ThreeUserOrderVo.java 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. package com.ydtech.modules.equity.model.request;
  2. import com.alibaba.fastjson.JSON;
  3. import com.fasterxml.jackson.annotation.JsonProperty;
  4. import com.ydtech.modules.admin.model.SysUser;
  5. import com.ydtech.modules.equity.model.InsAreaCompanyEquity;
  6. import com.ydtech.modules.equity.model.response.LocalEquityPackageAssociation;
  7. import com.ydtech.modules.equity.model.response.LocalEquityPackagePage;
  8. import com.ydtech.utils.StringUtils;
  9. import io.swagger.annotations.ApiModelProperty;
  10. import lombok.Data;
  11. import org.springframework.beans.BeanUtils;
  12. import java.math.BigDecimal;
  13. import java.util.ArrayList;
  14. import java.util.Date;
  15. import java.util.List;
  16. /**
  17. * @version
  18. * @author: hxl
  19. * @Date: 2025/4/30 14:41
  20. * @Description: 三方下单实体
  21. */
  22. @Data
  23. public class ThreeUserOrderVo extends BaseRequest {
  24. @ApiModelProperty(value = "子订单id")
  25. @JsonProperty("orderId")
  26. private String orderId;
  27. @ApiModelProperty(value = "代客下单用户id")
  28. @JsonProperty("orderUserId")
  29. private String orderUserId;
  30. @ApiModelProperty(value = "代客下单用户名称")
  31. @JsonProperty("orderUserName")
  32. private String orderUserName;
  33. @ApiModelProperty(value = "代客下单类型 1.渠道 2.代理人 3.电销")
  34. @JsonProperty("orderUserType")
  35. private Integer orderUserType;
  36. @ApiModelProperty(value = "代客下单手机号")
  37. @JsonProperty("orderUserPhone")
  38. private String orderUserPhone;
  39. @ApiModelProperty(value = "代客下单身份证号")
  40. @JsonProperty("orderUserIdcard")
  41. private String orderUserIdcard;
  42. @ApiModelProperty(value = "三方用户id")
  43. @JsonProperty("threeUserId")
  44. private String threeUserId;
  45. @ApiModelProperty(value = "投保人姓名")
  46. @JsonProperty("applyName")
  47. private String applyName;
  48. @ApiModelProperty(value = "投保人身份证号")
  49. @JsonProperty("applyIdcard")
  50. private String applyIdcard;
  51. @ApiModelProperty(value = "投保人电话")
  52. @JsonProperty("applyIdcard")
  53. private String applyPhone;
  54. @ApiModelProperty(value = "被保人姓名")
  55. @JsonProperty("insureName")
  56. private String insureName;
  57. @ApiModelProperty(value = "被保人身份证号")
  58. @JsonProperty("insureIdcard")
  59. private String insureIdcard;
  60. @ApiModelProperty(value = "被保人电话")
  61. @JsonProperty("insurePhone")
  62. private String insurePhone;
  63. @ApiModelProperty(value = "车主姓名")
  64. @JsonProperty("ownerName")
  65. private String ownerName;
  66. @ApiModelProperty(value = "车主身份证号")
  67. @JsonProperty("ownerIdcard")
  68. private String ownerIdcard;
  69. @ApiModelProperty(value = "车主电话")
  70. @JsonProperty("ownerPhone")
  71. private String ownerPhone;
  72. @ApiModelProperty(value = "返佣金额")
  73. @JsonProperty("orderMoney")
  74. private BigDecimal orderMoney;
  75. @ApiModelProperty(value = "剩余金额(抵扣积分)")
  76. @JsonProperty("surplusMoney")
  77. private BigDecimal surplusMoney;
  78. // 新增 字段
  79. @ApiModelProperty(value = "人员类型(1.代理人 2. 投保人 3.被保人 4.车主)")
  80. @JsonProperty("type")
  81. private Integer type;
  82. @ApiModelProperty(value = "权益卷列表")
  83. @JsonProperty("rightsInfoVoList")
  84. private List<ThreeRightsInfoVo> rightsInfoVoList;
  85. public ThreeUserOrderVo(String companyId, InsAreaCompanyEquity equity, String appkey, SysUser user) {
  86. this.orderId = companyId;
  87. this.threeUserId = appkey;
  88. if(equity.getReceiveType().equals(0)){
  89. this.applyName = equity.getReceiveName();
  90. this.applyPhone = equity.getReceivePhone();
  91. this.applyIdcard = equity.getReceiveIdentify();
  92. this.type = 2;
  93. }else if(equity.getReceiveType().equals(1)){
  94. this.insureName = equity.getReceiveName();
  95. this.insurePhone = equity.getReceivePhone();
  96. this.insureIdcard = equity.getReceiveIdentify();
  97. this.type = 3;
  98. }else if(equity.getReceiveType().equals(2)){
  99. this.ownerName = equity.getReceiveName();
  100. this.ownerPhone = equity.getReceivePhone();
  101. this.ownerIdcard = equity.getReceiveIdentify();
  102. this.type = 4;
  103. }
  104. this.orderMoney = equity.getOrderMoney();
  105. this.surplusMoney = equity.getPoint();
  106. this.rightsInfoVoList = ThreeRightsInfoVo.coverList(equity.getEquityInfo());
  107. if(StringUtils.isBlank(user.getDeptType())){
  108. this.orderUserType = 0;
  109. }else{
  110. this.orderUserType = Integer.parseInt(user.getDeptType());
  111. }
  112. this.orderUserId = user.getId();
  113. this.orderUserName = user.getName();
  114. this.orderUserPhone = user.getMobile();
  115. this.orderUserIdcard = user.getIdentity();
  116. }
  117. @Data
  118. public static class ThreeRightsInfoVo {
  119. @ApiModelProperty(value = "权益卷Id")
  120. @JsonProperty("rightsInfoId")
  121. private String rightsInfoId;
  122. @ApiModelProperty(value = "权益卷套餐Id")
  123. @JsonProperty("courseId")
  124. private String courseId;
  125. @ApiModelProperty(value = "权益卷个数")
  126. @JsonProperty("number")
  127. private Integer number;
  128. @ApiModelProperty(value = "类型(1.兑换券 2.折扣卷 3.抵现劵)")
  129. @JsonProperty("type")
  130. private String type;
  131. @ApiModelProperty(value = "权益名称")
  132. @JsonProperty("rightsName")
  133. private String rightsName;
  134. @ApiModelProperty(value = "分类")
  135. @JsonProperty("classify")
  136. private String classify;
  137. @ApiModelProperty(value = "折扣值")
  138. @JsonProperty("rebate")
  139. private String rebate;
  140. @ApiModelProperty(value = "抵现金额")
  141. @JsonProperty("amount")
  142. private java.math.BigDecimal amount;
  143. @ApiModelProperty(value = "权益图片")
  144. @JsonProperty("rightsPicture")
  145. private String rightsPicture;
  146. @ApiModelProperty(value = "市场售价")
  147. @JsonProperty("marketPrice")
  148. private BigDecimal marketPrice;
  149. @ApiModelProperty(value = "协议价")
  150. @JsonProperty("contractRate")
  151. private BigDecimal contractRate;
  152. @ApiModelProperty(value = "三方结算价格")
  153. @JsonProperty("settlePrice")
  154. private BigDecimal settlePrice;
  155. @ApiModelProperty(value = "使用有限期类型(1.用户领取后生效2.三方用户赠送时间起3.固定时间段4.长期可用)")
  156. @JsonProperty("useCondition")
  157. private String useCondition;
  158. @ApiModelProperty(value = "天数")
  159. @JsonProperty("dayNum")
  160. private Integer dayNum;
  161. @ApiModelProperty(value = "开始时间")
  162. @JsonProperty("startTime")
  163. private Date startTime;
  164. @ApiModelProperty(value = "结束时间")
  165. @JsonProperty("endTime")
  166. private Date endTime;
  167. public static List<ThreeRightsInfoVo> coverList(String equityInfo) {
  168. List<ThreeRightsInfoVo> infoVoList = new ArrayList<>();
  169. LocalEquityPackagePage packagevo = JSON.parseObject(equityInfo, LocalEquityPackagePage.class);
  170. List<LocalEquityPackageAssociation> localEquityPackageAssociationList = packagevo.getLocalEquityPackageAssociationList();
  171. for (LocalEquityPackageAssociation localEquityPackageAssociation : localEquityPackageAssociationList) {
  172. ThreeRightsInfoVo threeRightsInfoVo = new ThreeRightsInfoVo();
  173. BeanUtils.copyProperties(localEquityPackageAssociation,threeRightsInfoVo);
  174. threeRightsInfoVo.setRightsInfoId(localEquityPackageAssociation.getRightsId());
  175. threeRightsInfoVo.setCourseId(localEquityPackageAssociation.getRightsPackageId());
  176. infoVoList.add(threeRightsInfoVo);
  177. }
  178. return infoVoList;
  179. }
  180. }
  181. }