Selaa lähdekoodia

修复合同Bug

seyason 9 kuukautta sitten
vanhempi
commit
5ac6c3ac46

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

@@ -45,16 +45,16 @@ public class ContractController {
      * 分页查询合同
      */
     @RequestMapping("/getContractPage")
-    public HttpRespMsg getContractPage (HttpServletRequest request, @RequestParam Integer pageIndex, @RequestParam Integer pageSize, String number,String name,String typeName,Integer status,String startDate,String endDate, String paymentStartDate, String paymentEndDate){
-        return contractService.getContractPage(request,pageIndex,pageSize,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate);
+    public HttpRespMsg getContractPage (HttpServletRequest request, @RequestParam Integer pageIndex, @RequestParam Integer pageSize, String number,String name,String typeName,Integer status,String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId){
+        return contractService.getContractPage(request,pageIndex,pageSize,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId);
     }
 
     /**
      * 导出合同
      */
     @RequestMapping("/ExportContract")
-    public HttpRespMsg ExportContract (HttpServletRequest request, String number,String name,String typeName,Integer status,String startDate,String endDate, String paymentStartDate, String paymentEndDate){
-        return contractService.ExportContract(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate);
+    public HttpRespMsg ExportContract (HttpServletRequest request, String number,String name,String typeName,Integer status,String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId){
+        return contractService.ExportContract(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId);
     }
 
     /**

+ 2 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ContractMapper.java

@@ -14,6 +14,6 @@ import java.util.List;
  * @since 2022-11-29
  */
 public interface ContractMapper extends BaseMapper<Contract> {
-    List<Contract> selectContract(Integer companyId, Integer pageStart, Integer pageSize, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate);
-    Long selectContractCnt(Integer companyId, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate);
+    List<Contract> selectContract(Integer companyId, Integer pageStart, Integer pageSize, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId);
+    Long selectContractCnt(Integer companyId, String number, String name, String typeName, Integer status, String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId);
 }

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

@@ -20,9 +20,9 @@ import java.util.List;
  */
 public interface ContractService extends IService<Contract> {
 
-    HttpRespMsg getContractPage(HttpServletRequest request, Integer pageIndex, Integer pageSize, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate);
+    HttpRespMsg getContractPage(HttpServletRequest request, Integer pageIndex, Integer pageSize, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId);
 
-    HttpRespMsg ExportContract(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate);
+    HttpRespMsg ExportContract(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId);
 
     HttpRespMsg addContract(HttpServletRequest request, Contract contract, ContractCustom custom, String paymentListStr);
 

+ 6 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java

@@ -98,7 +98,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
      * @return
      */
     @Override
-    public HttpRespMsg getContractPage(HttpServletRequest request, Integer pageIndex, Integer pageSize, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate) {
+    public HttpRespMsg getContractPage(HttpServletRequest request, Integer pageIndex, Integer pageSize, String number, String name,
+                                       String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
             String token = request.getHeader("token");
@@ -131,8 +132,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
             if (StringUtils.isNotBlank(name)){
                 name = "%" + name + "%";
             }
-            List<Contract> contracts = contractMapper.selectContract(user.getCompanyId(), pageStart, pageSize, number, name , typeName , status, startDate,endDate, paymentStartDate, paymentEndDate);
-            Long totalCnt = contractMapper.selectContractCnt(user.getCompanyId(), number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate);
+            List<Contract> contracts = contractMapper.selectContract(user.getCompanyId(), pageStart, pageSize, number, name , typeName , status, startDate,endDate, paymentStartDate, paymentEndDate, secTypeId);
+            Long totalCnt = contractMapper.selectContractCnt(user.getCompanyId(), number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate, secTypeId);
             for (Contract contract : contracts) {
                 if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
                     contract.setCreatorName(contract.getCreatorWxCorpId());
@@ -242,7 +243,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
      * @return
      */
     @Override
-    public HttpRespMsg ExportContract(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate) {
+    public HttpRespMsg ExportContract(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("token"));
         List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "导出合同");
@@ -252,7 +253,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         }
         WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
         CompanyDingding dingding = companyDingdingMapper.selectOne(new QueryWrapper<CompanyDingding>().eq("company_id", user.getCompanyId()));
-        HttpRespMsg contractPage = getContractPage(request, null, null, number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate);
+        HttpRespMsg contractPage = getContractPage(request, null, null, number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate, secTypeId);
         HashMap<String, Object> resultDate = (HashMap<String, Object>) contractPage.data;
         List<ContractPageVO> data = (List<ContractPageVO>)resultDate.get("data");
         List<String> headList = new ArrayList<String>();

+ 67 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ContractMapper.xml

@@ -26,5 +26,72 @@
     <sql id="Base_Column_List">
         id, company_id, creator_id, start_date, end_date, number, project_id, name, amounts, type_id, checkerId, status, indate, remarks, payment, sec_type_id
     </sql>
+    <select id="selectContract" resultType="com.management.platform.entity.Contract">
+        select contract.id,contract.company_id,contract.creator_id,contract.number,contract.name,contract.amounts,contract.type_id,contract_type.type_name,contract.status,contract.indate,contract.remarks,
+        contract.start_date as startDate,contract.end_date as endDate,
+        user.name as creatorName,user.corpwx_userid as creatorWxCorpId, contract.project_id, contract.payment, cp.pay_date AS next_payment_date, cp.amount AS next_payment_amount
+        from contract
+        left join contract_type
+        on contract.type_id = contract_type.id
+        LEFT JOIN (SELECT contract_id, pay_date, amount FROM contract_payment WHERE is_payed = 0 GROUP BY contract_id) cp ON cp.contract_id=contract.id
+        left join user
+        on contract.creator_id = user.id
+        where contract.company_id = #{companyId}
+        <if test="number!=null">
+            and number like #{number}
+        </if>
+        <if test="name!=null">
+            and contract.name like #{name}
+        </if>
+        <if test="typeName!=null">
+            and contract_type.id = #{typeName}
+        </if>
+        <if test="secTypeId!=null">
+            and contract.sec_type_id = #{secTypeId}
+        </if>
+        <if test="status!=null">
+            and status = #{status}
+        </if>
+        <if test="startDate!=null and endDate !=null">
+            and indate between #{startDate} and #{endDate}
+        </if>
+        <if test="paymentStartDate != null and paymentEndDate != null">
+            and cp.pay_date between #{paymentStartDate} and #{paymentEndDate}
+        </if>
+        order by contract.id desc
+        <if test="pageStart!=null and pageSize!=null">
+            limit #{pageStart},#{pageSize}
+        </if>
+    </select>
 
+    <select id="selectContractCnt" resultType="java.lang.Long">
+        select count(1) from contract
+        left join contract_type
+        on contract.type_id = contract_type.id
+        LEFT JOIN (SELECT contract_id, pay_date, amount FROM contract_payment WHERE is_payed = 0 GROUP BY contract_id) cp ON cp.contract_id=contract.id
+        left join user
+        on contract.creator_id = user.id
+        where contract.company_id = #{companyId}
+        <if test="number!=null">
+            and number like #{number}
+        </if>
+        <if test="name!=null">
+            and contract.name like #{name}
+        </if>
+        <if test="typeName!=null">
+            and contract_type.id = #{typeName}
+        </if>
+        <if test="secTypeId!=null">
+            and contract.sec_type_id = #{secTypeId}
+        </if>
+        <if test="status!=null">
+            and status = #{status}
+        </if>
+        <if test="startDate!=null and endDate !=null">
+            and indate between #{startDate} and #{endDate}
+        </if>
+        <if test="paymentStartDate != null and paymentEndDate != null">
+            and cp.pay_date between #{paymentStartDate} and #{paymentEndDate}
+        </if>
+    </select>
 </mapper>