Commit a3580531 by lzxry

导入补充协议

parent 05d387ec
......@@ -96,6 +96,8 @@ public class ContractServiceImpl implements ContractService {
put("合同开始日期", "start_date");
put("合同结束日期", "end_date");
put("签约销售", "sale");
put("关联合同编号", "relation_code");
put("补充协议签订日期", "signed_date");
}};
private static final Map<String, String> SHEET_TITLE_RESERVE = new HashMap() {{
......@@ -115,6 +117,8 @@ public class ContractServiceImpl implements ContractService {
put("start_date", "合同开始日期");
put("end_date", "合同结束日期");
put("sale", "签约销售");
put("relation_code", "关联合同编号");
put("signed_date", "补充协议签订日期");
}};
public static final String UPLOAD_TITLE = "我方签约主体,客户签约主体,行业分类,合同开始日期,合同结束日期," +
......@@ -510,7 +514,7 @@ public class ContractServiceImpl implements ContractService {
}
//补充协议开始日期不能晚于原始合同的结束日期
Contract relationContract = contractRepository.findOne(resource.getRelationContract());
if(relationContract.getEndDate().compareTo(resource.getStartDate())<0){
if(relationContract.getEndDate().compareTo(resource.getSignedDate())<0){
Contract contractExist = new Contract();
contractExist.setId(-100L);
contractExist.setErroMessage("补充协议开始日期不能晚于原始合同的结束日期");
......@@ -887,7 +891,7 @@ public class ContractServiceImpl implements ContractService {
}
//补充协议开始日期不能晚于原始合同的结束日期
Contract relationContract = contractRepository.findOne(resource.getRelationContract());
if(relationContract.getEndDate().compareTo(resource.getStartDate())<0){
if(relationContract.getEndDate().compareTo(resource.getSignedDate())<0){
Contract contractExist = new Contract();
contractExist.setId(-100L);
contractExist.setErroMessage("补充协议开始日期不能晚于原始合同的结束日期");
......@@ -2423,7 +2427,7 @@ public class ContractServiceImpl implements ContractService {
try {
int row_length;
if (platform.equals("tkio")) {
row_length = 15;
row_length = 17;
} else {
row_length = 13;
}
......@@ -2505,6 +2509,10 @@ public class ContractServiceImpl implements ContractService {
titleKey.remove("track_flow");
titleKey.remove("赠送流量");
titleKey.remove("extra_flow");
titleKey.remove("补充协议签订日期");
titleKey.remove("signed_date");
titleKey.remove("关联合同编号");
titleKey.remove("relation_code");
}
int row_already = titleKey.size();
......@@ -2537,6 +2545,9 @@ public class ContractServiceImpl implements ContractService {
continue;
}
Map<String, String> filter = new HashMap<>();
filter.put("rowIndex",j+"");
for (int w = 0; w < titleKey.size(); w++) {
String sheetTitle = titleKey.get(w);
Cell cell = row_data.getCell(w);
......@@ -2593,6 +2604,7 @@ public class ContractServiceImpl implements ContractService {
return ResultModel.ERROR("第" + line_num + "行【签约类型】错误");
} else {
s_data[w] = CONTRACT_TYPE_NAME.get(dataSTR);
filter.put("contractType",CONTRACT_TYPE_NAME.get(dataSTR));
}
} else if ("price_level".equals(sheetTitle)) {
if (packageMap != null && (!packageMap.containsKey(dataSTR) && !packageMap.containsValue(Long.parseLong(dataSTR)))) {
......@@ -2604,7 +2616,7 @@ public class ContractServiceImpl implements ContractService {
s_data[w] = packageMap.get(dataSTR);
}
}
} else if ("start_date".equals(sheetTitle) || "end_date".equals(sheetTitle)) {
} else if ("start_date".equals(sheetTitle) || "end_date".equals(sheetTitle) || "signed_date".equals(sheetTitle)) {
String dfmate = cell.getCellStyle().getDataFormatString();
if (!"yyyy/mm;@".equals(dfmate)
......@@ -2621,11 +2633,15 @@ public class ContractServiceImpl implements ContractService {
if (org.apache.poi.ss.usermodel.DateUtil.isCellDateFormatted(cell)) {
// 用于转化为日期格式
Date d = cell.getDateCellValue();
if ("start_date".equals(sheetTitle)) {
createTime = d;
}
DateFormat formater = new SimpleDateFormat("yyyy-MM-dd");
s_data[w] = formater.format(d);
if("signed_date".equals(sheetTitle)){
createTime = d;
filter.put("signedDate",formater.format(d));
}else if ("start_date".equals(sheetTitle)) {
createTime = d;
}
} else {
s_data[w] = cell.toString();
}
......@@ -2643,7 +2659,16 @@ public class ContractServiceImpl implements ContractService {
} else {
return ResultModel.ERROR("第" + line_num + "行【行政区域】code错误");
}
} else {
}else if ("barrio_id".equals(sheetTitle)) {
if (barrioCityMap.containsKey(Long.parseLong(dataSTR))) {
s_data[w] = dataSTR;
} else {
return ResultModel.ERROR("第" + line_num + "行【行政区域】code错误");
}
}else if("relation_contract".equals(sheetTitle)){
s_data[w] = dataSTR;
filter.put("relationContract",dataSTR);
}else {
//主账号不为空,按照之前逻辑不变
s_data[w] = dataSTR;
if ("email".equals(sheetTitle) && !StringUtils.isEmpty(dataSTR) && "tkio".equals(platformexcl)) {
......@@ -2656,6 +2681,29 @@ public class ContractServiceImpl implements ContractService {
}
}
if(platform.equals("tkio")&&filter.get("contractType").equals("2")){
if(filter.get("relationContract")==null){
return ResultModel.ERROR("第" + filter.get("rowIndex") + "行【关联合同编号】为空");
}else{
String relationContract = filter.get("relationContract");
Contract masterContract = contractRepository.findByCodePlatform(relationContract, "tkio");
if(masterContract==null){
return ResultModel.ERROR("第" + filter.get("rowIndex") + "行【关联合同编号】不存在");
}else{
String endDate = masterContract.getEndDate();
String signedDate = filter.get("signedDate");
if(signedDate==null){
return ResultModel.ERROR("第" + filter.get("rowIndex") + "行【补充协议签订日期】为空");
}else{
if(endDate.compareTo(signedDate)<0){
return ResultModel.ERROR("第" + filter.get("rowIndex") + "行【补充协议签订日期】不能晚于关联合同的结束日期");
}
}
}
}
}
if (!accountsEmail.isEmpty()) {
List<String> emails = accountRepository.findEmailByEmails(accountsEmail);
Map<String, String> emailDic;
......
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