Commit 0589fce8 by manxiaoqiang

客户表

parent 8c1fae39
......@@ -17,6 +17,7 @@ import tkio.service.AccountFlowRestrictService;
import util.DateUtil;
import util.ValidateUtil;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -45,6 +46,12 @@ public class AccountTask {
public void task(){
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();
List<Account4Web> list = new ArrayList<>();
......@@ -52,17 +59,21 @@ public class AccountTask {
List<Account> accountValidList = accountRepository.findRootParentsUnPast(DateUtil.getBeforeDays(1));
if(ValidateUtil.isValid(accountValidList)){
for(Account ac : accountValidList){
Account4Web account4Web = new Account4Web();
account4Web.setAccountId(ac.getId());
account4Web.setEmail(ac.getEmail());
account4Web.setCompany(ac.getCompany());
account4Web.setCreateDate(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 account4Web = new Account4Web();
account4Web.setAccountId(ac.getId());
account4Web.setEmail(ac.getEmail());
account4Web.setCompany(ac.getCompany());
account4Web.setCreateDate(ac.getPubDate());
account4Web.setCreateDs(DateUtil.getFormatDate(ac.getPubDate()));
account4Web.setStatus(null == restrict4Web.getIOFlowNotified() ? "已激活" : (restrict4Web.getIOFlowNotified() ? "已激活" : "流量用尽"));
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)){
account4Web.setIo(restrict4Web.getThisMonthIOFlow());
account4Web.setTrack(restrict4Web.getTrackTotalFlow());
......@@ -95,11 +106,15 @@ public class AccountTask {
}
}
account4Web.setUser(ac.getName());
account4Web.setTell(ac.getPhone());
account4Web.setBussinessMan(ac.getBussinessman());
list.add(account4Web);
} 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());
}
......@@ -107,11 +122,7 @@ public class AccountTask {
}
//已过期的直接设置成过期
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)){
for(Account ac : pastAccountList){
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