| | |
| | | package test.goldcorn; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.Application; |
| | | import com.yeshi.makemoney.app.dto.mq.GoldCornSettleMQMsg; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetFrequencyConfig; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetRecordException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMakeException; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.*; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.*; |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetFrequencyConfigService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.*; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornConsumeRecordQuery; |
| | | import com.yeshi.makemoney.app.utils.mq.CMQManager; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | private GoldCornGetRecordService goldCornGetRecordService; |
| | | |
| | | @Resource |
| | | private GoldCornConsumeRecordService goldCornConsumeRecordService; |
| | | |
| | | @Resource |
| | | private GoldCornMakeService goldCornMakeService; |
| | | |
| | | @Resource |
| | | private GoldCornSettleService goldCornSettleService; |
| | | |
| | | @Resource |
| | | private GoldCornSettleRecordService goldCornSettleRecordService; |
| | | |
| | | @Test |
| | | public void addGoldRecord() throws GoldCornGetRecordException { |
| | |
| | | |
| | | @Test |
| | | public void settle() { |
| | | goldCornSettleService.startSettle(new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24L)); |
| | | // goldCornSettleService.startSettle(new Date(System.currentTimeMillis() - 1000 * 60 * 60 * 24 * 1L)); |
| | | // CMQManager.getInstance().addGoldCornSettleMsg(new GoldCornSettleMQMsg(record.getId(), uid, day, System.currentTimeMillis())); |
| | | //重新结算 |
| | | GoldCornConsumeRecordQuery query = new GoldCornConsumeRecordQuery(); |
| | | query.setType(GoldCornConsumeType.changeMoney); |
| | | query.setEventId("2022-06-22-svmm"); |
| | | query.setType(GoldCornConsumeType.changeMoney); |
| | | List<GoldCornConsumeRecord> list= goldCornConsumeRecordService.list(query,1,1000); |
| | | int count=0; |
| | | for(GoldCornConsumeRecord record:list){ |
| | | if(record.getCreateTime().getTime()> TimeUtil.convertToTimeTemp("2022-06-29","yyyy-MM-dd")){ |
| | | GoldCornConsumeRecord update=new GoldCornConsumeRecord(); |
| | | update.setId(record.getId()); |
| | | update.setEventId("2022-06-28-svmm"); |
| | | goldCornConsumeRecordService.update(update); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | public void getFrequencys() { |
| | | List<GoldCornGetFrequencyConfig> list = goldCornGetFrequencyConfigService.listByTypes(Arrays.asList(new GoldCornGetType[]{GoldCornGetType.watchVideo, GoldCornGetType.readNovel, GoldCornGetType.scanNews}), SystemEnum.svmm, new Date()); |
| | | } |
| | | |
| | | @Test |
| | | public void addSettle() throws GoldCornSettleRecordException, ParamsException { |
| | | GoldCornSettleRecord record = new GoldCornSettleRecord(); |
| | | goldCornSettleRecordService.add(record); |
| | | } |
| | | |
| | | @Test |
| | | public void sumMoney() { |
| | | GoldCornConsumeRecordQuery query = new GoldCornConsumeRecordQuery(); |
| | | query.setType(GoldCornConsumeType.changeMoney); |
| | | BigDecimal money = goldCornConsumeRecordService.sumMoney(query); |
| | | System.out.println(money); |
| | | } |
| | | |
| | | } |