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

窗口人员自评汇总

parent ea34674e
......@@ -2,6 +2,9 @@ package com.mortals.xhx.module.check.dao;
import com.mortals.framework.dao.ICRUDDao;
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;
/**
* 窗口人员考核汇总核查Dao
......@@ -13,5 +16,10 @@ import java.util.List;
public interface CheckWindowWorkmanPerformDao extends ICRUDDao<CheckWindowWorkmanPerformEntity,Long>{
/**
* 汇总已审核的核查记录
* @param query
* @return
*/
List<StaffCheckSummaryVo> summaryCheck(StaffCheckSummaryQuery query);
}
package com.mortals.xhx.module.check.dao.ibatis;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.check.dao.CheckWindowWorkmanPerformDao;
import com.mortals.xhx.module.check.model.CheckWindowWorkmanPerformEntity;
......@@ -17,5 +19,8 @@ import java.util.List;
public class CheckWindowWorkmanPerformDaoImpl extends BaseCRUDDaoMybatis<CheckWindowWorkmanPerformEntity,Long> implements CheckWindowWorkmanPerformDao {
@Override
public List<StaffCheckSummaryVo> summaryCheck(StaffCheckSummaryQuery query) {
return this.getSqlSession().selectList(this.getSqlId("getSummaryCheckList"), query);
}
}
......@@ -15,4 +15,9 @@ public class StaffCheckSummaryQuery {
private String checkTimeStart;
/** 结束 核查时间 */
private String checkTimeEnd;
/** 年 */
private Integer year;
/** 月 */
private Integer month;
private Long recordId;
}
......@@ -111,7 +111,7 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt
query.setStaffId(entity.getStaffId());
query.setCheckTimeStart(DateUtils.getStrDate(entity.getCheckTime()));
query.setCheckTimeEnd(query.getCheckTimeStart());
summaryCheck(query);
//summaryCheck(query);
} catch (Exception e) {
log.error("汇总已审核的核查记录出错", e);
}
......@@ -183,7 +183,7 @@ public class CheckOtherRecordServiceImpl extends AbstractCRUDServiceImpl<CheckOt
sendCheckDingTalk(temp);
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setStaffId(temp.getStaffId());
summaryCheck(query);
//summaryCheck(query);
} catch (Exception e) {
log.error("汇总已审核的核查记录出错", e);
......
package com.mortals.xhx.module.check.service.impl;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.common.code.CheckStatusEnum;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.check.model.CheckWindowPerformEntity;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery;
import com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo;
import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptPerformStatEntity;
import com.mortals.xhx.module.dept.model.DeptPerformStatQuery;
import com.mortals.xhx.module.staff.model.StaffPerformStatEntity;
import com.mortals.xhx.module.staff.model.StaffPerformStatQuery;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryEntity;
import com.mortals.xhx.module.staff.model.StaffPerformSummaryQuery;
import com.mortals.xhx.module.staff.service.StaffPerformSummaryService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
......@@ -11,7 +26,11 @@ import com.mortals.xhx.module.check.model.CheckWindowWorkmanPerformEntity;
import com.mortals.xhx.module.check.service.CheckWindowWorkmanPerformService;
import lombok.extern.slf4j.Slf4j;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* CheckWindowWorkmanPerformService
......@@ -24,6 +43,9 @@ import java.util.Date;
@Slf4j
public class CheckWindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImpl<CheckWindowWorkmanPerformDao, CheckWindowWorkmanPerformEntity, Long> implements CheckWindowWorkmanPerformService {
@Autowired
private StaffPerformSummaryService staffPerformSummaryService;
@Override
public void examine(CheckWindowWorkmanPerformEntity entity, Context context) throws AppException {
if (entity.getId() == null) {
......@@ -43,5 +65,75 @@ public class CheckWindowWorkmanPerformServiceImpl extends AbstractCRUDServiceImp
entity.setUpdateTime(new Date());
entity.setCheckStatus(CheckStatusEnum.已处理.getValue()); //处理状态(1.未处理,2.已处理)
dao.update(entity);
StaffCheckSummaryQuery query = new StaffCheckSummaryQuery();
query.setRecordId(temp.getRecordId());
query.setYear(temp.getYear());
query.setMonth(temp.getMonth());
summaryCheck(query);
}
private List<StaffCheckSummaryVo> summaryCheck(StaffCheckSummaryQuery query) throws AppException {
List<StaffCheckSummaryVo> summaryVoList = dao.summaryCheck(query);
if (CollectionUtils.isNotEmpty(summaryVoList)) {
for (StaffCheckSummaryVo vo : summaryVoList) {
StaffPerformSummaryEntity staffPerformSummaryEntity = new StaffPerformSummaryEntity();
staffPerformSummaryEntity.initAttrValue();
BeanUtils.copyProperties(vo, staffPerformSummaryEntity, BeanUtil.getNullPropertyNames(vo));
staffPerformSummaryEntity.setOtherScore(vo.getSumScore());
StaffPerformSummaryQuery summaryQuery = new StaffPerformSummaryQuery();
summaryQuery.setStaffId(vo.getStaffId());
summaryQuery.setYear(vo.getYear());
summaryQuery.setMonth(vo.getMonth());
StaffPerformSummaryEntity temp = staffPerformSummaryService.selectOne(summaryQuery);
if (temp != null) {
if (temp.getReviewScore() != null) {
staffPerformSummaryEntity.setReviewScore(temp.getReviewScore());
}
if (temp.getAttendScore() != null) {
staffPerformSummaryEntity.setAttendScore(temp.getAttendScore());
}
if (temp.getGoworkScore() != null) {
staffPerformSummaryEntity.setGoworkScore(temp.getGoworkScore());
}
if (temp.getEffectScore() != null) {
staffPerformSummaryEntity.setEffectScore(temp.getEffectScore());
}
if (temp.getComplainScore() != null) {
staffPerformSummaryEntity.setComplainScore(temp.getComplainScore());
}
BigDecimal erro = new BigDecimal(0);
erro = erro.add(staffPerformSummaryEntity.getReviewScore());
erro = erro.add(staffPerformSummaryEntity.getAttendScore());
erro = erro.add(staffPerformSummaryEntity.getOtherScore());
erro = erro.add(staffPerformSummaryEntity.getGoworkScore());
erro = erro.add(staffPerformSummaryEntity.getEffectScore());
erro = erro.add(staffPerformSummaryEntity.getComplainScore());
staffPerformSummaryEntity.setErrorScore(erro);
BigDecimal total = new BigDecimal(100);
staffPerformSummaryEntity.setTotalScore(total.add(erro));
staffPerformSummaryEntity.setId(temp.getId());
staffPerformSummaryEntity.setUpdateTime(new Date());
staffPerformSummaryService.update(staffPerformSummaryEntity);
staffPerformSummaryEntity.setId(temp.getId());
staffPerformSummaryEntity.setUpdateTime(new Date());
staffPerformSummaryService.update(staffPerformSummaryEntity);
} else {
staffPerformSummaryEntity.setAttendScore(new BigDecimal(0));
staffPerformSummaryEntity.setReviewScore(new BigDecimal(0));
staffPerformSummaryEntity.setGoworkScore(new BigDecimal(0));
staffPerformSummaryEntity.setEffectScore(new BigDecimal(0));
staffPerformSummaryEntity.setComplainScore(new BigDecimal(0));
staffPerformSummaryEntity.setErrorScore(vo.getSumScore());
BigDecimal total = new BigDecimal(100);
staffPerformSummaryEntity.setTotalScore(total.add(vo.getSumScore()));
staffPerformSummaryEntity.setCreateUserId(1l);
staffPerformSummaryEntity.setCreateTime(new Date());
staffPerformSummaryService.save(staffPerformSummaryEntity);
}
}
}
return summaryVoList;
}
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.module.check.dao.ibatis.CheckWindowWorkmanPerformDaoImpl">
<!-- 汇总已审核的核查记录 -->
<select id="getSummaryCheckList" parameterType="com.mortals.xhx.module.check.model.vo.StaffCheckSummaryQuery" resultType="com.mortals.xhx.module.check.model.vo.StaffCheckSummaryVo">
SELECT
p.`year`,p.`month`,d.staffId,d.staffName,s.deptId,s.deptName,sum(d.sumScore) as sumScore
FROM
mortals_xhx_check_window_workman_perform p,
mortals_xhx_window_workman_perform w,
mortals_xhx_window_workman_perform_detail d,
mortals_xhx_staff s
WHERE
p.recordId = w.id
AND d.performId = w.id
AND s.id = d.staffId
AND checkStatus = 2
AND manageCheckResult = 1
<if test="recordId != null and recordId!=''"> AND p.recordId = #{recordId} </if>
<if test="year != null and year!=''"> AND p.`year` = #{year} </if>
<if test="month != null and month!=''"> AND p.`month` = #{month} </if>
GROUP BY p.`year`,p.`month`,d.staffId,d.staffName,s.deptId,s.deptName
</select>
</mapper>
\ No newline at end of file
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