فهرست منبع

车票补偿天数记录

zoujiajian 9 ماه پیش
والد
کامیت
2de7867086

+ 5 - 0
netflix-dao/src/main/java/com/cyksj/model/entity/GroupsRelation.java

@@ -218,6 +218,11 @@ public class GroupsRelation extends BaseEntity {
      */
     private Integer reservedDays;
 
+    /**
+     * 补偿 天数
+     */
+    private Integer compensationDays;
+
 	@AllArgsConstructor
     @Getter
     public enum Status{

+ 10 - 0
netflix-dao/src/main/java/com/cyksj/model/views/OrderDonUserRefundDetailView.java

@@ -26,6 +26,16 @@ public class OrderDonUserRefundDetailView {
 	@DbField("count(if(status = 'refund',1,NULL))")
 	private Integer refundOrders;
 
+	/**
+	 * 订单对应车票剩余时长
+	 */
+	private Integer remainsDays;
+
+	/**
+	 * 车票补偿时长
+	 */
+	private Integer compensationDays;
+
 
 	@Getter
 	@Setter

+ 2 - 0
netflix-service/src/main/java/com/cyksj/service/mange/impl/CmsOrderDonServiceImpl.java

@@ -852,6 +852,8 @@ public class CmsOrderDonServiceImpl extends ServiceImpl<OrderDonMapper,OrderDon>
             newRelation.setGptTaskId(relation.getGptTaskId());
             newRelation.setCardKey(relation.getCardKey());
             newRelation.setGptToken(relation.getGptToken());
+            //补偿时长
+            newRelation.setCompensationDays(relation.getCompensationDays());
 
             //清除原先车票
             relation.setNewRelationId(newRelation.getId());

+ 11 - 1
netflix-web/src/main/java/com/cyksj/web/controller/manage/CmsOrderController.java

@@ -1241,7 +1241,7 @@ public class CmsOrderController {
 	 * 用户退款详情
 	 */
 	@GetMapping("/get/user/refund/detail")
-	public Result<OrderDonUserRefundDetailView> getUserRefundDetail(Long userId) {
+	public Result<OrderDonUserRefundDetailView> getUserRefundDetail(Long userId, Long orderId) {
 		if (userId == null || userId == 0) {
 			return GatewayResponse.SUCCESS.newBuilder().toResult();
 		}
@@ -1249,6 +1249,7 @@ public class CmsOrderController {
 		try {
 			userIdList = userBindRelationService.getRelationUserIdList(userId, null);
 		} catch (Exception e) {
+			userIdList = List.of(userId);
 		}
 		String userIds = null;
 		if (CollUtil.isNotEmpty(userIdList)) {
@@ -1261,6 +1262,15 @@ public class CmsOrderController {
 			builder.put("uid", String.format(" and user_id = %s", userId));
 		}
 		OrderDonUserRefundDetailView orderDonUserRefundDetailView = beanSearcher.searchFirst(OrderDonUserRefundDetailView.class, builder.build());
+		OrderDon orderDon = orderDonMapper.selectById(orderId);
+		if (orderDon != null && orderDon.getRelationId() > 0) {
+			GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class).eq(GroupsRelation::getId, orderDon.getRelationId()).in(GroupsRelation::getUserId, userIdList));
+			if (relation.getExpiryTime() != null && relation.getExpiryTime().after(DateTime.now())) {
+				Long remainDays = DateUtil.betweenDay(DateTime.now(), relation.getExpiryTime(), false);
+				orderDonUserRefundDetailView.setRemainsDays(remainDays.intValue());
+				orderDonUserRefundDetailView.setCompensationDays(relation.getCompensationDays());
+			}
+		}
 		return GatewayResponse.SUCCESS.newBuilder().toResult(orderDonUserRefundDetailView);
 	}
 

+ 3 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/statistics/StatisticsDataController.java

@@ -234,6 +234,9 @@ public class StatisticsDataController {
 		if (relation.getReservedDays() != null && relation.getReservedDays() > 0) {
 			relation.setReservedDays(relation.getReservedDays() + incrExpiryTimeRecord.getIncrExpiryDays());
 		}
+		Integer compensationDays = relation.getCompensationDays() + incrExpiryTimeRecord.getIncrExpiryDays();
+		//小于0
+		relation.setCompensationDays(compensationDays <= 0 ? 0 : compensationDays);
 		groupsRelationMapper.updateById(relation);
 
 		//扣除镜像过期时间