修改考勤统计逻辑

This commit is contained in:
wans 2021-10-18 18:07:55 +08:00
parent cf8cb15921
commit 13a447bcdf
12 changed files with 91 additions and 160 deletions

View File

@ -151,7 +151,7 @@ public class AssessmentController extends AbstractController {
private Map<String, Object> listUserSignStatusParams() {
Map<String, Object> params = requestParams();
if (!Objects.isNull(params.get("userType")) && !StringUtils.isBlank(params.get("userType").toString())) {
if (StringUtils.equals("4", params.get("userType").toString())) {
if (StringUtils.equals("N", params.get("userType").toString())) {
params.put("roleId", BaseService.ROLE_N_PERSON);
} else {
params.put("communityBossLevel", params.get("userType").toString());

View File

@ -12,6 +12,7 @@ import com.cm.common.result.SuccessResultData;
import com.cm.common.result.SuccessResultList;
import com.cm.systemcity.pojo.dtos.worknote.WorkNoteDTO;
import com.cm.systemcity.pojo.vos.worknote.WorkNoteVO;
import com.cm.systemcity.service.assessment.IAssessmentService;
import com.cm.systemcity.service.worknote.IWorkNoteService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
@ -34,6 +35,8 @@ public class WorkNoteAppController extends AbstractController {
@Autowired
private IWorkNoteService workNoteService;
@Autowired
private IAssessmentService assessmentService;
@ApiOperation(value = "新增工作日志", notes = "新增工作日志接口")
@ApiImplicitParams({
@ -116,5 +119,16 @@ public class WorkNoteAppController extends AbstractController {
Map<String, Object> params = requestParams();
return workNoteService.countWorkNote(params);
}
@ApiOperation(value = "考勤统计手动调用接口(勿乱用)", notes = "考勤统计手动调用接口(勿乱用)")
@ApiImplicitParams({
@ApiImplicitParam(name = "day", value = "日期yyyy-MM-dd", paramType = "query")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping(ISystemConstant.APP_RELEASE_SUFFIX + "/savedayassessmentusersignin")
public SuccessResult saveDayAssessmentUserSignin2() throws Exception {
Map<String, Object> params = requestParams();
assessmentService.saveDayAssessmentUserSignin(params.get("day").toString());
return new SuccessResult();
}
}

View File

@ -124,7 +124,7 @@ public class AssessmentAreaExcelDTO {
.append(assessmentUserCount);
sb.append(",\"shouldSignCount\":")
.append("\"").append(shouldSignCount).append("\"");
sb.append(",\"signCount\":")
sb.append(",\"signInCount\":")
.append("\"").append(signCount).append("\"");
sb.append(",\"unSignCount\":")
.append("\"").append(unSignCount).append("\"");

View File

@ -24,8 +24,12 @@ public class AssessmentDTO {
private String positionNames;
@ApiModelProperty(name = "departmentNames", value = "部门名称列表")
private String departmentNames;
@ApiModelProperty(name = "shouldSigninCount", value = "应签到次数")
private Integer shouldSigninCount;
@ApiModelProperty(name = "signinCount", value = "签到次数")
private Integer signinCount;
@ApiModelProperty(name = "shouldSignoutCount", value = "应签退次数")
private Integer shouldSignoutCount;
@ApiModelProperty(name = "signoutCount", value = "签退次数")
private Integer signoutCount;
@ApiModelProperty(name = "unSigninCount", value = "未签到次数")
@ -177,6 +181,22 @@ public class AssessmentDTO {
this.deductionPercent = deductionPercent;
}
public Integer getShouldSigninCount() {
return shouldSigninCount;
}
public void setShouldSigninCount(Integer shouldSigninCount) {
this.shouldSigninCount = shouldSigninCount;
}
public Integer getShouldSignoutCount() {
return shouldSignoutCount;
}
public void setShouldSignoutCount(Integer shouldSignoutCount) {
this.shouldSignoutCount = shouldSignoutCount;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
@ -188,8 +208,12 @@ public class AssessmentDTO {
.append(positionNames).append('\"');
sb.append(",\"departmentNames\":\"")
.append(departmentNames).append('\"');
sb.append(",\"shouldSigninCount\":")
.append(shouldSigninCount);
sb.append(",\"signinCount\":")
.append(signinCount);
sb.append(",\"shouldSignoutCount\":")
.append(shouldSignoutCount);
sb.append(",\"signoutCount\":")
.append(signoutCount);
sb.append(",\"unSigninCount\":")

View File

@ -1,6 +1,8 @@
package com.cm.systemcity.pojo.dtos.assessment;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import lombok.ToString;
/**
* When you feel like quitting. Think about why you started
@ -12,6 +14,8 @@ import com.alibaba.excel.annotation.ExcelProperty;
* @Date: 2019/10/30 8:47 下午
* @Version: 1.0
**/
@Data
@ToString
public class AssessmentExcelDTO {
@ExcelProperty(value = "人员名称")
@ -20,10 +24,14 @@ public class AssessmentExcelDTO {
private String positionNames;
@ExcelProperty(value = "部门名称列表")
private String departmentNames;
@ExcelProperty(value = "应签到次数")
private String shouldSignInCount;
@ExcelProperty(value = "签到次数")
private String signCount;
@ExcelProperty(value = "漏签次数")
private String unSignCount;
private String signInCount;
@ExcelProperty(value = "应签退次数")
private String shouldSignOutCount;
@ExcelProperty(value = "签退次数")
private String signOutCount;
@ExcelProperty(value = "请假天数")
private String leaveTimeSum;
@ExcelProperty(value = "旷工次数")
@ -37,120 +45,4 @@ public class AssessmentExcelDTO {
@ExcelProperty(value = "绩效扣除比例(%)")
private String deductionPercent;
public String getUserName() {
return userName == null ? "" : userName.trim();
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getPositionNames() {
return positionNames == null ? "" : positionNames.trim();
}
public void setPositionNames(String positionNames) {
this.positionNames = positionNames;
}
public String getDepartmentNames() {
return departmentNames == null ? "" : departmentNames;
}
public void setDepartmentNames(String departmentNames) {
this.departmentNames = departmentNames;
}
public String getSignCount() {
return signCount == null ? "" : signCount.trim();
}
public void setSignCount(String signCount) {
this.signCount = signCount;
}
public String getUnSignCount() {
return unSignCount == null ? "" : unSignCount.trim();
}
public void setUnSignCount(String unSignCount) {
this.unSignCount = unSignCount;
}
public String getLeaveTimeSum() {
return leaveTimeSum == null ? "" : leaveTimeSum;
}
public void setLeaveTimeSum(String leaveTimeSum) {
this.leaveTimeSum = leaveTimeSum;
}
public String getAbsenteeismCount() {
return absenteeismCount == null ? "" : absenteeismCount.trim();
}
public void setAbsenteeismCount(String absenteeismCount) {
this.absenteeismCount = absenteeismCount;
}
public String getOutOfContactOneHourCount() {
return outOfContactOneHourCount == null ? "" : outOfContactOneHourCount.trim();
}
public void setOutOfContactOneHourCount(String outOfContactOneHourCount) {
this.outOfContactOneHourCount = outOfContactOneHourCount;
}
public String getContactHour() {
return contactHour == null ? "" : contactHour.trim();
}
public void setContactHour(String contactHour) {
this.contactHour = contactHour;
}
public String getWorkDistance() {
return workDistance == null ? "" : workDistance.trim();
}
public void setWorkDistance(String workDistance) {
this.workDistance = workDistance;
}
public String getDeductionPercent() {
return deductionPercent == null ? "" : deductionPercent.trim();
}
public void setDeductionPercent(String deductionPercent) {
this.deductionPercent = deductionPercent;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("{");
sb.append("\"userName\":\"")
.append(userName).append('\"');
sb.append(",\"positionNames\":\"")
.append(positionNames).append('\"');
sb.append(",\"departmentNames\":\"")
.append(departmentNames).append('\"');
sb.append(",\"signCount\":\"")
.append(signCount).append('\"');
sb.append(",\"unSignCount\":\"")
.append(unSignCount).append('\"');
sb.append(",\"leaveTimeSum\":\"")
.append(leaveTimeSum).append('\"');
sb.append(",\"absenteeismCount\":\"")
.append(absenteeismCount).append('\"');
sb.append(",\"outOfContactOneHourCount\":\"")
.append(outOfContactOneHourCount).append('\"');
sb.append(",\"contactHour\":\"")
.append(contactHour).append('\"');
sb.append(",\"workDistance\":\"")
.append(workDistance).append('\"');
sb.append(",\"deductionPercent\":\"")
.append(deductionPercent).append('\"');
sb.append('}');
return sb.toString();
}
}

View File

@ -124,7 +124,7 @@ public class UserSignDayStatusExcelDTO {
.append(positionNames).append('\"');
sb.append(",\"departmentNames\":\"")
.append(departmentNames).append('\"');
sb.append(",\"signCount\":\"")
sb.append(",\"signInCount\":\"")
.append(signCount).append('\"');
sb.append(",\"leaveTimeSum\":\"")
.append(leaveTimeSum).append('\"');

View File

@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
import com.cm.common.exception.AccessTokenException;
import com.cm.common.exception.SearchException;
import com.cm.common.plugin.oauth.service.department.IDepartmentService;
import com.cm.common.plugin.oauth.service.menu.IMenuService;
import com.cm.common.plugin.oauth.service.user.IUserService;
import com.cm.common.plugin.oauth.token.ClientTokenManager;
import com.cm.common.plugin.pojo.bos.ClientTokenBO;
@ -41,7 +40,6 @@ import com.cm.systemcity.service.usersignin.IUserSigninService;
import com.cm.systemcity.service.usersignout.IUserSignoutService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.joda.time.Days;
@ -133,8 +131,8 @@ public class AssessmentServiceImpl extends BaseService implements IAssessmentSer
params.clear();
params.put("orderBy", "user");
params.put("userIds", userIds);
params.put("startTime", String.format("%s %s", showDay, config.get("amStartPunchTime").toString()));
params.put("endTime", String.format("%s %s", showDay, config.get("pmEndPunchTime").toString()));
params.put("startTime", String.format("%s %s", showDay, "09:00:00"));
params.put("endTime", String.format("%s %s", showDay, "18:00:00"));
params.put("isOverstep", 0);
if (!StringUtils.equals(showDay, DateUtil.getDay())) {
params.put("today", "today");
@ -205,10 +203,10 @@ public class AssessmentServiceImpl extends BaseService implements IAssessmentSer
// N员
shouldSignInCount = 1;
shouldSignOutCount = 1;
} else if (userSignDayStatusDTO.getCommunityBossLevel() != null && userSignDayStatusDTO.getCommunityBossLevel() == 3) {
} else if (userSignDayStatusDTO.getCommunityBossLevel() != null && userSignDayStatusDTO.getCommunityBossLevel() == 4) {
// 3级网格长
shouldSignInCount = 2;
shouldSignOutCount = 2;
shouldSignInCount = 1;
shouldSignOutCount = 1;
}
// 设置应签到次数
userSignDayStatusDTO.setShouldSigninCount(shouldSignInCount);
@ -233,13 +231,16 @@ public class AssessmentServiceImpl extends BaseService implements IAssessmentSer
int unSignCount = unSigninCount + unSignoutCount;
double deductionPercent = 0D;
double leaveDayCountDeductionPercent = dayLeaveCount * 2.4D;
if (shouldSignInCount == 1) {
// N员签到签退各1次每次2.4不包括请假
deductionPercent = unSignCount * 2.4D - leaveDayCountDeductionPercent;
} else if (shouldSignInCount == 2) {
// 网格长员签到签退各2次每次1.2不包括请假
deductionPercent = unSignCount * 1.2D - leaveDayCountDeductionPercent;
}
deductionPercent = unSignCount * 2.4D - leaveDayCountDeductionPercent;
// if (shouldSignInCount == 1) {
// // N员签到签退各1次每次2.4不包括请假
// deductionPercent = unSignCount * 2.4D - leaveDayCountDeductionPercent;
// } else if (shouldSignInCount == 2) {
// // 网格长员签到签退各2次每次1.2不包括请假
// deductionPercent = unSignCount * 1.2D - leaveDayCountDeductionPercent;
// }
userSignDayStatusDTO.setDeductionPercent(deductionPercent < 0 ? 0 : deductionPercent);
}
@ -332,8 +333,10 @@ public class AssessmentServiceImpl extends BaseService implements IAssessmentSer
assessmentExcelDTO.setUserName(assessmentDTO.getUserName());
assessmentExcelDTO.setPositionNames(assessmentDTO.getPositionNames());
assessmentExcelDTO.setDepartmentNames(assessmentDTO.getDepartmentNames());
assessmentExcelDTO.setSignCount(String.valueOf(assessmentDTO.getSigninCount() + assessmentDTO.getSignoutCount()));
assessmentExcelDTO.setUnSignCount(String.valueOf(assessmentDTO.getUnSigninCount() + assessmentDTO.getUnSignoutCount()));
assessmentExcelDTO.setShouldSignInCount(String.valueOf(assessmentDTO.getShouldSigninCount()));
assessmentExcelDTO.setSignInCount(String.valueOf(assessmentDTO.getSigninCount()));
assessmentExcelDTO.setShouldSignOutCount(String.valueOf(assessmentDTO.getShouldSignoutCount()));
assessmentExcelDTO.setSignOutCount(String.valueOf(assessmentDTO.getSignoutCount()));
assessmentExcelDTO.setLeaveTimeSum(assessmentDTO.getLeaveTimeSum().toString());
assessmentExcelDTO.setAbsenteeismCount(assessmentDTO.getAbsenteeismCount().toString());
assessmentExcelDTO.setOutOfContactOneHourCount(assessmentDTO.getOutOfContactOneHourCount().toString());
@ -342,7 +345,7 @@ public class AssessmentServiceImpl extends BaseService implements IAssessmentSer
assessmentExcelDTO.setDeductionPercent(assessmentDTO.getDeductionPercent().toString());
assessmentExcelDTOs.add(assessmentExcelDTO);
}
String[] excelHeaderNames = {"人员名称", "职位", "部门", "签到次数", "签次数", "请假天数", "旷工次数", "失联1小时情况(次)", "工作时长(小时)", "工作里程(KM)", "绩效扣除比例(%)"};
String[] excelHeaderNames = {"人员名称", "职位", "部门", "签到次数", "到次数", "应签退次数", "签退次数", "请假天数", "旷工次数", "失联1小时情况(次)", "工作时长(小时)", "工作里程(KM)", "绩效扣除比例(%)"};
List<List<String>> excelHeaders = simpleExcelHeader(excelHeaderNames);
EasyExcel.write(response.getOutputStream()).sheet("历史考勤统计").head(excelHeaders).doWrite(assessmentExcelDTOs);
}

View File

@ -246,8 +246,8 @@ public class UserLocationServiceImpl extends BaseService implements IUserLocatio
today = DateUtil.getDay();
}
Map<String, Object> config = CacheManager.getInstance().getConfig();
String startTime = Objects.isNull(params.get("startTime")) ? String.format("%s %s", today, config.get(startTimeKey).toString()) : params.get("startTime").toString();
String endTime = Objects.isNull(params.get("endTime")) ? String.format("%s %s", today, config.get(endTimeKey).toString()) : params.get("endTime").toString();
String startTime = Objects.isNull(params.get("startTime")) ? String.format("%s %s", today, "09:00:00") : params.get("startTime").toString();
String endTime = Objects.isNull(params.get("endTime")) ? String.format("%s %s", today, "18:00:00") : params.get("endTime").toString();
if (!isStartAndEndTimeParams(startTime, endTime, params)) {
return new ArrayList<>();
}

View File

@ -40,8 +40,10 @@
<result property="userName" column="user_name"/>
<result property="positionNames" column="position_names"/>
<result property="departmentNames" column="department_names"/>
<result property="shouldSigninCount" column="should_signin_count"/>
<result property="signinCount" column="signin_count"/>
<result property="unSigninCount" column="unsignin_count"/>
<result property="shouldSignoutCount" column="should_signout_count"/>
<result property="signoutCount" column="signout_count"/>
<result property="unSignoutCount" column="unsignout_count"/>
<result property="amDayLeaveCount" column="am_day_leave_count"/>
@ -158,10 +160,7 @@
t1.*
FROM
city_assessment t1
INNER JOIN
sys_user t2
ON
t1.user_id = t2.user_id
INNER JOIN sys_user t2 ON t1.user_id = t2.user_id
WHERE
t2.is_delete = 0
<if test="showDay != null and showDay != ''">
@ -201,8 +200,10 @@
t1.user_name,
t1.position_names,
t1.department_names,
SUM(t1.should_signin_count) should_signin_count,
SUM(t1.signin_count) signin_count,
SUM(t1.unsignin_count) unsignin_count,
SUM(t1.should_signout_count) should_signout_count,
SUM(t1.signout_count) signout_count,
SUM(t1.unsignout_count) unsignout_count,
SUM(t1.am_day_leave_count) am_day_leave_count,
@ -245,10 +246,6 @@
AND
t1.community_boss_level = #{communityBossLevel}
</if>
<if test="communityBossLevel != null and communityBossLevel != ''">
AND
t1.community_boss_level = #{communityBossLevel}
</if>
<if test="roleId != null and roleId != ''">
AND
t1.role_ids LIKE CONCAT('%', #{roleId}, '%')

View File

@ -610,8 +610,7 @@
GROUP_CONCAT( t9.role_id ) role_ids
FROM
sys_user t1
LEFT JOIN
city_community_boss t2 ON t1.user_id = t2.community_boss_id
LEFT JOIN city_community_boss t2 ON t1.user_id = t2.community_boss_user_id
AND
t2.is_delete = 0
LEFT JOIN

View File

@ -47,10 +47,11 @@
<div class="layui-inline" style="width: 150px;">
<select id="userType" name="userType">
<option value="">人员类别</option>
<option value="1">一级网格长</option>
<option value="2">二级网格长</option>
<option value="3">三级网格长</option>
<option value="4">专管员</option>
<option value="1">二级网格长</option>
<option value="2">三级网格长</option>
<option value="3">四级网格长</option>
<option value="4">五级网格员</option>
<option value="N">专管员</option>
</select>
</div>
<div class="layui-inline">

View File

@ -47,10 +47,11 @@
<div class="layui-inline" style="width: 150px;">
<select id="userType" name="userType">
<option value="">人员类别</option>
<option value="1">一级网格长</option>
<option value="2">二级网格长</option>
<option value="3">三级网格长</option>
<option value="4">专管员</option>
<option value="1">二级网格长</option>
<option value="2">三级网格长</option>
<option value="3">四级网格长</option>
<option value="4">五级网格员</option>
<option value="N">专管员</option>
</select>
</div>
<div class="layui-inline">
@ -151,7 +152,7 @@
return rowData;
}
},
{field: 'signoutCount', width: 120, title: '未签到次数', align:'center',
{field: 'signoutCount', width: 120, title: '签退次数', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData === '') {