|
|
@ -45,8 +45,6 @@ import com.yxt.anrui.oa.feign.message.MessageFlowVo; |
|
|
|
import com.yxt.anrui.oa.feign.message.MessageFlowableQuery; |
|
|
|
import com.yxt.anrui.oa.feign.portal.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.oa.feign.portal.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.oa.feign.portal.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.anrui.oa.feign.sysuser.SysUserFeign; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
@ -150,24 +148,19 @@ public class OaMendApplyService extends MybatisBaseService<OaMendApplyMapper, Oa |
|
|
|
ResultBean<String> rb = ResultBean.fireFail(); |
|
|
|
String sid = dto.getSid(); |
|
|
|
List<String> files = dto.getFiles(); |
|
|
|
|
|
|
|
if (StringUtils.isBlank(sid)) { |
|
|
|
// 新建操作
|
|
|
|
OaMendApply entity = new OaMendApply(); |
|
|
|
BeanUtil.copyProperties(dto, entity, "sid"); |
|
|
|
|
|
|
|
OaFormDto oaFormDto = new OaFormDto(); |
|
|
|
BeanUtil.copyProperties(dto, oaFormDto, "sid"); |
|
|
|
oaFormDto.setBillNo("BKSQ"); |
|
|
|
ResultBean<String> resultBean = oaFormService.saveOaForm(oaFormDto); |
|
|
|
|
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
entity.setFormSid(resultBean.getData()); |
|
|
|
baseMapper.insert(entity); |
|
|
|
|
|
|
|
// 处理附件
|
|
|
|
saveFiles(sid, files); |
|
|
|
sid = entity.getSid(); |
|
|
@ -176,6 +169,8 @@ public class OaMendApplyService extends MybatisBaseService<OaMendApplyMapper, Oa |
|
|
|
OaMendApply entity = fetchBySid(sid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
// 处理附件
|
|
|
|
saveFiles(sid, files); |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setData(sid); |
|
|
@ -183,23 +178,24 @@ public class OaMendApplyService extends MybatisBaseService<OaMendApplyMapper, Oa |
|
|
|
|
|
|
|
// 保存文件
|
|
|
|
private void saveFiles(String sid, List<String> files) { |
|
|
|
if (files == null || files.isEmpty()) { |
|
|
|
return; // 如果没有文件,不做任何操作
|
|
|
|
} |
|
|
|
oaAppendixService.deleteByLinkSid(sid); |
|
|
|
|
|
|
|
files.removeAll(Collections.singleton(null)); |
|
|
|
List<OaAppendix> oaAppendixList = new ArrayList<>(); |
|
|
|
if (!files.isEmpty()) { |
|
|
|
for (String file : files) { |
|
|
|
String filePath = file.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
OaAppendix oaAppendix = new OaAppendix(); |
|
|
|
oaAppendix.setLinkSid(sid); |
|
|
|
oaAppendix.setAttachType(OaFileEnum.OAMENDAPPLY.getAttachType()); |
|
|
|
oaAppendix.setFilePath(filePath); |
|
|
|
oaAppendixService.save(oaAppendix); |
|
|
|
oaAppendixList.add(oaAppendix); |
|
|
|
} |
|
|
|
} |
|
|
|
oaAppendixService.saveOrUpdateFile(sid, oaAppendixList); |
|
|
|
|
|
|
|
public OaMendApplyDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
|
OaMendApplyDetailsVo vo = baseMapper.fetchDetailsVoBySid(sid); |
|
|
|
} |
|
|
|
|
|
|
|
public OaMendApplyVo fetchDetailsVoBySid(String sid) { |
|
|
|
OaMendApplyVo vo = baseMapper.fetchDetailsVoBySid(sid); |
|
|
|
List<OaAppendix> oaAppendices = oaAppendixService.fetchByLinkSid(sid); |
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
for (OaAppendix oaAppendix : oaAppendices) { |
|
|
@ -335,10 +331,4 @@ public class OaMendApplyService extends MybatisBaseService<OaMendApplyMapper, Oa |
|
|
|
delBySids(sids); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public OaMendApplyInitVo init(String sid, String orgPath) { |
|
|
|
OaMendApplyInitVo oaMendApplyInitVo = baseMapper.init(sid); |
|
|
|
oaMendApplyInitVo.setOrgPath(orgPath); |
|
|
|
return oaMendApplyInitVo; |
|
|
|
} |
|
|
|
} |