|
@ -42,11 +42,9 @@ import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
|
|
|
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.*; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.*; |
|
|
|
|
|
|
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.app.AppCustomerRecordInitVo; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.app.*; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.app.AppCustomerRecordQuery; |
|
|
|
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.app.AppCustomerRecordVo; |
|
|
|
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.app.AppSalesmanRsk; |
|
|
|
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.flow.*; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.flow.*; |
|
|
|
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecordstaff.AppStaffVo; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecordstaff.LoanCustomerRecordStaff; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecordstaff.LoanCustomerRecordStaff; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecordstaff.LoanCustomerRecordStaffDto; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecordstaff.LoanCustomerRecordStaffDto; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecordstaff.LoanCustomerRecordStaffVo; |
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecordstaff.LoanCustomerRecordStaffVo; |
|
@ -1084,49 +1082,89 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//查询挂靠公司
|
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getBusinessName())) { |
|
|
|
|
|
vo.setDisName(entity.getBusinessName()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getTaxpayerNo())) { |
|
|
|
|
|
vo.setRegistNum(entity.getTaxpayerNo()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getAddress())) { |
|
|
|
|
|
vo.setRegistDetailAddress(entity.getAddress()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getPhone())) { |
|
|
|
|
|
vo.setMobile2(entity.getPhone()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getLeader())) { |
|
|
|
|
|
vo.setContract(entity.getLeader()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(entity.getLegal())) { |
|
|
|
|
|
vo.setLegalName(entity.getLegal()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
//查询企业人员信息
|
|
|
//查询企业人员信息
|
|
|
// List<LoanCustomerRecordStaffVo> staffVos = loanCustomerRecordStaffService.getStaffsByMainSid(sid).getData();
|
|
|
List<LoanCustomerRecordStaffVo> staffVos = loanCustomerRecordStaffService.getStaffsByMainSid(sid).getData(); |
|
|
// staffVos.removeAll(Collections.singleton(null));
|
|
|
staffVos.removeAll(Collections.singleton(null)); |
|
|
// if (!staffVos.isEmpty()) {
|
|
|
List<AppStaffVo> appStaffVos = new ArrayList<>(); |
|
|
// vo.setStaffs(staffVos);
|
|
|
if (!staffVos.isEmpty()) { |
|
|
// }
|
|
|
for (LoanCustomerRecordStaffVo staffVo : staffVos) { |
|
|
// //信息查询授权书
|
|
|
AppStaffVo appStaffVo = new AppStaffVo(); |
|
|
// List<LoanFile> fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.INFO_LETTER.getAttachType());
|
|
|
if (StringUtils.isNotBlank(staffVo.getMobile())) { |
|
|
// fileList.removeAll(Collections.singleton(null));
|
|
|
appStaffVo.setMobile(staffVo.getMobile()); |
|
|
// if (!fileList.isEmpty()) {
|
|
|
} |
|
|
// List<String> infoLetter = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).
|
|
|
if (StringUtils.isNotBlank(staffVo.getName())) { |
|
|
// collect(Collectors.toList());
|
|
|
appStaffVo.setName(staffVo.getName()); |
|
|
// vo.setInfoLetter(infoLetter);
|
|
|
} |
|
|
// }
|
|
|
if (StringUtils.isNotBlank(staffVo.getIdentityKey())) { |
|
|
// //车队挂靠协议
|
|
|
appStaffVo.setIdentityKey(staffVo.getIdentityKey()); |
|
|
// fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.AGREEMENT.getAttachType());
|
|
|
} |
|
|
// fileList.removeAll(Collections.singleton(null));
|
|
|
if (StringUtils.isNotBlank(staffVo.getIdentityValue())) { |
|
|
// if (!fileList.isEmpty()) {
|
|
|
appStaffVo.setIdentityValue(staffVo.getIdentityValue()); |
|
|
// List<String> agreement = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList());
|
|
|
} |
|
|
// vo.setAgreement(agreement);
|
|
|
if (StringUtils.isNotBlank(staffVo.getIdNumber())) { |
|
|
// }
|
|
|
appStaffVo.setIdCard(staffVo.getIdNumber()); |
|
|
// //营业执照
|
|
|
} |
|
|
// fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.LICENSE.getAttachType());
|
|
|
appStaffVos.add(appStaffVo); |
|
|
// fileList.removeAll(Collections.singleton(null));
|
|
|
} |
|
|
// if (!fileList.isEmpty()) {
|
|
|
} |
|
|
// List<String> license = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList());
|
|
|
vo.setStaffs(appStaffVos); |
|
|
// vo.setLicense(license);
|
|
|
//信息查询授权书
|
|
|
// }
|
|
|
List<LoanFile> fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.INFO_LETTER.getAttachType()); |
|
|
// //法人和实际控制人身份证
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
// fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.ID_CARD.getAttachType());
|
|
|
if (!fileList.isEmpty()) { |
|
|
// fileList.removeAll(Collections.singleton(null));
|
|
|
List<String> infoLetter = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()). |
|
|
// if (!fileList.isEmpty()) {
|
|
|
collect(Collectors.toList()); |
|
|
// List<String> idCard = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList());
|
|
|
vo.setInfoLetter(infoLetter); |
|
|
// vo.setIdCard(idCard);
|
|
|
} |
|
|
// }
|
|
|
//车队挂靠协议
|
|
|
// //其他资料
|
|
|
fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.AGREEMENT.getAttachType()); |
|
|
// fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.OTHER_INFO.getAttachType());
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
// fileList.removeAll(Collections.singleton(null));
|
|
|
if (!fileList.isEmpty()) { |
|
|
// if (!fileList.isEmpty()) {
|
|
|
List<String> agreement = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
// List<String> otherInfo = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList());
|
|
|
vo.setAgreement(agreement); |
|
|
// vo.setOtherInfo(otherInfo);
|
|
|
} |
|
|
// }
|
|
|
//营业执照
|
|
|
//
|
|
|
fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.LICENSE.getAttachType()); |
|
|
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
|
|
List<String> license = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
|
|
|
vo.setLicense(license); |
|
|
|
|
|
} |
|
|
|
|
|
//法人和实际控制人身份证
|
|
|
|
|
|
fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.ID_CARD.getAttachType()); |
|
|
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
|
|
List<String> idCard = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
|
|
|
vo.setIdCard(idCard); |
|
|
|
|
|
} |
|
|
|
|
|
//其他资料
|
|
|
|
|
|
fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.OTHER_INFO.getAttachType()); |
|
|
|
|
|
fileList.removeAll(Collections.singleton(null)); |
|
|
|
|
|
if (!fileList.isEmpty()) { |
|
|
|
|
|
List<String> otherInfo = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList()); |
|
|
|
|
|
vo.setOtherInfo(otherInfo); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
vo.setUserSid(userSid); |
|
|
vo.setUserSid(userSid); |
|
|
vo.setOrgPath(orgPath); |
|
|
vo.setOrgPath(orgPath); |
|
@ -1154,7 +1192,332 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return rb.success().setData(vo); |
|
|
return rb.success().setData(vo); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public ResultBean<String> saveCustomerRecord(AppCustomerRecordDto dto) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
String sid = ""; |
|
|
|
|
|
// 企业开票人员信息
|
|
|
|
|
|
List<AppStaffVo> staffs = dto.getStaffs(); |
|
|
|
|
|
// 营业执照
|
|
|
|
|
|
List<String> license = dto.getLicense(); |
|
|
|
|
|
// 法人和实际控制人身份证
|
|
|
|
|
|
List<String> idCard = dto.getIdCard(); |
|
|
|
|
|
// 信息查询授权书
|
|
|
|
|
|
List<String> infoLetter = dto.getInfoLetter(); |
|
|
|
|
|
// 车队挂靠协议
|
|
|
|
|
|
List<String> agreement = dto.getAgreement(); |
|
|
|
|
|
// 其他资料
|
|
|
|
|
|
List<String> otherInfo = dto.getOtherInfo(); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getCustomerTypeKey())) { |
|
|
|
|
|
if (dto.getCustomerTypeKey().equals("1")) { |
|
|
|
|
|
dto.setStaffs(new ArrayList<>()); |
|
|
|
|
|
} else if (dto.getCustomerTypeKey().equals("2")) { |
|
|
|
|
|
dto.setDisName(""); |
|
|
|
|
|
dto.setMobile2(""); |
|
|
|
|
|
dto.setRegistNum(""); |
|
|
|
|
|
dto.setRegistDetailAddress(""); |
|
|
|
|
|
dto.setContract(""); |
|
|
|
|
|
dto.setLegalName(""); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getSid())) { |
|
|
|
|
|
sid = dto.getSid(); |
|
|
|
|
|
LoanCustomerRecord loanCustomerRecord = fetchBySid(sid); |
|
|
|
|
|
BeanUtil.copyProperties(dto, loanCustomerRecord, "id", "sid"); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getSalesmanSid())) { |
|
|
|
|
|
String salesmanUserSid = dto.getSalesmanSid(); |
|
|
|
|
|
loanCustomerRecord.setSalesUserSid(salesmanUserSid); |
|
|
|
|
|
SysUserVo data = sysUserFeign.fetchBySid(salesmanUserSid).getData(); |
|
|
|
|
|
if (null != data) { |
|
|
|
|
|
loanCustomerRecord.setStaffSid(data.getStaffSid()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getIsGK())) { |
|
|
|
|
|
loanCustomerRecord.setIsAnchored(dto.getIsGK()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getDisName())) { |
|
|
|
|
|
loanCustomerRecord.setBusinessName(dto.getDisName()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setBusinessName(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRegistNum())) { |
|
|
|
|
|
loanCustomerRecord.setTaxpayerNo(dto.getRegistNum()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setTaxpayerNo(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getMobile2())) { |
|
|
|
|
|
loanCustomerRecord.setPhone(dto.getMobile2()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setPhone(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRegistDetailAddress())) { |
|
|
|
|
|
loanCustomerRecord.setAddress(dto.getRegistDetailAddress()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setAddress(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getContract())) { |
|
|
|
|
|
loanCustomerRecord.setLeader(dto.getContract()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setLeader(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getLegalName())) { |
|
|
|
|
|
loanCustomerRecord.setLegal(dto.getLegalName()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setLegal(""); |
|
|
|
|
|
} |
|
|
|
|
|
baseMapper.updateById(loanCustomerRecord); |
|
|
|
|
|
} else { |
|
|
|
|
|
LoanCustomerRecord loanCustomerRecord = new LoanCustomerRecord(); |
|
|
|
|
|
sid = loanCustomerRecord.getSid(); |
|
|
|
|
|
BeanUtil.copyProperties(dto, loanCustomerRecord, "id", "sid"); |
|
|
|
|
|
loanCustomerRecord.setOrgSidPath(dto.getOrgPath()); |
|
|
|
|
|
loanCustomerRecord.setCreateBySid(dto.getUserSid()); |
|
|
|
|
|
ResultBean<String> orgSidByPath = sysStaffOrgFeign.getOrgSidByPath(dto.getOrgPath()); |
|
|
|
|
|
if (orgSidByPath.getSuccess()) { |
|
|
|
|
|
String userOrgSid = orgSidByPath.getData(); |
|
|
|
|
|
loanCustomerRecord.setUseOrgSid(userOrgSid); |
|
|
|
|
|
ResultBean<SysOrganizationVo> organizationVo = sysOrganizationFeign.fetchBySid(userOrgSid); |
|
|
|
|
|
if (organizationVo.getSuccess()) { |
|
|
|
|
|
SysOrganizationVo organizationVoData = organizationVo.getData(); |
|
|
|
|
|
if (null != organizationVoData) { |
|
|
|
|
|
loanCustomerRecord.setUseOrgName(organizationVoData.getName()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
loanCustomerRecord.setNodeState("待提交"); |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getSalesmanSid())) { |
|
|
|
|
|
String salesmanUserSid = dto.getSalesmanSid(); |
|
|
|
|
|
loanCustomerRecord.setSalesUserSid(salesmanUserSid); |
|
|
|
|
|
SysUserVo data = sysUserFeign.fetchBySid(salesmanUserSid).getData(); |
|
|
|
|
|
if (null != data) { |
|
|
|
|
|
loanCustomerRecord.setStaffSid(data.getStaffSid()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getIsGK())) { |
|
|
|
|
|
loanCustomerRecord.setIsAnchored(dto.getIsGK()); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getDisName())) { |
|
|
|
|
|
loanCustomerRecord.setBusinessName(dto.getDisName()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setBusinessName(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRegistNum())) { |
|
|
|
|
|
loanCustomerRecord.setTaxpayerNo(dto.getRegistNum()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setTaxpayerNo(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getMobile2())) { |
|
|
|
|
|
loanCustomerRecord.setPhone(dto.getMobile2()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setPhone(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getRegistDetailAddress())) { |
|
|
|
|
|
loanCustomerRecord.setAddress(dto.getRegistDetailAddress()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setAddress(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getContract())) { |
|
|
|
|
|
loanCustomerRecord.setLeader(dto.getContract()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setLeader(""); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getLegalName())) { |
|
|
|
|
|
loanCustomerRecord.setLegal(dto.getLegalName()); |
|
|
|
|
|
} else { |
|
|
|
|
|
loanCustomerRecord.setLegal(""); |
|
|
|
|
|
} |
|
|
|
|
|
baseMapper.insert(loanCustomerRecord); |
|
|
|
|
|
} |
|
|
|
|
|
if (StringUtils.isNotBlank(sid)) { |
|
|
|
|
|
loanCustomerRecordStaffService.deleteByMainSid(sid); |
|
|
|
|
|
if (!staffs.isEmpty()) { |
|
|
|
|
|
for (AppStaffVo staffDto : staffs) { |
|
|
|
|
|
LoanCustomerRecordStaff staff = new LoanCustomerRecordStaff(); |
|
|
|
|
|
BeanUtil.copyProperties(staffDto, staff, "id", "sid"); |
|
|
|
|
|
staff.setCustomerRecordSid(sid); |
|
|
|
|
|
if (StringUtils.isNotBlank(staffDto.getIdCard())) { |
|
|
|
|
|
staff.setIdNumber(staffDto.getIdCard()); |
|
|
|
|
|
} |
|
|
|
|
|
loanCustomerRecordStaffService.insert(staff); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//删除附件表中关于该linkSid的文件
|
|
|
|
|
|
loanFileService.deleteByLinkSid(sid); |
|
|
|
|
|
if (!license.isEmpty()) { |
|
|
|
|
|
loanFileService.saveAll(sid, license, LoanFileEnum.LICENSE.getAttachType()); |
|
|
|
|
|
} |
|
|
|
|
|
if (!idCard.isEmpty()) { |
|
|
|
|
|
loanFileService.saveAll(sid, idCard, LoanFileEnum.ID_CARD.getAttachType()); |
|
|
|
|
|
} |
|
|
|
|
|
if (!infoLetter.isEmpty()) { |
|
|
|
|
|
loanFileService.saveAll(sid, infoLetter, LoanFileEnum.INFO_LETTER.getAttachType()); |
|
|
|
|
|
} |
|
|
|
|
|
if (!agreement.isEmpty()) { |
|
|
|
|
|
loanFileService.saveAll(sid, agreement, LoanFileEnum.AGREEMENT.getAttachType()); |
|
|
|
|
|
} |
|
|
|
|
|
if (!otherInfo.isEmpty()) { |
|
|
|
|
|
loanFileService.saveAll(sid, otherInfo, LoanFileEnum.OTHER_INFO.getAttachType()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return rb.success().setData(sid); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean deleteCustomerRecord(String sid) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
LoanCustomerRecord loanCustomerRecord = fetchBySid(sid); |
|
|
|
|
|
if (!loanCustomerRecord.getNodeState().equals("待提交")) { |
|
|
|
|
|
return rb.setMsg("删除的数据中包含已提交或已办结审批的数据,删除失败"); |
|
|
|
|
|
} |
|
|
|
|
|
loanCustomerRecord.setIsDelete(1); |
|
|
|
|
|
baseMapper.updateById(loanCustomerRecord); |
|
|
|
|
|
return rb.success().setMsg("删除成功"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 判断提交的流程是否被允许 |
|
|
|
|
|
* |
|
|
|
|
|
* @param dto |
|
|
|
|
|
* @return |
|
|
|
|
|
*/ |
|
|
|
|
|
private synchronized int submitAPPBusinessData(AppSubmitCustomerRecordDto dto, LoanCustomerRecord loanCustomerRecord) { |
|
|
|
|
|
int r = 0; |
|
|
|
|
|
if (StringUtils.isBlank(dto.getSid())) { |
|
|
|
|
|
r = 1; |
|
|
|
|
|
} else { |
|
|
|
|
|
if (loanCustomerRecord != null) { |
|
|
|
|
|
String businessTaskId = loanCustomerRecord.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 submitCustomerRecord(AppSubmitCustomerRecordDto dto) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
LoanCustomerRecord loanCustomerRecord = fetchBySid(dto.getSid()); |
|
|
|
|
|
int r = submitAPPBusinessData(dto, loanCustomerRecord); |
|
|
|
|
|
if (r == 3) { |
|
|
|
|
|
return rb.setMsg("该申请不存在"); |
|
|
|
|
|
} |
|
|
|
|
|
if (r == 0) { |
|
|
|
|
|
return rb.setMsg("操作失败!提交的数据不一致"); |
|
|
|
|
|
} |
|
|
|
|
|
String businessSid = ""; |
|
|
|
|
|
//新增修改保存
|
|
|
|
|
|
ResultBean<String> resultBean = saveCustomerRecord(dto); |
|
|
|
|
|
if (resultBean.getSuccess()) { |
|
|
|
|
|
businessSid = resultBean.getData(); |
|
|
|
|
|
} |
|
|
|
|
|
LoanCustomerRecord 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<>(); |
|
|
|
|
|
//若有网关,则赋值网关中判断的字段。
|
|
|
|
|
|
variables.put("businessSid", businessSid); |
|
|
|
|
|
appMap.put("sid", businessSid); |
|
|
|
|
|
variables.put("app", appMap); |
|
|
|
|
|
LoanCustomerRecord loanCustomerRecord1 = fetchBySid(businessSid); |
|
|
|
|
|
String msgBusinessSid = loanCustomerRecord1.getSid(); |
|
|
|
|
|
//用户的部门全路径sid
|
|
|
|
|
|
bv.setOrgSidPath(loanCustomerRecord1.getOrgSidPath()); |
|
|
|
|
|
//业务sid
|
|
|
|
|
|
bv.setBusinessSid(businessSid); |
|
|
|
|
|
//用户sid
|
|
|
|
|
|
bv.setUserSid(dto.getUserSid()); |
|
|
|
|
|
bv.setFormVariables(variables); |
|
|
|
|
|
String nextNodeUserSids_ = sysOrganization.getManagerSid(); |
|
|
|
|
|
bv.setNextNodeUserSids(nextNodeUserSids_); |
|
|
|
|
|
//流程定义id
|
|
|
|
|
|
bv.setModelId(ProcDefEnum.LOANCUSTOMERRECORD.getProDefId()); |
|
|
|
|
|
if (r == 1) { |
|
|
|
|
|
//流程定义id
|
|
|
|
|
|
bv.setModelId(ProcDefEnum.LOANCUSTOMERRECORD.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(loanCustomerRecord1.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"); |
|
|
|
|
|
} |
|
|
|
|
|
LoanCustomerRecord loanCustomerRecord2 = fetchBySid(dto.getSid()); |
|
|
|
|
|
bv.setTaskId(dto.getTaskId()); |
|
|
|
|
|
bv.setTaskDefKey(loanCustomerRecord2.getNodeSid()); |
|
|
|
|
|
bv.setComment("重新提交"); |
|
|
|
|
|
bv.setInstanceId(dto.getInstanceId()); |
|
|
|
|
|
return complete(bv); |
|
|
|
|
|
} |
|
|
|
|
|
return rb; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|