|
@@ -4,6 +4,7 @@ import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
|
|
|
import cn.newfeifan.mall.module.distri.dal.dataobject.ptprofitlog.PtProfitLogDO;
|
|
|
import cn.newfeifan.mall.module.distri.dal.mysql.ptprofitlog.PtProfitLogMapper;
|
|
|
import cn.newfeifan.mall.module.distri.enums.CaclEnum;
|
|
|
+import cn.newfeifan.mall.module.distri.service.ptprofitlog.PtProfitLogService;
|
|
|
import cn.newfeifan.mall.module.distri.service.sharepath.SharePathService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
@@ -24,6 +25,7 @@ import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
|
|
|
import cn.newfeifan.mall.module.distri.dal.mysql.integral.IntegralMapper;
|
|
|
|
|
|
import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
+import static cn.newfeifan.mall.module.distri.enums.CaclEnum.DIRECT_REFERRAL_QUOTA;
|
|
|
import static cn.newfeifan.mall.module.distri.enums.ErrorCodeConstants.*;
|
|
|
|
|
|
/**
|
|
@@ -45,6 +47,9 @@ public class IntegralServiceImpl implements IntegralService {
|
|
|
@Lazy
|
|
|
private SharePathService sharePathService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private PtProfitLogService ptProfitLogService;
|
|
|
+
|
|
|
@Override
|
|
|
public Long createIntegral(IntegralSaveReqVO createReqVO) {
|
|
|
// 插入
|
|
@@ -163,4 +168,34 @@ public class IntegralServiceImpl implements IntegralService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void initializeIntegralHighQuotaTotal() {
|
|
|
+ List<IntegralDO> integralDOS = integralMapper.selectList();
|
|
|
+ for (IntegralDO integralDO : integralDOS) {
|
|
|
+ List<PtProfitLogDO> ptProfitLogDOS = ptProfitLogMapper.selectList(new LambdaQueryWrapper<PtProfitLogDO>()
|
|
|
+ .eq(PtProfitLogDO::getUserId, integralDO.getUserId())
|
|
|
+ .eq(PtProfitLogDO::getProfitStatus, DIRECT_REFERRAL_QUOTA.getType())
|
|
|
+ );
|
|
|
+ for (PtProfitLogDO ptProfitLogDO : ptProfitLogDOS) {
|
|
|
+ integralDO.setHighQuotaTotal(integralDO.getHighQuotaTotal() + ptProfitLogDO.getMaxAvailablePointsAmount());
|
|
|
+ }
|
|
|
+
|
|
|
+ integralMapper.updateById(integralDO);
|
|
|
+ if(ptProfitLogDOS.size() > 1){
|
|
|
+ System.out.println("用户编号:[" + integralDO.getUserId() + "]");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void updateUserIntegral(Long userId, CaclEnum caclEnum, Long payIntegral, Long tradeOrderId, String orderNum) {
|
|
|
+ //退还订单支付过期积分
|
|
|
+ IntegralDO integralDO = integralMapper.selectOne(new LambdaQueryWrapper<IntegralDO>().eq(IntegralDO::getUserId, userId));
|
|
|
+ integralDO.setCurrentQuota(integralDO.getCurrentQuota() + payIntegral);
|
|
|
+
|
|
|
+ integralMapper.updateById(integralDO);
|
|
|
+
|
|
|
+ ptProfitLogService.addMessage(userId,userId,caclEnum,payIntegral,integralDO.getCurrentQuota(),0L,0L,null,tradeOrderId,orderNum);
|
|
|
+ }
|
|
|
+
|
|
|
}
|