diff --git a/src/main/java/com/cm/systemcity/controller/apis/assessment/AssessmentController.java b/src/main/java/com/cm/systemcity/controller/apis/assessment/AssessmentController.java index 2c162b5..1d9d459 100644 --- a/src/main/java/com/cm/systemcity/controller/apis/assessment/AssessmentController.java +++ b/src/main/java/com/cm/systemcity/controller/apis/assessment/AssessmentController.java @@ -151,7 +151,7 @@ public class AssessmentController extends AbstractController { private Map listUserSignStatusParams() { Map 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()); diff --git a/src/main/java/com/cm/systemcity/controller/app/worknote/WorkNoteAppController.java b/src/main/java/com/cm/systemcity/controller/app/worknote/WorkNoteAppController.java index aa30361..de22307 100644 --- a/src/main/java/com/cm/systemcity/controller/app/worknote/WorkNoteAppController.java +++ b/src/main/java/com/cm/systemcity/controller/app/worknote/WorkNoteAppController.java @@ -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 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 params = requestParams(); + assessmentService.saveDayAssessmentUserSignin(params.get("day").toString()); + return new SuccessResult(); + } } \ No newline at end of file diff --git a/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentAreaExcelDTO.java b/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentAreaExcelDTO.java index c413d00..f74f0c6 100644 --- a/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentAreaExcelDTO.java +++ b/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentAreaExcelDTO.java @@ -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("\""); diff --git a/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentDTO.java b/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentDTO.java index 5a687f1..b9aef3f 100644 --- a/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentDTO.java +++ b/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentDTO.java @@ -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\":") diff --git a/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentExcelDTO.java b/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentExcelDTO.java index e47d89c..1f92619 100644 --- a/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentExcelDTO.java +++ b/src/main/java/com/cm/systemcity/pojo/dtos/assessment/AssessmentExcelDTO.java @@ -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(); - } } diff --git a/src/main/java/com/cm/systemcity/pojo/dtos/usersignin/UserSignDayStatusExcelDTO.java b/src/main/java/com/cm/systemcity/pojo/dtos/usersignin/UserSignDayStatusExcelDTO.java index 6ccd3f7..e3ec558 100644 --- a/src/main/java/com/cm/systemcity/pojo/dtos/usersignin/UserSignDayStatusExcelDTO.java +++ b/src/main/java/com/cm/systemcity/pojo/dtos/usersignin/UserSignDayStatusExcelDTO.java @@ -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('\"'); diff --git a/src/main/java/com/cm/systemcity/service/assessment/impl/AssessmentServiceImpl.java b/src/main/java/com/cm/systemcity/service/assessment/impl/AssessmentServiceImpl.java index f4da7c9..e62ce8b 100644 --- a/src/main/java/com/cm/systemcity/service/assessment/impl/AssessmentServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/assessment/impl/AssessmentServiceImpl.java @@ -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> excelHeaders = simpleExcelHeader(excelHeaderNames); EasyExcel.write(response.getOutputStream()).sheet("历史考勤统计").head(excelHeaders).doWrite(assessmentExcelDTOs); } diff --git a/src/main/java/com/cm/systemcity/service/userlocation/impl/UserLocationServiceImpl.java b/src/main/java/com/cm/systemcity/service/userlocation/impl/UserLocationServiceImpl.java index a459c26..74743e9 100755 --- a/src/main/java/com/cm/systemcity/service/userlocation/impl/UserLocationServiceImpl.java +++ b/src/main/java/com/cm/systemcity/service/userlocation/impl/UserLocationServiceImpl.java @@ -246,8 +246,8 @@ public class UserLocationServiceImpl extends BaseService implements IUserLocatio today = DateUtil.getDay(); } Map 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<>(); } diff --git a/src/main/resources/mybatis/mapper/assessment/assessment-mapper.xml b/src/main/resources/mybatis/mapper/assessment/assessment-mapper.xml index 4c67642..c056478 100755 --- a/src/main/resources/mybatis/mapper/assessment/assessment-mapper.xml +++ b/src/main/resources/mybatis/mapper/assessment/assessment-mapper.xml @@ -40,8 +40,10 @@ + + @@ -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 @@ -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} - - AND - t1.community_boss_level = #{communityBossLevel} - AND t1.role_ids LIKE CONCAT('%', #{roleId}, '%') diff --git a/src/main/resources/mybatis/mapper/usersignin/usersignin-mapper.xml b/src/main/resources/mybatis/mapper/usersignin/usersignin-mapper.xml index 17c20b3..129258f 100755 --- a/src/main/resources/mybatis/mapper/usersignin/usersignin-mapper.xml +++ b/src/main/resources/mybatis/mapper/usersignin/usersignin-mapper.xml @@ -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 diff --git a/src/main/resources/static/route/assessment/list_day.html b/src/main/resources/static/route/assessment/list_day.html index 0118022..1deb7f9 100755 --- a/src/main/resources/static/route/assessment/list_day.html +++ b/src/main/resources/static/route/assessment/list_day.html @@ -47,10 +47,11 @@
diff --git a/src/main/resources/static/route/assessment/list_history.html b/src/main/resources/static/route/assessment/list_history.html index 07ee17c..90314f1 100755 --- a/src/main/resources/static/route/assessment/list_history.html +++ b/src/main/resources/static/route/assessment/list_history.html @@ -47,10 +47,11 @@
@@ -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 === '') {