|
@@ -47,6 +47,7 @@ import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
import java.util.Optional;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -268,6 +269,33 @@ public class CmsGroupRelationController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 更新剩余次数 针对之前的代充账号
|
|
|
|
|
+ */
|
|
|
|
|
+ @PostMapping("/recharge/set/remainNumBf")
|
|
|
|
|
+ public Result<String> setRechargeRemainNumBf(@RequestBody RechargeRemainNumReq req) {
|
|
|
|
|
+ long adminId = StpUtil.getLoginIdAsLong();
|
|
|
|
|
+ Long relationId = req.getRelationId();
|
|
|
|
|
+ GroupsRelation relation = groupsRelationMapper.selectById(relationId);
|
|
|
|
|
+ if (relation.getRechargeRemainNum() == null) {
|
|
|
|
|
+ Integer num = req.getNum();
|
|
|
|
|
+ if (num <= 0) {
|
|
|
|
|
+ throw BusinessRuntimeException.getInstance("剩余次数需大于0");
|
|
|
|
|
+ }
|
|
|
|
|
+ relation.setRechargeNum(num);
|
|
|
|
|
+ relation.setRechargeRemainNum(num);
|
|
|
|
|
+ Date startTime = relation.getStartTime();
|
|
|
|
|
+ DateTime now = DateTime.now();
|
|
|
|
|
+ relation.setSubmitTime(startTime != null ? startTime : now);
|
|
|
|
|
+ relation.setSendTime(relation.getSubmitTime());
|
|
|
|
|
+ groupsRelationMapper.updateById(relation);
|
|
|
|
|
+ //记录gpt代充记录
|
|
|
|
|
+ CmsUser cmsUser = cmsUserMapper.selectById(adminId);
|
|
|
|
|
+ gptUserRechargeRecordService.recordGptUserRechargeNum(relation.getUserId(), relation.getId(), relation.getAccount(), req.getNum(), cmsUser != null ? cmsUser.getNickname() : null, req.getRemark());
|
|
|
|
|
+ }
|
|
|
|
|
+ return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* GPT代充卡密列表
|
|
* GPT代充卡密列表
|
|
|
*/
|
|
*/
|
|
@@ -329,13 +357,17 @@ public class CmsGroupRelationController {
|
|
|
@GetMapping("/get/recharge/operate/record")
|
|
@GetMapping("/get/recharge/operate/record")
|
|
|
public Result<List<GptUserRechargeNumRecord>> getGptUserRechargeNumRecord(Long relationId, Long userId) {
|
|
public Result<List<GptUserRechargeNumRecord>> getGptUserRechargeNumRecord(Long relationId, Long userId) {
|
|
|
GroupsRelation relation = groupsRelationMapper.selectById(relationId);
|
|
GroupsRelation relation = groupsRelationMapper.selectById(relationId);
|
|
|
- if (relation.getStartTime() == null) {
|
|
|
|
|
|
|
+ if (relation.getSubmitTime() == null && relation.getStartTime() == null) {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult();
|
|
|
}
|
|
}
|
|
|
|
|
+ Date filterDate = relation.getSubmitTime();
|
|
|
|
|
+ if (filterDate == null) {
|
|
|
|
|
+ filterDate = relation.getStartTime();
|
|
|
|
|
+ }
|
|
|
List<GptUserRechargeNumRecord> gptUserRechargeNumRecords = beanSearcher.searchAll(GptUserRechargeNumRecord.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
List<GptUserRechargeNumRecord> gptUserRechargeNumRecords = beanSearcher.searchAll(GptUserRechargeNumRecord.class, MapUtils.flatBuilder(request.getParameterMap())
|
|
|
.field(GptUserRechargeNumRecord::getRelationId, relationId)
|
|
.field(GptUserRechargeNumRecord::getRelationId, relationId)
|
|
|
.field(GptUserRechargeNumRecord::getUserId, userId)
|
|
.field(GptUserRechargeNumRecord::getUserId, userId)
|
|
|
- .field(GptUserRechargeNumRecord::getCreatedTime, relation.getStartTime()).op(Operator.GreaterEqual)
|
|
|
|
|
|
|
+ .field(GptUserRechargeNumRecord::getCreatedTime, filterDate).op(Operator.GreaterEqual)
|
|
|
.build());
|
|
.build());
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(gptUserRechargeNumRecords);
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(gptUserRechargeNumRecords);
|
|
|
}
|
|
}
|