Commit 4c01dad6 by lzxry

同步流量定时任务bug修复

parent 7be2b9ca
...@@ -2,14 +2,11 @@ package track.task; ...@@ -2,14 +2,11 @@ package track.task;
import common.model.CalculationFlow; import common.model.CalculationFlow;
import common.model.Contract; import common.model.Contract;
import common.model.ContractChange;
import common.model.TkioFlow; import common.model.TkioFlow;
import common.repository.CalculationFlowRepository; import common.repository.CalculationFlowRepository;
import common.repository.ContractChangeRepository; import common.repository.ContractChangeRepository;
import common.repository.ContractRepository; import common.repository.ContractRepository;
import common.repository.TkioFlowRepository; import common.repository.TkioFlowRepository;
import dic.ContractStatusEnum;
import org.joda.time.DateTime;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -19,7 +16,6 @@ import tkio.repository.AppRepository; ...@@ -19,7 +16,6 @@ import tkio.repository.AppRepository;
import tkio.service.AccountFlowRestrictService; import tkio.service.AccountFlowRestrictService;
import util.DateUtil; import util.DateUtil;
import javax.persistence.Entity;
import java.math.BigInteger; import java.math.BigInteger;
import java.text.ParseException; import java.text.ParseException;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -50,7 +46,7 @@ public class TrackingFlowTask { ...@@ -50,7 +46,7 @@ public class TrackingFlowTask {
private CalculationFlowRepository calculationFlowRepository; private CalculationFlowRepository calculationFlowRepository;
public void syncFlow(){ public void syncFlow(){
List<CalculationFlow> calculationFlows = calculationFlowRepository.findByStatus(0); List<CalculationFlow> calculationFlows = calculationFlowRepository.findByStatus(3);
for (CalculationFlow calculationFlow : calculationFlows) { for (CalculationFlow calculationFlow : calculationFlows) {
List<TkioFlow> tkioFlowList = new ArrayList<>(); List<TkioFlow> tkioFlowList = new ArrayList<>();
calculationFlow.setStatus(1); calculationFlow.setStatus(1);
...@@ -126,7 +122,7 @@ public class TrackingFlowTask { ...@@ -126,7 +122,7 @@ public class TrackingFlowTask {
for (int i = 0; i < contractsArray.length; i++) { for (int i = 0; i < contractsArray.length; i++) {
TkioFlow tkioFlow = getTkioFlow(clickNum, yesterday, contractsArray[i]); TkioFlow tkioFlow = getTkioFlow(clickNum, yesterday, contractsArray[i]);
if (tkioFlow != null && i < contractsArray.length - 1 && tkioFlow.getCostFlow() > 0L) {//处理成本流量,如果超出了,依次算在下一个合同上 if (tkioFlow != null && i < contractsArray.length - 1 && tkioFlow.getCostFlow() !=null && tkioFlow.getCostFlow() > 0L) {//处理成本流量,如果超出了,依次算在下一个合同上
clickNum = BigInteger.valueOf(tkioFlow.getCostFlow()); clickNum = BigInteger.valueOf(tkioFlow.getCostFlow());
tkioFlow.setCostFlow(null); tkioFlow.setCostFlow(null);
tkioFlowList.add(tkioFlow); tkioFlowList.add(tkioFlow);
...@@ -181,6 +177,7 @@ public class TrackingFlowTask { ...@@ -181,6 +177,7 @@ public class TrackingFlowTask {
calculationFlow.setStatus(2); calculationFlow.setStatus(2);
calculationFlowRepository.save(calculationFlow); calculationFlowRepository.save(calculationFlow);
}catch(Exception e){ }catch(Exception e){
logger.error("CalculationFlow:Id::"+calculationFlow.getId()+":全流量同步失败",e);
calculationFlow.setStatus(3); calculationFlow.setStatus(3);
calculationFlowRepository.save(calculationFlow); calculationFlowRepository.save(calculationFlow);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment