xuqiang 1 rok temu
rodzic
commit
6aff758af7
25 zmienionych plików z 1171 dodań i 5 usunięć
  1. 5 0
      commons/src/main/java/com/jzg/commons/constants/ReturnInformation.java
  2. 33 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostExternalAdd.java
  3. 20 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostExternalDeleteParam.java
  4. 33 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostExternalEnd.java
  5. 41 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostExternalPageParam.java
  6. 20 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostExternalParam.java
  7. 3 0
      commons/src/main/java/com/jzg/commons/entity/dto/CostManagementVo.java
  8. 85 0
      commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostExternalAdd.java
  9. 94 0
      commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostExternalEnd.java
  10. 47 0
      commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementCostExternal.java
  11. 32 0
      commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementCostExternalType.java
  12. 64 0
      commons/src/main/java/com/jzg/commons/entity/vo/CostExternalListVo.java
  13. 27 0
      commons/src/main/java/com/jzg/commons/entity/vo/CostExternalTypeVo.java
  14. 26 0
      commons/src/main/java/com/jzg/commons/entity/vo/CostExternalVo.java
  15. 38 0
      commons/src/main/java/com/jzg/commons/util/DateTimeUtils.java
  16. 1 1
      gateway/src/main/resources/application-dev.yml
  17. 107 0
      tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementCostExternalController.java
  18. 31 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlAgreementCostExternalMapper.java
  19. 15 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/PtlAgreementCostExternalTypeMapper.java
  20. 32 0
      tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostExternalService.java
  21. 12 0
      tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostExternalTypeService.java
  22. 211 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalServiceImpl.java
  23. 16 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalTypeServiceImpl.java
  24. 171 0
      tenant/organization/src/main/resources/mapper/PtlAgreementCostExternalMapper.xml
  25. 7 4
      tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

+ 5 - 0
commons/src/main/java/com/jzg/commons/constants/ReturnInformation.java

@@ -14,4 +14,9 @@ public class ReturnInformation {
 
     public static final String UPDATE_FAILED = "修改失败";
 
+
+    public static final String DELETE_SUCCESS = "删除成功";
+
+    public static final String DELETE_FAILED = "删除失败";
+
 }

+ 33 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostExternalAdd.java

@@ -0,0 +1,33 @@
+package com.jzg.commons.entity.dto;
+
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@Schema(description = "补录协议费用管理新增")
+public class CostExternalAdd {
+
+    @Schema(description = "协议ID")
+    @NotBlank(message = "协议ID不能为空")
+    private String ptlAgreementId;
+
+    @Schema(description = "对接人姓名")
+    @NotBlank(message = "对接人姓名不能为空")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    @NotBlank(message = "对接人手机号不能为空")
+    private String contactMobile;
+
+    @Valid
+    @Schema(description = "费用类型集合")
+    @NotEmpty(message = "费用类型集合不能为空")
+    private List< PtlAgreementCostExternalAdd> ptlAgreementCostExternalAddList;
+
+}

+ 20 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostExternalDeleteParam.java

@@ -0,0 +1,20 @@
+package com.jzg.commons.entity.dto;
+
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+@Data
+@Schema(description = "补录协议费用管理删除")
+public class CostExternalDeleteParam {
+
+    @Schema(description = "协议ID")
+    @NotBlank(message = "协议ID不能为空")
+    private String ptlAgreementId;
+
+    @Schema(description = "对接人手机号")
+    @NotBlank(message = "对接人手机号不能为空")
+    private String contactMobile;
+
+}

+ 33 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostExternalEnd.java

@@ -0,0 +1,33 @@
+package com.jzg.commons.entity.dto;
+
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@Schema(description = "补录协议费用管理修改")
+public class CostExternalEnd {
+
+    @Schema(description = "协议ID")
+    @NotBlank(message = "协议ID不能为空")
+    private String ptlAgreementId;
+
+    @Schema(description = "对接人姓名")
+    @NotBlank(message = "对接人姓名不能为空")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    @NotBlank(message = "对接人手机号不能为空")
+    private String contactMobile;
+
+    @Valid
+    @Schema(description = "费用类型集合")
+    @NotEmpty(message = "更新数据不能为空")
+    private List<PtlAgreementCostExternalEnd> ptlAgreementCostExternalAddList;
+
+}

+ 41 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostExternalPageParam.java

@@ -0,0 +1,41 @@
+package com.jzg.commons.entity.dto;
+
+
+import com.jzg.commons.core.base.PageRequest;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@Schema(description = "补录协议费用管理")
+public class CostExternalPageParam extends PageRequest {
+
+    @Schema(description = "输入代码,名称,简称查找")
+    private String agreement;
+
+    @Schema(description = "险种id")
+    private String productId;
+
+    @Schema(description = "承保规则")
+    private String rulesName;
+
+    @Schema(description = "费用规则")
+    private String costRules;
+
+    @Schema(description = "费用状态")
+    private String agreementStatus;
+
+    @Schema(description = "审核状态")
+    private String auditStatus;
+
+    @Schema(description = "有效状态")
+    private String validState;
+
+    @Schema(description = "生效时间")
+    private List<String> effectiveTime;
+
+    @Schema(description = "失效时间")
+    private List<String> failureTime;
+
+}

+ 20 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostExternalParam.java

@@ -0,0 +1,20 @@
+package com.jzg.commons.entity.dto;
+
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Data
+@Schema(description = "补录协议费用管理")
+public class CostExternalParam {
+
+    @Schema(description = "协议ID")
+    private String ptlAgreementId;
+
+    @Schema(description = "对接人姓名")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    private String contactMobile;
+
+}

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/dto/CostManagementVo.java

@@ -50,6 +50,9 @@ public class CostManagementVo {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private String failureTime;
 
+    @Schema(description = "0-生效中;1-已失效")
+    private String isValid;
+
     @Schema(description = "费用主键ID")
     private String costId;
 

+ 85 - 0
commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostExternalAdd.java

@@ -0,0 +1,85 @@
+package com.jzg.commons.entity.dto;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+@Schema(description = "补录协议费用管理新增")
+public class PtlAgreementCostExternalAdd {
+
+    @Schema(description = "协议ID")
+    private String ptlAgreementId;
+
+    @Schema(description = "险种")
+    private String productName;
+
+    @Schema(description = "险种ID")
+    private String productId;
+
+    @Schema(description = "生效时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private String effectiveTime;
+
+    @Schema(description = "失效时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @NotBlank(message = "失效时间不能为空")
+    private String failureTime;
+
+    @Schema(description = "审核方式0-自动审核;1-手动审核")
+    private String auditMethod;
+
+    @Schema(description = "0-申请审核1-审核通过2-审核未通过")
+    private String auditStatus;
+
+    @Schema(description = "是否现询")
+    private String isInquiry;
+
+    @Schema(description = "费用描述")
+    private String costDescribe;
+
+    @Schema(description = "对接人姓名")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    private String contactMobile;
+
+    @Schema(description = "费用类型集合")
+    private List<PtlAgreementCostExternalTypeAdd> costExternalTypeAdds;
+
+
+    @Data
+    @Schema(description = "费用类型集合描述")
+    public static class PtlAgreementCostExternalTypeAdd {
+
+        @Schema(description = "费用类型1-交强险2-商业险3-驾意险")
+        private String costType;
+
+        @Schema(description = "入口比例")
+        private BigDecimal inlet;
+
+        @Schema(description = "出口比例")
+        private BigDecimal export;
+
+        @Schema(description = "总费用比例")
+        private BigDecimal totalCost;
+
+        @Schema(description = "其它费用比例")
+        private BigDecimal other;
+
+        @Schema(description = "1级比例")
+        private BigDecimal level1;
+
+        @Schema(description = "5级比例")
+        private BigDecimal level5;
+
+        private Long ptlAgreementCostExternalId;
+
+    }
+
+}

+ 94 - 0
commons/src/main/java/com/jzg/commons/entity/dto/PtlAgreementCostExternalEnd.java

@@ -0,0 +1,94 @@
+package com.jzg.commons.entity.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotEmpty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+
+@Data
+@Schema(description = "补录协议费用管理修改")
+public class PtlAgreementCostExternalEnd {
+
+    @Schema(description = "id")
+    private String id;
+
+    @Schema(description = "协议ID")
+    private String ptlAgreementId;
+
+    @Schema(description = "险种")
+    private String productName;
+
+    @Schema(description = "险种ID")
+    private String productId;
+
+    @Schema(description = "生效时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @NotBlank(message = "生效时间不能为空")
+    private String effectiveTime;
+
+    @Schema(description = "失效时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @NotBlank(message = "生效时间不能为空")
+    private String failureTime;
+
+    @Schema(description = "审核方式0-自动审核;1-手动审核")
+    @NotBlank(message = "审核方式不能为空")
+    private String auditMethod;
+
+    @Schema(description = "0-申请审核1-审核通过2-审核未通过")
+    private String auditStatus;
+
+    @Schema(description = "是否现询")
+    private String isInquiry;
+
+    @Schema(description = "费用描述")
+    private String costDescribe;
+
+    @Schema(description = "对接人姓名")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    private String contactMobile;
+
+    @NotEmpty(message = "费用类型集合不能为空")
+    @Schema(description = "费用类型集合")
+    private List<PtlAgreementCostExternalEnd.PtlAgreementCostExternalTypeAdd> costExternalTypeAdds;
+
+    @Valid
+    @Data
+    @Schema(description = "费用类型集合描述")
+    public static class PtlAgreementCostExternalTypeAdd {
+
+        @Schema(description = "费用类型1-交强险2-商业险3-驾意险")
+        @NotBlank(message = "费用类型不能为空")
+        private String costType;
+
+        @Schema(description = "入口比例")
+        private BigDecimal inlet;
+
+        @Schema(description = "出口比例")
+        private BigDecimal export;
+
+        @Schema(description = "总费用比例")
+        private BigDecimal totalCost;
+
+        @Schema(description = "其它费用比例")
+        private BigDecimal other;
+
+        @Schema(description = "1级比例")
+        private BigDecimal level1;
+
+        @Schema(description = "5级比例")
+        private BigDecimal level5;
+
+        private Long ptlAgreementCostExternalId;
+
+    }
+
+}

+ 47 - 0
commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementCostExternal.java

@@ -0,0 +1,47 @@
+package com.jzg.commons.entity.po;
+
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jzg.commons.core.base.BaseModel;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("ptl_agreement_cost_external")
+public class PtlAgreementCostExternal extends BaseModel {
+
+    @TableId(type = IdType.ASSIGN_ID)
+    private Long id;
+
+    private Long ptlAgreementId;
+
+    private String productName;
+
+    private String productId;
+
+    private Date effectiveTime;
+
+    private Date failureTime;
+
+    private Integer auditMethod;
+
+    private Integer auditStatus;
+
+    private String reviewDescription;
+
+    private Integer isInquiry;
+
+    private Integer isEnabled;
+
+    private String costDescribe;
+
+    private String contactPerson;
+
+    private String contactMobile;
+
+
+
+}

+ 32 - 0
commons/src/main/java/com/jzg/commons/entity/po/PtlAgreementCostExternalType.java

@@ -0,0 +1,32 @@
+package com.jzg.commons.entity.po;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.jzg.commons.core.base.BaseModel;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@TableName("ptl_agreement_cost_external_type")
+public class PtlAgreementCostExternalType extends BaseModel {
+
+    private Long id;
+
+    private Long ptlAgreementCostExternalId;
+
+    private String costType;
+
+    private BigDecimal inlet;
+
+    private BigDecimal export;
+
+    private BigDecimal totalCost;
+
+    private BigDecimal other;
+
+    private BigDecimal level1;
+
+    private BigDecimal level5;
+
+}

+ 64 - 0
commons/src/main/java/com/jzg/commons/entity/vo/CostExternalListVo.java

@@ -0,0 +1,64 @@
+package com.jzg.commons.entity.vo;
+
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@Schema(description = "补录协议费用管理列表VO")
+public class CostExternalListVo {
+
+    private String id;
+
+
+    @Schema(description = "协议代码")
+    private String agreementCode;
+
+    @Schema(description = "协议简称")
+    private String agreementAbbreviation;
+
+    @Schema(description = "险种")
+    private String productName;
+
+    @Schema(description = "险种ID")
+    private String productId;
+
+    @Schema(description = "费用描述")
+    private String costDescribe;
+
+    @Schema(description = "是否现询 0 -是;1-否")
+    private String isInquiry;
+
+    @Schema(description = "生效时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private String effectiveTime;
+
+    @Schema(description = "失效时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private String failureTime;
+
+    @Schema(description = "有效状态 true-有效")
+    private boolean effective;
+
+    @Schema(description = "审核状态 0-申请审核1-审核通过2-审核未通过")
+    private String auditStatus;
+
+    @Schema(description = "审核方式 0-自动审核1-人工审核")
+    private String auditMethod;
+
+    @Schema(description = "0-启用;1-停用")
+    private String isEnabled;
+
+    @Schema(description = "对接人姓名")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    private String contactMobile;
+
+    @Schema(description = "费用类型")
+    private List<CostExternalTypeVo>  costExternalTypeAdds;
+
+}

+ 27 - 0
commons/src/main/java/com/jzg/commons/entity/vo/CostExternalTypeVo.java

@@ -0,0 +1,27 @@
+package com.jzg.commons.entity.vo;
+
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+@Schema(description = "补录协议费用管理列表VO")
+public class CostExternalTypeVo {
+
+    private String costType;
+
+    private BigDecimal inlet;
+
+    private BigDecimal export;
+
+    private BigDecimal totalCost;
+
+    private BigDecimal other;
+
+    private BigDecimal level1;
+
+    private BigDecimal level5;
+
+}

+ 26 - 0
commons/src/main/java/com/jzg/commons/entity/vo/CostExternalVo.java

@@ -0,0 +1,26 @@
+package com.jzg.commons.entity.vo;
+
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+@Schema(description = "补录协议费用管理列表VO")
+public class CostExternalVo {
+
+    private String ids;
+
+    @Schema(description = "对接人姓名")
+    private String contactPerson;
+
+    @Schema(description = "对接人手机号")
+    private String contactMobile;
+
+
+    @Schema(description = "对接人邮箱")
+    private List<CostExternalListVo>  costExternalListVo;
+
+
+}

+ 38 - 0
commons/src/main/java/com/jzg/commons/util/DateTimeUtils.java

@@ -0,0 +1,38 @@
+package com.jzg.commons.util;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.format.DateTimeParseException;
+
+public class DateTimeUtils {
+
+    private static final  String pattern = "yyyy-MM-dd HH:mm:ss";
+
+    /**
+     * 比较当前时间是否大于传入的字符串时间
+     *
+     * @param endTimeStr 传入的结束时间字符串
+     * @return 如果当前时间大于传入的时间字符串,返回true;否则返回false
+     */
+    public static boolean isCurrentTimeAfter(String endTimeStr) {
+        try {
+            // 定义日期时间格式
+            DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
+
+            // 将字符串解析为 LocalDateTime 对象
+            LocalDateTime endTime = LocalDateTime.parse(endTimeStr, formatter);
+
+            // 获取当前时间
+            LocalDateTime now = LocalDateTime.now();
+
+            // 比较当前时间是否大于结束时间
+            return now.isAfter(endTime);
+        } catch (DateTimeParseException e) {
+            // 处理解析异常
+            System.err.println("日期时间解析异常: " + e.getMessage());
+            return false;
+        }
+    }
+
+
+}

+ 1 - 1
gateway/src/main/resources/application-dev.yml

@@ -28,6 +28,6 @@ spring:
         - id: tenant_route
           uri: http://localhost:8084/
           predicates:
-            - Path=/tenant/**,/dept/**,/area/**,/dict/**,/userInfo/**,/sysOrganization/**,/activity/**,/message/**,/messageNotice/**,/poster/**,/agreement/**,/pltAgreement/**,/agreementRules/**,/plt/areaLicense/**,/ptlAgreementCost/**
+            - Path=/tenant/**,/dept/**,/area/**,/dict/**,/userInfo/**,/sysOrganization/**,/activity/**,/message/**,/messageNotice/**,/poster/**,/agreement/**,/pltAgreement/**,/agreementRules/**,/plt/areaLicense/**,/ptlAgreementCost/**,/ptlAgreementCostExternal/**
 
 

+ 107 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/PtlAgreementCostExternalController.java

@@ -0,0 +1,107 @@
+package com.jzg.organization.controller;
+
+
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.dto.*;
+import com.jzg.commons.entity.vo.CostExternalListVo;
+import com.jzg.commons.request.RequestSingleParam;
+import com.jzg.organization.service.PtlAgreementCostExternalService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.annotation.Resource;
+import jakarta.validation.Valid;
+import jakarta.validation.constraints.NotEmpty;
+import jakarta.validation.constraints.NotNull;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Tag(name="补录协议费用管理")
+@Validated
+@RestController
+@RequestMapping("/ptlAgreementCostExternal")
+public class PtlAgreementCostExternalController {
+
+
+    @Resource
+    private PtlAgreementCostExternalService ptlAgreementCostExternalService;
+
+    @PostMapping("save")
+    @Operation(summary= "补录协议费用新增")
+    public HttpResult save(@Valid @RequestBody CostExternalAdd costExternalAdd){
+        return ptlAgreementCostExternalService.save(costExternalAdd);
+    }
+
+
+    @PostMapping("selectByAgreementIdAll")
+    @Operation(summary= "查询协议下对接人所有费用")
+    public HttpResult<CostExternalListVo> selectByAgreementIdAll(@RequestBody CostExternalParam costExternalParam){
+        return ptlAgreementCostExternalService.selectByAgreementIdAll(costExternalParam);
+    }
+
+
+    @PostMapping("updateList")
+    @Operation(summary= "批量编辑")
+    public HttpResult updateList(@Valid @RequestBody CostExternalEnd costExternalEnd){
+        return ptlAgreementCostExternalService.updateList(costExternalEnd);
+    }
+
+
+    @GetMapping("getById")
+    @Operation(summary= "通过ID查询查询")
+    public HttpResult getById(@Validated @NotNull @RequestParam("id") Long id){
+        return ptlAgreementCostExternalService.getById(id);
+    }
+
+
+    @PostMapping("updateById")
+    @Operation(summary= "补录协议费用修改")
+    public HttpResult updateById(@RequestBody PtlAgreementCostExternalEnd costExternalEnd){
+        return ptlAgreementCostExternalService.updateById(costExternalEnd);
+    }
+
+
+    @PostMapping("costExternalList")
+    @Operation(summary = "补录协议费用列表")
+    public HttpResult costExternalList(@RequestBody CostExternalParam costExternalParam){
+        return ptlAgreementCostExternalService.costExternalList(costExternalParam);
+    }
+
+
+    @PostMapping("deleteById")
+    @Operation(summary = "批量删除")
+    public HttpResult deleteById(@RequestBody List<Long> ids){
+        return ptlAgreementCostExternalService.removeBatchByIds(ids) ? HttpResult.ok("删除成功") : HttpResult.error("删除失败");
+    }
+
+
+    @PostMapping("deleteByPtlAgreementIdAndMobile")
+    @Operation(summary = "通过协议ID 与 对接人手机号删除")
+    public HttpResult deleteByPtlAgreementIdAndMobile(@Valid @RequestBody CostExternalDeleteParam costExternalDeleteParam){
+        return ptlAgreementCostExternalService.deleteByPtlAgreementIdAndMobile(costExternalDeleteParam);
+    }
+
+
+    @Operation(summary = "协议费用管理批量禁用/启用")
+    @PostMapping("enableDisableByIds")
+    public HttpResult enableDisableByIds(@RequestBody @NotEmpty(message = "id不能为空") List<String> ids, @NotNull(message = "状态不能为空") Boolean isEnabled){
+        return ptlAgreementCostExternalService.enableDisableByIds(ids,isEnabled);
+    }
+
+
+    @Operation(summary = "批量修改审批方式")
+    @PostMapping("approvalMethodAll")
+    public HttpResult approvalMethodAll(@RequestBody @NotEmpty(message = "id不能为空") List<String> ids, @NotNull(message = "审批方式不能为空") int auditMethod){
+        return ptlAgreementCostExternalService.approvalMethodAll(ids,auditMethod);
+    }
+
+
+    @Operation(summary = "费用管理分页列表")
+    @PostMapping("pageList")
+    public HttpResult pageList(@RequestBody CostExternalPageParam pageParam){
+        return ptlAgreementCostExternalService.pageList(pageParam);
+    }
+
+
+}

+ 31 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/PtlAgreementCostExternalMapper.java

@@ -0,0 +1,31 @@
+package com.jzg.organization.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jzg.commons.entity.dto.CostExternalEnd;
+import com.jzg.commons.entity.dto.CostExternalPageParam;
+import com.jzg.commons.entity.dto.CostExternalParam;
+import com.jzg.commons.entity.po.PtlAgreementCostExternal;
+import com.jzg.commons.entity.vo.CostExternalListVo;
+import com.jzg.commons.entity.vo.CostExternalVo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface  PtlAgreementCostExternalMapper extends BaseMapper<PtlAgreementCostExternal> {
+
+
+    List<CostExternalVo> costExternalList(CostExternalParam costExternalParam);
+
+
+    CostExternalListVo getById(Long id);
+
+    Page<CostExternalListVo> pageList(Page page, @Param("costParam") CostExternalPageParam costParam);
+
+    List<CostExternalListVo> selectByAgreementIdAll(CostExternalParam costExternalParam);
+
+    void deleteByIAgreementId(CostExternalEnd costExternalEnd);
+}

+ 15 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/PtlAgreementCostExternalTypeMapper.java

@@ -0,0 +1,15 @@
+package com.jzg.organization.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.jzg.commons.entity.po.PtlAgreementCostExternalType;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+@Mapper
+public interface PtlAgreementCostExternalTypeMapper extends BaseMapper<PtlAgreementCostExternalType> {
+
+    @Delete("delete from ptl_agreement_cost_external_type where ptl_agreement_cost_external_id = #{id}")
+    void deletePtlAgreementCostExternalId(@Param("id") Long id);
+}

+ 32 - 0
tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostExternalService.java

@@ -0,0 +1,32 @@
+package com.jzg.organization.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.dto.*;
+import com.jzg.commons.entity.po.PtlAgreementCostExternal;
+
+import java.util.List;
+
+public interface PtlAgreementCostExternalService extends IService<PtlAgreementCostExternal> {
+
+    HttpResult save(CostExternalAdd costExternalAdd);
+
+    HttpResult getById(Long id);
+
+    HttpResult updateById(PtlAgreementCostExternalEnd costExternalEnd);
+
+    HttpResult costExternalList(CostExternalParam costExternalParam);
+
+    HttpResult enableDisableByIds( List<String> ids, Boolean isEnabled);
+
+    HttpResult pageList(CostExternalPageParam pageParam);
+
+    HttpResult updateList(CostExternalEnd costExternalEnd);
+
+    HttpResult selectByAgreementIdAll(CostExternalParam costExternalParam);
+
+    HttpResult deleteByPtlAgreementIdAndMobile(CostExternalDeleteParam costExternalDeleteParam);
+
+    HttpResult approvalMethodAll(List<String> ids, int auditMethod);
+
+}

+ 12 - 0
tenant/organization/src/main/java/com/jzg/organization/service/PtlAgreementCostExternalTypeService.java

@@ -0,0 +1,12 @@
+package com.jzg.organization.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.entity.po.PtlAgreementCostExternalType;
+
+public interface PtlAgreementCostExternalTypeService extends IService<PtlAgreementCostExternalType> {
+
+
+    void deleteByPtlAgreementCostExternalId(Long id);
+
+
+}

+ 211 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalServiceImpl.java

@@ -0,0 +1,211 @@
+package com.jzg.organization.service.impl;
+
+
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.nacos.common.utils.CollectionUtils;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.constants.Constants;
+import com.jzg.commons.constants.ReturnInformation;
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.dto.*;
+import com.jzg.commons.entity.po.PtlAgreementCostExternal;
+import com.jzg.commons.entity.po.PtlAgreementCostExternalType;
+import com.jzg.commons.entity.vo.CostExternalVo;
+import com.jzg.commons.exception.SystemException;
+import com.jzg.commons.util.DateTimeUtils;
+import com.jzg.commons.util.StringUtils;
+import com.jzg.organization.mapper.PtlAgreementCostExternalMapper;
+import com.jzg.organization.service.PtlAgreementCostExternalService;
+import com.jzg.organization.service.PtlAgreementCostExternalTypeService;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+@Slf4j
+@Service
+public class PtlAgreementCostExternalServiceImpl extends ServiceImpl<PtlAgreementCostExternalMapper, PtlAgreementCostExternal> implements PtlAgreementCostExternalService {
+
+    @Resource
+    private PtlAgreementCostExternalTypeService ptlAgreementCostExternalTypeService;
+
+
+    @Override
+    @Transactional
+    public HttpResult save(CostExternalAdd costExternalAdd) {
+        try {
+            if (verifyAgreementCostExternal(costExternalAdd.getContactPerson(), costExternalAdd.getContactMobile(),null)){
+                throw new SystemException("对接人姓名和对接人手机号已存在");
+            }
+            costExternalAdd.getPtlAgreementCostExternalAddList().forEach(ptlAgreementCostExternalAdd -> {
+                ptlAgreementCostExternalAdd.setPtlAgreementId(costExternalAdd.getPtlAgreementId());
+                ptlAgreementCostExternalAdd.setContactPerson(costExternalAdd.getContactPerson());
+                ptlAgreementCostExternalAdd.setContactMobile(costExternalAdd.getContactMobile());
+                PtlAgreementCostExternal ptlAgreementCostExternal = BeanUtil.copyProperties(ptlAgreementCostExternalAdd, PtlAgreementCostExternal.class);
+                if (baseMapper.insert(ptlAgreementCostExternal) <= 0) {
+                    throw new SystemException(ReturnInformation.FAILURE_MESSAGE);
+                }
+                saveOrUpdate(ptlAgreementCostExternalAdd.getCostExternalTypeAdds(), ptlAgreementCostExternal.getId());
+
+            });
+            return HttpResult.ok(ReturnInformation.SUCCESS_MESSAGE);
+        } catch (Exception e) {
+            log.error("保存失败: ", e);
+            return HttpResult.error(ReturnInformation.FAILURE_MESSAGE);
+        }
+    }
+
+
+    public boolean verifyAgreementCostExternal(String contactPerson, String contactMobile,List<String> ids) {
+        if (baseMapper.selectCount(new LambdaQueryWrapper<>(PtlAgreementCostExternal.class)
+                .eq(PtlAgreementCostExternal::getContactPerson, contactPerson)
+                .eq(PtlAgreementCostExternal::getContactMobile, contactMobile)
+                .eq(PtlAgreementCostExternal::getIsDelete, Constants.NOT_DELETED)
+                .notIn(CollectionUtils.isNotEmpty(ids),PtlAgreementCostExternal::getId, ids) ) > 0 ){
+            return true;
+        }
+        return false;
+    }
+
+
+
+
+
+    @Override
+    public HttpResult getById(Long id) {
+        return HttpResult.ok(baseMapper.getById(id));
+    }
+
+    @Override
+    public HttpResult updateById(PtlAgreementCostExternalEnd costExternalEnd) {
+        try {
+//            ArrayList<String> list = new ArrayList<>();
+//            list.add(costExternalEnd.getId());
+//            if (verifyAgreementCostExternal(costExternalEnd.getContactPerson(), costExternalEnd.getContactMobile(),list)){
+//                return HttpResult.error("对接人姓名和对接人手机号已存在");
+//            }
+            PtlAgreementCostExternal ptlAgreementCostExternal = BeanUtil.copyProperties(costExternalEnd, PtlAgreementCostExternal.class);
+            if (baseMapper.updateById(ptlAgreementCostExternal) <= 0) {
+                return HttpResult.error(ReturnInformation.UPDATE_FAILED);
+            }
+            saveOrUpdate(costExternalEnd.getCostExternalTypeAdds(), ptlAgreementCostExternal.getId());
+            return HttpResult.ok(ReturnInformation.UPDATE_SUCCESS);
+        } catch (Exception e) {
+            log.error("保存失败: ", e);
+            return HttpResult.error(ReturnInformation.UPDATE_FAILED);
+        }
+    }
+
+
+    @Transactional
+    public void saveOrUpdate(List<?> list, Long id) {
+        try {
+            if (CollectionUtils.isNotEmpty(list)) {
+                ptlAgreementCostExternalTypeService.deleteByPtlAgreementCostExternalId(id);
+                List<PtlAgreementCostExternalType> ptlAgreementCostExternalTypes = BeanUtil.copyToList(list, PtlAgreementCostExternalType.class);
+                ptlAgreementCostExternalTypes.forEach(ptlAgreementCostExternalTypeAdd -> {
+                    ptlAgreementCostExternalTypeAdd.setPtlAgreementCostExternalId(id);
+                });
+                ptlAgreementCostExternalTypeService.saveBatch(ptlAgreementCostExternalTypes);
+            }
+        } catch (Exception e) {
+            // 记录日志
+            log.error("保存或更新失败: ", e);
+            throw new SystemException("保存或更新失败");
+        }
+
+    }
+
+
+    @Override
+    public HttpResult costExternalList(CostExternalParam costExternalParam) {
+        List<CostExternalVo> costExternalVo = baseMapper.costExternalList(costExternalParam);
+        if (CollectionUtils.isNotEmpty(costExternalVo)) {
+            costExternalVo.stream()
+                    .filter(Objects::nonNull)
+                    .flatMap(vo -> Optional.ofNullable(vo.getCostExternalListVo()).orElse(Collections.emptyList()).stream())
+                    .forEach(costExternalListVo ->
+                            costExternalListVo.setEffective(DateTimeUtils.isCurrentTimeAfter(costExternalListVo.getFailureTime()))
+                    );
+        }
+        return HttpResult.ok(costExternalVo);
+    }
+
+    @Override
+    public HttpResult enableDisableByIds(List<String> ids,Boolean isEnabled) {
+        if (org.springframework.util.CollectionUtils.isEmpty(ids)){
+            return HttpResult.error("参数不能为空");
+        }
+        PtlAgreementCostExternal ptlAgreementCostExternal = new PtlAgreementCostExternal();
+        ptlAgreementCostExternal.setIsEnabled(isEnabled ? 0 : 1);
+        return baseMapper.update(ptlAgreementCostExternal,new LambdaQueryWrapper<>(PtlAgreementCostExternal.class)
+                .in(PtlAgreementCostExternal::getId,ids)) > 0 ?
+                HttpResult.ok(isEnabled ? "启用成功" : "禁用成功") : HttpResult.error(isEnabled ? "启用失败" : "禁用失败");
+    }
+
+    @Override
+    public HttpResult pageList(CostExternalPageParam pageParam) {
+        return HttpResult.ok(baseMapper.pageList(pageParam.getPage(),pageParam));
+    }
+
+    @Override
+    public HttpResult updateList(CostExternalEnd costExternalEnd) {
+        try {
+            List<String> collect = costExternalEnd.getPtlAgreementCostExternalAddList().stream().map(PtlAgreementCostExternalEnd::getId).collect(Collectors.toList());
+            if (verifyAgreementCostExternal(costExternalEnd.getContactPerson(), costExternalEnd.getContactMobile(),collect)){
+                throw new SystemException("对接人姓名和对接人手机号已存在");
+            }
+            costExternalEnd.getPtlAgreementCostExternalAddList().forEach(agreementCostExternalEnd -> {
+                agreementCostExternalEnd.setPtlAgreementId(costExternalEnd.getPtlAgreementId());
+                agreementCostExternalEnd.setContactPerson(costExternalEnd.getContactPerson());
+                agreementCostExternalEnd.setContactMobile(costExternalEnd.getContactMobile());
+                PtlAgreementCostExternal ptlAgreementCostExternal = BeanUtil.copyProperties(agreementCostExternalEnd, PtlAgreementCostExternal.class);
+                if (!baseMapper.insertOrUpdate(ptlAgreementCostExternal)) {
+                    throw new SystemException(ReturnInformation.FAILURE_MESSAGE);
+                }
+                saveOrUpdate(agreementCostExternalEnd.getCostExternalTypeAdds(), ptlAgreementCostExternal.getId());
+            });
+            return HttpResult.ok(ReturnInformation.SUCCESS_MESSAGE);
+        } catch (Exception e) {
+            log.error("保存失败: ", e);
+            return HttpResult.error(e.getMessage());
+        }
+    }
+
+    @Override
+    public HttpResult selectByAgreementIdAll(CostExternalParam costExternalParam) {
+        if (costExternalParam.getPtlAgreementId() == null){
+            return HttpResult.error("协议ID不能为空");
+        }
+        if (StringUtils.isEmpty(costExternalParam.getContactPerson())){
+            return HttpResult.error("对接人姓名不能为空");
+        }
+        if (StringUtils.isEmpty(costExternalParam.getContactMobile())){
+            return HttpResult.error("对接人手机号不能为空");
+        }
+        return HttpResult.ok(baseMapper.selectByAgreementIdAll(costExternalParam));
+    }
+
+    @Override
+    public HttpResult deleteByPtlAgreementIdAndMobile(CostExternalDeleteParam costExternalDeleteParam) {
+        return baseMapper.delete(new LambdaQueryWrapper<>(PtlAgreementCostExternal.class).eq(PtlAgreementCostExternal::getPtlAgreementId,costExternalDeleteParam.getPtlAgreementId() )
+                .eq(PtlAgreementCostExternal::getContactMobile,costExternalDeleteParam.getContactMobile())) > 0 ? HttpResult.ok(ReturnInformation.DELETE_SUCCESS) : HttpResult.error(ReturnInformation.DELETE_FAILED);
+    }
+
+    @Override
+    public HttpResult approvalMethodAll(List<String> ids, int auditMethod) {
+        PtlAgreementCostExternal ptlAgreementCostExternal = new PtlAgreementCostExternal();
+        ptlAgreementCostExternal.setAuditMethod(auditMethod);
+        return baseMapper.update(ptlAgreementCostExternal,new LambdaQueryWrapper<>(PtlAgreementCostExternal.class)
+                .in(PtlAgreementCostExternal::getId,ids)) > 0 ?
+                HttpResult.ok(ReturnInformation.UPDATE_SUCCESS) : HttpResult.error(ReturnInformation.UPDATE_FAILED);
+    }
+
+
+}

+ 16 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlAgreementCostExternalTypeServiceImpl.java

@@ -0,0 +1,16 @@
+package com.jzg.organization.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.entity.po.PtlAgreementCostExternalType;
+import com.jzg.organization.mapper.PtlAgreementCostExternalTypeMapper;
+import com.jzg.organization.service.PtlAgreementCostExternalTypeService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PtlAgreementCostExternalTypeServiceImpl extends ServiceImpl<PtlAgreementCostExternalTypeMapper, PtlAgreementCostExternalType> implements PtlAgreementCostExternalTypeService {
+    @Override
+    public void deleteByPtlAgreementCostExternalId(Long id) {
+        baseMapper.deletePtlAgreementCostExternalId(id);
+    }
+}

+ 171 - 0
tenant/organization/src/main/resources/mapper/PtlAgreementCostExternalMapper.xml

@@ -0,0 +1,171 @@
+<?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.jzg.organization.mapper.PtlAgreementCostExternalMapper">
+
+
+    <resultMap id="CostExternalVoMap" type="com.jzg.commons.entity.vo.CostExternalVo">
+        <result column="ids" property="ids" />
+        <result column="contact_person" property="contactPerson" />
+        <result column="contact_mobile" property="contactMobile" />
+        <collection property="costExternalListVo" column="ids" ofType="com.jzg.commons.entity.vo.CostExternalListVo" select="selectByIds" />
+    </resultMap>
+
+    <resultMap id="CostExternalListVoMap" type="com.jzg.commons.entity.vo.CostExternalListVo">
+        <result column="id" property="id" />
+        <result column="product_name" property="productName" />
+        <result column="product_id" property="productId" />
+        <result column="cost_describe" property="costDescribe" />
+        <result column="is_inquiry" property="isInquiry" />
+        <result column="effective_time" property="effectiveTime" />
+        <result column="failure_time" property="failureTime" />
+        <result column="effective" property="effective" />
+        <result column="audit_status" property="auditStatus" />
+        <result column="is_enabled" property="isEnabled" />
+        <collection property="costExternalTypeAdds" column="id" ofType="com.jzg.commons.entity.vo.CostExternalTypeVo" select="selectCostExternalTypeVo" />
+    </resultMap>
+
+
+    <resultMap id="ExternalListVoMap" type="com.jzg.commons.entity.vo.CostExternalListVo">
+        <result column="id" property="id" />
+        <result column="agreement_code" property="agreementCode" />
+        <result column="agreement_abbreviation" property="agreementAbbreviation" />
+        <result column="product_name" property="productName" />
+        <result column="product_id" property="productId" />
+        <result column="cost_describe" property="costDescribe" />
+        <result column="is_inquiry" property="isInquiry" />
+        <result column="effective_time" property="effectiveTime" />
+        <result column="failure_time" property="failureTime" />
+        <result column="effective" property="effective" />
+        <result column="audit_status" property="auditStatus" />
+        <result column="is_enabled" property="isEnabled" />
+        <result column="contact_person" property="contactPerson" />
+        <result column="contact_mobile" property="contactMobile" />
+        <result column="audit_method" property="auditMethod" />
+        <collection property="costExternalTypeAdds" column="id" ofType="com.jzg.commons.entity.vo.CostExternalTypeVo" select="selectCostExternalTypeVo" />
+    </resultMap>
+
+
+    <sql id="Base_Column">
+        SELECT
+            id,ptl_agreement_id,product_name,product_id,effective_time,failure_time,audit_method,audit_status,is_enabled,review_description,is_inquiry,cost_describe,contact_person,contact_mobile,is_delete
+        FROM
+            ptl_agreement_cost_external
+    </sql>
+
+    <sql id="Base_Column_type">
+        SELECT
+            id,ptl_agreement_cost_external_id,cost_type,inlet,export,total_cost,other,level1,level5
+        FROM
+            ptl_agreement_cost_external_type
+    </sql>
+
+    <delete id="deleteByIAgreementId">
+        DELETE FROM ptl_agreement_cost_external WHERE ptl_agreement_id = #{ptlAgreementId} AND contact_mobile = #{contactMobile}
+    </delete>
+
+
+    <select id="getById" resultMap="CostExternalListVoMap">
+        <include refid="Base_Column" /> WHERE id = #{id}
+    </select>
+
+
+    <select id="costExternalList" resultMap="CostExternalVoMap">
+        SELECT
+            contact_person,
+            contact_mobile,
+            GROUP_CONCAT(id) as ids
+        FROM
+            ptl_agreement_cost_external
+        <where>
+            is_delete = 0
+        <if test="ptlAgreementId != null and ptlAgreementId != ''">
+            AND ptl_agreement_id = #{ptlAgreementId}
+        </if>
+            GROUP BY contact_person,contact_mobile
+        </where>
+    </select>
+
+    <select id="selectByIds" resultMap="CostExternalListVoMap">
+        <include refid="Base_Column" /> WHERE id in (${ids})
+    </select>
+
+    <select id="selectCostExternalTypeVo" resultType="com.jzg.commons.entity.vo.CostExternalTypeVo">
+        <include refid="Base_Column_type" /> WHERE ptl_agreement_cost_external_id = #{id}
+    </select>
+
+
+
+
+    <select id="pageList" resultMap="ExternalListVoMap">
+        SELECT
+            ce.id,
+            ce.product_name,
+            ce.product_id,
+            ce.cost_describe,
+            ce.is_inquiry,
+            ce.effective_time,
+            ce.failure_time,
+            ce.audit_status,
+            ce.is_enabled,
+            ce.contact_person,
+            ce.contact_mobile,
+            ce.audit_method,
+            pa.agreement_code,
+            pa.agreement_abbreviation
+        FROM
+            ptl_agreement_cost_external ce
+                LEFT JOIN ptl_agreement pa ON pa.id = ce.ptl_agreement_id
+        <where>
+            ce.is_delete = 0
+            <if test="costParam.agreement != null and costParam.agreement != ''">
+                AND (pa.agreement_title  like concat('%',#{costParam.agreement},'%') or
+                pa.agreement_code  like concat('%',#{costParam.agreement},'%') or
+                pa.agreement_abbreviation  like concat('%',#{costParam.agreement},'%') or
+                pa.id = #{costParam.agreement})
+            </if>
+            <if test="costParam.productId != null and costParam.productId != ''">
+                AND ce.product_id = #{costParam.productId}
+            </if>
+            <if test="costParam.rulesName != null and costParam.rulesName != ''">
+                AND ce.rule_description  like concat('%',#{costParam.rulesName},'%')
+            </if>
+            <if test="costParam.costRules != null and costParam.costRules != ''">
+                AND ce.cost_rules  like concat('%',#{costParam.costRules},'%')
+            </if>
+            <if test="costParam.agreementStatus != null and costParam.agreementStatus != ''">
+                AND ce.is_enabled = #{costParam.agreementStatus}
+            </if>
+            <if test="costParam.auditStatus != null and costParam.auditStatus != ''">
+                AND ce.approved = #{costParam.auditStatus}
+            </if>
+            <if test="costParam.validState != null and costParam.validState != ''">
+                AND ce.is_valid = #{costParam.validState}
+            </if>
+            <if test="costParam.effectiveTime != null and costParam.effectiveTime.size() > 0">
+                AND ce.effective_time BETWEEN #{costParam.effectiveTime[0]} AND #{costParam.effectiveTime[1]}
+            </if>
+            <if test="costParam.failureTime != null and costParam.failureTime.size() > 0">
+                AND ce.failure_time BETWEEN #{costParam.failureTime[0]} AND #{costParam.failureTime[1]}
+            </if>
+        </where>
+    </select>
+
+
+    <select id="selectByAgreementIdAll" resultMap="CostExternalListVoMap">
+        <include refid="Base_Column" />
+        <where>
+            is_delete = 0
+            <if test="ptlAgreementId != null and ptlAgreementId != ''">
+                AND ptl_agreement_id = #{ptlAgreementId}
+            </if>
+            <if test="contactPerson != null and contactPerson != ''">
+                AND contact_person = #{contactPerson}
+            </if>
+            <if test="contactMobile != null and contactMobile != ''">
+                AND contact_mobile = #{contactMobile}
+            </if>
+        </where>
+    </select>
+
+
+</mapper>

+ 7 - 4
tenant/organization/src/main/resources/mapper/PtlAgreementCostMapper.xml

@@ -89,6 +89,7 @@
         <result column="agreement_title" property="agreementTitle" jdbcType="VARCHAR"/>
         <result column="agreement_abbreviation" property="agreementAbbreviation" jdbcType="VARCHAR"/>
         <result column="is_enabled" property="isEnabled" jdbcType="VARCHAR"/>
+        <result column="is_valid" property="isValid" jdbcType="VARCHAR"/>
         <result column="approved" property="approved" jdbcType="VARCHAR"/>
         <result column="rule_description" property="ruleDescription" jdbcType="VARCHAR"/>
         <result column="product_id" property="productId" jdbcType="VARCHAR"/>
@@ -256,6 +257,7 @@
             pc.cover_rule_id,
             pc.approved,
             pc.is_enabled,
+            pc.is_valid,
             pa.agreement_code,
             pa.agreement_title,
             pa.agreement_abbreviation,
@@ -263,14 +265,15 @@
             pr.rule_description
         FROM
             ptl_agreement_cost pc
-                LEFT JOIN ptl_agreement pa ON pa.id = pc.ptl_agreement_id
-                LEFT JOIN ptl_agreement_undwrt_rules pr ON pr.id = pc.cover_rule_id AND pr.agreement_id = pc.ptl_agreement_id
+                LEFT JOIN ptl_agreement pa ON pa.id = pc.ptl_agreement_id and pa.is_delete = 0
+                LEFT JOIN ptl_agreement_undwrt_rules pr ON pr.id = pc.cover_rule_id AND pr.agreement_id = pc.ptl_agreement_id and pr.is_delete = 0
         <where>
-            pc.is_delete = 0 and pa.is_delete = 0 and pr.is_delete = 0
+            pc.is_delete = 0
             <if test="costParam.agreement != null and costParam.agreement != ''">
                 AND (pa.agreement_title  like concat('%',#{costParam.agreement},'%') or
                      pa.agreement_code  like concat('%',#{costParam.agreement},'%') or
-                     pa.agreement_abbreviation  like concat('%',#{costParam.agreement},'%'))
+                     pa.agreement_abbreviation  like concat('%',#{costParam.agreement},'%') or
+                     pa.id = #{costParam.agreement})
             </if>
             <if test="costParam.productId != null and costParam.productId != ''">
                 AND pc.product_id = #{costParam.productId}