Commit bf73390b authored by 赵啸非's avatar 赵啸非

修改员工导出

parent df463efb
...@@ -296,7 +296,7 @@ export default { ...@@ -296,7 +296,7 @@ export default {
} }
let params = JSON.parse(JSON.stringify(this.form)); //不更改原始数据 let params = JSON.parse(JSON.stringify(this.form)); //不更改原始数据
// console.log(this.form,'form参数') console.log(this.form,'form参数')
let data = this.decode(params); let data = this.decode(params);
// Object.assign({}, query, data) // Object.assign({}, query, data)
this.$router.push({ this.$router.push({
......
...@@ -11,30 +11,30 @@ ...@@ -11,30 +11,30 @@
<div class="item flex"> <div class="item flex">
<div> <div>
需要打卡人数 需要打卡人数
<span class="num">{{ tableData.attendanceStatus.needAttNum }}</span> <span class="num">{{ attendStatInfo.total }}</span>
</div> </div>
<div> <div>
未出勤 <span class="num">{{ tableData.attendanceStatus.noAtt }}</span> 未出勤 <span class="num">{{ attendStatInfo.noAtt }}</span>
</div> </div>
<div> <div>
出勤率 出勤率
<span class="num">{{ <span class="num">{{
tableData.attendanceStatus.attPercentage attendStatInfo.attPercentage
}}</span> }}</span>
</div> </div>
</div> </div>
<div class="item flex"> <div class="item flex">
<div> <div>
迟到 <span class="num">{{ tableData.attendanceStatus.beLate }}</span> 迟到 <span class="num">{{ attendStatInfo.beLate }}</span>
</div> </div>
<div> <div>
早退 早退
<span class="num">{{ tableData.attendanceStatus.leaveEarly }}</span> <span class="num">{{ attendStatInfo.leaveEarly }}</span>
</div> </div>
<div> <div>
缺卡 缺卡
<span class="num">{{ tableData.attendanceStatus.lackOfCards }}</span> <span class="num">{{attendStatInfo.lackOfCards }}</span>
</div> </div>
</div> </div>
</div> </div>
...@@ -207,6 +207,14 @@ export default { ...@@ -207,6 +207,14 @@ export default {
}, },
}, },
created() { created() {
this.$post("/attendance/record/stat", {}).then((res) => {
if (res.code === 1) {
this.attendStatInfo = res.data;
}
});
this.initalArr = this.config.columns; this.initalArr = this.config.columns;
}, },
methods: { methods: {
...@@ -549,6 +557,7 @@ export default { ...@@ -549,6 +557,7 @@ export default {
exportList: [], //导出记录 exportList: [], //导出记录
baseUrl: process.env.VUE_APP_API_BASE_URL + "/", baseUrl: process.env.VUE_APP_API_BASE_URL + "/",
initalArr: [], initalArr: [],
attendStatInfo:{}
}; };
}, },
}; };
......
...@@ -69,8 +69,7 @@ export default { ...@@ -69,8 +69,7 @@ export default {
{ {
name: "deptId", name: "deptId",
type: "select", type: "select",
label: "全部部门", label: "全部部门"
fuzzy: true,
}, },
{ {
name: "staffName", name: "staffName",
......
...@@ -120,7 +120,6 @@ public class PerformDetailInfo { ...@@ -120,7 +120,6 @@ public class PerformDetailInfo {
private String filePaths; private String filePaths;
/** /**
* 评价结果(1.非常不满意,2.差评) * 评价结果(1.非常不满意,2.差评)
*/ */
...@@ -228,7 +227,7 @@ public class PerformDetailInfo { ...@@ -228,7 +227,7 @@ public class PerformDetailInfo {
private Date deductTime; private Date deductTime;
private Integer auditStatus;
} }
...@@ -99,4 +99,6 @@ public class PerformInfo { ...@@ -99,4 +99,6 @@ public class PerformInfo {
private String result; private String result;
private Integer auditStatus;
} }
...@@ -8,6 +8,7 @@ import com.mortals.framework.exception.AppException; ...@@ -8,6 +8,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.ITask; import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
...@@ -46,11 +47,17 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService { ...@@ -46,11 +47,17 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private IHikDoorService hikDoorService; private IHikDoorService hikDoorService;
private Integer day;
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
//同步多久时间段的 偏移量为天 默认当天
String excuteParam = task.getExcuteParam();
if (!ObjectUtils.isEmpty(excuteParam)) {
day = DataUtil.converStr2Int(excuteParam, 0);
}
syncDoorEvents(); syncDoorEvents();
//calculateAttendByDay(); //calculateAttendByDay();
} }
...@@ -87,7 +94,7 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService { ...@@ -87,7 +94,7 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService {
doorEventReq.setEventTypes(eventTypes); doorEventReq.setEventTypes(eventTypes);
// 获取当天的开始时间 // 获取当天的开始时间
//Date todayStart = DateUtil.offsetHour(new Date(), -5).toJdkDate(); //Date todayStart = DateUtil.offsetHour(new Date(), -5).toJdkDate();
Date todayStart = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(),-1)); Date todayStart = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), day > 0 ? -day : 0));
// 获取当天的结束时间 // 获取当天的结束时间
Date todayEnd = DateUtil.endOfDay(new Date()); Date todayEnd = DateUtil.endOfDay(new Date());
doorEventReq.setStartTime(todayStart); doorEventReq.setStartTime(todayStart);
......
...@@ -38,7 +38,6 @@ public class AttendanceRecordHikEntity extends AttendanceRecordHikVo { ...@@ -38,7 +38,6 @@ public class AttendanceRecordHikEntity extends AttendanceRecordHikVo {
/** /**
* 所属部门名称 * 所属部门名称
*/ */
@Excel(name = "所属部门名称")
private String deptName; private String deptName;
/** /**
* 职位ID * 职位ID
...@@ -56,7 +55,6 @@ public class AttendanceRecordHikEntity extends AttendanceRecordHikVo { ...@@ -56,7 +55,6 @@ public class AttendanceRecordHikEntity extends AttendanceRecordHikVo {
/** /**
* 所属考勤组名称 * 所属考勤组名称
*/ */
@Excel(name = "所属考勤组名称")
private String attendanceGroupName; private String attendanceGroupName;
/** /**
* 班次ID * 班次ID
...@@ -65,7 +63,6 @@ public class AttendanceRecordHikEntity extends AttendanceRecordHikVo { ...@@ -65,7 +63,6 @@ public class AttendanceRecordHikEntity extends AttendanceRecordHikVo {
/** /**
* 班次名称 * 班次名称
*/ */
@Excel(name = "班次名称")
private String shiftsName; private String shiftsName;
/** /**
* 考勤日期 * 考勤日期
......
package com.mortals.xhx.module.attendance.model.vo;
import lombok.Data;
/**
* 每日统计
* @author:
* @date: 2023/7/28 10:44
*/
@Data
public class AttendStatInfo {
//总人数
private Long total=0L;
//未出勤
private Long noAtt = 0L;
//迟到人数
private Long beLate = 0L;
//早退人数
private Long leaveEarly = 0L;
//缺卡人数
private Long lackOfCards = 0L;
/**
* 出勤率
*/
private String attPercentage;
}
package com.mortals.xhx.module.attendance.service; package com.mortals.xhx.module.attendance.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.attendance.model.AttendanceRecordEntity; import com.mortals.xhx.module.attendance.model.AttendanceRecordEntity;
import com.mortals.xhx.module.attendance.model.vo.AttendStatInfo;
/** /**
* AttendanceRecordService * AttendanceRecordService
* * <p>
* 考勤打卡记录信息 service接口 * 考勤打卡记录信息 service接口
* *
* @author zxfei * @author zxfei
* @date 2023-04-07 * @date 2023-04-07
*/ */
public interface AttendanceRecordService extends ICRUDService<AttendanceRecordEntity,Long>{ public interface AttendanceRecordService extends ICRUDService<AttendanceRecordEntity, Long> {
Rest<AttendStatInfo> statByDay(Context context);
} }
\ No newline at end of file
package com.mortals.xhx.module.attendance.service.impl; package com.mortals.xhx.module.attendance.service.impl;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.common.code.GoWorkResultEnum;
import com.mortals.xhx.common.code.OffWorkResultEnum;
import com.mortals.xhx.module.attendance.model.AttendanceRecordQuery;
import com.mortals.xhx.module.attendance.model.vo.AttendStatInfo;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
...@@ -14,6 +20,7 @@ import com.mortals.xhx.module.attendance.model.AttendanceRecordDetailQuery; ...@@ -14,6 +20,7 @@ import com.mortals.xhx.module.attendance.model.AttendanceRecordDetailQuery;
import com.mortals.xhx.module.attendance.service.AttendanceRecordDetailService; import com.mortals.xhx.module.attendance.service.AttendanceRecordDetailService;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
...@@ -80,4 +87,51 @@ public class AttendanceRecordServiceImpl extends AbstractCRUDServiceImpl<Attenda ...@@ -80,4 +87,51 @@ public class AttendanceRecordServiceImpl extends AbstractCRUDServiceImpl<Attenda
attendanceRecordDetailService.removeList(attendanceRecordDetaillist, context); attendanceRecordDetailService.removeList(attendanceRecordDetaillist, context);
super.removeAfter(ids, context, result); super.removeAfter(ids, context, result);
} }
@Override
public Rest<AttendStatInfo> statByDay(Context context) {
AttendStatInfo attendStatInfo = new AttendStatInfo();
AttendanceRecordQuery attendanceRecordQuery = new AttendanceRecordQuery();
attendanceRecordQuery.setAttendanceDateStart(DateUtil.today());
attendanceRecordQuery.setAttendanceDateEnd(DateUtil.today());
List<AttendanceRecordEntity> attendanceRecordEntities = this.find(attendanceRecordQuery);
//去掉重复
long total = attendanceRecordEntities.parallelStream().map(item -> item.getStaffId()).distinct().count();
attendStatInfo.setTotal(total);
//迟到次数
long beLate = attendanceRecordEntities.parallelStream()
.flatMap(item -> item.getAttendanceRecordDetailList().stream())
.filter(f -> GoWorkResultEnum.迟到.getValue() == f.getGoWorkResult() || OffWorkResultEnum.迟到.getValue() == f.getOffWorkResult())
.count();
attendStatInfo.setBeLate(beLate);
//早退次数
long leaveEarly = attendanceRecordEntities.parallelStream()
.flatMap(item -> item.getAttendanceRecordDetailList().stream())
.filter(f -> GoWorkResultEnum.早退.getValue() == f.getGoWorkResult() || OffWorkResultEnum.早退.getValue() == f.getOffWorkResult())
.count();
attendStatInfo.setLeaveEarly(leaveEarly);
//缺卡次数
long lackOfCards = attendanceRecordEntities.parallelStream()
.flatMap(item -> item.getAttendanceRecordDetailList().stream())
.filter(f -> GoWorkResultEnum.缺卡.getValue() == f.getGoWorkResult() || OffWorkResultEnum.缺卡.getValue() == f.getOffWorkResult())
.count();
attendStatInfo.setLackOfCards(lackOfCards);
//未考勤
long noAtt=lackOfCards;
long att = total - noAtt;
if (att!=0L){
BigDecimal bigDecimal = new BigDecimal(att).divide(new BigDecimal(total)).multiply(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_CEILING);
attendStatInfo.setAttPercentage(bigDecimal.toString()+"%");
}else{
attendStatInfo.setAttPercentage("0%");
}
return Rest.ok(attendStatInfo);
}
} }
package com.mortals.xhx.module.attendance.web; package com.mortals.xhx.module.attendance.web;
import com.alibaba.fastjson.JSONObject;
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.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
...@@ -9,15 +11,20 @@ import com.mortals.xhx.common.code.NormalEnum; ...@@ -9,15 +11,20 @@ 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.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.service.AttendanceClassService; import com.mortals.xhx.module.attendance.service.AttendanceClassService;
import com.mortals.xhx.module.attendance.service.AttendanceGroupService; import com.mortals.xhx.module.attendance.service.AttendanceGroupService;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.perform.model.PerformAttendAppealEntity;
import com.mortals.xhx.module.perform.model.vo.AppealInfo;
import com.mortals.xhx.module.staff.service.StaffService; import com.mortals.xhx.module.staff.service.StaffService;
import org.checkerframework.checker.units.qual.A; import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
...@@ -172,15 +179,13 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle ...@@ -172,15 +179,13 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
if (ObjectUtils.isEmpty(addDetailList)) { if (ObjectUtils.isEmpty(addDetailList)) {
recordEntity.getAttendanceRecordDetailList().addAll(addDetailList); recordEntity.getAttendanceRecordDetailList().addAll(addDetailList);
List<AttendanceRecordDetailEntity> orderList = recordEntity.getAttendanceRecordDetailList().stream().sorted(Comparator.comparingInt(AttendanceRecordDetailEntity::getOrderNum)) List<AttendanceRecordDetailEntity> orderList = recordEntity.getAttendanceRecordDetailList().stream().sorted(Comparator.comparingInt(AttendanceRecordDetailEntity::getOrderNum))
.collect(Collectors.toList()); .collect(Collectors.toList());
recordEntity.setAttendanceRecordDetailList(orderList); recordEntity.setAttendanceRecordDetailList(orderList);
} }
} }
model.put("dyncColumns", dsyncColumns); model.put("dyncColumns", dsyncColumns);
//出勤情况 /* //出勤情况
//总人数 //总人数
Integer total = (Integer)model.get("total"); Integer total = (Integer)model.get("total");
//未出勤 //未出勤
...@@ -229,8 +234,35 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle ...@@ -229,8 +234,35 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
attendanceStatus.setBeLate(beLate); attendanceStatus.setBeLate(beLate);
attendanceStatus.setLeaveEarly(leaveEarly); attendanceStatus.setLeaveEarly(leaveEarly);
attendanceStatus.setLackOfCards(lackOfCards); attendanceStatus.setLackOfCards(lackOfCards);
model.put("attendanceStatus",attendanceStatus); model.put("attendanceStatus",attendanceStatus);*/
return super.doListAfter(query, model, context); return super.doListAfter(query, model, context);
} }
/**
* 每日统计
*/
@PostMapping(value = "stat")
public String statByDay() {
JSONObject jsonObject = new JSONObject();
String busiDesc = this.getModuleDesc() + "统计";
try {
Rest<AttendStatInfo> rest = this.service.statByDay(getContext());
if (rest.getCode() == YesNoEnum.NO.getValue()) {
throw new AppException("统计异常!");
} else {
jsonObject.put(KEY_RESULT_DATA, rest.getData());
}
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
} catch (Exception e) {
log.error("申诉审核", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
} }
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