Преглед на файлове

财务-合同登记借用

wangqiang преди 2 години
родител
ревизия
3ae4a0336c
променени са 15 файла, в които са добавени 561 реда и са изтрити 7 реда
  1. 96 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/controller/CwContractBorrowController.java
  2. 36 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/domain/ContractInfo.java
  3. 40 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/domain/CwWorkContractBorrow.java
  4. 35 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/domain/CwWorkContractBorrowMessage.java
  5. 2 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/ContractFileMapper.java
  6. 4 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/ContractInfoMapper.java
  7. 28 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/CwWorkContractBorrowMapper.java
  8. 11 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/CwWorkContractBorrowMessageMapper.java
  9. 9 2
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/xml/ContractFileMapper.xml
  10. 22 2
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/xml/ContractInfoMapper.xml
  11. 45 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/xml/CwWorkContractBorrowMapper.xml
  12. 10 2
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/ContractFileService.java
  13. 21 1
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/ContractInfoService.java
  14. 160 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/CwWorkContractBorrowService.java
  15. 42 0
      jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/dto/CwWorkContractBorrowDto.java

+ 96 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/controller/CwContractBorrowController.java

@@ -0,0 +1,96 @@
+package com.jeeplus.test.cw.contractRegistration.controller;
+
+import com.jeeplus.common.utils.ResponseUtil;
+import com.jeeplus.test.cw.contractRegistration.domain.CwWorkContractBorrow;
+import com.jeeplus.test.cw.contractRegistration.domain.CwWorkContractBorrowMessage;
+import com.jeeplus.test.cw.contractRegistration.service.CwWorkContractBorrowService;
+import com.jeeplus.test.cw.contractRegistration.service.dto.CwWorkContractBorrowDto;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-27 13:50
+ **/
+@Slf4j
+@Api(tags ="财务-合同登记借用")
+@RestController
+@RequestMapping(value = "/contract/workContractBorrow")
+public class CwContractBorrowController {
+
+    @Resource
+    private CwWorkContractBorrowService borrowService;
+
+    /**
+     * 合同登记新增/修改
+     */
+    @ApiOperation(value = "合同登记借用新增/修改")
+    @PostMapping(value = "save")
+    public ResponseEntity<String> save(@RequestBody CwWorkContractBorrowDto workContractBorrowDto) throws Exception{
+        String id = borrowService.saveInfo(workContractBorrowDto);
+        return ResponseUtil.newInstance().add("businessTable", "cw_work_contract_borrow").add("businessId", id).ok ("操作成功");
+    }
+
+    /**
+     * 根据id修改状态status
+     */
+    @ApiOperation(value = "根据id修改状态status")
+    @PostMapping(value = "updateStatusById")
+    public void updateStatusById(@RequestBody CwWorkContractBorrowDto workContractBorrowDto) {
+        borrowService.updateStatusById(workContractBorrowDto);
+    }
+
+    /**
+     * 根据contractInfoId修改状态status
+     */
+    @ApiOperation(value = "根据id修改状态status")
+    @PostMapping(value = "updateStatusByContractInfoId")
+    public void updateStatusByContractInfoId(@RequestBody CwWorkContractBorrowDto workContractBorrowDto) {
+        borrowService.updateStatusByContractInfoId(workContractBorrowDto);
+    }
+
+    /**
+     * 根据id查询
+     */
+    @ApiOperation(value = "根据id查询")
+    @GetMapping(value = "findById")
+    public CwWorkContractBorrow findById(@RequestParam String id) {
+        return borrowService.findById(id);
+    }
+
+    /**
+     * 根据contractInfoId查询
+     */
+    @ApiOperation(value = "根据contractInfoId查询")
+    @GetMapping(value = "findByContractInfoId")
+    public CwWorkContractBorrow findByContractInfoId(@RequestParam String id) {
+        return borrowService.findByContractInfoId(id);
+    }
+
+    /**
+     * 根据id修改状态status
+     */
+    @ApiOperation(value = "根据id修改状态借用表status")
+    @PostMapping(value = "updateMessageStatusById")
+    public void updateMessageStatusById(@RequestBody CwWorkContractBorrowDto workContractBorrowDto) {
+        borrowService.updateMessageByBorrowId(workContractBorrowDto, workContractBorrowDto.getType());
+    }
+
+    @ApiOperation(value = "根据id删除借用表信息")
+    @GetMapping(value = "deleteById")
+    public void deleteById(@RequestParam String id) {
+        borrowService.deleteById(id);
+    }
+
+    @ApiOperation(value = "根据id查询借用表信息")
+    @GetMapping(value = "findMessageList")
+    public List<CwWorkContractBorrowMessage> findMessageList(@RequestParam String id) {
+        return borrowService.findMessageList(id);
+    }
+}

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

@@ -99,4 +99,40 @@ public class ContractInfo extends BaseEntity {
      */
     @TableField(exist = false)
     private List<WorkAttachmentDto> contractInfoList;
+
+    /**
+     * 合同金额类别
+     */
+    private String contractAmountType;
+
+    /**
+     * 对方合同编号
+     */
+    private String contractOpposite;
+
+    /**
+     * 收费标准
+     */
+    private String contractFee;
+
+    private String fees;
+
+    /**
+     * 案卷号
+     */
+    @TableField(exist = false)
+    private String filedNo;
+    /**
+     * 确认案卷号
+     */
+    @TableField(exist = false)
+    private String confirmFiledNo;
+
+    /**
+     * 借用状态
+     */
+    private String borrowType;
+
+    @TableField(exist = false)
+    private String taskBorrowId;
 }

+ 40 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/domain/CwWorkContractBorrow.java

@@ -0,0 +1,40 @@
+package com.jeeplus.test.cw.contractRegistration.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-27 13:53
+ **/
+@Data
+@TableName("cw_work_contract_borrow")
+public class CwWorkContractBorrow extends BaseEntity {
+
+    private String contractInfoId;
+
+    private String procInsId;
+
+    private String processDefinitionId;
+
+    private String contractName;
+
+    private String contractNo;
+
+    private String clientName;
+
+    private String borrowName;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date borrowData;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date borrowRetData;
+
+    private String remarks;
+
+    private String borrowType;
+
+}

+ 35 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/domain/CwWorkContractBorrowMessage.java

@@ -0,0 +1,35 @@
+package com.jeeplus.test.cw.contractRegistration.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.core.domain.BaseEntity;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-27 13:54
+ **/
+@Data
+@TableName("cw_work_contract_borrow_message")
+public class CwWorkContractBorrowMessage extends BaseEntity {
+
+    private String contractBorrowId;
+
+    private String contractName;
+
+    private String borrowName;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date borrowData;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date borrowRetData;
+
+    private String borrowType;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date retData;
+
+}

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

@@ -39,4 +39,6 @@ public interface ContractFileMapper extends BaseMapper<ContractFile> {
      * @param id
      */
     ContractFile getInfoByConId(String id);
+
+    ContractFile getById(String id);
 }

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

@@ -22,6 +22,8 @@ import java.util.List;
  **/
 public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
 
+    ContractInfo getInfoById(String id);
+
     ContractFile getById(String id);
 
     List<WorkAttachmentDto> findDtos(@Param("id") String id);
@@ -49,4 +51,6 @@ public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
     void updateInfo(@Param("id") String id,
                     @Param("actualContractAmount") Double actualContractAmount,
                     @Param("contractApprovalType") String contractApprovalType);
+
+    List<String> findChildIds(String department);
 }

+ 28 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/CwWorkContractBorrowMapper.java

@@ -0,0 +1,28 @@
+package com.jeeplus.test.cw.contractRegistration.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.test.cw.contractRegistration.domain.CwWorkContractBorrow;
+import com.jeeplus.test.cw.contractRegistration.domain.CwWorkContractBorrowMessage;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-27 13:52
+ **/
+public interface CwWorkContractBorrowMapper extends BaseMapper<CwWorkContractBorrow> {
+
+    void updateStatusById(@Param("id") String id, @Param("borrowType")String borrowType);
+
+    void updateStatusByContractInfoId(@Param("id") String id, @Param("borrowType")String borrowType);
+
+    CwWorkContractBorrow selectFileByContractInfoId (@Param("id") String id);
+
+    void updateMessageByBorrowId(@Param("id") String id, @Param("borrowType")String borrowType, @Param("type")String type);
+
+    void deleteMessageById(@Param("id") String id);
+
+    List<CwWorkContractBorrowMessage> findMessageList(@Param("id") String id);
+
+}

+ 11 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/CwWorkContractBorrowMessageMapper.java

@@ -0,0 +1,11 @@
+package com.jeeplus.test.cw.contractRegistration.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.test.cw.contractRegistration.domain.CwWorkContractBorrowMessage;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-27 13:59
+ **/
+public interface CwWorkContractBorrowMessageMapper extends BaseMapper<CwWorkContractBorrowMessage> {
+}

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

@@ -56,7 +56,9 @@
             a.proc_ins_id as procInsId,
             a.status,
             b.filed_type as filedType,
-            b.contract_info_id as contractInfoId
+            b.contract_info_id as contractInfoId,
+            b.filed_no,
+            b.confirm_filed_no
 		FROM
 			cw_work_contract_info a
             LEFT JOIN cw_work_contract_file b on a.id = b.contract_info_id
@@ -104,7 +106,9 @@
             a.proc_ins_id as procInsId,
             a.status,
             b.filed_type as filedType,
-            b.contract_info_id as contractInfoId
+            b.contract_info_id as contractInfoId,
+            b.filed_no,
+            b.confirm_filed_no
 		FROM
 			cw_work_contract_file b
             LEFT JOIN cw_work_contract_info a on a.id = b.contract_info_id
@@ -116,4 +120,7 @@
     <select id="getInfoByConId" resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractFile">
         select * from cw_work_contract_file where contract_info_id = #{id}
     </select>
+    <select id="getById" resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractFile">
+        select * from cw_work_contract_file where id = #{id}
+    </select>
 </mapper>

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

@@ -38,17 +38,25 @@
             a.contract_approval_type as contractApprovalType,
             a.proc_ins_id as procInsId,
             a.process_definition_id as processDefinitionId,
+            a.contract_amount_type,
+            a.contract_opposite,
+            a.contract_fee,
+            a.fees,
             a.status,
             b.filed_type as filedType,
             e.ID_ as taskFiledId,
             b.proc_ins_id as taskFiledProcInsId,
-            d.name as departmentName
+            d.name as departmentName,
+            f.borrow_type,
+            g.ID_ as task_borrow_id
 		FROM
 			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 act_ru_task e ON b.proc_ins_id = e.PROC_INST_ID_
             LEFT JOIN sys_office d on a.department = d.id
+            LEFT JOIN cw_work_contract_borrow f ON a.id = f.contract_info_id
+            LEFT JOIN act_ru_task g ON f.proc_ins_id = g.PROC_INST_ID_
 		${ew.customSqlSegment}
 		ORDER BY a.update_date DESC
     </select>
@@ -72,12 +80,18 @@
             a.payment_agreement as paymentAgreement,
             a.change_num as changeNum,
             a.department,
+            a.contract_amount_type,
+            a.contract_opposite,
+            a.contract_fee,
+            a.fees,
             a.client_contacts as clientContacts,
             a.client_contacts_phone as clientContactsPhone,
             a.contract_approval_type as contractApprovalType,
             a.proc_ins_id as procInsId,
             a.status,
-            b.filed_type as filedType
+            b.filed_type as filedType,
+            b.filed_no,
+            b.confirm_filed_no
 		FROM
 			cw_work_contract_info a
             LEFT JOIN cw_work_contract_file b on a.id = b.contract_info_id
@@ -149,4 +163,10 @@
     <select id="getById" resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractFile">
         select * from cw_work_contract_file where id = #{id}
     </select>
+    <select id="getInfoById" resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractInfo">
+        select * from cw_work_contract_info where id = #{id}
+    </select>
+    <select id="findChildIds" resultType="java.lang.String">
+        select id from sys_office where parent_id = #{department}
+    </select>
 </mapper>

+ 45 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/xml/CwWorkContractBorrowMapper.xml

@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jeeplus.test.cw.contractRegistration.mapper.CwWorkContractBorrowMapper">
+
+    <update id="updateStatusById">
+        UPDATE cw_work_contract_borrow SET borrow_type = #{borrowType} WHERE del_flag = 0 AND id = #{id}
+    </update>
+    <update id="updateStatusByContractInfoId">
+        UPDATE cw_work_contract_borrow SET borrow_type = #{borrowType} WHERE del_flag = 0 AND contract_info_id = #{id}
+    </update>
+    <update id="updateMessageByBorrowId">
+        UPDATE cw_work_contract_borrow_message SET borrow_type = #{borrowType}
+        <if test="type != null and type != ''">
+            ,ret_data = NOW()
+        </if>
+        WHERE del_flag = 0 AND contract_borrow_id = #{id} order by create_date desc limit 1
+    </update>
+    <update id="deleteMessageById">
+        UPDATE cw_work_contract_borrow_message SET del_flag = 1
+		WHERE del_flag = 0 AND contract_borrow_id = #{id} order by create_date desc limit 1
+    </update>
+    <select id="selectFileByContractInfoId"
+            resultType="com.jeeplus.test.cw.contractRegistration.domain.CwWorkContractBorrow">
+        SELECT * FROM `cw_work_contract_borrow` WHERE del_flag = 0 AND contract_info_id = #{id}
+    </select>
+    <select id="findMessageList"
+            resultType="com.jeeplus.test.cw.contractRegistration.domain.CwWorkContractBorrowMessage">
+        SELECT
+			id,
+			create_by,
+			create_date,
+			update_by,
+			update_date,
+			del_flag,
+			contract_borrow_id,
+			contract_name,
+			borrow_name,
+			DATE_FORMAT(borrow_data,'%Y-%m-%d') as borrow_data,
+			DATE_FORMAT(borrow_ret_data,'%Y-%m-%d') as borrow_ret_data,
+			borrow_type,
+			DATE_FORMAT( ret_data, '%Y-%m-%d' ) AS ret_data
+		 FROM cw_work_contract_borrow_message WHERE del_flag = 0 AND contract_borrow_id = #{id}
+		 order by create_date desc
+    </select>
+</mapper>

+ 10 - 2
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/ContractFileService.java

@@ -43,8 +43,16 @@ public class ContractFileService {
      * 根据id修改status
      */
     public void updateStatusById(ContractFile contractFile) {
-        infoMapper.updatefiledTypeById(contractFile.getId(),contractFile.getFiledType());
-        mapper.updateStatusById(contractFile.getId(), contractFile.getFiledType());
+        ContractInfo infoById = infoMapper.getInfoById(contractFile.getId());
+        if (null != infoById){
+            infoMapper.updatefiledTypeById(contractFile.getId(),contractFile.getFiledType());
+            mapper.updateStatusById(contractFile.getId(), contractFile.getFiledType());
+        } else {
+            ContractFile file = mapper.getById(contractFile.getId());
+            infoMapper.updatefiledTypeById(file.getContractInfoId(),contractFile.getFiledType());
+            mapper.updateStatusById(contractFile.getId(), contractFile.getFiledType());
+        }
+
     }
 
     public String saveInfo(ContractFile contractFile) throws Exception {

+ 21 - 1
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/ContractInfoService.java

@@ -100,7 +100,14 @@ public class ContractInfoService {
         }
         //6、所属部门
         if (StringUtils.isNotEmpty(info.getDepartment())) {
-            wrapper.like("a.department", info.getDepartment());
+            //先估计id查出是否是父节点,是父节点则查出所以的子节点信息
+            List<String> childIds = mapper.findChildIds(info.getDepartment());
+            if ( null != childIds & childIds.size()>0){
+                childIds.add(info.getDepartment());
+                wrapper.in("a.department",childIds);
+            }else {
+                wrapper.in("a.department", info.getDepartment());
+            }
         }
         //7、状态
         if (StringUtils.isNotEmpty(info.getStatus())) {
@@ -172,6 +179,19 @@ public class ContractInfoService {
                 });
 
             }
+            //根据合同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);
         }

+ 160 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/CwWorkContractBorrowService.java

@@ -0,0 +1,160 @@
+package com.jeeplus.test.cw.contractRegistration.service;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.StringUtils;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.test.cw.contractRegistration.domain.CwWorkContractBorrow;
+import com.jeeplus.test.cw.contractRegistration.domain.CwWorkContractBorrowMessage;
+import com.jeeplus.test.cw.contractRegistration.mapper.CwWorkContractBorrowMapper;
+import com.jeeplus.test.cw.contractRegistration.mapper.CwWorkContractBorrowMessageMapper;
+import com.jeeplus.test.cw.contractRegistration.service.dto.CwWorkContractBorrowDto;
+import org.springframework.stereotype.Service;
+import org.springframework.beans.BeanUtils;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.UUID;
+import java.util.Date;
+/**
+ * @author: 王强
+ * @create: 2022-11-27 13:51
+ **/
+@Service
+public class CwWorkContractBorrowService {
+
+    @Resource
+    private CwWorkContractBorrowMapper borrowMapper;
+
+    @Resource
+    private CwWorkContractBorrowMessageMapper messageMapper;
+
+    public String saveInfo(CwWorkContractBorrowDto workContractBorrowDto) throws Exception {
+        if (StringUtils.isNotEmpty(workContractBorrowDto.getId())) {
+            CwWorkContractBorrow info = borrowMapper.selectById( workContractBorrowDto.getId());
+            if (info != null) {
+                return update(workContractBorrowDto, info.getContractInfoId());
+            }
+        }
+        return add(workContractBorrowDto);
+    }
+
+    /**
+     * 合同登记借用新增
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public String add(CwWorkContractBorrowDto workContractBorrowDto) throws Exception{
+        //获取当前登录人信息
+        UserDTO userDTO = UserUtils.getCurrentUserDTO();
+        String id = UUID.randomUUID().toString().replace("-", "");
+        CwWorkContractBorrow borrow = new CwWorkContractBorrow();
+        BeanUtils.copyProperties(workContractBorrowDto, borrow);
+        borrow.setId(id);
+        borrow.setCreateBy(userDTO.getId());
+        borrow.setCreateDate(new Date());
+        borrow.setUpdateBy(userDTO.getId());
+        borrow.setUpdateDate(new Date());
+        borrowMapper.insert(borrow);
+        //借用记录信息
+        this.saveMessage(workContractBorrowDto, id);
+        return id;
+    }
+
+    /**
+     * 合同登记修改
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public String update(CwWorkContractBorrowDto workContractBorrowDto, String id) {
+        //获取当前登录人信息
+        UserDTO userDTO = UserUtils.getCurrentUserDTO();
+        CwWorkContractBorrow borrow = new CwWorkContractBorrow();
+        BeanUtils.copyProperties(workContractBorrowDto, borrow);
+        borrow.setContractInfoId(id);
+        borrow.setUpdateBy(userDTO.getId());
+        borrow.setUpdateDate(new Date());
+        borrowMapper.updateById(borrow);
+        //借用记录信息
+        this.saveMessage(workContractBorrowDto, workContractBorrowDto.getId());
+        return borrow.getId();
+    }
+    /**
+     * 根据id修改status
+     */
+    public void updateStatusById(CwWorkContractBorrowDto workContractBorrowDto) {
+        borrowMapper.updateStatusById(workContractBorrowDto.getId(), workContractBorrowDto.getBorrowType());
+    }
+
+    public void updateStatusByContractInfoId(CwWorkContractBorrowDto workContractBorrowDto) {
+        borrowMapper.updateStatusByContractInfoId(workContractBorrowDto.getId(), workContractBorrowDto.getBorrowType());
+    }
+
+    public CwWorkContractBorrow findById(String id) {
+        CwWorkContractBorrow borrow = borrowMapper.selectById(id);
+        if (borrow == null) {
+            LambdaQueryWrapper<CwWorkContractBorrow> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(CwWorkContractBorrow::getContractInfoId, id);
+            return borrowMapper.selectOne(wrapper);
+        }
+        return borrow;
+    }
+
+    public CwWorkContractBorrow findByContractInfoId(String id) {
+        return borrowMapper.selectFileByContractInfoId(id);
+    }
+
+    /**
+     * 借用记录保存
+     * @param workContractBorrowDto
+     * @param id
+     * @return
+     */
+    public void saveMessage (CwWorkContractBorrowDto workContractBorrowDto, String id) {
+        //保存借用信息
+        UserDTO userDTO = UserUtils.getCurrentUserDTO();
+        CwWorkContractBorrowMessage message = new CwWorkContractBorrowMessage();
+        BeanUtils.copyProperties(workContractBorrowDto, message);
+        String messageId = UUID.randomUUID().toString().replace("-", "");
+        message.setId(messageId);
+        message.setCreateBy(userDTO.getId());
+        message.setCreateDate(new Date());
+        message.setUpdateBy(userDTO.getId());
+        message.setUpdateDate(new Date());
+        message.setContractBorrowId(id);
+//        message.setBorrowType("3");
+        message.setBorrowType(workContractBorrowDto.getBorrowType());
+        message.setRetData(workContractBorrowDto.getBorrowRetData());
+        messageMapper.insert(message);
+    }
+
+    /**
+     * 根据contractBorrowId修改borrowType
+     */
+    public void updateMessageByBorrowId(CwWorkContractBorrowDto workContractBorrowDto, String type) {
+        if ("reture".equals(type)) {
+            CwWorkContractBorrow borrow = borrowMapper.selectFileByContractInfoId(workContractBorrowDto.getId());
+            if (borrow != null) {
+                borrowMapper.updateMessageByBorrowId(borrow.getId(), workContractBorrowDto.getBorrowType(), type);
+            }
+        } else {
+            borrowMapper.updateMessageByBorrowId(workContractBorrowDto.getId(), workContractBorrowDto.getBorrowType(), null);
+        }
+    }
+
+    public void deleteById(String id) {
+        LambdaQueryWrapper<CwWorkContractBorrow> wrapper = new LambdaQueryWrapper<CwWorkContractBorrow>();
+        wrapper.eq(CwWorkContractBorrow::getContractInfoId, id);
+        CwWorkContractBorrow borrow = borrowMapper.selectOne(wrapper);
+        if (borrow != null) {
+            borrowMapper.deleteMessageById(borrow.getId());
+        }
+    }
+
+    public List<CwWorkContractBorrowMessage> findMessageList(String id) {
+        CwWorkContractBorrow borrow = findByContractInfoId(id);
+        if (borrow != null) {
+            return borrowMapper.findMessageList(borrow.getId());
+        }
+        return null;
+    }
+}

+ 42 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/dto/CwWorkContractBorrowDto.java

@@ -0,0 +1,42 @@
+package com.jeeplus.test.cw.contractRegistration.service.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.core.service.dto.BaseDTO;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-27 14:00
+ **/
+@Data
+public class CwWorkContractBorrowDto extends BaseDTO {
+
+    private String contractInfoId;
+
+    private String procInsId;
+
+    private String processDefinitionId;
+
+    private String contractName;
+
+    private String contractNo;
+
+    private String clientName;
+
+    private String borrowName;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date borrowData;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date borrowRetData;
+
+    private String remarks;
+
+    private String borrowType;
+
+    private String type;
+
+}