Commit 3285625c by lzxry

CAS批量导入处理

parent def3298a
...@@ -106,6 +106,7 @@ public class Contract { ...@@ -106,6 +106,7 @@ public class Contract {
private String validStartDate;//有效开始日 private String validStartDate;//有效开始日
private String validEndDate;//有效结束日 private String validEndDate;//有效结束日
private Double oneTimeRecognizedRevenue;//一次性确认收入 private Double oneTimeRecognizedRevenue;//一次性确认收入
private Boolean oneTime;//是否计算一次性收入,0不计算
@Id @Id
@GeneratedValue @GeneratedValue
...@@ -690,6 +691,14 @@ public class Contract { ...@@ -690,6 +691,14 @@ public class Contract {
this.oneTimeRecognizedRevenue = oneTimeRecognizedRevenue; this.oneTimeRecognizedRevenue = oneTimeRecognizedRevenue;
} }
public Boolean getOneTime() {
return oneTime;
}
public void setOneTime(Boolean oneTime) {
this.oneTime = oneTime;
}
@Override @Override
public String toString() { public String toString() {
return "Contract{" + return "Contract{" +
......
...@@ -98,6 +98,9 @@ public class ContractServiceImpl implements ContractService { ...@@ -98,6 +98,9 @@ public class ContractServiceImpl implements ContractService {
put("签约销售", "sale"); put("签约销售", "sale");
put("关联合同编号", "relation_code"); put("关联合同编号", "relation_code");
put("补充协议签订日期", "signed_date"); put("补充协议签订日期", "signed_date");
put("有效开始日", "valid_start_date");
put("有效结束日", "valid_end_date");
put("是否计算一次性收入", "one_time");
}}; }};
private static final Map<String, String> SHEET_TITLE_RESERVE = new HashMap() {{ private static final Map<String, String> SHEET_TITLE_RESERVE = new HashMap() {{
...@@ -119,6 +122,9 @@ public class ContractServiceImpl implements ContractService { ...@@ -119,6 +122,9 @@ public class ContractServiceImpl implements ContractService {
put("sale", "签约销售"); put("sale", "签约销售");
put("relation_code", "关联合同编号"); put("relation_code", "关联合同编号");
put("signed_date", "补充协议签订日期"); put("signed_date", "补充协议签订日期");
put("valid_start_date", "有效开始日");
put("valid_end_date", "有效结束日");
put("one_time", "是否计算一次性收入");
}}; }};
public static final String UPLOAD_TITLE = "我方签约主体,客户签约主体,行业分类,合同开始日期,合同结束日期," + public static final String UPLOAD_TITLE = "我方签约主体,客户签约主体,行业分类,合同开始日期,合同结束日期," +
...@@ -131,6 +137,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -131,6 +137,7 @@ public class ContractServiceImpl implements ContractService {
put("ADI", "adi"); put("ADI", "adi");
put("ADS", "ads"); put("ADS", "ads");
put("ABTEST", "abtest"); put("ABTEST", "abtest");
put("CAS", "cas");
}}; }};
public static final Map<String, String> SHEET_NAMES_RESERVE = new HashMap() {{ public static final Map<String, String> SHEET_NAMES_RESERVE = new HashMap() {{
...@@ -140,6 +147,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -140,6 +147,7 @@ public class ContractServiceImpl implements ContractService {
put("adi", "ADI"); put("adi", "ADI");
put("ads", "ADS"); put("ads", "ADS");
put("abtest", "ABTEST"); put("abtest", "ABTEST");
put("cas", "CAS");
}}; }};
Logger logger = LoggerFactory.getLogger(ContractServiceImpl.class); Logger logger = LoggerFactory.getLogger(ContractServiceImpl.class);
...@@ -505,7 +513,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -505,7 +513,7 @@ public class ContractServiceImpl implements ContractService {
if (resource == null) { if (resource == null) {
return null; return null;
} }
resource.setOneTime(true);
//补充协议 //补充协议
if("2".equals(resource.getContractType()) && "tkio".equals(resource.getPlatform())){ if("2".equals(resource.getContractType()) && "tkio".equals(resource.getPlatform())){
//关联合同不能为空 //关联合同不能为空
...@@ -2434,6 +2442,8 @@ public class ContractServiceImpl implements ContractService { ...@@ -2434,6 +2442,8 @@ public class ContractServiceImpl implements ContractService {
int row_length; int row_length;
if (platform.equals("tkio")) { if (platform.equals("tkio")) {
row_length = 17; row_length = 17;
}if (platform.equals("cas")) {
row_length = 16;
} else { } else {
row_length = 13; row_length = 13;
} }
...@@ -2519,6 +2529,11 @@ public class ContractServiceImpl implements ContractService { ...@@ -2519,6 +2529,11 @@ public class ContractServiceImpl implements ContractService {
titleKey.remove("signed_date"); titleKey.remove("signed_date");
titleKey.remove("关联合同编号"); titleKey.remove("关联合同编号");
titleKey.remove("relation_code"); titleKey.remove("relation_code");
}else if(!platform.equals("cas")){
titleKey.remove("有效开始日");
titleKey.remove("valid_start_date");
titleKey.remove("有效结束日");
titleKey.remove("valid_end_date");
} }
int row_already = titleKey.size(); int row_already = titleKey.size();
...@@ -2571,7 +2586,7 @@ public class ContractServiceImpl implements ContractService { ...@@ -2571,7 +2586,7 @@ public class ContractServiceImpl implements ContractService {
//return ResultModel.ERROR("第" + line_num + "行【" + SHEET_TITLE_RESERVE.get(sheetTitle) + "】不能为空,请重新上传"); //return ResultModel.ERROR("第" + line_num + "行【" + SHEET_TITLE_RESERVE.get(sheetTitle) + "】不能为空,请重新上传");
} }
} else { } else {
String dataSTR = formatter.formatCellValue(cell).trim(); String dataSTR = formatter.formatCellValue(cell).trim();
//校验合同编号 //校验合同编号
if ("contract_code".equals(sheetTitle)) { if ("contract_code".equals(sheetTitle)) {
if (!codeUniqueDic.containsKey(dataSTR)) { if (!codeUniqueDic.containsKey(dataSTR)) {
...@@ -2683,6 +2698,12 @@ public class ContractServiceImpl implements ContractService { ...@@ -2683,6 +2698,12 @@ public class ContractServiceImpl implements ContractService {
}else if("relation_code".equals(sheetTitle)){ }else if("relation_code".equals(sheetTitle)){
s_data[w] = dataSTR; s_data[w] = dataSTR;
filter.put("relation_code",dataSTR); filter.put("relation_code",dataSTR);
}else if("one_time".equals(sheetTitle)){
if(dataSTR.equals("否")){
s_data[w] = false;
}else{
s_data[w] = true;
}
}else { }else {
//主账号不为空,按照之前逻辑不变 //主账号不为空,按照之前逻辑不变
s_data[w] = dataSTR; s_data[w] = dataSTR;
......
...@@ -220,7 +220,12 @@ public class ShareIncomeServiceImpl implements ShareIncomeService { ...@@ -220,7 +220,12 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
Long excludTax = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100L)).longValue();//不含税收入*100 Long excludTax = bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100L)).longValue();//不含税收入*100
contract.setIncomeExcludingTax(excludTax); contract.setIncomeExcludingTax(excludTax);
BigDecimal oneTimeRecognizedRevenue = bigDecimal.multiply(new BigDecimal("0.9")); BigDecimal oneTimeRecognizedRevenue = null;
if(contract.getOneTime()!=null&&contract.getOneTime()==false){//处理cas是否计算一次性收入标识
oneTimeRecognizedRevenue = new BigDecimal("0");
}else{
oneTimeRecognizedRevenue = bigDecimal.multiply(new BigDecimal("0.9"));
}
BigDecimal dailyRevenueRecognition = bigDecimal.multiply(new BigDecimal("0.1")); BigDecimal dailyRevenueRecognition = bigDecimal.multiply(new BigDecimal("0.1"));
contract.setOneTimeRecognizedRevenue(oneTimeRecognizedRevenue.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); contract.setOneTimeRecognizedRevenue(oneTimeRecognizedRevenue.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
int contractAllDay = getDayRange(contractPart[0], contractPart[1]) + 1;//合同总天数 int contractAllDay = getDayRange(contractPart[0], contractPart[1]) + 1;//合同总天数
...@@ -272,9 +277,9 @@ public class ShareIncomeServiceImpl implements ShareIncomeService { ...@@ -272,9 +277,9 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
boolean isLateContract = false; // 是否为晚录合同(为了兼容历史数据 此处做冗余判断) boolean isLateContract = false; // 是否为晚录合同(为了兼容历史数据 此处做冗余判断)
if (ContractStatusEnum.LATE.getKey().equals(contract.getStatus())) { if (ContractStatusEnum.LATE.getKey().equals(contract.getStatus())) {
isLateContract = true; isLateContract = true;
} else if (checkLateContract(contractValidPart[0], creatPoints[0])) { }/* else if (checkLateContract(contractValidPart[0], creatPoints[0])) {
isLateContract = true; isLateContract = true;
} }*/
if (isLateContract) { if (isLateContract) {
contract.setStatus(ContractStatusEnum.LATE.getKey()); contract.setStatus(ContractStatusEnum.LATE.getKey());
...@@ -1034,10 +1039,10 @@ public class ShareIncomeServiceImpl implements ShareIncomeService { ...@@ -1034,10 +1039,10 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
boolean isLateContract = false; // 是否为晚录合同(为了兼容历史数据 此处做冗余判断) boolean isLateContract = false; // 是否为晚录合同(为了兼容历史数据 此处做冗余判断)
if (ContractStatusEnum.LATE.getKey().equals(contract.getStatus())) { if (ContractStatusEnum.LATE.getKey().equals(contract.getStatus())) {
isLateContract = true; isLateContract = true;
} else if (checkLateContract(contractPart[0], creatPoints[0])) { }/* else if (checkLateContract(contractPart[0], creatPoints[0])) {
isLateContract = true; isLateContract = true;
contract.setStatus(ContractStatusEnum.LATE.getKey()); contract.setStatus(ContractStatusEnum.LATE.getKey());
} }*/
boolean isLater = true; boolean isLater = true;
if (!isLateContract) { if (!isLateContract) {
......
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