|
@@ -14051,13 +14051,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg getTimeCostByWorkNum(String startDate, String endDate, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg getTimeCostByWorkNum(String startDate, String endDate,Integer deptId, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
try {
|
|
|
User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
|
Integer companyId =targetUser.getCompanyId();
|
|
|
+ //查看当前部门包括子部门的人员
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
+ List<Integer> deptIds =deptId==null?null: departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
- List<Map<String, Object>> list = projectMapper.getTimeCostByWorkNum(companyId, startDate, endDate);
|
|
|
+ List<Map<String, Object>> list = projectMapper.getTimeCostByWorkNum(companyId, startDate, endDate,deptIds);
|
|
|
BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
|
|
|
for (Map<String, Object> map : list) {
|
|
|
if (!map.containsKey("cost")) {
|
|
@@ -14082,12 +14085,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg exportTimeCostByWorkNum(String startDate, String endDate, HttpServletRequest request) {
|
|
|
+ public HttpRespMsg exportTimeCostByWorkNum(String startDate, String endDate,Integer deptId, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
CompanyDingding dingding = companyDingdingMapper.selectOne(new QueryWrapper<CompanyDingding>().eq("company_id", user.getCompanyId()));
|
|
|
- HttpRespMsg msg = getTimeCostByWorkNum(startDate, endDate, request);
|
|
|
+ //查找所有部门
|
|
|
+ List<Department> allDepartments = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
|
+ HttpRespMsg msg = getTimeCostByWorkNum(startDate, endDate,deptId, request);
|
|
|
Map<String, Object> data = (Map<String, Object>) (Map<String, Object>) msg.data;
|
|
|
List<Map<String, Object>> resultList = (List<Map<String, Object>>) data.get("costList");
|
|
|
|
|
@@ -14098,6 +14103,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
titleList.add("工单号");
|
|
|
titleList.add("工时");
|
|
|
titleList.add("工时成本");
|
|
|
+ titleList.add("部门");
|
|
|
dataList.add(titleList);
|
|
|
for (int i = 0; i < resultList.size(); i++) {
|
|
|
List<String> strList=new ArrayList<>();
|
|
@@ -14110,6 +14116,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
strList.add(costStr);
|
|
|
strList.add(costMoneyStr);
|
|
|
+ Optional<Department> first = allDepartments.stream().filter(dl -> dl.getDepartmentId().longValue()==(Long) stringObjectMap.get("deptId")).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ strList.add("$departmentName="+(first.get().getCorpwxDeptid()==null?"":first.get().getCorpwxDeptid())+"$");
|
|
|
+ }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
+ strList.add("$departmentName="+(first.get().getDdDeptid()==null?"":first.get().getDdDeptid())+"$");
|
|
|
+ }else {
|
|
|
+ strList.add(first.get().getDepartmentName());
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ strList.add("");
|
|
|
+ }
|
|
|
+
|
|
|
dataList.add(strList);
|
|
|
}
|
|
|
String fileName = "工单工时成本统计表"+System.currentTimeMillis();
|