|
@@ -389,6 +389,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (projectMapper.updateById(p) == 0) {
|
|
|
httpRespMsg.setError("操作失败");
|
|
|
} else {
|
|
|
+ if (customerId == null) {
|
|
|
+ //去掉客户
|
|
|
+ projectMapper.removeProjectCustomer(id);
|
|
|
+ }
|
|
|
//修改项目相关表
|
|
|
ProjectTimer timer = new ProjectTimer();
|
|
|
timer.setProjectName(name);
|
|
@@ -1210,7 +1214,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
int total = taskMapper.getProjectTaskCount(companyId);
|
|
|
int pageStart = (pageIndex -1) * pageSize;
|
|
|
- System.out.println("companyId="+companyId+", pageStart="+pageStart+", pageSize="+pageSize);
|
|
|
List projectTask = taskMapper.getProjectTask(companyId, pageStart, pageSize);
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -1924,6 +1927,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
seq++;
|
|
|
}
|
|
|
String total = totalMoneyCost.toString();
|
|
|
+ DecimalFormat df = new DecimalFormat("#0.0");
|
|
|
//合计
|
|
|
List<String> sumRow = new ArrayList<String>();
|
|
|
sumRow.add("合计");
|
|
@@ -1933,10 +1937,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
sumRow.add("");
|
|
|
sumRow.add("");
|
|
|
sumRow.add("");
|
|
|
- sumRow.add(""+totalWorkTime);
|
|
|
- sumRow.add(""+totalCostTime);
|
|
|
+ sumRow.add(""+df.format(totalWorkTime));
|
|
|
+ sumRow.add(""+df.format(totalCostTime));
|
|
|
if (hasViewSalary) {
|
|
|
- sumRow.add(totalMoneyCost.toString());
|
|
|
+ sumRow.add(total);
|
|
|
}
|
|
|
allList.add(sumRow);
|
|
|
//生成excel文件导出
|
|
@@ -1987,6 +1991,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
projectLevelMap.put("紧急", 2);
|
|
|
projectLevelMap.put("重要", 3);
|
|
|
projectLevelMap.put("重要且紧急", 4);
|
|
|
+ List<String> existCodeList = new ArrayList<>();
|
|
|
+ int importCount = 0;
|
|
|
for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
|
|
|
XSSFRow row = sheet.getRow(rowIndex);
|
|
|
if (row == null) {
|
|
@@ -2037,7 +2043,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
//检查项目是否存在
|
|
|
List<ProjectCategory> projectCategoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id", user.getCompanyId()));
|
|
|
- if (categoryCell != null) {
|
|
|
+ if (categoryCell != null && !StringUtils.isEmpty(categoryCell.getStringCellValue())) {
|
|
|
Optional<ProjectCategory> category = projectCategoryList.stream().filter(pc -> pc.getName().equals(categoryCell.getStringCellValue())).findFirst();
|
|
|
if(!category.isPresent()){
|
|
|
throw new Exception("项目分类["+categoryCell.getStringCellValue()+"]不存在");
|
|
@@ -2051,7 +2057,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (!StringUtils.isEmpty(code)) {
|
|
|
int cnt = projectMapper.selectCount(new QueryWrapper<Project>().eq("project_code", code).eq("company_id", user.getCompanyId()));
|
|
|
if (cnt > 0) {
|
|
|
- throw new Exception("项目编号存在重复: " + code);
|
|
|
+// throw new Exception("项目编号存在重复: " + code);
|
|
|
+ existCodeList.add(code);
|
|
|
+ //跳过编号重复的数据
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
project.setProjectCode(code);
|
|
@@ -2098,6 +2107,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
project.setIsPublic("是".equals(isPublicCell.getStringCellValue())?1:0);
|
|
|
}
|
|
|
projectMapper.insert(project);
|
|
|
+ importCount++;
|
|
|
//处理子项目
|
|
|
if (subNameCell != null) {
|
|
|
//兼容中英文逗号
|
|
@@ -2117,7 +2127,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (participatorCell != null) {
|
|
|
String part = participatorCell.getStringCellValue();
|
|
|
if (!StringUtils.isEmpty(part)) {
|
|
|
- String[] split = part.split(",");
|
|
|
+ String[] split = part.split("\\,|\\,");
|
|
|
for (String str : split) {
|
|
|
Participation p = new Participation();
|
|
|
Optional<User> first = userList.stream().filter(u -> u.getName().equals(str)).findFirst();
|
|
@@ -2133,6 +2143,11 @@ 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;
|
|
|
+ }
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
msg.setError("文件处理出错");
|