|
|
@ -27,14 +27,26 @@ package com.yxt.anrui.riskcenter.biz.loanbecollectionapply; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateUtil; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.yxt.anrui.base.common.utils.Rule; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrder; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesorder.BusSalesOrderFeign; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle; |
|
|
|
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign; |
|
|
|
import com.yxt.anrui.fin.api.finvehicleinvoice.FinVehicleInvoice; |
|
|
|
import com.yxt.anrui.fin.api.finvehicleinvoice.FinVehicleInvoiceFeign; |
|
|
|
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.flow2.FlowDelegateQuery; |
|
|
|
import com.yxt.anrui.flowable.api.flow2.FlowFeign; |
|
|
|
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.SysStaffOrgFeign; |
|
|
@ -42,12 +54,16 @@ import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionapply.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionapply.flowable.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionrecord.LoanBeCollectionRecordDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionrecord.LoanBeCollectionRecordVehInit; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbecollectionveh.LoanBeCollectionVehFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbepadsincereapply.LoanBePadsincereApply; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbepadsincereapply.LoanBePadsincereApplyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbepadsincereapply.flowable.LoanBePadsincereNodeVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbepadsincereapply.flowable.SubmitLoanBePadsincereDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFileEnum; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanhomevisitinvestigatecustomer.LoanHomevisitInvestigateCustomerDetailsVo; |
|
|
@ -59,6 +75,9 @@ import com.yxt.anrui.riskcenter.biz.loanhomevisitinvestigate.LoanHomevisitInvest |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanhomevisitinvestigatecustomer.LoanHomevisitInvestigateCustomerService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
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 com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
@ -70,6 +89,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
|
* Project: anrui-riskcenter(催收措施申请) <br/> |
|
|
@ -90,6 +110,8 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Autowired |
|
|
|
private SysStaffOrgFeign sysStaffOrgFeign; |
|
|
|
@Autowired |
|
|
|
private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign; |
|
|
|
@Autowired |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
@ -109,6 +131,14 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
private LoanFileService loanFileService; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Autowired |
|
|
|
private FlowableFeign flowableFeign; |
|
|
|
@Autowired |
|
|
|
private MessageFeign messageFeign; |
|
|
|
@Autowired |
|
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
@Autowired |
|
|
|
private FlowFeign flowFeign; |
|
|
|
|
|
|
|
private QueryWrapper<LoanBeCollectionApply> createQueryWrapper(LoanBeCollectionApplyQuery query) { |
|
|
|
// todo: 这里根据具体业务调整查询条件
|
|
|
@ -181,11 +211,23 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public void saveOrUpdateDto(LoanBeCollectionApplyDto dto) { |
|
|
|
public String saveOrUpdateDto(LoanBeCollectionApplyDto dto) { |
|
|
|
String dtoSid = dto.getSid(); |
|
|
|
List<LoanBeCollectionVehDto> loanBeCollectionVehDetails = dto.getLoanBeCollectionVehDetails(); |
|
|
|
List<LoanBeCollectionFileVo> files = dto.getFiles(); |
|
|
|
if (StringUtils.isBlank(dtoSid)) { |
|
|
|
//生成单据编号
|
|
|
|
String billNo = ""; |
|
|
|
String date = DateUtil.format(DateUtil.date(), "yyyyMM"); |
|
|
|
SysOrganizationVo sysOrganizationVo = sysOrganizationFeign.fetchBySid(dto.getUseOrgSid()).getData(); |
|
|
|
billNo = "CSCS" + sysOrganizationVo.getOrgCode() + date; |
|
|
|
String i = baseMapper.selectNum(billNo); |
|
|
|
if (StringUtils.isNotBlank(i)) { |
|
|
|
billNo = Rule.getBillNo(billNo, Integer.valueOf(i).intValue()); |
|
|
|
} else { |
|
|
|
billNo = Rule.getBillNo(billNo, 0); |
|
|
|
} |
|
|
|
dto.setBillNo(billNo); |
|
|
|
String sid = this.insertByDto(dto); |
|
|
|
if (files != null && files.size() > 0){ |
|
|
|
for (LoanBeCollectionFileVo file : files) { |
|
|
@ -218,7 +260,7 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return sid; |
|
|
|
} |
|
|
|
this.updateByDto(dto); |
|
|
|
loanFileService.delByLinkSidOrType(dtoSid,LoanFileEnum.BECOLLECTIONAPPLY.getAttachType()); |
|
|
@ -238,6 +280,7 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
loanBeCollectionVehService.delByMainSid(dtoSid); |
|
|
|
for (LoanBeCollectionVehDto loanBeCollectionVehDetail : loanBeCollectionVehDetails) { |
|
|
|
loanBeCollectionVehDetail.setMainSid(dtoSid); |
|
|
|
loanBeCollectionVehDetail.setSid(""); |
|
|
|
String sid = loanBeCollectionVehService.saveOrUpdateDto(loanBeCollectionVehDetail); |
|
|
|
List<LoanBeCollectionFileVo> hkxyFiles = loanBeCollectionVehDetail.getHkxyFiles(); |
|
|
|
if (hkxyFiles != null && hkxyFiles.size() > 0){ |
|
|
@ -254,6 +297,7 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return dtoSid; |
|
|
|
} |
|
|
|
|
|
|
|
public String insertByDto(LoanBeCollectionApplyDto dto) { |
|
|
@ -277,13 +321,23 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
} |
|
|
|
LoanBeCollectionApply entity = fetchBySid(dtoSid); |
|
|
|
BeanUtil.copyProperties(dto, entity, "id", "sid"); |
|
|
|
List<String> collMeasures = dto.getCollMeasures(); |
|
|
|
String collMeasureSpan = ""; |
|
|
|
for (String collMeasure : collMeasures) { |
|
|
|
collMeasureSpan = collMeasureSpan + collMeasure + ","; |
|
|
|
} |
|
|
|
entity.setCollMeasure(collMeasureSpan.substring(0, collMeasureSpan.lastIndexOf(","))); |
|
|
|
baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
|
|
|
|
public LoanBeCollectionApplyDetailsVo fetchDetailsVoBySid(String sid) { |
|
|
|
LoanBeCollectionApply entity = fetchBySid(sid); |
|
|
|
String collMeasure = entity.getCollMeasure(); |
|
|
|
String[] collMeasures = collMeasure.split(","); |
|
|
|
LoanBeCollectionApplyDetailsVo vo = new LoanBeCollectionApplyDetailsVo(); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
vo.setCreateTime(DateUtil.formatDate(entity.getCreateTime())); |
|
|
|
vo.setCollMeasures(Arrays.asList(collMeasures)); |
|
|
|
List<LoanFile> loanFiles = loanFileService.selectByLinkSid(sid, LoanFileEnum.BECOLLECTIONAPPLY.getAttachType()); |
|
|
|
List<LoanBeCollectionFileVo> loanBeCollectionFileVos = new ArrayList<>(); |
|
|
|
if (loanFiles != null && loanFiles.size() > 0){ |
|
|
@ -313,8 +367,8 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
} |
|
|
|
loanBeCollectionVehDetailsVo.setHkxyFiles(loanBeCollectionFileVos1); |
|
|
|
List<LoanBeCollectionVehFile> loanBeCollectionVehFiles = new ArrayList<>(); |
|
|
|
BusSalesOrder busSalesOrder = busSalesOrderFeign.fetchBySid(loanBeCollectionVehDetailsVo.getSaleVehSid()).getData(); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle1 = busSalesOrderVehicleFeign.details(loanBeCollectionVehDetailsVo.getSaleVehSid()).getData(); |
|
|
|
BusSalesOrder busSalesOrder = busSalesOrderFeign.fetchBySid(busSalesOrderVehicle1.getSalesOrderSid()).getData(); |
|
|
|
//催收记录sid
|
|
|
|
LoanBeCollectionVehFile loanBeCollectionVehFile1 = new LoanBeCollectionVehFile(); |
|
|
|
loanBeCollectionVehFile1.setName("催收记录"); |
|
|
@ -324,7 +378,7 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
FinVehicleInvoice finVehicleInvoice = finVehicleInvoiceFeign.selectByVinAndContractNo(busSalesOrderVehicle1.getLinkSid(), busSalesOrder.getContractNo()).getData(); |
|
|
|
LoanBeCollectionVehFile loanBeCollectionVehFile2 = new LoanBeCollectionVehFile(); |
|
|
|
loanBeCollectionVehFile2.setName("开票信息"); |
|
|
|
loanBeCollectionVehFile2.setSid(finVehicleInvoice.getSid()); |
|
|
|
//loanBeCollectionVehFile2.setSid(finVehicleInvoice.getSid());
|
|
|
|
loanBeCollectionVehFiles.add(loanBeCollectionVehFile2); |
|
|
|
//月还明细sid
|
|
|
|
LoanBeCollectionVehFile loanBeCollectionVehFile3 = new LoanBeCollectionVehFile(); |
|
|
@ -363,6 +417,11 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
loanBeCollectionApplyDetailsVo.setCreateBySid(userSid); |
|
|
|
loanBeCollectionApplyDetailsVo.setCreateByName(sysUserVo.getName()); |
|
|
|
loanBeCollectionApplyDetailsVo.setCreateTime(DateUtil.formatDate(new Date())); |
|
|
|
String useOrgSid = sysStaffOrgFeign.getOrgSidByPath(orgPath).getData(); |
|
|
|
SysOrganizationVo sysOrganizationVo1 = sysOrganizationFeign.fetchBySid(useOrgSid).getData(); |
|
|
|
loanBeCollectionApplyDetailsVo.setUseOrgSid(useOrgSid); |
|
|
|
loanBeCollectionApplyDetailsVo.setUseOrgName(sysOrganizationVo1.getName()); |
|
|
|
loanBeCollectionApplyDetailsVo.setOrgPath(orgPath); |
|
|
|
BusSalesOrderVehicle busSalesOrderVehicle = busSalesOrderVehicleFeign.details(saleVehSid).getData(); |
|
|
|
List<LoanBeCollectionRecordVehInit> loanBeCollectionRecordVehInits = loanBeOverdueVehService.initVehListByBorrSid(busSalesOrderVehicle.getBorrowerSid()); |
|
|
|
List<LoanBeCollectionVehDetailsVo> loanBeCollectionVehDetailsVos = new ArrayList<>(); |
|
|
@ -405,10 +464,300 @@ public class LoanBeCollectionApplyService extends MybatisBaseService<LoanBeColle |
|
|
|
loanBeCollectionVehFile6.setSid(sid); |
|
|
|
loanBeCollectionVehFiles.add(loanBeCollectionVehFile6); |
|
|
|
loanBeCollectionVehDetailsVo.setSids(loanBeCollectionVehFiles); |
|
|
|
loanBeCollectionVehDetailsVo.setSaleVehSid(saleVehSid); |
|
|
|
loanBeCollectionVehDetailsVos.add(loanBeCollectionVehDetailsVo); |
|
|
|
} |
|
|
|
loanBeCollectionApplyDetailsVo.setLoanBeCollectionVehDetails(loanBeCollectionVehDetailsVos); |
|
|
|
return loanBeCollectionApplyDetailsVo; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean submit(SubmitLoanBeCollectionApplyDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
LoanBeCollectionApply loanBeCollectionApply = fetchBySid(dto.getSid()); |
|
|
|
int r = submitBusinessData(dto, loanBeCollectionApply); |
|
|
|
if (r == 3) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
if (r == 0) { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
//新增修改保存
|
|
|
|
String businessSid = saveOrUpdateDto(dto); |
|
|
|
loanBeCollectionApply = fetchBySid(businessSid); |
|
|
|
//创建BusinessVariables实体对象
|
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
//用户的部门全路径sid
|
|
|
|
bv.setOrgSidPath(loanBeCollectionApply.getOrgPath()); |
|
|
|
//业务sid
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
//用户sid
|
|
|
|
bv.setUserSid(loanBeCollectionApply.getCreateBySid()); |
|
|
|
//若app移动端有此功能,则传递appMap参数
|
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
//需和移动端沟通业务sid保存的属性具体值:appMap中sid不是固定的。移动端提供具体字段。
|
|
|
|
variables.put("app", appMap); |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.BECOLLECTIONAPPLY.getProDefId()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
if (r == 1) { |
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowableFeign.startProcess(bv); |
|
|
|
UpdateFlowFieldVo ufVo = voResultBean.getData(); |
|
|
|
updateFlowFiled(BeanUtil.beanToMap(ufVo)); |
|
|
|
//极光推送
|
|
|
|
loanBeCollectionApply = 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(loanBeCollectionApply.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("催收措施申请"); |
|
|
|
messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
return voResultBean; |
|
|
|
} |
|
|
|
if (r == 2) { |
|
|
|
// ToDo:驳回到发起人后再次提交
|
|
|
|
if (StringUtils.isBlank(dto.getInstanceId())) { |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
bv.setTaskId(loanBeCollectionApply.getTaskId()); |
|
|
|
bv.setTaskDefKey(loanBeCollectionApply.getNodeSid()); |
|
|
|
bv.setComment(StringUtils.isNotBlank(dto.getComment()) ? dto.getComment() : "重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|
} |
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<LoanBeCollectionApplyNodeVo>> getPreviousNodesForReject(LoanBeCollectionApplyNodeQuery query) { |
|
|
|
ResultBean<List<LoanBeCollectionApplyNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
bv.setModelId(ProcDefEnum.BECOLLECTIONAPPLY.getProDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getPreviousNodesForReject(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<LoanBeCollectionApplyNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), LoanBeCollectionApplyNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<LoanBeCollectionApplyNodeVo>> getNextNodesForSubmit(LoanBeCollectionApplyNodeQuery query) { |
|
|
|
ResultBean<List<LoanBeCollectionApplyNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
bv.setModelId(ProcDefEnum.BECOLLECTIONAPPLY.getProDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<LoanBeCollectionApplyNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), LoanBeCollectionApplyNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean reject(LoanBeCollectionApplyTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = query.getBusinessSid(); |
|
|
|
LoanBeCollectionApply loanBeCollectionApply = fetchBySid(businessSid); |
|
|
|
if (loanBeCollectionApply == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
String businessTaskId = loanBeCollectionApply.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); |
|
|
|
//极光推送
|
|
|
|
loanBeCollectionApply = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
String procId = loanBeCollectionApply.getProcInstSid(); |
|
|
|
ufVo.setProcInsId(procId); |
|
|
|
ufVo.setProcDefId(loanBeCollectionApply.getProcDefId()); |
|
|
|
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(loanBeCollectionApply.getCreateBySid())) { |
|
|
|
messageFlowableQuery.setMsgContent("您提交的" + messageFlowableQuery.getModuleName() + "已被驳回,请重新提交"); |
|
|
|
} else { |
|
|
|
messageFlowableQuery.setMsgContent(loanBeCollectionApply.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
} |
|
|
|
messageFlowableQuery.setMsgTitle("催收措施申请"); |
|
|
|
messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致!"); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean revokeProcess(LoanBeCollectionApplyTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
|
} |
|
|
|
LoanBeCollectionApply loanBeCollectionApply = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = loanBeCollectionApply.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(LoanBeCollectionApplyTaskQuery 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("请填写意见"); |
|
|
|
} |
|
|
|
LoanBeCollectionApply loanBeCollectionApply = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = loanBeCollectionApply.getTaskId(); |
|
|
|
if (StringUtils.isNotBlank(businessTaskId)) { |
|
|
|
if (query.getUserSid().equals(loanBeCollectionApply.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 delegate(LoanBeCollectionApplyDelegateQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
FlowDelegateQuery delegateQuery = new FlowDelegateQuery(); |
|
|
|
BeanUtil.copyProperties(query, delegateQuery); |
|
|
|
flowFeign.delegate(delegateQuery); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean complete(BusinessVariables bv) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = bv.getBusinessSid(); |
|
|
|
LoanBeCollectionApply loanBeCollectionApply = fetchBySid(businessSid); |
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
FlowProcessMapQuery flowProcessMapQuery = new FlowProcessMapQuery(); |
|
|
|
if (StringUtils.isBlank(loanBeCollectionApply.getProcDefId())) { |
|
|
|
flowProcessMapQuery.setProDefKey(bv.getModelId()); |
|
|
|
} else { |
|
|
|
flowProcessMapQuery.setProDefKey(loanBeCollectionApply.getProcDefId()); |
|
|
|
} |
|
|
|
flowProcessMapQuery.setVariables(variables); |
|
|
|
variables = flowableFeign.getMap(flowProcessMapQuery).getData(); |
|
|
|
//=======================================
|
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setOrgSidPath(loanBeCollectionApply.getOrgPath()); |
|
|
|
if (bv.getTaskId().equals(loanBeCollectionApply.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())) { |
|
|
|
} else { |
|
|
|
//极光推送
|
|
|
|
loanBeCollectionApply = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
ufVo.setProcDefId(loanBeCollectionApply.getProcDefId()); |
|
|
|
ufVo.setProcInsId(loanBeCollectionApply.getProcInstSid()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("催收措施申请"); |
|
|
|
messageFlowableQuery.setMsgContent(loanBeCollectionApply.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("催收措施申请"); |
|
|
|
messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private synchronized int submitBusinessData(SubmitLoanBeCollectionApplyDto dto, LoanBeCollectionApply loanBeCollectionApply) { |
|
|
|
int r = 0; |
|
|
|
if (StringUtils.isBlank(dto.getSid())) { |
|
|
|
r = 1; |
|
|
|
} else { |
|
|
|
if (loanBeCollectionApply != null) { |
|
|
|
String businessTaskId = loanBeCollectionApply.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; |
|
|
|
} |
|
|
|
|
|
|
|
private int updateFlowFiled(Map<String, Object> map) { |
|
|
|
return baseMapper.updateFlowFiled(map); |
|
|
|
} |
|
|
|
} |