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

宜宾绩效汇总新需求

parent c9c577c0
......@@ -2,6 +2,7 @@ package com.mortals.xhx.common.utils;
import com.mortals.xhx.common.pdu.WeightPdu;
import com.mortals.xhx.module.staff.model.StaffEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEditEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEntity;
import java.math.BigDecimal;
......@@ -89,4 +90,46 @@ public class StaffPerformUtil {
staffPerformSummaryEntity.setSumScore(staffPerformSummaryEntity.getTotalScore().add(staffPerformSummaryEntity.getAddTotalScore()));
}
}
public static void computeSummary(StaffPerformSummaryEditEntity staffPerformSummaryEntity, WeightPdu weightPdu){
BigDecimal reviewScore = weightPdu.reviewWeight().add(staffPerformSummaryEntity.getReviewScore()); //评价分数默认20分扣完为止
if(reviewScore.compareTo(BigDecimal.ZERO)< 0){
reviewScore = BigDecimal.ZERO;
}
BigDecimal attendScore = weightPdu.attendWeight().add(staffPerformSummaryEntity.getAttendScore()); //考勤
if(attendScore.compareTo(BigDecimal.ZERO)< 0){
attendScore = BigDecimal.ZERO;
}
BigDecimal otherScore = staffPerformSummaryEntity.getOtherScore(); //其他绩效加分项
BigDecimal goworkScore = weightPdu.goworkWeight().add(staffPerformSummaryEntity.getGoworkScore()); //办件
if(goworkScore.compareTo(BigDecimal.ZERO)< 0){
goworkScore = BigDecimal.ZERO;
}
BigDecimal effectScore = weightPdu.effectWeight().add(staffPerformSummaryEntity.getEffectScore()); //效能
if(effectScore.compareTo(BigDecimal.ZERO)< 0){
effectScore = BigDecimal.ZERO;
}
BigDecimal complainScore = staffPerformSummaryEntity.getComplainScore(); //自评不用加100
if(complainScore.compareTo(BigDecimal.ZERO)==0){
complainScore = SCORE100;
}
complainScore = complainScore.multiply(weightPdu.selfWeight());
BigDecimal summary = new BigDecimal(0);
summary = summary.add(reviewScore);
summary = summary.add(attendScore);
summary = summary.add(effectScore);
summary = summary.add(goworkScore);
summary = summary.add(complainScore);
summary = summary.add(otherScore);
staffPerformSummaryEntity.setTotalScore(summary);
if(staffPerformSummaryEntity.getAddTotalScore()!=null){
staffPerformSummaryEntity.setSumScore(staffPerformSummaryEntity.getTotalScore().add(staffPerformSummaryEntity.getAddTotalScore()));
}
}
}
......@@ -11,6 +11,7 @@ import com.mortals.xhx.common.utils.StaffPerformUtil;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.service.*;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryEditService;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -53,6 +54,8 @@ public class StaffCheckSummaryService implements IApplicationStartedService {
private CheckOtherRecordService checkOtherRecordService;
@Autowired
private StaffPerformSummaryService staffPerformSummaryService;
@Autowired
private StaffPerformSummaryEditService staffPerformSummaryEditService;
@Override
public void start() {
......@@ -139,6 +142,8 @@ public class StaffCheckSummaryService implements IApplicationStartedService {
log.info("绩效分数汇总完成");
cacheService.set(STAFF_PERFORM_SUMMARY, DateUtils.getCurrStrDateTime());
}
//同步绩效汇总数据
staffPerformSummaryEditService.syncStaffPerformSummary(year,month,query.getStaffId());
}
......
package com.mortals.xhx.module.staff.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEditEntity;
import java.util.List;
import java.util.Map;
/**
* 员工绩效统计Dao
* 员工绩效统计 DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface StaffPerformSummaryEditDao extends ICRUDDao<StaffPerformSummaryEditEntity,Long>{
int updateSumScore(Map<String,Object> condition);
}
package com.mortals.xhx.module.staff.dao.ibatis;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import com.mortals.xhx.module.staff.dao.StaffPerformSummaryEditDao;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEditEntity;
import org.springframework.stereotype.Repository;
import java.util.Map;
/**
* 员工绩效统计DaoImpl DAO接口
*
* @author zxfei
* @date 2025-04-10
*/
@Repository("staffPerformSummaryEditDao")
public class StaffPerformSummaryEditDaoImpl extends BaseCRUDDaoMybatis<StaffPerformSummaryEditEntity,Long> implements StaffPerformSummaryEditDao {
@Override
public int updateSumScore(Map<String,Object> condition) {
return this.getSqlSession().update(this.getSqlId("updateSumScore"),condition);
}
}
package com.mortals.xhx.module.staff.model;
import java.math.BigDecimal;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.staff.model.vo.StaffPerformSummaryEditVo;
import lombok.Data;
/**
* 员工绩效统计实体对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class StaffPerformSummaryEditEntity extends StaffPerformSummaryEditVo {
private static final long serialVersionUID = 1L;
/**
* 人员id
*/
private Long staffId;
/**
* 所属中心
*/
//@Excel(name = "所属中心")
private String belongCenter;
/**
* 工号
*/
@Excel(name = "工号",sort = 2)
private String workNum;
/**
* 人员名称
*/
@Excel(name = "姓名",sort = 1)
private String staffName;
/**
* 所属大厅
*/
private Long salaId;
/**
* 所属大厅名称
*/
@Excel(name = "所属大厅",sort = 4)
private String salaName;
/**
* 部门id号
*/
private Long deptId;
/**
* 部门名称
*/
@Excel(name = "所属部门",sort = 5)
private String deptName;
/**
* 考勤绩效指标分数
*/
@Excel(name = "服务规范(考勤绩效)",sort = 7)
private BigDecimal attendScore;
/**
* 评价绩效指标分数
*/
@Excel(name = "群众评议",sort = 9)
private BigDecimal reviewScore;
/**
* 投诉绩效指标分数
*/
@Excel(name = "综合管理(自评绩效)",sort = 8)
private BigDecimal complainScore;
/**
* 办件绩效分数
*/
@Excel(name = "工作效能(办件绩效)",sort = 10)
private BigDecimal goworkScore;
/**
* 效能绩效分数
*/
@Excel(name = "工作纪律(效能绩效)",sort = 6)
private BigDecimal effectScore;
/**
* 其它绩效分数 加分项
*/
@Excel(name = "加分(其它绩效)",sort = 11)
private BigDecimal otherScore;
/**
* 累计异常分数
*/
//@Excel(name = "累计异常分数")
private BigDecimal errorScore;
/**
* 当月得分数
*/
@Excel(name = "本月绩效得分数",sort = 12)
private BigDecimal totalScore;
/**
* 备注
*/
@Excel(name = "备注1",sort = 19)
private String remark;
/**
* 年
*/
@Excel(name = "年",sort = 15)
private Integer year;
/**
* 月
*/
@Excel(name = "月",sort = 16)
private Integer month;
/**
* 加分备注
*/
private String remarkAdd;
/**
* 加分合计
*/
@Excel(name = "加分",sort = 13)
private BigDecimal addTotalScore;
/**
* 合计得分
*/
@Excel(name = "合计得分",sort = 14)
private BigDecimal sumScore;
/**
* 政务服务管理科审核等次
*/
@Excel(name = "政务服务管理科审核等次",sort = 17)
private String auditLevel;
/**
* 服务明星推荐
*/
@Excel(name = "服务明星推荐",sort = 18)
private String recommend;
/**
* 数据类型1,系统自动2手动录入
*/
private Integer dataType;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof StaffPerformSummaryEditEntity) {
StaffPerformSummaryEditEntity tmp = (StaffPerformSummaryEditEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.staffId = 0L;
this.workNum = "";
this.staffName = "";
this.belongCenter = "宜宾市民中心";
this.salaId = null;
this.salaName = "";
this.deptId = 0L;
this.deptName = "";
this.year = DateUtil.year(new Date());
this.month = DateUtil.month(new Date())+1;
this.attendScore = BigDecimal.ZERO;
this.reviewScore = BigDecimal.ZERO;
this.complainScore = BigDecimal.ZERO;
this.goworkScore = BigDecimal.ZERO;
this.effectScore = BigDecimal.ZERO;
this.otherScore = BigDecimal.ZERO;
this.errorScore = BigDecimal.ZERO;
this.totalScore = BigDecimal.ZERO;
this.remark = "";
this.remarkAdd = "";
this.addTotalScore = BigDecimal.ZERO;
this.sumScore = BigDecimal.ZERO;
this.auditLevel = "";
this.recommend = "";
this.dataType = 1;
}
}
\ No newline at end of file
package com.mortals.xhx.module.staff.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEditEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 员工绩效统计视图对象
*
* @author zxfei
* @date 2025-04-10
*/
@Data
public class StaffPerformSummaryEditVo extends BaseEntityLong {
/**
* 联系电话
*/
@Excel(name = "手机号码",sort = 3)
private String phoneNumber;
private Integer sortKind;
@Excel(name = "备注2",sort = 20)
private String remarkAddDesc;
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.staff.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEditEntity;
import com.mortals.xhx.module.staff.dao.StaffPerformSummaryEditDao;
/**
* StaffPerformSummaryEditService
*
* 员工绩效统计 service接口
*
* @author zxfei
* @date 2025-04-10
*/
public interface StaffPerformSummaryEditService extends ICRUDService<StaffPerformSummaryEditEntity,Long>{
StaffPerformSummaryEditDao getDao();
/**
* 同步数据
* @param year
* @param month
* @param staffId
*/
void syncStaffPerformSummary(int year,int month,Long staffId);
}
\ No newline at end of file
package com.mortals.xhx.module.staff.service.impl;
import com.alibaba.fastjson.JSONArray;
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.framework.util.StringUtils;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.pdu.WeightPdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.common.utils.StaffPerformUtil;
import com.mortals.xhx.module.staff.dao.StaffPerformSummaryEditDao;
import com.mortals.xhx.module.staff.model.*;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryEditService;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import com.mortals.xhx.module.staff.service.StaffService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static com.mortals.xhx.common.key.ParamKey.SYS_PARAM_WEIGHT;
/**
* StaffPerformSummaryEditService
* 员工绩效统计 service实现
*
* @author zxfei
* @date 2025-04-10
*/
@Service("staffPerformSummaryEditService")
@Slf4j
public class StaffPerformSummaryEditServiceImpl extends AbstractCRUDServiceImpl<StaffPerformSummaryEditDao, StaffPerformSummaryEditEntity, Long> implements StaffPerformSummaryEditService {
@Autowired
private StaffService staffService;
@Autowired
private ParamService paramService;
@Autowired
private StaffPerformSummaryService staffPerformSummaryService;
@Override
protected StaffPerformSummaryEditEntity findBefore(StaffPerformSummaryEditEntity params, PageInfo pageInfo, Context context) throws AppException {
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH) + 1;
if(params.getYear()==null){
params.setYear(year);
}
if(params.getMonth()==null){
params.setMonth(month);
}
return params;
}
@Override
public StaffPerformSummaryEditEntity get(Long key, Context context) throws AppException {
StaffPerformSummaryEditEntity entity = this.dao.get(key);
String value = paramService.getValueByKey(SYS_PARAM_WEIGHT);
WeightPdu weightPdu;
if (ObjectUtils.isEmpty(value)){
weightPdu = new WeightPdu();
}else {
weightPdu = JSONObject.parseObject(value,WeightPdu.class);
}
computeSummary(entity,weightPdu);
if(StringUtils.isNotEmpty(entity.getRemarkAdd())){
List<JSONObject> jList = JSONArray.parseArray(entity.getRemarkAdd(),JSONObject.class);
String desc = "";
for (JSONObject jsonObject:jList){
desc+=jsonObject.getString("name")+"("+jsonObject.getString("score")+");";
}
entity.setRemarkAddDesc(desc);
}
return entity;
}
@Override
protected void findAfter(StaffPerformSummaryEditEntity params, PageInfo pageInfo, Context context, List<StaffPerformSummaryEditEntity> 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(StaffPerformSummaryEditEntity item:list) {
StaffEntity staffEntity = staffService.getCache(item.getStaffId().toString());
if(staffEntity!=null){
item.setWorkNum(staffEntity.getWorkNum());
item.setPhoneNumber(staffEntity.getPhoneNumber());
}
computeSummary(item,weightPdu);
if(StringUtils.isNotEmpty(item.getRemarkAdd())){
List<JSONObject> jList = JSONArray.parseArray(item.getRemarkAdd(),JSONObject.class);
String desc = "";
for (JSONObject jsonObject:jList){
desc+=jsonObject.getString("name")+"("+jsonObject.getString("score")+");";
}
item.setRemarkAddDesc(desc);
}
}
}
}
private void computeSummary(StaffPerformSummaryEditEntity StaffPerformSummaryEditEntity, WeightPdu weightPdu){
BigDecimal reviewScore = weightPdu.reviewWeight().add(StaffPerformSummaryEditEntity.getReviewScore()); //评价
if(reviewScore.compareTo(BigDecimal.ZERO)<0){
reviewScore = BigDecimal.ZERO;
}
StaffPerformSummaryEditEntity.setReviewScore(reviewScore.setScale(2,BigDecimal.ROUND_DOWN));
BigDecimal attendScore = weightPdu.attendWeight().add(StaffPerformSummaryEditEntity.getAttendScore()); //考勤
if(attendScore.compareTo(BigDecimal.ZERO)<0){
attendScore = BigDecimal.ZERO;
}
StaffPerformSummaryEditEntity.setAttendScore(attendScore.setScale(2,BigDecimal.ROUND_DOWN));
BigDecimal complainScore = StaffPerformSummaryEditEntity.getComplainScore(); //自评不用加100
if(complainScore.compareTo(BigDecimal.ZERO)==0){
complainScore = StaffPerformUtil.SCORE100;
}
complainScore = complainScore.multiply(weightPdu.selfWeight());
StaffPerformSummaryEditEntity.setComplainScore(complainScore.setScale(2,BigDecimal.ROUND_DOWN));
BigDecimal goworkScore = weightPdu.goworkWeight().add(StaffPerformSummaryEditEntity.getGoworkScore()); //办件
if(goworkScore.compareTo(BigDecimal.ZERO)<0){
goworkScore = BigDecimal.ZERO;
}
StaffPerformSummaryEditEntity.setGoworkScore(goworkScore.setScale(2,BigDecimal.ROUND_DOWN));
BigDecimal effectScore = weightPdu.effectWeight().add(StaffPerformSummaryEditEntity.getEffectScore()); //效能
if(effectScore.compareTo(BigDecimal.ZERO)<0){
effectScore = BigDecimal.ZERO;
}
StaffPerformSummaryEditEntity.setEffectScore(effectScore.setScale(2,BigDecimal.ROUND_DOWN));
}
@Override
public void syncStaffPerformSummary(int year, int month, Long staffId) {
List<StaffPerformSummaryEntity> list = staffPerformSummaryService.find(new StaffPerformSummaryQuery().year(year).month(month).staffId(staffId));
List<StaffPerformSummaryEditEntity> editList = this.find(new StaffPerformSummaryEditQuery().year(year).month(month).staffId(staffId));
//Map<String,StaffPerformSummaryEntity> map = list.stream().collect(Collectors.toMap(item->item.getYear()+"_"+item.getMonth()+"_"+item.getStaffId(),Function.identity()));
Map<String,StaffPerformSummaryEditEntity> editMap = editList.stream().collect(Collectors.toMap(item->item.getYear()+"_"+item.getMonth()+"_"+item.getStaffId(),Function.identity()));
List<StaffPerformSummaryEditEntity> addList = new ArrayList<>();
List<StaffPerformSummaryEditEntity> updateList = new ArrayList<>();
for(StaffPerformSummaryEntity item:list){
String key = item.getYear()+"_"+item.getMonth()+"_"+item.getStaffId();
if(editMap.containsKey(key)){
StaffPerformSummaryEditEntity editEntity = editMap.get(key);
item.setId(editEntity.getId());
item.setAuditLevel(editEntity.getAuditLevel());
item.setRecommend(editEntity.getRecommend());
item.setRemarkAdd(editEntity.getRemarkAdd());
item.setRemark(editEntity.getRemark());
item.setAddTotalScore(editEntity.getAddTotalScore());
if(editEntity.getDataType()==1){
BeanUtils.copyProperties(item, editEntity, BeanUtil.getNullPropertyNames(item));
if(editEntity.getAddTotalScore()!=null){
editEntity.setSumScore(editEntity.getTotalScore().add(editEntity.getAddTotalScore()));
}
updateList.add(editEntity);
}
}else {
StaffPerformSummaryEditEntity editEntity = new StaffPerformSummaryEditEntity();
BeanUtils.copyProperties(item, editEntity, BeanUtil.getNullPropertyNames(item));
editEntity.setId(null);
editEntity.setDataType(1);
editEntity.setCreateTime(new Date());
addList.add(editEntity);
}
}
if(CollectionUtils.isNotEmpty(updateList)){
this.update(updateList);
}
if(CollectionUtils.isNotEmpty(addList)){
this.save(addList);
}
}
}
\ No newline at end of file
......@@ -1382,3 +1382,50 @@ PRIMARY KEY (`id`)
-- 2025-04-02
-- ----------------------------
ALTER TABLE mortals_xhx_staff ADD COLUMN `dingUserId` varchar(128) COMMENT '钉钉userId';
-- ----------------------------
-- 2025-04-10 宜宾需求
-- ----------------------------
-- ----------------------------
-- 员工绩效统计表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_xhx_staff_perform_summary_edit`;
CREATE TABLE mortals_xhx_staff_perform_summary_edit(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`staffId` bigint(20) DEFAULT '0' COMMENT '人员id',
`workNum` varchar(64) COMMENT '工号',
`staffName` varchar(512) COMMENT '人员名称',
`belongCenter` varchar(512) DEFAULT '宜宾市民中心' COMMENT '所属中心',
`salaId` bigint(20) COMMENT '所属大厅',
`salaName` varchar(128) COMMENT '所属大厅名称',
`deptId` bigint(20) DEFAULT '0' COMMENT '部门id号',
`deptName` varchar(64) COMMENT '部门名称',
`year` int(9) NOT NULL COMMENT '年',
`month` tinyint(2) NOT NULL COMMENT '月',
`attendScore` decimal(10,2) COMMENT '考勤绩效指标分数',
`reviewScore` decimal(10,2) COMMENT '评价绩效指标分数',
`complainScore` decimal(10,2) COMMENT '投诉绩效指标分数',
`goworkScore` decimal(10,2) COMMENT '办件绩效分数',
`effectScore` decimal(10,2) COMMENT '效能绩效分数',
`otherScore` decimal(10,2) COMMENT '其它绩效分数',
`errorScore` decimal(10,2) COMMENT '累计异常分数',
`totalScore` decimal(10,2) COMMENT '当月得分数',
`remark` varchar(255) COMMENT '备注',
`remarkAdd` varchar(255) COMMENT '加分备注',
`addTotalScore` decimal(10,2) COMMENT '加分合计',
`sumScore` decimal(10,2) COMMENT '合计得分',
`auditLevel` varchar(128) COMMENT '政务服务管理科审核等次',
`recommend` varchar(128) COMMENT '服务明星推荐',
`dataType` tinyint(2) DEFAULT '1' COMMENT '数据类型1,系统自动2手动录入',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建人id',
`updateTime` datetime COMMENT '更新时间',
`updateUserId` bigint(20) COMMENT '更新人id',
PRIMARY KEY (`id`)
,KEY `id` (`id`) USING BTREE
,KEY `workNum` (`workNum`) USING BTREE
,KEY `staffName` (`staffName`) USING BTREE
,KEY `belongCenter` (`belongCenter`) USING BTREE
,KEY `year` (`year`) USING BTREE
,KEY `month` (`month`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='员工绩效统计';
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