|
|
@ -45,6 +45,8 @@ 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; |
|
|
@ -148,19 +150,24 @@ 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(); |
|
|
@ -180,7 +187,7 @@ public class OaMendApplyService extends MybatisBaseService<OaMendApplyMapper, Oa |
|
|
|
private void saveFiles(String sid, List<String> files) { |
|
|
|
files.removeAll(Collections.singleton(null)); |
|
|
|
List<OaAppendix> oaAppendixList = new ArrayList<>(); |
|
|
|
if (!files.isEmpty()) { |
|
|
|
if(!files.isEmpty()){ |
|
|
|
for (String file : files) { |
|
|
|
String filePath = file.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
OaAppendix oaAppendix = new OaAppendix(); |
|
|
@ -190,6 +197,7 @@ public class OaMendApplyService extends MybatisBaseService<OaMendApplyMapper, Oa |
|
|
|
oaAppendixList.add(oaAppendix); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
oaAppendixService.saveOrUpdateFile(sid, oaAppendixList); |
|
|
|
|
|
|
|
} |
|
|
@ -250,38 +258,7 @@ public class OaMendApplyService extends MybatisBaseService<OaMendApplyMapper, Oa |
|
|
|
bv.setNextNodeUserSids(organizationVo.getManagerSid()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
if (r == 1) { |
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowFeign.startProcess(bv); |
|
|
|
UpdateFlowFieldVo ufVo = voResultBean.getData(); |
|
|
|
OaFormFlowDto oaFormFlowDto = new OaFormFlowDto(); |
|
|
|
BeanUtil.copyProperties(ufVo, oaFormFlowDto); |
|
|
|
oaFormService.updateFlow(oaFormFlowDto); |
|
|
|
//==================================添加线程
|
|
|
|
try { |
|
|
|
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder() |
|
|
|
.setNameFormat("demo-pool-%d").build(); |
|
|
|
ExecutorService pool = new ThreadPoolExecutor(2, 100, |
|
|
|
0L, TimeUnit.MILLISECONDS, |
|
|
|
new LinkedBlockingQueue<Runnable>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy()); |
|
|
|
oaForm = oaFormService.fetchBySid(oaMendApply.getFormSid()); |
|
|
|
OaForm finalOaForm = oaForm; |
|
|
|
Future future1 = pool.submit(() -> { |
|
|
|
//极光推送
|
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName(finalOaForm.getFormType()); |
|
|
|
messageFlowableQuery.setMsgContent(finalOaForm.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle(finalOaForm.getFormType()); |
|
|
|
messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
//==================================添加线程
|
|
|
|
return voResultBean; |
|
|
|
return oaFormService.submit(bv); |
|
|
|
} |
|
|
|
if (r == 2) { |
|
|
|
// ToDo:驳回到发起人后再次提交
|
|
|
|