Commit def3298a by lzxry

CAS

parent bebfec0c
......@@ -89,6 +89,7 @@
<report.url>http://10.3.20.41:9010</report.url>
<import.temp.url>http://10.3.20.41:9001</import.temp.url>
<adi.url>http://39.104.114.198</adi.url>
<!--Redis setting-->
<redis.key.validtime>120</redis.key.validtime>
......@@ -162,6 +163,7 @@
<!--<report.url>http://localhost:9010</report.url>-->
<report.url>http://10.3.20.41:9010</report.url>
<import.temp.url>http://10.3.20.41:9001</import.temp.url>
<adi.url>http://39.104.114.198</adi.url>
<contract.uppath></contract.uppath>
<!--Redis setting-->
<redis.key.validtime>120</redis.key.validtime>
......@@ -260,6 +262,7 @@
<report.url>http://internal-report-api-976419027.cn-north-1.elb.amazonaws.com.cn</report.url>
<import.temp.url>http://172.31.25.137:9001</import.temp.url>
<adi.url>http://www.adinsights.cn</adi.url>
<!--Redis setting-->
<redis.key.validtime>120</redis.key.validtime>
<redis.ip.requesttimes>5</redis.ip.requesttimes>
......
......@@ -48,6 +48,10 @@ public class ADIUser implements Serializable{
private String pastDate;
private Boolean sitOn=false;//是否坐席
private Boolean useStatus=true;//坐席启用
private String accountStatus;
private String sendStatus;
private String sendTime;
public Boolean getSitOn() {
return sitOn;
......@@ -365,6 +369,30 @@ public class ADIUser implements Serializable{
this.constractStartTime = constractStartTime;
}
public String getAccountStatus() {
return accountStatus;
}
public void setAccountStatus(String accountStatus) {
this.accountStatus = accountStatus;
}
public String getSendStatus() {
return sendStatus;
}
public void setSendStatus(String sendStatus) {
this.sendStatus = sendStatus;
}
public String getSendTime() {
return sendTime;
}
public void setSendTime(String sendTime) {
this.sendTime = sendTime;
}
@Override
public String toString() {
return "ADIUser{" +
......
......@@ -22,9 +22,11 @@ import org.json.JSONException;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import tkio.model.PackageType;
import userio.repository.IOPackageTypeRepository;
import userio.repository.IOSalesManLeaderRepository;
import util.Constant;
import util.DateUtil;
import util.HttpClientUtil;
import util.ValidateUtil;
......@@ -70,7 +72,6 @@ public class ADIAccountServiceImpl implements ADIAccountService {
ReminderLevelRepository reminderLevelRepository;
@Autowired
PressMoneyRepository pressMoneyRepository;
private static String u = "http://www.adinsights.cn/";
@Override
public Map<String, Object> findSale(User user, Long sale) {
Map<String, Object> map = new HashMap();
......@@ -135,7 +136,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
ADIUser adiUser = findOne(contract.getEmail());
if(null != adiUser){
String url = u + "adi/api/user/web/update";
String url = Constant.adiUrl + "adi/api/user/web/update";
Map<String,String> conditions = new HashMap<>();
conditions.put("expriedTime", contract.getEndDate() + " 00:00:00");
conditions.put("constractStartTime",contract.getStartDate() + " 00:00:00");
......@@ -154,7 +155,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
private List<ADIUser> getAllAccount() throws JSONException {
List<ADIUser> list = new ArrayList<>();
String url = u + "adi/api/user/web/list";
String url = Constant.adiUrl + "adi/api/user/web/list";
Map<String,String> conditions = new HashMap<>();
conditions.put("type","");
conditions.put("status","");
......@@ -319,21 +320,22 @@ public class ADIAccountServiceImpl implements ADIAccountService {
}
@Override
public ADIUser findOne(String email) {
String url = u + "adi/api/user/web/one";
Map<String,String> conditions = new HashMap<>();
conditions.put("field", "email");
conditions.put("value",email);
String request = HttpClientUtil.doHttpPostRequest(url, "",conditions,"utf-8");
String url = Constant.adiUrl + "/adi/api/user/web/one?email="+email;
String request = HttpClientUtil.doHttpGetRequest(url, "");
ADIUser adiUser =null;
try {
JSONObject rs = new JSONObject(request);
String content = rs.get("content").toString();
if(!"null".equals(content)){
try {
adiUser = new ObjectMapper().readValue(content, ADIUser.class);
} catch (IOException e) {
e.printStackTrace();
}
if(!StringUtils.isEmpty(content)){
JSONArray jsonArray = new JSONArray(content);
JSONObject jsonObject = jsonArray.getJSONObject(0);
adiUser = new ADIUser();
adiUser.setCompany(jsonObject.getString("company"));
adiUser.setAccountStatus(jsonObject.getString("accountStatus"));
adiUser.setSendStatus(jsonObject.getString("sendStatus"));
adiUser.setEmail(jsonObject.getString("email"));
adiUser.setSendTime(jsonObject.getString("sendTime"));
//adiUser = new ObjectMapper().readValue(content, ADIUser.class);
}
} catch (JSONException e) {
e.printStackTrace();
......@@ -368,7 +370,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
contract.setStatus("executing");
contractRepository.save(contract);
}
String url = u + "adi/api/user/web/update";
String url = Constant.adiUrl + "adi/api/user/web/update";
Map<String,String> conditions = new HashMap<>();
conditions.put("expriedTime", null);
conditions.put("constractStartTime",null);
......@@ -406,7 +408,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
contractRepository.save(contract);
}
String url = u + "adi/api/user/web/update";
String url = Constant.adiUrl + "adi/api/user/web/update";
Map<String,String> conditions = new HashMap<>();
conditions.put("expriedTime", null);
conditions.put("constractStartTime",null);
......@@ -545,7 +547,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
}
public static void main(String[] args) {
String url = u + "adi/api/user/web/one";
String url = Constant.adiUrl + "adi/api/user/web/one";
Map<String,String> conditions = new HashMap<>();
conditions.put("field", "email");
conditions.put("value","zhangshaoyou@reyun.com");
......
......@@ -137,6 +137,9 @@ public class ContractController {
if(platform.equals("tkio")){
title = Arrays.asList("录入时间,合同编号,客户账号,我方签约主体,签约方,行政区域,隶属集团,行业分类,销售,开始日期,结束日期,套餐类型,合同流量(万次),赠送流量(万次),合同金额,签约类型,合同状态,回款状态,关联合同,关联合同编号,补充协议签订日期"
.split(","));
}if(platform.equals("cas")){
title = Arrays.asList("录入时间,合同编号,客户账号,我方签约主体,签约方,行政区域,隶属集团,行业分类,销售,开始日期,结束日期,套餐类型,有效期开始日有效期结束日,合同金额,签约类型,合同状态,回款状态,关联合同"
.split(","));
}else{
title = Arrays.asList("录入时间,合同编号,客户账号,我方签约主体,签约方,行政区域,隶属集团,行业分类,销售,开始日期,结束日期,套餐类型,合同金额,签约类型,合同状态,回款状态,关联合同"
.split(","));
......@@ -173,11 +176,21 @@ public class ContractController {
rowBody.createCell(19).setCellValue(contract.getRelationCode() == null ? "" : contract.getRelationCode());
rowBody.createCell(20).setCellValue(contract.getSignedDate() == null ? "" : contract.getSignedDate());
}else{
rowBody.createCell(12).setCellValue(contract.getMoney() == null ? 0 : contract.getMoney());
rowBody.createCell(13).setCellValue(CONTRACT_STATUS.get(contract.getContractType()));
rowBody.createCell(14).setCellValue(CONTRACT_STATUS.get(contract.getStatus()));
rowBody.createCell(15).setCellValue(CONTRACT_STATUS.get(contract.getBackStatus() + "_back"));
rowBody.createCell(16).setCellValue(contract.getRelationCode() == null ? "" : contract.getRelationCode());
if(platform.equals("cas")){
rowBody.createCell(12).setCellValue(contract.getValidStartDate());
rowBody.createCell(13).setCellValue(contract.getValidEndDate());
rowBody.createCell(14).setCellValue(contract.getMoney() == null ? 0 : contract.getMoney());
rowBody.createCell(15).setCellValue(CONTRACT_STATUS.get(contract.getContractType()));
rowBody.createCell(16).setCellValue(CONTRACT_STATUS.get(contract.getStatus()));
rowBody.createCell(17).setCellValue(CONTRACT_STATUS.get(contract.getBackStatus() + "_back"));
rowBody.createCell(18).setCellValue(contract.getRelationCode() == null ? "" : contract.getRelationCode());
}else{
rowBody.createCell(12).setCellValue(contract.getMoney() == null ? 0 : contract.getMoney());
rowBody.createCell(13).setCellValue(CONTRACT_STATUS.get(contract.getContractType()));
rowBody.createCell(14).setCellValue(CONTRACT_STATUS.get(contract.getStatus()));
rowBody.createCell(15).setCellValue(CONTRACT_STATUS.get(contract.getBackStatus() + "_back"));
rowBody.createCell(16).setCellValue(contract.getRelationCode() == null ? "" : contract.getRelationCode());
}
}
}
......@@ -512,6 +525,8 @@ public class ContractController {
workbook = createTKIOExcel(contracts);
}else if(platform.equals("adi")){
workbook = createADIExcel(contracts);
}else if(platform.equals("cas")){
workbook = createCASExcel(contracts);
}else{
workbook = createCommonExcel(contracts);
}
......@@ -545,7 +560,47 @@ public class ContractController {
this.exportWrite(fileName, sb.toString(), "分摊收入报表", response);*/
}
private HSSFWorkbook createCASExcel(List<Contract> contracts) {
DecimalFormat df = new DecimalFormat("##,##0.00");
//创建工作薄对象
HSSFWorkbook workbook = new HSSFWorkbook();//这里也可以设置sheet的Name
//创建工作表对象
HSSFSheet sheet = workbook.createSheet();
//创建工作表的行
HSSFRow row = sheet.createRow(0);
List<String> title = Arrays.asList("我方签约主体,签约方,合同编号,行政区域,隶属集团,合同状态,合同金额,不含税收入,合同开始日期,合同截止日期,套餐类型,有效期开始日,有效期结束日,一次性确认收入,区间使用天数,区间分摊收入,调整额,分摊总收入"
.split(","));
int lineSize = title.size();
for (int i = 0; i < lineSize; i++) {
row.createCell(i).setCellValue(title.get(i));
}
for (int i = 0; i < contracts.size(); i++) {
Contract contract = contracts.get(i);
HSSFRow rowBody = sheet.createRow(i + 1);
rowBody.createCell(0).setCellValue(contract.getMyBodyName());
rowBody.createCell(1).setCellValue(contract.getCustomerBody());
rowBody.createCell(2).setCellValue(contract.getContractCode());
rowBody.createCell(3).setCellValue(contract.getBarrioName());
rowBody.createCell(4).setCellValue(contract.getBelongGroup());
rowBody.createCell(5).setCellValue(CONTRACT_STATUS.get(contract.getStatus()));
rowBody.createCell(6).setCellValue(df.format(contract.getMoney()));
rowBody.createCell(7).setCellValue(df.format(contract.getIncomeExcludingTax() * 1.0 / 100));
rowBody.createCell(8).setCellValue(contract.getStartDate());
rowBody.createCell(9).setCellValue(contract.getEndDate());
rowBody.createCell(10).setCellValue(contract.getPriceLevelName());
rowBody.createCell(11).setCellValue(contract.getValidStartDate());
rowBody.createCell(12).setCellValue(contract.getValidEndDate());
rowBody.createCell(13).setCellValue(contract.getOneTimeRecognizedRevenue());
rowBody.createCell(14).setCellValue(contract.getIntervalUseDays());
rowBody.createCell(15).setCellValue(df.format(contract.getIntervaIncomeShare() * 1.0 / 100));
rowBody.createCell(16).setCellValue(df.format(contract.getAdjustmentFund() * 1.0 / 100));
rowBody.createCell(17).setCellValue(df.format(contract.getIncomeShareAll() * 1.0 / 100));
}
return workbook;
}
private HSSFWorkbook createADIExcel(List<Contract> contracts) {
DecimalFormat df = new DecimalFormat("##,##0.00");
//创建工作薄对象
......
......@@ -103,6 +103,10 @@ public class Contract {
private double historyTkioFlow;//万单位,保留四位
private BigDecimal unitPriceAccurate;//16位的单价
private String validStartDate;//有效开始日
private String validEndDate;//有效结束日
private Double oneTimeRecognizedRevenue;//一次性确认收入
@Id
@GeneratedValue
public Long getId() {
......@@ -661,6 +665,31 @@ public class Contract {
this.unitPriceAccurate = unitPriceAccurate;
}
public String getValidStartDate() {
return validStartDate;
}
public void setValidStartDate(String validStartDate) {
this.validStartDate = validStartDate;
}
public String getValidEndDate() {
return validEndDate;
}
public void setValidEndDate(String validEndDate) {
this.validEndDate = validEndDate;
}
@Transient
public Double getOneTimeRecognizedRevenue() {
return oneTimeRecognizedRevenue;
}
public void setOneTimeRecognizedRevenue(Double oneTimeRecognizedRevenue) {
this.oneTimeRecognizedRevenue = oneTimeRecognizedRevenue;
}
@Override
public String toString() {
return "Contract{" +
......@@ -725,11 +754,14 @@ public class Contract {
", trackFlow=" + trackFlow +
", unitPrice=" + unitPrice +
", clickFlow=" + clickFlow +
", operate=" + operate +
", nextSignedDate='" + nextSignedDate + '\'' +
", nextSignedContractCode='" + nextSignedContractCode + '\'' +
", signedDate='" + signedDate + '\'' +
", historyTkioFlow=" + historyTkioFlow +
", unitPriceAccurate=" + unitPriceAccurate +
", validStartDate='" + validStartDate + '\'' +
", validEndDate='" + validEndDate + '\'' +
'}';
}
}
......@@ -237,7 +237,7 @@ public class ContractServiceImpl implements ContractService {
Account account = null;
IOAccount4Web ioAccount4Web = null;
ADIUser adiUser = null;
platfrom = "tkio";
//platfrom = "tkio";
if ("tkio".equals(platfrom)) {
//account4Web = account4WebRepository.findByEmail(email);
......@@ -256,16 +256,19 @@ public class ContractServiceImpl implements ContractService {
} else if ("io".equals(platfrom)) {
ioAccount4Web = ioAccount4WebRepository.findByEmail(email);
} else if ("adi".equals(platfrom)) {
} else if ("adi".equals(platfrom) || "cas".equals(platfrom) ) {
adiUser = adiAccountService.findOne(email);
}
if (null == account && null == ioAccount4Web && null == adiUser) {
if (null == account && null == ioAccount4Web && null == adiUser ) {
map.put("result", 0);
} else {
BigInteger integer = contractRepository.countNumByEmail(email, platfrom);
map.put("result", 1);
if (platfrom.equals("adi")) {
map.put("company", adiUser.getCompany());
}else if (platfrom.equals("cas")) {
map.put("company", adiUser.getCompany());
map.put("validStartDate", adiUser.getSendTime());
} else {
// map.put("company", null == account4Web ? ioAccount4Web.getCompany() : account4Web.getCompany());
map.put("company", account.getCompany());
......
......@@ -24,6 +24,7 @@ public class Constant {
public static ResourceBundle commonBundle = ResourceBundle.getBundle("common");
public static String reportUrl = commonBundle.getString("report.url");
public static String importTempUrl = commonBundle.getString("import.temp.url");
public static String adiUrl = commonBundle.getString("adi.url");
public static ResourceBundle redis = ResourceBundle.getBundle("redis");
public static String REDIS_KEY_VALID_TIME = redis.getString("redis.key.validtime");
......
......@@ -21,6 +21,7 @@ public class ContractBranchUtil {
map.put("ads", "type_one");
map.put("abtest", "type_one");
map.put("tkio", "type_two");
map.put("cas", "type_three");
}
public static String getValue(String key){
return map.get(key);
......
......@@ -5,3 +5,4 @@ profile.table=${profile.table}
event.table=${event.table}
usergroup.table=${usergroup.table}
iscache=${iscache}
adi.url=${adi.url}
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