|
|
@ -32,6 +32,7 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.yxt.anrui.base.api.basemanufacturer.BaseManufacturer; |
|
|
|
import com.yxt.anrui.base.api.baseoutsourcingapplication.*; |
|
|
|
import com.yxt.anrui.base.api.baseoutsourcingapplication.flow.GetNodeVo; |
|
|
@ -54,6 +55,7 @@ import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordDto; |
|
|
|
import com.yxt.anrui.fin.api.finpaymentrecord.FinPaymentrecordFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; |
|
|
|
import com.yxt.anrui.flowable.api.flow2.FlowFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.LatestTaskVo; |
|
|
|
import com.yxt.anrui.flowable.api.sysprourl.SysProUrlFeign; |
|
|
@ -74,6 +76,7 @@ import com.yxt.anrui.portal.api.sysuser.UserQuery; |
|
|
|
import com.yxt.anrui.portal.config.DictCommonType; |
|
|
|
import com.yxt.anrui.scm.api.scmvehicleexamine.ScmEntryVehicleExamineDto; |
|
|
|
import com.yxt.anrui.scm.api.scmvehicleexamine.ScmVehicleExamineFeign; |
|
|
|
import com.yxt.anrui.scm.api.scmvehiclegression.ScmVehicleGression; |
|
|
|
import com.yxt.anrui.scm.api.scmvehinspectitem.ScmVehinspectItemDto; |
|
|
|
import com.yxt.anrui.scm.api.scmvehinspectitem.ScmVehinspectItemFeign; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
@ -87,12 +90,14 @@ import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowableQuery; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -145,6 +150,8 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
private BaseManufacturerService baseManufacturerService; |
|
|
|
@Autowired |
|
|
|
private BaseVehicleBrandService baseVehicleBrandService; |
|
|
|
@Autowired |
|
|
|
private FlowFeign flowFeign; |
|
|
|
|
|
|
|
private QueryWrapper<BaseOutsourcingApplication> createQueryWrapper(BaseOutsourcingApplicationQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -420,22 +427,33 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
//如果taskid从业务的数据库中查询出来,那这个taskid 和当前的关系是什么 如果数据库中查询出来的taskid是第四个环节的id,但是目前是做的第一次的提交操作。
|
|
|
|
// 应该是也不允许走if 也不运行走else 那应该如何验证这个id是否允许走else呢?
|
|
|
|
// 取出来业务数据的taskid和前端传递的taskid作比较 来判断数据的是否有效 本质上是数据版本一致性的问题
|
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean1 = flowableFeign.startProcess(bv); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean1 = flowFeign.startProcess(bv); |
|
|
|
UpdateFlowFieldVo uff = resultBean1.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(uff)); |
|
|
|
//======================添加消息推送开始
|
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff, messageFlowVo); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("外采申请"); |
|
|
|
messageFlowableQuery.setMsgContent(baseOutsourcingApplication.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("外采申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
//极光推送
|
|
|
|
// String msgSid = getMessage(uff, appMap, baseOutsourcingApplication);
|
|
|
|
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()); |
|
|
|
Future future1 = pool.submit(() -> { |
|
|
|
//极光推送
|
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff, messageFlowVo); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("外采申请"); |
|
|
|
messageFlowableQuery.setMsgContent(baseOutsourcingApplication.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("外采申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|
//======================添加消息推送结束
|
|
|
|
return resultBean1; |
|
|
|
} |
|
|
@ -481,47 +499,68 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
if (StringUtils.isBlank(businessTaskid) && StringUtils.isBlank(dto.getTaskId())) { |
|
|
|
// 新提交 taskid都是空的
|
|
|
|
saveOrUpdateDto(dto);//update
|
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean1 = flowableFeign.startProcess(bv); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean1 = flowFeign.startProcess(bv); |
|
|
|
UpdateFlowFieldVo uff = resultBean1.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(uff)); |
|
|
|
//======================添加消息推送开始
|
|
|
|
BaseOutsourcingApplication baseOutsourcingApplication = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff, messageFlowVo); |
|
|
|
messageFlowVo.setProcInsId(baseOutsourcingApplication.getProcInstSid()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("外采申请"); |
|
|
|
messageFlowableQuery.setMsgContent(baseOutsourcingApplication.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("外采申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
//======================添加消息推送结束
|
|
|
|
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()); |
|
|
|
Future future1 = pool.submit(() -> { |
|
|
|
//极光推送
|
|
|
|
BaseOutsourcingApplication baseOutsourcingApplication = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff, messageFlowVo); |
|
|
|
messageFlowVo.setProcInsId(baseOutsourcingApplication.getProcInstSid()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("外采申请"); |
|
|
|
messageFlowableQuery.setMsgContent(baseOutsourcingApplication.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("外采申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return resultBean1; |
|
|
|
} else if (StringUtils.isNotBlank(businessTaskid) && businessTaskid.equals(dto.getTaskId())) {//只有数据一致的时候才能进行下一步
|
|
|
|
bv.setTaskDefKey(booad.getTaskDefKey()); |
|
|
|
bv.setComment(StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
ResultBean<UpdateFlowFieldVo> rb = flowableFeign.handleProsess(bv); |
|
|
|
ResultBean<UpdateFlowFieldVo> rb = flowFeign.handleProsess(bv); |
|
|
|
UpdateFlowFieldVo uff = rb.getData(); |
|
|
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(rb.getData()); |
|
|
|
updateFlowFiled(stringObjectMap); |
|
|
|
//======================添加消息推送开始
|
|
|
|
BaseOutsourcingApplication baseOutsourcingApplication = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff, messageFlowVo); |
|
|
|
messageFlowVo.setProcInsId(baseOutsourcingApplication.getProcInstSid()); |
|
|
|
messageFlowVo.setProcDefId(baseOutsourcingApplication.getProcDefId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("外采申请"); |
|
|
|
messageFlowableQuery.setMsgContent(baseOutsourcingApplication.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("外采申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
//======================添加消息推送结束
|
|
|
|
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()); |
|
|
|
Future future1 = pool.submit(() -> { |
|
|
|
//极光推送
|
|
|
|
BaseOutsourcingApplication baseOutsourcingApplication = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff, messageFlowVo); |
|
|
|
messageFlowVo.setProcInsId(baseOutsourcingApplication.getProcInstSid()); |
|
|
|
messageFlowVo.setProcDefId(baseOutsourcingApplication.getProcDefId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("外采申请"); |
|
|
|
messageFlowableQuery.setMsgContent(baseOutsourcingApplication.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("外采申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
return rb; |
|
|
|
} else { |
|
|
|
return ResultBean.fireFail().setMsg("操作失败,提交的数据不一致!"); |
|
|
@ -602,21 +641,30 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
//======================添加消息推送开始
|
|
|
|
UpdateFlowFieldVo uff = rb.getData(); |
|
|
|
BaseOutsourcingApplication baseOutsourcingApplication = fetchBySid(bv.getBusinessSid()); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff, messageFlowVo); |
|
|
|
messageFlowVo.setProcInsId(baseOutsourcingApplication.getProcInstSid()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(bv.getBusinessSid()); |
|
|
|
messageFlowableQuery.setModuleName("外采申请"); |
|
|
|
messageFlowableQuery.setMsgContent(baseOutsourcingApplication.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("外采申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
//======================添加消息推送结束
|
|
|
|
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()); |
|
|
|
Future future1 = pool.submit(() -> { |
|
|
|
UpdateFlowFieldVo uff = rb.getData(); |
|
|
|
BaseOutsourcingApplication baseOutsourcingApplication = fetchBySid(bv.getBusinessSid()); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff, messageFlowVo); |
|
|
|
messageFlowVo.setProcInsId(baseOutsourcingApplication.getProcInstSid()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(bv.getBusinessSid()); |
|
|
|
messageFlowableQuery.setModuleName("外采申请"); |
|
|
|
messageFlowableQuery.setMsgContent(baseOutsourcingApplication.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("外采申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return rb; |
|
|
@ -626,27 +674,9 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<UpdateFlowFieldVo> complete_handleProsess(BusinessVariables bv, BaseOutsourcingApplicationDto dto) { |
|
|
|
ResultBean<UpdateFlowFieldVo> rb = flowableFeign.handleProsess(bv); |
|
|
|
ResultBean<UpdateFlowFieldVo> rb = flowFeign.handleProsess(bv); |
|
|
|
Map<String, Object> stringObjectMap = BeanUtil.beanToMap(rb.getData()); |
|
|
|
updateFlowFiled(stringObjectMap); |
|
|
|
//消息推送===========开始
|
|
|
|
/* UpdateFlowFieldVo uff = rb.getData(); |
|
|
|
if (!"Event_end".equals(uff.getTaskDefKey())) { |
|
|
|
BaseOutsourcingApplication baseOutsourcingApplication = fetchBySid(bv.getBusinessSid()); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(uff,messageFlowVo); |
|
|
|
uff.setProcInsId(baseOutsourcingApplication.getProcInstSid()); |
|
|
|
uff.setProcDefId(baseOutsourcingApplication.getProcDefId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap((Map<String, Object>) bv.getFormVariables().get("app")); |
|
|
|
messageFlowableQuery.setBusinessSid(bv.getBusinessSid()); |
|
|
|
messageFlowableQuery.setModuleName("外采申请"); |
|
|
|
messageFlowableQuery.setMsgContent(baseOutsourcingApplication.getCreateByName()+"提交的"+messageFlowableQuery.getModuleName()+",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("供应链"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
}*/ |
|
|
|
//消息推送结束=====
|
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
@ -828,7 +858,6 @@ public class BaseOutsourcingApplicationService extends MybatisBaseService<BaseOu |
|
|
|
String nextNodeUserSids = listResultBean.getData().get(0).getASSIGNEE_(); |
|
|
|
String nextName = listResultBean.getData().get(0).getName_(); |
|
|
|
List<String> receiveSidList = Arrays.asList(nextNodeUserSids.split(",")); |
|
|
|
// if (receiveSidList.size() == 1 && receiveSidList.get(0).equals(baseOutsourcingApplication.getCreateBySid())) {
|
|
|
|
if ("发起申请".equals(nextName)) { |
|
|
|
messageFlowableQuery.setMsgContent("您提交的" + messageFlowableQuery.getModuleName() + "已被驳回,请重新提交"); |
|
|
|
} else { |
|
|
|