|
@@ -1,11 +1,16 @@
|
|
package com.zhongshu.reward.server.core.controller;
|
|
package com.zhongshu.reward.server.core.controller;
|
|
|
|
|
|
|
|
+import com.zhongshu.reward.client.model.param.TestSettleParam;
|
|
import com.zhongshu.reward.client.ret.ResultContent;
|
|
import com.zhongshu.reward.client.ret.ResultContent;
|
|
|
|
+import com.zhongshu.reward.server.core.dao.VipUserRecordDao;
|
|
|
|
+import com.zhongshu.reward.server.core.dao.WalletReceiptsDao;
|
|
import com.zhongshu.reward.server.core.domain.VipUserRecord;
|
|
import com.zhongshu.reward.server.core.domain.VipUserRecord;
|
|
|
|
+import com.zhongshu.reward.server.core.domain.WalletReceipts;
|
|
import com.zhongshu.reward.server.core.service.Impl.InviteRecordFeignServiceImpl;
|
|
import com.zhongshu.reward.server.core.service.Impl.InviteRecordFeignServiceImpl;
|
|
import com.zhongshu.reward.server.core.service.WalletReceiptsService;
|
|
import com.zhongshu.reward.server.core.service.WalletReceiptsService;
|
|
import com.zhongshu.reward.server.core.util.DateUtils;
|
|
import com.zhongshu.reward.server.core.util.DateUtils;
|
|
import com.zhongshu.vip.client.model.param.VipUserParam;
|
|
import com.zhongshu.vip.client.model.param.VipUserParam;
|
|
|
|
+import com.zswl.cloud.bdb.client.vo.InviteReceiptsRoleVo;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -18,6 +23,8 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.util.Calendar;
|
|
import java.util.Calendar;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author wjf
|
|
* @author wjf
|
|
@@ -35,27 +42,59 @@ public class TestController {
|
|
@Autowired
|
|
@Autowired
|
|
InviteRecordFeignServiceImpl inviteRecordFeignService;
|
|
InviteRecordFeignServiceImpl inviteRecordFeignService;
|
|
|
|
|
|
- @ApiOperation("会员消息")
|
|
|
|
- @PostMapping("vipUser")
|
|
|
|
- public Object vipUser(@RequestBody VipUserParam param){
|
|
|
|
- VipUserRecord vipUserRecord = new VipUserRecord();
|
|
|
|
- BeanUtils.copyProperties(param, vipUserRecord, "createTime");
|
|
|
|
- vipUserRecord.setOperateTime(DateUtils.timeToLong(param.getCreateTime(), DateUtils.FORMAT_LONG));
|
|
|
|
- walletReceiptsService.receipts(vipUserRecord);
|
|
|
|
- return ResultContent.buildSuccess();
|
|
|
|
- }
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ WalletReceiptsDao walletReceiptsDao;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ VipUserRecordDao vipUserRecordDao;
|
|
|
|
+
|
|
|
|
+// @ApiOperation("会员消息")
|
|
|
|
+// @PostMapping("vipUser")
|
|
|
|
+// public Object vipUser(@RequestBody VipUserParam param){
|
|
|
|
+// VipUserRecord vipUserRecord = new VipUserRecord();
|
|
|
|
+// BeanUtils.copyProperties(param, vipUserRecord, "createTime");
|
|
|
|
+// vipUserRecord.setOperateTime(DateUtils.timeToLong(param.getCreateTime(), DateUtils.FORMAT_LONG));
|
|
|
|
+// walletReceiptsService.receipts(vipUserRecord);
|
|
|
|
+// return ResultContent.buildSuccess();
|
|
|
|
+// }
|
|
|
|
|
|
@ApiOperation("结算奖励")
|
|
@ApiOperation("结算奖励")
|
|
@PostMapping("settle")
|
|
@PostMapping("settle")
|
|
- public Object settle(Integer day){
|
|
|
|
- walletReceiptsService.settle(day);
|
|
|
|
- return ResultContent.buildSuccess();
|
|
|
|
- }
|
|
|
|
|
|
+ public Object settle(@RequestBody TestSettleParam param){
|
|
|
|
+ Date date = new Date();
|
|
|
|
+ if (param.getIdList()!=null && !param.getIdList().isEmpty()){
|
|
|
|
+ Iterable<WalletReceipts> allById = walletReceiptsDao.findAllById(param.getIdList());
|
|
|
|
+ allById.forEach(it->{
|
|
|
|
+ it.setCreateTime(DateUtils.last(it.getCreateTime()));
|
|
|
|
+ it.setEstimatedTime(DateUtils.last(it.getEstimatedTime()));
|
|
|
|
+ VipUserRecord vipUserRecord = it.getVipUserRecord();
|
|
|
|
+ vipUserRecord.setOperateTime(DateUtils.last(vipUserRecord.getOperateTime()));
|
|
|
|
+ it.setVipUserRecord(vipUserRecord);
|
|
|
|
+ InviteReceiptsRoleVo ruler = it.getRuler();
|
|
|
|
+ ruler.setDay(Integer.parseInt(String.format("%tm", date)));
|
|
|
|
+ it.setRuler(ruler);
|
|
|
|
+ });
|
|
|
|
+ walletReceiptsDao.saveAll(allById);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
- @ApiOperation("生成持续订购返利")
|
|
|
|
- @PostMapping("autoReceipts")
|
|
|
|
- public Object autoReceipts(){
|
|
|
|
- walletReceiptsService.autoReceipts();
|
|
|
|
|
|
+ if (param.getVipRecordIdList()!=null && !param.getVipRecordIdList().isEmpty()){
|
|
|
|
+ Iterable<VipUserRecord> vipRecordList = vipUserRecordDao.findAllById(param.getVipRecordIdList());
|
|
|
|
+ vipRecordList.forEach(it->{
|
|
|
|
+ it.setOperateTime(DateUtils.last(it.getOperateTime()));
|
|
|
|
+ it.setCreateTime(DateUtils.last(it.getCreateTime()));
|
|
|
|
+ });
|
|
|
|
+ vipUserRecordDao.saveAll(vipRecordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ walletReceiptsService.settle(Integer.parseInt(String.format("%td", date)));
|
|
return ResultContent.buildSuccess();
|
|
return ResultContent.buildSuccess();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// @ApiOperation("生成持续订购返利")
|
|
|
|
+// @PostMapping("autoReceipts")
|
|
|
|
+// public Object autoReceipts(){
|
|
|
|
+// walletReceiptsService.autoReceipts();
|
|
|
|
+// return ResultContent.buildSuccess();
|
|
|
|
+// }
|
|
}
|
|
}
|