|
|
@ -1,10 +1,13 @@ |
|
|
|
package com.yxt.anrui.base.biz.basedistributor; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
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.basedistributor.*; |
|
|
|
import com.yxt.anrui.base.api.basedistributor.app.*; |
|
|
|
import com.yxt.anrui.base.api.basedistributor.flow.*; |
|
|
|
import com.yxt.anrui.base.api.basedistributorappendix.BaseDistributorAppendix; |
|
|
|
import com.yxt.anrui.base.api.basedistributorappendix.BaseDistributorAppendixDto; |
|
|
|
import com.yxt.anrui.base.api.basedistributorappendix.BaseDistributorAppendixVo; |
|
|
@ -19,11 +22,22 @@ import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempListQuery; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempListVo; |
|
|
|
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingBillListVo; |
|
|
|
import com.yxt.anrui.fin.api.fincompanyinvoicing.FinCompanyInvoicingFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowProcessMapQuery; |
|
|
|
import com.yxt.anrui.flowable.api.flow.FlowableFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flow.UpdateFlowFieldVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskFeign; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.FlowTaskVo; |
|
|
|
import com.yxt.anrui.flowable.api.flowtask.LatestTaskVo; |
|
|
|
import com.yxt.anrui.flowable.api.utils.ProcDefEnum; |
|
|
|
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationVo; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.UserRoleQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfinpolicyrecordapply.LoanFinPolicyRecordApply; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
@ -31,11 +45,16 @@ import com.yxt.common.base.utils.StringUtils; |
|
|
|
import com.yxt.common.core.query.PagerQuery; |
|
|
|
import com.yxt.common.core.result.ResultBean; |
|
|
|
import com.yxt.common.core.vo.PagerVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowableQuery; |
|
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: anrui-base(安瑞基础信息模块) <br/> |
|
|
@ -71,6 +90,12 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
private CrmCustomerTempFeign crmCustomerTempFeign; |
|
|
|
@Autowired |
|
|
|
private FinCompanyInvoicingFeign finCompanyInvoicingFeign; |
|
|
|
@Autowired |
|
|
|
private FlowableFeign flowableFeign; |
|
|
|
@Autowired |
|
|
|
private MessageFeign messageFeign; |
|
|
|
@Autowired |
|
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
|
|
|
|
/** |
|
|
|
* 经销商分页列表 |
|
|
@ -156,6 +181,7 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
qw.apply(StringUtils.isNotBlank(setUpStartTime), "date_format (bd.setUpTime,'%Y-%m-%d') >= date_format('" + setUpStartTime + "','%Y-%m-%d')"). |
|
|
|
apply(StringUtils.isNotBlank(setUpEndTime), "date_format (bd.setUpTime,'%Y-%m-%d') <= date_format('" + setUpEndTime + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
qw.orderByDesc("bd.createTime"); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
@ -219,6 +245,19 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
BaseDistributorVo baseDistributorVo = baseMapper.selBySid(sid); |
|
|
|
BeanUtil.copyProperties(baseDistributorVo, baseDistributorDetailsVo); |
|
|
|
baseDistributorDetailsVo.setSid(sid); |
|
|
|
BaseDistributor baseDistributor = fetchBySid(sid); |
|
|
|
if (StringUtils.isNotBlank(baseDistributor.getCreateBySid())) { |
|
|
|
baseDistributorDetailsVo.setUserSid(baseDistributor.getCreateBySid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(baseDistributor.getOrgSidPath())) { |
|
|
|
baseDistributorDetailsVo.setOrgSidPath(baseDistributor.getOrgSidPath()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(baseDistributor.getTaskId())) { |
|
|
|
baseDistributorDetailsVo.setTaskId(baseDistributor.getTaskId()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(baseDistributor.getProcInstId())) { |
|
|
|
baseDistributorDetailsVo.setProcInsId(baseDistributor.getProcInstId()); |
|
|
|
} |
|
|
|
List<BaseDistributorStaffVo> baseDistributorStaffVo = baseDistributorStaffService.selbyDistributorSid(sid); |
|
|
|
baseDistributorDetailsVo.setPerList(baseDistributorStaffVo); |
|
|
|
String[] split = s.split(","); |
|
|
@ -308,17 +347,19 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
List<BaseDistributorAppendixDto> qtzlList = dto.getQtzlList(); |
|
|
|
List<BaseDistributorStaffDto> perList = dto.getPerList(); |
|
|
|
int count = selectNumCode(registNum); |
|
|
|
if (count > 0) { |
|
|
|
return rb.fail().setMsg("保存失败,统一社会信用代码已存在"); |
|
|
|
} |
|
|
|
if (registNum.length() != 18 && registNum.length() != 9) { |
|
|
|
return ResultBean.fireFail().setMsg("统一信用社会代码应为9位或18位"); |
|
|
|
} |
|
|
|
// if (count > 0) {
|
|
|
|
// return rb.fail().setMsg("保存失败,统一社会信用代码已存在");
|
|
|
|
// }
|
|
|
|
// if (registNum.length() != 18 && registNum.length() != 9) {
|
|
|
|
// return rb.fireFail().setMsg("统一信用社会代码应为9位或18位");
|
|
|
|
// }
|
|
|
|
/*if (new Date().before(dto.getSetUpTime())) { |
|
|
|
return rb.setMsg("成立时间不能晚于当前时间"); |
|
|
|
}*/ |
|
|
|
BaseDistributor baseDistributor = new BaseDistributor(); |
|
|
|
BeanUtil.copyProperties(dto, baseDistributor); |
|
|
|
BeanUtil.copyProperties(dto, baseDistributor, "id", "sid"); |
|
|
|
baseDistributor.setCreateBySid(dto.getUserSid()); |
|
|
|
baseDistributor.setNodeState("待提交"); |
|
|
|
String pDistributorName = baseDistributor.getPDistributorName(); |
|
|
|
if (pDistributorName.equals("无")) { |
|
|
|
baseDistributor.setDisLevelKey("0001"); |
|
|
@ -414,7 +455,8 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
return rb.setMsg("其他资料附件保存失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setMsg("保存成功"); |
|
|
|
String entitySid = baseDistributor.getSid(); |
|
|
|
return rb.success().setData(entitySid).setMsg("保存成功"); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean updateAll(BaseDistributorDto dto, String sid) { |
|
|
@ -606,6 +648,28 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
qw.orderByDesc("bd.id"); |
|
|
|
} |
|
|
|
IPage<BaseDistributorsVo> pagging = baseMapper.getDistributorListOne(page, qw); |
|
|
|
List<BaseDistributorsVo> records = pagging.getRecords(); |
|
|
|
records.removeAll(Collections.singleton(null)); |
|
|
|
if (!records.isEmpty()) { |
|
|
|
for (BaseDistributorsVo record : records) { |
|
|
|
record.setUpdateBtn(false); |
|
|
|
if (StringUtils.isNotBlank(record.getState())) { |
|
|
|
if (record.getState().equals("已办结")) { |
|
|
|
record.setState("备案通过"); |
|
|
|
} |
|
|
|
if (record.getState().equals("终止")) { |
|
|
|
record.setState("备案未通过"); |
|
|
|
} |
|
|
|
if (record.getState().equals("待提交")) { |
|
|
|
record.setState("未备案"); |
|
|
|
record.setUpdateBtn(true); |
|
|
|
} |
|
|
|
} else { |
|
|
|
record.setState("未备案"); |
|
|
|
record.setUpdateBtn(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
PagerVo<BaseDistributorsVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
@ -617,6 +681,12 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
return rb.setMsg("该经销商不存在"); |
|
|
|
} |
|
|
|
BaseDisDetailsVo vo = new BaseDisDetailsVo(); |
|
|
|
if (StringUtils.isNotBlank(baseDistributor.getTaskId())) { |
|
|
|
vo.setTaskId(baseDistributor.getTaskId()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(baseDistributor.getProcInstId())) { |
|
|
|
vo.setProcInstId(baseDistributor.getProcInstId()); |
|
|
|
} |
|
|
|
BaseInfoVo baseInfoVo = baseMapper.getDistributorDetail(sid); |
|
|
|
vo.setBaseInfo(baseInfoVo); |
|
|
|
//开票信息
|
|
|
@ -647,6 +717,12 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
return rb.setMsg("该经销商不存在"); |
|
|
|
} |
|
|
|
BaseDistribuDeailVo vo = new BaseDistribuDeailVo(); |
|
|
|
if (StringUtils.isNotBlank(baseDistributor.getTaskId())) { |
|
|
|
vo.setTaskId(baseDistributor.getTaskId()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(baseDistributor.getProcInstId())) { |
|
|
|
vo.setProcInstId(baseDistributor.getProcInstId()); |
|
|
|
} |
|
|
|
//查询基础信息是否已完善
|
|
|
|
BaseDistributor distributor = baseMapper.selectBySid(sid); |
|
|
|
if (distributor != null) { |
|
|
@ -678,6 +754,9 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
if (baseDistributor == null) { |
|
|
|
return rb.setMsg("该数据不存在"); |
|
|
|
} |
|
|
|
if (!baseDistributor.getNodeState().equals("待提交")) { |
|
|
|
return rb.setMsg("删除的数据中包含已经提交审批的数据,删除失败"); |
|
|
|
} |
|
|
|
baseDistributorAppendixService.delByLinkSid(sid); |
|
|
|
baseDistributorStaffService.deleteStaff(sid); |
|
|
|
deleteBySid(sid); |
|
|
@ -740,11 +819,13 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
BaseDistributor baseDistributor = new BaseDistributor(); |
|
|
|
BeanUtil.copyProperties(dto, baseDistributor, "sid"); |
|
|
|
baseDistributor.setCreateBySid(userSid); |
|
|
|
baseDistributor.setOrgSidPath(orgPath); |
|
|
|
if (StringUtils.isBlank(orgPath)) { |
|
|
|
orgPath = sysStaffOrgFeign.getPathSidByUserSid(userSid).getData(); |
|
|
|
} else { |
|
|
|
orgPath = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData(); |
|
|
|
} |
|
|
|
baseDistributor.setNodeState("待提交"); |
|
|
|
//验证该分公司的经销商名称是否重复
|
|
|
|
BaseDistributor baseDistributor1 = baseMapper.selectNameByOne(orgPath, baseDistributor.getDisName()); |
|
|
|
if (baseDistributor1 != null) { |
|
|
@ -974,4 +1055,613 @@ public class BaseDistributorService extends MybatisBaseService<BaseDistributorMa |
|
|
|
} |
|
|
|
return rb.success().setData(appDisAndCustms); |
|
|
|
} |
|
|
|
//-------------------------------------流程------------------------------------------------/
|
|
|
|
|
|
|
|
/** |
|
|
|
* 判断提交的流程是否被允许 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private synchronized int submitBusinessData(SubmitBaseDistributorApplyDto dto, BaseDistributor baseDistributor) { |
|
|
|
int r = 0; |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(dto.getSid())) { |
|
|
|
r = 1; |
|
|
|
} else { |
|
|
|
if (baseDistributor != null) { |
|
|
|
String businessTaskId = baseDistributor.getTaskId(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(businessTaskId) && org.apache.commons.lang3.StringUtils.isBlank(dto.getTaskId())) { |
|
|
|
//新提交
|
|
|
|
r = 1; |
|
|
|
} else if (org.apache.commons.lang3.StringUtils.isNotBlank(businessTaskId) && businessTaskId.equals(dto.getTaskId())) { |
|
|
|
//二次提交//只有数据一致的时候才能进行下一步
|
|
|
|
r = 2; |
|
|
|
} |
|
|
|
} else { |
|
|
|
r = 3; |
|
|
|
} |
|
|
|
} |
|
|
|
return r; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 提交备案申请 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean submitRecordApplication(SubmitBaseDistributorApplyDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
BaseDistributor baseDistributor = fetchBySid(dto.getSid()); |
|
|
|
int r = submitBusinessData(dto, baseDistributor); |
|
|
|
if (r == 3) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
if (r == 0) { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
|
|
|
|
String businessSid = ""; |
|
|
|
//新增修改保存
|
|
|
|
if (StringUtils.isNotBlank(dto.getSid())) { |
|
|
|
ResultBean resultBean = updateAll(dto, dto.getSid()); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
businessSid = dto.getSid(); |
|
|
|
} else { |
|
|
|
ResultBean<String> resultBean = saveAll(dto); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
businessSid = resultBean.getData(); |
|
|
|
} |
|
|
|
BaseDistributor entity = fetchBySid(businessSid); |
|
|
|
String orgSidPath = ""; |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(entity.getOrgSidPath())) { |
|
|
|
orgSidPath = entity.getOrgSidPath(); |
|
|
|
} else { |
|
|
|
SysUserVo data = sysUserFeign.fetchBySid(entity.getCreateBySid()).getData(); |
|
|
|
if (null != data) { |
|
|
|
//根据staffSid获取用户的组织全路径
|
|
|
|
ResultBean<SysStaffOrg> staffOrgResultBean = sysStaffOrgFeign.getOrgByStaffSid(data.getStaffSid()); |
|
|
|
if (!staffOrgResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(staffOrgResultBean.getMsg()); |
|
|
|
} |
|
|
|
//用户的组织全路径
|
|
|
|
orgSidPath = staffOrgResultBean.getData().getOrgSidPath(); |
|
|
|
} |
|
|
|
} |
|
|
|
List<String> orgPathList = Arrays.asList(orgSidPath.split("/")); |
|
|
|
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(orgPathList.get(orgPathList.size() - 1)).getData(); |
|
|
|
if (sysOrganization == null) { |
|
|
|
return rb.setMsg("当前所在的组织机构不存在"); |
|
|
|
} |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(sysOrganization.getManagerSid())) { |
|
|
|
// return rb.setMsg("当前所在的组织机构未设置主管人员");
|
|
|
|
sysOrganization.setManagerSid(ProcDefEnum.DEFAUL_TADMIN_SID.getProDefId()); |
|
|
|
} |
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
//流程中的参数赋值
|
|
|
|
Map<String, Object> variables = BeanUtil.beanToMap(dto); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
appMap.put("distributorSid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
BaseDistributor baseDistributor1 = fetchBySid(businessSid); |
|
|
|
String msgBusinessSid = baseDistributor1.getSid(); |
|
|
|
//用户的部门全路径sid
|
|
|
|
bv.setOrgSidPath(baseDistributor1.getOrgSidPath()); |
|
|
|
//业务sid
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
//用户sid
|
|
|
|
bv.setUserSid(dto.getUserSid()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
String nextNodeUserSids_ = sysOrganization.getManagerSid(); |
|
|
|
bv.setNextNodeUserSids(nextNodeUserSids_); |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.DEALERFILINGAPPLY.getProDefId()); |
|
|
|
if (r == 1) { |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.DEALERFILINGAPPLY.getProDefId()); |
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowableFeign.startProcess(bv); |
|
|
|
if (!voResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(voResultBean.getMsg()); |
|
|
|
} |
|
|
|
UpdateFlowFieldVo ufVo = voResultBean.getData(); |
|
|
|
int i = updateFlowFiled(BeanUtil.beanToMap(ufVo)); |
|
|
|
if (i > 0) { |
|
|
|
//修改备案状态
|
|
|
|
BaseDistributor distributor = fetchBySid(businessSid); |
|
|
|
distributor.setState(3); |
|
|
|
baseMapper.updateById(distributor); |
|
|
|
} |
|
|
|
//==================================添加线程
|
|
|
|
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(() -> { |
|
|
|
//极光推送
|
|
|
|
// busVehicleApply.set(fetchBySid(businessSid))
|
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(msgBusinessSid); |
|
|
|
messageFlowableQuery.setModuleName("经销商备案"); |
|
|
|
SysUserVo userVo = sysUserFeign.fetchBySid(baseDistributor1.getCreateBySid()).getData(); |
|
|
|
if (userVo != null) { |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(userVo.getName())) { |
|
|
|
messageFlowableQuery.setMsgContent(userVo.getName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
} |
|
|
|
} |
|
|
|
messageFlowableQuery.setMsgTitle("经销商备案"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
//==================================添加线程
|
|
|
|
return voResultBean; |
|
|
|
} |
|
|
|
if (r == 2) { |
|
|
|
// ToDo:驳回到发起人后再次提交
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(dto.getInstanceId())) { |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
BaseDistributor baseDistributor2 = fetchBySid(dto.getSid()); |
|
|
|
bv.setTaskId(dto.getTaskId()); |
|
|
|
bv.setTaskDefKey(baseDistributor2.getNodeSid()); |
|
|
|
bv.setComment("重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|
} |
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新流程相关的状态 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private int updateFlowFiled(Map<String, Object> map) { |
|
|
|
return baseMapper.updateFlowFiled(map); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean complete(BusinessVariables bv) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = bv.getBusinessSid(); |
|
|
|
BaseDistributor baseDistributor = this.fetchBySid(businessSid); |
|
|
|
if (bv.getTaskId().equals(baseDistributor.getTaskId())) { |
|
|
|
bv.setOrgSidPath(baseDistributor.getOrgSidPath()); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.handleProsess(bv); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
int i = updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
if ("Event_end".equals(resultBean.getData().getTaskDefKey())) { |
|
|
|
BaseDistributor entity = fetchBySid(businessSid); |
|
|
|
entity.setState(2); |
|
|
|
entity.setClosingDate(new Date()); |
|
|
|
//办结日期
|
|
|
|
baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//-----------------------------------------移动端流程-----------------------------------------------/
|
|
|
|
|
|
|
|
/** |
|
|
|
* 移动端判断提交的流程是否被允许 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private synchronized int appSubmitBusinessData(AppSubmitDistributorApplyDto dto, BaseDistributor baseDistributor) { |
|
|
|
int r = 0; |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(dto.getDistributorSid())) { |
|
|
|
r = 1; |
|
|
|
} else { |
|
|
|
if (baseDistributor != null) { |
|
|
|
String businessTaskId = baseDistributor.getTaskId(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(businessTaskId) && org.apache.commons.lang3.StringUtils.isBlank(dto.getTaskId())) { |
|
|
|
//新提交
|
|
|
|
r = 1; |
|
|
|
} else if (org.apache.commons.lang3.StringUtils.isNotBlank(businessTaskId) && businessTaskId.equals(dto.getTaskId())) { |
|
|
|
//二次提交//只有数据一致的时候才能进行下一步
|
|
|
|
r = 2; |
|
|
|
} |
|
|
|
} else { |
|
|
|
r = 3; |
|
|
|
} |
|
|
|
} |
|
|
|
return r; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean submitDistributor(AppSubmitDistributorApplyDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = dto.getDistributorSid(); |
|
|
|
BaseDistributor baseDistributor = fetchBySid(businessSid); |
|
|
|
int r = appSubmitBusinessData(dto, baseDistributor); |
|
|
|
if (r == 3) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
if (r == 0) { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
//-----------判断开票信息是否完事是否可以提交------------------------
|
|
|
|
BaseInvoiceInfoVo invoiceInfoVo = getDistributorInvoiceInfo(businessSid).getData(); |
|
|
|
if (null == invoiceInfoVo) { |
|
|
|
return rb.setMsg("请完善开票信息"); |
|
|
|
} else { |
|
|
|
if (StringUtils.isBlank(invoiceInfoVo.getInvoPhone()) |
|
|
|
|| StringUtils.isBlank(invoiceInfoVo.getInvoBank()) |
|
|
|
|| StringUtils.isBlank(invoiceInfoVo.getInvoBankNum()) |
|
|
|
|| StringUtils.isBlank(invoiceInfoVo.getRegistNum()) |
|
|
|
|| StringUtils.isBlank(invoiceInfoVo.getRegistDetailAddress()) |
|
|
|
) { |
|
|
|
return rb.setMsg("请完善开票信息"); |
|
|
|
} |
|
|
|
} |
|
|
|
//------------------------------------------------------------
|
|
|
|
BaseDistributor entity = fetchBySid(businessSid); |
|
|
|
String orgSidPath = ""; |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(entity.getOrgSidPath())) { |
|
|
|
orgSidPath = baseDistributor.getOrgSidPath(); |
|
|
|
} else { |
|
|
|
SysUserVo data = sysUserFeign.fetchBySid(entity.getCreateBySid()).getData(); |
|
|
|
if (null != data) { |
|
|
|
//根据staffSid获取用户的组织全路径
|
|
|
|
ResultBean<SysStaffOrg> staffOrgResultBean = sysStaffOrgFeign.getOrgByStaffSid(data.getStaffSid()); |
|
|
|
if (!staffOrgResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(staffOrgResultBean.getMsg()); |
|
|
|
} |
|
|
|
//用户的组织全路径
|
|
|
|
orgSidPath = staffOrgResultBean.getData().getOrgSidPath(); |
|
|
|
} |
|
|
|
} |
|
|
|
List<String> orgPathList = Arrays.asList(orgSidPath.split("/")); |
|
|
|
SysOrganizationVo sysOrganization = sysOrganizationFeign.fetchBySid(orgPathList.get(orgPathList.size() - 1)).getData(); |
|
|
|
if (sysOrganization == null) { |
|
|
|
return rb.setMsg("当前所在的组织机构不存在"); |
|
|
|
} |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(sysOrganization.getManagerSid())) { |
|
|
|
// return rb.setMsg("当前所在的组织机构未设置主管人员");
|
|
|
|
sysOrganization.setManagerSid(ProcDefEnum.DEFAUL_TADMIN_SID.getProDefId()); |
|
|
|
} |
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
//流程中的参数赋值
|
|
|
|
Map<String, Object> variables = BeanUtil.beanToMap(dto); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
appMap.put("distributorSid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
BaseDistributor baseDistributor1 = fetchBySid(businessSid); |
|
|
|
String msgBusinessSid = baseDistributor1.getSid(); |
|
|
|
//用户的部门全路径sid
|
|
|
|
bv.setOrgSidPath(baseDistributor1.getOrgSidPath()); |
|
|
|
//业务sid
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
//用户sid
|
|
|
|
bv.setUserSid(baseDistributor1.getCreateBySid()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
String nextNodeUserSids_ = sysOrganization.getManagerSid(); |
|
|
|
bv.setNextNodeUserSids(nextNodeUserSids_); |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.DEALERFILINGAPPLY.getProDefId()); |
|
|
|
if (r == 1) { |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.DEALERFILINGAPPLY.getProDefId()); |
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowableFeign.startProcess(bv); |
|
|
|
if (!voResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(voResultBean.getMsg()); |
|
|
|
} |
|
|
|
UpdateFlowFieldVo ufVo = voResultBean.getData(); |
|
|
|
int i = updateFlowFiled(BeanUtil.beanToMap(ufVo)); |
|
|
|
if (i > 0) { |
|
|
|
//修改备案状态
|
|
|
|
BaseDistributor updateState = fetchBySid(businessSid); |
|
|
|
updateState.setState(3); |
|
|
|
baseMapper.updateById(updateState); |
|
|
|
} |
|
|
|
//==================================添加线程
|
|
|
|
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(() -> { |
|
|
|
//极光推送
|
|
|
|
// busVehicleApply.set(fetchBySid(businessSid))
|
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(msgBusinessSid); |
|
|
|
messageFlowableQuery.setModuleName("经销商备案"); |
|
|
|
SysUserVo userVo = sysUserFeign.fetchBySid(baseDistributor1.getCreateBySid()).getData(); |
|
|
|
if (userVo != null) { |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(userVo.getName())) { |
|
|
|
messageFlowableQuery.setMsgContent(userVo.getName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
} |
|
|
|
} |
|
|
|
messageFlowableQuery.setMsgTitle("经销商备案"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
}); |
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
//==================================添加线程
|
|
|
|
return voResultBean; |
|
|
|
} |
|
|
|
if (r == 2) { |
|
|
|
// ToDo:驳回到发起人后再次提交
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(dto.getInstanceId())) { |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
bv.setTaskId(baseDistributor.getTaskId()); |
|
|
|
bv.setTaskDefKey(baseDistributor.getNodeSid()); |
|
|
|
bv.setComment("重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|
} |
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 分公司跨风控办理 |
|
|
|
* |
|
|
|
* @param bv |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean companyToDivisionOperate(BusinessVariables bv) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
BaseDistributor baseDistributor = fetchBySid(bv.getBusinessSid()); |
|
|
|
bv.setOrgSidPath(baseDistributor.getOrgSidPath()); |
|
|
|
Map<String, Object> variables = bv.getFormVariables(); |
|
|
|
baseDistributor = fetchBySid(bv.getBusinessSid()); |
|
|
|
FlowProcessMapQuery flowProcessMapQuery = new FlowProcessMapQuery(); |
|
|
|
flowProcessMapQuery.setProDefKey(baseDistributor.getProcDefId()); |
|
|
|
flowProcessMapQuery.setVariables(variables); |
|
|
|
variables = flowableFeign.getMap(flowProcessMapQuery).getData(); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
//=======================================
|
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<GetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), GetNodeVo.class)).collect(Collectors.toList()); |
|
|
|
List<String> candidateGroups = voList.get(0).getCandidateGroups(); |
|
|
|
UserRoleQuery userRoleQuery = new UserRoleQuery(); |
|
|
|
userRoleQuery.setRoleSid(candidateGroups.get(0)); |
|
|
|
List<SysUserVo> sysUserVos = sysUserFeign.getOtherOrgRoleUser(userRoleQuery).getData(); |
|
|
|
StringBuilder nextNodeUserSids = new StringBuilder(); |
|
|
|
if (sysUserVos.size() > 0) { |
|
|
|
for (SysUserVo sysUserVo : sysUserVos) { |
|
|
|
String sid = sysUserVo.getSid(); |
|
|
|
nextNodeUserSids.append(sid).append(","); |
|
|
|
} |
|
|
|
} |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(nextNodeUserSids)) { |
|
|
|
return rb.setMsg("下一环节暂无操作人员"); |
|
|
|
} |
|
|
|
String substring = nextNodeUserSids.substring(0, nextNodeUserSids.lastIndexOf(",")); |
|
|
|
bv.setNextNodeUserSids(substring); |
|
|
|
if (bv.getTaskId().equals(baseDistributor.getTaskId())) { |
|
|
|
variables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("distributorSid", bv.getBusinessSid()); |
|
|
|
variables.put("app", appMap); |
|
|
|
//========================================
|
|
|
|
baseDistributor = fetchBySid(bv.getBusinessSid()); |
|
|
|
flowProcessMapQuery = new FlowProcessMapQuery(); |
|
|
|
flowProcessMapQuery.setProDefKey(baseDistributor.getProcDefId()); |
|
|
|
flowProcessMapQuery.setVariables(variables); |
|
|
|
variables = flowableFeign.getMap(flowProcessMapQuery).getData(); |
|
|
|
//=======================================
|
|
|
|
bv.setFormVariables(variables); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean1 = flowableFeign.handleProsess(bv); |
|
|
|
if (!resultBean1.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean1.getMsg()); |
|
|
|
} |
|
|
|
UpdateFlowFieldVo ufVo = resultBean1.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean1.getData())); |
|
|
|
//极光推送
|
|
|
|
baseDistributor = fetchBySid(bv.getBusinessSid()); |
|
|
|
SysUserVo userVo = sysUserFeign.fetchBySid(baseDistributor.getCreateBySid()).getData(); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
messageFlowVo.setProcInsId(baseDistributor.getProcInstId()); |
|
|
|
messageFlowVo.setProcDefId(baseDistributor.getProcDefId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(bv.getBusinessSid()); |
|
|
|
messageFlowableQuery.setModuleName("经销商备案"); |
|
|
|
messageFlowableQuery.setMsgContent(userVo.getName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("经销商备案"); |
|
|
|
messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
return rb.success().setData(resultBean1.getData()); |
|
|
|
} else { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean revokeProcess(BaseDistributorTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
|
} |
|
|
|
BaseDistributor baseDistributor = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = baseDistributor.getTaskId(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(businessTaskId)) { |
|
|
|
if (businessTaskId.equals(query.getTaskId())) { |
|
|
|
FlowTaskVo flowTaskVo = new FlowTaskVo(); |
|
|
|
BeanUtil.copyProperties(query, flowTaskVo); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.revokeProcess(flowTaskVo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.setMsg("操作失败,提交的数据不一致!"); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean taskReject(BaseDistributorTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = query.getBusinessSid(); |
|
|
|
BaseDistributor baseDistributor = fetchBySid(businessSid); |
|
|
|
if (baseDistributor == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
String businessTaskId = baseDistributor.getTaskId(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(businessTaskId)) { |
|
|
|
if (businessTaskId.equals(query.getTaskId())) { |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(query.getComment())) { |
|
|
|
return rb.setMsg("请填写意见"); |
|
|
|
} |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
|
} |
|
|
|
FlowTaskVo flowTaskVo = new FlowTaskVo(); |
|
|
|
BeanUtil.copyProperties(query, flowTaskVo); |
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("distributorSid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
flowTaskVo.setValues(variables); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.taskReject(flowTaskVo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
UpdateFlowFieldVo ufVo = resultBean.getData(); |
|
|
|
Map<String, Object> map = BeanUtil.beanToMap(ufVo); |
|
|
|
//更新业务中的流程相关的参数
|
|
|
|
updateFlowFiled(map); |
|
|
|
//极光推送
|
|
|
|
baseDistributor = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
String procId = baseDistributor.getProcInstId(); |
|
|
|
messageFlowVo.setProcInsId(procId); |
|
|
|
messageFlowVo.setProcDefId(baseDistributor.getProcDefId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("经销商备案"); |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(procId); |
|
|
|
String nextName = listResultBean.getData().get(0).getName_(); |
|
|
|
String nextNodeUserSids = listResultBean.getData().get(0).getASSIGNEE_(); |
|
|
|
List<String> receiveSidList = Arrays.asList(nextNodeUserSids.split(",")); |
|
|
|
// if (receiveSidList.size() == 1 && receiveSidList.get(0).equals(busVehicleApply.getCreateBySid())) {
|
|
|
|
if ("发起申请".equals(nextName)) { |
|
|
|
messageFlowableQuery.setMsgContent("您提交的" + messageFlowableQuery.getModuleName() + "已被驳回,请重新提交"); |
|
|
|
} else { |
|
|
|
SysUserVo userVo = sysUserFeign.fetchBySid(baseDistributor.getCreateBySid()).getData(); |
|
|
|
if (userVo != null) { |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(userVo.getName())) { |
|
|
|
messageFlowableQuery.setMsgContent(userVo.getName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
messageFlowableQuery.setMsgTitle("经销商备案"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致!"); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean breakProcess(BaseDistributorTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(query.getInstanceId())) { |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
|
} |
|
|
|
if (org.apache.commons.lang3.StringUtils.isBlank(query.getComment())) { |
|
|
|
return rb.setMsg("请填写意见"); |
|
|
|
} |
|
|
|
BaseDistributor baseDistributor = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = baseDistributor.getTaskId(); |
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(businessTaskId)) { |
|
|
|
if (query.getUserSid().equals(baseDistributor.getCreateBySid())) { |
|
|
|
FlowTaskVo flowTaskVo = new FlowTaskVo(); |
|
|
|
BeanUtil.copyProperties(query, flowTaskVo); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.breakProcess(flowTaskVo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
Map<String, Object> map = BeanUtil.beanToMap(resultBean.getData()); |
|
|
|
updateFlowFiled(map); |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
|
if (businessTaskId.equals(query.getTaskId())) { |
|
|
|
FlowTaskVo flowTaskVo = new FlowTaskVo(); |
|
|
|
BeanUtil.copyProperties(query, flowTaskVo); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.breakProcess(flowTaskVo); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
Map<String, Object> map = BeanUtil.beanToMap(resultBean.getData()); |
|
|
|
updateFlowFiled(map); |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致!"); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean flowRecord(String procInsId) { |
|
|
|
return flowTaskFeign.businessFlowRecord(procInsId); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<GetNodeVo>> getNextNodesForSubmit(GetNodeQuery query) { |
|
|
|
ResultBean<List<GetNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
//根据业务sid查询排产信息
|
|
|
|
BaseDistributor baseDistributor = fetchBySid(query.getBusinessSid()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setModelId(baseDistributor.getProcDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<GetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), GetNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<GetNodeVo>> getPreviousNodesForReject(GetNodeQuery query) { |
|
|
|
ResultBean<List<GetNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
//根据业务sid查询排产信息
|
|
|
|
BaseDistributor baseDistributor = fetchBySid(query.getBusinessSid()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setModelId(baseDistributor.getProcDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getPreviousNodesForReject(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<GetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), GetNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
|
} |