Procházet zdrojové kódy

财务-财务纸质归档

wangqiang před 2 roky
rodič
revize
8f6a551be4

+ 51 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/controller/ContractFilePaperController.java

@@ -0,0 +1,51 @@
+package com.jeeplus.test.cw.contractRegistration.controller;
+
+import com.jeeplus.common.utils.ResponseUtil;
+import com.jeeplus.test.cw.contractRegistration.domain.ContractFilePaper;
+import com.jeeplus.test.cw.contractRegistration.service.ContractFilePaperService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-29 14:22
+ **/
+@RestController
+@Api(tags ="财务合同登记纸质归档管理")
+@RequestMapping(value = "/contract/contractPaperFile")
+public class ContractFilePaperController {
+
+    @Autowired
+    private ContractFilePaperService service;
+
+    /**
+     * 合同登记纸质归档新增/修改
+     */
+    @ApiOperation(value = "合同登记纸质归档新增/修改")
+    @PostMapping(value = "save")
+    public ResponseEntity<String> save(@RequestBody ContractFilePaper contractFilePaper) throws Exception{
+        String id = service.saveInfo(contractFilePaper);
+        return ResponseUtil.newInstance().add("businessTable", "cw_work_contract_file_paper").add("businessId", id).ok ("操作成功");
+    }
+
+    /**
+     * 根据id修改状态status
+     */
+    @ApiOperation(value = "根据id修改状态status")
+    @PostMapping(value = "updateStatusById")
+    public void updateStatusById(@RequestBody ContractFilePaper filePaper) {
+        service.updateStatusById(filePaper);
+    }
+
+    /**
+     * 根据contractInfoId查询
+     */
+    @ApiOperation(value = "根据contractInfoId查询")
+    @GetMapping(value = "findByContractInfoId")
+    public ContractFilePaper findByContractInfoId(@RequestParam String id) {
+        return service.findByContractInfoId(id);
+    }
+}

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

@@ -46,11 +46,11 @@ public class ContractFile extends BaseEntity {
     /**
      * 案卷号
      */
-    private String filedNo;
+//    private String filedNo;
     /**
      * 确认案卷号
      */
-    private String confirmFiledNo;
+//    private String confirmFiledNo;
 
     @TableField(exist = false)
     private String createId;       //创建人id

+ 81 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/domain/ContractFilePaper.java

@@ -0,0 +1,81 @@
+package com.jeeplus.test.cw.contractRegistration.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jeeplus.core.domain.BaseEntity;
+import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 纸质归档
+ * @author: 王强
+ * @create: 2022-11-10 16:06
+ **/
+@Data
+@TableName(value = "cw_work_contract_file_paper")
+public class ContractFilePaper extends BaseEntity {
+
+    @TableField(exist = false)
+    private String fileId;
+
+    /**
+     * 合同登记主键值
+     */
+    private String contractInfoId;
+    /**
+     * 流程id
+     */
+    private String procInsId;
+    private String processDefinitionId;
+    /**
+     * 归档人
+     */
+    private String fileCreateName;
+    /**
+     * 纸质归档状态
+     */
+    private String filedPaperType;
+    /**
+     * 归档完成时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private String filedData;
+    /**
+     * 案卷号
+     */
+    private String filedNo;
+    /**
+     * 确认案卷号
+     */
+    private String confirmFiledNo;
+
+    @TableField(exist = false)
+    private String createId;       //创建人id
+
+    /**
+     * 客户名称
+     */
+    @TableField(exist = false)
+    private String customerName;
+
+    /**
+     * 客户编号
+     */
+    @TableField(exist = false)
+    private String customerNo;
+
+    /**
+     * 合同正文附件信息
+     */
+    @TableField(exist = false)
+    private List<WorkAttachmentDto> contractProperList;
+
+    /**
+     * 归档附件信息
+     */
+    @TableField(exist = false)
+    private List<WorkAttachmentDto> contractInfoList;
+}

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

@@ -67,12 +67,20 @@ public class ContractInfo extends BaseEntity {
     @TableField(exist = false)
     private String taskFiledProcInsId;
 
+    @TableField(exist = false)
+    private String taskFiledPaperProcInsId;
+
     /**
      * 归档状态
      */
     @Query(tableColumn = "a.filed_type")
     private String filedType;
 
+    /**
+     * 纸质归档状态
+     */
+    private String filedPaperType;
+
     @TableField(exist = false)
     private String[] contractAmounts;
 

+ 24 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/mapper/ContractFilePaperMapper.java

@@ -0,0 +1,24 @@
+package com.jeeplus.test.cw.contractRegistration.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jeeplus.test.cw.contractRegistration.domain.ContractFilePaper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-29 14:20
+ **/
+public interface ContractFilePaperMapper extends BaseMapper<ContractFilePaper> {
+    /**
+     * 估计id查询纸质归档信息
+     * @param id
+     * @return
+     */
+    ContractFilePaper selectFilePaperByContractInfoId(String id);
+
+    ContractFilePaper getById(String id);
+
+    void updateStatusById(@Param("id") String id, @Param("filedType")String filedType);
+
+
+}

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

@@ -40,6 +40,8 @@ public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
 
     void updatefiledTypeById(@Param("id") String id, @Param("status")String status);
 
+    void updatefiledPaperTypeById(@Param("id") String id, @Param("status")String status);
+
     List<WorkAttachment> findList(@Param("id") String id);
 
     Integer findIsExit(@Param("id") String id, @Param("name")String name);

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

@@ -56,9 +56,7 @@
             a.proc_ins_id as procInsId,
             a.status,
             b.filed_type as filedType,
-            b.contract_info_id as contractInfoId,
-            b.filed_no,
-            b.confirm_filed_no
+            b.contract_info_id as contractInfoId
 		FROM
 			cw_work_contract_info a
             LEFT JOIN cw_work_contract_file b on a.id = b.contract_info_id
@@ -106,9 +104,7 @@
             a.proc_ins_id as procInsId,
             a.status,
             b.filed_type as filedType,
-            b.contract_info_id as contractInfoId,
-            b.filed_no,
-            b.confirm_filed_no
+            b.contract_info_id as contractInfoId
 		FROM
 			cw_work_contract_file b
             LEFT JOIN cw_work_contract_info a on a.id = b.contract_info_id

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

@@ -0,0 +1,16 @@
+<?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.ContractFilePaperMapper">
+    <update id="updateStatusById">
+        UPDATE cw_work_contract_file_paper SET filed_paper_type = #{filedType}, filed_data = NOW()
+        WHERE del_flag = 0 AND contract_info_id = #{id}
+    </update>
+    <select id="selectFilePaperByContractInfoId"
+            resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractFilePaper">
+        SELECT * FROM `cw_work_contract_file_paper` WHERE del_flag = 0 AND contract_info_id = #{id}
+    </select>
+    <select id="getById" resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractFilePaper">
+        select * from cw_work_contract_file_paper where id = #{id}
+    </select>
+
+</mapper>

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

@@ -12,6 +12,9 @@
         UPDATE cw_work_contract_info SET actual_contract_amount = #{actualContractAmount}
         ,contract_approval_type = #{contractApprovalType} where del_flag = 0 AND id = #{id}
     </update>
+    <update id="updatefiledPaperTypeById">
+        UPDATE cw_work_contract_info SET `filed_paper_type` = #{status} WHERE del_flag = 0 AND id = #{id}
+    </update>
 
     <select id="findPageList" resultType="com.jeeplus.test.cw.contractRegistration.domain.ContractInfo">
         SELECT
@@ -48,7 +51,11 @@
             b.proc_ins_id as taskFiledProcInsId,
             d.name as departmentName,
             f.borrow_type,
-            g.ID_ as task_borrow_id
+            g.ID_ as task_borrow_id,
+            h.filed_paper_type as filedPaperType,
+            h.filed_no as filedNo,
+            h.confirm_filed_no as confirmFiledNo,
+            h.proc_ins_id as taskFiledPaperProcInsId
 		FROM
 			cw_work_contract_info a
             LEFT JOIN cw_work_contract_file b on a.id = b.contract_info_id
@@ -57,6 +64,7 @@
             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_
+            LEFT JOIN cw_work_contract_file_paper h on a.id = h.contract_info_id
 		${ew.customSqlSegment}
 		ORDER BY a.update_date DESC
     </select>
@@ -94,13 +102,17 @@
             a.proc_ins_id as procInsId,
             a.status,
             b.filed_type as filedType,
-            b.filed_no,
-            b.confirm_filed_no
+            d.filed_paper_type as filedPaperType,
+            d.filed_no as filedNo,
+            d.confirm_filed_no as confirmFiledNo,
+            e.name as departmentName
 		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 cw_work_client_base cw on a.client_contacts = cw.id
+            LEFT JOIN cw_work_contract_file_paper d on a.id = d.contract_info_id
+            LEFT JOIN sys_office e on a.department = e.id
         WHERE
 			a.id = #{id}
 			AND a.del_flag = 0
@@ -156,11 +168,15 @@
             a.contract_approval_type as contractApprovalType,
             a.proc_ins_id as procInsId,
             a.status,
-            b.filed_type as filedType
+            b.filed_type as filedType,
+            d.filed_paper_type as filedPaperType,
+            d.filed_no as filedNo,
+            d.confirm_filed_no as confirmFiledNo
 		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 cw_work_contract_file_paper d on a.id = d.contract_info_id
         WHERE
 			b.id = #{id}
 			AND a.del_flag = 0

+ 99 - 0
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/ContractFilePaperService.java

@@ -0,0 +1,99 @@
+package com.jeeplus.test.cw.contractRegistration.service;
+
+import com.jeeplus.sys.service.dto.UserDTO;
+import com.jeeplus.sys.utils.UserUtils;
+import com.jeeplus.test.cw.contractRegistration.domain.ContractFile;
+import com.jeeplus.test.cw.contractRegistration.domain.ContractFilePaper;
+import com.jeeplus.test.cw.contractRegistration.domain.ContractInfo;
+import com.jeeplus.test.cw.contractRegistration.mapper.ContractFilePaperMapper;
+import com.jeeplus.test.cw.contractRegistration.mapper.ContractInfoMapper;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.beans.BeanUtils;
+
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.UUID;
+
+/**
+ * @author: 王强
+ * @create: 2022-11-29 14:21
+ **/
+@Service
+public class ContractFilePaperService {
+
+    @Resource
+    private ContractFilePaperMapper mapper;
+
+    @Resource
+    private ContractInfoMapper infoMapper;
+
+    public String saveInfo(ContractFilePaper filePaper) throws Exception {
+
+        ContractFilePaper info = mapper.selectFilePaperByContractInfoId(filePaper.getId());
+        if (null != info) {
+            filePaper.setFileCreateName(filePaper.getCreateBy());
+            filePaper.setCreateBy(filePaper.getCreateId());
+            infoMapper.updatefiledTypeById(filePaper.getContractInfoId(),filePaper.getFiledPaperType());
+            return update(filePaper, info.getId());
+        }else {
+            return add(filePaper);
+        }
+    }
+
+    /**
+     * 根据id修改status
+     */
+    public void updateStatusById(ContractFilePaper filePaper) {
+        ContractInfo infoById = infoMapper.getInfoById(filePaper.getId());
+        if (null != infoById){
+            infoMapper.updatefiledPaperTypeById(filePaper.getId(),filePaper.getFiledPaperType());
+            mapper.updateStatusById(filePaper.getId(), filePaper.getFiledPaperType());
+        } else {
+            ContractFilePaper file = mapper.getById(filePaper.getId());
+            infoMapper.updatefiledPaperTypeById(file.getContractInfoId(),filePaper.getFiledPaperType());
+            mapper.updateStatusById(filePaper.getId(), filePaper.getFiledPaperType());
+        }
+
+    }
+
+    public ContractFilePaper findByContractInfoId(String id) {
+        return mapper.selectFilePaperByContractInfoId(id);
+    }
+
+    /**
+     * 合同登记纸质归档修改
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public String update(ContractFilePaper filePaper, String id) {
+        //获取当前登录人信息
+        UserDTO userDTO = UserUtils.getCurrentUserDTO();
+        ContractFilePaper file = new ContractFilePaper();
+        BeanUtils.copyProperties(filePaper, file);
+        file.setId(id);
+        file.setUpdateBy(userDTO.getId());
+        file.setUpdateDate(new Date());
+        mapper.updateById(file);
+        return file.getId();
+    }
+
+    /**
+     * 合同登记新增
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public String add(ContractFilePaper filePaper) throws Exception{
+        //获取当前登录人信息
+        UserDTO userDTO = UserUtils.getCurrentUserDTO();
+        String id = UUID.randomUUID().toString().replace("-", "");
+        ContractFilePaper file = new ContractFilePaper();
+        BeanUtils.copyProperties(filePaper, file);
+        file.setId(id);
+        file.setCreateBy(userDTO.getId());
+        file.setCreateDate(new Date());
+        file.setUpdateBy(userDTO.getId());
+        file.setUpdateDate(new Date());
+        mapper.insert(file);
+        return id;
+    }
+
+}

+ 64 - 10
jeeplus-module/jeeplus-test/src/main/java/com/jeeplus/test/cw/contractRegistration/service/ContractInfoService.java

@@ -10,9 +10,11 @@ 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.ContractFile;
+import com.jeeplus.test.cw.contractRegistration.domain.ContractFilePaper;
 import com.jeeplus.test.cw.contractRegistration.domain.ContractInfo;
 import com.jeeplus.test.cw.contractRegistration.domain.ContractParticipant;
 import com.jeeplus.test.cw.contractRegistration.mapper.ContractFileMapper;
+import com.jeeplus.test.cw.contractRegistration.mapper.ContractFilePaperMapper;
 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;
@@ -24,6 +26,7 @@ import com.jeeplus.test.workContract.domain.WorkContractInfo;
 import com.jeeplus.test.workContract.service.dto.WorkAttachmentDto;
 import com.jeeplus.test.workContract.service.dto.WorkContractInfoDto;
 import org.flowable.editor.language.json.converter.util.CollectionUtils;
+import org.flowable.ui.modeler.service.mapper.InfoMapper;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -52,6 +55,9 @@ public class ContractInfoService {
     private ContractFileMapper fileMapper;
 
     @Resource
+    private ContractFilePaperMapper paperMapper;
+
+    @Resource
     private ContractParticipantMapper participantMapper;
 
     /**
@@ -101,13 +107,13 @@ public class ContractInfoService {
         }
         //6、所属部门
         if (StringUtils.isNotEmpty(info.getDepartment())) {
-            //先估计id查出是否是父节点,是父节点则查出所以的子节点信息
+            //先根据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());
+                wrapper.eq("a.department", info.getDepartment());
             }
         }
         //7、状态
@@ -234,6 +240,49 @@ public class ContractInfoService {
                     dto.setCwWorkClientContactDTOList(list);
                     dto.setContractProperList(dtos);
                 }
+            } else {
+                //传过来的是纸质归档的id
+                ContractFilePaper filePaper = paperMapper.getById(id);
+                if ( null != filePaper ) {
+                    dto = mapper.findById(filePaper.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);
+                            });
+
+                        }
+                        //估计合同登记id查出归档信息
+                        ContractFile contractFile = fileMapper.getInfoByConId(dto.getId());
+                        if (null != contractFile){
+                            //查归档附件信息
+                            List<WorkAttachmentDto> fileDtos = mapper.findDtos(contractFile.getId());
+                            if (CollectionUtils.isNotEmpty(fileDtos)) {
+                                for (WorkAttachmentDto i : fileDtos) {
+                                    i.setCreateBy(UserUtils.get(i.getBy()));
+                                }
+                                dto.setContractInfoList(fileDtos);
+                            }
+                        }
+
+                        dto.setCwWorkClientContactDTOList(list);
+                        dto.setContractProperList(dtos);
+                    }
+                }
             }
         }
 
@@ -317,10 +366,8 @@ public class ContractInfoService {
         //获取当前登录人信息
         UserDTO userDTO = UserUtils.getCurrentUserDTO();
         //合同编号生成
-//        String serialNum = serialnumTplService.genSerialNum(userDTO.getCompanyDTO().getId(), WorkContractInfoDto.BIZ_CODE);
         ContractInfo contractInfo = new ContractInfo();
         BeanUtils.copyProperties(info, contractInfo);
-//        info.setNo(serialNum);
         contractInfo.setUpdateBy(userDTO.getId());
         contractInfo.setUpdateDate(new Date());
 
@@ -330,17 +377,25 @@ public class ContractInfoService {
         }else {
             contractInfo.setChangeNum(contractInfo.getChangeNum());
         }
-        //对管理员上传归档文件进行相关操作
+        //对管理员上传归档文件进行相关操作  归档修改
         if (StringUtils.isNotEmpty(contractInfo.getFiledType()) && contractInfo.getFiledType().equals("5")){
             //根据id找到归档表id
             ContractFile contractFile = fileMapper.getInfoByConId(info.getId());
-            contractFile.setContractInfoList(info.getContractInfoList());
-            if (CollectionUtils.isNotEmpty(contractFile.getContractInfoList())){
-                updateFiles(contractFile.getContractInfoList(), userDTO, contractFile.getId());
+            if ( null != contractFile) {
+                contractFile.setContractInfoList(info.getContractInfoList());
+                if (CollectionUtils.isNotEmpty(contractFile.getContractInfoList())){
+                    updateFiles(contractFile.getContractInfoList(), userDTO, contractFile.getId());
+                }
             }
         }
 
-
+        //纸质归档修改
+        ContractFilePaper filePaper = paperMapper.selectFilePaperByContractInfoId(info.getId());
+        if (null != filePaper) {
+            filePaper.setFiledNo(info.getFiledNo());
+            filePaper.setConfirmFiledNo(info.getConfirmFiledNo());
+            paperMapper.updateById(filePaper);
+        }
 
         mapper.updateById(contractInfo);
         ContractParticipant participant = new ContractParticipant();
@@ -365,7 +420,6 @@ public class ContractInfoService {
             }
         }
 
-
         List<WorkAttachmentDto> list = info.getContractProperList();
         if (CollectionUtils.isNotEmpty(list)) {
             updateFiles(list, userDTO, info.getId());