Explorar el Código

Merge remote-tracking branch 'origin/master'

hxl13994548489 hace 1 año
padre
commit
d8dc57d44f
Se han modificado 39 ficheros con 2043 adiciones y 8 borrados
  1. 6 0
      commons/src/main/java/com/jzg/commons/core/base/BaseModel.java
  2. 5 0
      commons/src/main/java/com/jzg/commons/entity/dto/InsOrdersParam.java
  3. 18 0
      commons/src/main/java/com/jzg/commons/entity/dto/OrderAdjustAddParam.java
  4. 39 0
      commons/src/main/java/com/jzg/commons/entity/dto/OrderAdjustExportParam.java
  5. 39 0
      commons/src/main/java/com/jzg/commons/entity/dto/OrderAdjustParam.java
  6. 3 0
      commons/src/main/java/com/jzg/commons/entity/dto/OrdersTrackParam.java
  7. 18 0
      commons/src/main/java/com/jzg/commons/entity/dto/VerifyAdjustParam.java
  8. 77 0
      commons/src/main/java/com/jzg/commons/entity/orders/po/InsOrderAdjust.java
  9. 63 0
      commons/src/main/java/com/jzg/commons/entity/orders/po/InsOrderAdjustInfo.java
  10. 2 1
      commons/src/main/java/com/jzg/commons/entity/orders/po/InsOrdersKind.java
  11. 9 0
      commons/src/main/java/com/jzg/commons/entity/orders/vo/OrderListVo.java
  12. 2 0
      commons/src/main/java/com/jzg/commons/entity/po/SysUserJzgInfo.java
  13. 44 0
      commons/src/main/java/com/jzg/commons/entity/quote/vo/aggregated/QuoteEchoVo.java
  14. 3 0
      commons/src/main/java/com/jzg/commons/entity/quote/vo/orders/InsOrdersVo.java
  15. 67 0
      commons/src/main/java/com/jzg/commons/entity/vo/AdjustAllRefundInfoVo.java
  16. 29 0
      commons/src/main/java/com/jzg/commons/entity/vo/AdjustAllRefundVo.java
  17. 18 0
      commons/src/main/java/com/jzg/commons/entity/vo/OrderAdjustInfoVo.java
  18. 94 0
      commons/src/main/java/com/jzg/commons/entity/vo/OrderAdjustVo.java
  19. 2 0
      commons/src/main/java/com/jzg/commons/entity/vo/SysDeptVo.java
  20. 1 1
      gateway/src/main/resources/application-dev.yml
  21. 109 5
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/OrderOperationLogAspect.java
  22. 4 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/constants/QuoteNumberConstant.java
  23. 195 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/InsOrderAdjustController.java
  24. 18 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/mapper/InsOrderAdjustInfoMapper.java
  25. 48 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/mapper/InsOrderAdjustMapper.java
  26. 54 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/InsOrderAdjustInfoService.java
  27. 70 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/InsOrderAdjustService.java
  28. 561 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrderAdjustInfoServiceImpl.java
  29. 187 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrderAdjustServiceImpl.java
  30. 22 0
      tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersServiceImpl.java
  31. 36 0
      tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrderAdjustInfoMapper.xml
  32. 116 0
      tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrderAdjustMapper.xml
  33. 44 1
      tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrdersMapper.xml
  34. 3 0
      tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrdersTrackMapper.xml
  35. 6 0
      tenant/organization/src/main/java/com/jzg/organization/controller/SchemeController.java
  36. 3 0
      tenant/organization/src/main/java/com/jzg/organization/mapper/InsBusinessInsuranceMapper.java
  37. 2 0
      tenant/organization/src/main/java/com/jzg/organization/service/PtlSchemeService.java
  38. 5 0
      tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java
  39. 21 0
      tenant/organization/src/main/resources/mapper/InsBusinessInsuranceMapper.xml

+ 6 - 0
commons/src/main/java/com/jzg/commons/core/base/BaseModel.java

@@ -1,5 +1,6 @@
 package com.jzg.commons.core.base;
 
+import com.alibaba.excel.annotation.ExcelIgnore;
 import com.baomidou.mybatisplus.annotation.FieldFill;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
@@ -13,23 +14,28 @@ import java.time.LocalDateTime;
 @Data
 public class BaseModel implements Serializable {
 
+    @ExcelIgnore
     @Schema(description = "是否删除")
     @TableLogic
     private Integer isDelete;
 
+    @ExcelIgnore
     @Schema(description = "创建人")
     @TableField(fill = FieldFill.INSERT)
     private String createBy;
 
+    @ExcelIgnore
     @Schema(description = "创建时间")
     @TableField(fill = FieldFill.INSERT)
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime createTime;
 
+    @ExcelIgnore
     @Schema(description = "修改人")
     @TableField(fill = FieldFill.INSERT_UPDATE)
     private String updateBy;
 
+    @ExcelIgnore
     @Schema(description = "修改时间")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @TableField(fill = FieldFill.INSERT_UPDATE)

+ 5 - 0
commons/src/main/java/com/jzg/commons/entity/dto/InsOrdersParam.java

@@ -40,4 +40,9 @@ public class InsOrdersParam extends PageRequest {
 
     @Schema(description = "录单时间结束")
     private String endDate;
+
+    @Schema(description = "批改状态")
+    private String adjustStatus;
+
+
 }

+ 18 - 0
commons/src/main/java/com/jzg/commons/entity/dto/OrderAdjustAddParam.java

@@ -0,0 +1,18 @@
+package com.jzg.commons.entity.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import jakarta.validation.constraints.NotNull;
+import lombok.Data;
+
+@Schema(description = "订单批改新增dto")
+@Data
+public class OrderAdjustAddParam {
+
+    @Schema(description = "订单号")
+    @NotNull(message = "订单号不能为空")
+    private String orderNo;
+
+    @NotNull(message = "批改类型不能为空")
+    @Schema(description = "批改类型 0.整单退保 1.险种批改")
+    private Integer type;
+}

+ 39 - 0
commons/src/main/java/com/jzg/commons/entity/dto/OrderAdjustExportParam.java

@@ -0,0 +1,39 @@
+package com.jzg.commons.entity.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jzg.commons.core.base.PageRequest;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "订单批改查询dto")
+@Data
+public class OrderAdjustExportParam {
+
+    @Schema(description = "订单号")
+    private Long orderNo;
+
+    @Schema(description = "车牌")
+    private String licenseNo;
+
+    @Schema(description = "保司id")
+    private String companyId;
+
+    @Schema(description = "业务员信息")
+    private String salesman;
+
+    @Schema(description = "批单状态 0.订单批改中 1.待审核 2.审核通过 3.退回修改 4.拒绝批改")
+    private Integer status;
+
+    @Schema(description = "批改类型 0.整单退保 1.险种批改")
+    private Integer type;
+
+    @Schema(description = "批改开始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime startDate;
+
+    @Schema(description = "批改结束时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime endDate;
+}

+ 39 - 0
commons/src/main/java/com/jzg/commons/entity/dto/OrderAdjustParam.java

@@ -0,0 +1,39 @@
+package com.jzg.commons.entity.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jzg.commons.core.base.PageRequest;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Schema(description = "订单批改分页查询dto")
+@Data
+public class OrderAdjustParam extends PageRequest {
+
+    @Schema(description = "订单号")
+    private Long orderNo;
+
+    @Schema(description = "车牌")
+    private String licenseNo;
+
+    @Schema(description = "保司id")
+    private String companyId;
+
+    @Schema(description = "业务员信息")
+    private String salesman;
+
+    @Schema(description = "批单状态 0.订单批改中 1.待审核 2.审核通过 3.退回修改 4.拒绝批改")
+    private Integer status;
+
+    @Schema(description = "批改类型 0.整单退保 1.险种批改")
+    private Integer type;
+
+    @Schema(description = "批改开始时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime startDate;
+
+    @Schema(description = "批改结束时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime endDate;
+}

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

@@ -10,4 +10,7 @@ public class OrdersTrackParam {
 
     @Schema(description = "订单号")
     private String orderNo;
+
+    @Schema(description = "模块")
+    private String module;
 }

+ 18 - 0
commons/src/main/java/com/jzg/commons/entity/dto/VerifyAdjustParam.java

@@ -0,0 +1,18 @@
+package com.jzg.commons.entity.dto;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+@Schema(description = "审核批改订单dto")
+@Data
+public class VerifyAdjustParam {
+
+    @Schema(description = "id")
+    private String id;
+
+    @Schema(description = "费用审核状态 2.审核通过 3.退回修改 4.拒绝批改")
+    private Integer status;
+
+    @Schema(description = "退回修改/拒绝修改原因")
+    private String refuse;
+}

+ 77 - 0
commons/src/main/java/com/jzg/commons/entity/orders/po/InsOrderAdjust.java

@@ -0,0 +1,77 @@
+package com.jzg.commons.entity.orders.po;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.jzg.commons.core.base.BaseModel;
+import com.jzg.commons.entity.quote.vo.aggregated.QuoteEchoVo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 订单批改表
+ * @TableName ins_order_adjust
+ */
+@Data
+@Schema(description = "订单批改表")
+public class InsOrderAdjust extends BaseModel {
+
+    @Schema(description = "主键ID")
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
+    private String id;
+
+    @Schema(description = "订单号")
+    private String orderNo;
+
+    @Schema(description = "车牌")
+    private String licenseNo;
+
+    @Schema(description = "产品ID")
+    private String productId;
+
+    @Schema(description = "产品名称")
+    private String productName;
+
+    @Schema(description = "保司id")
+    private String companyId;
+
+    @Schema(description = "保司名称")
+    private String companyName;
+
+    @Schema(description = "批单状态 0.订单批改中 1.待审核 2.审核通过 3.退回修改 4.拒绝批改")
+    private Integer status;
+
+    @Schema(description = "批改类型 0.整单退保 1.险种批改")
+    private Integer type;
+
+    @Schema(description = "保费")
+    private BigDecimal premium;
+
+    @Schema(description = "批改后保费")
+    private BigDecimal afterPremium;
+
+    @Schema(description = "批改后交强保费")
+    private BigDecimal afterJqPremium;
+
+    @Schema(description = "批改后商业保费")
+    private BigDecimal afterSyPremium;
+
+    @Schema(description = "批改后驾意保费")
+    private BigDecimal afterJyPremium;
+
+    @Schema(description = "拒绝/退回原因")
+    private String refuse;
+
+    @TableField(exist = false)
+    @Schema(description = "批改明细")
+    private List<InsOrderAdjustInfo> adjustInfoList;
+
+
+
+
+}

+ 63 - 0
commons/src/main/java/com/jzg/commons/entity/orders/po/InsOrderAdjustInfo.java

@@ -0,0 +1,63 @@
+package com.jzg.commons.entity.orders.po;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.jzg.commons.core.base.BaseModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+/**
+ * 订单批改明细表
+ * @TableName ins_order_adjust_info
+ */
+@Data
+@Schema(description = "订单批改明细表")
+public class InsOrderAdjustInfo extends BaseModel {
+
+    @Schema(description = "主键ID")
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
+    private String id;
+
+    @Schema(description = "批改表id")
+    private String adjustId;
+
+    @Schema(description = "险种类型 0. 交强 1.商业 2.非车")
+    private Integer kindType;
+
+    @Schema(description = "险种code")
+    private String kindCode;
+
+    @Schema(description = "险种名称")
+    private String kindName;
+
+    @Schema(description = "金额或数量")
+    private BigDecimal amount;
+
+    @Schema(description = "调整后金额或数量")
+    private BigDecimal afterAmount;
+
+    @Schema(description = "保费")
+    private BigDecimal premium;
+
+    @Schema(description = "批改类型 0.未批改 1.保额批改 2.退保 3.批增")
+    private Integer type;
+
+    @Schema(description = "调整类型 0. 补缴 1.退款")
+    private Integer adjustType;
+
+    @Schema(description = "调整金额")
+    private BigDecimal adjustAmount;
+
+    @Schema(description = "批改后的保费")
+    private BigDecimal AfterPremium;
+
+    @Schema(description = "是否隐藏 0.否 1.是")
+    private Integer isHide;
+
+
+}

+ 2 - 1
commons/src/main/java/com/jzg/commons/entity/orders/po/InsOrdersKind.java

@@ -4,6 +4,7 @@ package com.jzg.commons.entity.orders.po;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.jzg.commons.aop.aspect.DiffProperty;
+import com.jzg.commons.core.base.BaseModel;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
 
@@ -11,7 +12,7 @@ import java.math.BigDecimal;
 
 @Data
 @Schema(description = "保险订单险种信息")
-public class InsOrdersKind {
+public class InsOrdersKind extends BaseModel {
 
     @TableId(type = IdType.ASSIGN_ID)
     private String id;

+ 9 - 0
commons/src/main/java/com/jzg/commons/entity/orders/vo/OrderListVo.java

@@ -99,4 +99,13 @@ public class OrderListVo {
 
     //支付链接
     private String paymentLink;
+
+    //批改状态
+    private String adjustStatus;
+
+    //批改id
+    private String adjustId;
+
+    //批改后的保费
+    private String adjustPremium;
 }

+ 2 - 0
commons/src/main/java/com/jzg/commons/entity/po/SysUserJzgInfo.java

@@ -325,6 +325,8 @@ public class SysUserJzgInfo extends BaseModel implements Serializable {
     @Schema(description = "身份证有效期止期")
     private String identityTimeEnd;
 
+    private String isDistribution;
+
     public SysUserJzgInfo(String userName, SysUser user, String systemCode, String deptId){
         this.userId = user.getId();
         //默认添加管理员账户

+ 44 - 0
commons/src/main/java/com/jzg/commons/entity/quote/vo/aggregated/QuoteEchoVo.java

@@ -1,6 +1,10 @@
 package com.jzg.commons.entity.quote.vo.aggregated;
 
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.jzg.commons.entity.orders.po.InsOrderAdjust;
+import com.jzg.commons.entity.orders.po.InsOrderAdjustInfo;
 import com.jzg.commons.entity.orders.po.InsOrdersQrcode;
 import com.jzg.commons.entity.po.EsmInsCompany;
 import com.jzg.commons.entity.po.InsCompanyClause;
@@ -20,6 +24,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.NoArgsConstructor;
+import org.springframework.beans.BeanUtils;
 
 import java.io.Serial;
 import java.math.BigDecimal;
@@ -217,6 +222,38 @@ public class QuoteEchoVo extends QuoteVo {
     private List<InsCompanyClause> biSpecialInfoVo;
 
 
+    @Schema(description = "订单批改信息")
+    private InsOrderAdjustVo insOrderAdjustVo;
+
+    @Data
+    private static class InsOrderAdjustVo{
+
+        @Schema(description = "主键ID")
+        @TableId(value = "id", type = IdType.ASSIGN_ID)
+        private String id;
+
+        @Schema(description = "产品ID")
+        private String productId;
+
+        @Schema(description = "产品名称")
+        private String productName;
+
+        @Schema(description = "批单状态 0.订单批改中 1.待审核 2.审核通过 3.退回修改 4.拒绝批改")
+        private Integer status;
+
+        @Schema(description = "批改类型 0.整单退保 1.险种批改")
+        private Integer type;
+
+        @Schema(description = "保费")
+        private BigDecimal premium;
+
+        @Schema(description = "批改后保费")
+        private BigDecimal afterPremium;
+
+        @Schema(description = "批改明细")
+        private List<InsOrderAdjustInfo> adjustInfoList;
+    }
+
     /**
      * 订单数据库查询数据转 QuoteVo对象
      * @param insOrdersVo
@@ -260,6 +297,13 @@ public class QuoteEchoVo extends QuoteVo {
             insOrdersVo.getCarInfoVo().setTransferDate(insOrdersVo.getCarInfoVo().getTransferDate().substring(0, insOrdersVo.getCarInfoVo().getTransferDate().indexOf(" ")));
         }
 
+        // 批改信息处理
+        if(Objects.nonNull(insOrdersVo.getInsOrderAdjust())) {
+            InsOrderAdjustVo insOrderAdjustVo = new InsOrderAdjustVo();
+            BeanUtils.copyProperties(insOrdersVo.getInsOrderAdjust(), insOrderAdjustVo);
+            insOrderAdjustVo.setAdjustInfoList(insOrdersVo.getInsOrderAdjust().getAdjustInfoList());
+            this.insOrderAdjustVo = insOrderAdjustVo;
+        }
 
         //人员处理
         this.setOwnersInfo(insOrdersVo.getOwnersInfo());

+ 3 - 0
commons/src/main/java/com/jzg/commons/entity/quote/vo/orders/InsOrdersVo.java

@@ -112,6 +112,9 @@ public class InsOrdersVo extends QuoteVo {
     @Schema(description = "业务员信息")
     private Salesman salesmanInfo;
 
+    @Schema(description = "订单批改信息")
+    private InsOrderAdjust insOrderAdjust;
+
     @Data
     public static class Salesman{
         @Schema(description = "业务员姓名")

+ 67 - 0
commons/src/main/java/com/jzg/commons/entity/vo/AdjustAllRefundInfoVo.java

@@ -0,0 +1,67 @@
+package com.jzg.commons.entity.vo;
+
+import com.jzg.commons.entity.orders.po.InsOrdersPolicy;
+import com.jzg.commons.entity.orders.po.InsOrdersRisk;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Schema(description = "整单退明细VO")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class AdjustAllRefundInfoVo {
+
+    @Schema(description = "批改表id")
+    private String adjustId;
+
+    @NotNull(message = "保险类型不能为空")
+    @Schema(description = "保险类型 0. 交强 1.商业 3.非车")
+    private Integer kindType;
+
+    @Schema(description = "保险类型名称")
+    private String kindName;
+
+    @Schema(description = "保单号")
+    private String policyNumber;
+
+    @Schema(description = "终保日期")
+    private LocalDateTime expiryDate;
+
+    @NotNull(message = "保费不能为空")
+    @Schema(description = "保费")
+    private BigDecimal premium;
+
+    @NotNull(message = "退款金额不能为空")
+    @Schema(description = "退款金额")
+    private BigDecimal refundAmount;
+
+
+    public AdjustAllRefundInfoVo(Integer type, List<InsOrdersRisk> risks, InsOrdersPolicy policie, OrderAdjustVo orderAdjustVo,String id) {
+        this.adjustId = id;
+        if (type == 0){
+            this.kindType = 0;
+            this.kindName = "交强险";
+            this.policyNumber = policie.getJqPolicyNo();
+            this.expiryDate = risks.stream().filter(risk -> risk.getRiskCode().equals("0507")).findFirst().get().getEndDate();
+            this.premium = orderAdjustVo.getAfterJqPremium();
+        }else if (type == 1){
+            this.kindType = 1;
+            this.kindName = "商业险";
+            this.policyNumber = policie.getSyPolicyNo();
+            this.expiryDate = risks.stream().filter(risk -> risk.getRiskCode().equals("0510")).findFirst().get().getEndDate();
+            this.premium = orderAdjustVo.getAfterSyPremium();
+        }else if (type == 2){
+            this.kindType = 2;
+            this.kindName = "驾意险";
+            this.policyNumber = policie.getJyPolicyNo();
+            this.premium = orderAdjustVo.getAfterJyPremium();
+        }
+    }
+}

+ 29 - 0
commons/src/main/java/com/jzg/commons/entity/vo/AdjustAllRefundVo.java

@@ -0,0 +1,29 @@
+package com.jzg.commons.entity.vo;
+
+import com.jzg.commons.entity.orders.po.InsOrderAdjustInfo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@Schema(description = "整单退VO")
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class AdjustAllRefundVo {
+
+    @Schema(description = "主键")
+    private String id;
+
+    @Schema(description = "订单号")
+    private String orderNo;
+
+    @Schema(description = "整单退明细VO")
+    private List<AdjustAllRefundInfoVo> infoVosList;
+
+    @Schema(description = "批改明细VO")
+    private List<InsOrderAdjustInfo> changeInfoVosList;
+
+}

+ 18 - 0
commons/src/main/java/com/jzg/commons/entity/vo/OrderAdjustInfoVo.java

@@ -0,0 +1,18 @@
+package com.jzg.commons.entity.vo;
+
+import com.jzg.commons.entity.orders.po.InsOrderAdjustInfo;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.util.List;
+
+@Schema(description = "订单批改明细表VO")
+@Data
+public class OrderAdjustInfoVo {
+
+    @Schema(description = "订单批改信息")
+    private OrderAdjustVo orderAdjustVo;
+
+    @Schema(description = "订单批改明细信息")
+    private List<InsOrderAdjustInfo> adjustInfos;
+}

+ 94 - 0
commons/src/main/java/com/jzg/commons/entity/vo/OrderAdjustVo.java

@@ -0,0 +1,94 @@
+package com.jzg.commons.entity.vo;
+
+import com.alibaba.excel.annotation.ExcelIgnore;
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jzg.commons.core.base.BaseModel;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+@Schema(description = "订单批改表VO")
+@Data
+public class OrderAdjustVo extends BaseModel {
+
+    @ExcelProperty("ID")
+    @Schema(description = "主键")
+    private String id;
+
+    @ExcelProperty("订单号")
+    @Schema(description = "订单号")
+    private String orderNo;
+
+    @ExcelProperty("车牌")
+    @Schema(description = "车牌")
+    private String licenseNo;
+
+    @ExcelIgnore
+    @Schema(description = "保司id")
+    private String companyId;
+
+    @ExcelProperty("保险公司")
+    @Schema(description = "保司名称")
+    private String companyName;
+
+    @ExcelProperty("保费")
+    @Schema(description = "保费")
+    private BigDecimal premium;
+
+    @ExcelIgnore
+    @Schema(description = "批单状态 0.订单批改中 1.待审核 2.审核通过 3.退回修改 4.拒绝批改")
+    private Integer status;
+
+    @ExcelProperty("批单状态")
+    @Schema(description = "批单状态 0.订单批改中 1.待审核 2.审核通过 3.退回修改 4.拒绝批改")
+    private String statusStr;
+
+    @ExcelIgnore
+    @Schema(description = "批改类型 0.整单退保 1.险种批改")
+    private Integer type;
+
+    @ExcelProperty("批改类型")
+    @Schema(description = "批改类型 0.整单退保 1.险种批改")
+    private String typeStr;
+
+    @ExcelProperty("保费变化")
+    @Schema(description = "保费变化")
+    private BigDecimal changePremium;
+
+    @ExcelProperty("批改后保费")
+    @Schema(description = "批改后保费")
+    private BigDecimal afterPremium;
+
+
+    @ExcelIgnore
+    @Schema(description = "批改后交强保费")
+    private BigDecimal afterJqPremium;
+
+    @ExcelIgnore
+    @Schema(description = "批改后商业保费")
+    private BigDecimal afterSyPremium;
+
+    @ExcelIgnore
+    @Schema(description = "批改后驾意保费")
+    private BigDecimal afterJyPremium;
+
+    @ExcelProperty("批改人")
+    @Schema(description = "创建人")
+    private String createBy;
+
+    @ExcelProperty("批改时间")
+    @Schema(description = "创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime createTime;
+
+//    @Schema(description = "退款金额")
+//    private BigDecimal subAmount;
+//
+//    @Schema(description = "补缴金额")
+//    private BigDecimal addAmount;
+}

+ 2 - 0
commons/src/main/java/com/jzg/commons/entity/vo/SysDeptVo.java

@@ -85,6 +85,8 @@ public class SysDeptVo implements Serializable {
     @Schema(description = "是否参与分销 0-否 1-是")
     private String isDistribution;
 
+    private String isDistribution;
+
     public SysDeptVo(){}
 
     public SysDeptVo(SysDept sysDept){

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

@@ -38,7 +38,7 @@ spring:
         - id: summary_route
           uri: http://localhost:9898/
           predicates:
-            - Path= /order/identify/** ,/supplementOrder/**,/order/carModel/**,/unify/**,/order/taskImages/**,/order/qrCode/**,/orderTrack/**,/feeAudit/**
+            - Path= /order/identify/** ,/supplementOrder/**,/order/carModel/**,/unify/**,/order/taskImages/**,/order/qrCode/**,/orderTrack/**,/feeAudit/**,/adjust/**
 
         - id: costsorrule_route
           uri: http://localhost:8085/

+ 109 - 5
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/OrderOperationLogAspect.java

@@ -3,15 +3,19 @@ package com.jzg.quotation.summary.aop;
 import com.alibaba.fastjson2.JSON;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.jzg.commons.constants.dict.InsOrderStatusEnum;
+import com.jzg.commons.entity.dto.VerifyAdjustParam;
+import com.jzg.commons.entity.orders.po.InsOrderAdjust;
 import com.jzg.commons.entity.orders.po.InsOrders;
 import com.jzg.commons.entity.orders.po.InsOrdersCarInfo;
 import com.jzg.commons.entity.orders.po.InsOrdersTrack;
 import com.jzg.commons.entity.quote.vo.QuoteVo;
 import com.jzg.commons.entity.quote.vo.aggregated.*;
+import com.jzg.commons.entity.vo.AdjustAllRefundVo;
 import com.jzg.commons.exception.SystemException;
 import com.jzg.quotation.commons.constant.SpElMapping;
 import com.jzg.quotation.commons.utils.SpElFieldExtractor;
 import com.jzg.quotation.summary.constants.QuoteNumberConstant;
+import com.jzg.quotation.summary.service.InsOrderAdjustService;
 import com.jzg.quotation.summary.service.InsOrdersCarInfoService;
 import com.jzg.quotation.summary.service.InsOrdersService;
 import com.jzg.quotation.summary.service.InsOrdersTrackService;
@@ -49,6 +53,9 @@ public class OrderOperationLogAspect {
     @Autowired
     private SpElFieldExtractor fieldExtractor;
 
+    @Autowired
+    private InsOrderAdjustService insOrderAdjustService;
+
     @Around("@annotation(log)")
     public Object handleLog(ProceedingJoinPoint joinPoint, OrderOperationLog log) throws Throwable {
         // 获取方法信息和参数
@@ -113,11 +120,108 @@ public class OrderOperationLogAspect {
                 InsOrders after = loadAfterState(orderStatusVo.getOrder().getOrdersNo()); // 可选:新状态
                 this.getOrderStatusLog(orderStatusVo.getOrder().getOrdersNo(),before,after,result,log);
                 break;
-
+            // 提交批改申请
+            case 11:
+                // 通过 SpEL 提取 入参
+                AdjustAllRefundVo adjustAllRefundVo = parser.parseExpression(log.orderSpEl()).getValue(context, AdjustAllRefundVo.class);
+                result = joinPoint.proceed();
+                this.adjustSubmitLog(adjustAllRefundVo.getOrderNo(),result,log);
+                break;
+            // 审核批改申请
+            case 12:
+                // 通过 SpEL 提取 入参
+                VerifyAdjustParam param = parser.parseExpression(log.orderSpEl()).getValue(context, VerifyAdjustParam.class);
+                result = joinPoint.proceed();
+                this.adjustVerifyLog(param,result,log);
+                break;
+            // 撤销批改申请
+            case 13:
+                // 通过 SpEL 提取 入参
+                String orderNo = parser.parseExpression(log.orderSpEl()).getValue(context, String.class);
+                result = joinPoint.proceed();
+                this.adjustSubmitLog(orderNo,result,log);
+                break;
         }
         return result;
     }
 
+    /**
+     * 审核批改订单
+     * @param param
+     * @param result
+     * @param log
+     */
+    private void adjustVerifyLog(VerifyAdjustParam param, Object result, OrderOperationLog log) {
+
+        // 定义要提取的字段
+        List<SpElMapping> mappings = List.of(
+                new SpElMapping("msg", "#ret.msg"),
+                new SpElMapping("code", "#ret.code"),
+                new SpElMapping("data", "#ret.data")
+        );
+        // 执行提取
+        Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
+        InsOrderAdjust adjust = insOrderAdjustService.getById(param.getId());
+        InsOrdersTrack track = new InsOrdersTrack();
+        track.setOrderNo(adjust.getOrderNo());
+        track.setModule(log.module());
+        track.setSubModule(log.subModule());
+        track.setOptType(log.optType().getCode());
+        track.setOptContent(log.description());
+        track.setCompanyId(adjust.getCompanyId());
+        track.setLicenseNo(adjust.getLicenseNo());
+        if(extracted.get("code").equals(200)){
+            if(param.getStatus().equals(2)){
+                track.setChangeAfter("批改已完成");
+                track.setOptContent("订单批改申请审核通过");
+            }else if(param.getStatus().equals(3)){
+                track.setChangeAfter("退回修改");
+                track.setOptContent("退回订单批改申请");
+                track.setResult(param.getRefuse());
+            }else if(param.getStatus().equals(4)){
+                track.setChangeAfter("拒绝批改");
+                track.setOptContent("拒绝订单批改申请");
+                track.setResult(param.getRefuse());
+            }
+            track.setStatus(QuoteNumberConstant.QuoteResult.SUCCESS.getCode());
+            traceService.save(track);
+        }
+
+    }
+
+    /**
+     * 提交/撤销批改订单
+     * @param orderNo
+     * @param result
+     * @param log
+     */
+    private void adjustSubmitLog(String orderNo, Object result, OrderOperationLog log) {
+
+        // 定义要提取的字段
+        List<SpElMapping> mappings = List.of(
+                new SpElMapping("msg", "#ret.msg"),
+                new SpElMapping("code", "#ret.code"),
+                new SpElMapping("data", "#ret.data")
+        );
+        // 执行提取
+        Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
+        InsOrders insOrders = orderService.getById(orderNo);
+        InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
+        InsOrdersTrack track = new InsOrdersTrack();
+        track.setOrderNo(orderNo);
+        track.setModule(log.module());
+        track.setSubModule(log.subModule());
+        track.setOptType(log.optType().getCode());
+        track.setOptContent(log.description());
+        track.setCompanyId(insOrders.getCompanyId());
+        track.setLicenseNo(carInfo.getLicenseNo());
+
+        if(extracted.get("code").equals(200)){
+            track.setStatus(QuoteNumberConstant.QuoteResult.SUCCESS.getCode());
+            traceService.save(track);
+        }
+    }
+
     /**
      * 更新订单状态日志
      * @param orderId
@@ -136,7 +240,7 @@ public class OrderOperationLogAspect {
         // 执行提取
         Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(orderId);
-        if(extracted.get("code").equals("200")){
+        if(extracted.get("code").equals(200)){
             if(!before.getOrderStatus().equals(after.getOrderStatus())){
                 InsOrdersTrack track = new InsOrdersTrack();
                 track.setOrderNo(orderId);
@@ -181,7 +285,7 @@ public class OrderOperationLogAspect {
         track.setOptContent(log.description());
         track.setCompanyId(insOrders.getCompanyId());
         track.setLicenseNo(carInfo.getLicenseNo());
-        if(extracted.get("code").equals("200")){
+        if(extracted.get("code").equals(200)){
             track.setStatus(QuoteNumberConstant.QuoteResult.SUCCESS.getCode());
             track.setChangeBefore("电子保单未下载");
             track.setChangeAfter("电子保单已下载");
@@ -213,7 +317,7 @@ public class OrderOperationLogAspect {
         Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
         InsOrders insOrders = orderService.getById(orderId);
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
-        if(extracted.get("code").equals("200")){
+        if(extracted.get("code").equals(200)){
             InsOrdersTrack track = new InsOrdersTrack();
             track.setOrderNo(orderId);
             track.setModule(log.module());
@@ -255,7 +359,7 @@ public class OrderOperationLogAspect {
         track.setLicenseNo(carInfo.getLicenseNo());
         track.setChangeBefore("待核保");
 
-        if(extracted.get("code").equals("200")){
+        if(extracted.get("code").equals(200)){
             track.setStatus(QuoteNumberConstant.QuoteResult.SUCCESS.getCode());
             track.setResult("核保通过");
             track.setChangeAfter(InsOrderStatusEnum.PAY_PENDING.getDesc());

+ 4 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/constants/QuoteNumberConstant.java

@@ -89,6 +89,10 @@ public class QuoteNumberConstant {
         OPT_TYPE_8(8,"下载电子保单"),
         OPT_TYPE_9(9,"同步订单"),
         OPT_TYPE_10(10,"订单编辑"),
+        OPT_TYPE_11(11,"提交批改申请"),
+        OPT_TYPE_12(12,"批改审核"),
+        OPT_TYPE_13(13,"撤销批改"),
+
         ;
         private Integer code;
         private String desc;

+ 195 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/controller/InsOrderAdjustController.java

@@ -0,0 +1,195 @@
+package com.jzg.quotation.summary.controller;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jzg.commons.constants.dict.InsOrderStatusEnum;
+import com.jzg.commons.core.base.BaseController;
+import com.jzg.commons.core.page.HttpResult;
+import com.jzg.commons.entity.dto.*;
+import com.jzg.commons.entity.orders.po.InsOrderAdjust;
+import com.jzg.commons.entity.orders.po.InsOrderAdjustInfo;
+import com.jzg.commons.entity.orders.po.InsOrders;
+import com.jzg.commons.entity.vo.AdjustAllRefundInfoVo;
+import com.jzg.commons.entity.vo.AdjustAllRefundVo;
+import com.jzg.commons.entity.vo.OrderAdjustVo;
+import com.jzg.commons.util.AssertionUtils;
+import com.jzg.commons.util.EasyExcelUtils;
+import com.jzg.commons.util.ServletUtils;
+import com.jzg.quotation.summary.aop.OrderOperationLog;
+import com.jzg.quotation.summary.constants.QuoteNumberConstant;
+import com.jzg.quotation.summary.service.InsOrderAdjustInfoService;
+import com.jzg.quotation.summary.service.InsOrderAdjustService;
+import com.jzg.quotation.summary.service.InsOrdersService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Objects;
+
+@Tag(name = "订单批改管理接口")
+@RestController
+@RequestMapping("/adjust")
+@RequiredArgsConstructor
+public class InsOrderAdjustController extends BaseController {
+
+    private final InsOrderAdjustService insOrderAdjustService;
+    private final InsOrderAdjustInfoService insOrderAdjustInfoService;
+    private final InsOrdersService insOrdersService;
+    /**
+     * 订单批改列表分页
+     * @return
+     */
+    @PostMapping("/adjustList")
+    @Operation(summary = "订单批改列表分页")
+    public HttpResult adjustList(@RequestBody OrderAdjustParam param){
+        Page<OrderAdjustVo> result = insOrderAdjustService.queryPage(param);
+        return HttpResult.ok(result);
+    }
+
+    /**
+     * 导出订单批改列表
+     * @return
+     */
+    @PostMapping("/exportAdjustList")
+    @Operation(summary = "导出订单批改列表")
+    public void exportAdjustList(@RequestBody OrderAdjustExportParam param){
+        List<OrderAdjustVo> orderAdjustVos = insOrderAdjustService.adjustList(param);
+        AssertionUtils.isFail(CollUtil.isEmpty(orderAdjustVos), "无导出数据");
+        EasyExcelUtils.exportForWeb(ServletUtils.getResponse(), OrderAdjustVo.class, orderAdjustVos,"订单批改导出");
+    }
+
+
+    /**
+     * 订单批改信息查询
+     * @param id
+     * @return
+     */
+    @GetMapping(value = { "/adjustGet"})
+    @Operation(summary = "订单批改信息查询")
+    public HttpResult adjustGet(String id) {
+        return HttpResult.ok(insOrderAdjustService.queryById(id));
+    }
+
+    /**
+     * 订单批改信息添加
+     * @param param
+     * @return
+     */
+    @Operation(summary = "订单批改信息添加")
+    @PostMapping("/adjustAdd")
+    public HttpResult adjustAdd(@Validated @RequestBody OrderAdjustAddParam param) {
+        String orderNo = param.getOrderNo();
+        InsOrders order = insOrdersService.getById(orderNo);
+        AssertionUtils.isFail(Objects.isNull(order), "订单不存在");
+        AssertionUtils.isFail(!InsOrderStatusEnum.UNDERWRITED.getCode().equals(order.getOrderStatus()), "未承保订单不允许批改");
+        LambdaQueryWrapper<InsOrderAdjust> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(InsOrderAdjust::getOrderNo, orderNo);
+        wrapper.eq(InsOrderAdjust::getIsDelete, 0);
+        wrapper.in(InsOrderAdjust::getStatus, 0,1,3);
+        long count = insOrderAdjustService.count(wrapper);
+        AssertionUtils.isFail(count > 0, "订单批改中,请勿重复操作!");
+        String id = insOrderAdjustService.adjustAdd(param,order);
+        // 整单退
+        if(param.getType().equals(0)){
+            AdjustAllRefundVo refundVo = insOrderAdjustInfoService.adjustAllRefundGet(id,orderNo);
+            return HttpResult.ok("新增成功",refundVo);
+        }else{
+            // 批改
+            AdjustAllRefundVo refundVo = insOrderAdjustInfoService.adjustChangeGet(id,orderNo);
+            return HttpResult.ok("新增成功",refundVo);
+        }
+    }
+
+    /**
+     * 订单批改信息清除
+     * @param orderNo
+     * @return
+     */
+    @OrderOperationLog(
+            module = "批改订单",
+            subModule = "订单详情",
+            optType = QuoteNumberConstant.QuoteOptType.OPT_TYPE_13,
+            description = "撤销了订单批改申请",
+            orderSpEl = "#orderNo",
+            feedbackSpEl = "#ret.code + ' - ' + #ret.msg+ ' - ' + #ret.data"
+    )
+    @Operation(summary = "订单批改信息清除")
+    @DeleteMapping("/adjustRemove")
+    public HttpResult adjustRemove(String orderNo) {
+        boolean b = insOrderAdjustService.adjustRemove(orderNo);
+        return HttpResult.ok(b ? "清除成功":"清除失败");
+    }
+
+    /**
+     * 订单批改删除(已退回单据)
+     * @param id
+     * @return
+     */
+    @Operation(summary = "订单批改删除(已退回单据)")
+    @DeleteMapping("/adjustDel")
+    public HttpResult adjustDel(String id) {
+        boolean b = insOrderAdjustService.adjustDel(id);
+        return HttpResult.ok(b ? "删除成功":"删除失败");
+    }
+
+    /**
+     * 整单退提交
+     * @return
+     */
+    @OrderOperationLog(
+            module = "批改订单",
+            subModule = "订单详情",
+            optType = QuoteNumberConstant.QuoteOptType.OPT_TYPE_11,
+            description = "提交订单批改申请",
+            orderSpEl = "#refundVo",
+            feedbackSpEl = "#ret.code + ' - ' + #ret.msg+ ' - ' + #ret.data"
+    )
+    @Operation(summary = "整单退提交")
+    @PostMapping("/refundSubmit")
+    public HttpResult refundSubmit(@Validated @RequestBody AdjustAllRefundVo refundVo) {
+        insOrderAdjustInfoService.refundSubmit(refundVo);
+        return HttpResult.ok("保存成功");
+    }
+
+    /**
+     * 批改提交
+     * @return
+     */
+    @OrderOperationLog(
+            module = "批改订单",
+            subModule = "订单详情",
+            optType = QuoteNumberConstant.QuoteOptType.OPT_TYPE_11,
+            description = "提交订单批改申请",
+            orderSpEl = "#refundVo",
+            feedbackSpEl = "#ret.code + ' - ' + #ret.msg+ ' - ' + #ret.data"
+    )
+    @Operation(summary = "批改提交")
+    @PostMapping("/changeSubmit")
+    public HttpResult changeSubmit(@Validated @RequestBody AdjustAllRefundVo refundVo) {
+        insOrderAdjustInfoService.changeSubmit(refundVo);
+        return HttpResult.ok("保存成功");
+    }
+
+    /**
+     * 审核批改订单
+     * @return
+     */
+    @OrderOperationLog(
+            module = "批改订单",
+            subModule = "订单详情",
+            optType = QuoteNumberConstant.QuoteOptType.OPT_TYPE_12,
+            description = "",
+            orderSpEl = "#param",
+            feedbackSpEl = "#ret.code + ' - ' + #ret.msg+ ' - ' + #ret.data"
+    )
+    @PostMapping("/verifyOrder")
+    @Operation(summary = "审核批改订单")
+    public HttpResult verifyOrder(@RequestBody VerifyAdjustParam param){
+        insOrderAdjustInfoService.verifyOrder(param);
+        return HttpResult.ok("操作成功");
+    }
+}

+ 18 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/mapper/InsOrderAdjustInfoMapper.java

@@ -0,0 +1,18 @@
+package com.jzg.quotation.summary.mapper;
+
+import com.jzg.commons.entity.orders.po.InsOrderAdjustInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author dongxin
+* @description 针对表【ins_order_adjust_info(订单批改明细表)】的数据库操作Mapper
+* @createDate 2025-09-16 10:48:13
+* @Entity generator.domain.InsOrderAdjustInfo
+*/
+public interface InsOrderAdjustInfoMapper extends BaseMapper<InsOrderAdjustInfo> {
+
+}
+
+
+
+

+ 48 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/mapper/InsOrderAdjustMapper.java

@@ -0,0 +1,48 @@
+package com.jzg.quotation.summary.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.jzg.commons.entity.dto.OrderAdjustExportParam;
+import com.jzg.commons.entity.dto.OrderAdjustParam;
+import com.jzg.commons.entity.orders.po.InsOrderAdjust;
+import com.jzg.commons.entity.vo.OrderAdjustVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+* @author dongxin
+* @description 针对表【ins_order_adjust(订单批改表)】的数据库操作Mapper
+* @createDate 2025-09-16 10:48:13
+* @Entity generator.domain.InsOrderAdjust
+*/
+public interface InsOrderAdjustMapper extends BaseMapper<InsOrderAdjust> {
+
+    /**
+     * 订单批改分页列表
+     * @param page
+     * @param param
+     * @return
+     */
+    Page<OrderAdjustVo> queryPage(Page page,  @Param("param") OrderAdjustParam param);
+
+    /**
+     * 订单批改列表
+     * @param param
+     * @return
+     */
+    List<OrderAdjustVo> adjustList(@Param("param") OrderAdjustExportParam param);
+
+    /**
+     * 通过id获取订单批改信息
+     * @param id
+     * @return
+     */
+    OrderAdjustVo queryById(String id);
+
+
+}
+
+
+
+

+ 54 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/InsOrderAdjustInfoService.java

@@ -0,0 +1,54 @@
+package com.jzg.quotation.summary.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.entity.dto.VerifyAdjustParam;
+import com.jzg.commons.entity.orders.po.InsOrderAdjustInfo;
+import com.jzg.commons.entity.vo.AdjustAllRefundInfoVo;
+import com.jzg.commons.entity.vo.AdjustAllRefundVo;
+
+import java.util.List;
+
+/**
+* @author dongxin
+* @description 针对表【ins_order_adjust_info(订单批改明细表)】的数据库操作Service
+* @createDate 2025-09-16 10:48:13
+*/
+public interface InsOrderAdjustInfoService extends IService<InsOrderAdjustInfo> {
+
+    /**
+     * 整单退明细列表
+     *
+     * @param id
+     * @param orderNo
+     * @return
+     */
+    AdjustAllRefundVo adjustAllRefundGet(String id, String orderNo);
+
+    /**
+     * 批改明细列表
+     * @param id
+     * @param orderNo
+     * @return
+     */
+    AdjustAllRefundVo adjustChangeGet(String id, String orderNo);
+
+    /**
+     * 整单退提交
+     *
+     * @param refundVos
+     */
+    void refundSubmit(AdjustAllRefundVo refundVos);
+
+
+    /**
+     * 批改提交
+     * @param refundVo
+     */
+    void changeSubmit(AdjustAllRefundVo refundVo);
+
+    /**
+     * 审核批改订单
+     * @param param
+     */
+    void verifyOrder(VerifyAdjustParam param);
+}

+ 70 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/InsOrderAdjustService.java

@@ -0,0 +1,70 @@
+package com.jzg.quotation.summary.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jzg.commons.entity.dto.OrderAdjustAddParam;
+import com.jzg.commons.entity.dto.OrderAdjustExportParam;
+import com.jzg.commons.entity.dto.OrderAdjustParam;
+import com.jzg.commons.entity.orders.po.InsOrderAdjust;
+import com.jzg.commons.entity.orders.po.InsOrders;
+import com.jzg.commons.entity.vo.OrderAdjustInfoVo;
+import com.jzg.commons.entity.vo.OrderAdjustVo;
+
+import java.util.List;
+
+/**
+* @author dongxin
+* @description 针对表【ins_order_adjust(订单批改表)】的数据库操作Service
+* @createDate 2025-09-16 10:48:13
+*/
+public interface InsOrderAdjustService extends IService<InsOrderAdjust> {
+
+    /**
+     * 订单批改分页列表
+     * @param param
+     * @return
+     */
+    Page<OrderAdjustVo> queryPage(OrderAdjustParam param);
+
+    /**
+     * 订单批改信息查询
+     * @param id
+     * @return
+     */
+    OrderAdjustInfoVo queryById(String id);
+
+    /**
+     * 查询订单批改信息是否存在
+     * @param id
+     * @return
+     */
+    OrderAdjustVo isExistById(String id);
+
+    /**
+     * 创建批单
+     *
+     * @param param
+     * @param order
+     */
+    String adjustAdd(OrderAdjustAddParam param, InsOrders order);
+
+    /**
+     * 订单批改信息清除
+     * @return
+     */
+    boolean adjustRemove(String orderNo);
+
+    /**
+     * 订单批改导出列表
+     * @param param
+     * @return
+     */
+    List<OrderAdjustVo> adjustList(OrderAdjustExportParam param);
+
+    /**
+     *
+     * @param id
+     * @return
+     */
+    boolean adjustDel(String id);
+}

+ 561 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrderAdjustInfoServiceImpl.java

@@ -0,0 +1,561 @@
+package com.jzg.quotation.summary.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.entity.dto.VerifyAdjustParam;
+import com.jzg.commons.entity.orders.po.*;
+import com.jzg.commons.entity.vo.AdjustAllRefundInfoVo;
+import com.jzg.commons.entity.vo.AdjustAllRefundVo;
+import com.jzg.commons.entity.vo.OrderAdjustInfoVo;
+import com.jzg.commons.entity.vo.OrderAdjustVo;
+import com.jzg.commons.util.AssertionUtils;
+import com.jzg.quotation.summary.mapper.InsOrderAdjustInfoMapper;
+import com.jzg.quotation.summary.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+* @author dongxin
+* @description 针对表【ins_order_adjust_info(订单批改明细表)】的数据库操作Service实现
+* @createDate 2025-09-16 10:48:13
+*/
+@Service
+public class InsOrderAdjustInfoServiceImpl extends ServiceImpl<InsOrderAdjustInfoMapper, InsOrderAdjustInfo>
+    implements InsOrderAdjustInfoService {
+
+    @Autowired
+    private InsOrderAdjustService orderAdjustService;
+
+    @Autowired
+    private InsOrdersRiskService ordersRiskService;
+
+    @Autowired
+    private InsOrdersPolicyService ordersPolicyService;
+
+    @Autowired
+    private InsOrdersCostsService ordersCostsService;
+
+    @Autowired
+    private InsOrdersKindService ordersKindService;
+
+    @Autowired
+    private InsOrdersAccidentalDrivingService ordersAccidentalDrivingService;
+
+    @Override
+    public AdjustAllRefundVo adjustAllRefundGet(String id, String orderNo) {
+
+        AdjustAllRefundVo adjustAllRefundVo = new AdjustAllRefundVo();
+        adjustAllRefundVo.setId(id);
+        List<AdjustAllRefundInfoVo> refundVos = new ArrayList<>();
+        // 获取最新的批改记录
+        LambdaQueryWrapper<InsOrderAdjust> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.ne(InsOrderAdjust::getId, id);
+        queryWrapper.eq(InsOrderAdjust::getOrderNo, orderNo);
+        queryWrapper.eq(InsOrderAdjust::getStatus, 2);
+        queryWrapper.eq(InsOrderAdjust::getIsDelete, 0);
+        queryWrapper.orderByDesc(InsOrderAdjust::getCreateTime).last("limit 1");;
+        InsOrderAdjust adjust = orderAdjustService.getOne(queryWrapper);
+
+        // 查询原订单信息
+        List<InsOrdersRisk> risks = ordersRiskService.getById(orderNo);
+        InsOrdersPolicy policie = ordersPolicyService.getById(orderNo);
+        InsOrdersCosts costs = ordersCostsService.getById(orderNo);
+
+        // 有批改
+        if(Objects.nonNull(adjust)){
+            OrderAdjustInfoVo orderAdjustInfoVo = orderAdjustService.queryById(adjust.getId());
+            List<InsOrderAdjustInfo> adjustInfos = orderAdjustInfoVo.getAdjustInfos();
+            if(CollUtil.isNotEmpty(adjustInfos)){
+                Set<Integer> types = adjustInfos.stream()
+                        .filter(info -> !info.getIsHide().equals(1))
+                        .filter(info -> !info.getType().equals(2))
+                        .map(InsOrderAdjustInfo::getKindType).collect(Collectors.toSet());
+                for (Integer type : types) {
+                    refundVos.add(new AdjustAllRefundInfoVo(type,risks,policie,orderAdjustInfoVo.getOrderAdjustVo(),id));
+                }
+            }
+        // 无批改
+        }else{
+            for (InsOrdersRisk risk : risks) {
+                AdjustAllRefundInfoVo refundVo = new AdjustAllRefundInfoVo();
+                refundVo.setAdjustId(id);
+                refundVo.setKindName(risk.getRiskName());
+                refundVo.setExpiryDate(risk.getEndDate());
+                if(risk.getRiskCode().equals("0507")){
+                    refundVo.setKindType(0);
+                    refundVo.setPolicyNumber(policie.getJqPolicyNo());
+                    refundVo.setPremium(costs.getJqPremium());
+                    refundVos.add(refundVo);
+                }else{
+                    refundVo.setKindType(1);
+                    refundVo.setPolicyNumber(policie.getSyPolicyNo());
+                    refundVo.setPremium(costs.getSyPremium());
+                    refundVos.add(refundVo);
+                }
+            }
+            LambdaQueryWrapper<InsOrdersAccidentalDriving> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(InsOrdersAccidentalDriving::getOrderNo, orderNo);
+            List<InsOrdersAccidentalDriving> drivings = ordersAccidentalDrivingService.list(wrapper);
+            if (CollUtil.isNotEmpty(drivings)) {
+                AdjustAllRefundInfoVo refundVo = new AdjustAllRefundInfoVo();
+                refundVo.setAdjustId(id);
+                refundVo.setKindType(2);
+                refundVo.setKindName("驾意险");
+                refundVo.setPolicyNumber(policie.getJyPolicyNo());
+                refundVo.setPremium(costs.getJyPremium());
+                refundVos.add(refundVo);
+            }
+        }
+        adjustAllRefundVo.setInfoVosList(refundVos);
+        return adjustAllRefundVo;
+    }
+
+    @Override
+    public AdjustAllRefundVo adjustChangeGet(String id, String orderNo) {
+        AdjustAllRefundVo adjustAllRefundVo = new AdjustAllRefundVo();
+        adjustAllRefundVo.setId(id);
+        // 获取最新的批改记录
+        LambdaQueryWrapper<InsOrderAdjust> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.ne(InsOrderAdjust::getId, id);
+        queryWrapper.eq(InsOrderAdjust::getOrderNo, orderNo);
+        queryWrapper.eq(InsOrderAdjust::getStatus, 2);
+        queryWrapper.eq(InsOrderAdjust::getIsDelete, 0);
+        queryWrapper.orderByDesc(InsOrderAdjust::getCreateTime).last("limit 1");;
+        InsOrderAdjust adjust = orderAdjustService.getOne(queryWrapper);
+
+        // 查询原订单信息
+        List<InsOrdersRisk> risks = ordersRiskService.getById(orderNo);
+        InsOrdersCosts costs = ordersCostsService.getById(orderNo);
+
+        // 有批改
+        if(Objects.nonNull(adjust)){
+            OrderAdjustInfoVo orderAdjustInfoVo = orderAdjustService.queryById(adjust.getId());
+            List<InsOrderAdjustInfo> adjustInfos = orderAdjustInfoVo.getAdjustInfos();
+            List<InsOrderAdjustInfo> newAdjustInfos = new ArrayList<>();
+            if (CollUtil.isNotEmpty(adjustInfos)) {
+                newAdjustInfos = adjustInfos.stream()
+                        .filter(info -> !info.getIsHide().equals(1))
+                        .filter(info -> !info.getType().equals(2))
+                        .collect(Collectors.toList());
+            }
+            for (InsOrderAdjustInfo newAdjustInfo : newAdjustInfos) {
+                newAdjustInfo.setId(null);
+                newAdjustInfo.setAdjustId(id);
+                newAdjustInfo.setPremium(newAdjustInfo.getAfterPremium());
+                newAdjustInfo.setAmount(newAdjustInfo.getAfterAmount());
+            }
+            adjustAllRefundVo.setChangeInfoVosList(newAdjustInfos);
+
+        }else{
+            // 无批改
+            List<InsOrderAdjustInfo> adjustInfos = new ArrayList<>();
+            for (InsOrdersRisk risk : risks) {
+                if(risk.getRiskCode().equals("0507")){
+                    InsOrderAdjustInfo orderAdjustInfo = new InsOrderAdjustInfo();
+                    orderAdjustInfo.setAdjustId(id);
+                    orderAdjustInfo.setKindType(0);
+                    orderAdjustInfo.setKindCode("J1");
+                    orderAdjustInfo.setKindName("交强险");
+                    orderAdjustInfo.setPremium(costs.getJqPremium());
+                    orderAdjustInfo.setType(0);
+                    orderAdjustInfo.setIsHide(0);
+                    adjustInfos.add(orderAdjustInfo);
+                }else{
+                    LambdaQueryWrapper<InsOrdersKind> wrapper = new LambdaQueryWrapper<>();
+                    wrapper.eq(InsOrdersKind::getOrderNo, orderNo);
+                    wrapper.eq(InsOrdersKind::getIsDelete, 0);
+                    List<InsOrdersKind> kindList = ordersKindService.list(wrapper);
+                    if(CollUtil.isNotEmpty(kindList)){
+                        for (InsOrdersKind insOrdersKind : kindList) {
+                            InsOrderAdjustInfo orderAdjustInfo = new InsOrderAdjustInfo();
+                            orderAdjustInfo.setAdjustId(id);
+                            orderAdjustInfo.setKindType(1);
+                            orderAdjustInfo.setKindCode(insOrdersKind.getKindCode());
+                            orderAdjustInfo.setKindName(insOrdersKind.getKindName());
+                            orderAdjustInfo.setAmount(insOrdersKind.getAmount());
+                            orderAdjustInfo.setPremium(insOrdersKind.getPremium());
+                            orderAdjustInfo.setType(0);
+                            orderAdjustInfo.setIsHide(0);
+                            adjustInfos.add(orderAdjustInfo);
+                        }
+                    }
+                }
+            }
+            LambdaQueryWrapper<InsOrdersAccidentalDriving> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(InsOrdersAccidentalDriving::getOrderNo, orderNo);
+            List<InsOrdersAccidentalDriving> drivings = ordersAccidentalDrivingService.list(wrapper);
+            if (CollUtil.isNotEmpty(drivings)) {
+                InsOrderAdjustInfo orderAdjustInfo = new InsOrderAdjustInfo();
+                orderAdjustInfo.setAdjustId(id);
+                orderAdjustInfo.setKindType(2);
+                orderAdjustInfo.setKindCode(drivings.get(0).getRiskCode());
+                orderAdjustInfo.setKindName(drivings.get(0).getRiskName());
+                orderAdjustInfo.setAmount(new BigDecimal(drivings.get(0).getQuantity()));
+                orderAdjustInfo.setPremium(costs.getJyPremium());
+                orderAdjustInfo.setType(0);
+                orderAdjustInfo.setIsHide(0);
+                adjustInfos.add(orderAdjustInfo);
+            }
+            adjustAllRefundVo.setChangeInfoVosList(adjustInfos);
+        }
+        return adjustAllRefundVo;
+    }
+
+    @Override
+    public void refundSubmit(AdjustAllRefundVo refundVos) {
+        // 获取最新的批改记录
+        LambdaQueryWrapper<InsOrderAdjust> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.ne(InsOrderAdjust::getId, refundVos.getId());
+        queryWrapper.eq(InsOrderAdjust::getOrderNo, refundVos.getOrderNo());
+        queryWrapper.eq(InsOrderAdjust::getIsDelete, 0);
+        queryWrapper.eq(InsOrderAdjust::getStatus, 2);
+        queryWrapper.orderByDesc(InsOrderAdjust::getCreateTime).last("limit 1");;
+        InsOrderAdjust adjust = orderAdjustService.getOne(queryWrapper);
+
+        List<InsOrderAdjustInfo> orderAdjustInfos = new ArrayList<>();
+        List<AdjustAllRefundInfoVo> infoVosList = refundVos.getInfoVosList();
+
+        List<AdjustAllRefundInfoVo> jqRefundVo = infoVosList.stream().filter(info-> info.getKindType().equals(0)).collect(Collectors.toList()); // 交强信息
+        List<AdjustAllRefundInfoVo> syRefundVo = infoVosList.stream().filter(info-> info.getKindType().equals(1)).collect(Collectors.toList()); // 商业信息
+        List<AdjustAllRefundInfoVo> jyRefundVo = infoVosList.stream().filter(info-> info.getKindType().equals(2)).collect(Collectors.toList()); // 驾意信息
+
+
+        // 当前单据(提前保存了)
+        InsOrderAdjust insOrderAdjust = orderAdjustService.getById(refundVos.getId());
+
+        BigDecimal jqPremium = new BigDecimal(0);
+        BigDecimal syPremium = new BigDecimal(0);
+        BigDecimal jyPremium = new BigDecimal(0);
+        if (Objects.nonNull(adjust)) {
+            OrderAdjustInfoVo orderAdjustInfoVo = orderAdjustService.queryById(adjust.getId());
+            List<InsOrderAdjustInfo> adjustInfos = orderAdjustInfoVo.getAdjustInfos();
+            OrderAdjustVo orderAdjustVo = orderAdjustInfoVo.getOrderAdjustVo();
+            jqPremium = orderAdjustVo.getAfterJqPremium();
+            syPremium = orderAdjustVo.getAfterSyPremium();
+            jyPremium = orderAdjustVo.getAfterJyPremium();
+
+            List<InsOrderAdjustInfo> jqInfos = adjustInfos.stream()
+                    .filter(info -> info.getKindType().equals(0))
+                    .filter(info -> !info.getType().equals(2))
+                    .collect(Collectors.toList());
+            List<InsOrderAdjustInfo> syInfos = adjustInfos.stream()
+                    .filter(info -> info.getKindType().equals(1))
+                    .filter(info -> !info.getType().equals(2))
+                    .collect(Collectors.toList());
+            List<InsOrderAdjustInfo> jyInfos = adjustInfos.stream()
+                    .filter(info -> info.getKindType().equals(2))
+                    .filter(info -> !info.getType().equals(2))
+                    .collect(Collectors.toList());
+
+            for (InsOrderAdjustInfo adjustInfo : adjustInfos) {
+                adjustInfo.setAdjustId(insOrderAdjust.getId());
+                adjustInfo.setPremium(adjustInfo.getAfterPremium());
+                if(adjustInfo.getType().equals(0)){
+                    adjustInfo.setAfterAmount(adjustInfo.getAmount());
+                }else{
+                    adjustInfo.setAfterAmount(null);
+                }
+                adjustInfo.setAdjustType(null);
+                adjustInfo.setAdjustAmount(null);
+                if(adjustInfo.getIsHide().equals(0)){
+                    if((CollUtil.isNotEmpty(jqRefundVo) && adjustInfo.getKindType().equals(0))
+                            || (CollUtil.isNotEmpty(syRefundVo) && adjustInfo.getKindType().equals(1))
+                            || (CollUtil.isNotEmpty(jyRefundVo) && adjustInfo.getKindType().equals(2))
+                    ){
+                        adjustInfo.setType(2);
+                        adjustInfo.setPremium(null);
+                        adjustInfo.setAfterPremium(null);
+                        adjustInfo.setAdjustType(null);
+                        adjustInfo.setAdjustAmount(null);
+                        adjustInfo.setIsHide(0);
+                        if (CollUtil.isNotEmpty(jqInfos)) {
+                            if(Objects.nonNull(jqInfos.get(0).getId())){
+                                if (jqInfos.get(0).getId().equals(adjustInfo.getId())) {
+                                    adjustInfo.setPremium(jqRefundVo.get(0).getPremium());
+                                    adjustInfo.setAfterPremium(jqRefundVo.get(0).getPremium().subtract(jqRefundVo.get(0).getRefundAmount()));
+                                }
+                            }
+                        }
+                        if (CollUtil.isNotEmpty(syInfos)) {
+                            if(Objects.nonNull(syInfos.get(0).getId())){
+                                if (syInfos.get(0).getId().equals(adjustInfo.getId())) {
+                                    adjustInfo.setPremium(syRefundVo.get(0).getPremium());
+                                    adjustInfo.setAfterPremium(syRefundVo.get(0).getPremium().subtract(syRefundVo.get(0).getRefundAmount()));
+                                }
+                            }
+                        }
+                        if (CollUtil.isNotEmpty(jyInfos)) {
+                            if(Objects.nonNull(jyInfos.get(0).getId())){
+                                if (jyInfos.get(0).getId().equals(adjustInfo.getId())) {
+                                    adjustInfo.setPremium(jyRefundVo.get(0).getPremium());
+                                    adjustInfo.setAfterPremium(jyRefundVo.get(0).getPremium().subtract(jyRefundVo.get(0).getRefundAmount()));
+                                }
+                            }
+                        }
+                    }else{
+                        adjustInfo.setIsHide(1);
+                    }
+                }
+                adjustInfo.setId(null);
+                orderAdjustInfos.add(adjustInfo);
+            }
+        } else {
+            // 查询原订单信息
+            List<InsOrdersRisk> risks = ordersRiskService.getById(refundVos.getOrderNo());
+            InsOrdersCosts costs = ordersCostsService.getById(refundVos.getOrderNo());
+            LambdaQueryWrapper<InsOrdersKind> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(InsOrdersKind::getOrderNo, refundVos.getOrderNo());
+            wrapper.eq(InsOrdersKind::getIsDelete, 0);
+            List<InsOrdersKind> kindList = ordersKindService.list(wrapper);
+
+            jqPremium = costs.getJqPremium();
+            syPremium = costs.getSyPremium();
+            jyPremium = costs.getJyPremium();
+
+            for (InsOrdersRisk risk : risks) {
+                if(risk.getRiskCode().equals("0507")){
+                    InsOrderAdjustInfo info = new InsOrderAdjustInfo();
+                    info.setAdjustId(insOrderAdjust.getId());
+                    info.setKindType(0);
+                    info.setKindCode("J1");
+                    info.setKindName("交强险");
+                    info.setIsHide(0);
+                    if(CollUtil.isNotEmpty(jqRefundVo)){
+                        info.setType(2);
+                        info.setPremium(null);
+                        info.setAfterPremium(null);
+                        info.setAfterAmount(null);
+                        info.setAdjustType(null);
+                    }else{
+                        info.setType(0);
+                        info.setPremium(costs.getJqPremium());
+                        info.setAfterPremium(costs.getJqPremium());
+                    }
+                    orderAdjustInfos.add(info);
+                }else{
+                    for (InsOrdersKind insOrdersKind : kindList) {
+                        InsOrderAdjustInfo info = new InsOrderAdjustInfo();
+                        info.setAdjustId(insOrderAdjust.getId());
+                        info.setKindType(1);
+                        info.setKindCode(insOrdersKind.getKindCode());
+                        info.setKindName(insOrdersKind.getKindName());
+                        info.setAmount(insOrdersKind.getAmount());
+                        info.setType(2);
+                        info.setIsHide(0);
+                        if(CollUtil.isNotEmpty(syRefundVo)){
+                            info.setPremium(null);
+                            info.setAfterPremium(null);
+                            info.setAfterAmount(null);
+                            info.setAdjustType(null);
+                        }else{
+                            info.setType(0);
+                            info.setPremium(insOrdersKind.getPremium());
+                            info.setAfterPremium(insOrdersKind.getPremium());
+                        }
+                        orderAdjustInfos.add(info);
+                    }
+                }
+            }
+            LambdaQueryWrapper<InsOrdersAccidentalDriving> drivingLambdaQueryWrapper = new LambdaQueryWrapper<>();
+            drivingLambdaQueryWrapper.eq(InsOrdersAccidentalDriving::getOrderNo, refundVos.getOrderNo());
+            List<InsOrdersAccidentalDriving> drivings = ordersAccidentalDrivingService.list(drivingLambdaQueryWrapper);
+            if (CollUtil.isNotEmpty(drivings)) {
+                InsOrderAdjustInfo info = new InsOrderAdjustInfo();
+                info.setAdjustId(insOrderAdjust.getId());
+                info.setKindType(2);
+                info.setKindCode(drivings.get(0).getRiskCode());
+                info.setKindName(drivings.get(0).getRiskName());
+                info.setAmount(new BigDecimal(drivings.get(0).getQuantity()));
+                info.setType(2);
+                info.setIsHide(0);
+                if(CollUtil.isNotEmpty(jyRefundVo)){
+                    info.setPremium(null);
+                    info.setAfterPremium(null);
+                    info.setAfterAmount(null);
+                    info.setAdjustType(null);
+                    info.setIsHide(1);
+                }else{
+                    info.setType(0);
+                    info.setPremium(costs.getJyPremium());
+                    info.setAfterPremium(costs.getJyPremium());
+                }
+                orderAdjustInfos.add(info);
+            }
+        }
+        this.checkProduct(orderAdjustInfos,insOrderAdjust);
+
+
+        if(CollUtil.isNotEmpty(jqRefundVo)){
+            jqPremium = jqPremium.subtract(jqRefundVo.get(0).getRefundAmount());
+        }
+        if(CollUtil.isNotEmpty(syRefundVo)){
+            syPremium = syPremium.subtract(syRefundVo.get(0).getRefundAmount());
+        }
+        if(CollUtil.isNotEmpty(jyRefundVo)){
+            jyPremium = jyPremium.subtract(jyRefundVo.get(0).getRefundAmount());
+        }
+
+        insOrderAdjust.setAfterJqPremium(jqPremium);
+        insOrderAdjust.setAfterSyPremium(syPremium);
+        insOrderAdjust.setAfterJyPremium(jyPremium);
+        insOrderAdjust.setAfterPremium(jqPremium.add(syPremium).add(jyPremium));
+        insOrderAdjust.setStatus(1);
+        orderAdjustService.updateById(insOrderAdjust);
+        this.saveBatch(orderAdjustInfos);
+    }
+
+    @Override
+    public void changeSubmit(AdjustAllRefundVo refundVo) {
+        List<InsOrderAdjustInfo> orderAdjustInfos = new ArrayList<>();
+        List<InsOrderAdjustInfo> changeInfoVosList = refundVo.getChangeInfoVosList();
+
+        // 获取之前的批改单 加入退保剩余金额
+        // 获取最新的批改记录
+        LambdaQueryWrapper<InsOrderAdjust> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.ne(InsOrderAdjust::getId, refundVo.getId());
+        queryWrapper.eq(InsOrderAdjust::getOrderNo, refundVo.getOrderNo());
+        queryWrapper.eq(InsOrderAdjust::getIsDelete, 0);
+        queryWrapper.eq(InsOrderAdjust::getStatus, 2);
+        queryWrapper.orderByDesc(InsOrderAdjust::getCreateTime).last("limit 1");
+        List<InsOrderAdjust> adjusts = orderAdjustService.list(queryWrapper);
+
+        // 当前单据(提前保存了)
+        InsOrderAdjust insOrderAdjust = orderAdjustService.getById(refundVo.getId());
+        if(CollUtil.isNotEmpty(changeInfoVosList)){
+            for (InsOrderAdjustInfo info : changeInfoVosList) {
+                info.setId(null);
+                info.setAdjustId(insOrderAdjust.getId());
+                if(Objects.nonNull(info.getAdjustType())){
+                    if (info.getAdjustType().equals(0)){
+                        info.setAfterPremium(info.getPremium().add(info.getAdjustAmount()));
+                    }else{
+                        info.setAfterPremium(info.getPremium().subtract(info.getAdjustAmount()));
+                    }
+                }else{
+                    info.setAfterPremium(info.getPremium());
+                    info.setAfterAmount(info.getAmount());
+                }
+                info.setIsHide(0);
+            }
+            orderAdjustInfos = changeInfoVosList;
+        }
+
+        // 将上一单的退单追加进去
+        if(CollUtil.isNotEmpty(adjusts)){
+            InsOrderAdjust adjust = adjusts.get(0);
+            OrderAdjustInfoVo orderAdjustInfoVo = orderAdjustService.queryById(adjust.getId());
+            List<InsOrderAdjustInfo> adjustInfos = orderAdjustInfoVo.getAdjustInfos();
+            if(CollUtil.isNotEmpty(adjustInfos)){
+                for (InsOrderAdjustInfo adjustInfo : adjustInfos) {
+                    if(adjustInfo.getType().equals(2)){
+                        adjustInfo.setId(null);
+                        adjustInfo.setAdjustId(insOrderAdjust.getId());
+                        adjustInfo.setIsHide(1);
+                        orderAdjustInfos.add(adjustInfo);
+                    }
+                }
+            }
+        }
+
+        this.checkProduct(orderAdjustInfos,insOrderAdjust);
+
+        BigDecimal jqPrenium = new BigDecimal(0); // 交强保费
+        BigDecimal syPrenium = new BigDecimal(0); // 商业保费
+        BigDecimal jyPrenium = new BigDecimal(0); // 驾意保费
+
+
+        for (InsOrderAdjustInfo orderAdjustInfo : orderAdjustInfos) {
+            if(orderAdjustInfo.getKindType().equals(0)){
+                jqPrenium = jqPrenium.add(orderAdjustInfo.getAfterPremium());
+            }
+            if(orderAdjustInfo.getKindType().equals(1)){
+                syPrenium = syPrenium.add(orderAdjustInfo.getAfterPremium());
+            }
+            if(orderAdjustInfo.getKindType().equals(2)){
+                jyPrenium = jyPrenium.add(orderAdjustInfo.getAfterPremium());
+            }
+        }
+        insOrderAdjust.setAfterJqPremium(jqPrenium);
+        insOrderAdjust.setAfterSyPremium(syPrenium);
+        insOrderAdjust.setAfterJyPremium(jyPrenium);
+        BigDecimal totalPremium = jqPrenium.add(syPrenium).add(jyPrenium);
+        insOrderAdjust.setAfterPremium(totalPremium);
+        insOrderAdjust.setStatus(1);
+        orderAdjustService.updateById(insOrderAdjust);
+        this.saveBatch(changeInfoVosList);
+    }
+
+    @Override
+    public void verifyOrder(VerifyAdjustParam param) {
+        InsOrderAdjust insOrderAdjust = orderAdjustService.getById(param.getId());
+        AssertionUtils.isFail(insOrderAdjust.getStatus() > 1, "订单已审核,请刷新页面");
+        insOrderAdjust.setStatus(param.getStatus());
+        insOrderAdjust.setRefuse(param.getRefuse());
+        orderAdjustService.updateById(insOrderAdjust);
+    }
+
+    /**
+     * 保险产品重新核算
+     *
+     * @param orderAdjustInfos
+     * @param insOrderAdjust
+     * @return
+     */
+    private void checkProduct(List<InsOrderAdjustInfo> orderAdjustInfos, InsOrderAdjust insOrderAdjust) {
+        Boolean jq = false;
+        Boolean sz = false;
+        Boolean sy = false;
+
+        List<InsOrderAdjustInfo> jqInfos = orderAdjustInfos.stream().filter(info -> info.getKindType().equals(0) && !info.getType().equals(2)).collect(Collectors.toList());
+        if(CollUtil.isNotEmpty(jqInfos)){
+            if (!jqInfos.get(0).getType().equals(2)){
+                jq = true;
+            }
+        }
+
+        List<InsOrderAdjustInfo> syInfos = orderAdjustInfos.stream().filter(info -> info.getKindType().equals(1) && !info.getType().equals(2)).collect(Collectors.toList());
+        if(CollUtil.isNotEmpty(syInfos)){
+            if(syInfos.size() > 1){
+                sy = true;
+            }else{
+                InsOrderAdjustInfo syInfo = syInfos.get(0);
+                if (syInfo.getKindName().equals("第三者责任险")){
+                    sz = true;
+                }else{
+                    sy = true;
+                }
+            }
+        }
+        if (jq && sy){ // 交商
+            insOrderAdjust.setProductId("0330034001");
+            insOrderAdjust.setProductName("交商");
+        } else if (jq && sz){ // 交三
+            insOrderAdjust.setProductId("0330034002");
+            insOrderAdjust.setProductName("交三");
+        } else if (jq){ // 单交
+            insOrderAdjust.setProductId("0330");
+            insOrderAdjust.setProductName("单交");
+        } else if (sy){ // 单商
+            insOrderAdjust.setProductId("034001");
+            insOrderAdjust.setProductName("单商");
+        } else if (sz){ // 单三
+            insOrderAdjust.setProductId("034002");
+            insOrderAdjust.setProductName("单三");
+        }else{
+            insOrderAdjust.setProductId(null);
+            insOrderAdjust.setProductName(null);
+        }
+    }
+}
+
+
+
+

+ 187 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrderAdjustServiceImpl.java

@@ -0,0 +1,187 @@
+package com.jzg.quotation.summary.service.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jzg.commons.entity.dto.OrderAdjustAddParam;
+import com.jzg.commons.entity.dto.OrderAdjustExportParam;
+import com.jzg.commons.entity.dto.OrderAdjustParam;
+import com.jzg.commons.entity.orders.po.*;
+import com.jzg.commons.entity.vo.OrderAdjustInfoVo;
+import com.jzg.commons.entity.vo.OrderAdjustVo;
+import com.jzg.commons.exception.SystemException;
+import com.jzg.commons.util.EasyExcelUtils;
+import com.jzg.commons.util.ServletUtils;
+import com.jzg.quotation.summary.mapper.InsOrderAdjustInfoMapper;
+import com.jzg.quotation.summary.mapper.InsOrderAdjustMapper;
+import com.jzg.quotation.summary.service.InsOrderAdjustService;
+import com.jzg.quotation.summary.service.InsOrdersCarInfoService;
+import com.jzg.quotation.summary.service.InsOrdersCostsService;
+import org.apache.commons.lang3.ObjectUtils;
+import org.checkerframework.checker.units.qual.C;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+* @author dongxin
+* @description 针对表【ins_order_adjust(订单批改表)】的数据库操作Service实现
+* @createDate 2025-09-16 10:48:13
+*/
+@Service
+public class InsOrderAdjustServiceImpl extends ServiceImpl<InsOrderAdjustMapper, InsOrderAdjust>
+    implements InsOrderAdjustService {
+
+    @Autowired
+    private InsOrderAdjustInfoMapper orderAdjustInfoMapper;
+
+    @Autowired
+    private InsOrdersCarInfoService ordersCarInfoService;
+
+    @Autowired
+    private InsOrdersCostsService ordersCostsService;
+
+    @Override
+    public Page<OrderAdjustVo> queryPage(OrderAdjustParam param) {
+        Page<OrderAdjustVo> page = baseMapper.queryPage(param.getPage(), param);
+        return page;
+    }
+
+    @Override
+    public List<OrderAdjustVo> adjustList(OrderAdjustExportParam param) {
+        List<OrderAdjustVo> adjustVoList = baseMapper.adjustList(param);
+        return adjustVoList;
+    }
+
+    @Override
+    public boolean adjustDel(String id) {
+        LambdaQueryWrapper<InsOrderAdjust> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(InsOrderAdjust::getId, id);
+        wrapper.eq(InsOrderAdjust::getIsDelete, 0);
+        wrapper.eq(InsOrderAdjust::getStatus, 3);
+        List<InsOrderAdjust> adjusts = this.list(wrapper);
+        if(CollUtil.isNotEmpty(adjusts)){
+            InsOrderAdjust adjust = adjusts.get(0);
+            LambdaQueryWrapper<InsOrderAdjustInfo> infoWrapper = new LambdaQueryWrapper<>();
+            infoWrapper.eq(InsOrderAdjustInfo::getAdjustId, adjust.getId());
+            infoWrapper.eq(InsOrderAdjustInfo::getIsDelete, 0);
+            List<InsOrderAdjustInfo> infos = orderAdjustInfoMapper.selectList(infoWrapper);
+            if(CollUtil.isNotEmpty(infos)){
+                orderAdjustInfoMapper.deleteByIds(infos);
+            }
+            return this.removeById(adjust.getId());
+        }else{
+            return false;
+        }
+    }
+
+
+    @Override
+    public OrderAdjustInfoVo queryById(String id) {
+        OrderAdjustVo orderAdjustVo = this.isExistById(id);
+        LambdaQueryWrapper<InsOrderAdjustInfo> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(InsOrderAdjustInfo::getAdjustId, orderAdjustVo.getId());
+        queryWrapper.eq(InsOrderAdjustInfo::getIsDelete, 0);
+        List<InsOrderAdjustInfo> adjustInfos = orderAdjustInfoMapper.selectList(queryWrapper);
+//        BigDecimal subAmount = new BigDecimal(0);
+//        BigDecimal addAmount = new BigDecimal(0);
+//        if(CollUtil.isNotEmpty(adjustInfos)) {
+//            for (InsOrderAdjustInfo adjustInfo : adjustInfos) {
+//                if(adjustInfo.getAdjustType().equals(0)){
+//                    addAmount.add(adjustInfo.getAdjustAmount());
+//                }else{
+//                    subAmount.add(adjustInfo.getAdjustAmount());
+//                }
+//            }
+//        }
+//        orderAdjustVo.setSubAmount(subAmount);
+//        orderAdjustVo.setAddAmount(addAmount);
+        OrderAdjustInfoVo orderAdjustInfoVo = new OrderAdjustInfoVo();
+        orderAdjustInfoVo.setOrderAdjustVo(orderAdjustVo);
+        orderAdjustInfoVo.setAdjustInfos(adjustInfos);
+        return orderAdjustInfoVo;
+    }
+
+    @Override
+    public OrderAdjustVo isExistById(String id) {
+        OrderAdjustVo orderAdjustVo = baseMapper.queryById(id);
+        if (ObjectUtils.isEmpty(orderAdjustVo)) {
+            throw new SystemException("订单批改信息不存在!");
+        }
+        return orderAdjustVo;
+    }
+
+    @Override
+    public String adjustAdd(OrderAdjustAddParam param, InsOrders order) {
+        // 获取订单车辆信息
+        InsOrdersCarInfo carInfo = ordersCarInfoService.getByOrderId(order.getId());
+
+        // 获取最新的订单批改
+        LambdaQueryWrapper<InsOrderAdjust> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(InsOrderAdjust::getOrderNo, param.getOrderNo());
+        wrapper.eq(InsOrderAdjust::getIsDelete, 0);
+        wrapper.eq(InsOrderAdjust::getStatus, 2);
+        wrapper.orderByDesc(InsOrderAdjust::getCreateTime);
+        List<InsOrderAdjust> adjusts = this.list(wrapper);
+
+        BigDecimal premium = new BigDecimal(0);
+        if (CollUtil.isNotEmpty(adjusts)) {
+            InsOrderAdjust adjust = adjusts.get(0);
+            premium = adjust.getAfterPremium();
+            InsOrderAdjust adjustNew = new InsOrderAdjust();
+            BeanUtils.copyProperties(adjust, adjustNew);
+            adjustNew.setId(null);
+            adjustNew.setStatus(0);
+            adjustNew.setType(param.getType());
+            adjustNew.setOrderNo(param.getOrderNo());
+            adjustNew.setPremium(premium);
+            adjustNew.setAfterPremium(null);
+            adjustNew.setAfterJqPremium(null);
+            adjustNew.setAfterSyPremium(null);
+            adjustNew.setAfterJyPremium(null);
+            this.save(adjustNew);
+            return adjustNew.getId();
+        }else{
+            InsOrdersCosts costs = ordersCostsService.getById(param.getOrderNo());
+            premium = costs.getSumPremium().subtract(costs.getTaxPremium());
+            InsOrderAdjust adjust = new InsOrderAdjust();
+            adjust.setOrderNo(param.getOrderNo());
+            adjust.setType(param.getType());
+            adjust.setCompanyId(order.getCompanyId());
+            adjust.setCompanyName(order.getCompanyName());
+            adjust.setStatus(0);
+            adjust.setLicenseNo(carInfo.getLicenseNo());
+            adjust.setPremium(premium);
+            adjust.setProductId(order.getProductId());
+            adjust.setProductName(order.getProductName());
+            this.save(adjust);
+            return adjust.getId();
+        }
+    }
+
+    @Override
+    public boolean adjustRemove(String orderNo) {
+        LambdaQueryWrapper<InsOrderAdjust> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(InsOrderAdjust::getOrderNo, orderNo);
+        wrapper.eq(InsOrderAdjust::getIsDelete, 0);
+        wrapper.eq(InsOrderAdjust::getStatus, 0);
+        wrapper.orderByDesc(InsOrderAdjust::getCreateTime);
+        List<InsOrderAdjust> adjusts = this.list(wrapper);
+        if(CollUtil.isNotEmpty(adjusts)){
+            InsOrderAdjust adjust = adjusts.get(0);
+            return this.removeById(adjust.getId());
+        }else{
+            return false;
+        }
+    }
+
+}
+
+
+
+

+ 22 - 0
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/service/impl/InsOrdersServiceImpl.java

@@ -102,6 +102,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
 
     private final BaseController baseController;
 
+    private final InsOrderAdjustInfoService orderAdjustInfoService;
+
     @Autowired
     @Lazy
     private InsFeeAuditService insFeeAuditService; // ✅ 改为字段注入 + 延迟加载
@@ -399,6 +401,15 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             insOrdersVo.getInsOrdersRiskList().forEach(riskInfo -> {
                 if (StringUtils.equals(riskInfo.getRiskCode(),"0507")){
                     insOrdersVo.setCiRiskInfoVo(getRiskInfoVo(riskInfo));
+                    List<KindInfoVo> kindInfoVos = insOrdersVo.getKindInfoVo();
+                    InsOrdersCosts insOrdersCosts = insOrdersVo.getInsOrdersCosts();
+                    KindInfoVo jqKind = new KindInfoVo();
+                    jqKind.setKindCode("J1");
+                    jqKind.setKindName("交强险");
+                    if(Objects.nonNull(insOrdersCosts.getJqPremium())){
+                        jqKind.setPremium(insOrdersCosts.getJqPremium().toString());
+                    }
+                    kindInfoVos.add(jqKind);
                 }else {
                     insOrdersVo.setBiRiskInfoVo(getRiskInfoVo(riskInfo));
                 }
@@ -420,6 +431,17 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             }
             insOrdersVo.setSpecialInfoVo(companyClauseList);
         }
+
+        // 批改明细查询
+        if (insOrdersVo.getInsOrderAdjust() !=  null) {
+            LambdaQueryWrapper<InsOrderAdjustInfo> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(InsOrderAdjustInfo::getAdjustId, insOrdersVo.getInsOrderAdjust().getId());
+            wrapper.eq(InsOrderAdjustInfo::getIsDelete, 0);
+            List<InsOrderAdjustInfo> infos = orderAdjustInfoService.list(wrapper);
+            if (CollectionUtil.isNotEmpty(infos)) {
+                insOrdersVo.getInsOrderAdjust().setAdjustInfoList(infos);
+            }
+        }
         insOrdersVo.setInsOrdersTax(insOrdersTaxService.getById(id));
         setInsOrdersExternalPolicy(insOrdersVo.getInsOrdersExternalPolicy());
         return insOrdersVo;

+ 36 - 0
tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrderAdjustInfoMapper.xml

@@ -0,0 +1,36 @@
+<?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.quotation.summary.mapper.InsOrderAdjustInfoMapper">
+
+<!--    <resultMap id="BaseResultMap" type="generator.domain.InsOrderAdjustInfo">-->
+<!--            <id property="id" column="id" jdbcType="VARCHAR"/>-->
+<!--            <result property="adjustId" column="adjust_id" jdbcType="VARCHAR"/>-->
+<!--            <result property="relatedId" column="related_id" jdbcType="VARCHAR"/>-->
+<!--            <result property="kindType" column="kind_type" jdbcType="TINYINT"/>-->
+<!--            <result property="kindCode" column="kind_code" jdbcType="VARCHAR"/>-->
+<!--            <result property="kindName" column="kind_name" jdbcType="VARCHAR"/>-->
+<!--            <result property="amount" column="amount" jdbcType="INTEGER"/>-->
+<!--            <result property="premium" column="premium" jdbcType="DECIMAL"/>-->
+<!--            <result property="quantity" column="quantity" jdbcType="INTEGER"/>-->
+<!--            <result property="type" column="type" jdbcType="TINYINT"/>-->
+<!--            <result property="adjustType" column="adjust_type" jdbcType="TINYINT"/>-->
+<!--            <result property="adjustQuantity" column="adjust_quantity" jdbcType="INTEGER"/>-->
+<!--            <result property="adjustAmount" column="adjust_amount" jdbcType="DECIMAL"/>-->
+<!--            <result property="isDelete" column="is_delete" jdbcType="TINYINT"/>-->
+<!--            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>-->
+<!--            <result property="createBy" column="create_by" jdbcType="VARCHAR"/>-->
+<!--            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>-->
+<!--            <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>-->
+<!--    </resultMap>-->
+
+    <sql id="Base_Column_List">
+        id,adjust_id,related_id,
+        kind_type,kind_code,kind_name,
+        amount,premium,quantity,
+        type,adjust_type,adjust_quantity,
+        adjust_amount,is_delete,create_time,
+        create_by,update_time,update_by
+    </sql>
+</mapper>

+ 116 - 0
tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrderAdjustMapper.xml

@@ -0,0 +1,116 @@
+<?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.quotation.summary.mapper.InsOrderAdjustMapper">
+
+<!--    <resultMap id="BaseResultMap" type="generator.domain.InsOrderAdjust">-->
+<!--            <id property="id" column="id" jdbcType="BIGINT"/>-->
+<!--            <result property="orderNo" column="order_no" jdbcType="BIGINT"/>-->
+<!--            <result property="licenseNo" column="license_no" jdbcType="VARCHAR"/>-->
+<!--            <result property="companyId" column="company_id" jdbcType="VARCHAR"/>-->
+<!--            <result property="companyName" column="company_name" jdbcType="VARCHAR"/>-->
+<!--            <result property="status" column="status" jdbcType="TINYINT"/>-->
+<!--            <result property="type" column="type" jdbcType="TINYINT"/>-->
+<!--            <result property="sumPremium" column="sum_premium" jdbcType="DECIMAL"/>-->
+<!--            <result property="isDelete" column="is_delete" jdbcType="TINYINT"/>-->
+<!--            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>-->
+<!--            <result property="createBy" column="create_by" jdbcType="VARCHAR"/>-->
+<!--            <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>-->
+<!--            <result property="updateBy" column="update_by" jdbcType="VARCHAR"/>-->
+<!--    </resultMap>-->
+
+    <sql id="Base_Column_List">
+        ioa.id,ioa.order_no as orderNo,ioa.license_no as licenseNo,
+        ioa.company_name as companyName,ioa.status,ioa.company_id as companyId,
+        ioa.type,ioa.after_premium as afterPremium,ioa.premium,
+        ioa.create_time as createTime,ioa.create_by AS createBy,ioa.update_time as updateTime,ioa.update_by AS updateBy,
+        ioa.after_jq_premium as afterJqPremium, ioa.after_sy_premium as afterSyPremium,
+        ioa.after_jy_premium as afterJyPremium
+    </sql>
+    <select id="queryPage" resultType="com.jzg.commons.entity.vo.OrderAdjustVo">
+        select <include refid="Base_Column_List"/>
+        FROM ins_order_adjust ioa
+        LEFT JOIN sys_user su on ioa.create_by = su.username
+        <where>
+            ioa.is_delete = 0
+            <if test="param.orderNo != null and param.orderNo != ''">
+                and ioa.order_no = #{param.orderNo}
+            </if>
+            <if test="param.licenseNo != null and param.licenseNo != ''">
+                and ioa.license_no = #{param.licenseNo}
+            </if>
+            <if test="param.companyId != null and param.companyId != ''">
+                and ioa.company_id = #{param.companyId}
+            </if>
+            <if test="param.salesman != null and param.salesman != ''">
+                and (su.username = #{param.salesman} or su.mobile = #{param.salesman})
+            </if>
+            <if test="param.status != null ">
+                and ioa.status = #{param.status}
+            </if>
+            <if test="param.type != null ">
+                and ioa.type = #{param.type}
+            </if>
+            <if test="param.startDate != null and param.endDate != null">
+                and DATE_FORMAT(ioa.create_time, '%Y-%m-%d') between #{param.startDate} AND #{param.endDate}
+            </if>
+        </where>
+        ORDER BY ioa.create_time DESC
+    </select>
+
+    <select id="adjustList" resultType="com.jzg.commons.entity.vo.OrderAdjustVo">
+        select <include refid="Base_Column_List"/>,ioa.after_premium - ioa.premium as changePremium,
+        CASE ioa.status
+        WHEN 0 THEN '订单批改中'
+        WHEN 1 THEN '待审核'
+        WHEN 2 THEN '审核通过'
+        WHEN 3 THEN '退回修改'
+        WHEN 4 THEN '拒绝批改'
+        ELSE '未知状态'
+        END AS statusStr,
+        CASE ioa.type
+        WHEN 0 THEN '整单退保'
+        WHEN 1 THEN '险种批改'
+        ELSE '未知类型'
+        END AS typeStr
+        FROM ins_order_adjust ioa
+        LEFT JOIN sys_user su on ioa.create_by = su.username
+        <where>
+            ioa.is_delete = 0
+            <if test="param.orderNo != null and param.orderNo != ''">
+                and ioa.order_no = #{param.orderNo}
+            </if>
+            <if test="param.licenseNo != null and param.licenseNo != ''">
+                and ioa.license_no = #{param.licenseNo}
+            </if>
+            <if test="param.companyId != null and param.companyId != ''">
+                and ioa.company_id = #{param.companyId}
+            </if>
+            <if test="param.salesman != null and param.salesman != ''">
+                and (su.username = #{param.salesman} or su.mobile = #{param.salesman})
+            </if>
+            <if test="param.status != null ">
+                and ioa.status = #{param.status}
+            </if>
+            <if test="param.type != null ">
+                and ioa.type = #{param.type}
+            </if>
+            <if test="param.startDate != null and param.endDate != null">
+                and DATE_FORMAT(ioa.create_time, '%Y-%m-%d') between #{param.startDate} AND #{param.endDate}
+            </if>
+        </where>
+        ORDER BY ioa.create_time DESC
+    </select>
+    <select id="queryById" resultType="com.jzg.commons.entity.vo.OrderAdjustVo">
+        select <include refid="Base_Column_List"/>
+        FROM ins_order_adjust ioa
+        <where>
+            ioa.is_delete = 0
+            <if test="id != null and id != ''">
+                and ioa.id = #{id}
+            </if>
+        </where>
+    </select>
+
+</mapper>

+ 44 - 1
tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrdersMapper.xml

@@ -149,6 +149,20 @@
         <result property="endDate" column="end_date" jdbcType="VARCHAR"/>
     </resultMap>
 
+    <!--订单 批改-->
+    <resultMap id="InsOrderAdjustMap" type="com.jzg.commons.entity.orders.po.InsOrderAdjust">
+        <id property="id" column="id" jdbcType="VARCHAR"/>
+        <result property="orderNo" column="order_no" jdbcType="VARCHAR"/>
+        <result property="licenseNo" column="license_no" jdbcType="VARCHAR"/>
+        <result property="companyId" column="company_id" jdbcType="VARCHAR"/>
+        <result property="companyName" column="company_name" jdbcType="VARCHAR"/>
+        <result property="productId" column="product_id" jdbcType="VARCHAR"/>
+        <result property="productName" column="product_name" jdbcType="VARCHAR"/>
+        <result property="status" column="status" jdbcType="VARCHAR"/>
+        <result property="type" column="type" jdbcType="VARCHAR"/>
+        <result property="premium" column="premium" jdbcType="VARCHAR"/>
+        <result property="afterPremium" column="after_premium" jdbcType="VARCHAR"/>
+    </resultMap>
 
     <!--订单 车船税-->
     <resultMap id="InsOrdersTaxMap" type="com.jzg.commons.entity.orders.po.InsOrdersTax">
@@ -188,6 +202,7 @@
         <association property="vehicleAndVesselTaxVo" column="{orderNo=id}" select="selectOrdersTaxMap" />
         <association property="imagesAdds" column="{orderNo=id}" select="selectImageByOrderNo" />
         <collection property="insOrdersRiskList"  column="{orderNo=id}" select="selectOrdersRisk" />
+        <collection property="insOrderAdjust"  column="{orderNo=id}" select="selectOrderAdjust" />
         <collection property="carUserInfoList"  column="{orderNo=id}"  select="selectCarUserInfo" />
         <collection property="kindInfoVo" column="{orderNo=id}" select="selectKindMap" />
         <collection property="insOrdersCosts" column="{orderNo=id}" select="selectOrdersCostsByOrderNo" />
@@ -329,6 +344,10 @@
         select id,order_no,risk_name,amount,commission_rate,premium,risk_code,no_tax_premium,commission_amount,start_date,end_date from  ins_orders_risk where order_no = #{orderNo}
     </select>
 
+    <select id="selectOrderAdjust" resultMap="InsOrderAdjustMap">
+        select id,order_no ,license_no ,company_id,product_id,product_name,company_name ,status,type,after_premium,premium from ins_order_adjust where order_no = #{orderNo} AND status in (1,2,3) AND is_delete = 0 order by create_time desc limit 1
+    </select>
+
     <select id="selectOrdersTax" resultMap="InsOrdersTaxMap">
         select order_no,extend_char2,tax_relief,relif_reason,tax_com_code,tax_com_name,tax_document_date,tax_paid_area_code,paid_free_certificate,taxpayer_name,taxpayer_identifier,identify_number,tax_relif_flag from  ins_orders_tax where order_no = #{orderNo}
     </select>
@@ -480,7 +499,10 @@
             suji.type_attr as salesmanType,
             pa.agreement_name as agreementName,
             sd.name as deptName,
-            io.pay_link as paymentLink
+            io.pay_link as paymentLink,
+            ioa.status as adjustStatus,
+            ioa.id as adjustId,
+            ioa1.after_premium as adjustPremium
         FROM
             ins_orders io
                 LEFT JOIN ins_orders_car_info ioci ON ioci.order_no = io.id
@@ -504,6 +526,24 @@
             sys_dept sd on sd.id = suji.dept_id
                 left join
             ptl_agreement pa on pa.id = io.agreement_id
+                left join
+            (
+                SELECT *
+                    FROM (
+                        SELECT t.*,
+                        ROW_NUMBER() OVER(PARTITION BY t.order_no ORDER BY t.create_time DESC) AS rn
+                        FROM ins_order_adjust t where t.is_delete = 0
+                    ) x WHERE x.rn = 1
+            ) ioa ON io.id = ioa.order_no
+                left join
+            (
+            SELECT *
+            FROM (
+                SELECT t.*,
+                ROW_NUMBER() OVER(PARTITION BY t.order_no ORDER BY t.create_time DESC) AS rn
+                FROM ins_order_adjust t where t.status = 2 and t.is_delete = 0
+            ) x WHERE x.rn = 1
+        ) ioa1 ON io.id = ioa1.order_no
         where
             1=1
         <if test="insOrdersParam.orderNo != null and insOrdersParam.orderNo != ''">
@@ -515,6 +555,9 @@
         <if test="insOrdersParam.orderStatus!= null and insOrdersParam.orderStatus!= ''">
             AND io.order_status = #{insOrdersParam.orderStatus}
         </if>
+        <if test="insOrdersParam.adjustStatus!= null and insOrdersParam.adjustStatus!= ''">
+            AND ioa.status = #{insOrdersParam.adjustStatus}
+        </if>
         <if test="insOrdersParam.salesman!= null">
             AND io.real_quote_user_id = #{insOrdersParam.salesman}
         </if>

+ 3 - 0
tenant/insurance/quotation-summary/src/main/resources/mapper/InsOrdersTrackMapper.xml

@@ -30,6 +30,9 @@
             <if test="param.orderNo != null and param.orderNo != ''">
                 and order_no = #{param.orderNo}
             </if>
+            <if test="param.module != null and param.module != ''">
+                and `module` = #{param.module}
+            </if>
         </where>
         order by create_time desc
     </select>

+ 6 - 0
tenant/organization/src/main/java/com/jzg/organization/controller/SchemeController.java

@@ -62,6 +62,12 @@ public class SchemeController {
         return HttpResult.ok(ptlSchemeService.getBusinessInsuranceList(productId));
     }
 
+    @Operation(summary = "获取商业险信息")
+    @GetMapping("/getBusinessInsuranceByKindType")
+    public HttpResult getBusinessInsuranceByKindType(String kindCode){
+        return HttpResult.ok(ptlSchemeService.getBusinessInsuranceListByKindType(kindCode));
+    }
+
     @Operation(summary = "获取保司列表,用于方案排序")
     @GetMapping("/getCompanyList")
     public HttpResult getCompanyList(String systemCode){

+ 3 - 0
tenant/organization/src/main/java/com/jzg/organization/mapper/InsBusinessInsuranceMapper.java

@@ -7,6 +7,7 @@ import com.jzg.commons.entity.scheme.po.InsBusinessInsuranceOption;
 import com.jzg.commons.entity.scheme.po.PtlSchemeInsurance;
 import com.jzg.commons.entity.scheme.vo.InsBusinessInsuranceVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -20,4 +21,6 @@ public interface InsBusinessInsuranceMapper extends BaseMapper<InsBusinessInsura
      * @return
      */
     public List<InsBusinessInsuranceOption> getBusinessInsuranceOptionList();
+
+    List<InsBusinessInsuranceVo> getBusinessInsuranceListByKindType(@Param("kindCode") String kindCode);
 }

+ 2 - 0
tenant/organization/src/main/java/com/jzg/organization/service/PtlSchemeService.java

@@ -83,4 +83,6 @@ public interface PtlSchemeService extends IService<PtlScheme> {
      * @return
      */
     public SchemeResultVo getSchemeResult(String companyId,String productId);
+
+    List<InsBusinessInsuranceVo> getBusinessInsuranceListByKindType(String kindCode);
 }

+ 5 - 0
tenant/organization/src/main/java/com/jzg/organization/service/impl/PtlSchemeServiceImpl.java

@@ -442,4 +442,9 @@ public class PtlSchemeServiceImpl extends ServiceImpl<PtlSchemeMapper, PtlScheme
 
         return schemeResultVo;
     }
+
+    @Override
+    public List<InsBusinessInsuranceVo> getBusinessInsuranceListByKindType(String kindCode) {
+        return insBusinessInsuranceMapper.getBusinessInsuranceListByKindType(kindCode);
+    }
 }

+ 21 - 0
tenant/organization/src/main/resources/mapper/InsBusinessInsuranceMapper.xml

@@ -49,4 +49,25 @@
     <select id="getBusinessInsuranceOptionList" resultType="com.jzg.commons.entity.scheme.po.InsBusinessInsuranceOption">
         select * from ins_business_insurance_option
     </select>
+    <select id="getBusinessInsuranceListByKindType" resultMap="SchemeResultVoMap">
+        SELECT
+        ibi.power_id,
+        ibi.kind_code,
+        ibi.kind_name,
+        ibi.alias,
+        ibi.grouping,
+        ibio.id,
+        ibio.business_id,
+        ibio.label,
+        ibio.`value`,
+        ibio.sort
+        FROM
+        ins_business_insurance ibi
+        LEFT JOIN ins_business_insurance_option ibio ON ibi.id = ibio.business_id
+        WHERE
+        1=1
+        <if test="kindCode != null and kindCode != ''">
+            AND ibi.kind_code = #{kindCode}
+        </if>
+    </select>
 </mapper>