|
|
@ -9,8 +9,12 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder; |
|
|
|
import com.yxt.anrui.base.api.basedistributor.BaseDistributor; |
|
|
|
import com.yxt.anrui.base.api.basedistributor.app.BaseDistributorsQuery; |
|
|
|
import com.yxt.anrui.base.api.basedistributor.app.apply.AppDistributorApplyVo; |
|
|
|
import com.yxt.anrui.base.api.basedistributor.app.apply.AppSalesDeptVo; |
|
|
|
import com.yxt.anrui.base.api.basedistributor.app.apply.AppSalesman; |
|
|
|
import com.yxt.anrui.base.api.basedistributorappendix.BaseDistributorAppendix; |
|
|
|
import com.yxt.anrui.base.api.basedistributorapply.BaseDistributorApply; |
|
|
|
import com.yxt.anrui.base.api.basedistributorapply.BaseDistributorApplyFeign; |
|
|
|
import com.yxt.anrui.base.api.basedistributorapply.BaseSalesManger; |
|
|
|
import com.yxt.anrui.base.api.basedistributorapply.flow.DistributorDelegateQuery; |
|
|
|
import com.yxt.anrui.base.api.basedistributorapplyappendix.BaseDistributorApplyAppendixVo; |
|
|
|
import com.yxt.anrui.crm.api.crmcustomertemp.CrmCustomerTempFeign; |
|
|
@ -27,8 +31,7 @@ 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.sysorganization.*; |
|
|
|
import com.yxt.anrui.portal.api.sysparameter.SysParameterEnum; |
|
|
|
import com.yxt.anrui.portal.api.sysparameter.SysParameterFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrg; |
|
|
@ -39,8 +42,10 @@ import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
|
|
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.*; |
|
|
|
|
|
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecord.app.AppCustomerRecordInitVo; |
|
|
|
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.loancustomerrecordstaff.LoanCustomerRecordStaff; |
|
|
|
import com.yxt.anrui.riskcenter.api.loancustomerrecordstaff.LoanCustomerRecordStaffDto; |
|
|
@ -105,6 +110,8 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
|
private FlowableFeign flowableFeign; |
|
|
|
@Autowired |
|
|
|
private SysParameterFeign sysParameterFeign; |
|
|
|
@Autowired |
|
|
|
private BaseDistributorApplyFeign baseDistributorApplyFeign; |
|
|
|
|
|
|
|
/** |
|
|
|
* 分页列表 |
|
|
@ -201,6 +208,9 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
|
LoanCustomerRecordDetailsVo vo = new LoanCustomerRecordDetailsVo(); |
|
|
|
LoanCustomerRecord entity = fetchBySid(sid); |
|
|
|
BeanUtil.copyProperties(entity, vo); |
|
|
|
if (StringUtils.isNotBlank(entity.getStaffSid())) { |
|
|
|
vo.setSalesmanSid(entity.getStaffSid()); |
|
|
|
} |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
if (null != entity.getApplyDate()) { |
|
|
|
vo.setApplyDate(sdf.format(entity.getApplyDate())); |
|
|
@ -313,6 +323,14 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
|
sid = dto.getSid(); |
|
|
|
LoanCustomerRecord loanCustomerRecord = fetchBySid(sid); |
|
|
|
BeanUtil.copyProperties(dto, loanCustomerRecord, "id", "sid"); |
|
|
|
if (StringUtils.isNotBlank(dto.getSalesmanSid())) { |
|
|
|
String salesmanSid = dto.getSalesmanSid(); |
|
|
|
loanCustomerRecord.setStaffSid(salesmanSid); |
|
|
|
SysUserVo data = sysUserFeign.selectByStaffsid(salesmanSid).getData(); |
|
|
|
if (null != data) { |
|
|
|
loanCustomerRecord.setSalesUserSid(data.getSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.updateById(loanCustomerRecord); |
|
|
|
} else { |
|
|
|
LoanCustomerRecord loanCustomerRecord = new LoanCustomerRecord(); |
|
|
@ -333,6 +351,14 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
|
} |
|
|
|
} |
|
|
|
loanCustomerRecord.setNodeState("待提交"); |
|
|
|
if (StringUtils.isNotBlank(dto.getSalesmanSid())) { |
|
|
|
String salesmanSid = dto.getSalesmanSid(); |
|
|
|
loanCustomerRecord.setStaffSid(salesmanSid); |
|
|
|
SysUserVo data = sysUserFeign.selectByStaffsid(salesmanSid).getData(); |
|
|
|
if (null != data) { |
|
|
|
loanCustomerRecord.setSalesUserSid(data.getSid()); |
|
|
|
} |
|
|
|
} |
|
|
|
baseMapper.insert(loanCustomerRecord); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(sid)) { |
|
|
@ -596,11 +622,13 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
|
String address = ""; |
|
|
|
String phone = ""; |
|
|
|
String invoicingSid = ""; |
|
|
|
String orgPath = ""; |
|
|
|
if (StringUtils.isNotBlank(entity.getTaxpayerNo())) { |
|
|
|
taxpayerNo = entity.getTaxpayerNo(); |
|
|
|
FinCompanyInvoicingDetailsVo data = finCompanyInvoicingFeign.selectInvoingByTaxpayerNo(taxpayerNo).getData(); |
|
|
|
if (null != data) { |
|
|
|
invoicingSid = data.getSid(); |
|
|
|
orgPath = data.getOrgSidPath(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getBusinessName())) { |
|
|
@ -614,6 +642,7 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(invoicingSid)) { |
|
|
|
invoicingDto.setSid(invoicingSid); |
|
|
|
invoicingDto.setOrgSidPath(orgPath); |
|
|
|
} else { |
|
|
|
invoicingDto.setOrgSidPath(entity.getOrgSidPath()); |
|
|
|
invoicingDto.setCreateBySid(entity.getCreateBySid()); |
|
|
@ -635,11 +664,13 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
|
String address = ""; |
|
|
|
String phone = ""; |
|
|
|
String invoicingSid = ""; |
|
|
|
String orgPath = ""; |
|
|
|
if (StringUtils.isNotBlank(customerTempVo.getIDNumber())) { |
|
|
|
taxpayerNo = customerTempVo.getIDNumber(); |
|
|
|
FinCompanyInvoicingDetailsVo data = finCompanyInvoicingFeign.selectInvoingByTaxpayerNo(taxpayerNo).getData(); |
|
|
|
if (null != data) { |
|
|
|
invoicingSid = data.getSid(); |
|
|
|
orgPath = data.getOrgSidPath(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(customerTempVo.getName())) { |
|
|
@ -653,6 +684,7 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(invoicingSid)) { |
|
|
|
invoicingDto.setSid(invoicingSid); |
|
|
|
invoicingDto.setOrgSidPath(orgPath); |
|
|
|
} else { |
|
|
|
invoicingDto.setOrgSidPath(entity.getOrgSidPath()); |
|
|
|
invoicingDto.setCreateBySid(entity.getCreateBySid()); |
|
|
@ -932,4 +964,183 @@ public class LoanCustomerRecordService extends MybatisBaseService<LoanCustomerRe |
|
|
|
PagerVo<AppCustomerRecordVo> p = PagerUtil.pageToVo(pagging, null); |
|
|
|
return p; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<AppCustomerRecordInitVo> customerRecordInit(String sid, String orgPath, String userSid) { |
|
|
|
ResultBean<AppCustomerRecordInitVo> rb = ResultBean.fireFail(); |
|
|
|
AppCustomerRecordInitVo vo = new AppCustomerRecordInitVo(); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
|
|
|
LoanCustomerRecord entity = fetchBySid(sid); |
|
|
|
if (entity != null) { |
|
|
|
vo.setUserSid(entity.getCreateBySid()); |
|
|
|
vo.setOrgPath(entity.getOrgSidPath()); |
|
|
|
if (null != entity.getApplyDate()) { |
|
|
|
vo.setApplyDate(sdf.format(entity.getApplyDate())); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getRemarks())) { |
|
|
|
vo.setRemarks(entity.getRemarks()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getIsAnchored())) { |
|
|
|
vo.setIsGK(entity.getIsAnchored()); |
|
|
|
} |
|
|
|
// 主管人员
|
|
|
|
if (StringUtils.isNotBlank(entity.getManageSid())) { |
|
|
|
vo.setMangeSid(entity.getManageSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getManage())) { |
|
|
|
vo.setMange(entity.getManage()); |
|
|
|
} |
|
|
|
//销售部门
|
|
|
|
if (StringUtils.isNotBlank(entity.getSalesDeptSid())) { |
|
|
|
vo.setSalesDeptSid(entity.getSalesDeptSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getSalesDept())) { |
|
|
|
vo.setSalesDept(entity.getSalesDept()); |
|
|
|
} |
|
|
|
//销售专员
|
|
|
|
if (StringUtils.isNotBlank(entity.getSalesman())) { |
|
|
|
vo.setSalesman(entity.getSalesman()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getSalesUserSid())) { |
|
|
|
vo.setSalesmanSid(entity.getSalesUserSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getTaskId())) { |
|
|
|
vo.setTaskId(entity.getTaskId()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getProcInstId())) { |
|
|
|
vo.setProcInsId(entity.getProcInstId()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getApplyName()) && StringUtils.isNotBlank(entity.getDept())) { |
|
|
|
vo.setPublishInfo(entity.getDept() + "-" + entity.getApplyName()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getCustomerTypeKey())) { |
|
|
|
vo.setCustomerTypeKey(entity.getCustomerTypeKey()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getCustomerType())) { |
|
|
|
vo.setCustomerType(entity.getCustomerType()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(entity.getProcInstId())) { |
|
|
|
vo.setProcInsId(entity.getProcInstId()); |
|
|
|
} |
|
|
|
//组装销售专员
|
|
|
|
List<AppSalesmanRsk> users = new ArrayList<>(); |
|
|
|
SysOrganizationListQuery query = new SysOrganizationListQuery(); |
|
|
|
query.setOrgPath(orgPath); |
|
|
|
query.setUserSid(userSid); |
|
|
|
List<SysOrganizationListVo> sysOrganizationListVos = sysOrganizationFeign.selectOrgList(query).getData(); |
|
|
|
sysOrganizationListVos.removeAll(Collections.singleton(null)); |
|
|
|
if (!sysOrganizationListVos.isEmpty()) { |
|
|
|
for (SysOrganizationListVo org : sysOrganizationListVos) { |
|
|
|
if (org.getOrgDeptSid().equals(entity.getDeptSid())) { |
|
|
|
List<SysOrgStaffVo> staff = org.getStaffinfoVoList(); |
|
|
|
if (!staff.isEmpty()) { |
|
|
|
for (SysOrgStaffVo sysOrgStaffVo : staff) { |
|
|
|
AppSalesmanRsk user = new AppSalesmanRsk(); |
|
|
|
if (StringUtils.isNotBlank(sysOrgStaffVo.getUserSid())) { |
|
|
|
user.setDictKey(sysOrgStaffVo.getUserSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(sysOrgStaffVo.getStaffName())) { |
|
|
|
user.setDictValue(sysOrgStaffVo.getStaffName()); |
|
|
|
} |
|
|
|
users.add(user); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
vo.setUsers(users); |
|
|
|
//查询客户基本信息
|
|
|
|
if (StringUtils.isNotBlank(entity.getCustomerSid())) { |
|
|
|
String customerSid = entity.getCustomerSid(); |
|
|
|
CrmCustomerTempVo customerTempVo = crmCustomerTempFeign.fetchSid(customerSid).getData(); |
|
|
|
if (null != customerTempVo) { |
|
|
|
if (StringUtils.isNotBlank(customerTempVo.getMobile())) { |
|
|
|
vo.setMobile(customerTempVo.getMobile()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(customerTempVo.getIDNumber())) { |
|
|
|
vo.setIdNumber(customerTempVo.getIDNumber()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(customerTempVo.getCertificateType())) { |
|
|
|
vo.setIdType(customerTempVo.getCertificateType()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(customerTempVo.getEndDate())) { |
|
|
|
vo.setIdDate(customerTempVo.getEndDate()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(customerTempVo.getAddress())) { |
|
|
|
vo.setAddressNss(customerTempVo.getAddress()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//查询企业人员信息
|
|
|
|
// List<LoanCustomerRecordStaffVo> staffVos = loanCustomerRecordStaffService.getStaffsByMainSid(sid).getData();
|
|
|
|
// staffVos.removeAll(Collections.singleton(null));
|
|
|
|
// if (!staffVos.isEmpty()) {
|
|
|
|
// vo.setStaffs(staffVos);
|
|
|
|
// }
|
|
|
|
// //信息查询授权书
|
|
|
|
// List<LoanFile> fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.INFO_LETTER.getAttachType());
|
|
|
|
// fileList.removeAll(Collections.singleton(null));
|
|
|
|
// if (!fileList.isEmpty()) {
|
|
|
|
// List<String> infoLetter = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).
|
|
|
|
// collect(Collectors.toList());
|
|
|
|
// vo.setInfoLetter(infoLetter);
|
|
|
|
// }
|
|
|
|
// //车队挂靠协议
|
|
|
|
// fileList = loanFileService.selectByLinkSid(sid, LoanFileEnum.AGREEMENT.getAttachType());
|
|
|
|
// fileList.removeAll(Collections.singleton(null));
|
|
|
|
// if (!fileList.isEmpty()) {
|
|
|
|
// List<String> agreement = fileList.stream().map(c -> fileUploadComponent.getUrlPrefix() + c.getFilePath()).collect(Collectors.toList());
|
|
|
|
// vo.setAgreement(agreement);
|
|
|
|
// }
|
|
|
|
// //营业执照
|
|
|
|
// 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 { |
|
|
|
vo.setUserSid(userSid); |
|
|
|
vo.setOrgPath(orgPath); |
|
|
|
vo.setApplyDate(sdf.format(new Date())); |
|
|
|
SysUserVo sysUserVo = sysUserFeign.fetchBySid(userSid).getData(); |
|
|
|
if (null != sysUserVo) { |
|
|
|
vo.setApplyName(sysUserVo.getName()); |
|
|
|
//根据orgPath查询部门
|
|
|
|
List<String> orgPathsList = Arrays.asList(orgPath.split("/")); |
|
|
|
String orgSids = orgPathsList.get(orgPathsList.size() - 1); |
|
|
|
vo.setDeptSid(orgSids); |
|
|
|
ResultBean<SysOrganizationVo> organizationResultBean = sysOrganizationFeign.fetchBySid(orgSids); |
|
|
|
if (organizationResultBean.getData() != null) { |
|
|
|
String deptName = organizationResultBean.getData().getName(); |
|
|
|
vo.setDept(deptName); |
|
|
|
} |
|
|
|
BaseSalesManger baseSalesManger = baseDistributorApplyFeign.selectMangerByDeptSid(orgSids).getData(); |
|
|
|
if (null != baseSalesManger) { |
|
|
|
if (StringUtils.isNotBlank(baseSalesManger.getManageSid())) { |
|
|
|
vo.setTempMangeSid(baseSalesManger.getManageSid()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(baseSalesManger.getManage())) { |
|
|
|
vo.setTempMange(baseSalesManger.getManage()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return rb.success().setData(vo); |
|
|
|
} |
|
|
|
} |
|
|
|