Commit 75cd5018 authored by 廖旭伟's avatar 廖旭伟

绩效汇总分数显示优化

parent c0bf2de4
package com.mortals.xhx.module.staff.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.pdu.WeightPdu;
import com.mortals.xhx.module.staff.dao.StaffPerformSummaryDao;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEntity;
......@@ -13,10 +16,14 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.util.Calendar;
import java.util.List;
import static com.mortals.xhx.common.key.ParamKey.SYS_PARAM_WEIGHT;
/**
* StaffPerformSummaryService
* 员工绩效统计 service实现
......@@ -30,6 +37,8 @@ public class StaffPerformSummaryServiceImpl extends AbstractCRUDServiceImpl<Staf
@Autowired
private StaffService staffService;
@Autowired
private ParamService paramService;
@Override
protected StaffPerformSummaryEntity findBefore(StaffPerformSummaryEntity params, PageInfo pageInfo, Context context) throws AppException {
......@@ -48,13 +57,44 @@ public class StaffPerformSummaryServiceImpl extends AbstractCRUDServiceImpl<Staf
@Override
protected void findAfter(StaffPerformSummaryEntity params, PageInfo pageInfo, Context context, List<StaffPerformSummaryEntity> list) throws AppException {
if(CollectionUtils.isNotEmpty(list)){
String value = paramService.getValueByKey(SYS_PARAM_WEIGHT);
WeightPdu weightPdu;
if (ObjectUtils.isEmpty(value)){
weightPdu = new WeightPdu();
}else {
weightPdu = JSONObject.parseObject(value,WeightPdu.class);
}
for(StaffPerformSummaryEntity item:list) {
StaffEntity staffEntity = staffService.get(item.getStaffId());
if(staffEntity!=null){
item.setWorkNum(staffEntity.getWorkNum());
item.setPhoneNumber(staffEntity.getPhoneNumber());
}
computeSummary(item,weightPdu);
}
}
}
private void computeSummary(StaffPerformSummaryEntity staffPerformSummaryEntity, WeightPdu weightPdu){
BigDecimal total = new BigDecimal(100);
BigDecimal reviewScore = total.add(staffPerformSummaryEntity.getReviewScore()); //评价
reviewScore = reviewScore.multiply(weightPdu.reviewWeight());
staffPerformSummaryEntity.setReviewScore(reviewScore.setScale(2,BigDecimal.ROUND_DOWN));
BigDecimal attendScore = total.add(staffPerformSummaryEntity.getAttendScore()); //考勤
attendScore = attendScore.multiply(weightPdu.attendWeight());
staffPerformSummaryEntity.setAttendScore(attendScore.setScale(2,BigDecimal.ROUND_DOWN));
BigDecimal otherScore = staffPerformSummaryEntity.getOtherScore(); //自评不用加100
if(otherScore.compareTo(BigDecimal.ZERO)==0){
otherScore = new BigDecimal(100);
}
otherScore = otherScore.multiply(weightPdu.selfWeight());
staffPerformSummaryEntity.setOtherScore(otherScore.setScale(2,BigDecimal.ROUND_DOWN));
BigDecimal goworkScore = total.add(staffPerformSummaryEntity.getGoworkScore()); //办件
goworkScore = goworkScore.multiply(weightPdu.goworkWeight());
staffPerformSummaryEntity.setGoworkScore(goworkScore.setScale(2,BigDecimal.ROUND_DOWN));
BigDecimal effectScore = total.add(staffPerformSummaryEntity.getEffectScore()); //效能
effectScore = effectScore.multiply(weightPdu.effectWeight());
staffPerformSummaryEntity.setEffectScore(effectScore.setScale(2,BigDecimal.ROUND_DOWN));
}
}
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