Ver código fonte

财务-合同报告bug修改

wangqiang 2 anos atrás
pai
commit
9ae1543c11

+ 9 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/controller/ContractInfoController.java

@@ -72,6 +72,15 @@ public class ContractInfoController {
     }
 
     /**
+     * 合同登记查询附件信息
+     */
+    @ApiOperation(value = "合同登记查询")
+    @GetMapping(value = "findFileInfoById")
+    public ContractInfo findFileInfoById(@RequestParam String id) {
+        return service.findFileInfoById(id);
+    }
+
+    /**
      * 合同登记查询
      */
     @ApiOperation(value = "根据归档id查询")

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/domain/ContractFile.java

@@ -58,11 +58,13 @@ public class ContractFile extends BaseEntity {
     /**
      * 客户名称
      */
+    @TableField(exist = false)
     private String customerName;
 
     /**
      * 客户编号
      */
+    @TableField(exist = false)
     private String customerNo;
 
     /**

+ 24 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/domain/ContractInfo.java

@@ -135,4 +135,28 @@ public class ContractInfo extends BaseEntity {
 
     @TableField(exist = false)
     private String taskBorrowId;
+
+    /**
+     * 客户id
+     */
+    @TableField(exist = false)
+    private String customerId;
+
+    /**
+     * 客户编号
+     */
+    @TableField(exist = false)
+    private String customerNo;
+
+    /**
+     * 统一社会信用代码
+     */
+    @TableField(exist = false)
+    private String uscCode;
+
+    /**
+     * 客户地址
+     */
+    @TableField(exist = false)
+    private String address;
 }

+ 2 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/ContractInfoMapper.java

@@ -32,6 +32,8 @@ public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
 
     ContractInfo findById (@Param("id") String id);
 
+    ContractInfo findFileInfoById (@Param("id") String id);
+
     ContractInfo findByContractId (@Param("id") String id);
 
     void updateStatusById(@Param("id") String id, @Param("status")String status);

+ 10 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/xml/ContractInfoMapper.xml

@@ -84,8 +84,12 @@
             a.contract_opposite,
             a.contract_fee,
             a.fees,
-            a.client_contacts as clientContacts,
-            a.client_contacts_phone as clientContactsPhone,
+            cw.id as customerId,
+            cw.name as clientContacts,
+            cw.no as customerNo,
+            cw.usc_code as uscCode,
+            cw.mobile as clientContactsPhone,
+            cw.address as address,
             a.contract_approval_type as contractApprovalType,
             a.proc_ins_id as procInsId,
             a.status,
@@ -96,6 +100,7 @@
 			cw_work_contract_info a
             LEFT JOIN cw_work_contract_file b on a.id = b.contract_info_id
             LEFT JOIN sys_user c ON a.create_by = c.id
+            left join cw_work_client_base cw on a.client_contacts = cw.id
         WHERE
 			a.id = #{id}
 			AND a.del_flag = 0
@@ -169,4 +174,7 @@
     <select id="findChildIds" resultType="java.lang.String">
         select id from sys_office where parent_id = #{department}
     </select>
+    <select id="findFileInfoById" resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractInfo">
+        select * from cw_work_contract_info where id = #{id}
+    </select>
 </mapper>

+ 89 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/ContractInfoService.java

@@ -1,5 +1,6 @@
 package com.jeeplus.test.cw.contractRegistration.service;
 
+import com.alibaba.druid.sql.visitor.functions.If;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -194,12 +195,100 @@ public class ContractInfoService {
 
             dto.setCwWorkClientContactDTOList(list);
             dto.setContractProperList(dtos);
+        } else {
+            //穿来的是归档的id
+            ContractFile infoByConId = fileMapper.getById(id);
+            if ( null != infoByConId) {
+                dto = mapper.findById(infoByConId.getContractInfoId());
+                if (null != dto) {
+                    List<ContractParticipant> participant = participantMapper.findByInfoId(dto.getId());
+                    dto.setContractStatus("新创建");
+                    // 查询附件信息
+                    List<WorkAttachmentDto> dtos = mapper.findDtos(dto.getId());
+                    if (CollectionUtils.isNotEmpty(dtos)) {
+                        for (WorkAttachmentDto i : dtos) {
+                            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);
+                        });
+
+                    }
+                    if (null != infoByConId){
+                        //查归档附件信息
+                        List<WorkAttachmentDto> fileDtos = mapper.findDtos(id);
+                        if (CollectionUtils.isNotEmpty(fileDtos)) {
+                            for (WorkAttachmentDto i : fileDtos) {
+                                i.setCreateBy(UserUtils.get(i.getBy()));
+                            }
+                            dto.setContractInfoList(fileDtos);
+                        }
+                    }
+
+                    dto.setCwWorkClientContactDTOList(list);
+                    dto.setContractProperList(dtos);
+                }
+            }
+        }
+
+        return dto;
+    }
+
+    /**
+     * 合同登记查询附件信息
+     */
+    public ContractInfo findFileInfoById(String id) {
+
+        ContractInfo dto = mapper.findFileInfoById(id);
+
+        if (dto != null){
+            List<ContractParticipant> participant = participantMapper.findByInfoId(dto.getId());
+            dto.setContractStatus("新创建");
+            // 查询附件信息
+            List<WorkAttachmentDto> dtos = mapper.findDtos(id);
+            if (CollectionUtils.isNotEmpty(dtos)) {
+                for (WorkAttachmentDto i : dtos) {
+                    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);
+                });
+
+            }
+            //根据合同id去归档表查归档附件信息
+            ContractFile file = fileMapper.getInfoByConId(dto.getId());
+            if (null != file){
+                //查归档附件信息
+                List<WorkAttachmentDto> fileDtos = mapper.findDtos(file.getId());
+                if (CollectionUtils.isNotEmpty(fileDtos)) {
+                    for (WorkAttachmentDto i : fileDtos) {
+                        i.setCreateBy(UserUtils.get(i.getBy()));
+                    }
+                    dto.setContractInfoList(fileDtos);
+                }
+            }
+
+            dto.setCwWorkClientContactDTOList(list);
+            dto.setContractProperList(dtos);
         }
 
         return dto;
     }
 
     public String saveInfo(ContractInfo info) throws Exception {
+        info.setClientContacts(info.getCustomerId());
         if (StringUtils.isNotEmpty(info.getId())) {
             //对参与签约方进行处理  将参与签约方的客户编号 和 客户名称进行持久化
             ContractInfo contractInfo = mapper.selectById(info.getId());