Commit 47150c3d authored by 廖旭伟's avatar 廖旭伟

增加绩效汇总任务用于处理保存绩效核查数据的后续处理

parent 06e21d82
......@@ -29,4 +29,7 @@ public class RedisKey {
public static final String KEY_HOME_STAT_CACHE = "attendance:home:stat";
/** 绩效核查汇总 **/
public static final String KEY_CHECK_SUMMARY_CACHE = "staff:check:summary";
}
package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.xhx.common.code.CheckTypeEnum;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE;
/***
* 绩效汇总任务执行
*/
@Component
@Slf4j
public class StaffCheckSummaryService implements IApplicationStartedService {
protected Boolean stopped = false;
@Autowired
private ICacheService cacheService;
@Autowired
private CheckAttendRecordService checkAttendRecordService;
@Autowired
private CheckEffectRecordService checkEffectRecordService;
@Autowired
private CheckGoworkRecordService checkGoworkRecordService;
@Autowired
private CheckReviewRecordService checkReviewRecordService;
@Autowired
private CheckWindowWorkmanPerformService checkWindowWorkmanPerformService;
@Override
public void start() {
Thread sendThread = new Thread(new Runnable() {
@Override
public void run() {
int waitTime = 10;
while (!stopped) {
try {
StaffCheckSummaryQuery query = cacheService.rpop(KEY_CHECK_SUMMARY_CACHE, StaffCheckSummaryQuery.class);
if(!ObjectUtils.isEmpty(query)){
if(query.getCheckType() == CheckTypeEnum.考勤绩效.getValue()){
checkAttendRecordService.summaryCheck(query);
}
if(query.getCheckType() == CheckTypeEnum.效能绩效.getValue()){
checkEffectRecordService.summaryCheck(query);
}
if(query.getCheckType() == CheckTypeEnum.办件绩效.getValue()){
checkGoworkRecordService.summaryCheck(query);
}
if(query.getCheckType() == CheckTypeEnum.评价绩效.getValue()){
checkReviewRecordService.summaryCheck(query);
}
if(query.getCheckType() == CheckTypeEnum.其它绩效.getValue()){
checkWindowWorkmanPerformService.summaryCheck(query);
}
}
try {
Thread.sleep(waitTime);
} catch (InterruptedException e2) {
}
} catch (Exception e) {
log.error("异常", e);
try {
Thread.sleep(waitTime);
} catch (InterruptedException e2) {
}
}
}
}
});
sendThread.start();
}
@Override
public void stop() {
log.info("停止服务..");
this.stopped = true;
}
@Override
public int getOrder() {
return 30;
}
}
......@@ -19,5 +19,9 @@ public class StaffCheckSummaryQuery {
private Integer year;
/** 月 */
private Integer month;
private Long recordId;
/** 核查类型 */
private Integer checkType;
}
......@@ -5,6 +5,11 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.check.dao.CheckWindowWorkmanPerformDao;
import com.mortals.xhx.module.check.model.CheckWindowWorkmanPerformEntity;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo;
import java.util.List;
/**
* CheckWindowWorkmanPerformService
*
......@@ -24,4 +29,11 @@ public interface CheckWindowWorkmanPerformService extends ICRUDService<CheckWind
* @throws AppException
*/
void examine(CheckWindowWorkmanPerformEntity entity, Context context) throws AppException;
/**
* 汇总已审核的核查记录
* @param query
* @return
*/
List<StaffCheckSummaryVo> summaryCheck(StaffCheckSummaryQuery query) throws AppException;
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils;
......@@ -52,6 +53,8 @@ import java.util.Date;
import java.util.List;
import static com.mortals.xhx.common.key.ParamKey.SYS_PARAM_WEIGHT;
import static com.mortals.xhx.common.key.RedisKey.KEY_ATTENDANCE_STAT_CACHE;
import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE;
/**
* CheckAttendRecordService
......@@ -87,6 +90,9 @@ public class CheckAttendRecordServiceImpl extends AbstractCRUDServiceImpl<CheckA
@Autowired
private ParamService paramService;
@Autowired
private ICacheService cacheService;
@Override
protected void saveBefore(CheckAttendRecordEntity entity, Context context) throws AppException {
updateStaffRuleNames(entity);
......@@ -123,7 +129,9 @@ public class CheckAttendRecordServiceImpl extends AbstractCRUDServiceImpl<CheckA
query.setStaffId(entity.getStaffId());
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
summaryCheck(query);
query.setCheckType(CheckTypeEnum.考勤绩效.getValue());
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE, query);
//summaryCheck(query);
} catch (Exception e) {
log.error("汇总已审核的核查记录出错", e);
}
......@@ -193,7 +201,11 @@ public class CheckAttendRecordServiceImpl extends AbstractCRUDServiceImpl<CheckA
sendCheckDingTalk(temp);
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(temp.getStaffId());
summaryCheck(query);
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
query.setCheckType(CheckTypeEnum.考勤绩效.getValue());
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE, query);
//summaryCheck(query);
} catch (Exception e) {
log.error("汇总已审核的核查记录出错", e);
}
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils;
......@@ -52,6 +53,7 @@ import java.util.Date;
import java.util.List;
import static com.mortals.xhx.common.key.ParamKey.SYS_PARAM_WEIGHT;
import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE;
/**
* CheckEffectRecordService
......@@ -85,6 +87,8 @@ public class CheckEffectRecordServiceImpl extends AbstractCRUDServiceImpl<CheckE
private PerformRulesService rulesService;
@Autowired
private ParamService paramService;
@Autowired
private ICacheService cacheService;
@Override
protected void saveBefore(CheckEffectRecordEntity entity, Context context) throws AppException {
......@@ -118,7 +122,9 @@ public class CheckEffectRecordServiceImpl extends AbstractCRUDServiceImpl<CheckE
query.setStaffId(entity.getStaffId());
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
summaryCheck(query);
query.setCheckType(CheckTypeEnum.效能绩效.getValue());
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE, query);
//summaryCheck(query);
}catch (Exception e){
log.error("汇总已审核的核查记录出错",e);
}
......@@ -187,7 +193,11 @@ public class CheckEffectRecordServiceImpl extends AbstractCRUDServiceImpl<CheckE
sendCheckDingTalk(temp);
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(temp.getStaffId());
summaryCheck(query);
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
query.setCheckType(CheckTypeEnum.效能绩效.getValue());
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE, query);
//summaryCheck(query);
}catch (Exception e){
log.error("汇总已审核的核查记录出错",e);
}
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DateUtils;
......@@ -52,6 +53,7 @@ import java.util.Date;
import java.util.List;
import static com.mortals.xhx.common.key.ParamKey.SYS_PARAM_WEIGHT;
import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE;
/**
* CheckGoworkRecordService
......@@ -85,6 +87,8 @@ public class CheckGoworkRecordServiceImpl extends AbstractCRUDServiceImpl<CheckG
private PerformRulesService rulesService;
@Autowired
private ParamService paramService;
@Autowired
private ICacheService cacheService;
@Override
protected void saveBefore(CheckGoworkRecordEntity entity, Context context) throws AppException {
......@@ -117,7 +121,9 @@ public class CheckGoworkRecordServiceImpl extends AbstractCRUDServiceImpl<CheckG
query.setStaffId(entity.getStaffId());
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
summaryCheck(query);
query.setCheckType(CheckTypeEnum.办件绩效.getValue());
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE, query);
//summaryCheck(query);
}catch (Exception e){
log.error("汇总已审核的核查记录出错",e);
}
......@@ -184,7 +190,11 @@ public class CheckGoworkRecordServiceImpl extends AbstractCRUDServiceImpl<CheckG
sendCheckDingTalk(temp);
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(temp.getStaffId());
summaryCheck(query);
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
query.setCheckType(CheckTypeEnum.办件绩效.getValue());
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE, query);
//summaryCheck(query);
}catch (Exception e){
log.error("汇总已审核的核查记录出错",e);
}
......
......@@ -3,6 +3,7 @@ package com.mortals.xhx.module.check.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils;
......@@ -54,6 +55,7 @@ import java.util.Date;
import java.util.List;
import static com.mortals.xhx.common.key.ParamKey.SYS_PARAM_WEIGHT;
import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE;
/**
* CheckReviewRecordService
......@@ -82,6 +84,8 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
private DeptService deptService;
@Autowired
private PerformReviewRecordService recordService;
@Autowired
private ICacheService cacheService;
@Autowired
......@@ -120,7 +124,9 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
query.setStaffId(entity.getStaffId());
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
summaryCheck(query);
query.setCheckType(CheckTypeEnum.评价绩效.getValue());
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE, query);
//summaryCheck(query);
} catch (Exception e) {
log.error("汇总已审核的核查记录出错", e);
}
......@@ -189,7 +195,11 @@ public class CheckReviewRecordServiceImpl extends AbstractCRUDServiceImpl<CheckR
sendCheckDingTalk(temp);
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(temp.getStaffId());
summaryCheck(query);
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
query.setCheckType(CheckTypeEnum.评价绩效.getValue());
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE, query);
//summaryCheck(query);
} catch (Exception e) {
log.error("汇总已审核的核查记录出错", e);
}
......
package com.mortals.xhx.module.check.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.code.CheckTypeEnum;
import com.mortals.xhx.common.pdu.WeightPdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.check.model.CheckWindowPerformEntity;
......@@ -37,6 +39,7 @@ import java.util.Date;
import java.util.List;
import static com.mortals.xhx.common.key.ParamKey.SYS_PARAM_WEIGHT;
import static com.mortals.xhx.common.key.RedisKey.KEY_CHECK_SUMMARY_CACHE;
/**
* CheckWindowWorkmanPerformService
......@@ -53,6 +56,8 @@ public class CheckWindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImp
private StaffPerformSummaryService staffPerformSummaryService;
@Autowired
private ParamService paramService;
@Autowired
private ICacheService cacheService;
@Override
public void examine(CheckWindowWorkmanPerformEntity entity, Context context) throws AppException {
......@@ -77,10 +82,13 @@ public class CheckWindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImp
query.setRecordId(temp.getRecordId());
query.setYear(temp.getYear());
query.setMonth(temp.getMonth());
summaryCheck(query);
query.setCheckType(CheckTypeEnum.其它绩效.getValue());
cacheService.lpush(KEY_CHECK_SUMMARY_CACHE, query);
//summaryCheck(query);
}
private List<StaffCheckSummaryVo> summaryCheck(StaffCheckSummaryQuery query) throws AppException {
@Override
public List<StaffCheckSummaryVo> summaryCheck(StaffCheckSummaryQuery query) throws AppException {
List<StaffCheckSummaryVo> summaryVoList = dao.summaryCheck(query);
if (CollectionUtils.isNotEmpty(summaryVoList)) {
String value = paramService.getValueByKey(SYS_PARAM_WEIGHT);
......
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