|
@@ -124,6 +124,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
private StagesMapper stagesMapper;
|
|
|
@Resource
|
|
|
private UserSalaryService userSalaryService;
|
|
|
+ @Resource
|
|
|
+ private AuditWorkflowTimeSettingMapper auditWorkflowTimeSettingMapper;
|
|
|
|
|
|
@Value(value = "${upload.path}")
|
|
|
private String path;
|
|
@@ -339,7 +341,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
for (Map<String, Object> report : reportList) {
|
|
|
String picStr = (String)report.get("picStr");
|
|
|
- if (picStr != null) {
|
|
|
+ if (picStr != null && !"@".equals(picStr)) {
|
|
|
JSONArray array = JSONArray.parseArray(picStr.replaceAll("@", ","));
|
|
|
List<String> picList = new ArrayList<>();
|
|
|
for (int i=0;i<array.size(); i++) {
|
|
@@ -415,7 +417,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
r.setStages(stagesMapper.getProjectStages(r.getProjectId()));
|
|
|
}
|
|
|
//处理图片
|
|
|
- if (!StringUtils.isEmpty(r.getPicStr())) {
|
|
|
+ if (!StringUtils.isEmpty(r.getPicStr()) && !r.getPicStr().equals("@")) {
|
|
|
JSONArray array = JSONArray.parseArray(r.getPicStr().replaceAll("@", ","));
|
|
|
List<String> list = new ArrayList<>();
|
|
|
for (int i=0;i<array.size(); i++) {
|
|
@@ -599,27 +601,53 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if (wxCorpInfoMapper.selectCount(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId)) > 0) {
|
|
|
WxCorpInfo corpInfo = wxCorpInfoMapper.selectList(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId)).get(0);
|
|
|
for (Report report : reportList) {
|
|
|
- if (!StringUtils.isEmpty(report.getPicAdd()) && !report.getPicAdd().equals("@")) {
|
|
|
- report.setPicStr(report.getPicStr());
|
|
|
+ if (!StringUtils.isEmpty(report.getPicAdd())) {
|
|
|
Report item = new Report();
|
|
|
item.setId(report.getId());
|
|
|
- item.setPicStr(report.getPicAdd());
|
|
|
- batchUpdateList.add(item);
|
|
|
-
|
|
|
- String s = item.getPicStr().replaceAll("@", ",");
|
|
|
- JSONArray array = JSONArray.parseArray(s);
|
|
|
- for (int i = 0; i < array.size(); i++) {
|
|
|
- String string = array.getString(i);
|
|
|
- wxCorpInfoService.downloadFile(corpInfo, string);
|
|
|
+
|
|
|
+ //和历史数据比对,要计算本次新增的照片
|
|
|
+ Report oldItem = reportMapper.selectById(report.getId());
|
|
|
+ String newPics = report.getPicAdd();
|
|
|
+ if (!newPics.equals(oldItem.getPicStr())) {
|
|
|
+ //对比变化,有变化才处理
|
|
|
+ JSONArray oldArray = null;
|
|
|
+ if (oldItem.getPicStr() != null && !"@".equals(oldItem.getPicStr())) {
|
|
|
+ String oldPicArrStr = oldItem.getPicStr().replaceAll("@", ",");
|
|
|
+ oldArray = JSONArray.parseArray(oldPicArrStr);
|
|
|
+ }
|
|
|
+ item.setPicStr(newPics);
|
|
|
+ batchUpdateList.add(item);
|
|
|
+
|
|
|
+ //有照片才处理
|
|
|
+ if (!newPics.equals("@")) {
|
|
|
+ String s = item.getPicStr().replaceAll("@", ",");
|
|
|
+ JSONArray array = JSONArray.parseArray(s);
|
|
|
+ for (int i = 0; i < array.size(); i++) {
|
|
|
+ String string = array.getString(i);
|
|
|
+ boolean exists = false;
|
|
|
+ if (oldArray != null) {
|
|
|
+ for (int j=0;j<oldArray.size(); j++) {
|
|
|
+ String oldPicItem = oldArray.getString(j);
|
|
|
+ if (oldPicItem.equals(string)) {
|
|
|
+ exists = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //本次新增的照片要去企业微信下载
|
|
|
+ if (!exists) {
|
|
|
+ wxCorpInfoService.downloadFile(corpInfo, string);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
if (batchUpdateList.size() > 0) {
|
|
|
updateBatchById(batchUpdateList);
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
@@ -656,7 +684,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
Integer companyId = curUser.getCompanyId();
|
|
|
Integer isEngeering = companyMapper.selectById(companyId).getPackageEngineering();
|
|
|
String leaderId = null;
|
|
|
- if (curUser.getRole() == 0) {//普通员工
|
|
|
+ if (curUser.getRole() != 1 && curUser.getRole() != 2) {//非超级管理员和系统管理员
|
|
|
leaderId = curUser.getId();
|
|
|
}
|
|
|
List<Map<String, Object>> auditReportList = reportMapper.getAuditReportList(date, companyId, departmentId, projectId, leaderId, isEngeering);
|
|
@@ -716,7 +744,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
for (Map<String, Object> report : reportList) {
|
|
|
String picStr = (String)report.get("picStr");
|
|
|
- if (picStr != null) {
|
|
|
+ if (picStr != null && !"@".equals(picStr)) {
|
|
|
JSONArray array = JSONArray.parseArray(picStr.replaceAll("@", ","));
|
|
|
List<String> picList = new ArrayList<>();
|
|
|
for (int i=0;i<array.size(); i++) {
|
|
@@ -749,7 +777,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
try {
|
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
Company company = companyMapper.selectById(user.getCompanyId());
|
|
|
- final List<Long> ids = ListUtil.convertIdsArrayToList(reportIds);
|
|
|
+ final List<Integer> ids = ListUtil.convertIntegerIdsArrayToList(reportIds);
|
|
|
if (company.getPackageEngineering() == 1) {
|
|
|
//检查是否有专业进度待审核
|
|
|
List<ReportProfessionProgress> list = reportProfessionProgressService.list(new QueryWrapper<ReportProfessionProgress>().in("report_id", ids).eq("audit_state", 0));
|
|
@@ -821,9 +849,18 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- //直接进行项目经理审核
|
|
|
- reportMapper.update(new Report().setState(1),
|
|
|
- new QueryWrapper<Report>().in("id", ids));
|
|
|
+ String creatorId = reportMapper.selectById(ids.get(0)).getCreatorId();
|
|
|
+ User auditTargetUser = userMapper.selectById(creatorId);
|
|
|
+ List<AuditWorkflowTimeSetting> settings = auditWorkflowTimeSettingMapper.selectList(new QueryWrapper<AuditWorkflowTimeSetting>().eq("dept_id", auditTargetUser.getDepartmentId()));
|
|
|
+ if (settings.size() == 0) {
|
|
|
+ //直接进行项目经理审核
|
|
|
+ reportMapper.update(new Report().setState(1),
|
|
|
+ new QueryWrapper<Report>().in("id", ids));
|
|
|
+ } else {
|
|
|
+ //按流程走
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
} catch (NullPointerException e) {
|
|
@@ -1290,7 +1327,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
int cnt = 0;
|
|
|
for (Integer reportId : ids) {
|
|
|
Report report = new Report();
|
|
|
- report.setState(3);//待提交
|
|
|
+ report.setState(3);//待提交,即草稿状态
|
|
|
if (user.getRole() == 0) {
|
|
|
//自己只能撤销待审核状态的
|
|
|
cnt += reportMapper.update(report, new QueryWrapper<Report>().eq("id", reportId).eq("state", 0));
|
|
@@ -1387,7 +1424,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
for (Map<String, Object> report : reportList) {
|
|
|
String picStr = (String)report.get("picStr");
|
|
|
- if (picStr != null) {
|
|
|
+ if (picStr != null && !"@".equals(picStr)) {
|
|
|
JSONArray array = JSONArray.parseArray(picStr.replaceAll("@", ","));
|
|
|
List<String> picList = new ArrayList<>();
|
|
|
for (int i=0;i<array.size(); i++) {
|
|
@@ -1480,7 +1517,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
for (Map<String, Object> report : reportList) {
|
|
|
String picStr = (String)report.get("picStr");
|
|
|
- if (picStr != null) {
|
|
|
+ if (picStr != null && !"@".equals(picStr)) {
|
|
|
JSONArray array = JSONArray.parseArray(picStr.replaceAll("@", ","));
|
|
|
List<String> picList = new ArrayList<>();
|
|
|
for (int i=0;i<array.size(); i++) {
|
|
@@ -2084,7 +2121,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg listDeptImportByState(String leaderId, Integer projectId, String startDate, String endDate, Integer departmentId, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg listDeptImportByState(String leaderId, Integer projectId, Integer dateType, String date, Integer departmentId, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
@@ -2101,89 +2138,17 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
filterDeptIds.add(departmentId);
|
|
|
filterDeptIds.addAll(subDepts.stream().map(Department::getDepartmentId).collect(Collectors.toList()));
|
|
|
}
|
|
|
+ String startDate = null;
|
|
|
+ String endDate = null;
|
|
|
+ if (dateType == 0) {
|
|
|
+ startDate = date;
|
|
|
+ endDate = date;
|
|
|
+ } else {
|
|
|
+ //按月
|
|
|
+ startDate = date + "-01";
|
|
|
+ endDate = date + "-31";
|
|
|
+ }
|
|
|
List<Map<String, Object>> auditReportList = reportMapper.getDeptImportAuditList(companyId, leaderId, startDate, endDate, filterDeptIds, projectId);
|
|
|
-// //抽取姓名,进行分组
|
|
|
-// List<Map<String, Object>> nameList = new ArrayList<Map<String, Object>>();
|
|
|
-// Map<String, Object> lastName = null;
|
|
|
-// //某个用户某天下的各个项目日报列表
|
|
|
-// List<Map<String, Object>> userDailyReportList = null;
|
|
|
-// for (Map a : auditReportList) {
|
|
|
-// String createDate = (String)a.get("date");
|
|
|
-// String name = (String)a.get("name");
|
|
|
-//
|
|
|
-// if (lastName == null || !(lastName.get("name").equals(name) && lastName.get("dateStr").equals(createDate))) {
|
|
|
-// lastName = new HashMap<String, Object>();
|
|
|
-// lastName.put("dateStr", createDate);
|
|
|
-// lastName.put("name", name);
|
|
|
-// nameList.add(lastName);
|
|
|
-// userDailyReportList = new ArrayList<>();
|
|
|
-// lastName.put("data", userDailyReportList);
|
|
|
-// }
|
|
|
-// //每组日报数据都加上去
|
|
|
-// userDailyReportList.add(a);
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
-// List<Profession> professions = professionMapper.selectList(new QueryWrapper<Profession>().eq("company_id", curUser.getCompanyId()));
|
|
|
-// for (int index=0;index<nameList.size(); index++) {
|
|
|
-// Map<String, Object> map2 = nameList.get(index);
|
|
|
-// List<Map<String, Object>> list2 = (List)map2.get("data");
|
|
|
-// //项目专业进度
|
|
|
-// if (isEngeering == 1) {
|
|
|
-// for (Map<String, Object> map : list2) {
|
|
|
-// //获取当前项目的工程专业进度
|
|
|
-// List<ReportProfessionProgress> progressList = reportProfessionProgressService.list(new QueryWrapper<ReportProfessionProgress>().eq("report_id", (int)map.get("id")));
|
|
|
-// progressList.stream().forEach(p->{
|
|
|
-// p.setProfessionName(professions.stream().filter(m->m.getId().equals(p.getProfessionId())).findFirst().get().getName());
|
|
|
-// });
|
|
|
-// map.put("professionProgressList", progressList);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// double reportTime = 0;
|
|
|
-// BigDecimal total = new BigDecimal(0);
|
|
|
-// //计算每日汇总的工时成本
|
|
|
-// for (Map<String, Object> m : list2) {
|
|
|
-// double t = (double) m.get("time");
|
|
|
-// reportTime += t;
|
|
|
-// total = total.add((BigDecimal)m.get("cost"));
|
|
|
-// }
|
|
|
-// DecimalFormat df = new DecimalFormat("0.00");
|
|
|
-// map2.put("reportTime", df.format(reportTime));
|
|
|
-// map2.put("cost", total);
|
|
|
-// map2.put("state", list2.get(0).get("state"));
|
|
|
-// }
|
|
|
-
|
|
|
- //设置照片和项目工时成本显示
|
|
|
-// for (Map map : nameList) {
|
|
|
-// List<Map<String, Object>> reportList = (List<Map<String, Object>>)map.get("data");
|
|
|
-// StringBuilder sb = new StringBuilder();
|
|
|
-// for (int t=0;t<reportList.size(); t++) {
|
|
|
-// Map<String, Object> report = reportList.get(t);
|
|
|
-// String picStr = (String)report.get("picStr");
|
|
|
-// if (picStr != null) {
|
|
|
-// JSONArray array = JSONArray.parseArray(picStr.replaceAll("@", ","));
|
|
|
-// List<String> picList = new ArrayList<>();
|
|
|
-// for (int i=0;i<array.size(); i++) {
|
|
|
-// String string = array.getString(i);
|
|
|
-// string = "/upload/" + string + ".jpg";
|
|
|
-// picList.add(string);
|
|
|
-// }
|
|
|
-// report.put("pics", picList);
|
|
|
-// }
|
|
|
-// if (((Integer)report.get("multiWorktime")) == 1) {
|
|
|
-// //设置多个工时情况下的报告列表
|
|
|
-// String timeStr = (String)report.get("content");
|
|
|
-// report.put("worktimeList", JSONArray.parse(timeStr));
|
|
|
-// }
|
|
|
-// //抽取项目,工时和成本
|
|
|
-// sb.append(report.get("project")+"("+report.get("time")+"h/"+report.get("cost")+"元)");
|
|
|
-// if (t < reportList.size() -1) {
|
|
|
-// sb.append(" | ");
|
|
|
-// }
|
|
|
-// }
|
|
|
-// map.put("allProjectTime", sb.toString());
|
|
|
-// }
|
|
|
|
|
|
httpRespMsg.data = auditReportList;
|
|
|
} catch (NullPointerException e) {
|