Commit 0589fce8 by manxiaoqiang

客户表

parent 8c1fae39
...@@ -17,6 +17,7 @@ import tkio.service.AccountFlowRestrictService; ...@@ -17,6 +17,7 @@ import tkio.service.AccountFlowRestrictService;
import util.DateUtil; import util.DateUtil;
import util.ValidateUtil; import util.ValidateUtil;
import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -45,6 +46,12 @@ public class AccountTask { ...@@ -45,6 +46,12 @@ public class AccountTask {
public void task(){ public void task(){
logger.info("tkio task start :" + System.currentTimeMillis()); logger.info("tkio task start :" + System.currentTimeMillis());
List<PackageType> packageTypeList = packageTypeRepository.findAll();
Map<Long, String> map = new HashMap<>();
for(PackageType pt : packageTypeList){
map.put(pt.getId(), pt.getPackageName());
}
//清空前一天数据 //清空前一天数据
account4WebRepository.deleteAll(); account4WebRepository.deleteAll();
List<Account4Web> list = new ArrayList<>(); List<Account4Web> list = new ArrayList<>();
...@@ -52,17 +59,21 @@ public class AccountTask { ...@@ -52,17 +59,21 @@ public class AccountTask {
List<Account> accountValidList = accountRepository.findRootParentsUnPast(DateUtil.getBeforeDays(1)); List<Account> accountValidList = accountRepository.findRootParentsUnPast(DateUtil.getBeforeDays(1));
if(ValidateUtil.isValid(accountValidList)){ if(ValidateUtil.isValid(accountValidList)){
for(Account ac : accountValidList){ for(Account ac : accountValidList){
try{
AccountRestrict4Web restrict4Web = accountFlowRestrictService.findRestrictByAccount(ac.getId());
Account4Web account4Web = new Account4Web(); Account4Web account4Web = new Account4Web();
account4Web.setAccountId(ac.getId()); account4Web.setAccountId(ac.getId());
account4Web.setEmail(ac.getEmail()); account4Web.setEmail(ac.getEmail());
account4Web.setCompany(ac.getCompany()); account4Web.setCompany(ac.getCompany());
account4Web.setCreateDate(ac.getPubDate()); account4Web.setCreateDate(ac.getPubDate());
account4Web.setCreateDs(DateUtil.getFormatDate(ac.getPubDate())); account4Web.setCreateDs(DateUtil.getFormatDate(ac.getPubDate()));
account4Web.setPastDate(ac.getPastDate());
account4Web.setUser(ac.getName());
account4Web.setTell(ac.getPhone());
account4Web.setBussinessMan(ac.getBussinessman());
try{
AccountRestrict4Web restrict4Web = accountFlowRestrictService.findRestrictByAccount(ac.getId());
account4Web.setStatus(null == restrict4Web.getIOFlowNotified() ? "已激活" : (restrict4Web.getIOFlowNotified() ? "已激活" : "流量用尽")); account4Web.setStatus(null == restrict4Web.getIOFlowNotified() ? "已激活" : (restrict4Web.getIOFlowNotified() ? "已激活" : "流量用尽"));
account4Web.setPackageType(restrict4Web.getPackageName()); account4Web.setPackageType(restrict4Web.getPackageName());
account4Web.setPastDate(ac.getPastDate());
if (ac.getPricelevel().equals(7L) || ac.getPricelevel().equals(8L) || ac.getPricelevel().equals(5L) || ac.getPricelevel().equals(6L)){ if (ac.getPricelevel().equals(7L) || ac.getPricelevel().equals(8L) || ac.getPricelevel().equals(5L) || ac.getPricelevel().equals(6L)){
account4Web.setIo(restrict4Web.getThisMonthIOFlow()); account4Web.setIo(restrict4Web.getThisMonthIOFlow());
account4Web.setTrack(restrict4Web.getTrackTotalFlow()); account4Web.setTrack(restrict4Web.getTrackTotalFlow());
...@@ -95,11 +106,15 @@ public class AccountTask { ...@@ -95,11 +106,15 @@ public class AccountTask {
} }
} }
account4Web.setUser(ac.getName());
account4Web.setTell(ac.getPhone());
account4Web.setBussinessMan(ac.getBussinessman());
list.add(account4Web); list.add(account4Web);
} catch (Exception e){ } catch (Exception e){
account4Web.setPackageType(map.get(ac.getPricelevel()));
account4Web.setIoStatus(true);
account4Web.setTrackStatus(true);
account4Web.setStatus("已激活");
account4Web.setIo(new BigInteger("0"));
account4Web.setTrack(new BigInteger("0"));
list.add(account4Web);
logger.error("tkio task error :" + ac.getEmail()); logger.error("tkio task error :" + ac.getEmail());
} }
...@@ -107,11 +122,7 @@ public class AccountTask { ...@@ -107,11 +122,7 @@ public class AccountTask {
} }
//已过期的直接设置成过期 //已过期的直接设置成过期
List<Account> pastAccountList = accountRepository.findRootParentsPast(DateUtil.getBeforeDays(0)); List<Account> pastAccountList = accountRepository.findRootParentsPast(DateUtil.getBeforeDays(0));
List<PackageType> packageTypeList = packageTypeRepository.findAll();
Map<Long, String> map = new HashMap<>();
for(PackageType pt : packageTypeList){
map.put(pt.getId(), pt.getPackageName());
}
if(ValidateUtil.isValid(pastAccountList)){ if(ValidateUtil.isValid(pastAccountList)){
for(Account ac : pastAccountList){ for(Account ac : pastAccountList){
Account4Web account4Web = new Account4Web(); Account4Web account4Web = new Account4Web();
......
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