1;防重提,出账积分余额校验

2;测试更新历史数据
3; 短信计数及发送优化,打印日志
This commit is contained in:
wangshuai 2024-08-09 13:52:12 +08:00
parent 69708a890e
commit 9d5b573315
4 changed files with 11 additions and 7 deletions

View File

@ -5,6 +5,7 @@ import com.ruoyi.business.domain.BusStoreInfo;
import com.ruoyi.business.service.IBusAgentInfoService;
import com.ruoyi.business.service.IBusStoreInfoService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.annotation.RepeatSubmit;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
@ -150,7 +151,7 @@ public class BusAgentInfoController extends BaseController {
// @PreAuthorize("@ss.hasPermi('system:info:edit')")
@Log(title = "代理管理", businessType = BusinessType.UPDATE)
@PutMapping
@Transactional
@RepeatSubmit
public AjaxResult edit(@RequestBody BusAgentInfo busAgentInfo) {
LoginUser user = SecurityUtils.getLoginUser();
BusAgentInfo busAgentInfo1 = busAgentInfoService.selectBusAgentInfoById(user.getUserId());

View File

@ -228,7 +228,7 @@ public class AiConsumer {
}catch (Exception e){
e.printStackTrace();
log.error("营销事件推出-下次继续=====================");
throw new ServiceException("营销事件推出-下次继续");
throw new ServiceException("营销事件推出-下次继续:"+busOrderInfo.getOrderNo());
}
System.out.println(("一共耗时time: " + (System.currentTimeMillis() - startTime) / 1000 + " s"));
}

View File

@ -319,7 +319,6 @@ public class AiServiceImpl implements IAiService {
@Override
@Transactional(rollbackFor = ServiceException.class)
public void sendSmsTask(String content, BusOrderInfo busOrderInfo) {
lock.lock();
try {
String limitNum = Optional.ofNullable(redisTemplate.opsForValue().get("limitNum")).orElse(null);
BusSmsInfo busSmsInfo1 = busSmsInfoMapper.selectBusSmsInfoByNum(limitNum);
@ -351,10 +350,8 @@ public class AiServiceImpl implements IAiService {
}
} catch (Exception e) {
e.printStackTrace();
log.error("建立sendSmsTask错误 ",e.getMessage());
log.error(busOrderInfo.getOrderNo()+"建立sendSmsTask错误 "+e.getMessage());
throw new ServiceException("短信发送失败!");
}finally {
lock.unlock();
}
}

View File

@ -191,19 +191,25 @@ public class BusAgentInfoServiceImpl implements IBusAgentInfoService
recordService.insertBusIntegralRecord(record);
busAgentInfoMapper.updateBusAgentInfo(busAgentInfo);
BusAgentInfo temp1 = busAgentInfoMapper.selectBusAgentInfoById(busAgentInfo.getSuperiorAgentCode());
BusIntegralRecord record1 = new BusIntegralRecord();
record1.setAccount(busAgentInfo.getSuperiorAgentAccount());
record1.setUpdateType("出账");
record1.setCreateUser(busAgentInfo.getAgentAccount());
// record1.setIntegralUpdateNum(busAgentInfo.getAiDurationBalance1());
if(busAgentInfo.getAiDurationBalance1()!=0){
if(temp1.getAiDurationBalance()<busAgentInfo.getAiDurationBalance1()){
throw new ServiceException("安全账分余额不足!请联系管理员充值。");
}
record1.setIntegralUpdateNum(busAgentInfo.getAiDurationBalance1());
record1.setIntegralType("sms");
}else if(busAgentInfo.getAiRealTimeNum1()!=0){
if(temp1.getAiRealTimeNum()<busAgentInfo.getAiRealTimeNum1()){
throw new ServiceException("普通账分余额不足!请联系管理员充值。");
}
record1.setIntegralUpdateNum(busAgentInfo.getAiRealTimeNum1());
record1.setIntegralType("AI");
}
BusAgentInfo temp1 = busAgentInfoMapper.selectBusAgentInfoById(busAgentInfo.getSuperiorAgentCode());
if(busAgentInfo.getSuperiorAgentCode() == 1){
record1.setIntegralUpdateTime(new Date());
recordService.insertBusIntegralRecord(record1);