Parcourir la source

特定规格平台账号客服续费校验展示

zoujiajian il y a 2 ans
Parent
commit
3242473a11

+ 4 - 0
netflix-dao/src/main/java/com/cyksj/mapper/GoodsDonSkuMapper.java

@@ -13,4 +13,8 @@ import java.util.List;
 public interface GoodsDonSkuMapper  extends BaseMapper<GoodsDonSku> {
 
 	List<Long> selectAIMonthSkuIds(@Param("list") List<Long> goodsIds);
+
+	List<Long> getSpecificSkuIdsByGoodsIds(@Param("list") List<Long> aiGoodsIds, @Param("months") Integer months);
+
+	List<Long> getSpecificSkuIdsByGoodsId(@Param("goodsId") Long goodsId, @Param("num") Integer num, @Param("months") Integer months);
 }

+ 63 - 0
netflix-dao/src/main/java/com/cyksj/model/views/AccountSpecificView.java

@@ -0,0 +1,63 @@
+package com.cyksj.model.views;
+
+import com.ejlchina.searcher.bean.DbField;
+import com.ejlchina.searcher.bean.SearchBean;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+/*
+ *项目名: yhlxj
+ *文件名: AccountSpecificView
+ *创建者: JavaZou
+ *创建时间:2023/9/21 15:03
+ */
+@Getter
+@Setter
+@SearchBean(tables = "account a inner join groups_trips gt on gt.account_id = a.id :condition:" +
+		" left join goods_don g on g.id = a.goods_id" +
+		" left join goods_don_sku sku on sku.id = gt.sku_id")
+public class AccountSpecificView {
+	@DbField("a.id")
+	private Long id;
+
+	@DbField("a.account")
+	private String account;
+
+	@DbField("a.password")
+	private String password;
+
+	@DbField("a.start_time")
+	private Date startTime;
+
+	@DbField("a.expiry_time")
+	private Date expiryTime;
+
+	@DbField("a.goods_id")
+	private Long goodsId;
+
+	@DbField("gt.sku_id")
+	private Long skuId;
+
+	@DbField("g.title")
+	private String title;
+
+	@DbField("sku.spec_val")
+	private String specVal;
+
+	@DbField("gt.num")
+	private Integer num;
+
+	@DbField("gt.available_num")
+	private Integer availableNum;
+
+	@DbField("a.remark")
+	private String remark;
+
+	@DbField("a.created_time")
+	private Date createdTime;
+
+	@DbField("a.update_time")
+	private Date updateTime;
+}

+ 16 - 0
netflix-dao/src/main/resources/mapper/GoodsDonSkuMapper.xml

@@ -9,4 +9,20 @@
         </foreach>
         and `months` = 1
     </select>
+
+    <select id="getSpecificSkuIdsByGoodsIds" resultType="java.lang.Long">
+        select id from goods_don_sku where goods_id in
+        <foreach collection="list" item="item" open="(" separator="," close=")">
+            #{item}
+        </foreach>
+        and `months` = #{months}
+    </select>
+
+    <select id="getSpecificSkuIdsByGoodsId" resultType="java.lang.Long">
+        select id
+        from goods_don_sku
+        where goods_id = #{goodsId}
+          and num = #{num}
+          and `months` = #{months}
+    </select>
 </mapper>

+ 46 - 4
netflix-web/src/main/java/com/cyksj/web/controller/manage/account/CmsAccountController.java

@@ -11,9 +11,11 @@ import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
 import com.alibaba.excel.support.ExcelTypeEnum;
+import com.baomidou.mybatisplus.core.toolkit.Assert;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.annotation.Log;
 import com.cyksj.common.annotation.NoSubmit;
+import com.cyksj.common.constant.Constant;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.dto.RedisKey;
 import com.cyksj.dto.Result;
@@ -55,10 +57,7 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -103,6 +102,8 @@ public class CmsAccountController {
 
 	private final RedisService redisService;
 
+	private final GoodsDonSkuMapper goodsDonSkuMapper;
+
 	@GetMapping("/get")
 	@SaCheckPermission("account:view")
 	public Result<SearchResult<AccountView>> get(Long userId, String showId, String nickName, String submitAccount, String expiryStartTime, String expiryEndTime, Boolean expiredAll, Boolean existsExpired, Boolean existsExpiredToday, Integer noChangeMonths) {
@@ -857,4 +858,45 @@ public class CmsAccountController {
 		List<DoubleVerifyClickRefreshRecord> search = beanSearcher.searchAll(DoubleVerifyClickRefreshRecord.class, MapUtils.flatBuilder(request.getParameterMap()).build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
+
+	/**
+	 * MidJourney、ChatGPT年付 ChatGpt独立月付未续费列表
+	 */
+	@GetMapping("/get/specific/account")
+	public Result<SearchResult<AccountSpecificView>> getSpecificAccount() {
+		//获取MidJourney、ChatGPT年付 ChatGpt独立月付 规格id
+		Long chatGptPlusGid = Constant.AI_goodsIds.get(0);
+		//年付
+		List<Long> yearSkuIds = goodsDonSkuMapper.getSpecificSkuIdsByGoodsIds(Constant.AI_goodsIds, 12);
+		//ChatGpt Plus 独立月付
+		List<Long> monthSkuIds = goodsDonSkuMapper.getSpecificSkuIdsByGoodsId(chatGptPlusGid, 1, 1);
+		Collection<Long> skuIds = CollUtil.addAll(yearSkuIds, monthSkuIds);
+		if (skuIds.isEmpty()) {
+			return GatewayResponse.SUCCESS.newBuilder().toResult();
+		}
+		SearchResult<AccountSpecificView> search = beanSearcher.search(AccountSpecificView.class, MapUtils.flatBuilder(request.getParameterMap())
+				.put("condition", String.format("and (select count(*) from groups_relation gr where gr.groups_id = gt.id and gr.user_id != 0 and gr.status in ('validity','outside')) > 0"))
+				.field(AccountSpecificView::getExpiryTime, DateTime.now()).op(Operator.LessThan)
+				.field(AccountSpecificView::getSkuId, skuIds).op(Operator.InList).build());
+		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
+	}
+
+	/**
+	 * 编辑 未续费的账号
+	 */
+	@PutMapping("/update/renew/account")
+	public Result<String> updateRenewAccount(@RequestBody Account account) {
+		Long id = account.getId();
+		Date startTime = account.getStartTime();
+		Date expiryTime = account.getExpiryTime();
+		String remark = account.getRemark();
+		Account byId = accountService.getById(id);
+		Assert.notNull(byId, "账号不存在");
+		byId.setStartTime(startTime);
+		byId.setExpiryTime(expiryTime);
+		byId.setRemark(remark);
+		accountService.updateById(byId);
+		return GatewayResponse.SUCCESS.newBuilder().toResult();
+	}
+
 }