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

Merge remote-tracking branch 'origin/master'

parents 83fce092 17ab44a5
......@@ -296,7 +296,7 @@ export default {
}
let params = JSON.parse(JSON.stringify(this.form)); //不更改原始数据
// console.log(this.form,'form参数')
console.log(this.form,'form参数')
let data = this.decode(params);
// Object.assign({}, query, data)
this.$router.push({
......
......@@ -11,30 +11,30 @@
<div class="item flex">
<div>
需要打卡人数
<span class="num">{{ tableData.attendanceStatus.needAttNum }}</span>
<span class="num">{{ attendStatInfo.total }}</span>
</div>
<div>
未出勤 <span class="num">{{ tableData.attendanceStatus.noAtt }}</span>
未出勤 <span class="num">{{ attendStatInfo.noAtt }}</span>
</div>
<div>
出勤率
<span class="num">{{
tableData.attendanceStatus.attPercentage
attendStatInfo.attPercentage
}}</span>
</div>
</div>
<div class="item flex">
<div>
迟到 <span class="num">{{ tableData.attendanceStatus.beLate }}</span>
迟到 <span class="num">{{ attendStatInfo.beLate }}</span>
</div>
<div>
早退
<span class="num">{{ tableData.attendanceStatus.leaveEarly }}</span>
<span class="num">{{ attendStatInfo.leaveEarly }}</span>
</div>
<div>
缺卡
<span class="num">{{ tableData.attendanceStatus.lackOfCards }}</span>
<span class="num">{{attendStatInfo.lackOfCards }}</span>
</div>
</div>
</div>
......@@ -207,6 +207,14 @@ export default {
},
},
created() {
this.$post("/attendance/record/stat", {}).then((res) => {
if (res.code === 1) {
this.attendStatInfo = res.data;
}
});
this.initalArr = this.config.columns;
},
methods: {
......@@ -549,6 +557,7 @@ export default {
exportList: [], //导出记录
baseUrl: process.env.VUE_APP_API_BASE_URL + "/",
initalArr: [],
attendStatInfo:{}
};
},
};
......
......@@ -24,7 +24,12 @@
>
<el-col :span="12"
>违规类型:{{
form.irregularOtherType ? form.irregularOtherType : "--"
form.irregularOtherType
? util_formatter(
"irregularOtherType",
form.irregularOtherType
)
: "--"
}}</el-col
>
</el-row>
......
......@@ -441,19 +441,19 @@ export default {
sourceArr: [
{
label: "脱岗",
value: "1",
value: 1,
},
{
label: "离岗",
value: "2",
value: 2,
},
{
label: "玩手机",
value: "3",
value: 3,
},
{
label: "睡觉",
value: "4",
value: 4,
},
],
form: {},
......
......@@ -503,7 +503,7 @@ export default {
? (this.form[key] = timestampToTime(this.form[key], 6))
: key == "goOffTimeStr"
? (this.form[key] = timestampToTime(this.form[key], 6))
: key == "reviewTime"
: key == "goworkTime"
? (this.form[key] = timestampToTime(this.form[key], 6))
: "";
}
......
......@@ -69,7 +69,6 @@
<el-col :span="22">
<el-form-item label="发生时间:">
<p v-if="form.view == '查看'">{{ form.happenTime }}</p>
<el-date-picker
v-else
v-model="form.happenTime"
......@@ -462,7 +461,7 @@ export default {
? (this.form[key] = timestampToTime(this.form[key], 6))
: key == "goOffTimeStr"
? (this.form[key] = timestampToTime(this.form[key], 6))
: key == "reviewTime"
: key == "happenTime"
? (this.form[key] = timestampToTime(this.form[key], 6))
: "";
}
......@@ -520,7 +519,7 @@ export default {
? (this.form[key] = timestampToTime(this.form[key], 6))
: key == "goOffTimeStr"
? (this.form[key] = timestampToTime(this.form[key], 6))
: key == "reviewTime"
: key == "happenTime"
? (this.form[key] = timestampToTime(this.form[key], 6))
: "";
}
......
......@@ -27,9 +27,12 @@
<div class="user-info">
<span class="user-i">核查时间:{{momentVal(item.checkTime)}}</span>
</div>
<div class="user-info" v-if="item.auditStatus==2">
<span class="user-i">核查结果:{{item.subAddType==1?'+':'-'}}{{item.score}}{{item.checkResult}}</span>
</div>
</div>
<div class="user-right">
<div class="n">{{item.subAddType==1?'+':'-'}}{{item.score}}</div>
<div class="n">{{item.subAddType==1?'+':'-'}}{{item.auditStatus==2?0:item.score}}</div>
</div>
</div>
<!-- <el-form ref="form" :model="form" :rules="rules" label-width="120px">
......
......@@ -120,7 +120,6 @@ public class PerformDetailInfo {
private String filePaths;
/**
* 评价结果(1.非常不满意,2.差评)
*/
......@@ -228,7 +227,7 @@ public class PerformDetailInfo {
private Date deductTime;
private Integer auditStatus;
}
......@@ -99,4 +99,6 @@ public class PerformInfo {
private String result;
private Integer auditStatus;
}
package com.mortals.xhx.busiz.h5.web;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
......@@ -263,6 +264,7 @@ public class ApiWebPerformController extends AbstractBaseController<PerformReq>
recordEntity.setCreateTime(new Date());
recordEntity.setWorkNum(staffEntity.getWorkNum());
recordEntity.setWindowNum(req.getWindowNum());
recordEntity.setReviewTime(DateUtil.parse(req.getReviewTime()));
PerformRulesCategoryEntity categoryEntity = categoryService.get(rule.getCategoryId());
recordEntity.setCategoryName(categoryEntity == null ? "" : categoryEntity.getName());
PerformReviewRecordEntity save = reviewRecordService.save(recordEntity);
......
......@@ -302,7 +302,8 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
recordEntity.setDeptName(staffEntity.getDeptName());
recordEntity.setDeductTime(new Date());
recordEntity.setDeductPerson(staffEntity.getName());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore());
......@@ -336,7 +337,8 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setDeductTime(new Date());
recordEntity.setDeductPerson(staffEntity.getName());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
recordEntity.setDeptId(staffEntity.getDeptId());
recordEntity.setDeptName(staffEntity.getDeptName());
......@@ -370,7 +372,8 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
recordEntity.setDeptName(staffEntity.getDeptName());
recordEntity.setDeductTime(new Date());
recordEntity.setDeductPerson(staffEntity.getName());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
recordEntity.setSubAddType(rule.getSubAddType());
recordEntity.setScore(rule.getScore());
......@@ -400,7 +403,8 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setDeductTime(new Date());
recordEntity.setDeductPerson(staffEntity.getName());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
recordEntity.setDeptId(staffEntity.getDeptId());
recordEntity.setDeptName(staffEntity.getDeptName());
......@@ -430,9 +434,9 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
//recordEntity.setStaffId(staffEntity.getId());
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setDeductTime(new Date());
recordEntity.setDeductPerson(staffEntity.getName());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
recordEntity.setDeptId(staffEntity.getDeptId());
recordEntity.setDeptName(staffEntity.getDeptName());
......@@ -463,7 +467,8 @@ public class InspectApiController extends AbstractBaseController<PerformReq> {
recordEntity.setStaffName(staffEntity.getName());
recordEntity.setDeductTime(new Date());
recordEntity.setDeductPerson(staffEntity.getName());
StaffEntity custStaff = getStaff(context.getUser().getCustomerId().toString());
recordEntity.setDeductPerson(custStaff==null?"系统管理员":custStaff.getName());
recordEntity.setDeptId(staffEntity.getDeptId());
recordEntity.setDeptName(staffEntity.getDeptName());
......
......@@ -8,6 +8,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.DateUtils;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.common.code.YesNoEnum;
......@@ -46,11 +47,17 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService {
@Autowired
private IHikDoorService hikDoorService;
private Integer day;
@Override
public void excuteTask(ITask task) throws AppException {
//同步多久时间段的 偏移量为天 默认当天
String excuteParam = task.getExcuteParam();
if (!ObjectUtils.isEmpty(excuteParam)) {
day = DataUtil.converStr2Int(excuteParam, 0);
}
syncDoorEvents();
//calculateAttendByDay();
}
......@@ -87,7 +94,7 @@ public class SyncDoorsEventTaskImpl implements ITaskExcuteService {
doorEventReq.setEventTypes(eventTypes);
// 获取当天的开始时间
//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());
doorEventReq.setStartTime(todayStart);
......
......@@ -38,7 +38,6 @@ public class AttendanceRecordHikEntity extends AttendanceRecordHikVo {
/**
* 所属部门名称
*/
@Excel(name = "所属部门名称")
private String deptName;
/**
* 职位ID
......@@ -56,7 +55,6 @@ public class AttendanceRecordHikEntity extends AttendanceRecordHikVo {
/**
* 所属考勤组名称
*/
@Excel(name = "所属考勤组名称")
private String attendanceGroupName;
/**
* 班次ID
......@@ -65,7 +63,6 @@ public class AttendanceRecordHikEntity extends AttendanceRecordHikVo {
/**
* 班次名称
*/
@Excel(name = "班次名称")
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;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.attendance.model.AttendanceRecordEntity;
import com.mortals.xhx.module.attendance.model.vo.AttendStatInfo;
/**
* AttendanceRecordService
*
* 考勤打卡记录信息 service接口
*
* @author zxfei
* @date 2023-04-07
*/
public interface AttendanceRecordService extends ICRUDService<AttendanceRecordEntity,Long>{
* AttendanceRecordService
* <p>
* 考勤打卡记录信息 service接口
*
* @author zxfei
* @date 2023-04-07
*/
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;
import cn.hutool.core.date.DateUtil;
import com.mortals.framework.common.Rest;
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 com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -14,6 +20,7 @@ import com.mortals.xhx.module.attendance.model.AttendanceRecordDetailQuery;
import com.mortals.xhx.module.attendance.service.AttendanceRecordDetailService;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Arrays;
import java.util.List;
......@@ -80,4 +87,50 @@ public class AttendanceRecordServiceImpl extends AbstractCRUDServiceImpl<Attenda
attendanceRecordDetailService.removeList(attendanceRecordDetaillist, context);
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;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
......@@ -9,15 +11,20 @@ import com.mortals.xhx.common.code.NormalEnum;
import com.mortals.xhx.common.code.OffWorkResultEnum;
import com.mortals.xhx.common.code.YesNoEnum;
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.AttendanceGroupService;
import com.mortals.xhx.module.dept.model.DeptQuery;
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 org.checkerframework.checker.units.qual.A;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;
import com.mortals.framework.model.Context;
......@@ -172,15 +179,13 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
if (ObjectUtils.isEmpty(addDetailList)) {
recordEntity.getAttendanceRecordDetailList().addAll(addDetailList);
List<AttendanceRecordDetailEntity> orderList = recordEntity.getAttendanceRecordDetailList().stream().sorted(Comparator.comparingInt(AttendanceRecordDetailEntity::getOrderNum))
.collect(Collectors.toList());
recordEntity.setAttendanceRecordDetailList(orderList);
}
}
model.put("dyncColumns", dsyncColumns);
//出勤情况
/* //出勤情况
//总人数
Integer total = (Integer)model.get("total");
//未出勤
......@@ -229,8 +234,35 @@ public class AttendanceRecordController extends BaseCRUDJsonBodyMappingControlle
attendanceStatus.setBeLate(beLate);
attendanceStatus.setLeaveEarly(leaveEarly);
attendanceStatus.setLackOfCards(lackOfCards);
model.put("attendanceStatus",attendanceStatus);
model.put("attendanceStatus",attendanceStatus);*/
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