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

测试bug修改

parent 3339f087
...@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE; import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE;
...@@ -60,7 +61,18 @@ public class StaffCheckSummaryService implements IApplicationStartedService { ...@@ -60,7 +61,18 @@ public class StaffCheckSummaryService implements IApplicationStartedService {
query.setCheckTimeStart(DateUtil.beginOfMonth(date).toDateStr()); query.setCheckTimeStart(DateUtil.beginOfMonth(date).toDateStr());
query.setCheckTimeEnd(DateUtil.endOfMonth(date).toDateStr()); query.setCheckTimeEnd(DateUtil.endOfMonth(date).toDateStr());
query.setYear(DateUtil.year(date)); query.setYear(DateUtil.year(date));
query.setMonth(DateUtil.month(date)+1); int checkMonth = DateUtil.month(date)+1;
query.setMonth(checkMonth);
Date now = new Date();
int nowMonth = DateUtil.month(now)+1;
if(checkMonth==nowMonth){
//汇总当月绩效
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
query.setCheckTimeEnd(DateUtils.getStrDateTime(calendar.getTime()));
query.setCheckTimeStart(DateUtil.beginOfMonth(calendar.getTime()).toDateStr());
}
} }
if(query.getCheckType() == CheckTypeEnum.考勤绩效.getValue()){ if(query.getCheckType() == CheckTypeEnum.考勤绩效.getValue()){
checkAttendRecordService.summaryCheck(query); checkAttendRecordService.summaryCheck(query);
...@@ -126,4 +138,16 @@ public class StaffCheckSummaryService implements IApplicationStartedService { ...@@ -126,4 +138,16 @@ public class StaffCheckSummaryService implements IApplicationStartedService {
return 30; return 30;
} }
public static void main(String[] args) {
Date date = DateUtil.parse("2024-07-17","yyyy-MM-dd");
int year = DateUtil.year(date);
int checkMonth = DateUtil.month(date)+1;
int checkDay = DateUtil.dayOfMonth(date);
System.out.println(year);
System.out.println(checkMonth);
System.out.println(checkDay);
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH,-1);
System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
}
} }
package com.mortals.xhx.module.check.web; package com.mortals.xhx.module.check.web;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
...@@ -66,23 +67,10 @@ public class CheckAllRecordController extends BaseJsonBodyController { ...@@ -66,23 +67,10 @@ public class CheckAllRecordController extends BaseJsonBodyController {
try { try {
PageInfo pageInfo = new PageInfo(-1); PageInfo pageInfo = new PageInfo(-1);
if (StringUtils.isEmpty(query.getCheckTimeStart())) { if (StringUtils.isEmpty(query.getCheckTimeStart())) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.DAY_OF_MONTH,-1);
String startTime = format.format(calendar.getTime()); query.setCheckTimeEnd(DateUtils.getStrDateTime(calendar.getTime()));
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); query.setCheckTimeStart(DateUtil.beginOfMonth(calendar.getTime()).toDateStr());
String endTime = format.format(calendar.getTime());
query.setCheckTimeStart(startTime);
// String summaryTime = cacheService.get(STAFF_PERFORM_SUMMARY);
// if(StringUtils.isNotEmpty(summaryTime)){
// query.setCheckTimeEnd(summaryTime);
// }else {
// query.setCheckTimeEnd(endTime +" 23:59:59");
// }
}else {
if(StringUtils.isNotEmpty(query.getCheckTimeEnd()) && query.getCheckTimeEnd().length()>9) {
query.setCheckTimeEnd(query.getCheckTimeEnd() + " 23:59:59");
}
} }
Result<CheckAllRecordVo> result = checkAllRecordService.getAllCheckRecord(query, pageInfo); Result<CheckAllRecordVo> result = checkAllRecordService.getAllCheckRecord(query, pageInfo);
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<if test="createTimeEnd != null and createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createTimeEnd != null and createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND errorTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="checkTimeStart != null and checkTimeStart!=''"> AND errorTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND errorTime <![CDATA[ <= ]]> STR_TO_DATE(#{checkTimeEnd},'%Y-%m-%d %k:%i:%s') </if> <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND errorTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if>
UNION UNION
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,checkStatus,checkResult,auditStatus,createTime,score,subMethod,checkTime,deductTime,4 AS checkType ,'effect' AS performType,updateTime,remark FROM mortals_xhx_check_effect_record WHERE 1=1 SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,checkStatus,checkResult,auditStatus,createTime,score,subMethod,checkTime,deductTime,4 AS checkType ,'effect' AS performType,updateTime,remark FROM mortals_xhx_check_effect_record WHERE 1=1
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
<if test="createTimeEnd != null and createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="createTimeEnd != null and createTimeEnd!=''"> AND createTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND errorTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if> <if test="checkTimeStart != null and checkTimeStart!=''"> AND errorTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="checkTimeEnd != null and checkTimeEnd!=''"> AND errorTime <![CDATA[ <= ]]> STR_TO_DATE(#{checkTimeEnd},'%Y-%m-%d %k:%i:%s') </if> <if test="checkTimeEnd != null and checkTimeEnd!=''"> AND errorTime <![CDATA[ <= ]]> STR_TO_DATE(left(concat(#{checkTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') </if>
<if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if> <if test="createUserId != null and createUserId!=''"> AND createUserId = #{createUserId} </if>
UNION UNION
SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,checkStatus,checkResult,auditStatus,createTime,score,subMethod,checkTime,deductTime,4 AS checkType ,'effect' AS performType,updateTime,remark FROM mortals_xhx_check_effect_record WHERE 1=1 SELECT id,recordId,staffId,staffName,workNum,deptId,deptName,ruleId,ruleName,subAddType,checkStatus,checkResult,auditStatus,createTime,score,subMethod,checkTime,deductTime,4 AS checkType ,'effect' AS performType,updateTime,remark FROM mortals_xhx_check_effect_record WHERE 1=1
......
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