|
|
@ -25,20 +25,15 @@ 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.loanbuckleapply.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbuckleapply.app.AppBuckleDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbuckleapply.app.AppRecordVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbuckleapply.flow.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbuckleapplyrecord.LoanBuckleApplyRecord; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFile; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanfile.LoanFileEnum; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistory; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymenthistory.LoanRepaymentHistoryRecordVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentapply.LoanTransferPaymentApply; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentapply.LoanTransferPaymentApplyInit; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanbuckleapplyrecord.LoanBuckleApplyRecordService; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentapply.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentapply.flow.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loantransferpaymentrecord.LoanTransferPaymentRecord; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanfile.LoanFileService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanrepaymenthistory.LoanRepaymentHistoryService; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loantransferpaymentrecord.LoanTransferPaymentRecordService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
|
import com.yxt.common.base.utils.PagerUtil; |
|
|
@ -66,22 +61,763 @@ import java.util.stream.Collectors; |
|
|
|
@Service |
|
|
|
public class LoanTransferPaymentApplyService extends MybatisBaseService<LoanTransferPaymentApplyMapper, LoanTransferPaymentApply> { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private LoanTransferPaymentRecordService loanTransferPaymentRecordService; |
|
|
|
@Autowired |
|
|
|
private LoanFileService loanFileService; |
|
|
|
@Autowired |
|
|
|
private SysStaffOrgFeign sysStaffOrgFeign; |
|
|
|
@Autowired |
|
|
|
private SysOrganizationFeign sysOrganizationFeign; |
|
|
|
@Autowired |
|
|
|
private LoanRepaymentHistoryService loanRepaymentHistoryService; |
|
|
|
@Autowired |
|
|
|
private SysUserFeign sysUserFeign; |
|
|
|
@Autowired |
|
|
|
private FileUploadComponent fileUploadComponent; |
|
|
|
@Autowired |
|
|
|
private FlowFeign flowFeign; |
|
|
|
@Autowired |
|
|
|
private FlowableFeign flowableFeign; |
|
|
|
@Autowired |
|
|
|
private FlowTaskFeign flowTaskFeign; |
|
|
|
@Autowired |
|
|
|
private MessageFeign messageFeign; |
|
|
|
|
|
|
|
public ResultBean<LoanTransferPaymentApplyInit> paymentInit(String[] sids) { |
|
|
|
ResultBean<LoanTransferPaymentApplyInit> rb = ResultBean.fireFail(); |
|
|
|
LoanTransferPaymentApplyInit vo = new LoanTransferPaymentApplyInit(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
vo.setApplyDate(sdf.format(new Date())); |
|
|
|
List<LoanBuckleHistoryRecord> historyRecords = new ArrayList<>(); |
|
|
|
// for (String sid : sids) {
|
|
|
|
// LoanBuckleHistoryRecord record = new LoanBuckleHistoryRecord();
|
|
|
|
// LoanRepaymentHistoryRecordVo recordVo = loanRepaymentHistoryService.buckleInfo(sid).getData();
|
|
|
|
// if (null != recordVo) {
|
|
|
|
// BeanUtil.copyProperties(recordVo, record);
|
|
|
|
List<LoanTransferPaymentRecordVo> historyRecords = new ArrayList<>(); |
|
|
|
for (String sid : sids) { |
|
|
|
LoanTransferPaymentRecordVo recordVo = baseMapper.paymentInfo(sid); |
|
|
|
recordVo.setSpread("0"); |
|
|
|
recordVo.setDefaultInterest("0"); |
|
|
|
if (StringUtils.isNotBlank(recordVo.getBankContractNo())) { |
|
|
|
LoanTransferPaymentRecord paymentRecord = loanTransferPaymentRecordService.selByBankContractNo(recordVo.getBankContractNo()); |
|
|
|
if (null != paymentRecord) { |
|
|
|
if (StringUtils.isNotBlank(paymentRecord.getAccount())) { |
|
|
|
recordVo.setAccount(paymentRecord.getAccount()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(paymentRecord.getAccountNumber())) { |
|
|
|
recordVo.setAccountNumber(paymentRecord.getAccountNumber()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(paymentRecord.getAccountType())) { |
|
|
|
recordVo.setAccountType(paymentRecord.getAccountType()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(paymentRecord.getAccountTypeKey())) { |
|
|
|
recordVo.setAccountTypeKey(paymentRecord.getAccountTypeKey()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
historyRecords.add(recordVo); |
|
|
|
} |
|
|
|
vo.setRecords(historyRecords); |
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 生成申请单单据编号 |
|
|
|
* |
|
|
|
* @param orgSid |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
public String getApplyCode(String orgSid) { |
|
|
|
//获取分公司sid
|
|
|
|
ResultBean<SysOrganizationVo> resultBean1 = sysOrganizationFeign.fetchBySid(orgSid); |
|
|
|
String orgCode = resultBean1.getData().getOrgCode(); |
|
|
|
BillNo b = new BillNo(); |
|
|
|
b.setOrgCode(orgCode); |
|
|
|
b.setBillType(BillTypeEnum.DSDFSQ.getBillType()); |
|
|
|
String bill = Rule.getBill(b); |
|
|
|
int i = baseMapper.selectNum(bill); |
|
|
|
String billNo = Rule.getBillNo(bill, i); |
|
|
|
return billNo; |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public ResultBean<String> saveTransferPayment(LoanTransferPaymentApplyDto dto) { |
|
|
|
ResultBean<String> rb = ResultBean.fireFail(); |
|
|
|
String sid = ""; |
|
|
|
if (StringUtils.isNotBlank(dto.getSid())) { |
|
|
|
sid = dto.getSid(); |
|
|
|
LoanTransferPaymentApply updateEntity = fetchBySid(sid); |
|
|
|
if (null != updateEntity) { |
|
|
|
BeanUtil.copyProperties(dto, updateEntity, "id", "sid"); |
|
|
|
baseMapper.updateById(updateEntity); |
|
|
|
int i = loanTransferPaymentRecordService.deleteByMainSid(sid); |
|
|
|
//删除附件表中关于该linkSid的文件
|
|
|
|
loanFileService.deleteByLinkSid(sid); |
|
|
|
List<LoanTransferPaymentApplyFile> filess = dto.getFiles(); |
|
|
|
if (!filess.isEmpty()) { |
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
for (LoanTransferPaymentApplyFile file : filess) { |
|
|
|
files.add(file.getUrl()); |
|
|
|
} |
|
|
|
loanFileService.saveAll(sid, files, LoanFileEnum.TRANSFERPAYMENT.getAttachType()); |
|
|
|
} |
|
|
|
List<LoanTransferPaymentRecordVo> records = dto.getRecords(); |
|
|
|
if (!records.isEmpty()) { |
|
|
|
for (LoanTransferPaymentRecordVo record : records) { |
|
|
|
LoanTransferPaymentRecord applyRecord = new LoanTransferPaymentRecord(); |
|
|
|
BeanUtil.copyProperties(record, applyRecord, "id", "sid"); |
|
|
|
applyRecord.setMainSid(sid); |
|
|
|
applyRecord.setRepaymentHistorySid(record.getRecordSid()); |
|
|
|
loanTransferPaymentRecordService.insert(applyRecord); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
LoanTransferPaymentApply transferPaymentApply = new LoanTransferPaymentApply(); |
|
|
|
sid = transferPaymentApply.getSid(); |
|
|
|
BeanUtil.copyProperties(dto, transferPaymentApply, "id", "sid"); |
|
|
|
transferPaymentApply.setCreateBySid(dto.getUserSid()); |
|
|
|
transferPaymentApply.setOrgSidPath(dto.getOrgPath()); |
|
|
|
ResultBean<String> orgSidByPath = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgPath()); |
|
|
|
if (orgSidByPath.getSuccess()) { |
|
|
|
String userOrgSid = orgSidByPath.getData(); |
|
|
|
transferPaymentApply.setUseOrgSid(userOrgSid); |
|
|
|
String billNo = getApplyCode(userOrgSid); |
|
|
|
transferPaymentApply.setBillNo(billNo); |
|
|
|
ResultBean<SysOrganizationVo> organizationVo = sysOrganizationFeign.fetchBySid(userOrgSid); |
|
|
|
if (organizationVo.getSuccess()) { |
|
|
|
SysOrganizationVo organizationVoData = organizationVo.getData(); |
|
|
|
if (null != organizationVoData) { |
|
|
|
transferPaymentApply.setUseOrgName(organizationVoData.getName()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
transferPaymentApply.setNodeState("待提交"); |
|
|
|
baseMapper.insert(transferPaymentApply); |
|
|
|
List<LoanTransferPaymentRecordVo> records = dto.getRecords(); |
|
|
|
if (!records.isEmpty()) { |
|
|
|
for (LoanTransferPaymentRecordVo record : records) { |
|
|
|
LoanTransferPaymentRecord applyRecord = new LoanTransferPaymentRecord(); |
|
|
|
BeanUtil.copyProperties(record, applyRecord, "id", "sid"); |
|
|
|
applyRecord.setMainSid(sid); |
|
|
|
applyRecord.setRepaymentHistorySid(record.getRecordSid()); |
|
|
|
loanTransferPaymentRecordService.insert(applyRecord); |
|
|
|
LoanRepaymentHistory repaymentHistory = loanRepaymentHistoryService.fetchBySid(record.getRecordSid()); |
|
|
|
if (null != repaymentHistory) { |
|
|
|
repaymentHistory.setPaymentState("转付中"); |
|
|
|
repaymentHistory.setPaymentStateKey("002"); |
|
|
|
loanRepaymentHistoryService.updateById(repaymentHistory); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//删除附件表中关于该linkSid的文件
|
|
|
|
loanFileService.deleteByLinkSid(sid); |
|
|
|
List<LoanTransferPaymentApplyFile> filess = dto.getFiles(); |
|
|
|
if (!filess.isEmpty()) { |
|
|
|
List<String> files = new ArrayList<>(); |
|
|
|
for (LoanTransferPaymentApplyFile file : filess) { |
|
|
|
files.add(file.getUrl()); |
|
|
|
} |
|
|
|
loanFileService.saveAll(sid, files, LoanFileEnum.TRANSFERPAYMENT.getAttachType()); |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(sid); |
|
|
|
} |
|
|
|
|
|
|
|
public PagerVo<LoanTransferPaymentApplyVo> listPage(PagerQuery<LoanTransferPaymentApplyQuery> pq) { |
|
|
|
IPage<LoanTransferPaymentApply> page = PagerUtil.queryToPage(pq); |
|
|
|
LoanTransferPaymentApplyQuery pagerQuery = pq.getParams(); |
|
|
|
QueryWrapper<LoanTransferPaymentApply> qw = new QueryWrapper<>(); |
|
|
|
//=======================
|
|
|
|
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); |
|
|
|
privilegeQuery.setOrgPath(pagerQuery.getOrgPath()); |
|
|
|
privilegeQuery.setMenuSid(pagerQuery.getMenuSid()); |
|
|
|
privilegeQuery.setMenuUrl(pagerQuery.getMenuUrl()); |
|
|
|
privilegeQuery.setUserSid(pagerQuery.getUserSid()); |
|
|
|
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery); |
|
|
|
if (StringUtils.isNotBlank(defaultIdReltBean.getData())) { |
|
|
|
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
|
|
|
|
String orgSidPath = pagerQuery.getOrgPath(); |
|
|
|
orgSidPath = orgSidPath + "/"; |
|
|
|
int i1 = orgSidPath.indexOf("/"); |
|
|
|
int i2 = orgSidPath.indexOf("/", i1 + 1); |
|
|
|
int i3 = orgSidPath.indexOf("/", i2 + 1); |
|
|
|
int i4 = orgSidPath.indexOf("/", i3 + 1); |
|
|
|
String orgLevelKey = defaultIdReltBean.getData(); |
|
|
|
if ("1".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i1); |
|
|
|
qw.like("orgSidPath", orgSidPath); |
|
|
|
} else if ("2".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i2); |
|
|
|
qw.like("orgSidPath", orgSidPath); |
|
|
|
} else if ("3".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i3); |
|
|
|
qw.like("orgSidPath", orgSidPath); |
|
|
|
} else if ("4".equals(orgLevelKey)) { |
|
|
|
orgSidPath = orgSidPath.substring(0, i4); |
|
|
|
qw.like("orgSidPath", orgSidPath); |
|
|
|
} else if ("5".equals(orgLevelKey)) { |
|
|
|
qw.eq("createBySid", pagerQuery.getUserSid()); |
|
|
|
} else { |
|
|
|
PagerVo<LoanTransferPaymentApplyVo> p = new PagerVo<>(); |
|
|
|
return p; |
|
|
|
} |
|
|
|
} else { |
|
|
|
PagerVo<LoanTransferPaymentApplyVo> p = new PagerVo<>(); |
|
|
|
return p; |
|
|
|
} |
|
|
|
//=======================
|
|
|
|
//分公司
|
|
|
|
if (StringUtils.isNotBlank(pagerQuery.getCompany())) { |
|
|
|
qw.like("useOrgName", pagerQuery.getCompany()); |
|
|
|
} |
|
|
|
//申请人
|
|
|
|
if (StringUtils.isNotBlank(pagerQuery.getApplyName())) { |
|
|
|
qw.like("applyName", pagerQuery.getApplyName()); |
|
|
|
} |
|
|
|
//申请编号
|
|
|
|
if (StringUtils.isNotBlank(pagerQuery.getBillNo())) { |
|
|
|
qw.like("billNo", pagerQuery.getBillNo()); |
|
|
|
} |
|
|
|
String applyStartTime = pagerQuery.getApplyStartDate(); |
|
|
|
String applyEndTime = pagerQuery.getApplyEndDate(); |
|
|
|
qw.apply(StringUtils.isNotEmpty(applyStartTime), "date_format (applyDate,'%Y-%m-%d') >= date_format('" + applyStartTime + "','%Y-%m-%d')"). |
|
|
|
apply(StringUtils.isNotEmpty(applyEndTime), "date_format (applyDate,'%Y-%m-%d') <= date_format('" + applyEndTime + "','%Y-%m-%d')" |
|
|
|
); |
|
|
|
qw.eq("isDelete", 0); |
|
|
|
qw.orderByDesc("createTime"); |
|
|
|
IPage<LoanTransferPaymentApplyVo> pagging = baseMapper.listPage(page, qw); |
|
|
|
PagerVo<LoanTransferPaymentApplyVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<LoanTransferPaymentApplyInit> paymentDetails(String sid) { |
|
|
|
ResultBean<LoanTransferPaymentApplyInit> rb = ResultBean.fireFail(); |
|
|
|
LoanTransferPaymentApplyInit initVo = new LoanTransferPaymentApplyInit(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
LoanTransferPaymentApply paymentApply = fetchBySid(sid); |
|
|
|
if (null != paymentApply) { |
|
|
|
BeanUtil.copyProperties(paymentApply, initVo); |
|
|
|
initVo.setUserSid(paymentApply.getCreateBySid()); |
|
|
|
initVo.setOrgPath(paymentApply.getOrgSidPath()); |
|
|
|
if (StringUtils.isNotBlank(paymentApply.getProcInstId())) { |
|
|
|
initVo.setInstanceId(paymentApply.getProcInstId()); |
|
|
|
} |
|
|
|
if (null != paymentApply.getApplyDate()) { |
|
|
|
initVo.setApplyDate(sdf.format(paymentApply.getApplyDate())); |
|
|
|
} |
|
|
|
List<LoanFile> fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.TRANSFERPAYMENT.getAttachType()); |
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
List<String> files = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
|
collect(Collectors.toList()); |
|
|
|
List<LoanTransferPaymentApplyFile> paymentApplyFiles = new ArrayList<>(); |
|
|
|
for (String file : files) { |
|
|
|
LoanTransferPaymentApplyFile paymentApplyFile = new LoanTransferPaymentApplyFile(); |
|
|
|
paymentApplyFile.setUrl(file); |
|
|
|
paymentApplyFiles.add(paymentApplyFile); |
|
|
|
} |
|
|
|
initVo.setFiles(paymentApplyFiles); |
|
|
|
} |
|
|
|
List<LoanTransferPaymentRecord> records = loanTransferPaymentRecordService.selByMainSid(sid); |
|
|
|
List<LoanTransferPaymentRecordVo> recordList = new ArrayList<>(); |
|
|
|
if (!records.isEmpty()) { |
|
|
|
for (LoanTransferPaymentRecord record : records) { |
|
|
|
String historySid = record.getRepaymentHistorySid(); |
|
|
|
LoanTransferPaymentRecordVo recordVo = baseMapper.paymentInfo(historySid); |
|
|
|
recordList.add(recordVo); |
|
|
|
} |
|
|
|
} |
|
|
|
initVo.setRecords(recordList); |
|
|
|
} |
|
|
|
return rb.success().setData(initVo); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean deleteBySids(String[] sids) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
for (String sid : sids) { |
|
|
|
LoanTransferPaymentApply paymentApply = fetchBySid(sid); |
|
|
|
if (null != paymentApply) { |
|
|
|
if (!paymentApply.getNodeState().equals("待提交")) { |
|
|
|
return rb.setMsg("删除的数据中包含已经提交审批的数据,删除失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
paymentApply.setIsDelete(1); |
|
|
|
int i = baseMapper.updateById(paymentApply); |
|
|
|
if (i == 0) { |
|
|
|
return rb.setMsg("删除失败"); |
|
|
|
} |
|
|
|
List<LoanTransferPaymentRecord> loanTransferPaymentRecords = loanTransferPaymentRecordService.selByMainSid(sid); |
|
|
|
if (!loanTransferPaymentRecords.isEmpty()) { |
|
|
|
for (LoanTransferPaymentRecord applyRecord : loanTransferPaymentRecords) { |
|
|
|
LoanRepaymentHistory repaymentHistory = loanRepaymentHistoryService.fetchBySid(applyRecord.getRepaymentHistorySid()); |
|
|
|
if (null != repaymentHistory) { |
|
|
|
repaymentHistory.setPaymentState("待转付"); |
|
|
|
repaymentHistory.setPaymentStateKey("001"); |
|
|
|
loanRepaymentHistoryService.updateById(repaymentHistory); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
loanTransferPaymentRecordService.deleteByMainSid(sid); |
|
|
|
} |
|
|
|
return ResultBean.fireSuccess().setMsg("删除成功"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//-------------------------------------流程------------------------------------------------/
|
|
|
|
|
|
|
|
/** |
|
|
|
* 判断提交的流程是否被允许 |
|
|
|
* |
|
|
|
* @param dto |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private synchronized int submitBusinessData(SubmitTransferDto dto, LoanTransferPaymentApply paymentApply) { |
|
|
|
int r = 0; |
|
|
|
if (StringUtils.isBlank(dto.getSid())) { |
|
|
|
r = 1; |
|
|
|
} else { |
|
|
|
if (paymentApply != null) { |
|
|
|
String businessTaskId = paymentApply.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(SubmitTransferDto dto) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
LoanTransferPaymentApply paymentApply = fetchBySid(dto.getSid()); |
|
|
|
int r = submitBusinessData(dto, paymentApply); |
|
|
|
if (r == 3) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
if (r == 0) { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
String businessSid = ""; |
|
|
|
//新增修改保存
|
|
|
|
ResultBean<String> resultBean = saveTransferPayment(dto); |
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
businessSid = resultBean.getData(); |
|
|
|
} |
|
|
|
LoanTransferPaymentApply 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;
|
|
|
|
// }
|
|
|
|
// historyRecords.add(record);
|
|
|
|
// }
|
|
|
|
// vo.setRecords(historyRecords);
|
|
|
|
return rb.success().setData(vo); |
|
|
|
// variables.put("isTure", isTure);
|
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
appMap.put("sid", businessSid); |
|
|
|
variables.put("app", appMap); |
|
|
|
// String orderNames = "<" + entity.getCustomer() + ">" + "欠款客户备案";
|
|
|
|
// variables.put("orderNames", orderNames);
|
|
|
|
LoanTransferPaymentApply paymentApply1 = fetchBySid(businessSid); |
|
|
|
String msgBusinessSid = paymentApply1.getSid(); |
|
|
|
//用户的部门全路径sid
|
|
|
|
bv.setOrgSidPath(paymentApply1.getOrgSidPath()); |
|
|
|
//业务sid
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
//用户sid
|
|
|
|
bv.setUserSid(dto.getUserSid()); |
|
|
|
bv.setFormVariables(variables); |
|
|
|
// String nextNodeUserSids_ = sysOrganization.getManagerSid();
|
|
|
|
// if (isTure) {
|
|
|
|
// bv.setNextNodeUserSids(nextNodeUserSids_);
|
|
|
|
// } else {
|
|
|
|
// bv.setNextNodeUserSids(entity.getSalesUserSid());
|
|
|
|
// }
|
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.COLLECTIONPAYMENT.getProDefId()); |
|
|
|
if (r == 1) { |
|
|
|
//流程定义id
|
|
|
|
bv.setModelId(ProcDefEnum.COLLECTIONPAYMENT.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(paymentApply1.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"); |
|
|
|
} |
|
|
|
LoanTransferPaymentApply paymentApply2 = fetchBySid(dto.getSid()); |
|
|
|
bv.setTaskId(dto.getTaskId()); |
|
|
|
bv.setTaskDefKey(paymentApply2.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(); |
|
|
|
LoanTransferPaymentApply paymentApply = this.fetchBySid(businessSid); |
|
|
|
if (bv.getTaskId().equals(paymentApply.getTaskId())) { |
|
|
|
bv.setOrgSidPath(paymentApply.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()); |
|
|
|
} |
|
|
|
int i = updateFlowFiled(BeanUtil.beanToMap(resultBean.getData())); |
|
|
|
if ("Event_end".equals(resultBean.getData().getTaskDefKey())) { |
|
|
|
List<LoanTransferPaymentRecord> loanTransferPaymentRecords = loanTransferPaymentRecordService.selByMainSid(businessSid); |
|
|
|
if (!loanTransferPaymentRecords.isEmpty()) { |
|
|
|
for (LoanTransferPaymentRecord applyRecord : loanTransferPaymentRecords) { |
|
|
|
LoanRepaymentHistory repaymentHistory = loanRepaymentHistoryService.fetchBySid(applyRecord.getRepaymentHistorySid()); |
|
|
|
if (null != repaymentHistory) { |
|
|
|
repaymentHistory.setPaymentStateKey("003"); |
|
|
|
repaymentHistory.setPaymentState("已转付"); |
|
|
|
repaymentHistory.setTransferDate(new DateTime()); |
|
|
|
loanRepaymentHistoryService.updateById(repaymentHistory); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} else { |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean revokeProcess(TransferTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
if (StringUtils.isBlank(query.getUserSid())) { |
|
|
|
return rb.setMsg("参数错误:userSid"); |
|
|
|
} |
|
|
|
LoanTransferPaymentApply paymentApply = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = paymentApply.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 taskReject(TransferTaskQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
String businessSid = query.getBusinessSid(); |
|
|
|
LoanTransferPaymentApply paymentApply = fetchBySid(businessSid); |
|
|
|
if (paymentApply == null) { |
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
} |
|
|
|
String businessTaskId = paymentApply.getTaskId(); |
|
|
|
if (StringUtils.isNotBlank(businessTaskId)) { |
|
|
|
if (businessTaskId.equals(query.getTaskId())) { |
|
|
|
if (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("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); |
|
|
|
//极光推送
|
|
|
|
paymentApply = fetchBySid(businessSid); |
|
|
|
MessageFlowableQuery messageFlowableQuery = new MessageFlowableQuery(); |
|
|
|
MessageFlowVo messageFlowVo = new MessageFlowVo(); |
|
|
|
BeanUtil.copyProperties(ufVo, messageFlowVo); |
|
|
|
String procId = paymentApply.getProcInstId(); |
|
|
|
messageFlowVo.setProcInsId(procId); |
|
|
|
messageFlowVo.setProcDefId(paymentApply.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(paymentApply.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(TransferTaskQuery 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("请填写意见"); |
|
|
|
} |
|
|
|
LoanTransferPaymentApply paymentApply = fetchBySid(query.getBusinessSid()); |
|
|
|
String businessTaskId = paymentApply.getTaskId(); |
|
|
|
if (StringUtils.isNotBlank(businessTaskId)) { |
|
|
|
if (query.getUserSid().equals(paymentApply.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); |
|
|
|
//终止任务后划扣状态改完未通过
|
|
|
|
LoanTransferPaymentApply entity = fetchBySid(query.getBusinessSid()); |
|
|
|
if (entity.getNodeState().equals("终止")) { |
|
|
|
List<LoanTransferPaymentRecord> loanTransferPaymentRecords = loanTransferPaymentRecordService.selByMainSid(query.getBusinessSid()); |
|
|
|
if (!loanTransferPaymentRecords.isEmpty()) { |
|
|
|
for (LoanTransferPaymentRecord applyRecord : loanTransferPaymentRecords) { |
|
|
|
LoanRepaymentHistory repaymentHistory = loanRepaymentHistoryService.fetchBySid(applyRecord.getRepaymentHistorySid()); |
|
|
|
if (null != repaymentHistory) { |
|
|
|
repaymentHistory.setPaymentStateKey("001"); |
|
|
|
repaymentHistory.setPaymentState("待转付"); |
|
|
|
loanRepaymentHistoryService.updateById(repaymentHistory); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
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); |
|
|
|
//终止任务后划扣状态改完未通过
|
|
|
|
LoanTransferPaymentApply entity = fetchBySid(query.getBusinessSid()); |
|
|
|
if (entity.getNodeState().equals("终止")) { |
|
|
|
List<LoanTransferPaymentRecord> loanTransferPaymentRecords = loanTransferPaymentRecordService.selByMainSid(query.getBusinessSid()); |
|
|
|
if (!loanTransferPaymentRecords.isEmpty()) { |
|
|
|
for (LoanTransferPaymentRecord applyRecord : loanTransferPaymentRecords) { |
|
|
|
LoanRepaymentHistory repaymentHistory = loanRepaymentHistoryService.fetchBySid(applyRecord.getRepaymentHistorySid()); |
|
|
|
if (null != repaymentHistory) { |
|
|
|
repaymentHistory.setPaymentStateKey("001"); |
|
|
|
repaymentHistory.setPaymentState("待转付"); |
|
|
|
loanRepaymentHistoryService.updateById(repaymentHistory); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setData(resultBean.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return rb.setMsg("操作失败!提交的数据不一致!"); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean flowRecord(String procInsId) { |
|
|
|
return flowTaskFeign.businessFlowRecord(procInsId); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<TransferGetNodeVo>> getNextNodesForSubmit(TransferGetNodeQuery query) { |
|
|
|
ResultBean<List<TransferGetNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
|
|
|
|
//根据业务sid查询排产信息
|
|
|
|
LoanTransferPaymentApply paymentApply = 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(paymentApply.getProcDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getNextNodesForSubmit(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<TransferGetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), TransferGetNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<TransferGetNodeVo>> getPreviousNodesForReject(TransferGetNodeQuery query) { |
|
|
|
ResultBean<List<TransferGetNodeVo>> rb = ResultBean.fireFail(); |
|
|
|
BusinessVariables bv = new BusinessVariables(); |
|
|
|
BeanUtil.copyProperties(query, bv); |
|
|
|
//流程中的参数赋值、若有网关,则赋值网关中判断的字段。
|
|
|
|
Map<String, Object> variables = new HashMap<>(); |
|
|
|
//根据业务sid查询排产信息
|
|
|
|
LoanTransferPaymentApply paymentApply = 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(paymentApply.getProcDefId()); |
|
|
|
ResultBean<List<Map<String, Object>>> resultBean = flowTaskFeign.getPreviousNodesForReject(bv); |
|
|
|
//判断数组是否为空,若为空则赋值,若不为空,则遍历循环将map中的数据赋值给getNodeVo
|
|
|
|
List<TransferGetNodeVo> voList = Optional.ofNullable(resultBean.getData()).orElse(new ArrayList<>()).stream().map(m -> JSON.parseObject(JSON.toJSONString(m), TransferGetNodeVo.class)).collect(Collectors.toList()); |
|
|
|
return rb.success().setData(voList); |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean delegate(TransferDelegateQuery query) { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
FlowDelegateQuery delegateQuery = new FlowDelegateQuery(); |
|
|
|
BeanUtil.copyProperties(query, delegateQuery); |
|
|
|
flowFeign.delegate(delegateQuery); |
|
|
|
return rb.success(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|