|
@@ -10,7 +10,10 @@ import com.jeeplus.sys.utils.StringUtils;
|
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
|
import com.jeeplus.test.cw.contractRegistration.domain.ContractFile;
|
|
|
import com.jeeplus.test.cw.contractRegistration.domain.ContractInfo;
|
|
|
+import com.jeeplus.test.cw.contractRegistration.domain.ContractParticipant;
|
|
|
import com.jeeplus.test.cw.contractRegistration.mapper.ContractInfoMapper;
|
|
|
+import com.jeeplus.test.cw.contractRegistration.mapper.ContractParticipantMapper;
|
|
|
+import com.jeeplus.test.cw.workClientInfo.service.dto.CwWorkClientBaseDTO;
|
|
|
import com.jeeplus.test.mould.service.SerialnumTplService;
|
|
|
import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
|
import com.jeeplus.test.oss.mapper.OssServiceMapper;
|
|
@@ -25,10 +28,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.UUID;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author: 王强
|
|
@@ -46,6 +46,9 @@ public class ContractInfoService {
|
|
|
@Resource
|
|
|
private OssServiceMapper ossServiceMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private ContractParticipantMapper participantMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 根据id修改status
|
|
|
*/
|
|
@@ -138,7 +141,9 @@ public class ContractInfoService {
|
|
|
public ContractInfo findById(String id) {
|
|
|
|
|
|
ContractInfo dto = mapper.findById(id);
|
|
|
+
|
|
|
if (dto != null){
|
|
|
+ List<ContractParticipant> participant = participantMapper.findByInfoId(dto.getId());
|
|
|
dto.setContractStatus("新创建");
|
|
|
// 查询附件信息
|
|
|
List<WorkAttachmentDto> dtos = mapper.findDtos(id);
|
|
@@ -147,6 +152,17 @@ public class ContractInfoService {
|
|
|
i.setCreateBy(UserUtils.get(i.getBy()));
|
|
|
}
|
|
|
}
|
|
|
+ List<CwWorkClientBaseDTO> list = new ArrayList<>();
|
|
|
+ if (participant.size()>0){
|
|
|
+ participant.forEach(cw->{
|
|
|
+ CwWorkClientBaseDTO baseDTO = new CwWorkClientBaseDTO();
|
|
|
+ baseDTO.setName(cw.getCustomerName());
|
|
|
+ baseDTO.setNo(cw.getCustomerNo());
|
|
|
+ list.add(baseDTO);
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+ dto.setCwWorkClientContactDTOList(list);
|
|
|
dto.setContractProperList(dtos);
|
|
|
}
|
|
|
|
|
@@ -155,6 +171,7 @@ public class ContractInfoService {
|
|
|
|
|
|
public String saveInfo(ContractInfo info) throws Exception {
|
|
|
if (StringUtils.isNotEmpty(info.getId())) {
|
|
|
+ //对参与签约方进行处理 将参与签约方的客户编号 和 客户名称进行持久化
|
|
|
ContractInfo contractInfo = mapper.selectById(info.getId());
|
|
|
if (contractInfo != null) {
|
|
|
info.setCreateBy(info.getCreateId());
|
|
@@ -190,6 +207,26 @@ public class ContractInfoService {
|
|
|
int num = Integer.parseInt(contractInfo.getChangeNum()) + 1;
|
|
|
contractInfo.setChangeNum(num + "");
|
|
|
mapper.updateById(contractInfo);
|
|
|
+ ContractParticipant participant = new ContractParticipant();
|
|
|
+ //对参与签约方进行操作
|
|
|
+ participantMapper.deleteFromParticipant(info.getId());
|
|
|
+ //在操作前,清空之前的信息
|
|
|
+ if (info.getCwWorkClientContactDTOList().size()>0){
|
|
|
+ info.getCwWorkClientContactDTOList().forEach(cw->{
|
|
|
+
|
|
|
+ String parId = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ participant.setId(parId);
|
|
|
+ participant.setContractInfoId(info.getId());
|
|
|
+ participant.setCustomerName(cw.getName());
|
|
|
+ participant.setCustomerNo(cw.getNo());
|
|
|
+ participant.setCreateBy(userDTO.getId());
|
|
|
+ participant.setCreateDate(new Date());
|
|
|
+ participant.setUpdateBy(userDTO.getId());
|
|
|
+ participant.setUpdateDate(new Date());
|
|
|
+ participantMapper.insert(participant);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
List<WorkAttachmentDto> list = info.getContractProperList();
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
updateFiles(list, userDTO, info.getId());
|
|
@@ -218,6 +255,25 @@ public class ContractInfoService {
|
|
|
info.setUpdateBy(userDTO.getId());
|
|
|
info.setUpdateDate(new Date());
|
|
|
mapper.insert(info);
|
|
|
+ //对参与签约方进行持久化
|
|
|
+ //对参与签约方进行操作
|
|
|
+ participantMapper.deleteFromParticipant(info.getId());
|
|
|
+ ContractParticipant participant = new ContractParticipant();
|
|
|
+ if (info.getCwWorkClientContactDTOList().size()>0){
|
|
|
+ info.getCwWorkClientContactDTOList().forEach(cw->{
|
|
|
+ String parId = UUID.randomUUID().toString().replace("-", "");
|
|
|
+ participant.setId(parId);
|
|
|
+ participant.setContractInfoId(id);
|
|
|
+ participant.setCustomerName(cw.getName());
|
|
|
+ participant.setCustomerNo(cw.getNo());
|
|
|
+ participant.setCreateBy(userDTO.getId());
|
|
|
+ participant.setCreateDate(new Date());
|
|
|
+ participant.setUpdateBy(userDTO.getId());
|
|
|
+ participant.setUpdateDate(new Date());
|
|
|
+ participantMapper.insert(participant);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
List<WorkAttachmentDto> list = contractInfo.getContractProperList();
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
saveFiles(list, userDTO, id);
|