Commit bd8f3bbf authored by 廖旭伟's avatar 廖旭伟

Merge remote-tracking branch 'origin/master'

parents 1c18b14e 91cfa102
...@@ -104,7 +104,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -104,7 +104,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
boolean bool = review(req); boolean bool = review(req);
if (bool) throw new AppException(busiDesc + "失败!"); if (bool) throw new AppException(busiDesc + "失败!");
} catch (Exception e) { } catch (Exception e) {
log.error(busiDesc, e); log.error(busiDesc, e.getMessage());
return Rest.fail(e.getMessage()); return Rest.fail(e.getMessage());
} }
log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest)); log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
...@@ -129,7 +129,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -129,7 +129,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
boolean bool = complain(req); boolean bool = complain(req);
if (bool) throw new AppException(busiDesc + "失败!"); if (bool) throw new AppException(busiDesc + "失败!");
} catch (Exception e) { } catch (Exception e) {
log.error(busiDesc, e); log.error(busiDesc, e.getMessage());
return Rest.fail(e.getMessage()); return Rest.fail(e.getMessage());
} }
log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest)); log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
...@@ -154,7 +154,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -154,7 +154,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
boolean bool = gowork(req); boolean bool = gowork(req);
if (bool) throw new AppException(busiDesc + "失败!"); if (bool) throw new AppException(busiDesc + "失败!");
} catch (Exception e) { } catch (Exception e) {
log.error(busiDesc, e); log.error(busiDesc, e.getMessage());
return Rest.fail(e.getMessage()); return Rest.fail(e.getMessage());
} }
log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest)); log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
...@@ -184,7 +184,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq> ...@@ -184,7 +184,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
effect(req); effect(req);
} }
} catch (Exception e) { } catch (Exception e) {
log.error(busiDesc, e); log.error(busiDesc, e.getMessage());
return Rest.fail(e.getMessage()); return Rest.fail(e.getMessage());
} }
log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest)); log.info("响应【{}】【响应体】--> {} ", busiDesc, JSONObject.toJSONString(rest));
......
...@@ -174,7 +174,7 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -174,7 +174,7 @@ public class AttendanceLeaveRecordServiceImpl extends AbstractCRUDServiceImpl<At
DateTime attendStart = DateUtil.parseDate(DateUtil.formatDate(entity.getStartTime())); DateTime attendStart = DateUtil.parseDate(DateUtil.formatDate(entity.getStartTime()));
DateTime attendEnd = DateUtil.parseDate(DateUtil.formatDate(entity.getEndTime())); DateTime attendEnd = DateUtil.parseDate(DateUtil.formatDate(entity.getEndTime()));
Long compare1 = DateUtil.between(attendEnd, attendStart, DateUnit.DAY); Long compare1 = DateUtil.betweenDay(attendEnd, attendStart, true);
log.info("考勤计算天数区间:{}", compare1); log.info("考勤计算天数区间:{}", compare1);
for (int i = 0; i <= compare1.intValue(); i++) { for (int i = 0; i <= compare1.intValue(); i++) {
DateTime curDate = DateUtil.offsetDay(attendStart, i); DateTime curDate = DateUtil.offsetDay(attendStart, i);
......
...@@ -3,34 +3,33 @@ package com.mortals.xhx.module.attendance.service.impl; ...@@ -3,34 +3,33 @@ package com.mortals.xhx.module.attendance.service.impl;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.busiz.h5.req.AttendSaveReq; import com.mortals.xhx.busiz.h5.req.AttendSaveReq;
import com.mortals.xhx.busiz.h5.web.ApiWebPerformController;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.module.attendance.dao.AttendanceRecordErrorDao;
import com.mortals.xhx.module.attendance.model.*; import com.mortals.xhx.module.attendance.model.*;
import com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery; import com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery;
import com.mortals.xhx.module.attendance.model.vo.ErrorSummaryVo; import com.mortals.xhx.module.attendance.model.vo.ErrorSummaryVo;
import com.mortals.xhx.module.attendance.service.*; import com.mortals.xhx.module.attendance.service.AttendanceClassDetailService;
import com.mortals.xhx.module.attendance.service.AttendanceLeaveRecordService;
import com.mortals.xhx.module.attendance.service.AttendanceRecordErrorService;
import com.mortals.xhx.module.check.model.CheckAttendRecordEntity; import com.mortals.xhx.module.check.model.CheckAttendRecordEntity;
import com.mortals.xhx.module.check.model.CheckAttendRecordQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.service.CheckAttendRecordService; import com.mortals.xhx.module.check.service.CheckAttendRecordService;
import com.mortals.xhx.module.perform.model.PerformAttendRecordEntity; import com.mortals.xhx.module.perform.model.PerformAttendRecordEntity;
import com.mortals.xhx.module.perform.model.PerformAttendRecordQuery; import com.mortals.xhx.module.perform.model.PerformAttendRecordQuery;
import com.mortals.xhx.module.perform.service.PerformAttendRecordService; import com.mortals.xhx.module.perform.service.PerformAttendRecordService;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.attendance.dao.AttendanceRecordErrorDao;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.time.LocalDate; import java.time.LocalDate;
...@@ -349,7 +348,7 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -349,7 +348,7 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
goOffDateTime = DateUtil.offsetMinute(goOffDateTime, -attendanceClassDetailEntity.getOffWorkDateBefore()); goOffDateTime = DateUtil.offsetMinute(goOffDateTime, -attendanceClassDetailEntity.getOffWorkDateBefore());
} }
for (AttendanceLeaveRecordEntity leaveRecord : leaveRecords) { for (AttendanceLeaveRecordEntity leaveRecord : leaveRecords) {
long between = DateUtil.between(leaveRecord.getStartTime(), leaveRecord.getEndTime(), DateUnit.DAY); long between = DateUtil.betweenDay(leaveRecord.getStartTime(), leaveRecord.getEndTime(),true);
if (between == 0) { if (between == 0) {
//当天 //当天
// 1.判断异常时间与请假结束时间那个大。取大那个与当前班次下班时间比较差值,去正向值 偏移后的时间计算 // 1.判断异常时间与请假结束时间那个大。取大那个与当前班次下班时间比较差值,去正向值 偏移后的时间计算
...@@ -423,7 +422,7 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -423,7 +422,7 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
} }
for (AttendanceLeaveRecordEntity leaveRecord : leaveRecords) { for (AttendanceLeaveRecordEntity leaveRecord : leaveRecords) {
long between = DateUtil.between(leaveRecord.getStartTime(), leaveRecord.getEndTime(), DateUnit.DAY); long between = DateUtil.betweenDay(leaveRecord.getStartTime(), leaveRecord.getEndTime(), true);
if (between == 0) { if (between == 0) {
//当天 //当天
// 1.判断异常时间与请假开始时间那个大。 // 1.判断异常时间与请假开始时间那个大。
...@@ -514,9 +513,12 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -514,9 +513,12 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
public static void main(String[] args) { public static void main(String[] args) {
long compare = DateUtil.compare(DateUtil.parseDateTime("2024-07-01 15:00:00"), DateUtil.parseDateTime("2024-07-01 16:00:00")); long compare = DateUtil.compare(DateUtil.parseDateTime("2024-07-01 15:00:00"), DateUtil.parseDateTime("2024-07-01 16:00:00"));
long between = DateUtil.between(DateUtil.parseDateTime("2024-07-01 15:00:00"), DateUtil.parseDateTime("2024-07-01 16:00:00"), DateUnit.MINUTE, false); // long between = DateUtil.between(DateUtil.parseDateTime("2024-07-01 15:00:00"), DateUtil.parseDateTime("2024-07-01 16:00:00"), DateUnit.MINUTE, false);
long between = DateUtil.betweenDay(DateUtil.parseDateTime("2024-07-01 15:00:00"), DateUtil.parseDateTime("2024-07-03 14:00:00"),true);
long between1 = DateUtil.between(DateUtil.parseDateTime("2024-07-01 15:00:00"), DateUtil.parseDateTime("2024-07-03 14:00:00"),DateUnit.DAY);
System.out.println(compare); System.out.println(compare);
System.out.println(between); System.out.println(between);
System.out.println(between1);
} }
} }
\ No newline at end of file
...@@ -293,11 +293,11 @@ public class FixWorkOtherAttendance extends AttendanceWorkAbstract { ...@@ -293,11 +293,11 @@ public class FixWorkOtherAttendance extends AttendanceWorkAbstract {
if (isLeave) { if (isLeave) {
//查看请假时间段,是否为跨天记录 //查看请假时间段,是否为跨天记录
for (AttendanceLeaveRecordEntity leaveRecord : leaveRecords) { for (AttendanceLeaveRecordEntity leaveRecord : leaveRecords) {
long between = DateUtil.between(leaveRecord.getStartTime(), leaveRecord.getEndTime(), DateUnit.DAY); long between = DateUtil.betweenDay(leaveRecord.getStartTime(), leaveRecord.getEndTime(), true);
if (between > 0) { if (between > 0) {
//跨天 判断当前日期是否在全天,没在 就 //跨天 判断当前日期是否在全天,没在 就
//判断日期是否在最后一天 不是的话 为全天 //判断日期是否在最后一天 不是的话 为全天
long betweened = DateUtil.between(DateUtil.parseDate(commonData.getDateStr()), leaveRecord.getEndTime(), DateUnit.DAY); long betweened = DateUtil.betweenDay(DateUtil.parseDate(commonData.getDateStr()), leaveRecord.getEndTime(), true);
if (betweened > 0) { if (betweened > 0) {
//全天 //全天
calLeaveDate(commonData, DateUtil.parseDateTime(commonData.getDateStr() + " 00:00:00"), DateUtil.parseDateTime(commonData.getDateStr() + " 23:59:59")); calLeaveDate(commonData, DateUtil.parseDateTime(commonData.getDateStr() + " 00:00:00"), DateUtil.parseDateTime(commonData.getDateStr() + " 23:59:59"));
......
...@@ -29,6 +29,7 @@ import org.springframework.util.ObjectUtils; ...@@ -29,6 +29,7 @@ import org.springframework.util.ObjectUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* DeptService * DeptService
...@@ -172,15 +173,17 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -172,15 +173,17 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
StaffQuery query = new StaffQuery(); StaffQuery query = new StaffQuery();
query.setStatusNotList(Arrays.asList(StaffSatusEnum.离职.getValue())); query.setStatusNotList(Arrays.asList(StaffSatusEnum.离职.getValue()));
query.setDeptIdList(getChildrenId(m, list)); query.setDeptIdList(getChildrenId(m, list));
int count = staffService.count(query,null); int count = staffService.count(query, null);
m.setPersonNum(count); m.setPersonNum(count);
return m; return m;
} }
).collect(Collectors.toList()); ).collect(Collectors.toList());
return returnList.stream().map(DeptTreeSelect::new).collect(Collectors.toList()); return returnList.stream().map(DeptTreeSelect::new).collect(Collectors.toList());
} }
/** /**
* 递归查询子节点 * 递归查询子节点
*
* @param root 根节点 * @param root 根节点
* @param all 所有节点 * @param all 所有节点
* @return 根节点信息 * @return 根节点信息
...@@ -194,7 +197,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -194,7 +197,7 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
StaffQuery query = new StaffQuery(); StaffQuery query = new StaffQuery();
query.setDeptIdList(getChildrenId(m, all)); query.setDeptIdList(getChildrenId(m, all));
query.setStatusNotList(Arrays.asList(StaffSatusEnum.离职.getValue())); query.setStatusNotList(Arrays.asList(StaffSatusEnum.离职.getValue()));
int count = staffService.count(query,null); int count = staffService.count(query, null);
m.setPersonNum(count); m.setPersonNum(count);
return m; return m;
} }
...@@ -202,12 +205,12 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -202,12 +205,12 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
return children; return children;
} }
private List<Long> getChildrenId(DeptEntity root, List<DeptEntity> all){ private List<Long> getChildrenId(DeptEntity root, List<DeptEntity> all) {
List<Long> idList = new ArrayList<>(); List<Long> idList = new ArrayList<>();
idList.add(root.getId()); idList.add(root.getId());
all.forEach(item ->{ all.forEach(item -> {
if(Objects.equals(item.getParentId(), root.getId())){ if (Objects.equals(item.getParentId(), root.getId())) {
idList.addAll(getChildrenId(item,all)); idList.addAll(getChildrenId(item, all));
} }
}); });
return idList; return idList;
...@@ -266,8 +269,8 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -266,8 +269,8 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
parentDept.setPersonNum(sum); parentDept.setPersonNum(sum);
this.update(parentDept); this.update(parentDept);
} }
}else { } else {
log.info("deptEntity is null.deptId:{}",item.getKey()); log.info("deptEntity is null.deptId:{}", item.getKey());
} }
} }
...@@ -287,14 +290,14 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -287,14 +290,14 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
@Override @Override
public List<DeptEntity> getDeptBySalaId(Long salaId) throws AppException { public List<DeptEntity> getDeptBySalaId(Long salaId) throws AppException {
DeptQuery query = new DeptQuery(); DeptQuery query = new DeptQuery();
if(salaId == null || salaId == -1l){ if (salaId == null || salaId == -1l) {
List<DeptEntity> allSala = dao.getList(new DeptQuery().parentId(71l)); List<DeptEntity> allSala = dao.getList(new DeptQuery().parentId(71l));
List<Long> salaList = new ArrayList<>(); List<Long> salaList = new ArrayList<>();
for(DeptEntity item:allSala){ for (DeptEntity item : allSala) {
salaList.add(item.getId()); salaList.add(item.getId());
} }
query.setParentIdList(salaList); query.setParentIdList(salaList);
}else { } else {
query.setParentId(salaId); query.setParentId(salaId);
} }
return dao.getList(query); return dao.getList(query);
...@@ -338,6 +341,27 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -338,6 +341,27 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
this.update(deptEntity); this.update(deptEntity);
} }
} }
//差额删除部门
List<DeptEntity> localDeptList = this.find(new DeptQuery());
// Map<String, DeptEntity> localDeptMap = localDeptList.stream().collect(Collectors.toMap(x -> x.getDeptCode(), y -> y, (o, n) -> n));
//差额对
Map<String, OrgInfo> remoteDeptMap = orgInfoList.stream().collect(Collectors.toMap(x -> x.getOrgIndexCode(), y -> y, (o, n) -> n));
List<DeptEntity> deleteLocalDeptList = localDeptList.stream().map(item -> {
String deptCode = item.getDeptCode();
OrgInfo orgInfo = remoteDeptMap.get(deptCode);
if (ObjectUtils.isEmpty(orgInfo)) {
//需要删除的本地部门
return item;
} else {
return null;
}
}).filter(f -> f != null).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(deleteLocalDeptList)) {
log.info("delete dept lsit size :{}", deleteLocalDeptList.size());
}
} }
return Rest.ok(); return Rest.ok();
......
...@@ -959,6 +959,20 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID ...@@ -959,6 +959,20 @@ public class DingPersonServiceImpl extends AbstractDingTalkService implements ID
} }
} }
if (dateString.contains("AM")) {
if (tag) {
dateString = dateString.replace("AM", "09:00");
} else {
dateString = dateString.replace("AM", "12:00");
}
} else {
if (tag) {
dateString = dateString.replace("PM", "13:00");
} else {
dateString = dateString.replace("PM", "18:00");
}
}
//只有日期的字符串要处理加上时间 否则会转换出错 //只有日期的字符串要处理加上时间 否则会转换出错
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
try { try {
......
...@@ -49,8 +49,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord ...@@ -49,8 +49,8 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord
Content-Type: application/json Content-Type: application/json
{ {
"attendanceDateStart": "2024-10-19", "attendanceDateStart": "2025-01-01",
"attendanceDateEnd": "2024-10-31" "attendanceDateEnd": "2025-01-02"
} }
###海康考勤打卡记录计算1 ###海康考勤打卡记录计算1
...@@ -58,8 +58,9 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord ...@@ -58,8 +58,9 @@ POST {{baseUrl}}/attendance/record/hik/addAttendanceRecord
Content-Type: application/json Content-Type: application/json
{ {
"attendanceDateStart": "2024-11-18", "attendanceDateStart": "2025-01-20",
"attendanceDateEnd": "2024-11-26" "attendanceDateEnd": "2025-01-21",
"staffId":317
} }
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment