|
|
@ -1,16 +1,34 @@ |
|
|
|
package com.yxt.anrui.riskcenter.biz.loanlawsuitapply; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
|
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.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
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.SysStaffOrg; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
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.loanfile.LoanFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFileEnum; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanlawsuitapply.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanlawsuitapply.app.AppLawsuitDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanlawsuitapply.app.AppVehListVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanlawsuitapply.flow.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanlawsuitveh.LoanLawsuitVeh; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanmonthlyaccrualapply.LoanMonthlyAccrualApply; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanmonthlyaccrualapply.LoanMonthlyAccrualApplyQuery; |
|
|
@ -19,6 +37,8 @@ import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.LoanSolutionsDetailsss |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepurchaseapply.LoanRepurchaseApply; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepurchaseapply.LoanRepurchaseApplyQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepurchaseapply.LoanRepurchaseApplyVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepurchaseapply.app.AppRepurchaseDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepurchaseapply.flow.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrestorereportapply.AlrepaidAndArrVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions; |
|
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.app.SolutionsDetailsVo; |
|
|
@ -30,6 +50,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.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
@ -37,9 +60,9 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
@ -50,6 +73,14 @@ import java.util.List; |
|
|
|
@Service |
|
|
|
public class LoanLawsuitApplyService extends MybatisBaseService<LoanLawsuitApplyMapper, LoanLawsuitApply> { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private FlowFeign flowFeign; |
|
|
|
@Autowired |
|
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
@Autowired |
|
|
|
private FlowableFeign flowableFeign; |
|
|
|
@Autowired |
|
|
|
private MessageFeign messageFeign; |
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Autowired |
|
|
@ -270,6 +301,10 @@ public class LoanLawsuitApplyService extends MybatisBaseService<LoanLawsuitApply |
|
|
|
public ResultBean<String> saveLawsuit(LoanLawsuitApplyDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String sid = ""; |
|
|
|
List<LoanLawsuitVehVo> vehList1 = dto.getVehList(); |
|
|
|
if (vehList1.isEmpty()) { |
|
|
|
return rb.setMsg("诉讼车辆列表不能为空!"); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(dto.getSid())) { |
|
|
|
sid = dto.getSid(); |
|
|
|
LoanLawsuitApply updateEntity = fetchBySid(sid); |
|
|
@ -423,4 +458,496 @@ public class LoanLawsuitApplyService extends MybatisBaseService<LoanLawsuitApply |
|
|
|
PagerVo<LoanLawsuitApplyVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
//-----------------------------------flow---------------------------------
|
|
|
|
|
|
|
|
/** |
|
|
|
* 判断提交的流程是否被允许 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private synchronized int submitBusinessData(SubmitLawsuitDto dto, LoanLawsuitApply loanLawsuitApply) { |
|
|
|
int r = 0; |
|
|
|
if (StringUtils.isBlank(dto.getSid())) { |
|
|
|
r = 1; |
|
|
|
} else { |
|
|
|
if (loanLawsuitApply != null) { |
|
|
|
String businessTaskId = loanLawsuitApply.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; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新流程相关的状态 |
|
|
|
* |
|
|
|
* @param map |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private int updateFlowFiled(Map<String, Object> map) { |
|
|
|
return baseMapper.updateFlowFiled(map); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean submitRecordApplication(SubmitLawsuitDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
LoanLawsuitApply loanLawsuitApply = fetchBySid(dto.getSid()); |
|
|
|
int r = submitBusinessData(dto, loanLawsuitApply); |
|
|
|
if (r == 3) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
if (r == 0) { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
List<LoanLawsuitVehVo> vehList1 = dto.getVehList(); |
|
|
|
if (vehList1.isEmpty()) { |
|
|
|
return rb.setMsg("诉讼车辆列表不能为空!"); |
|
|
|
} |
|
|
|
List<String> busVinSids = new ArrayList<>(); |
|
|
|
for (LoanLawsuitVehVo loanLawsuitVehVo : vehList1) { |
|
|
|
busVinSids.add(loanLawsuitVehVo.getBusVinSid()); |
|
|
|
} |
|
|
|
//判断当前车辆是否已在审批中
|
|
|
|
int count = baseMapper.selCountByBusVinSid(busVinSids); |
|
|
|
if (count > 0) { |
|
|
|
return rb.setMsg("当前所选车辆已经处于诉讼申请审批状态,无法提交!"); |
|
|
|
} |
|
|
|
String businessSid = ""; |
|
|
|
//新增修改保存
|
|
|
|
ResultBean<String> resultBean = saveLawsuit(dto); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
businessSid = resultBean.getData(); |
|
|
|
} else { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
LoanLawsuitApply entity = fetchBySid(businessSid); |
|
|
|
String orgSidPath = ""; |
|
|
|
if (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 (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<>(); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
// boolean isTure = true;
|
|
|
|
// //去查询是否同意
|
|
|
|
// if (StringUtils.isNotBlank(entity.getSalesUserSid())) {
|
|
|
|
// if (!entity.getCreateBySid().equals(entity.getSalesUserSid())) {
|
|
|
|
// isTure = false;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// variables.put("isTure", isTure);
|
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
// String orderNames = "<" + entity.getCustomer() + ">" + "欠款客户备案";
|
|
|
|
// variables.put("orderNames", orderNames);
|
|
|
|
LoanLawsuitApply loanLawsuitApply1 = fetchBySid(businessSid); |
|
|
|
String msgBusinessSid = loanLawsuitApply1.getSid(); |
|
|
|
//用户的部门全路径sid
|
|
|
|
bv.setOrgSidPath(loanLawsuitApply1.getOrgSidPath()); |
|
|
|
//业务sid
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
//用户sid
|
|
|
|
bv.setUserSid(dto.getUserSid()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
// String nextNodeUserSids_ = sysOrganization.getManagerSid();
|
|
|
|
// bv.setNextNodeUserSids(nextNodeUserSids_);
|
|
|
|
// if (isTure) {
|
|
|
|
// bv.setNextNodeUserSids(nextNodeUserSids_);
|
|
|
|
// } else {
|
|
|
|
// bv.setNextNodeUserSids(entity.getSalesUserSid());
|
|
|
|
// }
|
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.LOANLAWSUITAPPLY.getProDefId()); |
|
|
|
if (r == 1) { |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.LOANLAWSUITAPPLY.getProDefId()); |
|
|
|
ResultBean<UpdateFlowFieldVo> voResultBean = flowFeign.startProcess(bv); |
|
|
|
if (!voResultBean.getSuccess()) { |
|
|
|
return rb.setMsg(voResultBean.getMsg()); |
|
|
|
} |
|
|
|
UpdateFlowFieldVo ufVo = voResultBean.getData(); |
|
|
|
int i = updateFlowFiled(BeanUtil.beanToMap(ufVo)); |
|
|
|
//==================================添加线程
|
|
|
|
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(ufVo, messageFlowVo); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(msgBusinessSid); |
|
|
|
messageFlowableQuery.setModuleName("诉讼申请"); |
|
|
|
SysUserVo userVo = sysUserFeign.fetchBySid(loanLawsuitApply1.getCreateBySid()).getData(); |
|
|
|
if (userVo != null) { |
|
|
|
if (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 (StringUtils.isBlank(dto.getInstanceId())) { |
|
|
|
return rb.setMsg("参数错误:instanceId"); |
|
|
|
} |
|
|
|
LoanLawsuitApply loanLawsuitApply2 = fetchBySid(dto.getSid()); |
|
|
|
bv.setTaskId(dto.getTaskId()); |
|
|
|
bv.setTaskDefKey(loanLawsuitApply2.getNodeSid()); |
|
|
|
bv.setComment("重新提交"); |
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
return complete(bv); |
|
|
|
} |
|
|
|
return rb; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean complete(BusinessVariables bv) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = bv.getBusinessSid(); |
|
|
|
LoanLawsuitApply loanLawsuitApply = this.fetchBySid(businessSid); |
|
|
|
if (bv.getTaskId().equals(loanLawsuitApply.getTaskId())) { |
|
|
|
bv.setOrgSidPath(loanLawsuitApply.getOrgSidPath()); |
|
|
|
//流程中的参数赋值
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
Map<String, Object> appMap = new HashMap<>(); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
// boolean isTure = true;
|
|
|
|
// //去查询是否同意
|
|
|
|
// if (StringUtils.isNotBlank(loanCustomerRecord.getSalesUserSid())) {
|
|
|
|
// if (!loanCustomerRecord.getCreateBySid().equals(loanCustomerRecord.getSalesUserSid())) {
|
|
|
|
// isTure = false;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// variables.put("isTure", isTure);
|
|
|
|
// if (bv.getTaskDefKey().equals("Activity_1078xxs")) {
|
|
|
|
// if (StringUtils.isNotBlank(loanCustomerRecord.getManageSid())) {
|
|
|
|
// bv.setNextNodeUserSids(loanCustomerRecord.getManageSid());
|
|
|
|
// } else {
|
|
|
|
// bv.setNextNodeUserSids(ProcDefEnum.DEFAUL_TADMIN_SID.getProDefId());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
ResultBean<UpdateFlowFieldVo> resultBean = flowFeign.handleProsess(bv); |
|
|
|
if (!resultBean.getSuccess()) { |
|
|
|
return rb.setMsg(resultBean.getMsg()); |
|
|
|
} |
|
|
|
UpdateFlowFieldVo ufVo = resultBean.getData(); |
|
|
|
int i = updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
if ("Event_end".equals(resultBean.getData().getTaskDefKey())) { |
|
|
|
LoanLawsuitApply lawsuitApply = fetchBySid(businessSid); |
|
|
|
lawsuitApply.setCloseDate(new DateTime()); |
|
|
|
baseMapper.updateById(lawsuitApply); |
|
|
|
|
|
|
|
} else { |
|
|
|
//极光推送
|
|
|
|
loanLawsuitApply = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
messageFlowVo.setProcDefId(loanLawsuitApply.getProcDefId()); |
|
|
|
messageFlowVo.setProcInsId(loanLawsuitApply.getProcInstId()); |
|
|
|
messageFlowableQuery.setUfVo(messageFlowVo); |
|
|
|
messageFlowableQuery.setAppMap(appMap); |
|
|
|
messageFlowableQuery.setBusinessSid(businessSid); |
|
|
|
messageFlowableQuery.setModuleName("诉讼申请"); |
|
|
|
messageFlowableQuery.setMsgContent(loanLawsuitApply.getCreateByName() + "提交的" + messageFlowableQuery.getModuleName() + ",请审批"); |
|
|
|
messageFlowableQuery.setMsgTitle("诉讼申请"); |
|
|
|
ResultBean<String> stringResultBean = messageFeign.pushMessage(messageFlowableQuery); |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 撤回 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public ResultBean revokeProcess(LawsuitTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
|
} |
|
|
|
LoanLawsuitApply loanLawsuitApply = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = loanLawsuitApply.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())); |
|
|
|
loanLawsuitApply = fetchBySid(query.getBusinessSid()); |
|
|
|
String procId = loanLawsuitApply.getProcInstId(); |
|
|
|
ResultBean<List<LatestTaskVo>> listResultBean = flowTaskFeign.getLatestTasks(procId); |
|
|
|
String nextNodeUserSids = listResultBean.getData().get(0).getASSIGNEE_(); |
|
|
|
String nextName = listResultBean.getData().get(0).getName_(); |
|
|
|
List<String> receiveSidList = Arrays.asList(nextNodeUserSids.split(",")); |
|
|
|
if ("发起申请".equals(nextName)) { |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.setMsg("操作失败,提交的数据不一致!"); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean taskReject(LawsuitTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = query.getBusinessSid(); |
|
|
|
LoanLawsuitApply loanLawsuitApply = fetchBySid(businessSid); |
|
|
|
if (loanLawsuitApply == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
String businessTaskId = loanLawsuitApply.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); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
// boolean isTure = true;
|
|
|
|
// //去查询是否同意
|
|
|
|
// if (StringUtils.isNotBlank(loanCustomerRecord.getSalesUserSid())) {
|
|
|
|
// if (!loanCustomerRecord.getCreateBySid().equals(loanCustomerRecord.getSalesUserSid())) {
|
|
|
|
// isTure = false;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// variables.put("isTure", isTure);
|
|
|
|
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); |
|
|
|
//极光推送
|
|
|
|
loanLawsuitApply = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
String procId = loanLawsuitApply.getProcInstId(); |
|
|
|
messageFlowVo.setProcInsId(procId); |
|
|
|
messageFlowVo.setProcDefId(loanLawsuitApply.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(loanLawsuitApply.getCreateBySid()).getData(); |
|
|
|
if (userVo != null) { |
|
|
|
if (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(LawsuitTaskQuery 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("请填写意见"); |
|
|
|
} |
|
|
|
LoanLawsuitApply loanLawsuitApply = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = loanLawsuitApply.getTaskId(); |
|
|
|
if (StringUtils.isNotBlank(businessTaskId)) { |
|
|
|
if (query.getUserSid().equals(loanLawsuitApply.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<LawsuitGetNodeVo>> getNextNodesForSubmit(LawsuitGetNodeQuery query) { |
|
|
|
ResultBean<List<LawsuitGetNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
|
|
|
|
//根据业务sid查询排产信息
|
|
|
|
LoanLawsuitApply lawsuitApply = fetchBySid(query.getBusinessSid()); |
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
// boolean isTure = true;
|
|
|
|
// //去查询是否同意
|
|
|
|
// if (StringUtils.isNotBlank(loanCustomerRecord.getSalesUserSid())) {
|
|
|
|
// if (!loanCustomerRecord.getCreateBySid().equals(loanCustomerRecord.getSalesUserSid())) {
|
|
|
|
// isTure = false;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// variables.put("isTure", isTure);
|
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setModelId(lawsuitApply.getProcDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<LawsuitGetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), LawsuitGetNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<LawsuitGetNodeVo>> getPreviousNodesForReject(LawsuitGetNodeQuery query) { |
|
|
|
ResultBean<List<LawsuitGetNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
//根据业务sid查询排产信息
|
|
|
|
LoanLawsuitApply lawsuitApply = fetchBySid(query.getBusinessSid()); |
|
|
|
// //若有网关,则赋值网关中判断的字段。
|
|
|
|
// boolean isTure = true;
|
|
|
|
// //去查询是否同意
|
|
|
|
// if (StringUtils.isNotBlank(loanCustomerRecord.getSalesUserSid())) {
|
|
|
|
// if (!loanCustomerRecord.getCreateBySid().equals(loanCustomerRecord.getSalesUserSid())) {
|
|
|
|
// isTure = false;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// variables.put("isTure", isTure);
|
|
|
|
bv.setFormVariables(variables); |
|
|
|
bv.setModelId(lawsuitApply.getProcDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getPreviousNodesForReject(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<LawsuitGetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), LawsuitGetNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean delegate(LawsuitDelegateQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
FlowDelegateQuery delegateQuery = new FlowDelegateQuery(); |
|
|
|
BeanUtil.copyProperties(query, delegateQuery); |
|
|
|
flowFeign.delegate(delegateQuery); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean<AppLawsuitDetailsVo> appDetail(String sid) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
AppLawsuitDetailsVo vo = baseMapper.appDetail(sid); |
|
|
|
if (null != vo) { |
|
|
|
List<LoanLawsuitVehVo> voList = loanLawsuitVehService.selByMainSid(sid); |
|
|
|
List<AppVehListVo> vehListVos = new ArrayList<>(); |
|
|
|
if (!voList.isEmpty()) { |
|
|
|
for (LoanLawsuitVehVo loanLawsuitVehVo : voList) { |
|
|
|
AppVehListVo appVehListVo = new AppVehListVo(); |
|
|
|
BeanUtil.copyProperties(loanLawsuitVehVo, appVehListVo); |
|
|
|
vehListVos.add(appVehListVo); |
|
|
|
} |
|
|
|
vo.setVehListVos(vehListVos); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|