|
|
@@ -27,6 +27,14 @@ import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
|
|
|
import com.zhongzheng.modules.course.vo.CourseMenuVo;
|
|
|
import com.zhongzheng.modules.course.vo.CourseModuleChapterVo;
|
|
|
import com.zhongzheng.modules.course.vo.CourseSectionVo;
|
|
|
+import com.zhongzheng.modules.distribution.bo.DistributionCashLogAddBo;
|
|
|
+import com.zhongzheng.modules.distribution.bo.DistributionRebateQueryBo;
|
|
|
+import com.zhongzheng.modules.distribution.domain.DistributionRebate;
|
|
|
+import com.zhongzheng.modules.distribution.domain.DistributionSeller;
|
|
|
+import com.zhongzheng.modules.distribution.service.IDistributionCashLogService;
|
|
|
+import com.zhongzheng.modules.distribution.service.IDistributionRebateService;
|
|
|
+import com.zhongzheng.modules.distribution.service.IDistributionSellerService;
|
|
|
+import com.zhongzheng.modules.distribution.vo.DistributionRebateVo;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamApplyQueryBo;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamBeforeQueryBo;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamTodayRecordBo;
|
|
|
@@ -266,6 +274,15 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
|
|
|
@Autowired
|
|
|
private IWisdomService iWisdomService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IDistributionRebateService iDistributionRebateService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IDistributionCashLogService iDistributionCashLogService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IDistributionSellerService iDistributionSellerService;
|
|
|
+
|
|
|
@Value("${aliyun.sms.OpenTheGoodsCode}")
|
|
|
private String OpenTheGoodsCode;
|
|
|
|
|
|
@@ -1084,7 +1101,54 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
|
|
|
|
|
|
@Override
|
|
|
public void distributionRebate() {
|
|
|
-
|
|
|
+ DistributionRebateQueryBo queryBo = new DistributionRebateQueryBo();
|
|
|
+ Long startTime = DateUtils.getTodayZeroTime();
|
|
|
+ Long endTime = DateUtils.getNowTime();
|
|
|
+ queryBo.setOpenStartTime(startTime);
|
|
|
+ queryBo.setOpenEndTime(endTime);
|
|
|
+ queryBo.setCashStatus(1);
|
|
|
+ List<DistributionRebateVo> list = iDistributionRebateService.queryList(queryBo);
|
|
|
+ for(DistributionRebateVo vo : list){
|
|
|
+ DistributionSeller seller = iDistributionSellerService.getOne(new LambdaQueryWrapper<DistributionSeller>()
|
|
|
+ .eq(DistributionSeller::getSellerId, vo.getSellerId()).last("limit 1"));
|
|
|
+ if(Validator.isEmpty(seller)){
|
|
|
+ throw new CustomException("业务员不存在");
|
|
|
+ }
|
|
|
+ //冻结金额日志
|
|
|
+ BigDecimal oldFreezeCash = seller.getFreezeCash();
|
|
|
+ BigDecimal newFreezeCash = seller.getFreezeCash().subtract(vo.getCash());
|
|
|
+ DistributionCashLogAddBo cashFreezeLogAddBo = new DistributionCashLogAddBo();
|
|
|
+ cashFreezeLogAddBo.setSellerId(seller.getSellerId());
|
|
|
+ cashFreezeLogAddBo.setOldNum(oldFreezeCash);
|
|
|
+ cashFreezeLogAddBo.setNewNum(newFreezeCash);
|
|
|
+ cashFreezeLogAddBo.setDiffNum(vo.getCash().negate());
|
|
|
+ cashFreezeLogAddBo.setRelatedSn(vo.getOrderSn());
|
|
|
+ cashFreezeLogAddBo.setType(1L);
|
|
|
+ iDistributionCashLogService.insertByAddBo(cashFreezeLogAddBo);
|
|
|
+
|
|
|
+ //可提现日志
|
|
|
+ BigDecimal oldCash = seller.getCash();
|
|
|
+ BigDecimal newCash = seller.getCash().add(vo.getCash());
|
|
|
+ DistributionCashLogAddBo cashLogAddBo = new DistributionCashLogAddBo();
|
|
|
+ cashLogAddBo.setSellerId(seller.getSellerId());
|
|
|
+ cashLogAddBo.setOldNum(oldCash);
|
|
|
+ cashLogAddBo.setNewNum(newCash);
|
|
|
+ cashLogAddBo.setDiffNum(vo.getCash());
|
|
|
+ cashLogAddBo.setRelatedSn(vo.getOrderSn());
|
|
|
+ cashLogAddBo.setType(2L);
|
|
|
+ iDistributionCashLogService.insertByAddBo(cashLogAddBo);
|
|
|
+
|
|
|
+ seller.setCash(newCash);
|
|
|
+ seller.setFreezeCash(newFreezeCash);
|
|
|
+ seller.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iDistributionSellerService.updateById(seller);
|
|
|
+
|
|
|
+ DistributionRebate rebate = new DistributionRebate();
|
|
|
+ rebate.setId(vo.getId());
|
|
|
+ rebate.setCashStatus(2);
|
|
|
+ rebate.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ iDistributionRebateService.updateById(rebate);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|