|
@@ -2763,6 +2763,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
throw new Exception("项目名称不能为空");
|
|
|
}
|
|
|
Project project = new Project();
|
|
|
+ boolean flag=false;
|
|
|
if (codeCell != null) {
|
|
|
String code = codeCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
|
|
|
if (code.equals("项目编号") && rowIndex == 0) {
|
|
@@ -2790,7 +2791,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
// throw new Exception("项目编号存在重复: " + code);
|
|
|
existCodeList.add(code);
|
|
|
//跳过编号重复的数据
|
|
|
- continue;
|
|
|
+ flag=true;
|
|
|
}
|
|
|
}
|
|
|
project.setProjectCode(code);
|
|
@@ -2835,12 +2836,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (isPublicCell != null && !StringUtils.isEmpty(isPublicCell.getStringCellValue())) {
|
|
|
project.setIsPublic("是".equals(isPublicCell.getStringCellValue())?1:0);
|
|
|
}
|
|
|
- if(projectMapper.insert(project)>0){
|
|
|
- ProjectAuditor projectAuditor=new ProjectAuditor();
|
|
|
- projectAuditor.setAuditorId(project.getInchargerId());
|
|
|
- projectAuditor.setAuditorName(project.getInchargerName());
|
|
|
- projectAuditor.setProjectId(project.getId());
|
|
|
- projectAuditorMapper.insert(projectAuditor);
|
|
|
+ if(flag){
|
|
|
+ Project updateProject = projectMapper.selectList(new QueryWrapper<Project>().eq("project_code", project.getProjectCode()).eq("company_id", user.getCompanyId())).get(0);
|
|
|
+ project.setId(updateProject.getId());
|
|
|
+ projectMapper.updateById(project);
|
|
|
+ }else {
|
|
|
+ if(projectMapper.insert(project)>0){
|
|
|
+ ProjectAuditor projectAuditor=new ProjectAuditor();
|
|
|
+ projectAuditor.setAuditorId(project.getInchargerId());
|
|
|
+ projectAuditor.setAuditorName(project.getInchargerName());
|
|
|
+ projectAuditor.setProjectId(project.getId());
|
|
|
+ projectAuditorMapper.insert(projectAuditor);
|
|
|
+ }
|
|
|
}
|
|
|
importCount++;
|
|
|
//处理子项目
|
|
@@ -2905,7 +2912,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
msg.data = "成功导入"+importCount+"条数据。";
|
|
|
if (existCodeList.size() > 0) {
|
|
|
String collect = existCodeList.stream().collect(Collectors.joining(","));
|
|
|
- msg.data += "自动跳过"+existCodeList.size()+"条已存在项目编码:"+collect;
|
|
|
+ msg.data += "自动更新"+existCodeList.size()+"条已存在项目编码:"+collect;
|
|
|
}
|
|
|
OperationRecord operationRecord=new OperationRecord();
|
|
|
operationRecord.setCompanyId(user.getCompanyId());
|
|
@@ -3097,6 +3104,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
throw new Exception("项目名称不能为空");
|
|
|
}
|
|
|
Project project = new Project();
|
|
|
+ boolean flag=false;
|
|
|
if (codeCell != null) {
|
|
|
String code = codeCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
|
|
|
if (code.equals("项目编号") && rowIndex == 0) {
|
|
@@ -3129,7 +3137,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
// throw new Exception("项目编号存在重复: " + code);
|
|
|
existCodeList.add(code);
|
|
|
//跳过编号重复的数据
|
|
|
- continue;
|
|
|
+ flag=true;
|
|
|
}
|
|
|
}
|
|
|
project.setProjectCode(code);
|
|
@@ -3325,17 +3333,28 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(projectMapper.insert(project)>0){
|
|
|
- ProjectAuditor projectAuditor=new ProjectAuditor();
|
|
|
- projectAuditor.setAuditorId(project.getInchargerId());
|
|
|
- projectAuditor.setAuditorName(project.getInchargerName());
|
|
|
- projectAuditor.setProjectId(project.getId());
|
|
|
- projectAuditorMapper.insert(projectAuditor);
|
|
|
+ if(flag){
|
|
|
+ Project updateProject = projectMapper.selectList(new QueryWrapper<Project>().eq("project_code", project.getProjectCode()).eq("company_id", user.getCompanyId())).get(0);
|
|
|
+ project.setId(updateProject.getId());
|
|
|
+ projectMapper.updateById(project);
|
|
|
+ }else {
|
|
|
+ if(projectMapper.insert(project)>0){
|
|
|
+ ProjectAuditor projectAuditor=new ProjectAuditor();
|
|
|
+ projectAuditor.setAuditorId(project.getInchargerId());
|
|
|
+ projectAuditor.setAuditorName(project.getInchargerName());
|
|
|
+ projectAuditor.setProjectId(project.getId());
|
|
|
+ projectAuditorMapper.insert(projectAuditor);
|
|
|
+ }
|
|
|
}
|
|
|
Integer id = project.getId();
|
|
|
//处理威派格 垂直分表项目数据数据
|
|
|
if(company.getId()==936){
|
|
|
- ProjectSeparate projectSeparate=new ProjectSeparate();
|
|
|
+ ProjectSeparate projectSeparate = projectSeparateMapper.selectById(id);
|
|
|
+ boolean check=true;
|
|
|
+ if(projectSeparate==null){
|
|
|
+ projectSeparate=new ProjectSeparate();
|
|
|
+ check=false;
|
|
|
+ }
|
|
|
projectSeparate.setId(id);
|
|
|
if (warrantyStartDateCell !=null&& warrantyStartDateCell.getCellTypeEnum() == CellType.NUMERIC && !StringUtils.isEmpty(warrantyStartDateCell.getDateCellValue())) {
|
|
|
projectSeparate.setWarrantyStartDate(LocalDate.parse(sdf.format(warrantyStartDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
|
@@ -3356,7 +3375,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (projectCategorySubCell != null && !StringUtils.isEmpty(projectCategorySubCell.getStringCellValue())) {
|
|
|
projectSeparate.setProjectCategorySub(projectCategorySubCell.getStringCellValue());
|
|
|
}
|
|
|
- projectSeparateMapper.insert(projectSeparate);
|
|
|
+ if(flag&&check){
|
|
|
+ projectSeparateMapper.updateById(projectSeparate);
|
|
|
+ }else {
|
|
|
+ projectSeparateMapper.insert(projectSeparate);
|
|
|
+ }
|
|
|
}
|
|
|
importCount++;
|
|
|
//参与人
|
|
@@ -3405,7 +3428,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
msg.data = "成功导入"+importCount+"条数据。";
|
|
|
if (existCodeList.size() > 0) {
|
|
|
String collect = existCodeList.stream().collect(Collectors.joining(","));
|
|
|
- msg.data += "自动跳过"+existCodeList.size()+"条已存在项目编码:"+collect;
|
|
|
+ msg.data += "自动更新"+existCodeList.size()+"条已存在项目编码:"+collect;
|
|
|
}
|
|
|
OperationRecord operationRecord=new OperationRecord();
|
|
|
operationRecord.setCompanyId(user.getCompanyId());
|