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

评价投诉和评价差评合计为评价分数

parent 6c3f621c
package com.mortals.xhx.module.check.service.impl; package com.mortals.xhx.module.check.service.impl;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
...@@ -9,7 +10,9 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; ...@@ -9,7 +10,9 @@ import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
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.base.system.message.MessageService; import com.mortals.xhx.base.system.message.MessageService;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.*; import com.mortals.xhx.common.code.*;
import com.mortals.xhx.common.pdu.WeightPdu;
import com.mortals.xhx.common.utils.AuditUtil; import com.mortals.xhx.common.utils.AuditUtil;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.check.dao.CheckComplainRecordDao; import com.mortals.xhx.module.check.dao.CheckComplainRecordDao;
...@@ -48,6 +51,8 @@ import java.util.Calendar; ...@@ -48,6 +51,8 @@ import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import static com.mortals.xhx.common.key.ParamKey.SYS_PARAM_WEIGHT;
/** /**
* CheckComplainRecordService * CheckComplainRecordService
* 评价绩效投诉核查信息 service实现 * 评价绩效投诉核查信息 service实现
...@@ -79,6 +84,8 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec ...@@ -79,6 +84,8 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec
@Autowired @Autowired
private PerformRulesService rulesService; private PerformRulesService rulesService;
@Autowired
private ParamService paramService;
@Override @Override
protected void saveBefore(CheckComplainRecordEntity entity, Context context) throws AppException { protected void saveBefore(CheckComplainRecordEntity entity, Context context) throws AppException {
...@@ -199,6 +206,13 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec ...@@ -199,6 +206,13 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec
} }
List<StaffCheckSummaryVo> summaryVoList = dao.summaryCheck(query); List<StaffCheckSummaryVo> summaryVoList = dao.summaryCheck(query);
if (CollectionUtils.isNotEmpty(summaryVoList)) { if (CollectionUtils.isNotEmpty(summaryVoList)) {
String value = paramService.getValueByKey(SYS_PARAM_WEIGHT);
WeightPdu weightPdu;
if (ObjectUtils.isEmpty(value)){
weightPdu = new WeightPdu();
}else {
weightPdu = JSONObject.parseObject(value,WeightPdu.class);
}
for (StaffCheckSummaryVo vo : summaryVoList) { for (StaffCheckSummaryVo vo : summaryVoList) {
StaffEntity staffEntity = staffService.get(vo.getStaffId()); StaffEntity staffEntity = staffService.get(vo.getStaffId());
if(staffEntity.getStatus() == StaffSatusEnum.离职.getValue()) { if(staffEntity.getStatus() == StaffSatusEnum.离职.getValue()) {
...@@ -215,10 +229,11 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec ...@@ -215,10 +229,11 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec
if(staffEntity.getAttendCheck()==0 && staffEntity.getEffectCheck()==0 && staffEntity.getGoworkCheck()==0 && staffEntity.getComplainCheck()==0){ if(staffEntity.getAttendCheck()==0 && staffEntity.getEffectCheck()==0 && staffEntity.getGoworkCheck()==0 && staffEntity.getComplainCheck()==0){
continue; continue;
} }
StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity(); StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity();
staffPerformSummaryEntity.initAttrValue(); staffPerformSummaryEntity.initAttrValue();
BeanUtils.copyProperties(vo, staffPerformSummaryEntity, BeanUtil.getNullPropertyNames(vo)); BeanUtils.copyProperties(vo, staffPerformSummaryEntity, BeanUtil.getNullPropertyNames(vo));
staffPerformSummaryEntity.setComplainScore(vo.getSumScore()); staffPerformSummaryEntity.setReviewScore(vo.getSumScore());
StaffPerformSummaryQuery summaryQuery = new StaffPerformSummaryQuery(); StaffPerformSummaryQuery summaryQuery = new StaffPerformSummaryQuery();
summaryQuery.setStaffId(vo.getStaffId()); summaryQuery.setStaffId(vo.getStaffId());
summaryQuery.setYear(vo.getYear()); summaryQuery.setYear(vo.getYear());
...@@ -252,8 +267,9 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec ...@@ -252,8 +267,9 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec
erro = erro.add(staffPerformSummaryEntity.getEffectScore()); erro = erro.add(staffPerformSummaryEntity.getEffectScore());
erro = erro.add(staffPerformSummaryEntity.getComplainScore()); erro = erro.add(staffPerformSummaryEntity.getComplainScore());
staffPerformSummaryEntity.setErrorScore(erro); staffPerformSummaryEntity.setErrorScore(erro);
BigDecimal total = new BigDecimal(100); // BigDecimal total = new BigDecimal(100);
staffPerformSummaryEntity.setTotalScore(total.add(erro)); // staffPerformSummaryEntity.setTotalScore(total.add(erro));
computeSummary(staffPerformSummaryEntity,weightPdu,staffEntity);
staffPerformSummaryEntity.setId(temp.getId()); staffPerformSummaryEntity.setId(temp.getId());
staffPerformSummaryEntity.setUpdateTime(new Date()); staffPerformSummaryEntity.setUpdateTime(new Date());
staffPerformSummaryService.update(staffPerformSummaryEntity); staffPerformSummaryService.update(staffPerformSummaryEntity);
...@@ -267,8 +283,9 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec ...@@ -267,8 +283,9 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec
staffPerformSummaryEntity.setEffectScore(new BigDecimal(0)); staffPerformSummaryEntity.setEffectScore(new BigDecimal(0));
staffPerformSummaryEntity.setReviewScore(new BigDecimal(0)); staffPerformSummaryEntity.setReviewScore(new BigDecimal(0));
staffPerformSummaryEntity.setErrorScore(vo.getSumScore()); staffPerformSummaryEntity.setErrorScore(vo.getSumScore());
BigDecimal total = new BigDecimal(100); // BigDecimal total = new BigDecimal(100);
staffPerformSummaryEntity.setTotalScore(total.add(vo.getSumScore())); // staffPerformSummaryEntity.setTotalScore(total.add(vo.getSumScore()));
computeSummary(staffPerformSummaryEntity,weightPdu,staffEntity);
staffPerformSummaryEntity.setCreateUserId(1l); staffPerformSummaryEntity.setCreateUserId(1l);
staffPerformSummaryEntity.setCreateTime(new Date()); staffPerformSummaryEntity.setCreateTime(new Date());
staffPerformSummaryService.save(staffPerformSummaryEntity); staffPerformSummaryService.save(staffPerformSummaryEntity);
...@@ -426,4 +443,39 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec ...@@ -426,4 +443,39 @@ public class CheckComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Chec
totalScore = totalScore.subtract(totalSubScore); totalScore = totalScore.subtract(totalSubScore);
statEntity.setTotalScore(totalScore); statEntity.setTotalScore(totalScore);
} }
private void computeSummary(StaffPerformSummaryEntity staffPerformSummaryEntity, WeightPdu weightPdu, StaffEntity staffEntity){
BigDecimal total = new BigDecimal(100);
BigDecimal reviewScore = total.add(staffPerformSummaryEntity.getReviewScore()); //评价
reviewScore = reviewScore.multiply(weightPdu.reviewWeight());
BigDecimal attendScore = total.add(staffPerformSummaryEntity.getAttendScore()); //考勤
attendScore = attendScore.multiply(weightPdu.attendWeight());
BigDecimal otherScore = staffPerformSummaryEntity.getOtherScore(); //自评不用加100
if(otherScore.compareTo(BigDecimal.ZERO)==0){
otherScore = new BigDecimal(100);
}
otherScore = otherScore.multiply(weightPdu.selfWeight());
BigDecimal goworkScore = total.add(staffPerformSummaryEntity.getGoworkScore()); //办件
goworkScore = goworkScore.multiply(weightPdu.goworkWeight());
BigDecimal effectScore = total.add(staffPerformSummaryEntity.getEffectScore()); //效能
effectScore = effectScore.multiply(weightPdu.effectWeight());
// BigDecimal complainScore = complainScore = total.add(staffPerformSummaryEntity.getComplainScore()); //投诉
BigDecimal summary = new BigDecimal(0);
if(staffEntity.getReviewCheck()==1) {
summary = summary.add(reviewScore);
}
if(staffEntity.getAttendCheck()==1) {
summary = summary.add(attendScore);
}
if(staffEntity.getOtherCheck()==1) {
summary = summary.add(otherScore);
}
if(staffEntity.getEffectCheck()==1){
summary = summary.add(effectScore);
}
if(staffEntity.getGoworkCheck()==1) {
summary = summary.add(goworkScore);
}
staffPerformSummaryEntity.setTotalScore(summary);
}
} }
\ No newline at end of file
...@@ -63,7 +63,10 @@ public class PerformComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Pe ...@@ -63,7 +63,10 @@ public class PerformComplainRecordServiceImpl extends AbstractCRUDServiceImpl<Pe
if (!ObjectUtils.isEmpty(entity.getStaffId())) { if (!ObjectUtils.isEmpty(entity.getStaffId())) {
StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString()); StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
entity.setStaffName(staffCache == null ? "" : staffCache.getName()); entity.setStaffName(staffCache == null ? "" : staffCache.getName());
entity.setDeptId(staffCache == null ? null : staffCache.getDeptId());
entity.setDeptName(staffCache == null ? "" : staffCache.getDeptName()); entity.setDeptName(staffCache == null ? "" : staffCache.getDeptName());
entity.setSalaId(staffCache == null ? null : staffCache.getSalaId());
entity.setSalaName(staffCache == null ? "" : staffCache.getSalaName());
} }
entity.setDeductTime(new Date()); entity.setDeductTime(new Date());
......
...@@ -65,7 +65,10 @@ public class PerformReviewRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -65,7 +65,10 @@ public class PerformReviewRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
if (!ObjectUtils.isEmpty(entity.getStaffId())) { if (!ObjectUtils.isEmpty(entity.getStaffId())) {
StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString()); StaffEntity staffCache = staffService.getCache(entity.getStaffId().toString());
entity.setStaffName(staffCache == null ? "" : staffCache.getName()); entity.setStaffName(staffCache == null ? "" : staffCache.getName());
entity.setDeptId(staffCache == null ? null : staffCache.getDeptId());
entity.setDeptName(staffCache == null ? "" : staffCache.getDeptName()); entity.setDeptName(staffCache == null ? "" : staffCache.getDeptName());
entity.setSalaId(staffCache == null ? null : staffCache.getSalaId());
entity.setSalaName(staffCache == null ? "" : staffCache.getSalaName());
} }
entity.setDeductTime(new Date()); entity.setDeductTime(new Date());
if(ObjectUtils.isEmpty(entity.getDeductPerson())){ if(ObjectUtils.isEmpty(entity.getDeductPerson())){
...@@ -76,6 +79,7 @@ public class PerformReviewRecordServiceImpl extends AbstractCRUDServiceImpl<Perf ...@@ -76,6 +79,7 @@ public class PerformReviewRecordServiceImpl extends AbstractCRUDServiceImpl<Perf
@Override @Override
protected void saveAfter(PerformReviewRecordEntity entity, Context context) throws AppException { protected void saveAfter(PerformReviewRecordEntity entity, Context context) throws AppException {
CheckReviewRecordEntity checkReviewRecordEntity = new CheckReviewRecordEntity(); CheckReviewRecordEntity checkReviewRecordEntity = new CheckReviewRecordEntity();
checkReviewRecordEntity.initAttrValue();
BeanUtils.copyProperties(entity, checkReviewRecordEntity, BeanUtil.getNullPropertyNames(entity)); BeanUtils.copyProperties(entity, checkReviewRecordEntity, BeanUtil.getNullPropertyNames(entity));
checkReviewRecordEntity.setId(null); checkReviewRecordEntity.setId(null);
checkReviewRecordEntity.setRecordId(entity.getId()); checkReviewRecordEntity.setRecordId(entity.getId());
......
...@@ -10,7 +10,11 @@ ...@@ -10,7 +10,11 @@
ANY_VALUE(DATE_FORMAT(checkTime,'%m')) as `month`, ANY_VALUE(DATE_FORMAT(checkTime,'%m')) as `month`,
SUM(CASE subAddType WHEN 1 THEN score ELSE score*-1 END) as sumScore SUM(CASE subAddType WHEN 1 THEN score ELSE score*-1 END) as sumScore
FROM FROM
mortals_xhx_check_complain_record (
SELECT staffId,staffName,workNum,salaId,salaName,deptId,deptName,checkTime,subAddType,score,checkStatus,auditStatus FROM mortals_xhx_check_complain_record
UNION
SELECT staffId,staffName,workNum,salaId,salaName,deptId,deptName,checkTime,subAddType,score,checkStatus,auditStatus FROM mortals_xhx_check_review_record
) as a
WHERE checkStatus = 2 and auditStatus = 1 WHERE checkStatus = 2 and auditStatus = 1
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if> <if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![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 checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
......
...@@ -10,7 +10,11 @@ ...@@ -10,7 +10,11 @@
ANY_VALUE(DATE_FORMAT(checkTime,'%m')) as `month`, ANY_VALUE(DATE_FORMAT(checkTime,'%m')) as `month`,
SUM(CASE subAddType WHEN 1 THEN score ELSE score*-1 END) as sumScore SUM(CASE subAddType WHEN 1 THEN score ELSE score*-1 END) as sumScore
FROM FROM
mortals_xhx_check_review_record (
SELECT staffId,staffName,workNum,salaId,salaName,deptId,deptName,checkTime,subAddType,score,checkStatus,auditStatus FROM mortals_xhx_check_complain_record
UNION
SELECT staffId,staffName,workNum,salaId,salaName,deptId,deptName,checkTime,subAddType,score,checkStatus,auditStatus FROM mortals_xhx_check_review_record
) as a
WHERE checkStatus = 2 and auditStatus = 1 WHERE checkStatus = 2 and auditStatus = 1
<if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if> <if test="staffId != null and staffId!=''"> AND staffId = #{staffId} </if>
<if test="checkTimeStart != null and checkTimeStart!=''"> AND checkTime <![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 checkTime <![CDATA[ >= ]]> STR_TO_DATE(left(concat(#{checkTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') </if>
......
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