Jelajahi Sumber

合同管理定制需求

seyason 8 bulan lalu
induk
melakukan
099e1f162f

+ 5 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ContractController.java

@@ -3,6 +3,7 @@ package com.management.platform.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.Contract;
+import com.management.platform.entity.ContractCustom;
 import com.management.platform.entity.Project;
 import com.management.platform.entity.User;
 import com.management.platform.mapper.ProjectMapper;
@@ -74,16 +75,16 @@ public class ContractController {
      * 新增合同
      */
     @RequestMapping("/addContract")
-    public HttpRespMsg addContract (HttpServletRequest request,Contract contract, String paymentListStr){
-        return contractService.addContract(request,contract, paymentListStr);
+    public HttpRespMsg addContract (HttpServletRequest request, Contract contract, ContractCustom custom, String paymentListStr){
+        return contractService.addContract(request,contract, custom, paymentListStr);
     }
 
     /**
      * 编辑合同
      */
     @RequestMapping("/editContract")
-    public HttpRespMsg editContract (HttpServletRequest request,Contract contract, String paymentListStr){
-        return contractService.editContract(request,contract, paymentListStr);
+    public HttpRespMsg editContract (HttpServletRequest request,Contract contract,ContractCustom custom, String paymentListStr){
+        return contractService.editContract(request,contract, custom, paymentListStr);
     }
 
     /**

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ContractCustom.java

@@ -147,8 +147,8 @@ public class ContractCustom extends Model<ContractCustom> {
     /**
      * 合同状态(是否结清):1-履约中,2-履约结束
      */
-    @TableField("status")
-    private Integer status;
+    @TableField("finish_status")
+    private Integer finishStatus;
 
     /**
      * 印花税税目

+ 3 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ContractService.java

@@ -2,6 +2,7 @@ package com.management.platform.service;
 
 import com.management.platform.entity.Contract;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.management.platform.entity.ContractCustom;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
@@ -23,9 +24,9 @@ public interface ContractService extends IService<Contract> {
 
     HttpRespMsg ExportContract(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate);
 
-    HttpRespMsg addContract(HttpServletRequest request, Contract contract, String paymentListStr);
+    HttpRespMsg addContract(HttpServletRequest request, Contract contract, ContractCustom custom, String paymentListStr);
 
-    HttpRespMsg editContract(HttpServletRequest request, Contract contract, String paymentListStr);
+    HttpRespMsg editContract(HttpServletRequest request, Contract contract, ContractCustom custom, String paymentListStr);
 
     HttpRespMsg importContract(HttpServletRequest request, MultipartFile file);
 

+ 14 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java

@@ -316,7 +316,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
      * @return
      */
     @Override
-    public HttpRespMsg addContract(HttpServletRequest request, Contract contract, String paymentListStr) {
+    public HttpRespMsg addContract(HttpServletRequest request, Contract contract, ContractCustom custom, String paymentListStr) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("token"));
         List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "新增合同");
@@ -349,6 +349,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         contract.setCompanyId(user.getCompanyId());
         contractMapper.insert(contract);
 
+
         if (StringUtils.isNotBlank(paymentListStr)){
             List<ContractPayment> contractPaymentList = JSON.parseArray(paymentListStr, ContractPayment.class);
             BigDecimal bg = new BigDecimal("0");
@@ -372,6 +373,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         contractLog.setType(0);
         contractLog.setMsg("创建了合同。");
         contractLogMapper.insert(contractLog);
+
+        custom.setContractId(contract.getId());
+        contractCustomMapper.insert(custom);
         httpRespMsg.msg = MessageUtils.message("contract.addSuc");
         httpRespMsg.data = contract.getId();
         return httpRespMsg;
@@ -384,7 +388,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
      * @return
      */
     @Override
-    public HttpRespMsg editContract(HttpServletRequest request, Contract contract, String paymentListStr) {
+    public HttpRespMsg editContract(HttpServletRequest request, Contract contract, ContractCustom custom, String paymentListStr) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("token"));
         List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "管理全部合同");
@@ -393,6 +397,10 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             return httpRespMsg;
         }
         try {
+            if (contract.getId() == null) {
+                httpRespMsg.setError(MessageUtils.message("name.idNullError"));
+                return httpRespMsg;
+            }
             if (StringUtils.isBlank(contract.getName())){
                 //名称不可为空
                 httpRespMsg.setError(MessageUtils.message("name.nullNameError"));
@@ -455,6 +463,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             contractLog.setType(1);
             contractLog.setMsg("编辑了合同。");
             contractLogMapper.insert(contractLog);
+            custom.setContractId(contract.getId());
+            contractCustomMapper.updateById(custom);
             httpRespMsg.msg = MessageUtils.message("contract.editSuc");
             return httpRespMsg;
         }catch (NullPointerException e) {
@@ -808,9 +818,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                 String status = row.getCell(26)==null?null:row.getCell(26).getStringCellValue();
                 if (StringUtils.isNotBlank(status)){
                     if ("履约中".equals(status)) {
-                        customItem.setStatus(1);
+                        customItem.setFinishStatus(1);
                     } else {
-                        customItem.setStatus(2);
+                        customItem.setFinishStatus(2);
                     }
                 }
                 String remarks = row.getCell(27)==null?null:row.getCell(27).getStringCellValue();

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages.properties

@@ -49,6 +49,7 @@ Company.nameRepeatByParam=名称[{0}]已存在
 name.nameRepeatByParam={0}名称重复
 name.CategoryNameRepeat=分类名称已存在
 #其他
+name.idNullError=id不能为空
 other.error=发生其他错误
 other.errorByParameter=发生其他错误{0}
 other.update=更新失败

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages_en_US.properties

@@ -48,6 +48,7 @@ name.nameRepeat=The name already exists.
 Company.nameRepeatByParam=The name ['{0}'] already exists.
 name.nameRepeatByParam=Duplicate {0} name.
 name.CategoryNameRepeat=Category name already exists.
+name.idNullError=ID cannot be empty.
 #其他
 other.error=Other errors occurred.
 other.errorByParameter=Other error {0} occurred.

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ContractCustomMapper.xml

@@ -24,13 +24,13 @@
         <result column="reserved_bill_number" property="reservedBillNumber" />
         <result column="total_payed_amounts" property="totalPayedAmounts" />
         <result column="pending_amounts" property="pendingAmounts" />
-        <result column="status" property="status" />
+        <result column="finish_status" property="finishStatus" />
         <result column="stamp_duty_items" property="stampDutyItems" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        contract_id, customer_org, customer_contact, customer_phone, use_department, funds_source, undertaker, agent, sign_date, filings_date, tax_rate, amounts_no_tax, currency, payed_amount, pay_way, bill_number, reserved_amounts, reserved_bill_number, total_payed_amounts, pending_amounts, status, stamp_duty_items
+        contract_id, customer_org, customer_contact, customer_phone, use_department, funds_source, undertaker, agent, sign_date, filings_date, tax_rate, amounts_no_tax, currency, payed_amount, pay_way, bill_number, reserved_amounts, reserved_bill_number, total_payed_amounts, pending_amounts, finish_status, stamp_duty_items
     </sql>
 
 </mapper>