mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-06-10 02:09:49 +08:00
update 使用order_insurance_info表将保险金额的退款情况进行记录,若已退款过保险金额,则不进行分账
This commit is contained in:
@@ -4,6 +4,7 @@ import java.math.BigDecimal;
|
|||||||
|
|
||||||
import com.jsowell.common.annotation.Excel;
|
import com.jsowell.common.annotation.Excel;
|
||||||
import com.jsowell.common.core.domain.BaseEntity;
|
import com.jsowell.common.core.domain.BaseEntity;
|
||||||
|
import lombok.*;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
@@ -13,6 +14,11 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
|||||||
* @author jsowell
|
* @author jsowell
|
||||||
* @date 2025-09-05
|
* @date 2025-09-05
|
||||||
*/
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
public class OrderInsuranceInfo extends BaseEntity {
|
public class OrderInsuranceInfo extends BaseEntity {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -39,51 +45,17 @@ public class OrderInsuranceInfo extends BaseEntity {
|
|||||||
@Excel(name = "保险支付金额")
|
@Excel(name = "保险支付金额")
|
||||||
private BigDecimal tradeAmount;
|
private BigDecimal tradeAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款状态(0-否;1-是)
|
||||||
|
*/
|
||||||
|
@Excel(name = "退款状态")
|
||||||
|
private String refundStatus;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除标识(0-否;1-是)
|
* 删除标识(0-否;1-是)
|
||||||
*/
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
|
|
||||||
public void setId(Long id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInsuranceTransactionCode(String insuranceTransactionCode) {
|
|
||||||
this.insuranceTransactionCode = insuranceTransactionCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInsuranceTransactionCode() {
|
|
||||||
return insuranceTransactionCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrderCode(String orderCode) {
|
|
||||||
this.orderCode = orderCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOrderCode() {
|
|
||||||
return orderCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTradeAmount(BigDecimal tradeAmount) {
|
|
||||||
this.tradeAmount = tradeAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getTradeAmount() {
|
|
||||||
return tradeAmount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDelFlag(String delFlag) {
|
|
||||||
this.delFlag = delFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDelFlag() {
|
|
||||||
return delFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
return new ToStringBuilder(this, ToStringStyle.JSON_STYLE)
|
||||||
@@ -91,6 +63,7 @@ public class OrderInsuranceInfo extends BaseEntity {
|
|||||||
.append("insuranceTransactionCode", getInsuranceTransactionCode())
|
.append("insuranceTransactionCode", getInsuranceTransactionCode())
|
||||||
.append("orderCode", getOrderCode())
|
.append("orderCode", getOrderCode())
|
||||||
.append("tradeAmount", getTradeAmount())
|
.append("tradeAmount", getTradeAmount())
|
||||||
|
.append("refundStatus", getRefundStatus())
|
||||||
.append("createTime", getCreateTime())
|
.append("createTime", getCreateTime())
|
||||||
.append("createBy", getCreateBy())
|
.append("createBy", getCreateBy())
|
||||||
.append("updateTime", getUpdateTime())
|
.append("updateTime", getUpdateTime())
|
||||||
|
|||||||
@@ -188,6 +188,9 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MemberAdapayRecordService memberAdapayRecordService;
|
private MemberAdapayRecordService memberAdapayRecordService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IOrderInsuranceInfoService orderInsuranceInfoService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ClearingBillInfoService clearingBillInfoService;
|
private ClearingBillInfoService clearingBillInfoService;
|
||||||
|
|
||||||
@@ -866,6 +869,10 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
// 白名单支付或者ETC支付
|
// 白名单支付或者ETC支付
|
||||||
logger.debug("订单:{}使用:{},不退保险费", orderBasicInfo.getOrderCode(), OrderPayModeEnum.getPayModeDescription(payMode));
|
logger.debug("订单:{}使用:{},不退保险费", orderBasicInfo.getOrderCode(), OrderPayModeEnum.getPayModeDescription(payMode));
|
||||||
}
|
}
|
||||||
|
// 修改保险订单表的退款状态
|
||||||
|
OrderInsuranceInfo insuranceInfo = orderInsuranceInfoService.getInsuranceInfoByOrderCode(orderBasicInfo.getOrderCode());
|
||||||
|
insuranceInfo.setRefundStatus(Constants.ONE);
|
||||||
|
orderInsuranceInfoService.updateOrderInsuranceInfo(insuranceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2648,15 +2655,24 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 如果保险金额大于0,新增一条分账信息
|
// 如果保险金额大于0,并且没有退款,新增一条分账信息
|
||||||
if (orderBasicInfo.getInsuranceAmount().compareTo(BigDecimal.ZERO) > 0) {
|
if (orderBasicInfo.getInsuranceAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
SplitData insuranceSplit = new SplitData();
|
// 查询该订单的保险退款信息
|
||||||
insuranceSplit.setMemberId(Constants.ZERO);
|
OrderInsuranceInfo insuranceInfo = orderInsuranceInfoService.getInsuranceInfoByOrderCode(orderCode);
|
||||||
insuranceSplit.setAmount(String.valueOf(orderBasicInfo.getInsuranceAmount()));
|
if (insuranceInfo != null) {
|
||||||
insuranceSplit.setFeeFlag(Constants.N);
|
String refundStatus = insuranceInfo.getRefundStatus();
|
||||||
insuranceSplit.setElecAmount(BigDecimal.ZERO);
|
if (Constants.ZERO.equals(refundStatus)) {
|
||||||
insuranceSplit.setServiceAmount(BigDecimal.ZERO);
|
// 退款状态为0,未退款
|
||||||
resultList.add(insuranceSplit);
|
SplitData insuranceSplit = new SplitData();
|
||||||
|
insuranceSplit.setMemberId(Constants.ZERO);
|
||||||
|
insuranceSplit.setAmount(String.valueOf(orderBasicInfo.getInsuranceAmount()));
|
||||||
|
insuranceSplit.setFeeFlag(Constants.N);
|
||||||
|
insuranceSplit.setElecAmount(BigDecimal.ZERO);
|
||||||
|
insuranceSplit.setServiceAmount(BigDecimal.ZERO);
|
||||||
|
|
||||||
|
resultList.add(insuranceSplit);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 下面进行根据adapayMemberId进行金额累加
|
// 下面进行根据adapayMemberId进行金额累加
|
||||||
@@ -5241,10 +5257,22 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService {
|
|||||||
.settleAmount(BigDecimal.ZERO)
|
.settleAmount(BigDecimal.ZERO)
|
||||||
.startType(dto.getStartType())
|
.startType(dto.getStartType())
|
||||||
.build();
|
.build();
|
||||||
if (dto.getInsuranceAmount() != null) {
|
// 保险金额不为 null 并且 > 0
|
||||||
if (dto.getInsuranceAmount().compareTo(BigDecimal.ZERO) > 0) {
|
if (dto.getInsuranceAmount() != null && dto.getInsuranceAmount().compareTo(BigDecimal.ZERO) > 0) {
|
||||||
orderBasicInfo.setInsuranceAmount(dto.getInsuranceAmount());
|
orderBasicInfo.setInsuranceAmount(dto.getInsuranceAmount());
|
||||||
}
|
CompletableFuture.runAsync(() -> {
|
||||||
|
try {
|
||||||
|
// 异步创建保险订单,将信息插入保险订单表
|
||||||
|
OrderInsuranceInfo insuranceInfo = OrderInsuranceInfo.builder()
|
||||||
|
.orderCode(orderCode)
|
||||||
|
.tradeAmount(dto.getInsuranceAmount())
|
||||||
|
.refundStatus(Constants.ZERO)
|
||||||
|
.build();
|
||||||
|
orderInsuranceInfoService.insertOrderInsuranceInfo(insuranceInfo);
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("异步创建保险订单 error", e);
|
||||||
|
}
|
||||||
|
}, executor);
|
||||||
}
|
}
|
||||||
if (StringUtils.equals(OrderTypeEnum.MERGE_CHARGE_ORDER.getValue(), dto.getOrderType())) {
|
if (StringUtils.equals(OrderTypeEnum.MERGE_CHARGE_ORDER.getValue(), dto.getOrderType())) {
|
||||||
// 并充订单
|
// 并充订单
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class OrderInsuranceInfoServiceImpl implements IOrderInsuranceInfoService
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public int updateOrderInsuranceInfo(OrderInsuranceInfo orderInsuranceInfo) {
|
public int updateOrderInsuranceInfo(OrderInsuranceInfo orderInsuranceInfo) {
|
||||||
orderInsuranceInfo.setUpdateTime(DateUtils.getNowDate());
|
// orderInsuranceInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
return orderInsuranceInfoMapper.updateOrderInsuranceInfo(orderInsuranceInfo);
|
return orderInsuranceInfoMapper.updateOrderInsuranceInfo(orderInsuranceInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
<result property="insuranceTransactionCode" column="insurance_transaction_code" />
|
<result property="insuranceTransactionCode" column="insurance_transaction_code" />
|
||||||
<result property="orderCode" column="order_code" />
|
<result property="orderCode" column="order_code" />
|
||||||
<result property="tradeAmount" column="trade_amount" />
|
<result property="tradeAmount" column="trade_amount" />
|
||||||
|
<result property="refundStatus" column="refund_status"/>
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="createBy" column="create_by" />
|
<result property="createBy" column="create_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
@@ -17,12 +18,12 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectOrderInsuranceInfoVo">
|
<sql id="selectOrderInsuranceInfoVo">
|
||||||
select id, insurance_transaction_code, order_code, trade_amount, create_time, create_by, update_time, update_by, del_flag from order_insurance_info
|
select id, insurance_transaction_code, order_code, trade_amount, refund_status, create_time, create_by, update_time, update_by, del_flag from order_insurance_info
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
id, insurance_transaction_code, order_code, trade_amount, create_time, create_by, update_time, update_by, del_flag
|
id, insurance_transaction_code, order_code, trade_amount, trade_amount, create_time, create_by, update_time, update_by, del_flag
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectOrderInsuranceInfoList" parameterType="com.jsowell.pile.domain.OrderInsuranceInfo" resultMap="OrderInsuranceInfoResult">
|
<select id="selectOrderInsuranceInfoList" parameterType="com.jsowell.pile.domain.OrderInsuranceInfo" resultMap="OrderInsuranceInfoResult">
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
<if test="insuranceTransactionCode != null">insurance_transaction_code,</if>
|
<if test="insuranceTransactionCode != null">insurance_transaction_code,</if>
|
||||||
<if test="orderCode != null">order_code,</if>
|
<if test="orderCode != null">order_code,</if>
|
||||||
<if test="tradeAmount != null">trade_amount,</if>
|
<if test="tradeAmount != null">trade_amount,</if>
|
||||||
|
<if test="refundStatus != null">refund_status</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="createBy != null">create_by,</if>
|
<if test="createBy != null">create_by,</if>
|
||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
@@ -55,6 +57,7 @@
|
|||||||
<if test="insuranceTransactionCode != null">#{insuranceTransactionCode},</if>
|
<if test="insuranceTransactionCode != null">#{insuranceTransactionCode},</if>
|
||||||
<if test="orderCode != null">#{orderCode},</if>
|
<if test="orderCode != null">#{orderCode},</if>
|
||||||
<if test="tradeAmount != null">#{tradeAmount},</if>
|
<if test="tradeAmount != null">#{tradeAmount},</if>
|
||||||
|
<if test="refundStatus != null">#{refundStatus},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="createBy != null">#{createBy},</if>
|
<if test="createBy != null">#{createBy},</if>
|
||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
@@ -69,6 +72,7 @@
|
|||||||
<if test="insuranceTransactionCode != null">insurance_transaction_code = #{insuranceTransactionCode},</if>
|
<if test="insuranceTransactionCode != null">insurance_transaction_code = #{insuranceTransactionCode},</if>
|
||||||
<if test="orderCode != null">order_code = #{orderCode},</if>
|
<if test="orderCode != null">order_code = #{orderCode},</if>
|
||||||
<if test="tradeAmount != null">trade_amount = #{tradeAmount},</if>
|
<if test="tradeAmount != null">trade_amount = #{tradeAmount},</if>
|
||||||
|
<if test="refundStatus != null">refund_status = #{refundStatus},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="createBy != null">create_by = #{createBy},</if>
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user