|
|
@ -1,11 +1,18 @@ |
|
|
|
package com.yxt.anrui.base.biz.commoncontract; |
|
|
|
|
|
|
|
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.basemodelmodprice.BaseModelModprice; |
|
|
|
import com.yxt.anrui.base.api.basemodelmodprice.flow.SubmitBaseModelModPriceDto; |
|
|
|
import com.yxt.anrui.base.api.commonappendix.CommonAppendix; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.*; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.AppSubmitContractInfoDto; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.CommonContractNodeQuery; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.CommonContractNodeVo; |
|
|
|
import com.yxt.anrui.base.api.commoncontract.flowable.CommonContractTaskQuery; |
|
|
|
import com.yxt.anrui.base.biz.basemodelszconfig.BaseModelSzconfigService; |
|
|
|
import com.yxt.anrui.base.biz.basetrailer.BaseTrailerService; |
|
|
|
import com.yxt.anrui.base.biz.basevehiclebrand.BaseVehicleBrandService; |
|
|
@ -25,12 +32,20 @@ import com.yxt.anrui.crm.api.crmcustomer.CrmCustomerFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomerfile.CrmCustomerFileFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempVo; |
|
|
|
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.sysformlink.SysFormLinkFeign; |
|
|
|
import com.yxt.anrui.flowable.api.sysformlink.SysFormStateVo; |
|
|
|
import com.yxt.anrui.flowable.api.utils.ProcDefEnum; |
|
|
|
import com.yxt.anrui.flowable.sqloperationsymbol.BusinessVariables; |
|
|
|
import com.yxt.anrui.portal.api.dictcommon.DictCommonFeign; |
|
|
|
import com.yxt.anrui.portal.api.dictcommon.DictCommonVo; |
|
|
|
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.sysstafforg.SysStaffOrgVo; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
@ -46,6 +61,9 @@ import com.yxt.common.base.utils.PagerUtil; |
|
|
|
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.commons.lang3.StringUtils; |
|
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -130,6 +148,12 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
private CrmCustomerTempFeign crmCustomerTempFeign; |
|
|
|
@Autowired |
|
|
|
private BusDepositFictitiousFeign busDepositFictitiousFeign; |
|
|
|
@Autowired |
|
|
|
private FlowableFeign flowableFeign; |
|
|
|
@Autowired |
|
|
|
private MessageFeign messageFeign; |
|
|
|
@Autowired |
|
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
|
|
|
|
private QueryWrapper<CommonContract> createQueryWrapper(CommonContractQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -962,8 +986,6 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
*/ |
|
|
|
public PagerVo<AppCommonContractPageVo> getContractList(PagerQuery<AppCommonContractQuery> pagerQuery) { |
|
|
|
AppCommonContractQuery query = pagerQuery.getParams(); |
|
|
|
String staffSid = sysUserFeign.getUserOrgInfoByUserSid(query.getUserSid()).getData().getStaffSid(); |
|
|
|
query.setStaffSid(staffSid); |
|
|
|
QueryWrapper<CommonContract> qw = appCreateQueryWrapper(query); |
|
|
|
IPage<CommonContract> page = PagerUtil.queryToPage(pagerQuery); |
|
|
|
IPage<AppCommonContractPageVo> iPage = baseMapper.getContractList(page, qw); |
|
|
@ -977,9 +999,9 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
QueryWrapper<CommonContract> qw = new QueryWrapper<>(); |
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getType())) { //合同类型
|
|
|
|
qw.eq("contractTypeKey", query.getType()); |
|
|
|
} |
|
|
|
// if (StringUtils.isNotBlank(query.getType())) { //合同类型
|
|
|
|
// qw.eq("contractTypeKey", query.getType());
|
|
|
|
// }
|
|
|
|
if (StringUtils.isNotBlank(query.getNames())) { // 甲方名称
|
|
|
|
qw.like("partyA", query.getNames()); |
|
|
|
} |
|
|
@ -989,8 +1011,11 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
if (StringUtils.isNotBlank(query.getNames())) { // 其他方名称
|
|
|
|
qw.like("partyC", query.getNames()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getStaffSid())) { // 业务员sid
|
|
|
|
qw.like("staffSid", query.getStaffSid()); |
|
|
|
if (StringUtils.isNotBlank(query.getUserSid())) { // 业务员sid
|
|
|
|
qw.eq("staffSid", query.getUserSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(query.getType())) { // 业务员sid
|
|
|
|
qw.eq("state", query.getType()); |
|
|
|
} |
|
|
|
return qw; |
|
|
|
} |
|
|
@ -1003,46 +1028,49 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public AppCommonContractInitVo getContractInfo(String contractSid, String userSid) { |
|
|
|
String staffSid = sysUserFeign.getUserOrgInfoByUserSid(userSid).getData().getStaffSid(); |
|
|
|
AppCommonContractInitVo vo = baseMapper.getContractInfo(contractSid, staffSid); |
|
|
|
AppCommonContractInitVo vo = baseMapper.getContractInfo(contractSid, userSid); |
|
|
|
String urlPrefix = fileUploadComponent.getUrlPrefix(); |
|
|
|
|
|
|
|
String[] split1 = vo.getAppdixUrl().split(","); |
|
|
|
List<String> contract = new ArrayList<>(); |
|
|
|
List<String> contractImages = Arrays.asList(split1); |
|
|
|
for (String contractImage : contractImages) { |
|
|
|
String contractImageUrl = urlPrefix + contractImage; |
|
|
|
contract.add(contractImageUrl); |
|
|
|
vo.setUserSid(userSid); |
|
|
|
if (StringUtils.isNotBlank(vo.getAppdixUrl())) { |
|
|
|
String[] split1 = vo.getAppdixUrl().split(","); |
|
|
|
List<String> contract = new ArrayList<>(); |
|
|
|
List<String> contractImages = Arrays.asList(split1); |
|
|
|
for (String contractImage : contractImages) { |
|
|
|
String contractImageUrl = urlPrefix + contractImage; |
|
|
|
contract.add(contractImageUrl); |
|
|
|
} |
|
|
|
vo.setContractImages(contract); |
|
|
|
} |
|
|
|
vo.setContractImages(contract); |
|
|
|
|
|
|
|
String[] split2 = vo.getSceneSignUrl().split(","); |
|
|
|
List<String> siteSig = new ArrayList<>(); |
|
|
|
List<String> siteSigImages = Arrays.asList(split2); |
|
|
|
for (String siteSigImage : siteSigImages) { |
|
|
|
String siteSigImagesUrl = urlPrefix + siteSigImage; |
|
|
|
siteSig.add(siteSigImagesUrl); |
|
|
|
if (StringUtils.isNotBlank(vo.getSceneSignUrl())) { |
|
|
|
String[] split2 = vo.getSceneSignUrl().split(","); |
|
|
|
List<String> siteSig = new ArrayList<>(); |
|
|
|
List<String> siteSigImages = Arrays.asList(split2); |
|
|
|
for (String siteSigImage : siteSigImages) { |
|
|
|
String siteSigImagesUrl = urlPrefix + siteSigImage; |
|
|
|
siteSig.add(siteSigImagesUrl); |
|
|
|
} |
|
|
|
vo.setSiteSigImages(siteSig); |
|
|
|
} |
|
|
|
vo.setSiteSigImages(siteSig); |
|
|
|
|
|
|
|
if (vo.getCustomerKey().equals("1")) { |
|
|
|
vo.setIdCardArchives(false); |
|
|
|
if (StringUtils.isNotBlank(vo.getSceneSignUrl())) { |
|
|
|
|
|
|
|
String[] split3 = vo.getSceneSignUrl().split(","); |
|
|
|
List<String> idCard = new ArrayList<>(); |
|
|
|
List<String> idCardImages = Arrays.asList(split3); |
|
|
|
for (String idCardImage : idCardImages) { |
|
|
|
String idCardImagesUrl = urlPrefix + idCardImage; |
|
|
|
idCard.add(idCardImagesUrl); |
|
|
|
if (StringUtils.isNotBlank(vo.getCustomerKey())) { |
|
|
|
if (vo.getCustomerKey().equals("1")) { |
|
|
|
vo.setIdCardArchives(false); |
|
|
|
if (StringUtils.isNotBlank(vo.getSceneSignUrl())) { |
|
|
|
|
|
|
|
String[] split3 = vo.getSceneSignUrl().split(","); |
|
|
|
List<String> idCard = new ArrayList<>(); |
|
|
|
List<String> idCardImages = Arrays.asList(split3); |
|
|
|
for (String idCardImage : idCardImages) { |
|
|
|
String idCardImagesUrl = urlPrefix + idCardImage; |
|
|
|
idCard.add(idCardImagesUrl); |
|
|
|
} |
|
|
|
vo.setIdCardImages(idCard); |
|
|
|
} else { |
|
|
|
vo.setIdCardImages(new ArrayList<>()); |
|
|
|
} |
|
|
|
vo.setIdCardImages(idCard); |
|
|
|
} else { |
|
|
|
vo.setIdCardImages(new ArrayList<>()); |
|
|
|
} |
|
|
|
} else if (vo.getCustomerKey().equals("2")) { |
|
|
|
vo.setIdCardArchives(true); |
|
|
|
} else if (vo.getCustomerKey().equals("2")) { |
|
|
|
vo.setIdCardArchives(true); |
|
|
|
// 往里添加客户档案里的身份证信息
|
|
|
|
} |
|
|
|
} |
|
|
|
return vo; |
|
|
|
} |
|
|
@ -1056,9 +1084,8 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean saveContractInfo(AppCrmCustomerFileDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
|
|
AppUserOrgInfoVo data = sysUserFeign.getUserOrgInfoByUserSid(dto.getUserSid()).getData(); |
|
|
|
CommonContract commonContract = new CommonContract(); |
|
|
|
CommonContract commonContract = fetchBySid(dto.getContractSid()); |
|
|
|
commonContract.setContractNo(dto.getContractId()); |
|
|
|
commonContract.setPrice(dto.getPrice()); |
|
|
|
commonContract.setNum(Integer.valueOf(dto.getNumber())); |
|
|
@ -1066,43 +1093,151 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
commonContract.setPartyB(dto.getPartyB()); |
|
|
|
commonContract.setContractAmount(dto.getContractPrice()); |
|
|
|
commonContract.setCustomerSid(dto.getCustomerSid()); |
|
|
|
commonContract.setStaffSid(data.getStaffSid()); |
|
|
|
commonContract.setStaffSid(dto.getUserSid()); |
|
|
|
commonContract.setStaffName(data.getStaffName()); |
|
|
|
commonContract.setOrgSid(data.getOrgSid()); |
|
|
|
String s1 = ""; |
|
|
|
String s2 = ""; |
|
|
|
String s3 = ""; |
|
|
|
if (dto.getContractImages().size() > 0) { |
|
|
|
if (dto.getContractImages() != null) { |
|
|
|
for (String contractImage : dto.getContractImages()) { |
|
|
|
if (contractImage.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
contractImage = contractImage.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
} |
|
|
|
s1 += contractImage + ","; |
|
|
|
commonContract.setAppdixUrl(s1.substring(0, s1.length() - 1)); |
|
|
|
} |
|
|
|
commonContract.setAppdixUrl(s1.substring(0, s1.length() - 1)); |
|
|
|
} |
|
|
|
|
|
|
|
if (dto.getContractImages().size() > 0) { |
|
|
|
if (dto.getContractImages() != null) { |
|
|
|
for (String siteSigImages : dto.getSiteSigImages()) { |
|
|
|
if (siteSigImages.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
siteSigImages = siteSigImages.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
} |
|
|
|
s2 += siteSigImages + ","; |
|
|
|
commonContract.setSceneSignUrl(s2.substring(0, s2.length() - 1)); |
|
|
|
} |
|
|
|
commonContract.setSceneSignUrl(s2.substring(0, s2.length() - 1)); |
|
|
|
} |
|
|
|
|
|
|
|
if (dto.getContractImages().size() > 0) { |
|
|
|
if (dto.getContractImages() != null) { |
|
|
|
for (String idCardImage : dto.getIdCardImages()) { |
|
|
|
if (idCardImage.indexOf(fileUploadComponent.getUrlPrefix()) > -1) { |
|
|
|
idCardImage = idCardImage.replace(fileUploadComponent.getUrlPrefix(), ""); |
|
|
|
} |
|
|
|
s3 += idCardImage + ","; |
|
|
|
commonContract.setIdImagesUrl(s3.substring(0, s3.length() - 1)); |
|
|
|
} |
|
|
|
} |
|
|
|
updateById(commonContract); |
|
|
|
return rb.success().setData(commonContract.getSid()); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean submitContractInfo(AppSubmitContractInfoDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
//根据用户sid获取staffSid
|
|
|
|
ResultBean<SysUserVo> userVoResultBean = sysUserFeign.fetchBySid(dto.getUserSid()); |
|
|
|
if (!userVoResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(userVoResultBean.getMsg()); |
|
|
|
} |
|
|
|
//根据staffSid获取用户的组织全路径
|
|
|
|
ResultBean<SysStaffOrg> orgByStaffSid = sysStaffOrgFeign.getOrgByStaffSid(userVoResultBean.getData().getStaffSid()); |
|
|
|
if (!orgByStaffSid.getSuccess()) { |
|
|
|
return rb.setMsg(orgByStaffSid.getMsg()); |
|
|
|
} |
|
|
|
//用户的组织全路径
|
|
|
|
String orgSidPath = orgByStaffSid.getData().getOrgSidPath(); |
|
|
|
CommonContract commonContract = fetchBySid(dto.getContractSid()); |
|
|
|
int r = submitBusinessData(dto, commonContract); |
|
|
|
if (r == 3) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
if (r == 0) { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
ResultBean<String> resultBean = saveContractInfo(dto); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
String businessSid = resultBean.getData(); |
|
|
|
baseMapper.updateBySidAndState(businessSid, "2"); |
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
//流程中的参数赋值
|
|
|
|
Map<String, Object> variables = BeanUtil.beanToMap(dto); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
//用户的部门全路径sid
|
|
|
|
bv.setOrgSidPath(orgSidPath); |
|
|
|
//业务sid
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
//用户sid
|
|
|
|
bv.setUserSid(dto.getUserSid()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
//若app移动端有此功能,则传递appMap参数
|
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
//需和移动端沟通业务sid保存的属性具体值:appMap中sid不是固定的。移动端提供具体字段。
|
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.CONTRACTAPPLY.getProDefId()); |
|
|
|
if (r == 1) { |
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowableFeign.startProcess(bv); |
|
|
|
UpdateFlowFieldVo ufVo = voResultBean.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(ufVo)); |
|
|
|
//极光推送
|
|
|
|
commonContract = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("合同审核申请"); |
|
|
|
messageFlowableQuery.setMsgContent(commonContract.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("业务"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
return voResultBean; |
|
|
|
} |
|
|
|
if (r == 2) { |
|
|
|
// ToDo:驳回到发起人后再次提交
|
|
|
|
if (StringUtils.isBlank(dto.getInstanceId())) { |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
commonContract.setIdImagesUrl(s3.substring(0, s3.length() - 1)); |
|
|
|
bv.setTaskId(commonContract.getTaskId()); |
|
|
|
bv.setTaskDefKey(commonContract.getNodeId()); |
|
|
|
bv.setComment(StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|
} |
|
|
|
save(commonContract); |
|
|
|
return rb.success(); |
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断提交的流程是否被允许 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private synchronized int submitBusinessData(AppSubmitContractInfoDto dto, CommonContract commonContract) { |
|
|
|
int r = 0; |
|
|
|
if (StringUtils.isBlank(dto.getContractSid())) { |
|
|
|
r = 1; |
|
|
|
} else { |
|
|
|
if (commonContract != null) { |
|
|
|
String businessTaskId = commonContract.getTaskId(); |
|
|
|
if (StringUtils.isBlank(businessTaskId) && StringUtils.isBlank(dto.getTaskId())) { |
|
|
|
//新提交
|
|
|
|
r = 1; |
|
|
|
} else if (StringUtils.isNotBlank(businessTaskId) && businessTaskId.equals(dto.getTaskId())) { |
|
|
|
//二次提交//只有数据一致的时候才能进行下一步
|
|
|
|
r = 2; |
|
|
|
} |
|
|
|
} else { |
|
|
|
r = 3; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return r; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<PrintConfirmVo>> printConfirm(PrintConfirmDto dto) { |
|
|
@ -1252,6 +1387,7 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
//签订日期、签订地点
|
|
|
|
//订金、合同金额
|
|
|
|
commonContract.setDeposit(new BigDecimal(depositTotal)); |
|
|
|
commonContract.setContractAmount(depositTotal); |
|
|
|
//合同附件
|
|
|
|
//身份证信息附件
|
|
|
|
//车型sid
|
|
|
@ -1287,4 +1423,183 @@ public class CommonContractService extends MybatisBaseService<CommonContractMapp |
|
|
|
String billNo = Rule.getBillNo(bill, i); |
|
|
|
return billNo; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean complete(BusinessVariables bv) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = bv.getBusinessSid(); |
|
|
|
CommonContract commonContract = fetchBySid(businessSid); |
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
if (bv.getTaskId().equals(commonContract.getTaskId())) { |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowableFeign.handleProsess(bv); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
UpdateFlowFieldVo ufVo = resultBean.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
if (!"Event_end".equals(resultBean.getData().getTaskDefKey())) { |
|
|
|
//极光推送
|
|
|
|
commonContract = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
ufVo.setProcInsId(commonContract.getProcInstId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("合同审核申请"); |
|
|
|
messageFlowableQuery.setMsgContent(commonContract.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("业务中心"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private int updateFlowFiled(Map<String, Object> map) { |
|
|
|
return baseMapper.updateFlowFiled(map); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<CommonContractNodeVo>> getPreviousNodesForReject(CommonContractNodeQuery query) { |
|
|
|
ResultBean<List<CommonContractNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setModelId(ProcDefEnum.CONTRACTAPPLY.getProDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getPreviousNodesForReject(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<CommonContractNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), CommonContractNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<CommonContractNodeVo>> getNextNodesForSubmit(CommonContractNodeQuery query) { |
|
|
|
ResultBean<List<CommonContractNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setModelId(ProcDefEnum.CONTRACTAPPLY.getProDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<CommonContractNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), CommonContractNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean taskReject(CommonContractTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = query.getBusinessSid(); |
|
|
|
CommonContract commonContract = fetchBySid(businessSid); |
|
|
|
if (commonContract == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
String businessTaskId = commonContract.getTaskId(); |
|
|
|
if (StringUtils.isNotBlank(businessTaskId)) { |
|
|
|
if (businessTaskId.equals(query.getTaskId())) { |
|
|
|
if (StringUtils.isBlank(query.getComment())) { |
|
|
|
return rb.setMsg("请填写意见"); |
|
|
|
} |
|
|
|
if (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("sid", 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); |
|
|
|
//极光推送
|
|
|
|
commonContract = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
String procId = commonContract.getProcInstId(); |
|
|
|
ufVo.setProcInsId(procId); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("合同审核申请"); |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(procId); |
|
|
|
String nextNodeUserSids = listResultBean.getData().get(0).getASSIGNEE_(); |
|
|
|
List<String> receiveSidList = Arrays.asList(nextNodeUserSids.split(",")); |
|
|
|
if (receiveSidList.size() == 1 && receiveSidList.get(0).equals(commonContract.getStaffSid())) { |
|
|
|
messageFlowableQuery.setMsgContent("您提交的" + messageFlowableQuery.getModuleName() + "已被驳回,请重新提交"); |
|
|
|
} else { |
|
|
|
messageFlowableQuery.setMsgContent(commonContract.getStaffName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
} |
|
|
|
messageFlowableQuery.setMsgTitle("业务中心"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致!"); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean revokeProcess(CommonContractTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
|
} |
|
|
|
CommonContract commonContract = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = commonContract.getTaskId(); |
|
|
|
if (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 breakProcess(CommonContractTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (StringUtils.isBlank(query.getInstanceId())) { |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(query.getComment())) { |
|
|
|
return rb.setMsg("请填写意见"); |
|
|
|
} |
|
|
|
CommonContract commonContract = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = commonContract.getTaskId(); |
|
|
|
if (StringUtils.isNotBlank(businessTaskId)) { |
|
|
|
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("操作失败!提交的数据不一致!"); |
|
|
|
} |
|
|
|
} |