|
@@ -1,44 +1,47 @@
|
|
|
package com.jeeplus.finance.ccpm.controller;
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.TypeReference;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.jeeplus.finance.ccpm.service.ccpm.FlowRequest;
|
|
|
-import com.jeeplus.finance.ccpm.vo.RuralProjectRecordsVo;
|
|
|
-import com.jeeplus.finance.ccpm.vo.WorkClientBankVo;
|
|
|
-import com.jeeplus.finance.ccpm.vo.WorkClientInfoVo;
|
|
|
-import com.jeeplus.finance.ccpm.vo.WorkContractInfoVo;
|
|
|
-import com.jeeplus.finance.contractRegistration.domain.ContractFile;
|
|
|
+import com.jeeplus.finance.ccpm.vo.*;
|
|
|
import com.jeeplus.finance.contractRegistration.domain.ContractFilePaper;
|
|
|
import com.jeeplus.finance.contractRegistration.domain.ContractInfo;
|
|
|
-import com.jeeplus.finance.contractRegistration.mapper.ContractFileMapper;
|
|
|
import com.jeeplus.finance.contractRegistration.mapper.ContractFilePaperMapper;
|
|
|
import com.jeeplus.finance.contractRegistration.mapper.ContractInfoMapper;
|
|
|
+import com.jeeplus.finance.projectRecords.domain.CwProjectClientContact;
|
|
|
import com.jeeplus.finance.projectRecords.domain.CwProjectRecords;
|
|
|
+import com.jeeplus.finance.projectRecords.mapper.CwProjectClientContactMapper;
|
|
|
import com.jeeplus.finance.projectRecords.mapper.CwProjectRecordsMapper;
|
|
|
-import com.jeeplus.finance.projectRecords.service.dto.CwProjectRecordsDTO;
|
|
|
import com.jeeplus.finance.projectReport.domain.*;
|
|
|
import com.jeeplus.finance.projectReport.mapper.*;
|
|
|
import com.jeeplus.finance.utils.RestTemplateService;
|
|
|
-import com.jeeplus.finance.utils.RestUtil;
|
|
|
-import com.jeeplus.finance.workClientInfo.domain.*;
|
|
|
+
|
|
|
+import com.jeeplus.finance.workClientInfo.domain.CwWorkClientBase;
|
|
|
+import com.jeeplus.finance.workClientInfo.domain.CwWorkClientBilling;
|
|
|
+import com.jeeplus.finance.workClientInfo.domain.CwWorkClientContact;
|
|
|
+import com.jeeplus.finance.workClientInfo.domain.CwWorkClientType;
|
|
|
import com.jeeplus.finance.workClientInfo.mapper.CwWorkClientBaseMapper;
|
|
|
import com.jeeplus.finance.workClientInfo.mapper.CwWorkClientBillingMapper;
|
|
|
+import com.jeeplus.finance.workClientInfo.mapper.CwWorkClientContactMapper;
|
|
|
import com.jeeplus.finance.workClientInfo.mapper.CwWorkClientTypeMapper;
|
|
|
-
|
|
|
import com.jeeplus.sys.domain.Area;
|
|
|
-import com.jeeplus.sys.feign.IAreaApi;
|
|
|
+import com.jeeplus.sys.domain.WorkAttachmentInfo;
|
|
|
+import com.jeeplus.sys.feign.*;
|
|
|
|
|
|
|
|
|
-import com.jeeplus.sys.feign.IDictApi;
|
|
|
+import com.jeeplus.sys.service.dto.OfficeDTO;
|
|
|
+import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.PostConstruct;
|
|
|
import javax.annotation.Resource;
|
|
@@ -89,20 +92,37 @@ public class CcpmList {
|
|
|
@Autowired
|
|
|
private ContractFilePaperMapper contractFilePaperMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private CwWorkClientContactMapper cwWorkClientContactMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private CwProjectClientContactMapper cwProjectClientContactMapper;
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
- @PostConstruct
|
|
|
- public void initMethod() throws Exception {
|
|
|
- getProjectList();
|
|
|
- getWorkContract();
|
|
|
- getAllClient();
|
|
|
+// @PostConstruct
|
|
|
+// public void initMethod() throws Exception {
|
|
|
+// //获取所有的用户信息
|
|
|
+// List<UserDTO> allUserInfo = SpringUtil.getBean(IUserApi.class).getAllUserInfo();
|
|
|
+// getAllClient(allUserInfo);
|
|
|
+// getWorkContract(allUserInfo);
|
|
|
+// getProjectList(allUserInfo);
|
|
|
+// }
|
|
|
+
|
|
|
+ public void getCcpmMethod() throws Exception {
|
|
|
+ //获取所有的用户信息
|
|
|
+ List<UserDTO> allUserInfo = SpringUtil.getBean(IUserApi.class).getAllUserInfo();
|
|
|
+ getAllClient(allUserInfo);
|
|
|
+ getWorkContract(allUserInfo);
|
|
|
+ getProjectList(allUserInfo);
|
|
|
}
|
|
|
|
|
|
/*8
|
|
|
获取项目信息
|
|
|
*/
|
|
|
- public void getProjectList() throws Exception {
|
|
|
+ public void getProjectList( List<UserDTO> allUserInfo) throws Exception {
|
|
|
//ccpm系统中的项目信息
|
|
|
Object projectList = flowRequest.getProjectList();
|
|
|
System.out.println(projectList);
|
|
@@ -116,6 +136,7 @@ public class CcpmList {
|
|
|
cwProjectReportSignAndIssueMapper.deleteByTenantId();
|
|
|
cwProjectReportOnlineArchivingMapper.deleteByTenantId();
|
|
|
cwProjectReportPaperArchivingMapper.deleteByTenantId();
|
|
|
+ cwProjectClientContactMapper.deleteByTenantId();
|
|
|
//将获取到的项目信息通过遍历的方式插入到数据表中
|
|
|
if (CollectionUtils.isNotEmpty(ruralProjectRecordsVos)){
|
|
|
for (RuralProjectRecordsVo recordsVo : ruralProjectRecordsVos) {
|
|
@@ -139,9 +160,32 @@ public class CcpmList {
|
|
|
cwProjectRecords.setProjectNumber(recordsVo.getProjectId());//项目编号
|
|
|
cwProjectRecords.setContractId(recordsVo.getWorkContractInfo().getId());
|
|
|
cwProjectRecords.setProjectName(recordsVo.getProjectName());
|
|
|
- cwProjectRecords.setProjectType(recordsVo.getProjectType());
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getProjectType())){
|
|
|
+ if (recordsVo.getProjectType().equals("2")){
|
|
|
+ cwProjectRecords.setProjectType("1");//造价
|
|
|
+ cwProjectRecords.setReportType(recordsVo.getAttachmentProjectSort()); //项目类别
|
|
|
+ }else {
|
|
|
+ cwProjectRecords.setProjectType("2");
|
|
|
+ cwProjectRecords.setReportType(recordsVo.getAttachmentProjectSort());
|
|
|
+ }
|
|
|
+ }
|
|
|
cwProjectRecords.setStatus(recordsVo.getProjectStatus()+"");
|
|
|
- cwProjectRecords.setCreateById("1");
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getCreateNamePhone())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(recordsVo.getCreateNamePhone()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()) {
|
|
|
+ UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getById(matchingUserId.get());
|
|
|
+ if (userDTO != null) {
|
|
|
+ cwProjectRecords.setCreateById(userDTO.getId());
|
|
|
+ cwProjectRecords.setUpdateById(userDTO.getId());
|
|
|
+ cwProjectRecords.setOfficeId(userDTO.getOfficeDTO().getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ cwProjectRecords.setCreateTime(recordsVo.getCreateDate());
|
|
|
cwProjectRecords.setTenantId("ccpm");
|
|
|
//获取项目所在地
|
|
|
List<Area> areaDTO = SpringUtil.getBean(IAreaApi.class).getAreaDTOByName(recordsVo.getArea().getName());
|
|
@@ -164,7 +208,64 @@ public class CcpmList {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //项目等级
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getSubmitMoney())){
|
|
|
+ if (recordsVo.getSubmitMoney().equals("1")){
|
|
|
+ cwProjectRecords.setProjectLevel("2");
|
|
|
+ }else {
|
|
|
+ cwProjectRecords.setProjectLevel("1");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //项目金额
|
|
|
+ if (ObjectUtils.isNotEmpty(recordsVo.getTotalFees())){
|
|
|
+ cwProjectRecords.setProjectMoney(recordsVo.getTotalFees().toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ //项目开始时间结束时间
|
|
|
+ cwProjectRecords.setProjectStartTime(recordsVo.getStartDate());
|
|
|
+ cwProjectRecords.setProjectEndTime(recordsVo.getEndDate());
|
|
|
+ //工程类型
|
|
|
+ cwProjectRecords.setEngineeringType(recordsVo.getEngineeringType());
|
|
|
+ //项目负责人
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getProjectMasterPhone())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(recordsVo.getProjectMasterPhone()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getById(matchingUserId.get());
|
|
|
+ if (userDTO != null){
|
|
|
+ cwProjectRecords.setProjectLeaderId(userDTO.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
cwProjectRecordsMapper.insert(cwProjectRecords);
|
|
|
+ //项目联系人
|
|
|
+ if (CollectionUtils.isNotEmpty(recordsVo.getWorkClientLinkmanList())){
|
|
|
+ for (WorkClientLinkman workClientLinkman : recordsVo.getWorkClientLinkmanList()) {
|
|
|
+ if (workClientLinkman.getClientId() != null){
|
|
|
+ CwProjectClientContact cwProjectClientContact = new CwProjectClientContact();
|
|
|
+ cwProjectClientContact.setProjectId(recordsVo.getId());
|
|
|
+ cwProjectClientContact.setClientId(workClientLinkman.getId());
|
|
|
+ cwProjectClientContact.setEmail(workClientLinkman.getEmail());
|
|
|
+ cwProjectClientContact.setContactFirst(workClientLinkman.getLinkMobile());
|
|
|
+ cwProjectClientContact.setContactSecond(workClientLinkman.getLinkPhone());
|
|
|
+ cwProjectClientContact.setName(workClientLinkman.getName());
|
|
|
+ cwProjectClientContact.setPosition(workClientLinkman.getPosition());
|
|
|
+ if (StringUtils.isNotBlank(workClientLinkman.getOffice())){
|
|
|
+ OfficeDTO officeDTOByName = SpringUtil.getBean(IOfficeApi.class).getOfficeDTOByName(workClientLinkman.getOffice());
|
|
|
+ if (officeDTOByName != null){
|
|
|
+ cwProjectClientContact.setOfficeId(officeDTOByName.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cwProjectClientContact.setClientContactId(workClientLinkman.getClientId().getId());
|
|
|
+ cwProjectClientContact.setTenantId("ccpm");
|
|
|
+ cwProjectClientContactMapper.insert(cwProjectClientContact);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
//质量复核
|
|
|
if (StringUtils.isNotBlank(recordsVo.getPrdId())){
|
|
@@ -173,7 +274,18 @@ public class CcpmList {
|
|
|
cwProjectReviewNew.setProjectId(recordsVo.getId());
|
|
|
cwProjectReviewNew.setReviewStatus(recordsVo.getProjectReportStatus().toString());
|
|
|
cwProjectReviewNew.setTenantId("ccpm");
|
|
|
- cwProjectReviewNew.setCreateById("1");
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getCreateNamePhone())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(recordsVo.getCreateNamePhone()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ cwProjectReviewNew.setCreateById(matchingUserId.get());
|
|
|
+ cwProjectReviewNew.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ cwProjectReviewNew.setCreateTime(recordsVo.getCreateDate());
|
|
|
cwProjectReviewNewMapper.insert(cwProjectReviewNew);
|
|
|
}
|
|
|
//报告
|
|
@@ -183,7 +295,18 @@ public class CcpmList {
|
|
|
report.setId(id);
|
|
|
report.setProjectId(recordsVo.getId());
|
|
|
report.setTenantId("ccpm");
|
|
|
- report.setCreateById("1");
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getCreateNamePhone())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(recordsVo.getCreateNamePhone()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ report.setCreateById(matchingUserId.get());
|
|
|
+ report.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ report.setCreateTime(recordsVo.getCreateDate());
|
|
|
cwProjectReportMapper.insert(report);
|
|
|
|
|
|
//报告编号
|
|
@@ -192,7 +315,18 @@ public class CcpmList {
|
|
|
cwProjectInfoData.setReportId(id);
|
|
|
cwProjectInfoData.setReportNo(recordsVo.getProjectReportNumber());
|
|
|
cwProjectInfoData.setTenantId("ccpm");
|
|
|
- cwProjectInfoData.setCreateById("1");
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getCreateNamePhone())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(recordsVo.getCreateNamePhone()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ cwProjectInfoData.setCreateById(matchingUserId.get());
|
|
|
+ cwProjectInfoData.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ cwProjectInfoData.setCreateTime(recordsVo.getCreateTime());
|
|
|
cwProjectInfoMapper.insert(cwProjectInfoData);
|
|
|
}
|
|
|
//报告签发
|
|
@@ -206,7 +340,18 @@ public class CcpmList {
|
|
|
|
|
|
}
|
|
|
cwProjectReportSignAndIssue.setTenantId("ccpm");
|
|
|
- cwProjectReportSignAndIssue.setCreateById("1");
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getCreateNamePhone())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(recordsVo.getCreateNamePhone()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ cwProjectReportSignAndIssue.setCreateById(matchingUserId.get());
|
|
|
+ cwProjectReportSignAndIssue.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ cwProjectReportSignAndIssue.setCreateTime(recordsVo.getCreateDate());
|
|
|
cwProjectReportSignAndIssueMapper.insert(cwProjectReportSignAndIssue);
|
|
|
}
|
|
|
|
|
@@ -220,7 +365,18 @@ public class CcpmList {
|
|
|
cwProjectReportOnlineArchiving.setStatus("");
|
|
|
}
|
|
|
cwProjectReportOnlineArchiving.setTenantId("ccpm");
|
|
|
- cwProjectReportOnlineArchiving.setCreateById("1");
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getCreateNamePhone())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(recordsVo.getCreateNamePhone()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ cwProjectReportOnlineArchiving.setCreateById(matchingUserId.get());
|
|
|
+ cwProjectReportOnlineArchiving.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ cwProjectReportOnlineArchiving.setCreateTime(recordsVo.getCreateDate());
|
|
|
cwProjectReportOnlineArchivingMapper.insert(cwProjectReportOnlineArchiving);
|
|
|
}
|
|
|
//纸质归档
|
|
@@ -234,8 +390,18 @@ public class CcpmList {
|
|
|
cwProjectReportPaperArchiving.setStatus("");
|
|
|
}
|
|
|
cwProjectReportPaperArchiving.setTenantId("ccpm");
|
|
|
- cwProjectReportPaperArchiving.setCreateById("1");
|
|
|
- cwProjectReportPaperArchiving.setUpdateById("1");
|
|
|
+ if (StringUtils.isNotBlank(recordsVo.getCreateNamePhone())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(recordsVo.getCreateNamePhone()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ cwProjectReportPaperArchiving.setCreateById(matchingUserId.get());
|
|
|
+ cwProjectReportPaperArchiving.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ cwProjectReportPaperArchiving.setCreateTime(recordsVo.getCreateDate());
|
|
|
cwProjectReportPaperArchivingMapper.insert(cwProjectReportPaperArchiving);
|
|
|
}
|
|
|
}
|
|
@@ -249,7 +415,7 @@ public class CcpmList {
|
|
|
/**
|
|
|
* 获取合同信息
|
|
|
*/
|
|
|
- public void getWorkContract(){
|
|
|
+ public void getWorkContract( List<UserDTO> allUserInfo){
|
|
|
//ccpm系统中的合同信息
|
|
|
Object contractList = flowRequest.getWorkContractList();
|
|
|
System.out.println(contractList);
|
|
@@ -263,8 +429,17 @@ public class CcpmList {
|
|
|
for (WorkContractInfoVo contractInfoVo : workContractInfoVos) {
|
|
|
ContractInfo workContractInfo = new ContractInfo();
|
|
|
workContractInfo.setId(contractInfoVo.getId());//id
|
|
|
- workContractInfo.setCreateById("1");
|
|
|
- workContractInfo.setCreateTime(new Date());
|
|
|
+ if (StringUtils.isNotBlank(contractInfoVo.getCreateUserMobile())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(contractInfoVo.getCreateUserMobile()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ workContractInfo.setCreateById(matchingUserId.get());
|
|
|
+ workContractInfo.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ workContractInfo.setCreateTime(contractInfoVo.getCreateDate());
|
|
|
workContractInfo.setContractName(contractInfoVo.getName());//合同名称
|
|
|
workContractInfo.setContractNo(contractInfoVo.getContractNum());//合同编号
|
|
|
workContractInfo.setClientContacts(contractInfoVo.getClient().getId());//客户id
|
|
@@ -302,17 +477,75 @@ public class CcpmList {
|
|
|
workContractInfo.setFiledNo(contractInfoVo.getRecordNum());//案卷号
|
|
|
workContractFile.setFiledPaperType(contractInfoVo.getContrractRecordStatus());
|
|
|
workContractFile.setTenantId("ccpm");
|
|
|
- workContractFile.setCreateById("1");
|
|
|
+ workContractFile.setCreateTime(contractInfoVo.getCreateDate());
|
|
|
+ if (StringUtils.isNotBlank(contractInfoVo.getCreateUserMobile())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(contractInfoVo.getCreateUserMobile()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ workContractFile.setCreateById(matchingUserId.get());
|
|
|
+ workContractFile.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+ }
|
|
|
contractFilePaperMapper.insert(workContractFile);
|
|
|
+ if (contractInfoVo.getWorkAttachments()!=null){
|
|
|
+ SpringUtil.getBean ( IWorkAttachmentApi.class ).deleteByAttachmentId(contractInfoVo.getId());
|
|
|
+ UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByLoginNameNotTenantId(contractInfoVo.getCreateUser());
|
|
|
+ if (userDTO != null){
|
|
|
+ saveWorkContractFiles(contractInfoVo.getWorkAttachments(),userDTO,contractInfoVo.getId(),"workcontract");
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 保存附件信息
|
|
|
+ * @param list 待保存的附件列表
|
|
|
+ * @param userDTO 当前登录用户
|
|
|
+ * @param id 关联id
|
|
|
+ */
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void saveWorkContractFiles(List<WorkClientAttachment> list, UserDTO userDTO, String id,String flag) {
|
|
|
+ int j = 1;
|
|
|
+ for (WorkClientAttachment dto : list) {
|
|
|
+ WorkAttachmentInfo i = new WorkAttachmentInfo();
|
|
|
+ //包含了url、size、name
|
|
|
+ i.setId(UUID.randomUUID().toString().replace("-", ""));
|
|
|
+// i.getCreateBy().setId(userDTO.getId());
|
|
|
+ i.setCreateTime(new Date());
|
|
|
+// i.getUpdateBy().setId(userDTO.getId());
|
|
|
+ i.setUpdateTime(new Date());
|
|
|
+ i.setDelFlag(0);
|
|
|
+ i.setUrl(dto.getUrl());
|
|
|
+ //文件类型处理
|
|
|
+ List<String> strings = Arrays.asList(dto.getAttachmentName().split("\\."));
|
|
|
+ if (CollectionUtil.isNotEmpty(strings)) {
|
|
|
+ i.setType(strings.get(1));
|
|
|
+ }
|
|
|
+ i.setAttachmentId(id);
|
|
|
+ i.setAttachmentName(dto.getAttachmentName());
|
|
|
+ i.setAttachmentFlag(flag);
|
|
|
+ i.setFileSize(dto.getFileSize());
|
|
|
+ i.setSort(j);
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ String workAttachment = JSON.toJSONString((i));
|
|
|
+ String userDTOInfo = JSON.toJSONString((userDTO));
|
|
|
+ map.put("workAttachment",workAttachment);
|
|
|
+ map.put("userDTO",userDTOInfo);
|
|
|
+ SpringUtil.getBean ( IWorkAttachmentApi.class ).insertWorkAttachment(map);
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//获取ccpm中所有的客户信息
|
|
|
- public void getAllClient(){
|
|
|
+ public void getAllClient( List<UserDTO> allUserInfo){
|
|
|
+
|
|
|
Object clientList = flowRequest.getClientList();
|
|
|
System.out.println(clientList);
|
|
|
if (ObjectUtils.isNotEmpty(clientList)){
|
|
@@ -321,20 +554,35 @@ public class CcpmList {
|
|
|
cwWorkClientBaseMapper.deleteByTenantId();
|
|
|
cwWorkClientBillingMapper.deleteByTenantId();
|
|
|
cwWorkClientTypeMapper.deleteByTenantId();
|
|
|
+ cwWorkClientBaseMapper.deleteLinkmanByTenantId();
|
|
|
for (WorkClientInfoVo workClientInfoVo : workClientInfoVos) {
|
|
|
//客户基本信息
|
|
|
CwWorkClientBase cwWorkClientBase = new CwWorkClientBase();
|
|
|
cwWorkClientBase.setId(workClientInfoVo.getId());
|
|
|
- cwWorkClientBase.setCreateById("1");
|
|
|
+ if (StringUtils.isNotBlank(workClientInfoVo.getCreateMobile())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(workClientInfoVo.getCreateMobile()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ cwWorkClientBase.setCreateById(matchingUserId.get());
|
|
|
+ cwWorkClientBase.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
cwWorkClientBase.setName(workClientInfoVo.getName());//客户名称
|
|
|
cwWorkClientBase.setIsUscCode(workClientInfoVo.getHasUscc()+"");//是否有统一社会信用代码
|
|
|
cwWorkClientBase.setUscCode(workClientInfoVo.getUscCode());//统一社会信用代码
|
|
|
cwWorkClientBase.setAddress(workClientInfoVo.getRegisterAddress());//地址
|
|
|
cwWorkClientBase.setMobile(workClientInfoVo.getTelephone()); //电话
|
|
|
- cwWorkClientBase.setIndustry(workClientInfoVo.getCompanyIndustry()); //所属行业
|
|
|
- cwWorkClientBase.setType(workClientInfoVo.getClientType()); //客户类型
|
|
|
+ if (StringUtils.isNotBlank(workClientInfoVo.getCompanyIndustry())){
|
|
|
+ String dictValue = SpringUtil.getBean(IDictApi.class).getDictValue(workClientInfoVo.getCompanyIndustry(), "cw_work_client_industry", "");
|
|
|
+ cwWorkClientBase.setIndustry(dictValue); //所属行业
|
|
|
+ }
|
|
|
+
|
|
|
cwWorkClientBase.setStatus("5");
|
|
|
cwWorkClientBase.setTenantId("ccpm");
|
|
|
+ cwWorkClientBase.setCreateTime(workClientInfoVo.getCreateDate());
|
|
|
cwWorkClientBaseMapper.insert(cwWorkClientBase);
|
|
|
//修改客户开户行信息
|
|
|
if (CollectionUtils.isNotEmpty(workClientInfoVo.getWorkClientBankList())){
|
|
@@ -344,6 +592,18 @@ public class CcpmList {
|
|
|
clientBilling.setClientId(workClientBank.getClientId().getId());
|
|
|
clientBilling.setAccountHolder(workClientBank.getOurBank());//开户行
|
|
|
clientBilling.setAccount(workClientBank.getBankNumber());//银行账号
|
|
|
+ if (StringUtils.isNotBlank(workClientInfoVo.getCreateMobile())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(workClientInfoVo.getCreateMobile()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ clientBilling.setCreateById(matchingUserId.get());
|
|
|
+ clientBilling.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ clientBilling.setCreateTime(workClientInfoVo.getCreateDate());
|
|
|
clientBilling.setTenantId("ccpm");
|
|
|
cwWorkClientBillingMapper.insert(clientBilling);
|
|
|
|
|
@@ -354,8 +614,50 @@ public class CcpmList {
|
|
|
cwWorkClientType.setIsListed("0");
|
|
|
cwWorkClientType.setTenantId("ccpm");
|
|
|
cwWorkClientType.setClientId(workClientInfoVo.getId());
|
|
|
+ cwWorkClientType.setCreateTime(workClientInfoVo.getCreateDate());
|
|
|
+ if (StringUtils.isNotBlank(workClientInfoVo.getCreateMobile())){
|
|
|
+ Optional<String> matchingUserId = allUserInfo.stream()
|
|
|
+ .filter(user -> user.getMobile().equals(workClientInfoVo.getCreateMobile()))
|
|
|
+ .map(UserDTO::getId)
|
|
|
+ .findFirst();
|
|
|
+ if (matchingUserId.isPresent()){
|
|
|
+ cwWorkClientType.setCreateById(matchingUserId.get());
|
|
|
+ cwWorkClientType.setUpdateById(matchingUserId.get());
|
|
|
+ }
|
|
|
+ }
|
|
|
cwWorkClientTypeMapper.insert(cwWorkClientType);
|
|
|
|
|
|
+ //客户联系人
|
|
|
+ CwWorkClientContact cwWorkClientContact = new CwWorkClientContact();
|
|
|
+ if (workClientInfoVo.getWorkClientLinkmanList() != null){
|
|
|
+ for (WorkClientLinkman clientLinkman : workClientInfoVo.getWorkClientLinkmanList()) {
|
|
|
+ cwWorkClientContact.setId(clientLinkman.getId());
|
|
|
+ cwWorkClientContact.setTenantId("ccpm");
|
|
|
+ cwWorkClientContact.setClientId(workClientInfoVo.getId());
|
|
|
+ cwWorkClientContact.setEmail(clientLinkman.getEmail());
|
|
|
+ cwWorkClientContact.setContactFirst(clientLinkman.getLinkMobile());
|
|
|
+ cwWorkClientContact.setContactSecond(clientLinkman.getLinkPhone());
|
|
|
+ if (StringUtils.isNotBlank(clientLinkman.getOffice())){
|
|
|
+ OfficeDTO officeDTOByName = SpringUtil.getBean(IOfficeApi.class).getOfficeDTOByName(clientLinkman.getOffice());
|
|
|
+ if (officeDTOByName != null){
|
|
|
+ cwWorkClientContact.setOfficeId(officeDTOByName.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cwWorkClientContact.setName(clientLinkman.getName());
|
|
|
+ cwWorkClientContact.setPosition(clientLinkman.getPosition());
|
|
|
+ cwWorkClientContactMapper.insert(cwWorkClientContact);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (workClientInfoVo.getWorkAttachments()!=null){
|
|
|
+ SpringUtil.getBean ( IWorkAttachmentApi.class ).deleteByAttachmentId(workClientInfoVo.getId());
|
|
|
+ UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByLoginNameNotTenantId(workClientInfoVo.getUserName());
|
|
|
+ if (userDTO != null){
|
|
|
+ saveWorkContractFiles(workClientInfoVo.getWorkAttachments(),userDTO,workClientInfoVo.getId(),"cw_work_client");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
|
|
|
}
|
|
|
}
|