Răsfoiți Sursa

fix cc退款详情

zoujiajian 6 luni în urmă
părinte
comite
0d343ca7aa

+ 20 - 0
netflix-dao/src/main/java/com/cyksj/model/dto/CcRefundDto.java

@@ -0,0 +1,20 @@
+package com.cyksj.model.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * 项目名: yhlxj11111111
+ * 文件名: CcRefundDto
+ * 创建者: JavaZou
+ * 创建时间:2026/2/2 13:35
+ */
+@Getter
+@Setter
+public class CcRefundDto {
+	private Long remainDays;
+
+	private BigDecimal deductMoney;
+}

+ 2 - 2
netflix-service/src/main/java/com/cyksj/service/relation/GroupRelationFrontService.java

@@ -1,6 +1,7 @@
 package com.cyksj.service.relation;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.cyksj.model.dto.CcRefundDto;
 import com.cyksj.model.dto.NetflixRecoverReceivedGptConditionDto;
 import com.cyksj.model.dto.OrderRefundDto;
 import com.cyksj.model.entity.GoodsDonSku;
@@ -16,7 +17,6 @@ import com.cyksj.model.response.NetflixRefundInfoResp;
 import com.cyksj.model.views.*;
 import com.ejlchina.searcher.SearchResult;
 
-import java.math.BigDecimal;
 import java.util.List;
 
 /*
@@ -137,7 +137,7 @@ public interface GroupRelationFrontService {
 
 	OrderRefundDto getYoutubeRefundInfo(long userId, Long relationId);
 
-	BigDecimal getCcRemainDeductMoney(long userId);
+	CcRefundDto getCcRemainDeductMoney(long userId);
 
 	void ccRefund(long userId) throws Exception;
 

+ 13 - 9
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -2686,26 +2686,30 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 	}
 
 	@Override
-	public BigDecimal getCcRemainDeductMoney(long userId) {
+	public CcRefundDto getCcRemainDeductMoney(long userId) {
 		List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
 		GroupsRelationView relationView = beanSearcher.searchFirst(GroupsRelationView.class, MapUtils.builder()
 				.field(GroupsRelationView::getGoodsId, Constant.CLAUDE_CODE_GOODS_ID)
 				.field(GroupsRelationView::getUserId, userIdList).op(Operator.InList)
 				.field(GroupsRelationView::getExpiryTime, DateTime.now()).op(Operator.GreaterThan)
 				.build());
+		CcRefundDto refundDto = new CcRefundDto();
 		if (relationView == null) {
-			return BigDecimal.ZERO;
+			refundDto.setDeductMoney(BigDecimal.ZERO);
+		} else {
+			Long relationId = relationView.getId();
+			ClaudeCodeUser claudeCodeUser = claudeCodeUserMapper.selectOne(Wrappers.lambdaQuery(ClaudeCodeUser.class).eq(ClaudeCodeUser::getRelationId, relationId).last("limit 1"));
+			OrderDon oriOrderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getRelationId, relationId).in(OrderDon::getUserId, userIdList).notIn(OrderDon::getStatus, Constant.noOrderAllStatus).eq(OrderDon::getOrderType, 1).orderByDesc(OrderDon::getId).last("limit 1"));
+			ClaudeCodeDeductDto claudeCodeDeductDto = claudeCodeService.getDeductMoney(relationId, oriOrderDon.getSkuId(), claudeCodeUser.getRenewSkuId(), claudeCodeUser.getRenewOrderId(), claudeCodeUser.getRenewExpiryTime(), relationView.getStartTime(), relationView.getExpiryTime(), DateTime.now(), userIdList, null);
+			refundDto.setDeductMoney(claudeCodeDeductDto.getDeductMoney());
+			refundDto.setRemainDays(DateUtil.betweenDay(DateTime.now(), relationView.getExpiryTime(), false)+ 1);
 		}
-		Long relationId = relationView.getId();
-		ClaudeCodeUser claudeCodeUser = claudeCodeUserMapper.selectOne(Wrappers.lambdaQuery(ClaudeCodeUser.class).eq(ClaudeCodeUser::getRelationId, relationId).last("limit 1"));
-		OrderDon oriOrderDon = orderDonMapper.selectOne(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getRelationId, relationId).in(OrderDon::getUserId, userIdList).notIn(OrderDon::getStatus, Constant.noOrderAllStatus).eq(OrderDon::getOrderType, 1).orderByDesc(OrderDon::getId).last("limit 1"));
-		ClaudeCodeDeductDto claudeCodeDeductDto = claudeCodeService.getDeductMoney(relationId, oriOrderDon.getSkuId(), claudeCodeUser.getRenewSkuId(), claudeCodeUser.getRenewOrderId(), claudeCodeUser.getRenewExpiryTime(), relationView.getStartTime(), relationView.getExpiryTime(), DateTime.now(), userIdList, null);
-		return claudeCodeDeductDto.getDeductMoney();
+		return refundDto;
 	}
 
 	@Override
 	public void ccRefund(long userId) throws Exception {
-		BigDecimal ccRemainDeductMoney = getCcRemainDeductMoney(userId);
+		BigDecimal ccRemainDeductMoney = getCcRemainDeductMoney(userId).getDeductMoney();
 		if (ccRemainDeductMoney.compareTo(BigDecimal.ZERO) == 0) {
 			throw BusinessRuntimeException.getInstance("车票剩余价值为0,无法退款");
 		}
@@ -2728,7 +2732,7 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 
 	@Override
 	public void ccTrans(long userId) {
-		BigDecimal ccRemainDeductMoney = getCcRemainDeductMoney(userId);
+		BigDecimal ccRemainDeductMoney = getCcRemainDeductMoney(userId).getDeductMoney();
 		if (ccRemainDeductMoney.compareTo(BigDecimal.ZERO) == 0) {
 			throw BusinessRuntimeException.getInstance("车票剩余价值为0,不可转换");
 		}

+ 3 - 3
netflix-web/src/main/java/com/cyksj/web/controller/group/GroupRelationController.java

@@ -1633,10 +1633,10 @@ public class GroupRelationController {
      * cc车票剩余价值
      */
     @GetMapping("/get/remain/deductMoney")
-    public Result<BigDecimal> getCcRemainDeductMoney() {
+    public Result<CcRefundDto> getCcRemainDeductMoney() {
         long userId = StpUserUtil.getLoginIdAsLong();
-        BigDecimal ccRemainDeductMoney = groupRelationFrontService.getCcRemainDeductMoney(userId);
-        return GatewayResponse.SUCCESS.newBuilder().toResult(ccRemainDeductMoney);
+        CcRefundDto refundDto = groupRelationFrontService.getCcRemainDeductMoney(userId);
+        return GatewayResponse.SUCCESS.newBuilder().toResult(refundDto);
     }
 
     /**