Commit f69218cc authored by hezhen's avatar hezhen

123

parent 6dd122ee
......@@ -65,10 +65,10 @@ public class MyWallet implements Serializable {
private BigDecimal totalAmount;
/**
* 进账总额(分)
* 今日收益
*/
@Column(name = "today_amount")
@ApiModelProperty(value = "进账总额(元)")
@ApiModelProperty(value = "今日收益")
private BigDecimal todayAmount;
/**
......
......@@ -15,12 +15,14 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.mapper.entity.Example;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.Date;
import java.util.List;
/**
* 钱包
......@@ -176,6 +178,21 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
return ObjectRestResponse.createDefaultFail();
}
}
//定时处理今日收益
public void updTodayAmount(){
Example example=new Example(MyWallet.class);
example.createCriteria().andGreaterThan("todayAmount",0).andEqualTo("isFrozen",0);
List<MyWallet> list=mapper.selectByExample(example);
log.info("---钱包定时处理今日收益updTodayAmount----size==="+list.size());
if (list.size()>0){
for (MyWallet myWallet:list){
log.info("---钱包定时处理今日收益updTodayAmount----userId==="+myWallet.getUserId());
myWallet.setTodayAmount(BigDecimal.ZERO);
mapper.updMyWater(myWallet);
}
}
}
}
\ No newline at end of file
package com.github.wxiaoqi.security.admin.jobhandler;
import com.github.wxiaoqi.security.admin.biz.MyWaterBiz;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
......@@ -18,11 +20,14 @@ import org.springframework.stereotype.Component;
@Slf4j
public class RentDepositJobHandler extends IJobHandler {
@Autowired
MyWaterBiz myWaterBiz;
@Override
public ReturnT<String> execute(String var1) throws Exception {
try {
log.info("-----定时器进入---walletHandler---");
myWaterBiz.updTodayAmount();
ReturnT returnT = new ReturnT(){{
setCode(100);
setMsg("成功");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment