|
@@ -248,6 +248,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
private CompanyDingdingMapper companyDingdingMapper;
|
|
|
@Resource
|
|
|
private SysRoleFunctionService sysRoleFunctionService;
|
|
|
+ private DingDingService dingDingService;
|
|
|
|
|
|
|
|
|
//获取报告列表
|
|
@@ -2165,6 +2166,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
String name = (String)a.get("name");
|
|
|
String uid = (String)a.get("userId");
|
|
|
String corpwxUserid = (String)a.get("corpwxUserid");
|
|
|
+ String fillUserName = (String)a.get("fillUserName");
|
|
|
System.out.println("createDate=="+createDate + " name=="+name+" uid=="+uid+" corpwxUserid=="+corpwxUserid);
|
|
|
if (lastName == null || !(lastName.get("name").equals(name) && lastName.get("dateStr").equals(createDate))) {
|
|
|
lastName = new HashMap<String, Object>();
|
|
@@ -2172,6 +2174,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
lastName.put("name", name);
|
|
|
lastName.put("userId", uid);
|
|
|
lastName.put("corpwxUserid", corpwxUserid);
|
|
|
+ lastName.put("fillUserName", fillUserName);
|
|
|
nameList.add(lastName);
|
|
|
userDailyReportList = new ArrayList<>();
|
|
|
lastName.put("data", userDailyReportList);
|
|
@@ -6460,6 +6463,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if(companyId == 7536){
|
|
|
titles.add("工单号");
|
|
|
titles.add("行号");
|
|
|
+ titles.add("协助部门");
|
|
|
}
|
|
|
titles.add(MessageUtils.message("entry.projectStage"));
|
|
|
if(companyId==936){
|
|
@@ -6804,6 +6808,17 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if(companyId == 7536){
|
|
|
item.add((String) map.get("extraField4"));
|
|
|
item.add((String) map.get("extraField5"));
|
|
|
+ //日报部门与提交人不是同一部门,则为协助部门
|
|
|
+ String creatorId = (String) map.get("creatorId");
|
|
|
+ Optional<User> curUser = userList.stream().filter(u->u.getId().equals(creatorId)).findFirst();
|
|
|
+ if (curUser.isPresent()) {
|
|
|
+ Integer userDeptId = curUser.get().getDepartmentId();
|
|
|
+ if(userDeptId != null && !userDeptId.equals(dept.getDepartmentId())){
|
|
|
+ item.add("协助部门");
|
|
|
+ } else {
|
|
|
+ item.add("");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
item.add(map.get("stageName")==null?"":(String) map.get("stageName"));
|
|
|
if(companyId==936){
|
|
@@ -11053,6 +11068,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
User operator = userMapper.selectById(request.getHeader("token"));
|
|
|
Integer companyId = operator.getCompanyId();
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
|
|
|
+ CompanyDingding dingding = companyDingdingService.getOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
|
|
|
List<Information> informationList = new ArrayList<>();
|
|
|
LocalDate firstDay = LocalDate.parse(ymonth + "-01");
|
|
|
LocalDate lastDay = firstDay.with(TemporalAdjusters.lastDayOfMonth());
|
|
@@ -11063,6 +11079,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
String curUserid = String.valueOf(e.get("userId"));
|
|
|
String date = String.valueOf(e.get("createDate"));
|
|
|
String userName = String.valueOf(e.get("name"));
|
|
|
+ String ddUserid = String.valueOf(e.get("dingdingUserId"));
|
|
|
information.setUserId(curUserid);
|
|
|
information.setTime(LocalDateTime.now());
|
|
|
information.setContent(date);
|
|
@@ -11101,6 +11118,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if(wxCorpInfo!=null&&e.get("corpwxUserId")!=null){
|
|
|
wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,String.valueOf(e.get("corpwxUserId")), reason, null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_ABNOEMAL);
|
|
|
}
|
|
|
+
|
|
|
+ if (dingding != null) {
|
|
|
+ companyDingdingService.sendRejectReportMsg(companyId,date, "全部项目", reason,operator.getName(), ddUserid);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
if(informationList.size()>0){
|
|
@@ -12109,6 +12130,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<User> manageUserList = new ArrayList<>();
|
|
|
List<UserCorpwxTime> userCorpwxTimeList = new ArrayList<>();
|
|
|
List<UserFvTime> userFvTimeList = new ArrayList<>();
|
|
|
+ List<UserDingdingTime> userDingdingTimeList = new ArrayList<>();
|
|
|
if (timeType.getSyncCorpwxTime() == 1) {
|
|
|
//获取考勤表记录
|
|
|
if (canViewAll) {
|
|
@@ -12236,6 +12258,62 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
manageUserList.add(user);
|
|
|
}
|
|
|
}
|
|
|
+ } else if (timeType.getSyncDingding() == 1) {
|
|
|
+ //获取user_dingding_time表的考勤记录
|
|
|
+ if (canViewAll) {
|
|
|
+ if (!StringUtils.isEmpty(userId)) {
|
|
|
+ User findUser = userMapper.selectById(userId);
|
|
|
+ if (findUser != null) {
|
|
|
+ userDingdingTimeList = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>().eq("company_id", companyId).eq("user_id", userId).between("work_date", firstDay, lastDay));
|
|
|
+ manageUserList.add(findUser);
|
|
|
+ }
|
|
|
+ } else if (deptId != null) {
|
|
|
+ //按部门过滤
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
+ List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
|
|
|
+ if (manageUserList.size() > 0) {
|
|
|
+ List<String> collect = manageUserList.stream().map(User::getId).collect(Collectors.toList());
|
|
|
+ userDingdingTimeList = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>().eq("company_id", companyId).in("user_id", collect).between("work_date", firstDay, lastDay));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ userDingdingTimeList = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>().eq("company_id", companyId).between("work_date", firstDay, lastDay));
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //是否是部门负责人
|
|
|
+ List<Integer> allDeptIds = getAllVisibleDeptIdList(user, departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId)));
|
|
|
+ if (allDeptIds.size() > 0) {
|
|
|
+ if (!StringUtils.isEmpty(userId)) {
|
|
|
+ User findUser = userMapper.selectById(userId);
|
|
|
+ if (findUser != null) {
|
|
|
+ manageUserList.add(findUser);
|
|
|
+ }
|
|
|
+ } else if (deptId != null) {
|
|
|
+ //按部门过滤
|
|
|
+ if (allDeptIds.contains(deptId)) {
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
+ List<Integer> allSubDeptIds = departmentService.getDeptIncludeSubDeptIds(deptId, allDeptList);
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allSubDeptIds));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //取部门的人员
|
|
|
+ manageUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds));
|
|
|
+ }
|
|
|
+ //如果自己不在manageUserList中,加进去
|
|
|
+ if (!manageUserList.stream().anyMatch(u -> u.getId().equals(user.getId()))) {
|
|
|
+ manageUserList.add(user);
|
|
|
+ }
|
|
|
+ List<String> userIdList = manageUserList.stream().map(User::getId).collect(Collectors.toList());
|
|
|
+ if (userIdList.size() > 0) {
|
|
|
+ userDingdingTimeList = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>().eq("company_id", companyId).in("user_id", userIdList).between("work_date", firstDay, lastDay));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //个人看自己的
|
|
|
+ userDingdingTimeList = userDingdingTimeMapper.selectList(new QueryWrapper<UserDingdingTime>().eq("company_id", companyId).eq("user_id", user.getId()).between("work_date", firstDay, lastDay));
|
|
|
+ manageUserList.add(user);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
//去掉不提醒的人员
|
|
|
for (int i=0;i<manageUserList.size();i++) {
|
|
@@ -12250,6 +12328,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
} else if (timeType.getSyncFanwei() == 1) {
|
|
|
//从userFvTimeList中去掉
|
|
|
userFvTimeList.removeIf(userFvTime -> userFvTime.getUserId() != null && userFvTime.getUserId().equals(item.getId()));
|
|
|
+ } else if (timeType.getSyncDingding() == 1) {
|
|
|
+ //从userFvTimeList中去掉
|
|
|
+ userDingdingTimeList.removeIf(userDdTime -> userDdTime.getUserId() != null && userDdTime.getUserId().equals(item.getId()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -12260,7 +12341,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
int LEAVE_PROJECT_ID = 80333;
|
|
|
if (canViewAll && StringUtils.isEmpty(userId) && deptId == null) {
|
|
|
//查看全公司的
|
|
|
- QueryWrapper<Report> reportQueryWrapper = new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").eq("company_id", companyId).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date");
|
|
|
+ QueryWrapper<Report> reportQueryWrapper = new QueryWrapper<Report>().select("fill_userid,creator_id,create_date, sum(working_time) as working_time").eq("company_id", companyId).ne("state", 2).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date");
|
|
|
if (companyId == HONGHUCompanyId) {
|
|
|
reportQueryWrapper.ne("project_id", LEAVE_PROJECT_ID);//泓浒,排除掉请假项目,请假是自动生成的,不计考勤工时
|
|
|
}
|
|
@@ -12268,7 +12349,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
} else if (manageUserList.size() > 0) {
|
|
|
List<String> userIdList = manageUserList.stream().map(User::getId).collect(Collectors.toList());
|
|
|
if (userIdList.size() > 0) {
|
|
|
- QueryWrapper<Report> reportQueryWrapper = new QueryWrapper<Report>().select("creator_id,create_date, sum(working_time) as working_time").between("create_date", firstDay, lastDay).groupBy("creator_id,create_date");
|
|
|
+ QueryWrapper<Report> reportQueryWrapper = new QueryWrapper<Report>().select("fill_userid,creator_id,create_date, sum(working_time) as working_time").ne("state", 2).between("create_date", firstDay, lastDay).groupBy("creator_id,create_date");
|
|
|
if (userIdList.size() == 1) {
|
|
|
reportQueryWrapper.eq("creator_id", userIdList.get(0));
|
|
|
//按单个人匹配
|
|
@@ -12364,9 +12445,43 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ } else if (timeType.getSyncDingding() == 1) {
|
|
|
+ for (UserDingdingTime ddTime : userDingdingTimeList) {
|
|
|
+ boolean isMatch = true;
|
|
|
+ double reportTime = 0;
|
|
|
+ Optional<User> first = manageUserList.stream().filter(u -> u.getId().equals(ddTime.getUserId())).findFirst();
|
|
|
+ if (first.isPresent()) {
|
|
|
+ User targetUser = first.get();
|
|
|
+ for (Report report : reportList) {
|
|
|
+ if (report.getCreatorId().equals(ddTime.getUserId()) && ddTime.getWorkDate().isEqual(report.getCreateDate())) {
|
|
|
+ reportTime = report.getWorkingTime();
|
|
|
+ //不一致
|
|
|
+ if (Math.abs(ddTime.getWorkHours() - report.getWorkingTime()) > 0.01) {
|
|
|
+ isMatch = false;
|
|
|
+ ddTime.setName(targetUser.getName());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!isMatch) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("userId", ddTime.getUserId());
|
|
|
+ map.put("dingdingUserId", targetUser.getDingdingUserid());
|
|
|
+ map.put("name", ddTime.getName());
|
|
|
+ map.put("createDate", dateTimeFormatter.format(ddTime.getWorkDate()));
|
|
|
+ map.put("workHours", ddTime.getWorkHours());
|
|
|
+ map.put("reportTime", reportTime);
|
|
|
+ resultList.add(map);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
//反向,检测有填报日报但是没有考勤的数据
|
|
|
for (Report report : reportList) {
|
|
|
+ //代填的不校验
|
|
|
+ if (report.getFillUserid() != null && !report.getFillUserid().equals(report.getCreatorId())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
boolean hasCardTime = false;
|
|
|
Optional<User> first = manageUserList.stream().filter(u -> u.getId().equals(report.getCreatorId())).findFirst();
|
|
|
if (!first.isPresent()) {
|
|
@@ -12396,12 +12511,23 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ } else if (timeType.getSyncDingding() == 1) {
|
|
|
+ for (UserDingdingTime ddTime : userDingdingTimeList) {
|
|
|
+ //人员/日期匹配
|
|
|
+ if (targetUser.getId().equals(ddTime.getUserId()) && ddTime.getWorkDate().isEqual(report.getCreateDate())) {
|
|
|
+ if (ddTime.getWorkHours() > 0) {
|
|
|
+ hasCardTime = true;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (!hasCardTime) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
map.put("userId", targetUser.getId());
|
|
|
map.put("corpwxUserId", targetUser.getCorpwxUserid());
|
|
|
+ map.put("dingdingUserId", targetUser.getDingdingUserid());
|
|
|
map.put("name", targetUser.getName());
|
|
|
map.put("createDate", dateTimeFormatter.format(report.getCreateDate()));
|
|
|
map.put("workHours", 0);
|