|
@@ -1,7 +1,6 @@
|
|
|
package com.cyksj.web.controller.manage.statistics;
|
|
package com.cyksj.web.controller.manage.statistics;
|
|
|
|
|
|
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
-import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
@@ -42,6 +41,7 @@ import com.ejlchina.searcher.param.Operator;
|
|
|
import com.ejlchina.searcher.util.MapBuilder;
|
|
import com.ejlchina.searcher.util.MapBuilder;
|
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
import com.ejlchina.searcher.util.MapUtils;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -63,6 +63,7 @@ import java.util.stream.Collectors;
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
|
@RequestMapping("/manager/statistics")
|
|
@RequestMapping("/manager/statistics")
|
|
|
|
|
+@Slf4j
|
|
|
public class StatisticsDataController {
|
|
public class StatisticsDataController {
|
|
|
|
|
|
|
|
private final StatisticsDataService statisticsDataService;
|
|
private final StatisticsDataService statisticsDataService;
|
|
@@ -212,10 +213,9 @@ public class StatisticsDataController {
|
|
|
*/
|
|
*/
|
|
|
@PutMapping("/renewTime/up")
|
|
@PutMapping("/renewTime/up")
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
- @SaCheckPermission("validAccount:addTime")
|
|
|
|
|
@Log(module = "有效子账号管理/增加时长", businessType = BusinessType.PUT, isSaveRequestData = true)
|
|
@Log(module = "有效子账号管理/增加时长", businessType = BusinessType.PUT, isSaveRequestData = true)
|
|
|
public Result<String> addRenewTime(@RequestBody @Validated RenewTimeUpReq renewTimeUpReq) {
|
|
public Result<String> addRenewTime(@RequestBody @Validated RenewTimeUpReq renewTimeUpReq) {
|
|
|
- long adminId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
|
|
+ long adminId = 55;
|
|
|
GroupsRelation relation = groupsRelationMapper.selectById(renewTimeUpReq.getRelationId());
|
|
GroupsRelation relation = groupsRelationMapper.selectById(renewTimeUpReq.getRelationId());
|
|
|
if (relation == null) {
|
|
if (relation == null) {
|
|
|
throw BusinessRuntimeException.getInstance("该车票已不存在");
|
|
throw BusinessRuntimeException.getInstance("该车票已不存在");
|
|
@@ -710,4 +710,61 @@ public class StatisticsDataController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(dataList);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(dataList);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 补偿 cc
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/buchang/cc")
|
|
|
|
|
+ public Result<String> buchangCC() {
|
|
|
|
|
+ List<OrderDon> orderDonList = orderDonMapper.selectList(Wrappers.lambdaQuery(OrderDon.class).eq(OrderDon::getGoodsId, Constant.CLAUDE_CODE_GOODS_ID).between(OrderDon::getCreatedTime, DateUtil.parse("2026-01-27"), DateUtil.parse("2026-01-28")).eq(OrderDon::getUserId, 1200924));
|
|
|
|
|
+ String remark = "新cc规格补偿1天";
|
|
|
|
|
+ RenewTimeUpReq renewTimeUpReq = new RenewTimeUpReq();
|
|
|
|
|
+ renewTimeUpReq.setDays(1);
|
|
|
|
|
+ renewTimeUpReq.setRemark(remark);
|
|
|
|
|
+ for (OrderDon orderDon : orderDonList) {
|
|
|
|
|
+ GroupsRelation groupsRelation = groupsRelationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class).eq(GroupsRelation::getId, orderDon.getRelationId()).eq(GroupsRelation::getUserId, orderDon.getUserId()).last("limit 1"));
|
|
|
|
|
+ if (groupsRelation != null) {
|
|
|
|
|
+ Integer selectCount = incrExpiryTimeRecordMapper.selectCount(Wrappers.lambdaQuery(IncrExpiryTimeRecord.class).eq(IncrExpiryTimeRecord::getRelationId, groupsRelation.getId()).eq(IncrExpiryTimeRecord::getUserId, groupsRelation.getUserId()).eq(IncrExpiryTimeRecord::getRemark, remark));
|
|
|
|
|
+ if (selectCount > 0) {
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ renewTimeUpReq.setRelationId(groupsRelation.getId());
|
|
|
|
|
+ addRenewTime(renewTimeUpReq);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 将之前cc的规格额度减半
|
|
|
|
|
+ */
|
|
|
|
|
+ @PutMapping("/sub/cc")
|
|
|
|
|
+ public Result<String> subCc() {
|
|
|
|
|
+ List<ClaudeCodeUser> claudeCodeUsers = claudeCodeUserMapper.selectList(Wrappers.lambdaQuery(ClaudeCodeUser.class).lt(ClaudeCodeUser::getCreatedTime, "2026-01-27").in(ClaudeCodeUser::getPlanName, List.of("MINI;", "ULTRA;", "MAX;", "PRO;")).eq(ClaudeCodeUser::getUserId, 55075));
|
|
|
|
|
+
|
|
|
|
|
+ for (ClaudeCodeUser claudeCodeUser : claudeCodeUsers) {
|
|
|
|
|
+ Long skuId ;
|
|
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectById(claudeCodeUser.getRelationId());
|
|
|
|
|
+ if (claudeCodeUser.getRenewSkuId() != null) {
|
|
|
|
|
+ skuId= claudeCodeUser.getRenewSkuId();
|
|
|
|
|
+ }else {
|
|
|
|
|
+ GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
|
|
|
|
|
+ skuId = groupsTrips.getSkuId();
|
|
|
|
|
+ }
|
|
|
|
|
+ GoodsDonSku sku = goodsDonSkuMapper.selectById(skuId);
|
|
|
|
|
+ Integer claudeQuota = claudeCodeUser.getClaudeQuota();
|
|
|
|
|
+ if (claudeQuota.intValue()/2 == sku.getClaudeQuota().intValue()) {
|
|
|
|
|
+ log.info("{}已降一半额度", claudeCodeUser.getUserId());
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ claudeCodeUser.setClaudeDailyLimit(sku.getClaudeDailyLimit()/2);
|
|
|
|
|
+ claudeCodeUser.setClaudeQuota(sku.getClaudeQuota()/2);
|
|
|
|
|
+ claudeCodeService.updateClaudeCodeUserPackageInfo(claudeCodeUser, relation.getExpiryTime(), null);
|
|
|
|
|
+ claudeCodeUserMapper.updateById(claudeCodeUser);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|