This commit is contained in:
杜建超 2020-11-04 16:00:58 +08:00
parent dbad69aadc
commit 0920ae649f
10 changed files with 99 additions and 17 deletions

View File

@ -47,4 +47,6 @@ public interface EvaluationGroupMapper extends BaseMapper<EvaluationGroup> {
List<Long> selectIdsByCopyIds(@Param("copyIds")String copyIds);
EvaluationGroup selectEvaluationGroupByCopyId(@Param("copyId")String copyId);
}

View File

@ -52,6 +52,10 @@ public class EvaluationGroup implements java.io.Serializable {
@ApiModelProperty(value = "本记录被拷贝的id每次发起绩效备份一份copy_id表示被复制的那份id。发起后所有相关逻辑表使用的是拷贝后新生成的ID。绩效考核流程中如果原考评组有人员变动该拷贝也将变动", name = "copyId")
private Long copyId;
//发起任务id
@ApiModelProperty(value = "发起任务id", name = "startId")
private Long startId;
@TableField(exist = false)
@ApiModelProperty(value = "参与考核人数", name = "counts")
private int counts;
@ -200,6 +204,23 @@ public class EvaluationGroup implements java.io.Serializable {
this.outIds = outIds;
}
/**
* 发起任务id
* @return
*/
public Long getStartId() {
return startId;
}
/**
* 发起任务id
* @param startId
*/
public void setStartId(Long startId) {
this.startId = startId;
}
@Override
public String toString() {
return "EvaluationGroup{" +
@ -213,6 +234,7 @@ public class EvaluationGroup implements java.io.Serializable {
",staffIds=" + staffIds +
",outIds=" + outIds +
",copyId=" + copyId +
",startId=" + startId +
"}";
}
}

View File

@ -135,7 +135,8 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
group.setCounts(ids.size());
//是否通知评分
if(req.getStartId()!=null){
int i = evaluationStartStaffMapper.existByStartIdAndEvaluationId(req.getStartId(),group.getId());
EvaluationGroup scoreGroup = evaluationGroupMapper.selectEvaluationGroupByCopyId(String.valueOf(group.getId()));
int i = evaluationStartStaffMapper.existByStartIdAndEvaluationId(req.getStartId(),scoreGroup.getId());
if(i>0){
group.setScore(1);
}

View File

@ -0,0 +1,16 @@
package com.lz.modules.performance.dto;
import lombok.Data;
/**
* @Author: djc
* @Desc:
* @Date: 2020/11/4 11:38
*/
@Data
public class ToScoreDingTalkDto {
private Long id;
private Long staffId;
}

View File

@ -3,6 +3,7 @@ package com.lz.modules.performance.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Maps;
import com.lz.common.emun.WorkMsgTypeEnum;
import com.lz.common.exception.RRException;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
@ -10,6 +11,7 @@ import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dto.ApprovalDto;
import com.lz.modules.app.dto.StaffSimpleDto;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.dao.EvaluationGroupMapper;
import com.lz.modules.flow.dao.EvaluationStartStaffMapper;
@ -24,6 +26,8 @@ import com.lz.modules.flow.service.EvaluationGroupService;
import com.lz.modules.flow.service.EvaluationStartStaffService;
import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.flow.service.FlowStartService;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.dto.ToScoreDingTalkDto;
import com.lz.modules.performance.req.AssessChangeReq;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.req.AssessListReq;
@ -83,6 +87,8 @@ public class AssessManagerServiceImpl implements AssessManagerService {
private EvaluationGroupMapper evaluationGroupMapper;
@Autowired
private FlowRecordMapper flowRecordMapper;
@Autowired
private DingtalkBusiness dingtalkBusiness;
public static final Long processId = 1L;
@ -250,30 +256,45 @@ public class AssessManagerServiceImpl implements AssessManagerService {
@Override
public void toScore(AssessToScoreReq req) {
String[] split = req.getEvaluationIds().split(",");
List<StaffSimpleInfo> toStaffids = new ArrayList<>();
for(String s:split){
Long evaluation = Long.valueOf(s);
//更新评分
int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), evaluation);
EvaluationGroup group = evaluationGroupMapper.selectEvaluationGroupByCopyId(s);
if(group==null){
log.info("未找到主组信息copyId: " + s);
continue;
}
Long evaluation = group.getId();
int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), group.getId());
log.info("更新evaluationStartStaff 数据 为已评分 " + i);
List<Long> recordIds = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
if(CollectionUtils.isEmpty(recordIds)){
List<ToScoreDingTalkDto> dtos = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
if(CollectionUtils.isEmpty(dtos)){
log.info("该考评组无数据 evaluationId:" + evaluation);
continue;
}
log.info("本次评分更新操作 num: " + recordIds.size());
recordIds.forEach(aLong -> {
log.info("本次评分更新操作 num: " + dtos.size());
dtos.forEach(dto -> {
Long recordId = dto.getId();
//更新流程绩效
ApprovalDto approvalDto = new ApprovalDto();
approvalDto.setStatus(1);
approvalDto.setResultRecordId(aLong);
approvalDto.setResultRecordId(recordId);
approvalDto.setMenuName("开始评分");
try {
R r = resultRecordService.newApproval(approvalDto);
log.info("绩效id aLong :" + aLong + " ,res" + JSON.toJSONString(r));
log.info("绩效id aLong :" + recordId + " ,res" + JSON.toJSONString(r));
} catch (Exception e) {
log.error("执行中状态跳过失败 recorId:" + aLong,e);
log.error("执行中状态跳过失败 recorId:" + recordId,e);
}
//钉钉通知评分构建
StaffSimpleInfo staffSimpleInfo = new StaffSimpleInfo();
staffSimpleInfo.setId(dto.getStaffId());
staffSimpleInfo.setRecordId(recordId);
staffSimpleInfo.setStartId(req.getStartId());
toStaffids.add(staffSimpleInfo);
});
//更新flowRecord记录
List<Object> objects = resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
@ -287,6 +308,13 @@ public class AssessManagerServiceImpl implements AssessManagerService {
log.info("更新flowRecord记录,i:" + updateExecution);
}
//通知评分
try {
dingtalkBusiness.sendWorkMSGWithThread(toStaffids, WorkMsgTypeEnum.START_SCORE.getType());
} catch (Exception e) {
log.error("通知评分异常:",e);
}
}

View File

@ -16,6 +16,7 @@ import com.lz.modules.app.req.ReportListReq;
import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.resp.OwnResultResp;
import com.lz.modules.flow.model.ResultRecordDto;
import com.lz.modules.performance.dto.ToScoreDingTalkDto;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.res.AssessManagerDetailRes;
import com.lz.modules.performance.res.ChartStatistical;
@ -24,6 +25,7 @@ import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@Mapper
public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
@ -91,5 +93,5 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
int batchDeleteByStartIdAndStaffId(@Param("startId")Long startId,@Param("staffIds") List<String> staffIds);
List<Long> selectToScoreList(@Param("startId")Long startId,@Param("evaluationId")Long evaluationId);
List<ToScoreDingTalkDto> selectToScoreList(@Param("startId")Long startId, @Param("evaluationId")Long evaluationId);
}

View File

@ -515,8 +515,8 @@
)
</update>
<select id="selectToScoreList" resultType="long">
select id from lz_result_record where is_delete = 0
<select id="selectToScoreList" resultType="com.lz.modules.performance.dto.ToScoreDingTalkDto">
select id,staff_id from lz_result_record where is_delete = 0
and start_id = #{startId}
and flow_process = 2
and evaluation_id = #{evaluationId}

View File

@ -14,12 +14,13 @@
<result column="staff_ids" property="staffIds"/>
<result column="out_ids" property="outIds"/>
<result column="copy_id" property="copyId"/>
<result column="start_id" property="startId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, manager_ids AS managerIds, dep_ids AS depIds, staff_ids AS staffIds, out_ids AS outIds, copy_id AS copyId
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name, manager_ids AS managerIds, dep_ids AS depIds, staff_ids AS staffIds, out_ids AS outIds, copy_id AS copyId, start_id AS startId
</sql>
@ -38,6 +39,7 @@
<if test="staffIds != null">staff_ids, </if>
<if test="outIds != null">out_ids, </if>
<if test="copyId != null">copy_id, </if>
<if test="startId != null">start_id, </if>
is_delete,
gmt_create,
gmt_modified
@ -48,6 +50,7 @@
<if test="staffIds != null">#{ staffIds}, </if>
<if test="outIds != null">#{ outIds}, </if>
<if test="copyId != null">#{ copyId}, </if>
<if test="startId != null">#{ startId}, </if>
0,
now(),
now()
@ -66,7 +69,8 @@
<if test="depIds != null">dep_ids = #{depIds},</if>
<if test="staffIds != null">staff_ids = #{staffIds},</if>
<if test="outIds != null">out_ids = #{outIds},</if>
<if test="copyId != null">copy_id = #{copyId}</if>
<if test="copyId != null">copy_id = #{copyId},</if>
<if test="startId != null">start_id = #{startId}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -84,7 +88,8 @@
dep_ids = #{depIds},
staff_ids = #{staffIds},
out_ids = #{outIds},
copy_id = #{copyId}
copy_id = #{copyId},
start_id = #{startId}
,gmt_modified = now()
where id = #{id}
</update>
@ -151,5 +156,9 @@
</foreach>
)
</select>
<select id="selectEvaluationGroupByCopyId" resultType="EvaluationGroup" >
select * from lz_evaluation_group where is_delete = 0 and copy_id = #{copyId}
</select>
</mapper>

View File

@ -178,6 +178,7 @@
where f.is_delete=0 and r.is_delete=0
and approval_staff_id = #{approvalStaffId}
and f.status = 1
and f.flow_process != 2
order by r.gmt_modified desc
</select>
@ -188,6 +189,7 @@
where f.is_delete=0 and r.is_delete=0
and approval_staff_id = #{approvalStaffId}
and f.status = 2
and f.flow_process != 2
order by r.gmt_modified desc
</select>

View File

@ -126,7 +126,7 @@ public class MysqlMain {
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_flow_record"));
list.add(new TablesBean("lz_evaluation_group"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();