Просмотр исходного кода

优化重复累加问题

shuiqilin
zhangxin 1 год назад
Родитель
Сommit
1eec31e418

+ 19
- 0
src/main/java/com/qtzl/alterSales/manager/service/AflPaccountRefundCountServiceImpl.java Просмотреть файл

@@ -1,6 +1,7 @@
package com.qtzl.alterSales.manager.service;

import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
import com.google.common.collect.Lists;
import com.qtzl.alterSales.dao.entity.primary.AflAgencyMchRel;
@@ -14,6 +15,7 @@ import com.qtzl.alterSales.manager.model.protocol.sales.AflPaccountRefundCountFi
import com.qtzl.alterSales.manager.service.third.ConstantConfig;
import com.qtzl.alterSales.manager.service.third.FmsService;
import com.qtzl.alterSales.manager.tools.ExcelUtils;
import com.qtzl.alterSales.manager.tools.RedisUtils;
import com.qtzl.alterSales.manager.vo.AflPaccountRefundCountVo;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
@@ -45,6 +47,10 @@ public class AflPaccountRefundCountServiceImpl implements AflPaccountRefundCount
FmsService fmsService;
@Resource
ConstantConfig constantConfig;
@Resource
RedisUtils redisUtils;

private static final String COUNT_KEY = "COUNT_";
@Override
public String export(AflPaccountRefundCountFindPageViewRequest request, Logger logger) throws ServiceHandleException {
String pathFile =null;
@@ -137,6 +143,19 @@ public class AflPaccountRefundCountServiceImpl implements AflPaccountRefundCount
log.error("未查询到部中心原始流水统计信息,AgentId ={},accountDate={}",fssPaccountPay.getAgentId(),format);
return;
}
try {
String redisKey=COUNT_KEY+fssPaccountPay.getPayId();
final Object redisData = redisUtils.get(redisKey);
if (!ObjectUtil.isEmpty(redisData)) {
log.error("该数据已存在60秒内处理中,请勿重复处理");
return;
}else {
redisUtils.set(redisKey,JSON.toJSONString(fssPaccountPay),60);
}
} catch (Exception e) {
log.error("保存redis信息错误,fssPaccountPay ={},{}",JSON.toJSONString(fssPaccountPay),e.getMessage());
return;
}
Long collectMoney =0L;
if (aflPaccountRefundCount.getCollectMoney()!=null){
collectMoney = aflPaccountRefundCount.getCollectMoney();

Загрузка…
Отмена
Сохранить