Commit cd0aa926 authored by 姬鋆屾's avatar 姬鋆屾
parents a3a8c5a3 02e46cec
...@@ -220,10 +220,8 @@ export default { ...@@ -220,10 +220,8 @@ export default {
}, },
/** 导出Excel */ /** 导出Excel */
doExport() { doExport() {
console.log("isExport:",this.isExport)
if(this.isExport==true) { if(this.isExport==true) {
console.log("isExport:",this.isExport)
this.$message.info("考勤数据正在导出中,请勿重复点击!") this.$message.info("考勤数据正在导出中,请勿重复点击!")
return false; return false;
} }
...@@ -240,6 +238,8 @@ export default { ...@@ -240,6 +238,8 @@ export default {
params["idList"] = this.selection; params["idList"] = this.selection;
} }
let that=this;
this.$download( this.$download(
"/attendance/record/hik/exportExcel", "/attendance/record/hik/exportExcel",
{ {
...@@ -247,7 +247,9 @@ export default { ...@@ -247,7 +247,9 @@ export default {
}, },
{ type: "excel" } { type: "excel" }
) )
.then(() => (this.isExport = false)) .then(() => {
console.log("isExport222:",this.isExport)
that.isExport = false})
.catch((error) => { .catch((error) => {
this.isExport = false; this.isExport = false;
this.$message.error(error.message); this.$message.error(error.message);
......
...@@ -202,6 +202,7 @@ export default { ...@@ -202,6 +202,7 @@ export default {
params[value.name] = this.query[value.name]; params[value.name] = this.query[value.name];
} }
} }
if (this.selection.length > 0) { if (this.selection.length > 0) {
params["idList"] = this.selection; params["idList"] = this.selection;
} }
......
...@@ -209,15 +209,20 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -209,15 +209,20 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
attendanceRecordQuery.setAttendanceDateStart(DateUtil.beginOfMonth(new Date()).toDateStr()); attendanceRecordQuery.setAttendanceDateStart(DateUtil.beginOfMonth(new Date()).toDateStr());
attendanceRecordQuery.setAttendanceDateEnd(DateUtil.today()); attendanceRecordQuery.setAttendanceDateEnd(DateUtil.today());
List<AttendanceRecordEntity> attendanceRecordEntities = recordService.find(attendanceRecordQuery); List<AttendanceRecordEntity> attendanceRecordEntities = recordService.find(attendanceRecordQuery);
//总打卡人次
long total = recordHikService.find(hikQuery).parallelStream().map(item -> item.getStaffId()).distinct().count();
//long total = attendanceRecordEntities.parallelStream().map(item -> item.getStaffId()).distinct().count(); //获取当月打卡人数,如果存在
Long totalCache = cacheService.hget(RedisKey.KEY_ATTENC_TOTOAL_CACHE, DateUtil.format(new Date(), "yyyy-MM"), Long.class);
if (ObjectUtils.isEmpty(totalCache)) {
totalCache = recordHikService.find(hikQuery).parallelStream().map(item -> item.getStaffId()).distinct().count();
cacheService.hset(RedisKey.KEY_ATTENC_TOTOAL_CACHE, DateUtil.format(new Date(), "yyyy-MM"), totalCache);
}
//迟到次数 //迟到次数
long beLate = attendanceRecordEntities.parallelStream() long beLate = attendanceRecordEntities.parallelStream()
.flatMap(item -> item.getAttendanceRecordDetailList().stream()) .flatMap(item -> item.getAttendanceRecordDetailList().stream())
.filter(f -> GoWorkResultEnum.迟到.getValue() == f.getGoWorkResult() || OffWorkResultEnum.迟到.getValue() == f.getOffWorkResult()) .filter(f -> GoWorkResultEnum.迟到.getValue() == f.getGoWorkResult() || OffWorkResultEnum.迟到.getValue() == f.getOffWorkResult())
.map(i->i.getStaffId()) .map(i -> i.getStaffId())
.distinct() .distinct()
.count(); .count();
...@@ -225,7 +230,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -225,7 +230,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
long leaveEarly = attendanceRecordEntities.parallelStream() long leaveEarly = attendanceRecordEntities.parallelStream()
.flatMap(item -> item.getAttendanceRecordDetailList().stream()) .flatMap(item -> item.getAttendanceRecordDetailList().stream())
.filter(f -> GoWorkResultEnum.早退.getValue() == f.getGoWorkResult() || OffWorkResultEnum.早退.getValue() == f.getOffWorkResult()) .filter(f -> GoWorkResultEnum.早退.getValue() == f.getGoWorkResult() || OffWorkResultEnum.早退.getValue() == f.getOffWorkResult())
.map(i->i.getStaffId()) .map(i -> i.getStaffId())
.distinct() .distinct()
.count(); .count();
...@@ -233,7 +238,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -233,7 +238,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
long lackOfCards = attendanceRecordEntities.parallelStream() long lackOfCards = attendanceRecordEntities.parallelStream()
.flatMap(item -> item.getAttendanceRecordDetailList().stream()) .flatMap(item -> item.getAttendanceRecordDetailList().stream())
.filter(f -> GoWorkResultEnum.缺卡.getValue() == f.getGoWorkResult() || OffWorkResultEnum.缺卡.getValue() == f.getOffWorkResult()) .filter(f -> GoWorkResultEnum.缺卡.getValue() == f.getGoWorkResult() || OffWorkResultEnum.缺卡.getValue() == f.getOffWorkResult())
.map(i->i.getStaffId()) .map(i -> i.getStaffId())
.distinct() .distinct()
.count(); .count();
...@@ -259,12 +264,12 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -259,12 +264,12 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
.count(); .count();
//异常考勤记录 //异常考勤记录
//未考勤 //未考勤
// long noAtt=lackOfCards; // long noAtt=lackOfCards;
long att = totalAttend - lackOfCardsAttend-levealPersonNum; long att = totalAttend - lackOfCardsAttend - levealPersonNum;
if (att!=0L){ if (att != 0L) {
BigDecimal bigDecimal = new BigDecimal(att).divide(new BigDecimal(totalAttend),4,BigDecimal.ROUND_CEILING).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_CEILING); BigDecimal bigDecimal = new BigDecimal(att).divide(new BigDecimal(totalAttend), 4, BigDecimal.ROUND_CEILING).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_CEILING);
homeStatInfo.setAttendRadio(bigDecimal.toString()+"%"); homeStatInfo.setAttendRadio(bigDecimal.toString() + "%");
}else{ } else {
homeStatInfo.setAttendRadio("0%"); homeStatInfo.setAttendRadio("0%");
} }
...@@ -272,7 +277,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -272,7 +277,7 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
homeStatInfo.setLatePersonNum(beLate); homeStatInfo.setLatePersonNum(beLate);
homeStatInfo.setLeftEarlyPersonNum(leaveEarly); homeStatInfo.setLeftEarlyPersonNum(leaveEarly);
homeStatInfo.setMissCardPersonNum(lackOfCards); homeStatInfo.setMissCardPersonNum(lackOfCards);
homeStatInfo.setAttendPersonNum(total); homeStatInfo.setAttendPersonNum(totalCache);
data.put("homeStat", homeStatInfo); data.put("homeStat", homeStatInfo);
data.put("token", token); data.put("token", token);
...@@ -289,7 +294,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -289,7 +294,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
} }
@RequestMapping("validcode") @RequestMapping("validcode")
public String validCode(HttpServletRequest request, HttpServletResponse response, LoginForm loginForm) { public String validCode(HttpServletRequest request, HttpServletResponse response, LoginForm loginForm) {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
......
...@@ -16,4 +16,9 @@ public class RedisKey { ...@@ -16,4 +16,9 @@ public class RedisKey {
*/ */
public static final String KEY_DINGTALK_ACCESSTOKEN_CACHE = "dingtalk:token:"; public static final String KEY_DINGTALK_ACCESSTOKEN_CACHE = "dingtalk:token:";
/**
* 每月打卡人数
*/
public static final String KEY_ATTENC_TOTOAL_CACHE = "attend:total";
} }
...@@ -19,10 +19,8 @@ public class AttendanceStatVo extends BaseEntityLong { ...@@ -19,10 +19,8 @@ public class AttendanceStatVo extends BaseEntityLong {
private List<AttendanceStaffStatEntity> attendanceStaffStatEntities; private List<AttendanceStaffStatEntity> attendanceStaffStatEntities;
private String startTime; private String startTime;
private String endTime; private String endTime;
private List <Long> idList;
} }
\ No newline at end of file
...@@ -38,6 +38,8 @@ public class AttendanceSummaryQuery { ...@@ -38,6 +38,8 @@ public class AttendanceSummaryQuery {
private List<String> properties; private List<String> properties;
private List<Long> idList;
public AttendanceSummaryQuery(String summaryTime) { public AttendanceSummaryQuery(String summaryTime) {
this.summaryTime = summaryTime; this.summaryTime = summaryTime;
} }
......
...@@ -4,13 +4,15 @@ import cn.hutool.core.date.DateUnit; ...@@ -4,13 +4,15 @@ import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.DateUtils;
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.busiz.h5.web.ApiWebPerformController;
import com.mortals.xhx.common.code.ErrorStatusEnum; import com.mortals.xhx.common.code.ErrorStatusEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.attendance.model.AttendanceClassDetailEntity; import com.mortals.xhx.module.attendance.model.AttendanceClassDetailEntity;
import com.mortals.xhx.module.attendance.service.AttendanceClassDetailService; import com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery;
import com.mortals.xhx.module.attendance.service.AttendanceClassService; import com.mortals.xhx.module.attendance.service.*;
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 com.mortals.xhx.module.staff.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -20,7 +22,6 @@ import com.mortals.framework.exception.AppException; ...@@ -20,7 +22,6 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.xhx.module.attendance.dao.AttendanceRecordErrorDao; import com.mortals.xhx.module.attendance.dao.AttendanceRecordErrorDao;
import com.mortals.xhx.module.attendance.model.AttendanceRecordErrorEntity; import com.mortals.xhx.module.attendance.model.AttendanceRecordErrorEntity;
import com.mortals.xhx.module.attendance.service.AttendanceRecordErrorService;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.List; import java.util.List;
...@@ -47,6 +48,8 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -47,6 +48,8 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
private ApiWebPerformController apiWebPerformController; private ApiWebPerformController apiWebPerformController;
@Autowired @Autowired
private StaffService staffService; private StaffService staffService;
@Autowired
private AttendanceStatService attendanceStatService;
@Override @Override
...@@ -140,6 +143,14 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At ...@@ -140,6 +143,14 @@ public class AttendanceRecordErrorServiceImpl extends AbstractCRUDServiceImpl<At
attendSaveReq.setStaffId(entity.getStaffId()); attendSaveReq.setStaffId(entity.getStaffId());
performAttendRecordService.saveAttend(attendSaveReq, context); performAttendRecordService.saveAttend(attendSaveReq, context);
} }
//异常处理后重新汇总考勤
if(StringUtils.isNotEmpty(entity.getProcessResult())) {
AttendanceSummaryQuery query = new AttendanceSummaryQuery();
query.setStaffId(entity.getStaffId());
query.setSummaryTime(DateUtils.getStrDate(entity.getErrorDateTime()));
attendanceStatService.doAttendanceSummary(query);
}
} }
} }
} }
\ No newline at end of file
...@@ -308,9 +308,25 @@ public class FixWorkOtherAttendance extends AttendanceWorkAbstract { ...@@ -308,9 +308,25 @@ public class FixWorkOtherAttendance extends AttendanceWorkAbstract {
} }
if (!ObjectUtils.isEmpty(errorEntityList)) { if (!ObjectUtils.isEmpty(errorEntityList)) {
//删除当前员工当日未处理的异常后,重新添加
AttendanceRecordErrorQuery errorQuery = new AttendanceRecordErrorQuery();
errorQuery.setCreateTimeStart(DateUtil.today());
errorQuery.setCreateTimeEnd(DateUtil.today());
errorQuery.setStaffId(attendanceRecordEntity.getStaffId());
errorQuery.setProcessStatus(ProcessStatusEnum.未处理.getValue());
Long[] errorIds = errorService.find(errorQuery).stream().map(i -> i.getId()).toArray(Long[]::new);
if(!ObjectUtils.isEmpty(errorIds)){
errorService.remove(errorIds,context);
}
for (AttendanceRecordErrorEntity errorEntity : errorEntityList) { for (AttendanceRecordErrorEntity errorEntity : errorEntityList) {
//查看是否存在相同的异常记录,如果存在 则不添加 errorService.save(errorEntity, context);
AttendanceRecordErrorQuery errorQuery = new AttendanceRecordErrorQuery();
/* //查看是否存在相同的异常记录,如果存在 则不添加
errorQuery = new AttendanceRecordErrorQuery();
errorQuery.setShiftsId(errorEntity.getShiftsId()); errorQuery.setShiftsId(errorEntity.getShiftsId());
errorQuery.setGoOffDateTime(errorEntity.getErrorDateTime()); errorQuery.setGoOffDateTime(errorEntity.getErrorDateTime());
errorQuery.setStaffId(errorEntity.getStaffId()); errorQuery.setStaffId(errorEntity.getStaffId());
...@@ -323,7 +339,7 @@ public class FixWorkOtherAttendance extends AttendanceWorkAbstract { ...@@ -323,7 +339,7 @@ public class FixWorkOtherAttendance extends AttendanceWorkAbstract {
errorEntity.setId(attendanceRecordErrorEntity.getId()); errorEntity.setId(attendanceRecordErrorEntity.getId());
errorService.update(errorEntity,context); errorService.update(errorEntity,context);
log.info("已经存在相同的异常记录,更新保存!"); log.info("已经存在相同的异常记录,更新保存!");
} }*/
} }
} }
} }
......
...@@ -6,6 +6,7 @@ import com.mortals.framework.annotation.Excel; ...@@ -6,6 +6,7 @@ import com.mortals.framework.annotation.Excel;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol; import com.mortals.framework.model.OrderCol;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.utils.ServletUtils; import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
...@@ -14,6 +15,7 @@ import com.mortals.xhx.common.code.GoWorkResultEnum; ...@@ -14,6 +15,7 @@ import com.mortals.xhx.common.code.GoWorkResultEnum;
import com.mortals.xhx.common.code.NormalEnum; import com.mortals.xhx.common.code.NormalEnum;
import com.mortals.xhx.common.code.OffWorkResultEnum; import com.mortals.xhx.common.code.OffWorkResultEnum;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.keys.RedisCacheKeys;
import com.mortals.xhx.module.attendance.model.*; import com.mortals.xhx.module.attendance.model.*;
import com.mortals.xhx.module.attendance.model.vo.AttendStatInfo; import com.mortals.xhx.module.attendance.model.vo.AttendStatInfo;
import com.mortals.xhx.module.attendance.service.AttendanceClassService; import com.mortals.xhx.module.attendance.service.AttendanceClassService;
...@@ -75,6 +77,8 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle ...@@ -75,6 +77,8 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
private AttendanceGroupService groupService; private AttendanceGroupService groupService;
@Autowired @Autowired
private AttendanceClassService classService; private AttendanceClassService classService;
@Autowired
private ICacheService cacheService;
public AttendanceRecordController() { public AttendanceRecordController() {
super.setModuleDesc("考勤打卡记录信息"); super.setModuleDesc("考勤打卡记录信息");
...@@ -96,6 +100,14 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle ...@@ -96,6 +100,14 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
@Override @Override
public void doExportBefore(Context context, AttendanceRecordEntity query, List<String> properties) throws AppException { public void doExportBefore(Context context, AttendanceRecordEntity query, List<String> properties) throws AppException {
String bool = cacheService.get(RedisCacheKeys.getRecordExportLockKey());
if (!ObjectUtils.isEmpty(bool)) {
throw new AppException("每日数据正在导出中,请稍后再试!");
}
cacheService.set(RedisCacheKeys.getRecordExportLockKey(), "111", 120L);
if (!ObjectUtils.isEmpty(query.getProperties())) { if (!ObjectUtils.isEmpty(query.getProperties())) {
/* //通过属性转换为注解 /* //通过属性转换为注解
List<Field> tempFields = new ArrayList<>(); List<Field> tempFields = new ArrayList<>();
...@@ -177,6 +189,9 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle ...@@ -177,6 +189,9 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
attendanceExportRecordEntity.setType(2); attendanceExportRecordEntity.setType(2);
attendanceExportRecordEntity.setExportOrImport(1); attendanceExportRecordEntity.setExportOrImport(1);
attendanceExportRecordService.save(attendanceExportRecordEntity); attendanceExportRecordService.save(attendanceExportRecordEntity);
cacheService.del(RedisCacheKeys.getRecordExportLockKey());
} }
...@@ -323,7 +338,7 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle ...@@ -323,7 +338,7 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
String busiDesc = this.getModuleDesc() + "统计"; String busiDesc = this.getModuleDesc() + "统计";
try { try {
// Rest<AttendStatInfo> rest = this.service.statByDay(getContext()); // Rest<AttendStatInfo> rest = this.service.statByDay(getContext());
// if (rest.getCode() == YesNoEnum.NO.getValue()) { // if (rest.getCode() == YesNoEnum.NO.getValue()) {
// throw new AppException("统计异常!"); // throw new AppException("统计异常!");
// } else { // } else {
......
...@@ -190,7 +190,6 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro ...@@ -190,7 +190,6 @@ public class AttendanceRecordHikController extends BaseCRUDJsonBodyMappingContro
String bool = cacheService.get(RedisCacheKeys.getHikExportLockKey()); String bool = cacheService.get(RedisCacheKeys.getHikExportLockKey());
if(!ObjectUtils.isEmpty(bool)){ if(!ObjectUtils.isEmpty(bool)){
throw new AppException("考勤数据正在导出中,请稍后再试!"); throw new AppException("考勤数据正在导出中,请稍后再试!");
} }
......
...@@ -36,5 +36,8 @@ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{ ...@@ -36,5 +36,8 @@ public interface DeptDao extends ICRUDDao<DeptEntity,Long>{
* */ * */
DeptEntity queryDeptParient(String parentCode); DeptEntity queryDeptParient(String parentCode);
/**
* 查询包含本部门所有下级部门
* */
List<DeptEntity> getAllChildrenDept(Long deptId);
} }
...@@ -37,7 +37,10 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements ...@@ -37,7 +37,10 @@ public class DeptDaoImpl extends BaseCRUDDaoMybatis<DeptEntity,Long> implements
return getSqlSession().selectOne(getSqlId("queryDeptParient"),parentCode); return getSqlSession().selectOne(getSqlId("queryDeptParient"),parentCode);
} }
@Override
public List<DeptEntity> getAllChildrenDept(Long deptId) {
return getSqlSession().selectList(getSqlId("getAllChildrenDept"), deptId);
}
} }
package com.mortals.xhx.module.dept.service; package com.mortals.xhx.module.dept.service;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.dept.dao.DeptDao; import com.mortals.xhx.module.dept.dao.DeptDao;
...@@ -64,5 +65,10 @@ public interface DeptService extends ICRUDService<DeptEntity, Long> { ...@@ -64,5 +65,10 @@ public interface DeptService extends ICRUDService<DeptEntity, Long> {
*/ */
Rest<Void> updateDeptNum(Context context); Rest<Void> updateDeptNum(Context context);
/**
* 查询包含本部门所有下级部门
* */
List<DeptEntity> getAllChildrenDept(Long deptId) throws AppException;
} }
\ No newline at end of file
...@@ -255,5 +255,10 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity ...@@ -255,5 +255,10 @@ public class DeptServiceImpl extends AbstractCRUDServiceImpl<DeptDao, DeptEntity
return Rest.ok(); return Rest.ok();
} }
@Override
public List<DeptEntity> getAllChildrenDept(Long deptId) throws AppException {
return dao.getAllChildrenDept(deptId);
}
} }
...@@ -95,7 +95,7 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic ...@@ -95,7 +95,7 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
int code = VALUE_RESULT_SUCCESS; int code = VALUE_RESULT_SUCCESS;
try { try {
DeptQuery deptQuery = new DeptQuery(); DeptQuery deptQuery = new DeptQuery();
deptQuery.setOrderColList(Arrays.asList(new OrderCol("deptName"))); deptQuery.setOrderColList(Arrays.asList(new OrderCol("orderNum","desc")));
List<DeptEntity> list = this.service.find(deptQuery); List<DeptEntity> list = this.service.find(deptQuery);
List<DeptTreeSelect> treeSelects = this.service.buildDeptTreeSelect(list); List<DeptTreeSelect> treeSelects = this.service.buildDeptTreeSelect(list);
model.put("result", treeSelects); model.put("result", treeSelects);
......
...@@ -32,4 +32,6 @@ public class StaffVo extends BaseEntityLong { ...@@ -32,4 +32,6 @@ public class StaffVo extends BaseEntityLong {
private List<StaffInfoVo>staffInfoVos; private List<StaffInfoVo>staffInfoVos;
private List <Long> deptIdList;
} }
\ No newline at end of file
...@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil; ...@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.util.SecurityUtil; import com.mortals.framework.util.SecurityUtil;
import com.mortals.xhx.base.system.role.model.RoleUserQuery; import com.mortals.xhx.base.system.role.model.RoleUserQuery;
...@@ -33,14 +34,12 @@ import com.mortals.xhx.module.staff.model.StaffQuery; ...@@ -33,14 +34,12 @@ import com.mortals.xhx.module.staff.model.StaffQuery;
import com.mortals.xhx.module.staff.model.vo.StaffInfoVo; import com.mortals.xhx.module.staff.model.vo.StaffInfoVo;
import com.mortals.xhx.module.staff.service.StaffService; 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.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -263,4 +262,20 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -263,4 +262,20 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
System.out.println("1" + StrUtil.padPre("125", 7, "0")); System.out.println("1" + StrUtil.padPre("125", 7, "0"));
} }
@Override
protected StaffEntity findBefore(StaffEntity params, PageInfo pageInfo, Context context) throws AppException {
if(params.getDeptId()!=null){
List<DeptEntity> deptList = deptService.getAllChildrenDept(params.getDeptId());
if(CollectionUtils.isNotEmpty(deptList)){
List<Long> deptIdList = new ArrayList<>();
deptList.forEach(item -> {
deptIdList.add(item.getId());
});
params.setDeptId(null);
params.setDeptIdList(deptIdList);
}
}
return params;
}
} }
\ No newline at end of file
...@@ -9,5 +9,7 @@ ...@@ -9,5 +9,7 @@
where s.staffId=#{staffId} where s.staffId=#{staffId}
AND STR_TO_DATE(CONCAT(s.`year`,'-',s.`month`,'-',s.`day`),'%Y-%m-%d') <![CDATA[ >= ]]> STR_TO_DATE(#{summaryTimeStart},'%Y-%m-%d') AND STR_TO_DATE(CONCAT(s.`year`,'-',s.`month`,'-',s.`day`),'%Y-%m-%d') <![CDATA[ >= ]]> STR_TO_DATE(#{summaryTimeStart},'%Y-%m-%d')
AND STR_TO_DATE(CONCAT(s.`year`,'-',s.`month`,'-',s.`day`),'%Y-%m-%d') <![CDATA[ <= ]]> STR_TO_DATE(#{summaryTimeEnd},'%Y-%m-%d') AND STR_TO_DATE(CONCAT(s.`year`,'-',s.`month`,'-',s.`day`),'%Y-%m-%d') <![CDATA[ <= ]]> STR_TO_DATE(#{summaryTimeEnd},'%Y-%m-%d')
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<select id="getListExt" parameterType="com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery" resultMap="AttendanceStatEntity-Map"> <select id="getListExt" parameterType="com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery" resultMap="AttendanceStatEntity-Map">
SELECT * FROM ( SELECT * FROM (
SELECT SELECT
s.id,
s.staffId, s.staffId,
s.staffName, s.staffName,
s.deptId, s.deptId,
...@@ -52,6 +53,12 @@ ...@@ -52,6 +53,12 @@
<if test="staffName != null and staffName!=''"> AND s.staffName like #{staffName}</if> <if test="staffName != null and staffName!=''"> AND s.staffName like #{staffName}</if>
<if test="phoneNumer != null and phoneNumer!=''"> AND s.phoneNumer like #{phoneNumer}</if> <if test="phoneNumer != null and phoneNumer!=''"> AND s.phoneNumer like #{phoneNumer}</if>
<if test="deptId != null and deptId!=''"> AND s.deptId = #{deptId}</if> <if test="deptId != null and deptId!=''"> AND s.deptId = #{deptId}</if>
<if test="idList != null and idList.size>0">
and s.id in
<foreach collection="idList" open="(" close=")" index="index" item="item" separator=",">
#{item}
</foreach>
</if>
GROUP BY GROUP BY
s.staffId, s.staffId,
s.staffName, s.staffName,
...@@ -64,6 +71,7 @@ ...@@ -64,6 +71,7 @@
<select id="getListCountExt" parameterType="com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery" resultType="int"> <select id="getListCountExt" parameterType="com.mortals.xhx.module.attendance.model.vo.AttendanceSummaryQuery" resultType="int">
SELECT count(1) FROM ( SELECT count(1) FROM (
SELECT SELECT
s.id,
s.staffId, s.staffId,
s.staffName, s.staffName,
s.deptId, s.deptId,
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
FROM FROM
mortals_xhx_staff s mortals_xhx_staff s
LEFT JOIN mortals_xhx_attendance_vacation_balance b ON s.id = b.staffId LEFT JOIN mortals_xhx_attendance_vacation_balance b ON s.id = b.staffId
WHERE 1=1
<if test="staffId != null and staffId!=''"> AND s.id = #{staffId}</if>
</select> </select>
<!-- 汇总当前日期请假情况 --> <!-- 汇总当前日期请假情况 -->
...@@ -60,6 +62,7 @@ ...@@ -60,6 +62,7 @@
AND processStatus = 2 AND processStatus = 2
AND STR_TO_DATE(date_format(startTime,'%Y-%m-%d'),'%Y-%m-%d') <![CDATA[ <= ]]> STR_TO_DATE(#{summaryTime},'%Y-%m-%d') AND STR_TO_DATE(date_format(startTime,'%Y-%m-%d'),'%Y-%m-%d') <![CDATA[ <= ]]> STR_TO_DATE(#{summaryTime},'%Y-%m-%d')
AND STR_TO_DATE(date_format(endTime,'%Y-%m-%d'),'%Y-%m-%d') <![CDATA[ >= ]]> STR_TO_DATE(#{summaryTime},'%Y-%m-%d') AND STR_TO_DATE(date_format(endTime,'%Y-%m-%d'),'%Y-%m-%d') <![CDATA[ >= ]]> STR_TO_DATE(#{summaryTime},'%Y-%m-%d')
<if test="staffId != null and staffId!=''"> AND leavePersonId = #{staffId}</if>
GROUP BY leavePersonId,leavePerson,leaveType GROUP BY leavePersonId,leavePerson,leaveType
</select> </select>
...@@ -83,6 +86,7 @@ ...@@ -83,6 +86,7 @@
and processResult != 4 and processResult != 4
and e.errorDateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{summaryTime},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') and e.errorDateTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{summaryTime},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s')
and e.errorDateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{summaryTime},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') and e.errorDateTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{summaryTime},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s')
<if test="staffId != null and staffId!=''"> AND e.staffId = #{staffId}</if>
group by group by
e.staffId, e.staffId,
e.staffName e.staffName
......
...@@ -12,4 +12,20 @@ ...@@ -12,4 +12,20 @@
<select id="queryDeptParentId" resultType="integer"> <select id="queryDeptParentId" resultType="integer">
select parentId from mortals_xhx_dept where deptId = #{deptId} select parentId from mortals_xhx_dept where deptId = #{deptId}
</select> </select>
<!--查询所有子部门-->
<select id="getAllChildrenDept" resultType="com.mortals.xhx.module.dept.model.DeptEntity">
SELECT * FROM (
SELECT id, parentId, deptName,deptCode,deptStatus FROM mortals_xhx_dept WHERE id = #{deptId}
UNION ALL
SELECT i.id, i.parentId, i.deptName,i.deptCode,i.deptStatus
FROM mortals_xhx_dept i
INNER JOIN (
SELECT * FROM (
SELECT id, parentId, deptName,deptCode,deptStatus FROM mortals_xhx_dept WHERE id = #{deptId}
UNION ALL
SELECT id, parentId, deptName,deptCode,deptStatus FROM mortals_xhx_dept WHERE parentId = #{deptId}
) t1
) t2 ON i.parentId = t2.id
) t3
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -23,4 +23,8 @@ public final class RedisCacheKeys { ...@@ -23,4 +23,8 @@ public final class RedisCacheKeys {
return "hik:export:lock"; return "hik:export:lock";
} }
public static String getRecordExportLockKey() {
return "record:export:lock";
}
} }
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