Commit 4027e3bc authored by 廖旭伟's avatar 廖旭伟

绩效汇总前初始化绩效避免之前有扣分但被全部撤销的情况

parent ddc111c9
...@@ -7,15 +7,21 @@ import com.mortals.framework.springcloud.service.IApplicationStartedService; ...@@ -7,15 +7,21 @@ import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.common.code.CheckTypeEnum; import com.mortals.xhx.common.code.CheckTypeEnum;
import com.mortals.xhx.common.utils.StaffPerformUtil;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery; import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.service.*; import com.mortals.xhx.module.check.service.*;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; 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.math.BigDecimal;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE; import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE;
import static com.mortals.xhx.common.key.RedisKey.STAFF_PERFORM_SUMMARY; import static com.mortals.xhx.common.key.RedisKey.STAFF_PERFORM_SUMMARY;
...@@ -45,6 +51,8 @@ public class StaffCheckSummaryService implements IApplicationStartedService { ...@@ -45,6 +51,8 @@ public class StaffCheckSummaryService implements IApplicationStartedService {
private CheckWindowWorkmanPerformService checkWindowWorkmanPerformService; private CheckWindowWorkmanPerformService checkWindowWorkmanPerformService;
@Autowired @Autowired
private CheckOtherRecordService checkOtherRecordService; private CheckOtherRecordService checkOtherRecordService;
@Autowired
private StaffPerformSummaryService staffPerformSummaryService;
@Override @Override
public void start() { public void start() {
...@@ -74,6 +82,30 @@ public class StaffCheckSummaryService implements IApplicationStartedService { ...@@ -74,6 +82,30 @@ public class StaffCheckSummaryService implements IApplicationStartedService {
} }
} }
//汇总前初始化绩效避免之前有扣分但被全部撤销的情况
Date date = DateUtils.StrToDateTime(query.getCheckTimeStart());
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity();
staffPerformSummaryEntity.setReviewScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setOtherScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setGoworkScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setEffectScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setComplainScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setAttendScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setTotalScore(StaffPerformUtil.SCORE100);
staffPerformSummaryEntity.setErrorScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setUpdateTime(new Date());
Map<String,Object> condition = new HashMap<>();
condition.put("year",year);
condition.put("month",month);
if(query.getStaffId()!=null){
condition.put("staffId",query.getStaffId());
}
staffPerformSummaryService.getDao().update(staffPerformSummaryEntity,condition);
if(query.getCheckType() == CheckTypeEnum.考勤绩效.getValue()){ if(query.getCheckType() == CheckTypeEnum.考勤绩效.getValue()){
checkAttendRecordService.summaryCheck(query); checkAttendRecordService.summaryCheck(query);
} }
......
...@@ -138,30 +138,30 @@ public class StaffPerformSummaryController extends BaseCRUDJsonBodyMappingContro ...@@ -138,30 +138,30 @@ public class StaffPerformSummaryController extends BaseCRUDJsonBodyMappingContro
if(StringUtils.isNotEmpty(verify)&&verify.equals("true")){ if(StringUtils.isNotEmpty(verify)&&verify.equals("true")){
throw new AppException("汇总任务正在执行,请勿重复操作"); throw new AppException("汇总任务正在执行,请勿重复操作");
} }
if(StringUtils.isNotEmpty(query.getCheckTimeStart())){ // if(StringUtils.isNotEmpty(query.getCheckTimeStart())){
Date date = DateUtils.StrToDateTime(query.getCheckTimeStart()); // Date date = DateUtils.StrToDateTime(query.getCheckTimeStart());
Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
calendar.setTime(date); // calendar.setTime(date);
int year = calendar.get(Calendar.YEAR); // int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1; // int month = calendar.get(Calendar.MONTH) + 1;
StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity(); // StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity();
staffPerformSummaryEntity.setReviewScore(BigDecimal.ZERO); // staffPerformSummaryEntity.setReviewScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setOtherScore(BigDecimal.ZERO); // staffPerformSummaryEntity.setOtherScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setGoworkScore(BigDecimal.ZERO); // staffPerformSummaryEntity.setGoworkScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setEffectScore(BigDecimal.ZERO); // staffPerformSummaryEntity.setEffectScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setComplainScore(BigDecimal.ZERO); // staffPerformSummaryEntity.setComplainScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setAttendScore(BigDecimal.ZERO); // staffPerformSummaryEntity.setAttendScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setTotalScore(StaffPerformUtil.SCORE100); // staffPerformSummaryEntity.setTotalScore(StaffPerformUtil.SCORE100);
staffPerformSummaryEntity.setErrorScore(BigDecimal.ZERO); // staffPerformSummaryEntity.setErrorScore(BigDecimal.ZERO);
staffPerformSummaryEntity.setUpdateTime(new Date()); // staffPerformSummaryEntity.setUpdateTime(new Date());
Map<String,Object> condition = new HashMap<>(); // Map<String,Object> condition = new HashMap<>();
condition.put("year",year); // condition.put("year",year);
condition.put("month",month); // condition.put("month",month);
if(query.getStaffId()!=null){ // if(query.getStaffId()!=null){
condition.put("staffId",query.getStaffId()); // condition.put("staffId",query.getStaffId());
} // }
this.service.getDao().update(staffPerformSummaryEntity,condition); // this.service.getDao().update(staffPerformSummaryEntity,condition);
} // }
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE,query); cacheService.lpush(KEY_CHECK_SUMMARY_CACHE,query);
cacheService.set(SUMMARY_TASK_KEY,"true",900); //15分钟过期 cacheService.set(SUMMARY_TASK_KEY,"true",900); //15分钟过期
model.put("message_info", "开始执行绩效汇总,请稍后查看"); model.put("message_info", "开始执行绩效汇总,请稍后查看");
......
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