浏览代码

提现失败自动补偿一次

wujiefeng 9 月之前
父节点
当前提交
c11a5e2d55

+ 2 - 0
RewardClient/src/main/java/com/zhongshu/reward/client/model/param/TestSettleParam.java

@@ -14,4 +14,6 @@ public class TestSettleParam {
     private List<String> idList;
 
     private List<String> vipRecordIdList;
+
+    private Long time;
 }

+ 37 - 2
RewardServer/src/main/java/com/zhongshu/reward/server/core/controller/TestController.java

@@ -14,6 +14,7 @@ import com.zswl.cloud.bdb.client.vo.InviteReceiptsRoleVo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -58,9 +59,44 @@ public class TestController {
 //        return ResultContent.buildSuccess();
 //    }
 
-    @ApiOperation("结算奖励")
+    @ApiOperation("修改入账及消息时间")
     @PostMapping("settle")
     public Object settle(@RequestBody TestSettleParam param){
+        if (param.getTime()!=null && param.getTime() != 0L){
+            Date date = new Date(param.getTime());
+            if (param.getIdList()!=null && !param.getIdList().isEmpty()){
+                Iterable<WalletReceipts> allById = walletReceiptsDao.findAllById(param.getIdList());
+                allById.forEach(it->{
+                    it.setCreateTime(param.getTime());
+                    it.setEstimatedTime(param.getTime());
+                    VipUserRecord vipUserRecord = it.getVipUserRecord();
+                    vipUserRecord.setOperateTime(param.getTime());
+                    it.setVipUserRecord(vipUserRecord);
+                    InviteReceiptsRoleVo ruler = it.getRuler();
+                    ruler.setDay(Integer.parseInt(String.format("%tm", date)));
+                    it.setRuler(ruler);
+                });
+                walletReceiptsDao.saveAll(allById);
+            }
+
+
+            if (param.getVipRecordIdList()!=null && !param.getVipRecordIdList().isEmpty()){
+                Iterable<VipUserRecord> vipRecordList = vipUserRecordDao.findAllById(param.getVipRecordIdList());
+                vipRecordList.forEach(it->{
+                    it.setOperateTime(param.getTime());
+                    it.setCreateTime(param.getTime());
+                });
+                vipUserRecordDao.saveAll(vipRecordList);
+            }
+
+            walletReceiptsService.settle(Integer.parseInt(String.format("%td", date)));
+        }else {
+            updateTime(param);
+        }
+        return ResultContent.buildSuccess();
+    }
+
+    private void updateTime(TestSettleParam param) {
         Date date = new Date();
         if (param.getIdList()!=null && !param.getIdList().isEmpty()){
             Iterable<WalletReceipts> allById = walletReceiptsDao.findAllById(param.getIdList());
@@ -88,7 +124,6 @@ public class TestController {
         }
 
         walletReceiptsService.settle(Integer.parseInt(String.format("%td", date)));
-        return ResultContent.buildSuccess();
     }
 
 //    @ApiOperation("生成持续订购返利")

+ 1 - 1
RewardServer/src/main/resources/application-dev.yml

@@ -2,7 +2,7 @@ spring:
   data:
     mongodb:
       #uri: mongodb://paymentcenter:paymentcenter@192.168.110.241:30117,192.168.110.241:30118,192.168.110.241:30119/paymentcenter?replicaSet=MongoSetsShard1
-      uri: mongodb://rewardcenter:rewardcenter@192.168.110.241:30117,192.168.110.241:30118,192.168.110.241:30119/rewardcenter?replicaSet=MongoSetsShard1
+      uri: mongodb://rewardcenter:rewardcenter@192.168.110.241:30117/rewardcenter?replicaSet=MongoSetsShard1
       auto-index-creation: true
   redis:
     host: 192.168.110.241