Explorar o código

过期代充次数大于0也展示

zoujiajian hai 1 ano
pai
achega
c8c41b7a15

+ 43 - 0
netflix-dao/src/main/java/com/cyksj/model/views/GptUserRechargeNumRecordView.java

@@ -0,0 +1,43 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.SearchBean;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/**
+ * 项目名: yhlxj321312312312312312
+ * 文件名: GptUserRechargeNumRecordView
+ * 创建者: JavaZou
+ * 创建时间:2025/8/13 17:30
+ */
+@Getter
+@Setter
+@SearchBean(tables = "gpt_user_recharge_num_record gu")
+public class GptUserRechargeNumRecordView {
+
+	@DbField("gu.user_id")
+	@JsonIgnore
+	private Long userId;
+
+	@DbField("gu.relation_id")
+	private Long relationId;
+
+	@DbField("ifnull(gu.operator,null,'银河客服')")
+	private String operator;
+
+	/**
+	 * 次数 正为增加 负为扣除
+	 */
+	@DbField("gu.num")
+	private Integer num;
+
+	@DbField("gu.remark")
+	private String remark;
+
+	@DbField("gu.created_time")
+	private Date createdTime;
+}

+ 2 - 1
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -229,7 +229,8 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 		if (StrUtil.isNotBlank(account)) {
 			builder.field(RenewalView::getAccount, account).op(Operator.Contain);
 		}
-		String conditionSql = String.format("(gr.expiry_time is null or gr.expiry_time > '%s'", now);
+		//代充剩余次数大于0/未发车/过期时间
+		String conditionSql = String.format("(gr.recharge_remain_num > 0 or gr.expiry_time is null or gr.expiry_time > '%s'", now);
 		//镜像车票 过期7天后清除
 		//个人店铺和AI店铺 暂不支持过期续费
 		if (cmt == null && StrUtil.isEmpty(customId)) {

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

@@ -1429,4 +1429,28 @@ public class GroupRelationController {
         TicketRenewUpgradeView renewView = groupRelationFrontService.getRenewUpgradeInfo(userId, relationId);
         return GatewayResponse.SUCCESS.newBuilder().toResult(renewView);
     }
+
+    /**
+     * 代充记录
+     */
+    @GetMapping("/get/recharge/record")
+    public Result<List<GptUserRechargeNumRecordView>> getRechargeRecord(Long relationId) {
+        long userId = StpUserUtil.getLoginIdAsLong();
+        List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
+        GroupsRelation relation = relationMapper.selectById(relationId);
+        if (relation == null || !userIdList.contains(relation.getUserId())) {
+            return GatewayResponse.SUCCESS.newBuilder().toResult();
+        }
+        Date filterTime = relation.getStartTime();
+        if (filterTime == null) {
+            filterTime = relation.getSubmitTime();
+        }
+        List<GptUserRechargeNumRecordView> search = beanSearcher.searchAll(GptUserRechargeNumRecordView.class, MapUtils.flatBuilder(request.getParameterMap())
+                .field(GptUserRechargeNumRecordView::getUserId, userIdList).op(Operator.InList)
+                .field(GptUserRechargeNumRecordView::getRelationId, relationId)
+                .field(GptUserRechargeNumRecordView::getCreatedTime, filterTime).op(Operator.GreaterEqual)
+                .orderBy(GptUserRechargeNumRecordView::getCreatedTime).desc()
+                .build());
+        return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+    }
 }