记得上下班打卡 | git大法好,push需谨慎

Commit 8eb5d790 authored by 张国柄's avatar 张国柄

Merge branch 'dev' into test

parents d1edf532 e9a78805
...@@ -20,14 +20,14 @@ public class AdamAddressesParam implements java.io.Serializable { ...@@ -20,14 +20,14 @@ public class AdamAddressesParam implements java.io.Serializable {
@Pattern(regexp = "\\d{11}", message = "手机号格式有误") @Pattern(regexp = "\\d{11}", message = "手机号格式有误")
private String phone; private String phone;
@ApiModelProperty(position = 13, required = true, value = "省份[30]", example = "北京") @ApiModelProperty(position = 13, required = true, value = "省份[30]", example = "北京")
@Pattern(regexp = LnsRegex.Valid.CHINESE_PCD, message = "省份必须为2~30位汉字") @Pattern(regexp = LnsRegex.Valid.CN_PCD, message = "省份必须为2~30位汉字")
private String province; private String province;
@ApiModelProperty(position = 14, required = true, value = "城市[30]", example = "北京城区") @ApiModelProperty(position = 14, required = true, value = "城市[30]", example = "北京城区")
@NotNull() @NotNull()
@Pattern(regexp = LnsRegex.Valid.CHINESE_PCD, message = "城市必须为2~30位汉字") @Pattern(regexp = LnsRegex.Valid.CN_PCD, message = "城市必须为2~30位汉字")
private String city; private String city;
@ApiModelProperty(position = 15, required = true, value = "区县[30]", example = "朝阳区") @ApiModelProperty(position = 15, required = true, value = "区县[30]", example = "朝阳区")
@Pattern(regexp = LnsRegex.Valid.CHINESE_PCD, message = "区县必须为2~30位汉字") @Pattern(regexp = LnsRegex.Valid.CN_PCD, message = "区县必须为2~30位汉字")
private String county; private String county;
@ApiModelProperty(position = 16, required = true, value = "详细地址[100]", example = "广渠路1号创1958园区") @ApiModelProperty(position = 16, required = true, value = "详细地址[100]", example = "广渠路1号创1958园区")
@Size(max = 100) @Size(max = 100)
......
...@@ -23,10 +23,10 @@ public class RefundApplyParam implements Serializable { ...@@ -23,10 +23,10 @@ public class RefundApplyParam implements Serializable {
private String reason; private String reason;
private Double RefundPriceExpress; private BigDecimal RefundPriceExpress;
private List<String> ticketEntityIds; private List<String> ticketEntityIds;
private List<Double> entitiesPrice; private List<BigDecimal> entitiesPrice;
private List<String> ids; private List<String> ids;
......
...@@ -3,6 +3,7 @@ package com.liquidnet.service.kylin.dto.param; ...@@ -3,6 +3,7 @@ package com.liquidnet.service.kylin.dto.param;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
/** /**
* <p> * <p>
...@@ -45,7 +46,7 @@ public class RefundCallbackParam implements Serializable { ...@@ -45,7 +46,7 @@ public class RefundCallbackParam implements Serializable {
private String refund_code; private String refund_code;
private double refund_price; private BigDecimal refund_price;
private String refund_reason; private String refund_reason;
......
...@@ -34,6 +34,9 @@ public class KylinOrderRefundBatchesVo implements Serializable { ...@@ -34,6 +34,9 @@ public class KylinOrderRefundBatchesVo implements Serializable {
private BigDecimal totalAlipay; private BigDecimal totalAlipay;
private BigDecimal totalWepay; private BigDecimal totalWepay;
private Integer totalRefundNum;
private Integer totalCompleteRefundNum;
@ApiModelProperty(value = "添加时间") @ApiModelProperty(value = "添加时间")
private LocalDateTime createdAt; private LocalDateTime createdAt;
......
...@@ -31,6 +31,16 @@ ...@@ -31,6 +31,16 @@
<div class="form-control-static" th:text="${KylinOrderRefundsBatchVo.totalWepay}"> <div class="form-control-static" th:text="${KylinOrderRefundsBatchVo.totalWepay}">
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-2 control-label">总处理数量:</label>
<div class="form-control-static" th:text="${KylinOrderRefundsBatchVo.totalRefundNum}">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label">已完成退款数量:</label>
<div class="form-control-static" th:text="${KylinOrderRefundsBatchVo.totalCompleteRefundNum}">
</div>
</div>
<div class="form-group"> <div class="form-group">
<label class="col-sm-2 control-label">提交时间:</label> <label class="col-sm-2 control-label">提交时间:</label>
<div class="form-control-static" th:text="${KylinOrderRefundsBatchVo.createdAt}"> <div class="form-control-static" th:text="${KylinOrderRefundsBatchVo.createdAt}">
......
...@@ -20,7 +20,6 @@ import com.liquidnet.service.kylin.dao.OrderRefundDao; ...@@ -20,7 +20,6 @@ import com.liquidnet.service.kylin.dao.OrderRefundDao;
import com.liquidnet.service.kylin.dto.param.RefundApplyParam; import com.liquidnet.service.kylin.dto.param.RefundApplyParam;
import com.liquidnet.service.kylin.dto.param.RefundCallbackParam; import com.liquidnet.service.kylin.dto.param.RefundCallbackParam;
import com.liquidnet.service.kylin.dto.param.RefundSearchParam; import com.liquidnet.service.kylin.dto.param.RefundSearchParam;
import com.liquidnet.service.kylin.dto.param.SysDamaiParam;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo; import com.liquidnet.service.kylin.dto.vo.mongo.KylinOrderTicketVo;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo; import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundsVo; import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundsVo;
...@@ -92,13 +91,11 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM ...@@ -92,13 +91,11 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
public ResponseDto refundApply(RefundApplyParam refundApplyParam) { public ResponseDto refundApply(RefundApplyParam refundApplyParam) {
String orderTicketsId = refundApplyParam.getOrderTicketsId(); String orderTicketsId = refundApplyParam.getOrderTicketsId();
List<String> ticketEntityIds = refundApplyParam.getTicketEntityIds(); List<String> ticketEntityIds = refundApplyParam.getTicketEntityIds();
List<Double> entitiesPrice = refundApplyParam.getEntitiesPrice(); List<BigDecimal> entitiesPrice = refundApplyParam.getEntitiesPrice();
Double RefundPriceExpressDouble = refundApplyParam.getRefundPriceExpress(); BigDecimal RefundPriceExpress = refundApplyParam.getRefundPriceExpress();
if (null == RefundPriceExpressDouble) { if (null == RefundPriceExpress) {
RefundPriceExpressDouble = 0.0; RefundPriceExpress = new BigDecimal(0);
} }
BigDecimal RefundPriceExpress = BigDecimal.valueOf(RefundPriceExpressDouble);
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne( KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
new QueryWrapper<KylinOrderTickets>().eq("order_tickets_id", orderTicketsId) new QueryWrapper<KylinOrderTickets>().eq("order_tickets_id", orderTicketsId)
...@@ -121,19 +118,19 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM ...@@ -121,19 +118,19 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
} }
// TODO: 2021/6/16 是否能单独退快递飞 批量退款是否退快递费 现在做的是自动退剩余快递费 // TODO: 2021/6/16 是否能单独退快递飞 批量退款是否退快递费 现在做的是自动退剩余快递费
// 传的快递费不能大于实际的快递费=(支付的快递费-已退的快递费) // 传的快递费不能大于实际的快递费=(支付的快递费-已退的快递费)
Double refundPriceExpressSum = kylinOrderRefundsMapper.RefundPriceExpressSum(// 已退快递费 BigDecimal refundPriceExpressSum = kylinOrderRefundsMapper.RefundPriceExpressSum(// 已退快递费
orderTicketsId, orderTicketsId,
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL
); );
if (null == refundPriceExpressSum) { if (null == refundPriceExpressSum) {
refundPriceExpressSum = 0.0; refundPriceExpressSum = new BigDecimal(0);
} }
if (null == refundApplyParam.getOrderRefundBatchesId() || refundApplyParam.getOrderRefundBatchesId().isEmpty()) { // 不是批量退款 if (null == refundApplyParam.getOrderRefundBatchesId() || refundApplyParam.getOrderRefundBatchesId().isEmpty()) { // 不是批量退款
if (RefundPriceExpress.compareTo(priceExpress.subtract(BigDecimal.valueOf(refundPriceExpressSum))) > 0) { if (RefundPriceExpress.compareTo(priceExpress.subtract(refundPriceExpressSum)) > 0) {
return ResponseDto.failure("快递费不能大于实际减去已退的快递费"); return ResponseDto.failure("快递费不能大于实际减去已退的快递费");
} }
} else { } else {
RefundPriceExpress = priceExpress.subtract(BigDecimal.valueOf(refundPriceExpressSum)); RefundPriceExpress = priceExpress.subtract(refundPriceExpressSum);
} }
// todo 出票未出票 // todo 出票未出票
...@@ -157,22 +154,22 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM ...@@ -157,22 +154,22 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
.ne("is_payment", KylinTableStatusConst.ENTITIES_IS_PAYMENT0) .ne("is_payment", KylinTableStatusConst.ENTITIES_IS_PAYMENT0)
); );
BigDecimal onePrice = priceActual.subtract(priceExpress).divide(BigDecimal.valueOf(allEntitiesCount));//单价 BigDecimal onePrice = priceActual.subtract(priceExpress).divide(BigDecimal.valueOf(allEntitiesCount));//单价
List<Double> realRefundPriceList = new ArrayList<>(); List<BigDecimal> realRefundPriceList = new ArrayList<>();
if (null == refundApplyParam.getOrderRefundBatchesId() || refundApplyParam.getOrderRefundBatchesId().isEmpty()) { // 不是批量退款 if (null == refundApplyParam.getOrderRefundBatchesId() || refundApplyParam.getOrderRefundBatchesId().isEmpty()) { // 不是批量退款
for (int i = 0; i <= ticketEntityIds.size() - 1; i++) { for (int i = 0; i <= ticketEntityIds.size() - 1; i++) {
BigDecimal price = BigDecimal.valueOf(entitiesPrice.get(i)); BigDecimal price = entitiesPrice.get(i);
if (price.compareTo(BigDecimal.ZERO) <= 0) { if (price.compareTo(BigDecimal.ZERO) <= 0) {
return ResponseDto.failure(ErrorMapping.get("20021")); return ResponseDto.failure(ErrorMapping.get("20021"));
} else { } else {
Double refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退 BigDecimal refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退
orderTicketsId, orderTicketsId,
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL, KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL,
ticketEntityIds.get(i) ticketEntityIds.get(i)
); );
if (null == refundedPrice) { if (null == refundedPrice) {
refundedPrice = 0.0; refundedPrice = new BigDecimal(0);
} }
if (price.compareTo(onePrice.subtract(BigDecimal.valueOf(refundedPrice))) > 0) { if (price.compareTo(onePrice.subtract(refundedPrice)) > 0) {
return ResponseDto.failure("超过可退款金额"); return ResponseDto.failure("超过可退款金额");
} }
} }
...@@ -181,17 +178,17 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM ...@@ -181,17 +178,17 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
} else { // 批量 计算入场人订单可退金额 } else { // 批量 计算入场人订单可退金额
List<String> ticketEntityIdsNew = new ArrayList<>(); List<String> ticketEntityIdsNew = new ArrayList<>();
for (int i = 0; i <= ticketEntityIds.size() - 1; i++) { for (int i = 0; i <= ticketEntityIds.size() - 1; i++) {
Double refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退 包含退款中 BigDecimal refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退 包含退款中
orderTicketsId, orderTicketsId,
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL, KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL,
ticketEntityIds.get(i) ticketEntityIds.get(i)
); );
if (null == refundedPrice) { if (null == refundedPrice) {
refundedPrice = 0.0; refundedPrice = new BigDecimal(0);
} }
BigDecimal price = onePrice.subtract(BigDecimal.valueOf(refundedPrice)); // 计算可退金额 BigDecimal price = onePrice.subtract(refundedPrice); // 计算可退金额
if (price.compareTo(BigDecimal.ZERO) > 0) { if (price.compareTo(BigDecimal.ZERO) > 0) {
realRefundPriceList.add(price.doubleValue()); realRefundPriceList.add(price);
ticketEntityIdsNew.add(ticketEntityIds.get(i)); ticketEntityIdsNew.add(ticketEntityIds.get(i));
} }
} }
...@@ -201,7 +198,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM ...@@ -201,7 +198,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefunding( boolean res = kylinRefundsStatusServiceImpl.orderTicketRefunding(
refundApplyParam, orderInfo, orderTicketsId, refundApplyParam, orderInfo, orderTicketsId,
RefundPriceExpress.doubleValue(), RefundPriceExpress,
ticketEntityIds, realRefundPriceList ticketEntityIds, realRefundPriceList
); );
...@@ -240,11 +237,13 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM ...@@ -240,11 +237,13 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
default: default:
return ResponseDto.failure("type类型错误"); return ResponseDto.failure("type类型错误");
case "cancel": case "cancel":
orderRefundStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE}; // orderRefundStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
orderRefundStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT};
orderType = KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY; orderType = KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY;
break; break;
case "reapply": case "reapply":
orderRefundStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE}; // orderRefundStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
orderRefundStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT};
break; break;
case "approved": case "approved":
orderRefundStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE}; orderRefundStatus = new Integer[]{KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUSE};
...@@ -319,7 +318,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM ...@@ -319,7 +318,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
RefundCallbackParam refundCallbackParam = new RefundCallbackParam(); RefundCallbackParam refundCallbackParam = new RefundCallbackParam();
refundCallbackParam.setRefund_code(refundInfo.getRefundCode()); refundCallbackParam.setRefund_code(refundInfo.getRefundCode());
double refundPrice = refundInfo.getPrice().doubleValue() + refundInfo.getPriceExpress().doubleValue(); BigDecimal refundPrice = refundInfo.getPrice().add(refundInfo.getPriceExpress());
refundCallbackParam.setRefund_price(refundPrice); refundCallbackParam.setRefund_price(refundPrice);
refundCallbackParam.setRefund_type("UNKNOWN"); refundCallbackParam.setRefund_type("UNKNOWN");
refundCallbackParam.setRefund_id(refundInfo.getRefundId()); refundCallbackParam.setRefund_id(refundInfo.getRefundId());
...@@ -405,15 +404,15 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM ...@@ -405,15 +404,15 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
new QueryWrapper<KylinOrderTickets>().eq("order_code", orderCode) new QueryWrapper<KylinOrderTickets>().eq("order_code", orderCode)
); );
// 传的快递费不能大于实际的快递费=(支付的快递费-已退的快递费) // 传的快递费不能大于实际的快递费=(支付的快递费-已退的快递费)
Double refundPriceExpressSum = kylinOrderRefundsMapper.RefundPriceExpressSum(// 已退快递费 BigDecimal refundPriceExpressSum = kylinOrderRefundsMapper.RefundPriceExpressSum(// 已退快递费
kylinOrderTickets.getOrderTicketsId(), kylinOrderTickets.getOrderTicketsId(),
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL
); );
if (null == refundPriceExpressSum) { if (null == refundPriceExpressSum) {
refundPriceExpressSum = 0.0; refundPriceExpressSum = new BigDecimal(0);
} }
Double RefundPriceExpress = kylinOrderTickets.getPriceExpress().doubleValue() - refundPriceExpressSum; BigDecimal RefundPriceExpress = kylinOrderTickets.getPriceExpress().subtract(refundPriceExpressSum);
kylinOrderTickets.setPriceExpress(BigDecimal.valueOf(RefundPriceExpress)); kylinOrderTickets.setPriceExpress(RefundPriceExpress);
// 订单关联 获取演出id // 订单关联 获取演出id
KylinOrderTicketRelations kylinOrderTicketRelations = kylinOrderTicketRelationsMapper.selectOne( KylinOrderTicketRelations kylinOrderTicketRelations = kylinOrderTicketRelationsMapper.selectOne(
...@@ -437,14 +436,14 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM ...@@ -437,14 +436,14 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
); );
BigDecimal onePrice = (priceActual.subtract(priceExpress)).divide(BigDecimal.valueOf(allEntitiesCount));//单价 BigDecimal onePrice = (priceActual.subtract(priceExpress)).divide(BigDecimal.valueOf(allEntitiesCount));//单价
for (KylinOrderTicketEntitiesDao entities : entitiesListTemp) { for (KylinOrderTicketEntitiesDao entities : entitiesListTemp) {
Double refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退 包含退款中 BigDecimal refundedPrice = kylinOrderTicketEntitiesMapper.getRefundEntitiesPrice(//已退 包含退款中
kylinOrderTickets.getOrderTicketsId(), kylinOrderTickets.getOrderTicketsId(),
KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL, KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL,
entities.getOrderTicketEntitiesId() entities.getOrderTicketEntitiesId()
); );
BigDecimal canRefundedPrice; BigDecimal canRefundedPrice;
if (null != refundedPrice) { if (null != refundedPrice) {
canRefundedPrice = onePrice.subtract(BigDecimal.valueOf(refundedPrice)); canRefundedPrice = onePrice.subtract(refundedPrice);
} else { } else {
canRefundedPrice = onePrice; canRefundedPrice = onePrice;
} }
......
...@@ -70,8 +70,8 @@ public class KylinRefundExecuteServiceImpl { ...@@ -70,8 +70,8 @@ public class KylinRefundExecuteServiceImpl {
refundApplyParam.setReason(reason); refundApplyParam.setReason(reason);
refundApplyParam.setOrderTicketsId(order.getOrderTicketsId()); refundApplyParam.setOrderTicketsId(order.getOrderTicketsId());
refundApplyParam.setTicketEntityIds(ticketEntityIds); refundApplyParam.setTicketEntityIds(ticketEntityIds);
if (order.getPriceExpress() != null) { if (null != order.getPriceExpress()) {
refundApplyParam.setRefundPriceExpress(order.getPriceExpress().doubleValue()); refundApplyParam.setRefundPriceExpress(order.getPriceExpress());
} }
try { try {
ResponseDto res = kylinOrderRefundsServiceImpl.refundApply(refundApplyParam); ResponseDto res = kylinOrderRefundsServiceImpl.refundApply(refundApplyParam);
......
...@@ -14,8 +14,10 @@ import com.liquidnet.service.kylin.dto.param.RefundBatchApplyParam; ...@@ -14,8 +14,10 @@ import com.liquidnet.service.kylin.dto.param.RefundBatchApplyParam;
import com.liquidnet.service.kylin.dto.param.RefundBatchSearchParam; import com.liquidnet.service.kylin.dto.param.RefundBatchSearchParam;
import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundBatchesVo; import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundBatchesVo;
import com.liquidnet.service.kylin.entity.KylinOrderRefundBatches; import com.liquidnet.service.kylin.entity.KylinOrderRefundBatches;
import com.liquidnet.service.kylin.entity.KylinOrderRefunds;
import com.liquidnet.service.kylin.entity.KylinPerformances; import com.liquidnet.service.kylin.entity.KylinPerformances;
import com.liquidnet.service.kylin.mapper.KylinOrderRefundBatchesMapper; import com.liquidnet.service.kylin.mapper.KylinOrderRefundBatchesMapper;
import com.liquidnet.service.kylin.mapper.KylinOrderRefundsMapper;
import com.liquidnet.service.kylin.mapper.KylinOrderTicketsMapper; import com.liquidnet.service.kylin.mapper.KylinOrderTicketsMapper;
import com.liquidnet.service.kylin.mapper.KylinPerformancesMapper; import com.liquidnet.service.kylin.mapper.KylinPerformancesMapper;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -47,6 +49,9 @@ public class KylinRefundPerformancesAdminServiceImpl { ...@@ -47,6 +49,9 @@ public class KylinRefundPerformancesAdminServiceImpl {
@Autowired @Autowired
private KylinOrderRefundBatchesMapper kylinOrderRefundBatchesMapper; private KylinOrderRefundBatchesMapper kylinOrderRefundBatchesMapper;
@Autowired
private KylinOrderRefundsMapper kylinOrderRefundsMapper;
@Autowired @Autowired
private KylinPerformancesMapper kylinPerformancesMapper; private KylinPerformancesMapper kylinPerformancesMapper;
...@@ -183,15 +188,29 @@ public class KylinRefundPerformancesAdminServiceImpl { ...@@ -183,15 +188,29 @@ public class KylinRefundPerformancesAdminServiceImpl {
} }
} }
public KylinOrderRefundBatchesVo detail(String orderRefundId) { public KylinOrderRefundBatchesVo detail(String refundBatchId) {
KylinOrderRefundBatches data = kylinOrderRefundBatchesMapper.selectOne( KylinOrderRefundBatches data = kylinOrderRefundBatchesMapper.selectOne(
new UpdateWrapper<KylinOrderRefundBatches>() new QueryWrapper<KylinOrderRefundBatches>()
.eq("refund_batch_id", orderRefundId) .eq("refund_batch_id", refundBatchId)
); );
KylinOrderRefundBatchesVo kylinOrderRefundBatchesVo = new KylinOrderRefundBatchesVo(); KylinOrderRefundBatchesVo kylinOrderRefundBatchesVo = new KylinOrderRefundBatchesVo();
BeanUtils.copyProperties(data, kylinOrderRefundBatchesVo); BeanUtils.copyProperties(data, kylinOrderRefundBatchesVo);
Integer totalRefundNum = kylinOrderRefundsMapper.selectCount(
new QueryWrapper<KylinOrderRefunds>()
.eq("order_refund_batches_id", refundBatchId)
);
Integer totalCompleteRefundNum = kylinOrderRefundsMapper.selectCount(
new QueryWrapper<KylinOrderRefunds>()
.eq("order_refund_batches_id", refundBatchId)
.eq("status", KylinTableStatusConst.ORDER_REFUND_STATUS_REFUNDED)
);
kylinOrderRefundBatchesVo.setTotalRefundNum(totalRefundNum);
kylinOrderRefundBatchesVo.setTotalCompleteRefundNum(totalCompleteRefundNum);
return kylinOrderRefundBatchesVo; return kylinOrderRefundBatchesVo;
} }
......
...@@ -91,8 +91,8 @@ public class KylinRefundsStatusServiceImpl { ...@@ -91,8 +91,8 @@ public class KylinRefundsStatusServiceImpl {
public Boolean orderTicketRefunding( public Boolean orderTicketRefunding(
RefundApplyParam refundApplyParam, KylinOrderTickets orderInfo, String orderTicketsId, RefundApplyParam refundApplyParam, KylinOrderTickets orderInfo, String orderTicketsId,
double RefundPriceExpress, BigDecimal RefundPriceExpress,
List<String> ticketEntityIds, List<Double> entitiesPrice List<String> ticketEntityIds, List<BigDecimal> entitiesPrice
) { ) {
if (CollectionUtil.isEmpty(ticketEntityIds)) { if (CollectionUtil.isEmpty(ticketEntityIds)) {
return false; return false;
...@@ -103,7 +103,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -103,7 +103,7 @@ public class KylinRefundsStatusServiceImpl {
String reason = refundApplyParam.getReason(); String reason = refundApplyParam.getReason();
String orderRefundBatchesId = refundApplyParam.getOrderRefundBatchesId(); String orderRefundBatchesId = refundApplyParam.getOrderRefundBatchesId();
// 本次退款票总金额 // 本次退款票总金额
double entitiesPriceSum = entitiesPrice.stream().mapToDouble(Double::doubleValue).sum(); BigDecimal entitiesPriceSum = entitiesPrice.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
// TODO: 2021/5/27 事物 and 部分退款 // TODO: 2021/5/27 事物 and 部分退款
// 更新数据 // 更新数据
...@@ -163,8 +163,8 @@ public class KylinRefundsStatusServiceImpl { ...@@ -163,8 +163,8 @@ public class KylinRefundsStatusServiceImpl {
String orderRefundCode = orderInfo.getOrderCode(); String orderRefundCode = orderInfo.getOrderCode();
String codeNum = StringUtils.leftPad(String.valueOf(refundCount), 3, "0"); String codeNum = StringUtils.leftPad(String.valueOf(refundCount), 3, "0");
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(codeNum)); kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(codeNum));
kylinOrderRefunds.setPrice(BigDecimal.valueOf(entitiesPriceSum)); kylinOrderRefunds.setPrice(entitiesPriceSum);
kylinOrderRefunds.setPriceExpress(BigDecimal.valueOf(RefundPriceExpress)); kylinOrderRefunds.setPriceExpress(RefundPriceExpress);
kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY); kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY);
kylinOrderRefunds.setType(KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY); kylinOrderRefunds.setType(KylinTableStatusConst.ORDER_REFUND_TYPE_APPLY);
...@@ -172,11 +172,11 @@ public class KylinRefundsStatusServiceImpl { ...@@ -172,11 +172,11 @@ public class KylinRefundsStatusServiceImpl {
kylinOrderRefunds.setApplicantName(authName); kylinOrderRefunds.setApplicantName(authName);
kylinOrderRefunds.setApplicantAt(LocalDateTime.now()); kylinOrderRefunds.setApplicantAt(LocalDateTime.now());
kylinOrderRefunds.setReason(reason); kylinOrderRefunds.setReason(reason);
if (RefundPriceExpress > 0 && entitiesPriceSum > 0) { if (RefundPriceExpress.compareTo(BigDecimal.ZERO) > 0 && entitiesPriceSum.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE3); kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE3);
} else if (RefundPriceExpress > 0) { } else if (RefundPriceExpress.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE2); kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE2);
} else if (entitiesPriceSum > 0) { } else if (entitiesPriceSum.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE1); kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE1);
} }
kylinOrderRefunds.setCreatedAt(LocalDateTime.now()); kylinOrderRefunds.setCreatedAt(LocalDateTime.now());
...@@ -192,7 +192,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -192,7 +192,7 @@ public class KylinRefundsStatusServiceImpl {
String orderRefundsEntitiesId = IDGenerator.nextSnowId(); String orderRefundsEntitiesId = IDGenerator.nextSnowId();
kylinOrderRefundEntities.setOrderRefundsEntitiesId(orderRefundsEntitiesId); kylinOrderRefundEntities.setOrderRefundsEntitiesId(orderRefundsEntitiesId);
kylinOrderRefundEntities.setOrderRefundsId(orderRefundsId); kylinOrderRefundEntities.setOrderRefundsId(orderRefundsId);
kylinOrderRefundEntities.setRefundPrice(BigDecimal.valueOf(entitiesPrice.get(i))); kylinOrderRefundEntities.setRefundPrice(entitiesPrice.get(i));
kylinOrderRefundEntities.setOrderTicketEntitiesId(ticketEntityIds.get(i)); kylinOrderRefundEntities.setOrderTicketEntitiesId(ticketEntityIds.get(i));
kylinOrderRefundEntities.setCreatedAt(LocalDateTime.now()); kylinOrderRefundEntities.setCreatedAt(LocalDateTime.now());
int rowsR = kylinOrderRefundsEntitiesMapper.insert(kylinOrderRefundEntities); int rowsR = kylinOrderRefundsEntitiesMapper.insert(kylinOrderRefundEntities);
...@@ -237,7 +237,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -237,7 +237,7 @@ public class KylinRefundsStatusServiceImpl {
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne( KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
new QueryWrapper<KylinOrderTickets>().eq("order_tickets_id", orderTicketsId) new QueryWrapper<KylinOrderTickets>().eq("order_tickets_id", orderTicketsId)
); );
if (orderInfo.getPriceRefund().doubleValue() > 0) { // 已经有退完的 那就是部分退款了 if (orderInfo.getPriceRefund().compareTo(BigDecimal.ZERO) > 0) { // 已经有退完的 那就是部分退款了
newStatus = KylinTableStatusConst.ORDER_STATUS6; newStatus = KylinTableStatusConst.ORDER_STATUS6;
} else { } else {
newStatus = KylinTableStatusConst.ORDER_STATUS1; newStatus = KylinTableStatusConst.ORDER_STATUS1;
...@@ -276,7 +276,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -276,7 +276,7 @@ public class KylinRefundsStatusServiceImpl {
KylinOrderTicketEntities entitiesInfo = kylinOrderTicketEntitiesMapper.selectOne( KylinOrderTicketEntities entitiesInfo = kylinOrderTicketEntitiesMapper.selectOne(
new QueryWrapper<KylinOrderTicketEntities>().eq("order_ticket_entities_id", entitiesId) new QueryWrapper<KylinOrderTicketEntities>().eq("order_ticket_entities_id", entitiesId)
); );
if (entitiesInfo.getRefundPrice().doubleValue() > 0) { // 已经有退完的 那就是部分退款了 if (entitiesInfo.getRefundPrice().compareTo(BigDecimal.ZERO) > 0) { // 已经有退完的 那就是部分退款了
newIsPayment = KylinTableStatusConst.ENTITIES_IS_PAYMENT4; newIsPayment = KylinTableStatusConst.ENTITIES_IS_PAYMENT4;
} else { } else {
newIsPayment = KylinTableStatusConst.ENTITIES_IS_PAYMENT1; newIsPayment = KylinTableStatusConst.ENTITIES_IS_PAYMENT1;
...@@ -406,7 +406,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -406,7 +406,7 @@ public class KylinRefundsStatusServiceImpl {
new QueryWrapper<KylinOrderTickets>() new QueryWrapper<KylinOrderTickets>()
.eq("order_tickets_id", refund.getOrderTicketsId()) .eq("order_tickets_id", refund.getOrderTicketsId())
); );
double refundPrice = refund.getPrice().doubleValue() + refund.getPriceExpress().doubleValue(); BigDecimal refundPrice = refund.getPrice().add(refund.getPriceExpress());
MultiValueMap<String, String> params = new LinkedMultiValueMap(); MultiValueMap<String, String> params = new LinkedMultiValueMap();
params.add("code", oderInfo.getPayCode()); params.add("code", oderInfo.getPayCode());
params.add("order_refund_code", refund.getOrderRefundCode()); params.add("order_refund_code", refund.getOrderRefundCode());
...@@ -468,7 +468,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -468,7 +468,7 @@ public class KylinRefundsStatusServiceImpl {
); );
KylinOrderTicketStatus orderStatusTable = new KylinOrderTicketStatus(); KylinOrderTicketStatus orderStatusTable = new KylinOrderTicketStatus();
int newStatus = 0; int newStatus = 0;
if (refundCallbackParam.getRefund_price() + orderInfo.getPriceRefund().doubleValue() == orderInfo.getPriceActual().doubleValue()) { if (refundCallbackParam.getRefund_price().add(orderInfo.getPriceRefund()).compareTo(orderInfo.getPriceActual()) == 0) {
newStatus = KylinTableStatusConst.ORDER_STATUS4; newStatus = KylinTableStatusConst.ORDER_STATUS4;
} else { } else {
newStatus = KylinTableStatusConst.ORDER_STATUS6; newStatus = KylinTableStatusConst.ORDER_STATUS6;
...@@ -535,11 +535,11 @@ public class KylinRefundsStatusServiceImpl { ...@@ -535,11 +535,11 @@ public class KylinRefundsStatusServiceImpl {
} }
// 订单表 // 订单表
double price = orderInfo.getPriceRefund().doubleValue() + refundCallbackParam.getRefund_price(); BigDecimal price = orderInfo.getPriceRefund().add(refundCallbackParam.getRefund_price());
Integer num = orderInfo.getRefundNumber() + refundNumber; Integer num = orderInfo.getRefundNumber() + refundNumber;
KylinOrderTickets update = new KylinOrderTickets(); KylinOrderTickets update = new KylinOrderTickets();
update.setRefundNumber(num); update.setRefundNumber(num);
update.setPriceRefund(BigDecimal.valueOf(price)); update.setPriceRefund(price);
update.setUpdatedAt(LocalDateTime.now()); update.setUpdatedAt(LocalDateTime.now());
kylinOrderTicketsMapper.update( kylinOrderTicketsMapper.update(
update, new UpdateWrapper<KylinOrderTickets>() update, new UpdateWrapper<KylinOrderTickets>()
...@@ -548,7 +548,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -548,7 +548,7 @@ public class KylinRefundsStatusServiceImpl {
HashMap<String, Object> orderVo = new HashMap<>(); HashMap<String, Object> orderVo = new HashMap<>();
orderVo.put("updatedAt", DateUtil.getNowTime()); orderVo.put("updatedAt", DateUtil.getNowTime());
orderVo.put("priceRefund", BigDecimal.valueOf(price)); orderVo.put("priceRefund", price);
orderVo.put("status", newStatus); orderVo.put("status", newStatus);
orderVo.put("refundNumber", num); orderVo.put("refundNumber", num);
BasicDBObject orderVov = new BasicDBObject("$set", mongoConverter.convertToMongoType(orderVo)); BasicDBObject orderVov = new BasicDBObject("$set", mongoConverter.convertToMongoType(orderVo));
......
...@@ -10,21 +10,53 @@ public class LnsRegex { ...@@ -10,21 +10,53 @@ public class LnsRegex {
* yyyy-MM-dd * yyyy-MM-dd
*/ */
public static final String DATETIME_YMD = "^(((((0[48]|[2468][048]|[3579][26])00))|(([0-9]{2})(0[48]|[2468][048]|[13579][26])))[-|.|/| ]0?2[-|.|/| ]29|(((?!0{1,4})[0-9]{1,4})[-|.|/| ](((0[13-9]|1[0-2]|[13-9])[-|.|/| ](29|30))|((0[13578]|(10|12)|[13578])[-|.|/| ]31)|((0(?:[1-9])|1(?:[0-2])|[1-9])[-|.|/| ](0(?:[1-9])|1[0-9]|2[0-8]|[1-9])))))$"; public static final String DATETIME_YMD = "^(((((0[48]|[2468][048]|[3579][26])00))|(([0-9]{2})(0[48]|[2468][048]|[13579][26])))[-|.|/| ]0?2[-|.|/| ]29|(((?!0{1,4})[0-9]{1,4})[-|.|/| ](((0[13-9]|1[0-2]|[13-9])[-|.|/| ](29|30))|((0[13578]|(10|12)|[13578])[-|.|/| ]31)|((0(?:[1-9])|1(?:[0-2])|[1-9])[-|.|/| ](0(?:[1-9])|1[0-9]|2[0-8]|[1-9])))))$";
/**
* 字母、数字组合
*/
public static final String LETTER_NUMBER = "^[A-Z0-9]+$";
/** /**
* 汉字-姓名(2~20位) * 汉字-姓名(2~20位)
*/ */
public static final String CHINESE_HANZI = "^[\\u4e00-\\u9fa5]{2,20}$"; public static final String CN_HANZI = "^[\\u4e00-\\u9fa5]{2,20}$";
/** /**
* 汉字-省|市|区(2~30位) * 汉字-省|市|区(2~30位)
*/ */
public static final String CHINESE_PCD = "^[\\u4e00-\\u9fa5]{2,30}$"; public static final String CN_PCD = "^[\\u4e00-\\u9fa5]{2,30}$";
/** /**
* 身份证号(15位||18位) * 大陆居民身份证(15位||18位)
*/ */
public static final String CHINESE_ID_CARD = "(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)"; public static final String CN_ID_CARD = "(^\\d{15}$)|(^\\d{18}$)|(^\\d{17}(\\d|X|x)$)";
/** /**
* 字母、数字组合 * 大陆居民身份证
*/ */
public static final String LETTER_NUMBER = "^[A-Z0-9]+$"; public static final String CN_ID_CARD_REF = "/(^[1-9]\\d{5}(18|19|([23]\\d))\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)/";
/**
* 军官证
* 规则: 军/兵/士/文/职/广/(其他中文) + "字第" + 4到8位字母或数字 + "号"
* 样本: 军字第2001988号, 士字第P011816X号
*/
public static final String CN_ID_CARD_MO = "/^[\\x{4E00}-\\x{9FA5}](字第)([0-9a-zA-Z]{4,8})(号?)$/u";
/**
* 中国大陆护照
* 规则: 14/15开头 + 7位数字, P + 7位数字, G/E + 8位数字, S/D + 7或8位数字, 等
* 样本: 141234567, G12345678, P1234567
*/
public static final String CN_ID_CARD_PP = "/^(?:P\\d{7}|[GE]\\d{8}|[SD]\\d{7,8}|[PSD]E\\d{7}|1[45]\\d{7})$/";
/**
* 非中国大陆护照
*/
public static final String CN_ID_CARD_PP_NON = "/^([A-Z0-9]){5,17}$/";
/**
* 港澳居民来往内地通行证
* 规则: H/M + 8位数字, C + 8位数字, C + 1位字母除去IO + 7位数字
* 样本: H12345678
*/
public static final String CN_ID_CARD_HM = "/^(?:[HM]\\d{8}|C[A-HJ-NP-Z0-9]\\d{7})$/";
/**
* 台湾居民来往大陆通行证
* 规则: 8位数字, 18位数字, 10位数字 + 1位英文字母
* 样本: 12345678 1234567890B
*/
public static final String CN_ID_CARD_TW = "/^(?:\\d{8}|\\d{18}|\\d{10}[A-Z])$/";
} }
} }
...@@ -5,6 +5,7 @@ import com.liquidnet.service.kylin.dao.OrderRefundDao; ...@@ -5,6 +5,7 @@ import com.liquidnet.service.kylin.dao.OrderRefundDao;
import com.liquidnet.service.kylin.entity.KylinOrderRefunds; import com.liquidnet.service.kylin.entity.KylinOrderRefunds;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -35,7 +36,7 @@ public interface KylinOrderRefundsMapper extends BaseMapper<KylinOrderRefunds> { ...@@ -35,7 +36,7 @@ public interface KylinOrderRefundsMapper extends BaseMapper<KylinOrderRefunds> {
@Param("ticketEntityIds") List<String> ticketEntityIds @Param("ticketEntityIds") List<String> ticketEntityIds
); );
Double RefundPriceExpressSum( BigDecimal RefundPriceExpressSum(
@Param("orderTicketsId") String orderTicketsId, @Param("orderTicketsId") String orderTicketsId,
@Param("orderRefundStatusCancel") Integer orderRefundStatusCancel @Param("orderRefundStatusCancel") Integer orderRefundStatusCancel
); );
......
...@@ -6,6 +6,7 @@ import com.liquidnet.service.kylin.entity.KylinOrderTicketEntities; ...@@ -6,6 +6,7 @@ import com.liquidnet.service.kylin.entity.KylinOrderTicketEntities;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List; import java.util.List;
/** /**
...@@ -22,13 +23,13 @@ public interface KylinOrderTicketEntitiesMapper extends BaseMapper<KylinOrderTic ...@@ -22,13 +23,13 @@ public interface KylinOrderTicketEntitiesMapper extends BaseMapper<KylinOrderTic
List<KylinOrderTicketEntitiesDao> getRefundEntitiesList(String orderTicketsId); List<KylinOrderTicketEntitiesDao> getRefundEntitiesList(String orderTicketsId);
Double getRefundEntitiesPrice( BigDecimal getRefundEntitiesPrice(
@Param("orderTicketsId") String orderTicketsId, @Param("orderTicketsId") String orderTicketsId,
@Param("orderRefundStatusCancel") Integer orderRefundStatusCancel, @Param("orderRefundStatusCancel") Integer orderRefundStatusCancel,
@Param("orderTicketEntitiesId") String orderTicketEntitiesId @Param("orderTicketEntitiesId") String orderTicketEntitiesId
); );
Double getRefundOverEntitiesPrice( BigDecimal getRefundOverEntitiesPrice(
@Param("orderTicketsId") String orderTicketsId, @Param("orderTicketsId") String orderTicketsId,
@Param("orderRefundStatus") Integer orderRefundStatus, @Param("orderRefundStatus") Integer orderRefundStatus,
@Param("entitiesId") String entitiesId @Param("entitiesId") String entitiesId
......
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
</foreach> </foreach>
</where> </where>
</select> </select>
<select id="RefundPriceExpressSum" resultType="java.lang.Double"> <select id="RefundPriceExpressSum" resultType="java.math.BigDecimal">
SELECT SUM(price_express) SELECT SUM(price_express)
FROM kylin_order_refunds FROM kylin_order_refunds
<where> <where>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
AND a.is_payment != 3 AND a.is_payment != 3
</where> </where>
</select> </select>
<select id="getRefundEntitiesPrice" resultType="java.lang.Double"> <select id="getRefundEntitiesPrice" resultType="java.math.BigDecimal">
SELECT SUM(b.refund_price) SELECT SUM(b.refund_price)
FROM kylin_order_refunds AS a FROM kylin_order_refunds AS a
JOIN kylin_order_refund_entities AS b ON a.order_refunds_id = b.order_refunds_id JOIN kylin_order_refund_entities AS b ON a.order_refunds_id = b.order_refunds_id
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
AND b.order_ticket_entities_id = #{orderTicketEntitiesId} AND b.order_ticket_entities_id = #{orderTicketEntitiesId}
</where> </where>
</select> </select>
<select id="getRefundOverEntitiesPrice" resultType="java.lang.Double"> <select id="getRefundOverEntitiesPrice" resultType="java.math.BigDecimal">
SELECT SUM(b.refund_price) SELECT SUM(b.refund_price)
FROM kylin_order_refunds AS a FROM kylin_order_refunds AS a
JOIN kylin_order_refund_entities AS b ON a.order_refunds_id = b.order_refunds_id JOIN kylin_order_refund_entities AS b ON a.order_refunds_id = b.order_refunds_id
......
...@@ -51,10 +51,38 @@ public class AdamEntersController { ...@@ -51,10 +51,38 @@ public class AdamEntersController {
@ApiOperation(value = "添加入场人") @ApiOperation(value = "添加入场人")
@PostMapping("add") @PostMapping("add")
public ResponseDto<String> add(@RequestBody @Valid AdamEntersParam parameter) { public ResponseDto<String> add(@RequestBody @Valid AdamEntersParam parameter) {
if (1 == parameter.getType()) { switch (parameter.getType()) {// 证件类型:1-大陆身份证,2-港澳通行证,3-台胞证,4-护照,5-军官证
if (!Pattern.matches(LnsRegex.Valid.CHINESE_HANZI, parameter.getName())) { case 1:
if (!Pattern.matches(LnsRegex.Valid.CN_HANZI, parameter.getName())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "姓名必须为2~20位汉字"); return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "姓名必须为2~20位汉字");
} }
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_REF, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "身份证号码不合规");
}
break;
case 2:
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_HM, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "港澳居民来往内地通行证号码不合规");
}
break;
case 3:
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_TW, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "台湾居民来往大陆通行证号码不合规");
}
break;
case 4:
if (Pattern.matches(LnsRegex.Valid.CN_ID_CARD_PP, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "不支持中国大陆护照");
}
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_PP_NON, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "护照号码不合规");
}
break;
case 5:
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_MO, parameter.getIdCard())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "军官证号不合规");
}
break;
} }
List<AdamEntersVo> vos = adamRdmService.getEntersVoByUid(CurrentUtil.getCurrentUid()); List<AdamEntersVo> vos = adamRdmService.getEntersVoByUid(CurrentUtil.getCurrentUid());
...@@ -103,7 +131,7 @@ public class AdamEntersController { ...@@ -103,7 +131,7 @@ public class AdamEntersController {
@PostMapping("edit") @PostMapping("edit")
public ResponseDto<Object> edit(@RequestBody @Valid AdamEntersParam parameter) { public ResponseDto<Object> edit(@RequestBody @Valid AdamEntersParam parameter) {
if (1 == parameter.getType()) { if (1 == parameter.getType()) {
if (!Pattern.matches(LnsRegex.Valid.CHINESE_HANZI, parameter.getName())) { if (!Pattern.matches(LnsRegex.Valid.CN_HANZI, parameter.getName())) {
return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "姓名必须为2~20位汉字"); return ResponseDto.failure(ErrorCode.HTTP_PARAM_ERROR.getCode(), "姓名必须为2~20位汉字");
} }
} }
......
...@@ -202,9 +202,9 @@ public class AdamUserController { ...@@ -202,9 +202,9 @@ public class AdamUserController {
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "idCard", value = "证件号"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "idCard", value = "证件号"),
}) })
@PostMapping(value = {"identity"}) @PostMapping(value = {"identity"})
public ResponseDto<AdamRealInfoVo> identity(@Pattern(regexp = LnsRegex.Valid.CHINESE_HANZI, message = "姓名必须为2~20位汉字") public ResponseDto<AdamRealInfoVo> identity(@Pattern(regexp = LnsRegex.Valid.CN_HANZI, message = "姓名必须为2~20位汉字")
@RequestParam String name, @RequestParam String name,
@Pattern(regexp = LnsRegex.Valid.CHINESE_ID_CARD, message = "身份证号格式有误") @Pattern(regexp = LnsRegex.Valid.CN_ID_CARD_REF, message = "身份证号码不合规")
@RequestParam String idCard) { @RequestParam String idCard) {
log.debug("name:{},idCard:{}", name, idCard); log.debug("name:{},idCard:{}", name, idCard);
AdamRealInfoVo vo = adamUserService.identity(CurrentUtil.getCurrentUid(), name, idCard); AdamRealInfoVo vo = adamUserService.identity(CurrentUtil.getCurrentUid(), name, idCard);
......
...@@ -58,8 +58,8 @@ public class KylinRefundsStatusServiceImpl { ...@@ -58,8 +58,8 @@ public class KylinRefundsStatusServiceImpl {
public Boolean orderTicketRefunding( public Boolean orderTicketRefunding(
KylinOrderTicketVo orderInfo, String orderTicketsId, KylinOrderTicketVo orderInfo, String orderTicketsId,
double RefundPriceExpress, BigDecimal RefundPriceExpress,
List<String> ticketEntityIds, List<Double> entitiesPrice List<String> ticketEntityIds, List<BigDecimal> entitiesPrice
) { ) {
if (CollectionUtil.isEmpty(ticketEntityIds)) { if (CollectionUtil.isEmpty(ticketEntityIds)) {
return false; return false;
...@@ -69,7 +69,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -69,7 +69,7 @@ public class KylinRefundsStatusServiceImpl {
String authName = "system_overtime_order_refund"; String authName = "system_overtime_order_refund";
String reason = "订单支付超时自动退款"; String reason = "订单支付超时自动退款";
// 本次退款票总金额 // 本次退款票总金额
double entitiesPriceSum = entitiesPrice.stream().mapToDouble(Double::doubleValue).sum(); BigDecimal entitiesPriceSum = entitiesPrice.stream().reduce(BigDecimal.ZERO, BigDecimal::add);
// 更新数据 // 更新数据
// 订单状态表 和 缓存 // 订单状态表 和 缓存
...@@ -127,19 +127,19 @@ public class KylinRefundsStatusServiceImpl { ...@@ -127,19 +127,19 @@ public class KylinRefundsStatusServiceImpl {
String orderRefundCode = orderInfo.getOrderCode(); String orderRefundCode = orderInfo.getOrderCode();
String codeNum = StringUtils.leftPad(String.valueOf(5), 3, "0"); String codeNum = StringUtils.leftPad(String.valueOf(5), 3, "0");
kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(codeNum)); kylinOrderRefunds.setOrderRefundCode(orderRefundCode.concat(codeNum));
kylinOrderRefunds.setPrice(BigDecimal.valueOf(entitiesPriceSum)); kylinOrderRefunds.setPrice(entitiesPriceSum);
kylinOrderRefunds.setPriceExpress(BigDecimal.valueOf(RefundPriceExpress)); kylinOrderRefunds.setPriceExpress(RefundPriceExpress);
kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY); kylinOrderRefunds.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_APPLY);
kylinOrderRefunds.setType(KylinTableStatusConst.ORDER_REFUND_TYPE_AUTO); kylinOrderRefunds.setType(KylinTableStatusConst.ORDER_REFUND_TYPE_AUTO);
kylinOrderRefunds.setApplicantId(authId); kylinOrderRefunds.setApplicantId(authId);
kylinOrderRefunds.setApplicantName(authName); kylinOrderRefunds.setApplicantName(authName);
kylinOrderRefunds.setApplicantAt(nowTime); kylinOrderRefunds.setApplicantAt(nowTime);
kylinOrderRefunds.setReason(reason); kylinOrderRefunds.setReason(reason);
if (RefundPriceExpress > 0 && entitiesPriceSum > 0) { if (RefundPriceExpress.compareTo(BigDecimal.ZERO) > 0 && entitiesPriceSum.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE3); kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE3);
} else if (RefundPriceExpress > 0) { } else if (RefundPriceExpress.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE2); kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE2);
} else if (entitiesPriceSum > 0) { } else if (entitiesPriceSum.compareTo(BigDecimal.ZERO) > 0) {
kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE1); kylinOrderRefunds.setRefundCate(KylinTableStatusConst.ORDER_REFUND_CATE1);
} }
kylinOrderRefunds.setCreatedAt(nowTime); kylinOrderRefunds.setCreatedAt(nowTime);
...@@ -158,7 +158,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -158,7 +158,7 @@ public class KylinRefundsStatusServiceImpl {
for (int i = 0; i <= ticketEntityIds.size() - 1; i++) { for (int i = 0; i <= ticketEntityIds.size() - 1; i++) {
String orderRefundsEntitiesId = IDGenerator.nextSnowId(); String orderRefundsEntitiesId = IDGenerator.nextSnowId();
kylinOrderRefundEntities.setOrderRefundsEntitiesId(orderRefundsEntitiesId); kylinOrderRefundEntities.setOrderRefundsEntitiesId(orderRefundsEntitiesId);
kylinOrderRefundEntities.setRefundPrice(BigDecimal.valueOf(entitiesPrice.get(i))); kylinOrderRefundEntities.setRefundPrice(entitiesPrice.get(i));
kylinOrderRefundEntities.setOrderTicketEntitiesId(ticketEntityIds.get(i)); kylinOrderRefundEntities.setOrderTicketEntitiesId(ticketEntityIds.get(i));
sqlsDataD.add(new Object[]{ sqlsDataD.add(new Object[]{
......
...@@ -37,22 +37,22 @@ public class OrderRefundOvertimeServiceImpl implements IKylinOrderRefundsService ...@@ -37,22 +37,22 @@ public class OrderRefundOvertimeServiceImpl implements IKylinOrderRefundsService
public Boolean refundApply(String orderTicketsId) { public Boolean refundApply(String orderTicketsId) {
KylinOrderTicketVo orderInfo = dataUtils.getOrderTicketVo(orderTicketsId); KylinOrderTicketVo orderInfo = dataUtils.getOrderTicketVo(orderTicketsId);
// 快递费 未进行判断 // 快递费 未进行判断
Double RefundPriceExpress = orderInfo.getPriceExpress().doubleValue(); BigDecimal RefundPriceExpress = orderInfo.getPriceExpress();
double priceActual = orderInfo.getPriceActual().doubleValue(); BigDecimal priceActual = orderInfo.getPriceActual();
double priceExpress = orderInfo.getPriceExpress().doubleValue(); BigDecimal priceExpress = orderInfo.getPriceExpress();
// 查询订单入场人 // 查询订单入场人
List<KylinOrderTicketEntitiesVo> entitiesList = orderInfo.getEntitiesVoList(); List<KylinOrderTicketEntitiesVo> entitiesList = orderInfo.getEntitiesVoList();
if (!CollectionUtil.isEmpty(entitiesList)) { if (!CollectionUtil.isEmpty(entitiesList)) {
int allEntitiesCount = entitiesList.size();// 总入场人数量 排出未付款的 用来计算单入场人的价格 int allEntitiesCount = entitiesList.size();// 总入场人数量 排出未付款的 用来计算单入场人的价格
double onePrice = (priceActual - priceExpress) / allEntitiesCount;//单价 BigDecimal onePrice = priceActual.subtract(priceExpress).divide(BigDecimal.valueOf(allEntitiesCount));//单价
for (KylinOrderTicketEntitiesVo entities : entitiesList) { for (KylinOrderTicketEntitiesVo entities : entitiesList) {
entities.setCanRefundedPrice(BigDecimal.valueOf(onePrice)); entities.setCanRefundedPrice(onePrice);
} }
} }
List<String> ticketEntityIds = entitiesList.stream().map(KylinOrderTicketEntities -> KylinOrderTicketEntities.getOrderTicketEntitiesId()).collect(Collectors.toList()); List<String> ticketEntityIds = entitiesList.stream().map(KylinOrderTicketEntities -> KylinOrderTicketEntities.getOrderTicketEntitiesId()).collect(Collectors.toList());
List<Double> entitiesPrice = entitiesList.stream().map(KylinOrderTicketEntities -> KylinOrderTicketEntities.getCanRefundedPrice().doubleValue()).collect(Collectors.toList()); List<BigDecimal> entitiesPrice = entitiesList.stream().map(KylinOrderTicketEntities -> KylinOrderTicketEntities.getCanRefundedPrice()).collect(Collectors.toList());
boolean res = kylinRefundsStatusServiceImpl.orderTicketRefunding( boolean res = kylinRefundsStatusServiceImpl.orderTicketRefunding(
orderInfo, orderTicketsId, orderInfo, orderTicketsId,
......
...@@ -35,7 +35,9 @@ public class DMEntersProcessor extends DataMigrationProcessorService { ...@@ -35,7 +35,9 @@ public class DMEntersProcessor extends DataMigrationProcessorService {
log.info("DM.flush.AdamEntersVo:{}", mongoTemplate.remove(Query.query(Criteria.where("_id").exists(true)), AdamEntersVo.class.getSimpleName()).getDeletedCount()); log.info("DM.flush.AdamEntersVo:{}", mongoTemplate.remove(Query.query(Criteria.where("_id").exists(true)), AdamEntersVo.class.getSimpleName()).getDeletedCount());
} }
String sqlCount = "select count(1) from enters where (type <> 1 or (type = 1 and is_certification = 'yes')) and created_at" + (StringUtils.isBlank(incrDt) ? "<" : ">=") + "curdate()"; String sqlCount = "select count(1) from (\n" +
" select row_number() over (partition by user_id,type,idcode,name order by updated_at desc) rn,e.* from enters e where e.is_certification = 'yes' and e.deleted_at is null and created_at" + (StringUtils.isBlank(incrDt) ? "<" : ">=") + "curdate()\n" +
" ) tk where tk.rn=1 ";
if (null != dg) { if (null != dg) {
sqlCount = sqlCount + " and id%" + dG + "=" + dg; sqlCount = sqlCount + " and id%" + dG + "=" + dg;
} }
......
...@@ -105,10 +105,8 @@ public class DMThirdPartsProcessor extends DataMigrationProcessorService { ...@@ -105,10 +105,8 @@ public class DMThirdPartsProcessor extends DataMigrationProcessorService {
thirdPartyList.add(thirdParty); thirdPartyList.add(thirdParty);
vos.add(vo); vos.add(vo);
if (currentYear.isBefore(createdAt)) {
dmRdmService.setUidByPlatformOpenId(thirdParty.getPlatform(), thirdParty.getOpenId(), uid); dmRdmService.setUidByPlatformOpenId(thirdParty.getPlatform(), thirdParty.getOpenId(), uid);
} }
}
if (thirdPartyList.size() == 500 || (thirdPartyList.size() > 0 && smFlg)) { if (thirdPartyList.size() == 500 || (thirdPartyList.size() > 0 && smFlg)) {
tl += thirdPartyList.size(); tl += thirdPartyList.size();
mongoTemplate.insert(vos, AdamThirdPartInfoVo.class.getSimpleName()); mongoTemplate.insert(vos, AdamThirdPartInfoVo.class.getSimpleName());
......
...@@ -142,8 +142,7 @@ public class DMUserInformationProcessor extends DataMigrationProcessorService { ...@@ -142,8 +142,7 @@ public class DMUserInformationProcessor extends DataMigrationProcessorService {
userInfoList.add(userInfo); userInfoList.add(userInfo);
vos.add(vo); vos.add(vo);
if (StringUtils.length(mobile) == 11 && if (StringUtils.length(mobile) == 11) {
(currentYear.isBefore(createdAt) || currentYear.isBefore(updatedAt))) {
dmRdmService.setUidByMobile(mobile, uid); dmRdmService.setUidByMobile(mobile, uid);
} }
} }
......
...@@ -92,7 +92,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -92,7 +92,7 @@ public class KylinRefundsStatusServiceImpl {
); );
KylinOrderTicketStatus orderStatusTable = new KylinOrderTicketStatus(); KylinOrderTicketStatus orderStatusTable = new KylinOrderTicketStatus();
int newStatus = 0; int newStatus = 0;
if (refundCallbackParam.getRefund_price() + orderInfo.getPriceRefund().doubleValue() == orderInfo.getPriceActual().doubleValue()) { if (refundCallbackParam.getRefund_price().add(orderInfo.getPriceRefund()).compareTo(orderInfo.getPriceActual()) == 0) {
newStatus = KylinTableStatusConst.ORDER_STATUS4; newStatus = KylinTableStatusConst.ORDER_STATUS4;
} else { } else {
newStatus = KylinTableStatusConst.ORDER_STATUS6; newStatus = KylinTableStatusConst.ORDER_STATUS6;
...@@ -159,11 +159,11 @@ public class KylinRefundsStatusServiceImpl { ...@@ -159,11 +159,11 @@ public class KylinRefundsStatusServiceImpl {
} }
// 订单表 // 订单表
double price = orderInfo.getPriceRefund().doubleValue() + refundCallbackParam.getRefund_price(); BigDecimal price = orderInfo.getPriceRefund().add(refundCallbackParam.getRefund_price());
Integer num = orderInfo.getRefundNumber() + refundNumber; Integer num = orderInfo.getRefundNumber() + refundNumber;
KylinOrderTickets update = new KylinOrderTickets(); KylinOrderTickets update = new KylinOrderTickets();
update.setRefundNumber(num); update.setRefundNumber(num);
update.setPriceRefund(BigDecimal.valueOf(price)); update.setPriceRefund(price);
update.setUpdatedAt(LocalDateTime.now()); update.setUpdatedAt(LocalDateTime.now());
kylinOrderTicketsMapper.update( kylinOrderTicketsMapper.update(
update, new UpdateWrapper<KylinOrderTickets>() update, new UpdateWrapper<KylinOrderTickets>()
...@@ -172,7 +172,7 @@ public class KylinRefundsStatusServiceImpl { ...@@ -172,7 +172,7 @@ public class KylinRefundsStatusServiceImpl {
HashMap<String, Object> orderVo = new HashMap<>(); HashMap<String, Object> orderVo = new HashMap<>();
orderVo.put("updatedAt", DateUtil.getNowTime()); orderVo.put("updatedAt", DateUtil.getNowTime());
orderVo.put("priceRefund", BigDecimal.valueOf(price)); orderVo.put("priceRefund", price);
orderVo.put("status", newStatus); orderVo.put("status", newStatus);
orderVo.put("refundNumber", num); orderVo.put("refundNumber", num);
BasicDBObject orderVov = new BasicDBObject("$set", mongoConverter.convertToMongoType(orderVo)); BasicDBObject orderVov = new BasicDBObject("$set", mongoConverter.convertToMongoType(orderVo));
......
...@@ -21,8 +21,6 @@ import org.springframework.data.mongodb.core.query.Query; ...@@ -21,8 +21,6 @@ import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
/** /**
* <p> * <p>
......
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/#build-image)
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/#build-image)
# Getting Started
### Reference Documentation
For further reference, please consider the following sections:
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/)
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.5/maven-plugin/reference/html/#build-image)
* [Spring Native Reference Guide](https://docs.spring.io/spring-native/docs/current/reference/htmlsingle/)
### Additional Links
These additional references should also help you:
* [Configure the Spring AOT Plugin](https://docs.spring.io/spring-native/docs/0.9.2-SNAPSHOT/reference/htmlsingle/#spring-aot-maven)
## Spring Native
This project has been configured to let you generate a lightweight container running a native executable.
Docker should be installed and configured on your machine prior to creating the image, see [the Getting Started section of the reference guide](https://docs.spring.io/spring-native/docs/0.9.2-SNAPSHOT/reference/htmlsingle/#getting-started-buildpacks).
To create the image, run the following goal:
```
$ ./mvnw spring-boot:build-image
```
Then, you can run the app like any other container:
```
$ docker run --rm liquidnet-service-ticket-impl:0.0.1-SNAPSHOT
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment