Răsfoiți Sursa

权益包功能的开发

dongxin 1 an în urmă
părinte
comite
4c01f8c04b
44 a modificat fișierele cu 1939 adăugiri și 10 ștergeri
  1. 22 0
      sql/Online.sql
  2. 7 0
      src/main/java/com/ydtech/modules/admin/controller/SysSwitchConfigController.java
  3. 17 0
      src/main/java/com/ydtech/modules/equity/components/EquityApiConfigurationProperties.java
  4. 125 0
      src/main/java/com/ydtech/modules/equity/components/EquityRequestApiComponents.java
  5. 106 0
      src/main/java/com/ydtech/modules/equity/controller/EquityController.java
  6. 18 0
      src/main/java/com/ydtech/modules/equity/dao/InsAreaCompanyEquityMapper.java
  7. 103 0
      src/main/java/com/ydtech/modules/equity/model/InsAreaCompanyEquity.java
  8. 17 0
      src/main/java/com/ydtech/modules/equity/model/request/BaseRequest.java
  9. 23 0
      src/main/java/com/ydtech/modules/equity/model/request/ThreeOrderVo.java
  10. 21 0
      src/main/java/com/ydtech/modules/equity/model/request/ThreePointVo.java
  11. 54 0
      src/main/java/com/ydtech/modules/equity/model/request/ThreeRightsInfoPageVo.java
  12. 28 0
      src/main/java/com/ydtech/modules/equity/model/request/ThreeUserOrderListVo.java
  13. 231 0
      src/main/java/com/ydtech/modules/equity/model/request/ThreeUserOrderVo.java
  14. 24 0
      src/main/java/com/ydtech/modules/equity/model/response/BaseResponse.java
  15. 164 0
      src/main/java/com/ydtech/modules/equity/model/response/LocalEquityPackageAssociation.java
  16. 127 0
      src/main/java/com/ydtech/modules/equity/model/response/LocalEquityPackagePage.java
  17. 25 0
      src/main/java/com/ydtech/modules/equity/model/response/PageResultResponse.java
  18. 31 0
      src/main/java/com/ydtech/modules/equity/model/response/PointRatioDto.java
  19. 23 0
      src/main/java/com/ydtech/modules/equity/model/vo/AddEquityPageQueryVo.java
  20. 53 0
      src/main/java/com/ydtech/modules/equity/model/vo/EquityPackageVo.java
  21. 35 0
      src/main/java/com/ydtech/modules/equity/model/vo/EquityPageQueryVo.java
  22. 81 0
      src/main/java/com/ydtech/modules/equity/model/vo/EquitySaveVo.java
  23. 58 0
      src/main/java/com/ydtech/modules/equity/service/EquityService.java
  24. 13 0
      src/main/java/com/ydtech/modules/equity/service/InsAreaCompanyEquityService.java
  25. 300 0
      src/main/java/com/ydtech/modules/equity/service/impl/EquityServiceImpl.java
  26. 22 0
      src/main/java/com/ydtech/modules/equity/service/impl/InsAreaCompanyEquityServiceImpl.java
  27. 92 0
      src/main/java/com/ydtech/modules/equity/utils/SMCheckDataUtils.java
  28. 1 1
      src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java
  29. 6 0
      src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java
  30. 1 0
      src/main/java/com/ydtech/modules/order/components/dajia/DaJiaRequestApiComponents.java
  31. 6 0
      src/main/java/com/ydtech/modules/order/constants/InsuranceTypeCorrespondence.java
  32. 11 2
      src/main/java/com/ydtech/modules/order/controller/ExternalOrderController.java
  33. 6 0
      src/main/java/com/ydtech/modules/order/entity/InsOrders.java
  34. 5 0
      src/main/java/com/ydtech/modules/order/entity/dto/InsAreaCompanyQueryDto.java
  35. 3 0
      src/main/java/com/ydtech/modules/order/entity/vo/InsOrdersEditingVo.java
  36. 8 0
      src/main/java/com/ydtech/modules/order/entity/vo/OrderVo.java
  37. 1 1
      src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java
  38. 2 2
      src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java
  39. 45 0
      src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java
  40. 4 0
      src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementProductCostsNew.java
  41. 3 0
      src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCosts.java
  42. 3 0
      src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCostsSave.java
  43. 10 3
      src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml
  44. 4 1
      src/main/resources/mapper/modules/order/InsOrdersMapper.xml

+ 22 - 0
sql/Online.sql

@@ -9,3 +9,25 @@ INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `co
 INSERT INTO `agent`.`ins_driving_intention_insurance` ( `parent_id`, `type`, `company_id`, `project_name`, `project_code`, `alias`, `risk_code`, `seat_num`, `sum_amount`, `sum_premium`, `request_data`, `api_type`, `relate_code`) VALUES ( 0, 2, 'PICC1000000', '“如意行”非营运客车方案C款(升级版)(1至1年)', 'EAD0000041', NULL, NULL, NULL, 0.00, 0.00, NULL, 2, NULL);
 
 INSERT INTO `agent`.`ins_driving_intention_insurance_type_company` ( `company_id`, `type_id`, `is_multiple`, `is_enable`, `create_time`) VALUES ( 'PICC1000000', 2, 0, 1, '2025-04-17 16:29:17');
+
+
+
+ALTER TABLE `agent`.`ptl_agreement_product_costs_new`
+    ADD COLUMN `ld_proportion` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '代理人留点比例' AFTER `valid_status`;
+CREATE TABLE `ins_area_company_equity`  (
+                                            `sub_order_no` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '订单号',
+                                            `type` tinyint NULL DEFAULT NULL COMMENT '权益类型0.现金权益 1.权益包',
+                                            `status` tinyint NULL DEFAULT 0 COMMENT '0.未下单1.已下单2.已确认',
+                                            `equity_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权益包id',
+                                            `equity_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权益包名称',
+                                            `equity_info` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '权益包明细json',
+                                            `receive_type` tinyint NULL DEFAULT NULL COMMENT '接收人类型0.投保人 1.被保人 2.车主',
+                                            `receive_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收人名字',
+                                            `receive_phone` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收人电话',
+                                            `receive_identify` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '接收人身份证号',
+                                            `order_money` decimal(10, 2) NULL DEFAULT NULL COMMENT '返佣金额',
+                                            `point` decimal(10, 2) NULL DEFAULT NULL COMMENT '兑换积分',
+                                            PRIMARY KEY (`sub_order_no`) USING BTREE
+) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '订单权益包下单表' ROW_FORMAT = Dynamic;
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 7 - 0
src/main/java/com/ydtech/modules/admin/controller/SysSwitchConfigController.java

@@ -57,4 +57,11 @@ public class SysSwitchConfigController {
         return HttpResult.ok(display);
     }
 
+    @GetMapping("/isEnabled")
+    @ApiOperation(value = "开关是否开启")
+    public HttpResult<Boolean> isEnabled(String keyWord) {
+        boolean display = sysSwitchConfigService.isEnabled(keyWord);
+        return HttpResult.ok(display);
+    }
+
 }

+ 17 - 0
src/main/java/com/ydtech/modules/equity/components/EquityApiConfigurationProperties.java

@@ -0,0 +1,17 @@
+package com.ydtech.modules.equity.components;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+@Data
+@Component
+@ConfigurationProperties(prefix = "equity.api")
+public class EquityApiConfigurationProperties {
+
+    private String url;
+    private String appkey;
+    private String secret;
+    private String publicKey;
+    private String privateKey;
+}

+ 125 - 0
src/main/java/com/ydtech/modules/equity/components/EquityRequestApiComponents.java

@@ -0,0 +1,125 @@
+package com.ydtech.modules.equity.components;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.equity.model.request.*;
+import com.ydtech.modules.equity.model.response.BaseResponse;
+import com.ydtech.modules.equity.model.response.PageResultResponse;
+import com.ydtech.modules.equity.model.response.PointRatioDto;
+import com.ydtech.modules.equity.utils.SMCheckDataUtils;
+import com.ydtech.modules.order.utils.InsuranceLog;
+import com.ydtech.utils.HttpUtil;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.lang.Nullable;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 权益包接口
+ */
+@Slf4j
+@Component
+@RequiredArgsConstructor
+public class EquityRequestApiComponents {
+
+    private final EquityApiConfigurationProperties properties;
+
+    public <T extends BaseRequest, B extends BaseResponse> B post(String url, @Nullable T requestBody, Class<B> responseType) {
+
+        String busReqString = JSON.toJSONString(requestBody, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteNullStringAsEmpty);
+
+        InsuranceLog.infoLog("权益包接口", "\n\t---------> URl: {} \n\t---------> 请求参数:{}", url, busReqString);
+        String privateKeyHex = properties.getPrivateKey();
+        String publicKeyHex = properties.getPublicKey();
+        String scret = properties.getSecret();
+        //加签
+        String signStr = SMCheckDataUtils.sm2SignStr(busReqString,privateKeyHex,publicKeyHex);
+        //加密
+        String dataStr = SMCheckDataUtils.sm4EncryptStr(busReqString,scret);
+
+        HttpHeaders httpHeaders = new HttpHeaders();
+        httpHeaders.setContentType(MediaType.APPLICATION_JSON);
+        Map requetBean = new HashMap();
+        requetBean.put("appKey",properties.getAppkey());
+        requetBean.put("data",dataStr);
+        requetBean.put("sign",signStr);
+        String content = JSON.toJSONString(requetBean);
+        InsuranceLog.infoLog("权益包接口", "\n\t---------> URl: {} \n\t---------> 请求参数: {}", url, content);
+        String postStr = HttpUtil.sendPost(url, content);
+        // 解密参数
+        String decryptStr = SMCheckDataUtils.sm4DecryptStr(postStr,scret);
+        B res = JSON.parseObject(decryptStr).toJavaObject(responseType);
+        if(!"200".equals(res.code)){
+            throw new SystemException(res.message);
+        }
+        System.out.println(res.getResult());
+        return res;
+    }
+
+    public <T extends BaseRequest, B extends BaseResponse> B request(String url, String apiType, T requestBody, Class<B> responseType) {
+        String apiUrl = url + apiType;
+        return this.post(apiUrl, requestBody, responseType);
+    }
+
+
+    /**
+     * 权益包分页列表
+     * @param threeRightsInfoPageVo
+     * @return
+     */
+    public PageResultResponse equityPage(ThreeRightsInfoPageVo threeRightsInfoPageVo) {
+        PageResultResponse response = request(properties.getUrl(), "getPageRightInfoList",threeRightsInfoPageVo ,PageResultResponse.class);
+        PageResultResponse res = JSON.parseObject(response.getResult()).toJavaObject(PageResultResponse.class);
+        return res;
+    }
+
+//    /**
+//     * 权益包列表
+//     * @param threeUserOrderListVo
+//     * @return
+//     */
+//    public PageResultResponse equityList(ThreeUserOrderListVo threeUserOrderListVo) {
+//        return null;
+//    }
+//
+
+    /**
+     * 权益包下单
+     * @param threeUserOrderVo
+     * @return
+     */
+    public BaseResponse createOrder(ThreeUserOrderVo threeUserOrderVo) {
+        BaseResponse response = request(properties.getUrl(), "addThreeUserOrder"
+                ,threeUserOrderVo ,BaseResponse.class);
+        return response;
+    }
+
+    /**
+     * 权益包确认下单
+     * @param threeOrderVo
+     */
+    public BaseResponse confirmOrder(ThreeOrderVo threeOrderVo) {
+        BaseResponse response = request(properties.getUrl(), "updateThreeOrder"
+                ,threeOrderVo ,BaseResponse.class);
+        return response;
+    }
+
+    /**
+     * 获取积分兑换比例
+     * @param threePointVo
+     * @return
+     */
+    public PointRatioDto getPointRatio(ThreePointVo threePointVo) {
+        PointRatioDto response = request(properties.getUrl(), "getPointRatio"
+                ,threePointVo ,PointRatioDto.class);
+        PointRatioDto res = JSON.parseObject(response.getResult()).toJavaObject(PointRatioDto.class);
+        return res;
+    }
+}

+ 106 - 0
src/main/java/com/ydtech/modules/equity/controller/EquityController.java

@@ -0,0 +1,106 @@
+package com.ydtech.modules.equity.controller;
+
+import cn.dev33.satoken.annotation.SaIgnore;
+import com.ydtech.aop.request.RequestSingleParam;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.core.page.PageRequest;
+import com.ydtech.core.page.PageResult;
+import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.customer.entity.vo.ReturnMessageVo;
+import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
+import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
+import com.ydtech.modules.equity.model.vo.AddEquityPageQueryVo;
+import com.ydtech.modules.equity.model.vo.EquityPageQueryVo;
+import com.ydtech.modules.equity.model.vo.EquitySaveVo;
+import com.ydtech.modules.equity.service.EquityService;
+import com.ydtech.modules.order.entity.BasePageResult;
+import io.swagger.annotations.Api;
+import lombok.RequiredArgsConstructor;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+@Api(tags = "权益包功能", value = "权益包功能")
+@RequestMapping("/equity")
+@RestController
+@RequiredArgsConstructor
+public class EquityController  extends BaseController {
+
+    private final EquityService equityService;
+
+    /**
+     * 权益包分页列表
+     * @param pageQueryVo
+     * @return
+     */
+    @PostMapping("/equityInfo")
+    public HttpResult equityInfo(@Validated @RequestBody EquityPageQueryVo pageQueryVo) {
+        return HttpResult.ok(equityService.equityInfo(pageQueryVo));
+    }
+
+    /**
+     * 补录订单权益包分页列表
+     * @param pageQueryVo
+     * @return
+     */
+    @PostMapping("/addEquityInfo")
+    public HttpResult addEquityInfo(@Validated @RequestBody AddEquityPageQueryVo pageQueryVo) {
+        return HttpResult.ok(equityService.addEquityInfo(pageQueryVo));
+    }
+
+    /**
+     * 选择保存权益类型
+     * @return
+     */
+    @PostMapping("/saveEquityType")
+    public HttpResult saveEquityType(@RequestParam String companyId,@RequestParam Integer type) {
+        equityService.saveEquityType(companyId,type);
+        return HttpResult.ok();
+    }
+
+    /**
+     * 选择保存权益
+     * @param equitySaveVo
+     * @return
+     */
+    @PostMapping("/saveEquity")
+    public HttpResult saveEquity(@Validated @RequestBody EquitySaveVo equitySaveVo) {
+        equityService.saveEquity(equitySaveVo);
+        return HttpResult.ok();
+    }
+
+    /**
+     * 放弃选中权益
+     * @param companyId
+     * @return
+     */
+    @PostMapping("/delEquity")
+    public HttpResult delEquity(@RequestParam String companyId) {
+        equityService.delEquity(companyId);
+        return HttpResult.ok();
+    }
+
+    /**
+     * 权益包下单
+     * @param companyId
+     * @return
+     */
+    @PostMapping("/createEquityOrder")
+    public HttpResult createEquityOrder(@RequestParam String companyId) {
+        InsAreaCompanyEquity equity = equityService.createEquityOrder(companyId);
+        return HttpResult.ok(equity);
+    }
+
+    /**
+     * 权益包确认下单
+     * @param companyId
+     * @return
+     */
+    @PostMapping("/confirmEquityOrder")
+    public HttpResult confirmEquityOrder(@RequestParam String companyId) {
+        equityService.confirmEquityOrder(companyId);
+        return HttpResult.ok();
+    }
+
+
+}

+ 18 - 0
src/main/java/com/ydtech/modules/equity/dao/InsAreaCompanyEquityMapper.java

@@ -0,0 +1,18 @@
+package com.ydtech.modules.equity.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
+
+/**
+* @author dongxin
+* @description 针对表【ins_area_company_equity(订单权益包下单表)】的数据库操作Mapper
+* @createDate 2025-05-07 18:24:28
+* @Entity generator.domain.InsAreaCompanyEquity
+*/
+public interface InsAreaCompanyEquityMapper extends BaseMapper<InsAreaCompanyEquity> {
+
+}
+
+
+
+

+ 103 - 0
src/main/java/com/ydtech/modules/equity/model/InsAreaCompanyEquity.java

@@ -0,0 +1,103 @@
+package com.ydtech.modules.equity.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 订单权益包下单表
+ * @TableName ins_area_company_equity
+ */
+@TableName(value = "ins_area_company_equity")
+@Data
+public class InsAreaCompanyEquity implements Serializable {
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 订单号
+     */
+    @TableId(value = "sub_order_no")
+    private String subOrderNo;
+
+    /**
+     * 0.未下单1.已下单2.已确认
+     */
+    @TableField(value = "status")
+    private Integer status;
+
+    /**
+     * 权益包id
+     */
+    @TableField(value = "equity_id")
+    private String equityId;
+
+    /**
+     * 权益包名称
+     */
+    @TableField(value = "equity_name")
+    private String equityName;
+
+    /**
+     * 权益包明细json
+     */
+    @TableField(value = "equity_info")
+    private String equityInfo;
+
+    /**
+     * 接收人类型0.投保人 1.被保人 2.车主
+     */
+    @TableField(value = "receive_type")
+    private Integer receiveType;
+
+    /**
+     * 接收人名字
+     */
+    @TableField(value = "receive_name")
+    private String receiveName;
+
+    /**
+     * 接收人电话
+     */
+    @TableField(value = "receive_phone")
+    private String receivePhone;
+
+    /**
+     * 接收人身份证号
+     */
+    @TableField(value = "receive_identify")
+    private String receiveIdentify;
+
+    /**
+     * 返佣金额
+     */
+    @TableField(value = "order_money")
+    private BigDecimal orderMoney;
+
+    /**
+     * 兑换积分
+     */
+    @TableField(value = "point")
+    private BigDecimal point;
+
+    /**
+     * 权益类型0.现金权益 1.权益包
+     */
+    @TableField(value = "type")
+    private Integer type;
+
+    @TableField(exist = false)
+    private LocalEquityPackagePage equityInfoVo;
+
+
+}

+ 17 - 0
src/main/java/com/ydtech/modules/equity/model/request/BaseRequest.java

@@ -0,0 +1,17 @@
+package com.ydtech.modules.equity.model.request;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+@NoArgsConstructor
+@Data
+public class BaseRequest implements Serializable {
+
+    private static final long serialVersionUID = 01744654061707132550211L;
+
+    private String appKey;
+    private String data;
+    private String sign;
+}

+ 23 - 0
src/main/java/com/ydtech/modules/equity/model/request/ThreeOrderVo.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.equity.model.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class ThreeOrderVo extends BaseRequest {
+
+    @ApiModelProperty(value = "三方用戶Id")
+    @JsonProperty("threeUserId")
+    private String threeUserId;
+
+    @ApiModelProperty(value = "子订单Id")
+    @JsonProperty("orderId")
+    private String orderId;
+
+    public ThreeOrderVo(String appKey, String orderId) {
+        this.setAppKey(appKey);
+        this.setOrderId(orderId);
+    }
+
+}

+ 21 - 0
src/main/java/com/ydtech/modules/equity/model/request/ThreePointVo.java

@@ -0,0 +1,21 @@
+package com.ydtech.modules.equity.model.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/4/30 14:41
+ *  @Description:  积分比例
+ */
+@Data
+public class ThreePointVo extends BaseRequest {
+
+    @ApiModelProperty(value = "三方用户id")
+    @JsonProperty("threeUserId")
+    private String threeUserId;
+
+
+}

+ 54 - 0
src/main/java/com/ydtech/modules/equity/model/request/ThreeRightsInfoPageVo.java

@@ -0,0 +1,54 @@
+package com.ydtech.modules.equity.model.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.core.page.PageRequest;
+import com.ydtech.modules.equity.model.vo.AddEquityPageQueryVo;
+import com.ydtech.modules.equity.model.vo.EquityPageQueryVo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/4/30 14:45
+ *  @Description: 三方权益券
+ */
+@NoArgsConstructor
+@Data
+public class ThreeRightsInfoPageVo extends BaseRequest{
+
+    @ApiModelProperty(value = "三方用戶Id")
+    @JsonProperty("threeUserId")
+    private String threeUserId;
+
+    @ApiModelProperty(value = "页码")
+    @JsonProperty("pageNo")
+    private Integer pageNo;
+
+    @ApiModelProperty(value = "页数")
+    @JsonProperty("pageSize")
+    private Integer pageSize;
+
+    // 新增字段
+    @ApiModelProperty(value = "返佣金额")
+    @JsonProperty("orderMoney")
+    private BigDecimal orderMoney;
+
+
+    public ThreeRightsInfoPageVo(EquityPageQueryVo pageRequest, String threeUserId, BigDecimal orderMoney) {
+        this.pageNo = pageRequest.getPageNum();
+        this.pageSize = pageRequest.getPageSize();
+        this.threeUserId = threeUserId;
+        this.orderMoney = orderMoney;
+    }
+
+    public ThreeRightsInfoPageVo(AddEquityPageQueryVo pageRequest, String threeUserId, BigDecimal orderMoney) {
+        this.pageNo = pageRequest.getPageNum();
+        this.pageSize = pageRequest.getPageSize();
+        this.threeUserId = threeUserId;
+        this.orderMoney = orderMoney;
+    }
+}

+ 28 - 0
src/main/java/com/ydtech/modules/equity/model/request/ThreeUserOrderListVo.java

@@ -0,0 +1,28 @@
+package com.ydtech.modules.equity.model.request;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.equity.model.vo.EquityPageQueryVo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/4/30 14:41
+ *  @Description:  三方权益列表请求实体
+ */
+@NoArgsConstructor
+@Data
+public class ThreeUserOrderListVo extends BaseRequest {
+
+    @ApiModelProperty(value = "三方用戶Id")
+    @JsonProperty("threeUserId")
+    private String threeUserId;
+
+
+    public ThreeUserOrderListVo(String threeUserId){
+        this.threeUserId = threeUserId;
+    }
+}

+ 231 - 0
src/main/java/com/ydtech/modules/equity/model/request/ThreeUserOrderVo.java

@@ -0,0 +1,231 @@
+package com.ydtech.modules.equity.model.request;
+
+import com.alibaba.fastjson.JSON;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
+import com.ydtech.modules.equity.model.response.LocalEquityPackageAssociation;
+import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
+import com.ydtech.utils.StringUtils;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/4/30 14:41
+ *  @Description:  三方下单实体
+ */
+@Data
+public class ThreeUserOrderVo extends BaseRequest {
+
+
+    @ApiModelProperty(value = "子订单id")
+    @JsonProperty("orderId")
+    private String orderId;
+
+    @ApiModelProperty(value = "代客下单用户id")
+    @JsonProperty("orderUserId")
+    private String orderUserId;
+
+    @ApiModelProperty(value = "代客下单用户名称")
+    @JsonProperty("orderUserName")
+    private String orderUserName;
+
+    @ApiModelProperty(value = "代客下单类型 1.渠道 2.代理人 3.电销")
+    @JsonProperty("orderUserType")
+    private Integer orderUserType;
+
+    @ApiModelProperty(value = "代客下单手机号")
+    @JsonProperty("orderUserPhone")
+    private String orderUserPhone;
+
+    @ApiModelProperty(value = "代客下单身份证号")
+    @JsonProperty("orderUserIdcard")
+    private String orderUserIdcard;
+
+    @ApiModelProperty(value = "三方用户id")
+    @JsonProperty("threeUserId")
+    private String threeUserId;
+
+    @ApiModelProperty(value = "投保人姓名")
+    @JsonProperty("applyName")
+    private String applyName;
+
+    @ApiModelProperty(value = "投保人身份证号")
+    @JsonProperty("applyIdcard")
+    private String applyIdcard;
+
+    @ApiModelProperty(value = "投保人电话")
+    @JsonProperty("applyIdcard")
+    private String applyPhone;
+
+    @ApiModelProperty(value = "被保人姓名")
+    @JsonProperty("insureName")
+    private String insureName;
+
+    @ApiModelProperty(value = "被保人身份证号")
+    @JsonProperty("insureIdcard")
+    private String insureIdcard;
+
+    @ApiModelProperty(value = "被保人电话")
+    @JsonProperty("insurePhone")
+    private String insurePhone;
+
+    @ApiModelProperty(value = "车主姓名")
+    @JsonProperty("ownerName")
+    private String ownerName;
+
+    @ApiModelProperty(value = "车主身份证号")
+    @JsonProperty("ownerIdcard")
+    private String ownerIdcard;
+
+    @ApiModelProperty(value = "车主电话")
+    @JsonProperty("ownerPhone")
+    private String ownerPhone;
+
+    @ApiModelProperty(value = "返佣金额")
+    @JsonProperty("orderMoney")
+    private BigDecimal orderMoney;
+
+    @ApiModelProperty(value = "剩余金额(抵扣积分)")
+    @JsonProperty("surplusMoney")
+    private BigDecimal surplusMoney;
+
+    // 新增 字段
+    @ApiModelProperty(value = "人员类型(1.代理人 2. 投保人 3.被保人 4.车主)")
+    @JsonProperty("type")
+    private Integer type;
+
+    @ApiModelProperty(value = "权益卷列表")
+    @JsonProperty("rightsInfoVoList")
+    private List<ThreeRightsInfoVo>  rightsInfoVoList;
+    public ThreeUserOrderVo(String companyId, InsAreaCompanyEquity equity, String appkey, SysUser user) {
+        this.orderId = companyId;
+        this.threeUserId = appkey;
+        if(equity.getReceiveType().equals(0)){
+            this.applyName = equity.getReceiveName();
+            this.applyPhone = equity.getReceivePhone();
+            this.applyIdcard = equity.getReceiveIdentify();
+            this.type = 2;
+        }else if(equity.getReceiveType().equals(1)){
+            this.insureName = equity.getReceiveName();
+            this.insurePhone = equity.getReceivePhone();
+            this.insureIdcard = equity.getReceiveIdentify();
+            this.type = 3;
+        }else if(equity.getReceiveType().equals(2)){
+            this.ownerName = equity.getReceiveName();
+            this.ownerPhone = equity.getReceivePhone();
+            this.ownerIdcard = equity.getReceiveIdentify();
+            this.type = 4;
+        }
+        this.orderMoney = equity.getOrderMoney();
+        this.surplusMoney = equity.getPoint();
+        this.rightsInfoVoList = ThreeRightsInfoVo.coverList(equity.getEquityInfo());
+        if(StringUtils.isBlank(user.getDeptType())){
+            this.orderUserType = 0;
+        }else{
+            this.orderUserType = Integer.parseInt(user.getDeptType());
+        }
+
+        this.orderUserId = user.getId();
+        this.orderUserName = user.getName();
+        this.orderUserPhone = user.getMobile();
+        this.orderUserIdcard = user.getIdentity();
+    }
+
+    @Data
+    public static class ThreeRightsInfoVo {
+
+
+        @ApiModelProperty(value = "权益卷Id")
+        @JsonProperty("rightsInfoId")
+        private String rightsInfoId;
+
+        @ApiModelProperty(value = "权益卷套餐Id")
+        @JsonProperty("courseId")
+        private String  courseId;
+
+        @ApiModelProperty(value = "权益卷个数")
+        @JsonProperty("number")
+        private Integer number;
+
+
+        @ApiModelProperty(value = "类型(1.兑换券 2.折扣卷 3.抵现劵)")
+        @JsonProperty("type")
+        private String type;
+
+        @ApiModelProperty(value = "权益名称")
+        @JsonProperty("rightsName")
+        private String rightsName;
+
+        @ApiModelProperty(value = "分类")
+        @JsonProperty("classify")
+        private String classify;
+
+        @ApiModelProperty(value = "折扣值")
+        @JsonProperty("rebate")
+        private String rebate;
+
+        @ApiModelProperty(value = "抵现金额")
+        @JsonProperty("amount")
+        private java.math.BigDecimal amount;
+
+        @ApiModelProperty(value = "权益图片")
+        @JsonProperty("rightsPicture")
+        private String rightsPicture;
+
+        @ApiModelProperty(value = "市场售价")
+        @JsonProperty("marketPrice")
+        private BigDecimal marketPrice;
+
+        @ApiModelProperty(value = "协议价")
+        @JsonProperty("contractRate")
+        private BigDecimal contractRate;
+
+        @ApiModelProperty(value = "三方结算价格")
+        @JsonProperty("settlePrice")
+        private BigDecimal settlePrice;
+
+
+        @ApiModelProperty(value = "使用有限期类型(1.用户领取后生效2.三方用户赠送时间起3.固定时间段4.长期可用)")
+        @JsonProperty("useCondition")
+        private String useCondition;
+
+        @ApiModelProperty(value = "天数")
+        @JsonProperty("dayNum")
+        private Integer dayNum;
+
+        @ApiModelProperty(value = "开始时间")
+        @JsonProperty("startTime")
+        private Date startTime;
+
+        @ApiModelProperty(value = "结束时间")
+        @JsonProperty("endTime")
+        private Date endTime;
+
+
+
+        public static List<ThreeRightsInfoVo> coverList(String equityInfo) {
+            List<ThreeRightsInfoVo> infoVoList = new ArrayList<>();
+            LocalEquityPackagePage packagevo = JSON.parseObject(equityInfo, LocalEquityPackagePage.class);
+            List<LocalEquityPackageAssociation> localEquityPackageAssociationList = packagevo.getLocalEquityPackageAssociationList();
+
+            for (LocalEquityPackageAssociation localEquityPackageAssociation : localEquityPackageAssociationList) {
+                ThreeRightsInfoVo threeRightsInfoVo = new ThreeRightsInfoVo();
+                BeanUtils.copyProperties(localEquityPackageAssociation,threeRightsInfoVo);
+                threeRightsInfoVo.setRightsInfoId(localEquityPackageAssociation.getRightsId());
+                threeRightsInfoVo.setCourseId(localEquityPackageAssociation.getRightsPackageId());
+                infoVoList.add(threeRightsInfoVo);
+            }
+            return infoVoList;
+        }
+    }
+
+}

+ 24 - 0
src/main/java/com/ydtech/modules/equity/model/response/BaseResponse.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.equity.model.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.apache.poi.ss.formula.functions.T;
+
+import java.io.Serializable;
+
+@NoArgsConstructor
+@Data
+public class BaseResponse implements Serializable {
+
+    private static final long serialVersionUID = 01222613534207241613320L;
+
+    @JsonProperty("code")
+    public String code;
+
+    @JsonProperty("message")
+    public String message;
+
+    @JsonProperty("result")
+    private String result;
+}

+ 164 - 0
src/main/java/com/ydtech/modules/equity/model/response/LocalEquityPackageAssociation.java

@@ -0,0 +1,164 @@
+package com.ydtech.modules.equity.model.response;
+
+import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @Description: 权益套餐关联表
+ * @Author: jeecg-boot
+ * @Date:   2025-05-06
+ * @Version: V1.0
+ */
+@Data
+public class LocalEquityPackageAssociation implements Serializable {
+    private static final long serialVersionUID = 1L;
+    
+	/**
+	 * id
+	 */
+	@JsonProperty("id")
+	private String id;
+
+	/**
+	 * 权益id
+	 */
+	@JsonProperty("rightsId")
+	private String rightsId;
+
+	/**
+	 * 权益套餐id
+	 */
+	@JsonProperty("rightsPackageId")
+	private String rightsPackageId;
+
+	/**
+	 * 是否删除(0,:否 1:是)
+	 */
+	@JsonProperty("delFlag")
+	private Integer delFlag;
+
+	/**
+	 * 创建者
+	 */
+	@JsonProperty("createBy")
+	private String createBy;
+
+	/**
+	 * 创建时间
+	 */
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	@JsonProperty("createTime")
+	private Date createTime;
+
+	/**
+	 * 修改者
+	 */
+	@JsonProperty("updateBy")
+	private String updateBy;
+
+	/**
+	 * 修改时间
+	 */
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	@JsonProperty("updateTime")
+	private Date updateTime;
+
+	/**
+	 * 数量
+	 */
+	@JsonProperty("number")
+	private Integer number;
+
+	/**
+	 * 类型(1.兑换券 2.折扣卷 3.抵现劵)
+	 */
+	@JsonProperty("type")
+	private String type;
+
+	/**
+	 * 权益名称
+	 */
+	@JsonProperty("rightsName")
+	private String rightsName;
+
+	/**
+	 * 分类
+	 */
+	@JsonProperty("classify")
+	private String classify;
+
+	/**
+	 * 折扣值
+	 */
+	@JsonProperty("rebate")
+	private String rebate;
+
+
+	/**
+	 * 抵现金额
+	 */
+	@JsonProperty("amount")
+	private BigDecimal amount;
+
+	/**
+	 * 权益图片
+	 */
+	@JsonProperty("rightsPicture")
+	private String rightsPicture;
+
+	/**
+	 * 市场售价
+	 */
+	@JsonProperty("marketPrice")
+	private BigDecimal marketPrice;
+
+	/**
+	 * 协议价
+	 */
+	@JsonProperty("contractRate")
+	private BigDecimal contractRate;
+
+	/**
+	 * 三方结算价格
+	 */
+	@JsonProperty("settlePrice")
+	private BigDecimal settlePrice;
+
+
+	/**
+	 * 使用有限期类型(1.用户领取后生效2.三方用户赠送时间起3.固定时间段4.长期可用)
+	 */
+	@JsonProperty("useCondition")
+	private String useCondition;
+
+	/**
+	 * 天数
+	 */
+	@JsonProperty("dayNum")
+	private Integer dayNum;
+
+	/**
+	 * 开始时间
+	 */
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonProperty("startTime")
+	private Date startTime;
+
+	/**
+	 * 结束时间
+	 */
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern="yyyy-MM-dd")
+	@JsonProperty("endTime")
+	private Date endTime;
+
+}

+ 127 - 0
src/main/java/com/ydtech/modules/equity/model/response/LocalEquityPackagePage.java

@@ -0,0 +1,127 @@
+package com.ydtech.modules.equity.model.response;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.util.Date;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * @Description: 权益套餐表
+ * @Author: jeecg-boot
+ * @Date:   2025-05-06
+ * @Version: V1.0
+ */
+@Data
+public class LocalEquityPackagePage{
+	
+	/**id*/
+	@JsonProperty("id")
+	private String id;
+
+	/**
+	 * 权益券套餐名称
+	 */
+	@JsonProperty("equityPackageName")
+	private String equityPackageName;
+
+	/**
+	 * 费用最大值
+	 */
+	@JsonProperty("costPriceMax")
+	private BigDecimal costPriceMax;
+
+	/**
+	 * 费用最小值
+	 */
+	@JsonProperty("costPriceMin")
+	private BigDecimal costPriceMin;
+
+	/**
+	 * 市场价
+	 */
+	@JsonProperty("marketPrice")
+	private BigDecimal marketPrice;
+
+	/**
+	 * 协议价
+	 */
+	@JsonProperty("agreementPrice")
+	private BigDecimal agreementPrice;
+
+	/**
+	 * 三方结算价
+	 */
+	@JsonProperty("threeSettlementPrice")
+	private BigDecimal threeSettlementPrice;
+
+	/**
+	 * 套餐总价
+	 */
+	@JsonProperty("totalPackagePrice")
+	private BigDecimal totalPackagePrice;
+
+	/**
+	 * 套餐售价
+	 */
+	@JsonProperty("packagePrice")
+	private BigDecimal packagePrice;
+
+	/**
+	 * 行业id
+	 */
+	@JsonProperty("industryId")
+	private String industryId;
+
+	/**
+	 * 是否删除(0,:否 1:是)
+	 */
+	@JsonProperty("delFlag")
+	private Integer delFlag;
+
+	/**
+	 * 创建者
+	 */
+	@JsonProperty("createBy")
+	private String createBy;
+
+	/**
+	 * 创建时间
+	 */
+  	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	@JsonProperty("createTime")
+	private Date createTime;
+
+	/**
+	 * 修改者
+	 */
+	@JsonProperty("updateBy")
+	private String updateBy;
+
+	/**
+	 * 修改时间
+	 */
+  	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+	@JsonProperty("updateTime")
+	private Date updateTime;
+
+	/**
+	 * 是否上架(0 未上架  1  上架)
+	 */
+	@JsonProperty("status")
+	private String status;
+
+	/**
+	 * 权益套餐关联表
+	 */
+	@JsonProperty("localEquityPackageAssociationList")
+	private List<LocalEquityPackageAssociation> localEquityPackageAssociationList;
+	
+}

+ 25 - 0
src/main/java/com/ydtech/modules/equity/model/response/PageResultResponse.java

@@ -0,0 +1,25 @@
+package com.ydtech.modules.equity.model.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.equity.model.request.ThreeRightsInfoPageVo;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class PageResultResponse extends BaseResponse {
+
+    @JsonProperty("records")
+    public List<LocalEquityPackagePage> records;
+
+    @JsonProperty("total")
+    public int total;
+
+    @JsonProperty("pages")
+    public int pages;
+
+    @JsonProperty("size")
+    public int size;
+}

+ 31 - 0
src/main/java/com/ydtech/modules/equity/model/response/PointRatioDto.java

@@ -0,0 +1,31 @@
+package com.ydtech.modules.equity.model.response;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/5/8 15:27
+ *  @Description: 现金兑换积分比例
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@ApiModel(value = "现金兑换积分比例")
+public class PointRatioDto extends BaseResponse{
+
+    @ApiModelProperty("分子")
+    @JsonProperty("numerator")
+    private String  numerator;
+
+    @ApiModelProperty("分母")
+    @JsonProperty("denominator")
+    private String  denominator;
+
+}

+ 23 - 0
src/main/java/com/ydtech/modules/equity/model/vo/AddEquityPageQueryVo.java

@@ -0,0 +1,23 @@
+package com.ydtech.modules.equity.model.vo;
+
+import com.ydtech.core.page.BasePageVO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+@ApiModel(description = "补录订单权益包列表查询VO")
+@Data
+public class AddEquityPageQueryVo extends BasePageVO {
+
+    @NotBlank(message = "费用id不能为空")
+    @ApiModelProperty(value = "费用id")
+    private String costsId;
+
+    @NotNull(message = "总优惠不能为空")
+    @ApiModelProperty(value = "总优惠")
+    private BigDecimal totalAmount;
+}

+ 53 - 0
src/main/java/com/ydtech/modules/equity/model/vo/EquityPackageVo.java

@@ -0,0 +1,53 @@
+package com.ydtech.modules.equity.model.vo;
+
+import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@ApiModel(description = "权益包信息VO")
+@Data
+public class EquityPackageVo {
+
+
+    @ApiModelProperty(value = "权益包名称")
+    private String packageName;
+
+    @ApiModelProperty(value = "留点比例")
+    private String ldProportion;
+
+    @ApiModelProperty(value = "总费用")
+    private BigDecimal totalAmount;
+
+    @ApiModelProperty(value = "代理人费用")
+    private BigDecimal dlrAmount;
+
+    @ApiModelProperty(value = "客户权益费用")
+    private BigDecimal khAmount;
+
+    @ApiModelProperty(value = "权益包价格")
+    private BigDecimal qybAmount;
+
+    @ApiModelProperty(value = "客户权益明细")
+    private List<EquityPackageInfoVo> infoVoList;
+
+    @Data
+    public static class EquityPackageInfoVo {
+
+        @ApiModelProperty(value = "权益名称")
+        private String equityName;
+
+        @ApiModelProperty(value = "数量")
+        private Integer number;
+
+        @ApiModelProperty(value = "市场价")
+        private BigDecimal marketPrice;
+
+        @ApiModelProperty(value = "权益价")
+        private BigDecimal agreementPrice;
+
+    }
+}

+ 35 - 0
src/main/java/com/ydtech/modules/equity/model/vo/EquityPageQueryVo.java

@@ -0,0 +1,35 @@
+package com.ydtech.modules.equity.model.vo;
+
+import com.ydtech.core.page.BasePageVO;
+import com.ydtech.core.page.PageResult;
+import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
+import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+@ApiModel(description = "权益包列表查询VO")
+@Data
+public class EquityPageQueryVo extends BasePageVO {
+
+    @NotBlank(message = "订单号不能为空")
+    @ApiModelProperty(value = "订单id")
+    private String companyId;
+
+    private FeeOrderNewVo feeOrderNewVo;
+
+    private PageResult pageResult;
+
+    private BigDecimal pointProportion;
+
+    private BigDecimal amount;
+
+    private LocalEquityPackagePage equityInfoVo;
+
+
+
+}

+ 81 - 0
src/main/java/com/ydtech/modules/equity/model/vo/EquitySaveVo.java

@@ -0,0 +1,81 @@
+package com.ydtech.modules.equity.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+@ApiModel(description = "权益包新增VO")
+@Data
+public class EquitySaveVo {
+
+    @NotBlank(message = "订单号不能为空")
+    @ApiModelProperty(value = "订单id")
+    private String companyId;
+
+    @NotNull(message = "选中权益包不能为空")
+    @ApiModelProperty(value = "权益包列表")
+    private LocalEquityPackagePage equityInfo;
+
+    /**
+     * 接收人类型0.投保人 1.被保人 2.车主
+     */
+    @NotNull(message = "接收人类型不能为空")
+    @ApiModelProperty(value = "接收人类型0.投保人 1.被保人 2.车主")
+    private Integer receiveType;
+
+    /**
+     * 接收人名字
+     */
+    @NotBlank(message = "接收人名字不能为空")
+    @ApiModelProperty(value = "接收人名字")
+    private String receiveName;
+
+    /**
+     * 接收人电话
+     */
+    @NotBlank(message = "接收人电话不能为空")
+    @ApiModelProperty(value = "接收人电话")
+    private String receivePhone;
+
+    /**
+     * 接收人身份证号
+     */
+    @ApiModelProperty(value = "接收人身份证号")
+    @NotBlank(message = "接收人身份证号不能为空")
+    private String receiveIdentify;
+
+    /**
+     * 返佣金额
+     */
+    @NotNull(message = "返佣金额不能为空")
+    @ApiModelProperty(value = "返佣金额")
+    private BigDecimal orderMoney;
+
+    @NotNull(message = "兑换积分不能为空")
+    @ApiModelProperty(value = "兑换积分")
+    private BigDecimal point;
+
+    @ApiModelProperty(value = "代客下单用户id")
+    private String orderUserId;
+
+    @ApiModelProperty(value = "代客下单用户名称")
+    private String orderUserName;
+
+    @ApiModelProperty(value = "代客下单类型 1.渠道 2.代理人 3.电销")
+    private Integer orderUserType;
+
+    @ApiModelProperty(value = "代客下单手机号")
+    private String orderUserPhone;
+
+    @ApiModelProperty(value = "代客下单身份证号")
+    private String orderUserIdcard;
+
+
+}

+ 58 - 0
src/main/java/com/ydtech/modules/equity/service/EquityService.java

@@ -0,0 +1,58 @@
+package com.ydtech.modules.equity.service;
+
+import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
+import com.ydtech.modules.equity.model.vo.AddEquityPageQueryVo;
+import com.ydtech.modules.equity.model.vo.EquityPageQueryVo;
+import com.ydtech.modules.equity.model.vo.EquitySaveVo;
+
+public interface EquityService {
+
+    /**
+     * 权益包分页列表
+     * @param pageQueryVo
+     * @return
+     */
+    EquityPageQueryVo equityInfo(EquityPageQueryVo pageQueryVo);
+
+    /**
+     * 补录订单权益包分页列表
+     * @param pageQueryVo
+     * @return
+     */
+    EquityPageQueryVo addEquityInfo(AddEquityPageQueryVo pageQueryVo);
+
+    /**
+     * 保存选中的权益包
+     * @param equitySaveVo
+     */
+    void saveEquity(EquitySaveVo equitySaveVo);
+
+    /**
+     * 权益包下单
+     *
+     * @param companyId
+     */
+    InsAreaCompanyEquity createEquityOrder(String companyId);
+
+    /**
+     * 权益包确认下单
+     * @param companyId
+     */
+    void confirmEquityOrder(String companyId);
+
+    /**
+     * 放弃选中权益
+     * @param companyId
+     */
+    void delEquity(String companyId);
+
+    /**
+     * 保存权益类型
+     * @param companyId
+     * @param type
+     */
+    void saveEquityType(String companyId, Integer type);
+
+
+}

+ 13 - 0
src/main/java/com/ydtech/modules/equity/service/InsAreaCompanyEquityService.java

@@ -0,0 +1,13 @@
+package com.ydtech.modules.equity.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
+
+/**
+* @author dongxin
+* @description 针对表【ins_area_company_equity(订单权益包下单表)】的数据库操作Service
+* @createDate 2025-05-07 18:24:28
+*/
+public interface InsAreaCompanyEquityService extends IService<InsAreaCompanyEquity> {
+
+}

+ 300 - 0
src/main/java/com/ydtech/modules/equity/service/impl/EquityServiceImpl.java

@@ -0,0 +1,300 @@
+package com.ydtech.modules.equity.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ydtech.core.page.PageResult;
+import com.ydtech.exception.SystemException;
+import com.ydtech.modules.admin.model.SysUser;
+import com.ydtech.modules.admin.service.SysUserService;
+import com.ydtech.modules.equity.components.EquityApiConfigurationProperties;
+import com.ydtech.modules.equity.components.EquityRequestApiComponents;
+import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
+import com.ydtech.modules.equity.model.request.ThreeOrderVo;
+import com.ydtech.modules.equity.model.request.ThreePointVo;
+import com.ydtech.modules.equity.model.request.ThreeRightsInfoPageVo;
+import com.ydtech.modules.equity.model.request.ThreeUserOrderVo;
+import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
+import com.ydtech.modules.equity.model.response.PageResultResponse;
+import com.ydtech.modules.equity.model.response.PointRatioDto;
+import com.ydtech.modules.equity.model.vo.AddEquityPageQueryVo;
+import com.ydtech.modules.equity.model.vo.EquityPageQueryVo;
+import com.ydtech.modules.equity.model.vo.EquitySaveVo;
+import com.ydtech.modules.equity.service.EquityService;
+import com.ydtech.modules.equity.service.InsAreaCompanyEquityService;
+import com.ydtech.modules.order.constants.BusinessConstant;
+import com.ydtech.modules.order.entity.InsAreaCompany;
+import com.ydtech.modules.order.entity.InsOrders;
+import com.ydtech.modules.order.entity.vo.FeeOrderNewVo;
+import com.ydtech.modules.order.service.InsAreaCompanyService;
+import com.ydtech.modules.order.service.InsOrdersService;
+import com.ydtech.modules.protocols.entity.po.InsFeeOrderNew;
+import com.ydtech.modules.protocols.entity.po.PtlAgreementProductCostsNew;
+import com.ydtech.modules.protocols.service.InsFeeOrderNewService;
+import com.ydtech.modules.protocols.service.PtlAgreementProductCostsNewService;
+import com.ydtech.utils.StringUtils;
+import org.springframework.beans.BeanUtils;
+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.Optional;
+
+@Service
+public class EquityServiceImpl implements EquityService {
+
+    @Autowired
+    private EquityRequestApiComponents equityRequestApiComponents;
+
+    @Autowired
+    private InsFeeOrderNewService insFeeOrderNewService;
+
+    @Autowired
+    private InsAreaCompanyService insAreaCompanyService;
+
+    @Autowired
+    private InsOrdersService insOrdersService;
+
+    @Autowired
+    private SysUserService sysUserService;
+
+    @Autowired
+    private PtlAgreementProductCostsNewService agreementProductCostsNewService;
+
+    @Autowired
+    private InsAreaCompanyEquityService insAreaCompanyEquityService;
+
+    @Autowired
+    private EquityApiConfigurationProperties properties;
+
+    @Override
+    public EquityPageQueryVo equityInfo(EquityPageQueryVo pageQueryVo) {
+
+        // 通过订单号获取优惠信息
+        InsFeeOrderNew insFeeOrderNew = insFeeOrderNewService.getOne(new LambdaQueryWrapper<InsFeeOrderNew>()
+                .eq(InsFeeOrderNew::getInsOrderNo, pageQueryVo.getCompanyId()));
+        // 获取费用信息
+        LambdaQueryWrapper<PtlAgreementProductCostsNew> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(PtlAgreementProductCostsNew::getId, insFeeOrderNew.getCostsId());
+        PtlAgreementProductCostsNew agreementProductCostsNew = agreementProductCostsNewService.getOne(wrapper);
+        if(Objects.isNull(agreementProductCostsNew)){
+            throw new SystemException("费用信息异常!");
+        }
+        if(StringUtils.isBlank(agreementProductCostsNew.getLdProportion())){
+            throw new SystemException("先去设置代理人的留点比例!");
+        }
+
+        FeeOrderNewVo feeOrderNewVo = this.newConvertOrderFeeVoData(insFeeOrderNew,agreementProductCostsNew);
+        // 获取佣金
+        List<FeeOrderNewVo.ExportFee> feeList = feeOrderNewVo.getExportFee();
+        BigDecimal totalAmount = BigDecimal.valueOf(0);
+        for (FeeOrderNewVo.ExportFee fee : feeList) {
+            if(BusinessConstant.FEE_INSURANCE_TYPE_4.equals(fee.getInsuranceType())){
+                totalAmount = fee.getTotalAmount();
+            }
+        }
+        int pageNum = pageQueryVo.getPageNum();
+        int pageSize = pageQueryVo.getPageSize();
+        PageResult pageResult = new PageResult();
+        ThreeRightsInfoPageVo threeRightsInfoPageVo = new ThreeRightsInfoPageVo(pageQueryVo, properties.getAppkey(), totalAmount);
+        PageResultResponse response = equityRequestApiComponents.equityPage(threeRightsInfoPageVo);
+        pageResult.setPageNum(pageNum);
+        pageResult.setPageSize(pageSize);
+        pageResult.setTotalSize(response.total);
+        pageResult.setContent(response.getRecords());
+        pageQueryVo.setPageResult(pageResult);
+        pageQueryVo.setFeeOrderNewVo(feeOrderNewVo);
+        // 获取积分兑换比例(接口获取)
+        ThreePointVo threePointVo = new ThreePointVo();
+        threePointVo.setThreeUserId(properties.getAppkey());
+        PointRatioDto pointRatioDto = equityRequestApiComponents.getPointRatio(threePointVo);
+        pageQueryVo.setPointProportion(new BigDecimal(pointRatioDto.getDenominator()));
+
+        // 获取权益包
+        InsAreaCompanyEquity equity = insAreaCompanyEquityService.getById(pageQueryVo.getCompanyId());
+        if(Objects.nonNull(equity)){
+            String equityInfo = equity.getEquityInfo();
+            LocalEquityPackagePage packagevo = JSON.parseObject(equityInfo, LocalEquityPackagePage.class);
+            pageQueryVo.setEquityInfoVo(packagevo);
+        }
+        return pageQueryVo;
+    }
+
+    @Override
+    public EquityPageQueryVo addEquityInfo(AddEquityPageQueryVo pageQueryVo) {
+        EquityPageQueryVo pageQueryDto = new EquityPageQueryVo();
+        // 获取费用信息
+        LambdaQueryWrapper<PtlAgreementProductCostsNew> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(PtlAgreementProductCostsNew::getId, pageQueryVo.getCostsId());
+        PtlAgreementProductCostsNew agreementProductCostsNew = agreementProductCostsNewService.getOne(wrapper);
+        if(Objects.isNull(agreementProductCostsNew)){
+            throw new SystemException("费用信息异常!");
+        }
+        if(StringUtils.isBlank(agreementProductCostsNew.getLdProportion())){
+            throw new SystemException("先去设置代理人的留点比例!");
+        }
+        BigDecimal amount = pageQueryVo.getTotalAmount().subtract(pageQueryVo.getTotalAmount().multiply(new BigDecimal(agreementProductCostsNew.getLdProportion()).divide(new BigDecimal(100))));
+        int pageNum = pageQueryVo.getPageNum();
+        int pageSize = pageQueryVo.getPageSize();
+        PageResult pageResult = new PageResult();
+        ThreeRightsInfoPageVo threeRightsInfoPageVo = new ThreeRightsInfoPageVo(pageQueryVo, properties.getAppkey(), amount);
+        PageResultResponse response = equityRequestApiComponents.equityPage(threeRightsInfoPageVo);
+        pageResult.setPageNum(pageNum);
+        pageResult.setPageSize(pageSize);
+        pageResult.setTotalSize(response.total);
+        pageResult.setContent(response.getRecords());
+        pageQueryDto.setPageResult(pageResult);
+        // 获取积分兑换比例(接口获取)
+        ThreePointVo threePointVo = new ThreePointVo();
+        threePointVo.setThreeUserId(properties.getAppkey());
+        PointRatioDto pointRatioDto = equityRequestApiComponents.getPointRatio(threePointVo);
+        pageQueryDto.setPointProportion(new BigDecimal(pointRatioDto.getDenominator()));
+        pageQueryDto.setAmount(amount);
+        return pageQueryDto;
+    }
+
+    @Override
+    public void saveEquity(EquitySaveVo equitySaveVo) {
+
+        InsAreaCompanyEquity equity = insAreaCompanyEquityService.getById(equitySaveVo.getCompanyId());
+        if (Objects.isNull(equity)) {
+            equity = new InsAreaCompanyEquity();
+            equity.setType(1);
+        }
+        BeanUtils.copyProperties(equitySaveVo, equity);
+        equity.setSubOrderNo(equitySaveVo.getCompanyId());
+        equity.setStatus(0);
+        LocalEquityPackagePage packagevo = equitySaveVo.getEquityInfo();
+        equity.setEquityInfo(JSON.toJSONString(packagevo));
+        equity.setEquityId(packagevo.getId());
+        equity.setEquityName(packagevo.getEquityPackageName());
+        insAreaCompanyEquityService.saveOrUpdate(equity);
+    }
+
+    @Override
+    public InsAreaCompanyEquity createEquityOrder(String companyId) {
+        // 获取权益包
+        InsAreaCompanyEquity equity = insAreaCompanyEquityService.getById(companyId);
+        if(Objects.isNull(equity)){
+            throw new SystemException("客户权益未保存成功!");
+        }
+        InsAreaCompany insAreaCompany = insAreaCompanyService.getById(companyId);
+        InsOrders orders = insOrdersService.getById(insAreaCompany.getOrderno());
+        SysUser user = sysUserService.getByUserId(orders.getUserid());
+        if(Objects.isNull(equity)){return null;}
+        if(!equity.getStatus().equals(1)){
+            ThreeUserOrderVo threeUserOrderVo = new ThreeUserOrderVo(companyId, equity,properties.getAppkey(),user);
+            equityRequestApiComponents.createOrder(threeUserOrderVo);
+            equity.setStatus(1);
+            insAreaCompanyEquityService.updateById(equity);
+        }
+        return equity;
+    }
+
+    @Override
+    public void confirmEquityOrder(String companyId) {
+        // 获取权益包
+        InsAreaCompanyEquity equity = insAreaCompanyEquityService.getById(companyId);
+        if(Objects.isNull(equity) || !equity.getStatus().equals(1)){throw new SystemException("权益包订单异常");}
+        ThreeOrderVo threeOrderVo = new ThreeOrderVo(properties.getAppkey(), companyId);
+        equityRequestApiComponents.confirmOrder(threeOrderVo);
+        equity.setStatus(2);
+        insAreaCompanyEquityService.updateById(equity);
+    }
+
+    @Override
+    public void delEquity(String companyId) {
+        insAreaCompanyEquityService.removeById(companyId);
+    }
+
+    @Override
+    public void saveEquityType(String companyId, Integer type) {
+        InsAreaCompanyEquity equity = new InsAreaCompanyEquity();
+        equity.setSubOrderNo(companyId);
+        equity.setType(type);
+        insAreaCompanyEquityService.save(equity);
+    }
+
+
+    /**
+     * 计算费用
+     *
+     * @param insFeeOrderNew
+     * @param agreementProductCostsNew
+     * @return
+     */
+    private FeeOrderNewVo newConvertOrderFeeVoData(InsFeeOrderNew insFeeOrderNew, PtlAgreementProductCostsNew agreementProductCostsNew) {
+
+        FeeOrderNewVo feeOrderNewVo = new FeeOrderNewVo();
+        List<FeeOrderNewVo.ExportFee> exportFeeList = new ArrayList<>();
+        // 出口费用
+        // 交强
+        FeeOrderNewVo.ExportFee jqExportFee = this.assignExportFee(BusinessConstant.FEE_INSURANCE_TYPE_1,
+                insFeeOrderNew.getJqExportSuperviseCostsPremiums(), insFeeOrderNew.getJqExportOtherCostsPremiums(),
+                new BigDecimal(agreementProductCostsNew.getLdProportion())
+        );
+
+        //商业
+        FeeOrderNewVo.ExportFee syExportFee = this.assignExportFee(BusinessConstant.FEE_INSURANCE_TYPE_2,
+                insFeeOrderNew.getSyExportSuperviseCostsPremiums(), insFeeOrderNew.getSyExportOtherCostsPremiums(),
+                new BigDecimal(agreementProductCostsNew.getLdProportion())
+        );
+
+        //非车
+        FeeOrderNewVo.ExportFee noExportFee = this.assignExportFee(BusinessConstant.FEE_INSURANCE_TYPE_3,
+                insFeeOrderNew.getNoExportSuperviseCostsPremiums(), insFeeOrderNew.getNoExportOtherCostsPremiums(),
+                new BigDecimal(agreementProductCostsNew.getLdProportion()));
+
+        exportFeeList.add(jqExportFee);
+        exportFeeList.add(syExportFee);
+        exportFeeList.add(noExportFee);
+        //出口费用合计
+        FeeOrderNewVo.ExportFee exportFeeTotal = assignExportFeeTotal(exportFeeList);
+        exportFeeList.add(exportFeeTotal);
+
+        feeOrderNewVo.setExportFee(exportFeeList);
+        return feeOrderNewVo;
+
+    }
+
+    /**
+     * 费用合计
+     * @param exportFeeList
+     * @return
+     */
+    private FeeOrderNewVo.ExportFee assignExportFeeTotal(List<FeeOrderNewVo.ExportFee> exportFeeList) {
+        FeeOrderNewVo.ExportFee exportFee = new FeeOrderNewVo.ExportFee();
+        exportFee.setInsuranceType(BusinessConstant.FEE_INSURANCE_TYPE_4);
+        //总费用合计
+        BigDecimal totalAmount = exportFeeList.stream().map(FeeOrderNewVo.ExportFee::getTotalAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
+        exportFee.setTotalAmount(Optional.of(totalAmount).orElse(BigDecimal.ZERO));
+        return exportFee;
+    }
+
+    /**
+     * 费用计算
+     *
+     * @param title
+     * @param superviseCostsPremiums
+     * @param otherCostsPremiums
+     * @param ldProportion
+     * @return
+     */
+    public FeeOrderNewVo.ExportFee assignExportFee(String title,
+                                                   BigDecimal superviseCostsPremiums,
+                                                   BigDecimal otherCostsPremiums,
+                                                   BigDecimal ldProportion) {
+        FeeOrderNewVo.ExportFee exportFee = new FeeOrderNewVo.ExportFee();
+        exportFee.setInsuranceType(title);
+        //手续费
+        exportFee.setSuperviseCostsPremiums(superviseCostsPremiums);
+        //跟单费
+        exportFee.setOtherCostsPremiums(otherCostsPremiums);
+        //总费用
+        BigDecimal totalAmount = superviseCostsPremiums.add(otherCostsPremiums);
+        exportFee.setTotalAmount(totalAmount.subtract(totalAmount.multiply(ldProportion.divide(new BigDecimal(100)))));
+        return exportFee;
+    }
+}

+ 22 - 0
src/main/java/com/ydtech/modules/equity/service/impl/InsAreaCompanyEquityServiceImpl.java

@@ -0,0 +1,22 @@
+package com.ydtech.modules.equity.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydtech.modules.equity.dao.InsAreaCompanyEquityMapper;
+import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
+import com.ydtech.modules.equity.service.InsAreaCompanyEquityService;
+import org.springframework.stereotype.Service;
+
+/**
+* @author dongxin
+* @description 针对表【ins_area_company_equity(订单权益包下单表)】的数据库操作Service实现
+* @createDate 2025-05-07 18:24:28
+*/
+@Service
+public class InsAreaCompanyEquityServiceImpl extends ServiceImpl<InsAreaCompanyEquityMapper, InsAreaCompanyEquity>
+    implements InsAreaCompanyEquityService {
+
+}
+
+
+
+

+ 92 - 0
src/main/java/com/ydtech/modules/equity/utils/SMCheckDataUtils.java

@@ -0,0 +1,92 @@
+package com.ydtech.modules.equity.utils;
+
+import cn.hutool.core.util.HexUtil;
+import cn.hutool.crypto.SmUtil;
+import cn.hutool.crypto.asymmetric.SM2;
+import cn.hutool.crypto.symmetric.SM4;
+
+/**
+ *  @version
+ *  @author: hxl
+ *  @Date: 2025/2/25 10:05
+ *  @Description: 国密算法
+ */
+public class SMCheckDataUtils {
+    public static void main(String[] args) {
+        String privateKeyHex = "MIGTAgEAMBMGByqGSM49AgEGCCqBHM9VAYItBHkwdwIBAQQgL4JFOA+0iymPbYi9ek5kHJ+BBjkdJV6GERmWnW1pAuugCgYIKoEcz1UBgi2hRANCAASfzrZzeAfaZR5nCLLA28F1sRdhUfyaQMbE+QlK62trsGH9F77GyeF7vFu4fx/BnZaCQQYA2cyBbPLXM1gL9aZV";
+        String publicKeyHex = "MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAEn862c3gH2mUeZwiywNvBdbEXYVH8mkDGxPkJSutra7Bh/Re+xsnhe7xbuH8fwZ2WgkEGANnMgWzy1zNYC/WmVQ==";
+        String scret = "7eb6c2063bb2d2ce3bdacebc6ecad8df";
+//        User user =new User("1","张三");
+//        String userStr = JSON.toJSONString(user);
+        //加签
+//        String signStr =  sm2SignStr(userStr,privateKeyHex,publicKeyHex);
+//        //加密
+//        String dataStr = sm4EncryptStr(userStr,scret);
+//        System.out.println("sm2签名: " + signStr);
+//        System.out.println("sm4加密: " + dataStr);
+    }
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/2/25 9:53
+     *  @scret  秘钥
+     *  @plainText   待解密的字符串
+     *  @Description:  sm4 解密
+     */
+    public static String sm4DecryptStr(String plainText,String scret){
+        SM4 sm4 = SmUtil.sm4(HexUtil.decodeHex(scret));
+        String decryptedText = sm4.decryptStr(plainText);
+        System.out.println("解密后的文本: " + decryptedText);
+        return decryptedText;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/2/25 9:56
+     *   @scret 秘钥
+     *   @plainText 待加密的字符串
+     *  @Description:加密
+     */
+    public  static String sm4EncryptStr(String plainText,String scret){
+        SM4 sm4 = SmUtil.sm4(HexUtil.decodeHex(scret));
+        String encryptText = sm4.encryptHex(plainText);
+        System.out.println("加密后的文本: " + encryptText);
+        return encryptText;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/2/25 9:53
+     *  @privateKeyHex  私钥
+     *  @publicKeyHex  公钥
+     *  @plainText   待加签的字符串
+     *  @Description:  sm2 加签
+     */
+    public static String sm2SignStr(String plainText,String privateKeyHex,String publicKeyHex){
+        SM2 sm2 =  SmUtil.sm2(privateKeyHex,publicKeyHex);
+        //加签
+        String signStr = sm2.signHex(HexUtil.encodeHexStr(plainText));
+        System.out.println("加签后的文本: " + signStr);
+        return signStr;
+    }
+
+    /**
+     *  @version
+     *  @author: hxl
+     *  @Date: 2025/2/25 9:53
+     *  @privateKeyHex  私钥
+     *  @publicKeyHex  公钥
+     *  @plainText   待验签的字符串
+     *  @signature  签名
+     *  @Description:  sm2 加签
+     */
+    public static boolean sm2VerifyHexStr(String plainText, String signature, String privateKeyHex, String publicKeyHex){
+        SM2 sm2 =  SmUtil.sm2(privateKeyHex,publicKeyHex);
+        //验签
+        boolean flag = sm2.verifyHex(HexUtil.encodeHexStr(plainText), signature);
+        System.out.println("验证是否通过: " + flag);
+        return flag;
+    }
+}

+ 1 - 1
src/main/java/com/ydtech/modules/fee/service/impl/FeeRuleSchemeServiceNewImpl.java

@@ -157,7 +157,7 @@ public class FeeRuleSchemeServiceNewImpl implements FeeRuleSchemeNewService {
                     }
                 }
 
-                //使用性质 营业  非营业
+                //使用性质 营业 非营业
                 if(attr.getAttrCode().equals("NatureOfUse")){
                     String[] split = attr.getMin().split(",");
                     boolean isPipei = false;

+ 6 - 0
src/main/java/com/ydtech/modules/fnc/service/impl/InsFeeAuditServiceImpl.java

@@ -192,6 +192,8 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
 
             //生成机构费用
             gene_deptfee(order, insFeeOrderNew, insAreaCompany);
+
+
             //结算费用生成
             insPlyIncomeService.saveBalanceNew(order, insFeeOrderNew, insAreaCompany, user.getLeaderId(), user.getLeaderName());
 
@@ -244,6 +246,10 @@ public class InsFeeAuditServiceImpl extends ServiceImpl<InsFeeAuditMapper, InsFe
                     sysUserAccount.setDocumentaryStatus("2");  // 收入
                     sysUserAccount.setSuborderId(insAreaCompany.getId());  // 订单Id
                     sysUserAccountService.addOrUpdate(sysUserAccount);
+
+
+
+
                     if (insFeeOrderNew.getDistributionStatus() != null) {
                         createInsFeeOrderNewDistribution(insFeeOrderNew, insAreaCompany, order, order.getUserid(), BigDecimal.ZERO, BigDecimal.ZERO, "0");
                         if (insFeeOrderNew.getFirstLevelUserId() != null) {

+ 1 - 0
src/main/java/com/ydtech/modules/order/components/dajia/DaJiaRequestApiComponents.java

@@ -65,6 +65,7 @@ public class DaJiaRequestApiComponents {
 
         InsuranceLog.infoLog(InsuranceEnum.DJPC.getPinyin(), "\n\t---------> URl: {} \n---------> 保险公司:{} {}\n---------> 请求参数:{}", url, InsuranceEnum.DJPC.getName(), tradeCode.getDesc(), JSONObject.toJSONString(q));
         String encrypt = AESEncrypt.encrypt(JSON.toJSONString(q), encryptKey);
+        System.out.println(encrypt);
         HttpEntity<String> httpEntity = new HttpEntity<>(encrypt, httpHeaders);
         ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.POST,  httpEntity, String.class);
         String body = response.getBody();

+ 6 - 0
src/main/java/com/ydtech/modules/order/constants/InsuranceTypeCorrespondence.java

@@ -57,6 +57,12 @@ public class InsuranceTypeCorrespondence {
     //司机
     protected static final String[] DRIVER = {"D3", "SY_FJ_YBW3"};
 
+    // 诚泰乘客
+    protected static final String[] CT_PASSENGER = {"D12", "YD12"};
+
+    // 诚泰司机
+    protected static final String[] CT_DRIVER = {"D11", "YD11"};
+
     // 绝对免赔
     protected static final String[] ABSOLUTE_DEDUCTIBLE = {"MJ1", "MJ2", "MJ3", "MJ4"};
 

+ 11 - 2
src/main/java/com/ydtech/modules/order/controller/ExternalOrderController.java

@@ -1,5 +1,6 @@
 package com.ydtech.modules.order.controller;
 
+import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ydtech.constants.enums.InsuranceRisk;
@@ -78,7 +79,7 @@ public class ExternalOrderController {
     @ApiOperation("保存子订单")
     public HttpResult<QuoteRespVo> saveSubOrder(@RequestBody BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
         BaseQuoteInfoVo quoteInfo = this.insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo(), quoteVo.getAgreementId(),quoteVo.getKinds());
-        boolean result = this.insAreaCompanyService.saveSubOrder(quoteInfo, quoteVo);
+        String companyId = this.insAreaCompanyService.saveSubOrder(quoteInfo, quoteVo);
         String successMsg="";
         String errorMsg ="";
         if(quoteVo.getStageFlag()==1){
@@ -88,7 +89,15 @@ public class ExternalOrderController {
             successMsg="暂存订单成功";
             errorMsg="暂存订单失败";
         }
-        return result  ? HttpResult.ok(successMsg) : HttpResult.error(errorMsg);
+        if(StringUtils.isNotBlank(companyId)){
+            HttpResult httpResult = new HttpResult();
+            httpResult.setData(companyId);
+            httpResult.setMsg(successMsg);
+            httpResult.setCode(200);
+            return httpResult;
+        }else{
+            return HttpResult.error(errorMsg);
+        }
     }
     @PostMapping("/updateExternalOrder")
     @ApiOperation("更新外部订单")

+ 6 - 0
src/main/java/com/ydtech/modules/order/entity/InsOrders.java

@@ -382,6 +382,12 @@ public class InsOrders implements Serializable {
     @ApiModelProperty("更新时间")
     @TableField(exist = false)
     private String updateStatusTime;
+
+    @ApiModelProperty("权益类型 0.现金券 1.权益包")
+    @TableField(exist = false)
+    private Integer type;
+
+
     public InsOrders(SysUser user, SysDept dept, BaseQuoteInfoVo quoteInfoVo) {
         // 2. 组装订单
         this.setQuoteno(String.valueOf(quoteInfoVo.getQuoteno()));

+ 5 - 0
src/main/java/com/ydtech/modules/order/entity/dto/InsAreaCompanyQueryDto.java

@@ -21,4 +21,9 @@ public class InsAreaCompanyQueryDto extends InsAreaCompany {
      */
     private String fileStatus;
 
+    /**
+     * 权益类型
+     */
+    private Integer equityType;
+
 }

+ 3 - 0
src/main/java/com/ydtech/modules/order/entity/vo/InsOrdersEditingVo.java

@@ -287,6 +287,8 @@ public class InsOrdersEditingVo extends InsOrders implements Serializable {
         @ApiModelProperty("接口类型")
         private String apiType;
 
+        @ApiModelProperty("权益类型")
+        private Integer equityType;
 
 
         public void feeVacant() {
@@ -339,6 +341,7 @@ public class InsOrdersEditingVo extends InsOrders implements Serializable {
             if(!Objects.isNull(insAreaCompany.getApiType())) {
                 this.apiType = insAreaCompany.getApiType().toString();
             }
+            this.equityType = insAreaCompany.getEquityType();
         }
     }
 

+ 8 - 0
src/main/java/com/ydtech/modules/order/entity/vo/OrderVo.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ydtech.modules.equity.model.vo.EquityPackageVo;
 import com.ydtech.modules.protocol.entity.po.PtlAgreement;
 import com.ydtech.modules.protocols.entity.vo.AgreementProductCostsSave;
 import io.swagger.annotations.ApiModelProperty;
@@ -536,4 +537,11 @@ public class OrderVo implements Serializable {
     @ApiModelProperty("录入来源")
     private String entryStatus;
 
+    @ApiModelProperty("权益包信息")
+    private EquityPackageVo equityPackageVo;
+
+    @ApiModelProperty("权益类型")
+    private Integer equityType;
+
+
 }

+ 1 - 1
src/main/java/com/ydtech/modules/order/service/InsAreaCompanyService.java

@@ -160,7 +160,7 @@ public interface InsAreaCompanyService extends IService<InsAreaCompany> {
      *
      * @return
      */
-    boolean saveSubOrder(BaseQuoteInfoVo quoteInfo, BaseQuoteVo<AccidentalDrivingVo> quoteVo);
+    String saveSubOrder(BaseQuoteInfoVo quoteInfo, BaseQuoteVo<AccidentalDrivingVo> quoteVo);
 
     /**
      * 根据订单id 获取已承保的子订单信息

+ 2 - 2
src/main/java/com/ydtech/modules/order/service/impl/InsAreaCompanyServiceImpl.java

@@ -588,7 +588,7 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
 
     @Override
     @Transactional
-    public boolean saveSubOrder(BaseQuoteInfoVo quoteInfo, BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
+    public String saveSubOrder(BaseQuoteInfoVo quoteInfo, BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
         //添加暂存标志   add by  hxl  2024-07-10  0 暂存 1 保存
         if (quoteVo.getStageFlag() == null) {
             throw new SystemException("暂存标志为空");
@@ -829,7 +829,7 @@ public class InsAreaCompanyServiceImpl extends ServiceImpl<InsAreaCompanyMapper,
         if(InsOrderStatusEnum.ACCEPT_INSURANCE.getCode().equals(insAreaCompany.getOrderstatus())){
             insOrderPushMsgService.getPushSignInsAreaCompanyList(insAreaCompany.getId());
         }
-        return true;
+        return insAreaCompany.getId();
     }
 
     /**

+ 45 - 0
src/main/java/com/ydtech/modules/order/service/impl/InsOrdersServiceImpl.java

@@ -30,6 +30,11 @@ import com.ydtech.modules.admin.model.*;
 import com.ydtech.modules.admin.model.po.SysUserIsDial;
 import com.ydtech.modules.admin.service.*;
 import com.ydtech.modules.base.controller.BaseController;
+import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
+import com.ydtech.modules.equity.model.response.LocalEquityPackageAssociation;
+import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
+import com.ydtech.modules.equity.model.vo.EquityPackageVo;
+import com.ydtech.modules.equity.service.InsAreaCompanyEquityService;
 import com.ydtech.modules.esm.model.EsmUserReferrer;
 import com.ydtech.modules.esm.service.EsmUserReferrerService;
 import com.ydtech.modules.fee.service.CostsCalcService;
@@ -150,6 +155,9 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
     @Autowired
     private PtlAgreementProductCostsNewService ptlAgreementProductCostsNewService;
 
+    @Autowired
+    private InsAreaCompanyEquityService insAreaCompanyEquityService;
+
     @Autowired
     private InsAreaCompanyAccidentalDrivingService insAreaCompanyAccidentalDrivingService;
 
@@ -1034,6 +1042,41 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
             orderAndAreaCompany.setSumFee(sum.toString());
             List<DistributionLevelVo> distributionLevelVoList = feeRuleSchemeService.converDistrbutionData(insFeeOrderNew);
             orderAndAreaCompany.setDistributionLevelVoList(distributionLevelVoList);
+
+            // 获取客户权益信息
+            List<FeeOrderNewVo.ExportFee> exportFee = feeOrderNewVo.getExportFee();
+            BigDecimal totalAmount = BigDecimal.valueOf(0);
+            for (FeeOrderNewVo.ExportFee fee : exportFee) {
+                if(BusinessConstant.FEE_INSURANCE_TYPE_4.equals(fee.getInsuranceType())){
+                    totalAmount = fee.getTotalAmount();
+                }
+            }
+            // 获取权益包
+            InsAreaCompanyEquity equity = insAreaCompanyEquityService.getById(companyId);
+            if(Objects.nonNull(equity) && equity.getType().equals(1)){
+                EquityPackageVo packageVo = new EquityPackageVo();
+                packageVo.setPackageName(equity.getEquityName());
+                packageVo.setLdProportion(ptlAgreementProductCostsNew.getLdProportion());
+                packageVo.setTotalAmount(totalAmount);
+                packageVo.setKhAmount(totalAmount.subtract(totalAmount.multiply(new BigDecimal(ptlAgreementProductCostsNew.getLdProportion()).multiply(new BigDecimal(100)))));
+                packageVo.setDlrAmount(totalAmount.multiply(new BigDecimal(ptlAgreementProductCostsNew.getLdProportion()).multiply(new BigDecimal(100))));
+
+                String equityInfo = equity.getEquityInfo();
+                LocalEquityPackagePage packagevo = JSON.parseObject(equityInfo, LocalEquityPackagePage.class);
+                List<LocalEquityPackageAssociation> infoList = packagevo.getLocalEquityPackageAssociationList();
+                packageVo.setQybAmount(packagevo.getTotalPackagePrice());
+                List<EquityPackageVo.EquityPackageInfoVo> infoVoList = new ArrayList<>();
+                for (LocalEquityPackageAssociation localEquityPackageAssociation : infoList) {
+                    EquityPackageVo.EquityPackageInfoVo infoVo = new EquityPackageVo.EquityPackageInfoVo();
+                    infoVo.setNumber(localEquityPackageAssociation.getNumber());
+                    infoVo.setEquityName(localEquityPackageAssociation.getRightsName());
+                    infoVo.setAgreementPrice(localEquityPackageAssociation.getSettlePrice());
+                    infoVo.setMarketPrice(localEquityPackageAssociation.getMarketPrice());
+                    infoVoList.add(infoVo);
+                }
+                packageVo.setInfoVoList(infoVoList);
+                orderAndAreaCompany.setEquityPackageVo(packageVo);
+            }
         }
         //查询费用审核状态
         List<InsFeeAudit> feeAuditList = insFeeAuditService.query().eq("ins_order_no", companyId).list();
@@ -1102,6 +1145,8 @@ public class InsOrdersServiceImpl extends ServiceImpl<InsOrdersMapper, InsOrders
         } else {
             orderAndAreaCompany.setJqInsuranceType(new JSONArray());
         }
+
+
         // 获取协议信息、 录入来源
         PtlAgreement ptlAgreement = ptlAgreementService.getById(orderAndAreaCompany.getAgreementId());
         orderAndAreaCompany.setPtlAgreement(ptlAgreement);

+ 4 - 0
src/main/java/com/ydtech/modules/protocols/entity/po/PtlAgreementProductCostsNew.java

@@ -157,6 +157,10 @@ public class PtlAgreementProductCostsNew {
     @TableField(value = "is_inquiry_now")
     private String isInquiryNow;
 
+    @ApiModelProperty(value = "代理人留点比例")
+    @TableField(value = "ld_proportion")
+    private String ldProportion;
+
     @ApiModelProperty(value = "生成的描述")
     @TableField(exist = false)
     private String desc;

+ 3 - 0
src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCosts.java

@@ -145,6 +145,9 @@ public class AgreementProductCosts implements Serializable {
     @ApiModelProperty(value = "是否现询")
     private String isInquiryNow;
 
+    @ApiModelProperty(value = "代理人留点比例")
+    private String ldProportion;
+
 
     @ApiModelProperty(value = "费用属性")
     private List<PtlAgreementProductCostsAttrLink> costsAttrLinks;

+ 3 - 0
src/main/java/com/ydtech/modules/protocols/entity/vo/AgreementProductCostsSave.java

@@ -145,6 +145,9 @@ public class AgreementProductCostsSave {
     @ApiModelProperty(value = "是否现寻")
     private String isInquiryNow;
 
+    @ApiModelProperty(value = "代理人留点比例")
+    private String ldProportion;
+
 
     @ApiModelProperty(value = "费用属性")
     private List<PtlAgreementUndwrtRulesAttr> costsAttrLinks;

+ 10 - 3
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -80,6 +80,7 @@
                extends="BaseResultMap">
         <result property="agreementName" column="agreement_name" jdbcType="VARCHAR"/>
         <result property="fileStatus" column="fileStatus" jdbcType="VARCHAR"/>
+        <result property="equityType" column="equityType" jdbcType="INTEGER"/>
     </resultMap>
 
     <sql id="Base_Column_List">
@@ -100,9 +101,11 @@
                (select IF(count(0) > 0, 'true', 'false')
                 from pingan_sh_uploafile
                 where sub_order_no = iac.id
-                  AND status = 0) as fileStatus
+                  AND status = 0) as fileStatus,
+               iace.type as equityType
         FROM ins_area_company as iac
                  left join ptl_agreement as pa on pa.id = iac.agreement_id
+                 left join ins_area_company_equity iace on iac.id = iace.sub_order_no
                  INNER JOIN (SELECT company_id, max(createtime) AS max_createtime
                              FROM ins_area_company
                              WHERE orderno = #{orderNo}
@@ -118,10 +121,12 @@
                (select IF(count(0) > 0, 'true', 'false')
                 from pingan_sh_uploafile
                 where sub_order_no = iac.id
-                  AND status = 0) as fileStatus
+                  AND status = 0) as fileStatus,
+            iace.type as equityType
         FROM ins_area_company as iac
                  left join ptl_agreement as pa on pa.id = iac.agreement_id
                  left join ins_orders io on iac.orderno = io.orderno
+                left join ins_area_company_equity iace on iac.id = iace.sub_order_no
         WHERE iac.orderstatus = 3
           and iac.orderno = #{orderNo};
     </select>
@@ -198,7 +203,8 @@
         pa.job_description as jobDescription,
         pa.agreement_title as agreementTitle,
         pa.docking_person as dockingPerson,
-        io.entry_status
+        io.entry_status,
+        iace.type AS type
         FROM
         ins_fee_audit ifa
         LEFT JOIN ins_orders io ON io.orderno = ifa.orderno
@@ -209,6 +215,7 @@
         LEFT JOIN sys_user su2 ON ifa.audituser = su2.id
         LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
         LEFT JOIN esm_ins_company eic ON eic.id = pa.partner_companies_id
+        LEFT JOIN ins_area_company_equity iace ON  iace.sub_order_no = iac.id
         WHERE
         iac.id = ifa.ins_order_no
         AND iac.orderstatus = 3

+ 4 - 1
src/main/resources/mapper/modules/order/InsOrdersMapper.xml

@@ -133,6 +133,7 @@
         <result property="signingTime" column="signingTime" jdbcType="TIMESTAMP"/>
         <result property="payDate" column="payDate" jdbcType="TIMESTAMP"/>
         <result property="partnerCompaniesName" column="partnerCompaniesName" jdbcType="VARCHAR"/>
+        <result property="equityType" column="equityType" jdbcType="INTEGER"/>
         <result property="mergecostrate" column="mergecostrate" jdbcType="DOUBLE"/>
 
     </resultMap>
@@ -254,11 +255,13 @@
                o.entry_status,
                eic.namesimple as partnerCompaniesName,
                iac.merge_cost_rate,
-               iac.extend_info as extendInfo1
+               iac.extend_info as extendInfo1,
+               iace.type as equityType
         from ins_orders as o
                  join ins_area_company iac on o.orderno = iac.orderno
                  LEFT JOIN ptl_agreement pa ON pa.id = iac.agreement_id
                  LEFT JOIN esm_ins_company eic on eic.id = pa.partner_companies_id
+                 left join ins_area_company_equity iace on iace.sub_order_no = iac.id
         where iac.id = #{companyId}
     </select>