|
@@ -22,6 +22,7 @@ import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
|
|
|
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
|
|
|
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
|
+import org.apache.logging.log4j.util.PropertySource;
|
|
|
import org.apache.poi.EncryptedDocumentException;
|
|
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|
|
import org.apache.poi.ss.usermodel.*;
|
|
@@ -47,6 +48,7 @@ import java.math.RoundingMode;
|
|
|
import java.sql.Timestamp;
|
|
|
import java.text.DateFormat;
|
|
|
import java.text.DecimalFormat;
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -4231,9 +4233,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
Company company = companyMapper.selectById(companyId);
|
|
|
//准备部门数据
|
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
|
|
|
- List<UserFvTime> userFvTimeList = userFvTimeMapper.selectList(new LambdaQueryWrapper<UserFvTime>().between(UserFvTime::getWorkDate, startDate, endDate));
|
|
|
- List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, company.getId()));
|
|
|
- //处理特殊节假日设置
|
|
|
//特殊节假日配置
|
|
|
List<HolidaySetting> holidaySettingList = holidaySettingService.list(new LambdaQueryWrapper<HolidaySetting>().eq(HolidaySetting::getCompanyId, companyId));
|
|
|
//针对全员生效的日期
|
|
@@ -4258,7 +4257,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
String[] userSplit = userIdStr.split(",");
|
|
|
targetUserIds = Arrays.asList(userSplit);
|
|
|
}
|
|
|
- List<UserCustom> userCustomList = userCustomMapper.selectList(new LambdaQueryWrapper<UserCustom>().eq(UserCustom::getCompanyId, companyId));
|
|
|
DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
//String[] weekDayCHN = {"周一","周二","周三","周四","周五","周六","周日"};
|
|
|
String[] weekDayCHN = {MessageUtils.message("week.Monday"),MessageUtils.message("week.Tuesday"),MessageUtils.message("week.Wednesday"),MessageUtils.message("week.Thursday"),MessageUtils.message("week.Friday"),MessageUtils.message("week.Saturday"),MessageUtils.message("week.Sunday")};
|
|
@@ -4273,12 +4271,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
//检查是不是部门负责人(含主要负责人和其他负责人)
|
|
|
List<Integer> allDeptIds = getAllVisibleDeptIdList(user, allDeptList);
|
|
|
if (allDeptIds.size() > 0) {
|
|
|
- list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, allDeptIds, null);
|
|
|
- //部门负责人看自己部门相关的
|
|
|
- allRangeUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds).orderByDesc("department_id"));
|
|
|
+ list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, allDeptIds, null,user.getId());
|
|
|
+ //部门负责人看自己部门相关的 以及自己的
|
|
|
+ allRangeUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds).or().eq("id",user.getId()).orderByDesc("department_id"));
|
|
|
} else {
|
|
|
//看自己的所负责的项目相关人员的
|
|
|
- list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, null, user.getId());
|
|
|
+ list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, null, user.getId(),user.getId());
|
|
|
//项目相关的人员列表
|
|
|
List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("incharger_id", user.getId()));
|
|
|
List<Project> collect = projectList.stream().collect(Collectors.toList());
|
|
@@ -4286,12 +4284,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<Participation> participationList = participationMapper.selectList(new QueryWrapper<Participation>().in("project_id", collect));
|
|
|
List<String> collect1 = participationList.stream().map(Participation::getUserId).collect(Collectors.toList());
|
|
|
if (collect1.size() > 0) {
|
|
|
- allRangeUserList = userMapper.selectList(new QueryWrapper<User>().in("id", collect1).orderByDesc("department_id"));
|
|
|
+ allRangeUserList = userMapper.selectList(new QueryWrapper<User>().in("id", collect1).or().eq("id",user.getId()).orderByDesc("department_id"));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, null, null);
|
|
|
+ list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, null, null,user.getId());
|
|
|
//管理员看全公司所有人
|
|
|
allRangeUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).orderByDesc("department_id"));
|
|
|
}
|
|
@@ -4317,36 +4315,6 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
String date = new SimpleDateFormat("yyyy-MM-dd").format((Date)data.get("createDate"));
|
|
|
map.put("workingTime", data.get("workingTime"));
|
|
|
map.put("createDate", date);
|
|
|
- //针对景昱 5978 校验填报工时是否超过考勤
|
|
|
- if(user.getCompanyId().equals(5978)){
|
|
|
- map.put("exceedCardTime",0);
|
|
|
- Optional<UserFvTime> first = userFvTimeList.stream().filter(u -> u.getWorkDate().isEqual(LocalDate.parse(date, df)) && u.getUserId().equals(id)).findFirst();
|
|
|
- if(first.isPresent()){
|
|
|
- if(first.get().getWorkHours()!=null){
|
|
|
- map.put("cardTime",first.get().getWorkHours());
|
|
|
- Optional<User> optional = userList.stream().filter(u -> u.getId().equals(id)).findFirst();
|
|
|
- User targetUser = optional.get();
|
|
|
- List<String> customList = userCustomList.stream().map(UserCustom::getName).collect(Collectors.toList());
|
|
|
- if(customList.size()>0&&customList.contains("是否有加班费")){
|
|
|
- int index = customList.indexOf("是否有加班费");
|
|
|
- targetUser.getPlate1();
|
|
|
- String getter="getPlate"+(index+1);
|
|
|
- Class<User> aClass = User.class;
|
|
|
- Method method = aClass.getMethod(getter);
|
|
|
- String invoke = (String) method.invoke(targetUser);
|
|
|
- if(invoke==null||invoke.equals("有加班费")){
|
|
|
- if(!(Double.valueOf(String.valueOf(data.get("workingTime"))).equals(Double.valueOf(first.get().getWorkHours())))){
|
|
|
- map.put("exceedCardTime",1);
|
|
|
- }
|
|
|
- }else{
|
|
|
- if((Double.valueOf(String.valueOf(data.get("workingTime")))<first.get().getWorkHours())){
|
|
|
- map.put("exceedCardTime",1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
if (id.equals(lastUserId)) {
|
|
|
//同一个用户的数据
|
|
|
lastUserData.worktimeList.add(map);
|
|
@@ -6106,12 +6074,12 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
List<Integer> allVisibleDeptIdList = getAllVisibleDeptIdList(user, null);
|
|
|
//检查是不是部门负责人
|
|
|
if (allVisibleDeptIdList.size() > 0) {
|
|
|
- list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, allVisibleDeptIdList, null);
|
|
|
+ list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, allVisibleDeptIdList, null,user.getId());
|
|
|
//部门负责人看自己部门相关的
|
|
|
allRangeUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allVisibleDeptIdList).eq("report_status",0));
|
|
|
} else {
|
|
|
//看自己的所负责的项目相关人员的
|
|
|
- list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, null, user.getId());
|
|
|
+ list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, null, user.getId(),user.getId());
|
|
|
//项目相关的人员列表
|
|
|
List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("incharger_id", user.getId()));
|
|
|
List<Project> collect = projectList.stream().collect(Collectors.toList());
|
|
@@ -6124,7 +6092,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, null, null);
|
|
|
+ list = reportMapper.getUserDailyWorkTime(companyId, startDate, endDate, null, null,user.getId());
|
|
|
//管理员看全公司所有人
|
|
|
allRangeUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).eq("report_status",0));
|
|
|
}
|
|
@@ -6184,6 +6152,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
if (!workDay){
|
|
|
continue;
|
|
|
}
|
|
|
+ //去掉非工作日
|
|
|
+ boolean workDay1 = WorkDayCalculateUtils.isWorkDay(date);
|
|
|
+ if(!workDay1){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
//去掉设置了分摊比例的人员
|
|
|
if (setPercentUserIdList.contains(curUser.getId())) {
|
|
|
continue;
|
|
@@ -9051,36 +9024,33 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
|
|
|
LocalDate now=LocalDate.now();
|
|
|
- HttpRespMsg userDailyWorkTime = getUserDailyWorkTime(request,startDate,endDate);
|
|
|
+ HttpRespMsg userDailyWorkTime = getUserDailyWorkTimeReminder(request,startDate,endDate,null,0);
|
|
|
Map<String, Object> map = (Map<String, Object>) userDailyWorkTime.getData();
|
|
|
- List<UserMonthWork> userDailyWorkTimeData = (List<UserMonthWork>) map.get("list");
|
|
|
+ List<Map<String, Object>> mapList = (List<Map<String, Object>>) map.get("list");
|
|
|
if(!StringUtils.isEmpty(userId)){
|
|
|
- userDailyWorkTimeData=userDailyWorkTimeData.stream().filter(u->u.userId.equals(userId)).collect(Collectors.toList());
|
|
|
+ mapList=mapList.stream().filter(u->String.valueOf(u.get("userId")).equals(userId)).collect(Collectors.toList());
|
|
|
}
|
|
|
List<Information> informationList=new ArrayList<>();
|
|
|
- userDailyWorkTimeData.forEach(u-> {
|
|
|
- List<Map<String, Object>> worktimeList = u.worktimeList;
|
|
|
- List<Map<String, Object>> exceedCardTimeList = worktimeList.stream().filter(w -> Integer.valueOf(String.valueOf(w.get("exceedCardTime"))).equals(1)).collect(Collectors.toList());
|
|
|
- if(exceedCardTimeList.size()>0){
|
|
|
- if(!StringUtils.isEmpty(createDate)){
|
|
|
- exceedCardTimeList=exceedCardTimeList.stream().filter(e->String.valueOf(e.get("createDate")).equals(createDate)).collect(Collectors.toList());
|
|
|
- }
|
|
|
- exceedCardTimeList.forEach(e->{
|
|
|
- Information information=new Information();
|
|
|
- information.setUserId(u.userId);
|
|
|
- information.setTime(LocalDateTime.now());
|
|
|
- information.setContent(String.valueOf(e.get("createDate")));
|
|
|
- information.setType(0);
|
|
|
- information.setMsg("您在"+String.valueOf(e.get("createDate"))+"的日报考勤填报异常,请完成填报变更");
|
|
|
- informationList.add(information);
|
|
|
- reportMapper.denyReportWithUserAndCreateDate(u.userId,String.valueOf(e.get("createDate")));
|
|
|
- //发送企业微信消息
|
|
|
- if(wxCorpInfo!=null&&u.corpwxUserId!=null){
|
|
|
- wxCorpInfoService.sendWXCorpMsg(wxCorpInfo, u.corpwxUserId, "您在"+String.valueOf(e.get("createDate"))+"的日报考勤填报异常,请完成填报变更", null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_DENY);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
+ List<Map<String, Object>> exceedCardTimeList = mapList.stream().filter(w -> Integer.valueOf(String.valueOf(w.get("exceedCardTime"))).equals(1)).collect(Collectors.toList());
|
|
|
+ if(exceedCardTimeList.size()>0){
|
|
|
+ if(!StringUtils.isEmpty(createDate)){
|
|
|
+ exceedCardTimeList=exceedCardTimeList.stream().filter(e->String.valueOf(e.get("createDate")).equals(createDate)).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ exceedCardTimeList.forEach(e->{
|
|
|
+ Information information=new Information();
|
|
|
+ information.setUserId(String.valueOf(e.get("userId")));
|
|
|
+ information.setTime(LocalDateTime.now());
|
|
|
+ information.setContent(String.valueOf(e.get("createDate")));
|
|
|
+ information.setType(0);
|
|
|
+ information.setMsg("您在"+String.valueOf(e.get("createDate"))+"的日报考勤填报异常,请完成填报变更");
|
|
|
+ informationList.add(information);
|
|
|
+ reportMapper.denyReportWithUserAndCreateDate(String.valueOf(e.get("userId")),String.valueOf(e.get("createDate")));
|
|
|
+ //发送企业微信消息
|
|
|
+ if(wxCorpInfo!=null&&e.get("corpwxUserId")!=null){
|
|
|
+ wxCorpInfoService.sendWXCorpMsg(wxCorpInfo,String.valueOf(e.get("corpwxUserId")), "您在"+String.valueOf(e.get("createDate"))+"的日报考勤填报异常,请完成填报变更", null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_DENY);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
if(informationList.size()>0){
|
|
|
informationService.saveBatch(informationList);
|
|
|
}
|
|
@@ -9089,51 +9059,146 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg getUserDailyWorkTimeReminder(HttpServletRequest request, String startDate, String endDate) throws Exception {
|
|
|
+ public HttpRespMsg getUserDailyWorkTimeReminder(HttpServletRequest request, String startDate, String endDate,Integer deptId,Integer viewValue) throws Exception {
|
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
- HttpRespMsg userDailyWorkTime = getUserDailyWorkTime(request, startDate, endDate);
|
|
|
List<UserFvTime> userFvTimeList = userFvTimeMapper.selectList(new LambdaQueryWrapper<UserFvTime>().between(UserFvTime::getWorkDate, startDate, endDate));
|
|
|
- Map<String, Object> objectMap = (Map<String, Object>) userDailyWorkTime.getData();
|
|
|
- List<UserMonthWork > mapList = (List<UserMonthWork >) objectMap.get("list");
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, user.getCompanyId()));
|
|
|
+ List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getCompanyId, user.getCompanyId()));
|
|
|
+ List<UserCustom> userCustomList = userCustomMapper.selectList(new LambdaQueryWrapper<UserCustom>().eq(UserCustom::getCompanyId, user.getCompanyId()));
|
|
|
+ List<User> allRangeUserList = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> list = null;
|
|
|
+ //分角色权限:管理员看全部的,部门负责人看自己部门的,个人只能看自己的。
|
|
|
+ List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全公司工时");
|
|
|
+ if (functionList.size() == 0) {
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
|
+ //检查是不是部门负责人(含主要负责人和其他负责人)
|
|
|
+ List<Integer> allDeptIds = getAllVisibleDeptIdList(user, allDeptList);
|
|
|
+ if (allDeptIds.size() > 0) {
|
|
|
+ list = reportMapper.getUserDailyWorkTimeReminder(user.getCompanyId(), startDate, endDate, allDeptIds, deptId,null);
|
|
|
+ //部门负责人看自己部门相关的
|
|
|
+ allRangeUserList = userMapper.selectList(new QueryWrapper<User>().in("department_id", allDeptIds).eq(deptId!=null,"department_id",deptId).orderByDesc("department_id"));
|
|
|
+ } else {
|
|
|
+ //看自己的所负责的项目相关人员的
|
|
|
+ list = reportMapper.getUserDailyWorkTimeReminder(user.getCompanyId(), startDate, endDate, null,deptId, user.getId());
|
|
|
+ //项目相关的人员列表
|
|
|
+ List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("incharger_id", user.getId()));
|
|
|
+ List<Project> collect = projectList.stream().collect(Collectors.toList());
|
|
|
+ if (collect.size() > 0) {
|
|
|
+ List<Participation> participationList = participationMapper.selectList(new QueryWrapper<Participation>().in("project_id", collect));
|
|
|
+ List<String> collect1 = participationList.stream().map(Participation::getUserId).collect(Collectors.toList());
|
|
|
+ if (collect1.size() > 0) {
|
|
|
+ allRangeUserList = userMapper.selectList(new QueryWrapper<User>().in("id", collect1).eq(deptId!=null,"department_id",deptId).orderByDesc("department_id"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ list = reportMapper.getUserDailyWorkTimeReminder(user.getCompanyId(), startDate, endDate, null,deptId, null);
|
|
|
+ //管理员看全公司所有人
|
|
|
+ allRangeUserList = userMapper.selectList(new QueryWrapper<User>().eq(deptId!=null,"department_id",deptId).eq("company_id", user.getCompanyId()).orderByDesc("department_id"));
|
|
|
+ }
|
|
|
+ List<User> needRangeUserList=new ArrayList<>();
|
|
|
+ for (User u : allRangeUserList) {
|
|
|
+ if(u.getInactiveDate()==null||(u.getInactiveDate()!=null&&u.getInactiveDate().isAfter(LocalDate.parse(startDate))||u.getIsActive()==1)){
|
|
|
+ needRangeUserList.add(u);
|
|
|
+ }
|
|
|
+ }
|
|
|
List<LocalDate> days = getDays(LocalDate.parse(startDate, df), LocalDate.parse(endDate, df));
|
|
|
- List<Map<String, Object>> result=new ArrayList<>();
|
|
|
- mapList.forEach(m->{
|
|
|
- List<Map<String, Object>> worktimeList = (List<Map<String, Object>>) m.worktimeList;
|
|
|
- for (LocalDate date : days) {
|
|
|
- boolean match = worktimeList.stream().anyMatch(www -> String.valueOf(www.get("createDate")).equals(date.format(df)));
|
|
|
+ for (User item : needRangeUserList) {
|
|
|
+ for (LocalDate day : days) {
|
|
|
+ boolean workDay = WorkDayCalculateUtils.isWorkDay(day);
|
|
|
+ //去掉非工作日
|
|
|
+ if(!workDay){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ boolean match = list.stream().anyMatch(l -> l.get("createDate").equals(df.format(day)) && l.get("userId").equals(item.getId()));
|
|
|
if(!match){
|
|
|
- Map<String,Object> ww=new HashMap<>();
|
|
|
- ww.put("createDate",date.format(df));
|
|
|
- ww.put("exceedCardTime",0);
|
|
|
- ww.put("workingTime",0);
|
|
|
- worktimeList.add(ww);
|
|
|
- }
|
|
|
- }
|
|
|
- if(worktimeList.size()>0){
|
|
|
- worktimeList.forEach(w->{
|
|
|
- Optional<UserFvTime> first = userFvTimeList.stream().filter(u -> u.getWorkDate().isEqual(LocalDate.parse(String.valueOf(w.get("createDate")),df)) && u.getUserId().equals(m.userId)).findFirst();
|
|
|
- if(first.isPresent()){
|
|
|
- w.put("cardTime",first.get().getWorkHours());
|
|
|
- }
|
|
|
- w.put("name",m.name);
|
|
|
- w.put("corpwxDeptId",m.corpwxDeptId);
|
|
|
- w.put("corpwxUserId",m.corpwxUserId);
|
|
|
- w.put("departmentName",m.departmentName);
|
|
|
- w.put("userId",m.userId);
|
|
|
- });
|
|
|
+ Map<String,Object> map=new HashMap<>();
|
|
|
+ map.put("userId",item.getId());
|
|
|
+ map.put("corpwxUserId",item.getCorpwxUserid());
|
|
|
+ map.put("createDate",day.format(df));
|
|
|
+ Optional<Department> first = departmentList.stream().filter(d -> d.getDepartmentId().equals(item.getDepartmentId())).findFirst();
|
|
|
+ map.put("departmentName",first.get().getDepartmentName());
|
|
|
+ Optional<UserFvTime> time = userFvTimeList.stream().filter(u -> u.getWorkDate().isEqual(day) && u.getUserId().equals(item.getId())).findFirst();
|
|
|
+ if(time.isPresent()){
|
|
|
+ map.put("cardTime",time.get().getWorkHours());
|
|
|
+ map.put("cancelNormal",time.get().getCancelNormal());
|
|
|
+ }else {
|
|
|
+ map.put("cardTime",0);
|
|
|
+ }
|
|
|
+ map.put("corpwxDeptId",first.get().getCorpwxDeptid());
|
|
|
+ map.put("workingTime",0);
|
|
|
+ map.put("name",item.getName());
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
}
|
|
|
- result.addAll(worktimeList);
|
|
|
- });
|
|
|
+ }
|
|
|
+ // 进行排序 list:就是要排序的集合
|
|
|
+ Collections.sort(list, new Comparator<Map<String, Object>>() {
|
|
|
+ @Override
|
|
|
+ public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String userId1 = (String) o1.get("userId");
|
|
|
+ String userId2 = (String) o2.get("userId");
|
|
|
+// return date2.compareTo(date1); //倒序
|
|
|
+ return userId1.compareTo(userId2); // 正序
|
|
|
+ }
|
|
|
+ }.thenComparing(new Comparator<Map<String, Object>>() {
|
|
|
+ @Override
|
|
|
+ public int compare(Map<String, Object> o1, Map<String, Object> o2) {
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ try {
|
|
|
+ Date date1 = format.parse((String) o1.get("createDate"));
|
|
|
+ Date date2 = format.parse((String) o2.get("createDate"));
|
|
|
+// return date2.compareTo(date1); //倒序
|
|
|
+ return date1.compareTo(date2); // 正序
|
|
|
+ } catch (ParseException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }));
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
+ //针对景昱 5978 校验填报工时是否超过考勤
|
|
|
+ if(user.getCompanyId().equals(5978)){
|
|
|
+ map.put("exceedCardTime",0);
|
|
|
+ Optional<User> optional = userList.stream().filter(u -> u.getId().equals(String.valueOf(map.get("userId")))).findFirst();
|
|
|
+ User targetUser = optional.get();
|
|
|
+ List<String> customList = userCustomList.stream().map(UserCustom::getName).collect(Collectors.toList());
|
|
|
+ if(customList.size()>0&&customList.contains("是否有加班费")){
|
|
|
+ int index = customList.indexOf("是否有加班费");
|
|
|
+ targetUser.getPlate1();
|
|
|
+ String getter="getPlate"+(index+1);
|
|
|
+ Class<User> aClass = User.class;
|
|
|
+ Method method = aClass.getMethod(getter);
|
|
|
+ String invoke = (String) method.invoke(targetUser);
|
|
|
+ if(invoke==null||invoke.equals("有加班费")){
|
|
|
+ if((!(Double.valueOf(String.valueOf(map.get("workingTime"))).equals(Double.valueOf(String.valueOf(map.get("cardTime"))))))&&(map.containsKey("cancelNormal")&&(Integer)map.get("cancelNormal")!=1)){
|
|
|
+ map.put("exceedCardTime",1);
|
|
|
+ }
|
|
|
+ map.put("invokeValue","有加班费");
|
|
|
+ }else{
|
|
|
+ if(((Double.valueOf(String.valueOf(map.get("workingTime")))<Double.valueOf(String.valueOf(map.get("cardTime")))))&&(map.containsKey("cancelNormal")&&(Integer)map.get("cancelNormal")!=1)){
|
|
|
+ map.put("exceedCardTime",1);
|
|
|
+ }
|
|
|
+ map.put("invokeValue","无加班费");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(viewValue==1){
|
|
|
+ list=list.stream().filter(l->Integer.valueOf(String.valueOf(l.get("exceedCardTime")))==1).collect(Collectors.toList());
|
|
|
+ }
|
|
|
Map<String,Object> map=new HashMap<>();
|
|
|
- map.put("list",result);
|
|
|
+ map.put("list",list);
|
|
|
msg.setData(map);
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public HttpRespMsg exportUserDailyWorkTimeReminder(HttpServletRequest request, String startDate, String endDate) throws Exception {
|
|
|
- HttpRespMsg timeReminder = getUserDailyWorkTimeReminder(request, startDate, endDate);
|
|
|
+ public HttpRespMsg exportUserDailyWorkTimeReminder(HttpServletRequest request, String startDate, String endDate,Integer deptId,Integer viewValue) throws Exception {
|
|
|
+ HttpRespMsg timeReminder = getUserDailyWorkTimeReminder(request, startDate, endDate,deptId,viewValue);
|
|
|
Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
|
|
|
CompanyDingding dingding = companyDingdingService.getOne(new QueryWrapper<CompanyDingding>().eq("company_id", companyId));
|
|
@@ -9169,4 +9234,26 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
|
|
|
String fileName="工时异常表"+System.currentTimeMillis();
|
|
|
return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,fileName,dataList,path);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg cancelReminder(HttpServletRequest request, String createDate, String userId) {
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
+ DateTimeFormatter df=DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ LambdaQueryWrapper<UserFvTime> wrapper = new LambdaQueryWrapper<UserFvTime>().eq(UserFvTime::getCompanyId, companyId).eq(UserFvTime::getWorkDate, LocalDate.parse(createDate, df)).eq(UserFvTime::getUserId, userId);
|
|
|
+ UserFvTime userFvTime=new UserFvTime();
|
|
|
+ userFvTime.setCancelNormal(1);
|
|
|
+ if(userFvTimeMapper.update(userFvTime,wrapper)<=0){
|
|
|
+ msg.setError("操作失败");
|
|
|
+ }
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg cancelHasPushForSap(String uuids) {
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
+ cancelReportPushSap(uuids,user);
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
}
|