提交修改

This commit is contained in:
quyixiao 2020-10-30 11:49:46 +08:00
commit 428fb0fe40
29 changed files with 638 additions and 264 deletions

View File

@ -40,6 +40,7 @@ import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -95,6 +96,12 @@ public class ResultRecordController extends AbstractController {
@Autowired
private ResultCalculateService resultCalculateService;
@Autowired
private ResultScoreService resultScoreService;
@Autowired
private FlowChartDetailRecordService flowChartDetailRecordService;
/**
* 列表
*/
@ -348,6 +355,50 @@ public class ResultRecordController extends AbstractController {
//获取计算公式
List<CalculateModel> calculateModels = getCalculate(resultModels.get(0).getCalculateId());
List<ResultScoreDto> scoreDtos = new ArrayList<>();
//查询所有参与评分人以及所占比重
List<FlowChartDetailRecord> flowChartDetailRecords =
flowChartDetailRecordService.selectFlowChartDetailRecordsByFlowProcess(resultRecord.getEvaluationId(), 4);//获取参与评分的人
List<StaffEntity> staffs = new ArrayList<>();
for (FlowChartDetailRecord record:flowChartDetailRecords
) {
if(record.getOptType().intValue() == -1){
//自己
StaffEntity staffEntity = new StaffEntity();
staffEntity.setId(resultRecord.getId());
staffEntity.setName(resultRecord.getStaffName());
staffs.add(staffEntity);
}else if(record.getOptType().intValue() == 0){
//指定人员
//获取人员信息
List<Long> sIds = Arrays.stream(record.getOptIds().split(",")).map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
staffs.addAll(staffService.selectNamesByIds(sIds));//这里不过滤离职人员因为过滤了可能涉及到评分规则的变更
}else{
//领导
DepartManagers departManagers = staffService.findLeader(resultRecord.getStaffId(), record.getOptType());
if(departManagers.getManagers().size() > 0){
staffs.addAll(departManagers.getManagers());
}
}
for (StaffEntity staff:staffs
) {
ResultScoreDto resultScore = new ResultScoreDto();
resultScore.setApprovalId(staff.getId());
resultScore.setApprovalName(staff.getName());
resultScore.setWeight(record.getWeight());
scoreDtos.add(resultScore);
}
}
resultRecordDetailDto.setGradeGroupId(resultModels.get(0).getGradeGroupId());//设置评分等级
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
resultRecordDetailDto.setAvatar(staffEntity.getAvatar());
@ -365,6 +416,42 @@ public class ResultRecordController extends AbstractController {
) {
dto.setCalculate(setCalculateValue(calculateModels, dto)) ;
weight = weight.add(dto.getCheckWeight());
//获取评分详细
List<ResultScore> scores =
resultScoreService.selectResultScoresByDetailIdAndOrderByStaffIds(dto.getId(), scoreDtos);
if(scores.size() > 0){
//
List<ResultScoreDto> scoreDtos1 = new ArrayList<>();
for (ResultScoreDto scoreDto: scoreDtos
) {//
//
boolean isAdd = false;
for (ResultScore score:
scores) {
if(scoreDto.getApprovalId().longValue() == score.getApprovalId().longValue()){
ResultScoreDto scoreDto1 = new ResultScoreDto();
BeanUtils.copyProperties(scoreDto1, score);
scoreDto1.setApprovalId(scoreDto.getApprovalId());
scoreDto1.setApprovalName(scoreDto.getApprovalName());
scoreDto1.setWeight(scoreDto.getWeight());
scoreDtos1.add(scoreDto1);
scores.remove(score);
isAdd = true;
break;
}
}
if(!isAdd){
ResultScoreDto scoreDto1 = new ResultScoreDto();
scoreDto1.setApprovalId(scoreDto.getApprovalId());
scoreDto1.setApprovalName(scoreDto.getApprovalName());
scoreDto1.setWeight(scoreDto.getWeight());
scoreDtos1.add(scoreDto1);
}
}
dto.setScoreDtos(scoreDtos1);
}else{
dto.setScoreDtos(scoreDtos);
}
}
//下面设置计算公式
@ -477,6 +564,11 @@ public class ResultRecordController extends AbstractController {
BeanUtils.copyProperties(dto, resultRecord);
List<ResultDetail> inserts = new ArrayList<>();
List<ResultDetail> updates = new ArrayList<>();
List<ResultScore> insertScores = new ArrayList<>();
List<ResultScore> updateScores = new ArrayList<>();
for (ResultRecortModelDto model:dto.getRecortModelDtos()
) {
int index = 0;
@ -497,13 +589,31 @@ public class ResultRecordController extends AbstractController {
inserts.add(resultDetail);
}
if(resultDetail.getIsDelete() == null || resultDetail.getIsDelete().intValue() == 0){
BigDecimal score = BigDecimal.ZERO;
for (ResultScoreDto scoreDto:detailDto.getScoreDtos()
) {
//计算得分
ResultScore resultScore = new ResultScore();
BeanUtils.copyProperties(scoreDto, resultScore);
if(scoreDto.getAcquireScore() != null){
score = score.add(scoreDto.getAcquireScore().multiply(scoreDto.getWeight()));
}
if(resultScore.getId() == null){
insertScores.add(resultScore);
}else{
updateScores.add(resultScore);
}
}
resultDetail.setAcquireScore(score);
weight = weight.add(resultDetail.getCheckWeight());
}
}
if(weight.compareTo(model.getWeight()) == 1){
return R.error(model.getName() + "的指标之和不能超过" + model.getWeight().multiply(BigDecimal.valueOf(100)) + "%");
}
}
//下面更新指标记录
if(inserts.size() > 0){
resultDetailService.saveBatch(inserts);
}
@ -511,6 +621,14 @@ public class ResultRecordController extends AbstractController {
resultDetailService.updateBatchById(updates);
}
//下面更新评分记录
if(insertScores.size() > 0){
resultScoreService.saveBatch(insertScores);
}
if(updateScores.size() > 0){
resultScoreService.updateBatchById(updateScores);
}
return R.ok();

View File

@ -94,4 +94,8 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
List<StaffEntity> selectOnJobByIds(@Param("mIds") List<Long> mIds);
StaffSimpleInfo selectStaffSimpleInfo(@Param("staffId") Long staffId);
List<StaffEntity> selectNamesByIds(@Param("list") List<Long> sIds);
List<StaffEntity> selectStaffsByGroupId(@Param("copyId") Long copyId);
}

View File

@ -99,5 +99,9 @@ public interface StaffService extends IService<StaffEntity> {
List<StaffEntity> selectOnJobByIds(List<Long> mIds);
StaffSimpleInfo selectStaffSimpleInfo(Long staffId);
List<StaffEntity> selectNamesByIds(List<Long> sIds);
//获取绩效考核管理员
List<StaffEntity> selectStaffsByGroupId(Long copyId);
}

View File

@ -519,5 +519,15 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
return staffDao.selectStaffSimpleInfo(staffId);
}
@Override
public List<StaffEntity> selectNamesByIds(List<Long> sIds){
return staffDao.selectNamesByIds(sIds);
}
@Override
public List<StaffEntity> selectStaffsByGroupId(Long copyId){
return staffDao.selectStaffsByGroupId(copyId);
}
}

View File

@ -41,4 +41,6 @@ public interface FlowChartDetailRecordMapper extends BaseMapper<FlowChartDetailR
int insertFlowChartDetailRecords(@Param("list") List<FlowChartDetailRecord> inserts);
int updateCoverFlowChartDetailRecordByIds(@Param("list") List<FlowChartDetailRecord> updaes);
List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(@Param("groupId") Long groupId, @Param("flowProcess") int flowProcess);
}

View File

@ -9,8 +9,12 @@ package com.lz.modules.flow.dao;
*/
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.flow.entity.ResultScore;
import com.lz.modules.flow.model.ResultScoreDto;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface ResultScoreMapper extends BaseMapper<ResultScore> {
@ -30,4 +34,7 @@ public interface ResultScoreMapper extends BaseMapper<ResultScore> {
int deleteResultScoreById(@Param("id")Long id);
List<ResultScore> selectResultScoresByDetailId(@Param("id") Long id);
List<ResultScore> selectResultScoresByDetailIdAndOrderByStaffIds(@Param("id") Long id, @Param("list") List<ResultScoreDto> scoreDtos);
}

View File

@ -42,4 +42,6 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
List<StaffRole> selectByCondition(@Param("page") IPage page, @Param("params") Map<String, Object> params);
List<StaffRole> selectByGroupId(@Param("id") Long id);
List<StaffRole> selectStaffRolesByStaffId(@Param("list") List<Long> mIds);
}

View File

@ -10,7 +10,7 @@ import java.util.Date;
* <p>
* </p>*发起考核考核组人员对应关系表
* @author quyixiao
* @since 2020-10-23
* @since 2020-10-30
*/
@Data
@ -38,8 +38,8 @@ public class EvaluationStartStaff implements java.io.Serializable {
//人员id
@ApiModelProperty(value = "人员id", name = "staffId")
private Long staffId;
//0考核人员1管理人员
@ApiModelProperty(value = "0考核人员1管理人员", name = "type")
//0考核人员 1考核人员
@ApiModelProperty(value = "0考核人员 1考核人员", name = "type")
private Integer type;
//0: 未通知评分 1 已通知评分
@ApiModelProperty(value = "0: 未通知评分 1 已通知评分", name = "score")
@ -47,6 +47,9 @@ public class EvaluationStartStaff implements java.io.Serializable {
//考核组名称
@ApiModelProperty(value = "考核组名称", name = "evaluationName")
private String evaluationName;
//员工所在的部门id
@ApiModelProperty(value = "员工所在的部门id", name = "departmentId")
private String departmentId;
/**
*
* @return
@ -153,14 +156,14 @@ public class EvaluationStartStaff implements java.io.Serializable {
}
/**
* 0考核人员1管理人员
* 0考核人员 1考核人员
* @return
*/
public Integer getType() {
return type;
}
/**
* 0考核人员1管理人员
* 0考核人员 1考核人员
* @param type
*/
public void setType(Integer type) {
@ -197,6 +200,21 @@ public class EvaluationStartStaff implements java.io.Serializable {
this.evaluationName = evaluationName;
}
/**
* 员工所在的部门id
* @return
*/
public String getDepartmentId() {
return departmentId;
}
/**
* 员工所在的部门id
* @param departmentId
*/
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
@Override
public String toString() {
return "EvaluationStartStaff{" +
@ -210,6 +228,7 @@ public class EvaluationStartStaff implements java.io.Serializable {
",type=" + type +
",score=" + score +
",evaluationName=" + evaluationName +
",departmentId=" + departmentId +
"}";
}
}

View File

@ -27,6 +27,8 @@ public class EvaluationStartStaffDto {
//0考核人员1管理人员
@ApiModelProperty(value = "0考核人员1管理人员", name = "type")
private Integer type;
@ApiModelProperty(value = "员工所在的部门id", name = "departmentId")
private String departmentId;
/**
*
* @return

View File

@ -0,0 +1,12 @@
package com.lz.modules.flow.model;
import com.lz.modules.flow.entity.EvaluationGroup;
import lombok.Data;
import java.util.List;
//人员ids
@Data
public class GroupStaffs {
private EvaluationGroup evaluationGroup;
private List<Long> staffIds;
}

View File

@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
* <p>
@ -52,6 +53,9 @@ public class ResultDetailDto {
//优先级从大到小
@ApiModelProperty(value = "优先级,从小到大", name = "priority")
private Integer priority;
@ApiModelProperty(value = "评分详细", name = "scoreDtos")
private List<ResultScoreDto> scoreDtos;
/**
*
* @return

View File

@ -27,6 +27,14 @@ public class ResultScoreDto {
//审批人id
@ApiModelProperty(value = "审批人id", name = "approvalId")
private Long approvalId;
//审批人id
@ApiModelProperty(value = "审批人姓名", name = "approvalName")
private String approvalName;
//审批人id
@ApiModelProperty(value = "所占权重", name = "weight")
private BigDecimal weight;
/**
*
* @return

View File

@ -0,0 +1,11 @@
package com.lz.modules.flow.model;
import lombok.Data;
import java.util.List;
//发起组集合对象
@Data
public class StartGroups {
private Long startId;
private List<GroupStaffs> groups;
}

View File

@ -50,6 +50,8 @@ public class EvaluationStartStaffReq implements java.io.Serializable {
//0考核人员1管理人员
@ApiModelProperty(value = "0考核人员1管理人员", name = "type")
private Integer type;
@ApiModelProperty(value = "员工所在的部门id", name = "departmentId")
private String departmentId;
/**
*
* @return

View File

@ -40,4 +40,6 @@ public interface FlowChartDetailRecordService extends IService<FlowChartDetailRe
int insertFlowChartDetailRecords(List<FlowChartDetailRecord> inserts);
int updateCoverFlowChartDetailRecordByIds(List<FlowChartDetailRecord> updaes);
List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(Long groupId, int flowProcess);
}

View File

@ -3,6 +3,7 @@ package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.R;
import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.flow.model.StartGroups;
import java.util.List;
@ -35,6 +36,8 @@ public interface FlowStartService extends IService<FlowStart> {
FlowStart selectFlowStartByName(String name);
R startStaffs(StartGroups startGroupStaffIds);
R saveStart(FlowStart flowStart);
R getModelById(Long id, int type);

View File

@ -2,6 +2,9 @@ package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.flow.entity.ResultScore;
import com.lz.modules.flow.model.ResultScoreDto;
import java.util.List;
/**
* <p>
@ -30,4 +33,7 @@ public interface ResultScoreService extends IService<ResultScore> {
int deleteResultScoreById(Long id);
List<ResultScore> selectResultScoresByDetailId(Long id);
List<ResultScore> selectResultScoresByDetailIdAndOrderByStaffIds(Long id, List<ResultScoreDto> scoreDtos);
}

View File

@ -49,4 +49,6 @@ public interface StaffRoleService extends IService<StaffRole> {
List<SysMenuEntity> selectMenuList();
List<StaffRole> selectByGroupId(Long id);
List<StaffRole> selectStaffRolesByStaffId(List<Long> mIds);
}

View File

@ -81,6 +81,11 @@ public class FlowChartDetailRecordServiceImpl extends ServiceImpl<FlowChartDetai
return flowChartDetailRecordMapper.updateCoverFlowChartDetailRecordByIds(updaes);
}
@Override
public List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(Long groupId, int flowProcess){
return flowChartDetailRecordMapper.selectFlowChartDetailRecordsByFlowProcess(groupId, flowProcess);
}

View File

@ -10,9 +10,7 @@ import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.dao.FlowStartMapper;
import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.model.DepartManagers;
import com.lz.modules.flow.model.ResultModelDto;
import com.lz.modules.flow.model.ResultTagetLibDto;
import com.lz.modules.flow.model.*;
import com.lz.modules.flow.service.*;
import com.lz.modules.performance.service.ResultTagetLibService;
import com.lz.modules.sys.entity.app.ResultDetail;
@ -123,6 +121,38 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return flowStartMapper.selectFlowStartByName(name);
}
//发起指定用户的绩效中途添加的时候
public R startStaffs(StartGroups startGroupStaffIds){
FlowStart flowStart = flowStartMapper.selectFlowStartById(startGroupStaffIds.getStartId());
if(flowStart == null){
return R.error("发起任务不存在");
}
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系减少数据库查找
for (GroupStaffs groupStaffs:startGroupStaffIds.getGroups()
) {
List<StaffSimpleInfo> staffSimpleInfos = staffService.selectStaffSimpleInfos(groupStaffs.getStaffIds());
if(staffSimpleInfos.size() == 0){
R.error(groupStaffs.getEvaluationGroup().getName() + "——无有效考核人员");
}
switch (start(groupStaffs.getEvaluationGroup(), flowStart, staffManages, staffSimpleInfos)){
case 1:
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置考核模板");
case 2:
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有绩效流程节点");
case 3:
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置考核流程");
case 4:
return R.error(groupStaffs.getEvaluationGroup().getName() + "——没有设置绩效管理人员");
case 5:
return R.error(groupStaffs.getEvaluationGroup().getName() + "——初始化考核流程失败");
}
}
return R.ok("发起成功").put("data", flowStart);
}
@Override
public R saveStart(FlowStart flowStart){
//下面生成或者合并发起绩效
@ -151,7 +181,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
}
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系减少数据库查找
//下面开始初始化流程
List<Long> ids = Arrays.stream(flowStart.getGroupIds().split(",")).map(new Function<String, Long>() {
@ -173,152 +202,177 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
return R.error(evaluationGroup.getName() + "——无有效考核人员");
}
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
if(resultModelDtos.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
}
switch (start(evaluationGroup, flowStart, staffManages, staffIds)){
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
if(flowCharts.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return R.error(evaluationGroup.getName() + "——没有绩效流程节点");
}
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
for (FlowChart chart:flowCharts
) {//按照节点顺序获取正确的流程
List<FlowChartDetailRecord> flowChartDetailRecords1
= flowChartDetailRecordService.selectFlowChartDetailRecordByGroupIdAndChartId(evaluationGroup.getId(), chart.getId());
flowChartDetailRecords.addAll(flowChartDetailRecords1);
case 1:
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
case 2:
return R.error(evaluationGroup.getName() + "——没有绩效流程节点");
case 3:
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
case 4:
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
case 5:
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
}
}
return R.ok("发起成功").put("data", flowStart);
}
if(flowChartDetailRecords.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
}
Map<Long, String> chartNameMaps =
flowCharts.stream().collect(Collectors.toMap(FlowChart::getId, FlowChart::getName));//流程节点与流程名称对应map下面多次循环减少数据库查找
private int start(EvaluationGroup evaluationGroup, FlowStart flowStart,
Map<String, List<StaffEntity>> staffManages, List<StaffSimpleInfo> staffIds){
List<StaffEntity> staffManagers = null;
if(!StringUtil.isEmpty(evaluationGroup.getManagerIds())){
List<Long> mIds = Arrays.stream(evaluationGroup.getManagerIds().split(","))
.map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
//查找在职的管理人员
staffManagers = staffService.selectOnJobByIds(mIds);
}
if(staffManagers == null || staffManagers.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
}
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
if(resultModelDtos.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return 1;
}
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
if(flowCharts.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return 2;
}
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
for (FlowChart chart:flowCharts
) {//按照节点顺序获取正确的流程
List<FlowChartDetailRecord> flowChartDetailRecords1
= flowChartDetailRecordService.selectFlowChartDetailRecordByGroupIdAndChartId(evaluationGroup.getId(), chart.getId());
flowChartDetailRecords.addAll(flowChartDetailRecords1);
}
if(flowChartDetailRecords.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return 3;
}
Map<Long, String> chartNameMaps =
flowCharts.stream().collect(Collectors.toMap(FlowChart::getId, FlowChart::getName));//流程节点与流程名称对应map下面多次循环减少数据库查找
//获取绩效考核管理员
List<StaffEntity> staffManagers = staffService.selectStaffsByGroupId(evaluationGroup.getCopyId());
/*if(!StringUtil.isEmpty(evaluationGroup.getManagerIds())){
List<Long> mIds = Arrays.stream(evaluationGroup.getManagerIds().split(","))
.map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
//查找在职的管理人员
staffManagers = staffService.selectOnJobByIds(mIds);
}*/
if(staffManagers == null || staffManagers.size() == 0){
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return 4;
}
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
if(evaluationGroup.getCopyId() == null){
evaluationGroup.setCopyId(evaluationGroup.getId());
evaluationGroup.setId(null);
evaluationGroup.setGmtCreate(null);
evaluationGroup.setGmtModified(null);
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
}
//拷贝考评组的指标信息
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
for (ResultModelDto dto:resultModelDtos
//拷贝考评组的指标信息
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
for (ResultModelDto dto:resultModelDtos
) {
dto.setEvaluationGroupId(evaluationGroup.getId());//设置拷贝组的id
//下面拷贝一份考评组信息的维度信息
ResultModel resultModel = new ResultModel();
BeanUtils.copyProperties(dto, resultModel);
resultModel.setId(null);
resultModelService.insertResultModel(resultModel);
List<ResultTagetLibDto> libDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(dto.getId());
dto.setTagetLibs(libDtos);
for (ResultTagetLibDto libDto: libDtos
) {
//下面拷贝考评组里面的指标信息
ResultTagetLib resultTagetLib = new ResultTagetLib();
BeanUtils.copyProperties(libDto, resultTagetLib);
resultTagetLib.setModelId(resultModel.getId());//设置新的维度id
resultTagetLib.setId(null);
resultTagetLibs.add(resultTagetLib);
}
}
if(resultTagetLibs.size() > 0){
//插入备份的考评组指标信息
resultTagetLibService.insertResultTagetLibs(resultTagetLibs);
}
dto.setEvaluationGroupId(evaluationGroup.getId());//设置拷贝组的id
//下面拷贝一份考评组信息的维度信息
ResultModel resultModel = new ResultModel();
BeanUtils.copyProperties(dto, resultModel);
resultModel.setId(null);
resultModelService.insertResultModel(resultModel);
List<ResultTagetLibDto> libDtos = resultTagetLibService.selectResultTagetLibDtoByModelId(dto.getId());
dto.setTagetLibs(libDtos);
for (ResultTagetLibDto libDto: libDtos
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
int stepIndex = 0;
for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords
) {
Flow flow = new Flow();
flow.setFlowId(evaluationGroup.getId());
flow.setOpt("+");
flow.setStartId(flowStart.getId());
flow.setChartId(flowChartDetailRecord.getChartId());
flow.setOptDesc(chartNameMaps.get(flowChartDetailRecord.getChartId()));
flowService.insertFlow(flow);
FlowApprovalRole flowApprovalRole = null;
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
for (String id:optIds
) {
//下面拷贝考评组里面的指标信息
ResultTagetLib resultTagetLib = new ResultTagetLib();
BeanUtils.copyProperties(libDto, resultTagetLib);
resultTagetLib.setModelId(resultModel.getId());//设置新的维度id
resultTagetLib.setId(null);
resultTagetLibs.add(resultTagetLib);
}
}
if(resultTagetLibs.size() > 0){
//插入备份的考评组指标信息
resultTagetLibService.insertResultTagetLibs(resultTagetLibs);
}
//下面初始化lz_flow流程表 lz_flow_approval_role流程审批表
List<FlowApprovalRole> flowApprovalRoles = new ArrayList<>();
int stepIndex = 0;
for (FlowChartDetailRecord flowChartDetailRecord:flowChartDetailRecords
) {
Flow flow = new Flow();
flow.setFlowId(evaluationGroup.getId());
flow.setOpt("+");
flow.setStartId(flowStart.getId());
flow.setChartId(flowChartDetailRecord.getChartId());
flow.setOptDesc(chartNameMaps.get(flowChartDetailRecord.getChartId()));
flowService.insertFlow(flow);
FlowApprovalRole flowApprovalRole = null;
if(flowChartDetailRecord.getOptType().intValue() == ChartOptType.APPOINT.getCode()){//指定人员的
String[] optIds = flowChartDetailRecord.getOptIds().split(",");
for (String id:optIds
) {
flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setApprovalId(Long.parseLong(id));
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
if(flowChartDetailRecord.getStepType().intValue() == 0){
//依次
stepIndex++;
}
}
//stepIndex++;
if(flowApprovalRole != null){
stepIndex = flowApprovalRole.getStepIndex() + 1;
}
}else{
flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setApprovalId(Long.parseLong(id));
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
stepIndex++;
if(flowChartDetailRecord.getStepType().intValue() == 0){
//依次
stepIndex++;
}
}
//stepIndex++;
if(flowApprovalRole != null){
stepIndex = flowApprovalRole.getStepIndex() + 1;
}
}else{
flowApprovalRole = new FlowApprovalRole();
flowApprovalRole.setFlowId(flow.getId());
flowApprovalRole.setStepType(flowChartDetailRecord.getStepType());
flowApprovalRole.setRoleId(flowChartDetailRecord.getRoleIds());
flowApprovalRole.setType(flowChartDetailRecord.getOptType());
flowApprovalRoles.add(flowApprovalRole);
flowApprovalRole.setStepIndex(stepIndex);
stepIndex++;
}
//插入记录/flowChart/saveDetailProcs
if(flowApprovalRoles.size() > 0){
flowApprovalRoleService.insertFlowApprovalRoles(flowApprovalRoles);
//初始化lz_result_details数据
List<ResultDetail> resultDetails = new ArrayList<>();
}
//插入记录/flowChart/saveDetailProcs
if(flowApprovalRoles.size() > 0){
flowApprovalRoleService.insertFlowApprovalRoles(flowApprovalRoles);
//初始化lz_result_details数据
List<ResultDetail> resultDetails = new ArrayList<>();
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
//下面初始化管理人员对应关系
/*//下面初始化管理人员对应关系
for (StaffEntity entity:staffManagers
) {
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
@ -329,158 +383,157 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
evaluationStartStaffs.add(evaluationStartStaff);
}
}*/
//下面初始化参与人员
for (StaffSimpleInfo staffInfo:staffIds
) {
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
evaluationStartStaff.setStaffId(staffInfo.getId());
evaluationStartStaff.setStartId(flowStart.getId());
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
evaluationStartStaffs.add(evaluationStartStaff);
//下面初始化参与人员
for (StaffSimpleInfo staffInfo:staffIds
) {
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
evaluationStartStaff.setStaffId(staffInfo.getId());
evaluationStartStaff.setStartId(flowStart.getId());
evaluationStartStaff.setDepartmentId(staffInfo.getDepartmentId());
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
evaluationStartStaffs.add(evaluationStartStaff);
//初始化lz_result_records数据
ResultRecord resultRecord = new ResultRecord();
resultRecord.setDepartmentId(staffInfo.getDepartmentId());
resultRecord.setDepartmentName(staffInfo.getDepartmentName());
resultRecord.setStaffId(staffInfo.getId());
resultRecord.setStaffName(staffInfo.getName());
resultRecord.setType(1);//设置为提交目标
resultRecord.setStatus(0);//设置为新建
resultRecord.setStartId(flowStart.getId());
resultRecord.setEvaluationId(evaluationGroup.getId());
resultRecord.setFlowProcess(0);//设置为目标制定
//初始化lz_result_records数据
ResultRecord resultRecord = new ResultRecord();
resultRecord.setDepartmentId(staffInfo.getDepartmentId());
resultRecord.setDepartmentName(staffInfo.getDepartmentName());
resultRecord.setStaffId(staffInfo.getId());
resultRecord.setStaffName(staffInfo.getName());
resultRecord.setType(1);//设置为提交目标
resultRecord.setStatus(0);//设置为新建
resultRecord.setStartId(flowStart.getId());
resultRecord.setEvaluationId(evaluationGroup.getId());
resultRecord.setFlowProcess(0);//设置为目标制定
//下面初始化flow_staff_id_role字段步骤为0的
String roleJSON = "[";
for (int i = 0; i < flowApprovalRoles.size() ;i++){
FlowApprovalRole approvalRole = flowApprovalRoles.get(i);
if(approvalRole.getStepIndex().intValue() == 0){//找到所有步骤为0的人员
Long staffId = approvalRole.getApprovalId();//默认为指定人员
if(approvalRole.getType().intValue() == ChartOptType.SELF.getCode()){
//制定人员为自己的
staffId = staffInfo.getId();
if(i == 0){//目前只设置一个多个不明确是否支持roleJSON是支持多个的
//设置当前审批员工id current_approval_staff_id
resultRecord.setCurrentApprovalStaffId(staffInfo.getId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName(staffInfo.getName());
//下面初始化flow_staff_id_role字段步骤为0的
String roleJSON = "[";
for (int i = 0; i < flowApprovalRoles.size() ;i++){
FlowApprovalRole approvalRole = flowApprovalRoles.get(i);
if(approvalRole.getStepIndex().intValue() == 0){//找到所有步骤为0的人员
Long staffId = approvalRole.getApprovalId();//默认为指定人员
if(approvalRole.getType().intValue() == ChartOptType.SELF.getCode()){
//制定人员为自己的
staffId = staffInfo.getId();
if(i == 0){//目前只设置一个多个不明确是否支持roleJSON是支持多个的
//设置当前审批员工id current_approval_staff_id
resultRecord.setCurrentApprovalStaffId(staffInfo.getId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName(staffInfo.getName());
}
} else if(approvalRole.getType().intValue() > 0){//当设置为几级领导时
///查找领导如果不存在那么设置管理人员
List<StaffEntity> staffLeader;
String key = staffInfo.getDepartmentId() + "_" + approvalRole.getType();
if(staffManages.containsKey(key)){
staffLeader = staffManages.get(staffInfo.getDepartmentId());
}else{
DepartManagers departManagers =
staffService.findLeader(staffInfo.getId(), approvalRole.getType());
staffLeader = departManagers.getManagers();
staffManages.put(key, departManagers.getManagers());
}
if(staffLeader.size() == 0){
//没有领导通知到组设置的绩效管理人员
for (StaffEntity entity:staffManagers
) {
roleJSON += ("{\"roleId\":0,\"staffId\":" + entity.getId() + "},");//这里写死了权限为0的即为找不到领导
}
if(i == 0){//目前只设置一个多个不明确是否支持roleJSON是支持多个的
//设置当前审批员工id current_approval_staff_id
resultRecord.setCurrentApprovalStaffId(staffManagers.get(0).getId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName(staffManagers.get(0).getName());
}
}else{
for(int j = 0; j <staffLeader.size(); j++ ){
StaffEntity staff = staffLeader.get(j);
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
",\"staffId\":" + staff.getId() + "},");
}
if(i == 0){//目前只设置一个多个不明确是否支持roleJSON是支持多个的
//设置当前审批员工id current_approval_staff_id
resultRecord.setCurrentApprovalStaffId(staffLeader.get(0).getId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName(staffLeader.get(0).getName());
}
}
continue;
}
} else if(approvalRole.getType().intValue() > 0){//当设置为几级领导时
///查找领导如果不存在那么设置管理人员
List<StaffEntity> staffLeader;
String key = staffInfo.getDepartmentId() + "_" + approvalRole.getType();
if(staffManages.containsKey(key)){
staffLeader = staffManages.get(staffInfo.getDepartmentId());
}else{
DepartManagers departManagers =
staffService.findLeader(staffInfo.getId(), approvalRole.getType());
staffLeader = departManagers.getManagers();
staffManages.put(key, departManagers.getManagers());
}
if(staffLeader.size() == 0){
//没有领导通知到组设置的绩效管理人员
for (StaffEntity entity:staffManagers
) {
roleJSON += ("{\"roleId\":0,\"staffId\":" + entity.getId() + "},");//这里写死了权限为0的即为找不到领导
}
if(i == 0){//目前只设置一个多个不明确是否支持roleJSON是支持多个的
//设置当前审批员工id current_approval_staff_id
resultRecord.setCurrentApprovalStaffId(approvalRole.getApprovalId());
resultRecord.setCurrentApprovalStaffId(staffManagers.get(0).getId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName("");
resultRecord.setCurrentApprovalStaffName(staffManagers.get(0).getName());
}
}else{
for(int j = 0; j <staffLeader.size(); j++ ){
StaffEntity staff = staffLeader.get(j);
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
",\"staffId\":" + staff.getId() + "},");
}
if(i == 0){//目前只设置一个多个不明确是否支持roleJSON是支持多个的
//设置当前审批员工id current_approval_staff_id
resultRecord.setCurrentApprovalStaffId(staffLeader.get(0).getId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName(staffLeader.get(0).getName());
}
}
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
",\"staffId\":" + staffId + "},");
continue;
}
break;
}
roleJSON += "]";
roleJSON = roleJSON.replace(",]", "]");
resultRecord.setFlowStaffIdRole(roleJSON);
resultRecordService.insertResultRecord(resultRecord);
//下面生成实际的考核流程
resultRecordService.initFlowRecord(resultRecord.getId());
//下面生成ResultDetail对象
for (ResultModelDto modelDto:resultModelDtos
) {
}else{
if(i == 0){//目前只设置一个多个不明确是否支持roleJSON是支持多个的
//设置当前审批员工id current_approval_staff_id
resultRecord.setCurrentApprovalStaffId(approvalRole.getApprovalId());
//设置当前审批员工姓名 current_approval_staff_name
resultRecord.setCurrentApprovalStaffName("");
if(modelDto.getTagetLibs() != null && modelDto.getTagetLibs().size() > 0){//模板里面有添加指标
for (ResultTagetLibDto libDto:
modelDto.getTagetLibs()) {
ResultDetail resultDetail = new ResultDetail();
resultDetail.setRecordId(resultRecord.getId());
resultDetail.setTarget(libDto.getName());
resultDetail.setType(modelDto.getType());
resultDetail.setKeyResult(libDto.getKeyResult());
resultDetail.setCheckWeight(libDto.getWeight());
resultDetail.setStaffId(staffInfo.getId());
resultDetail.setPriority(libDto.getOrderBy());
resultDetails.add(resultDetail);
}
}
roleJSON += ("{\"roleId\":"+ approvalRole.getRoleId() +
",\"staffId\":" + staffId + "},");
continue;
}
break;
}
roleJSON += "]";
roleJSON = roleJSON.replace(",]", "]");
resultRecord.setFlowStaffIdRole(roleJSON);
resultRecordService.insertResultRecord(resultRecord);
//下面生成实际的考核流程
resultRecordService.initFlowRecord(resultRecord.getId());
//下面生成ResultDetail对象
for (ResultModelDto modelDto:resultModelDtos
) {
if(modelDto.getTagetLibs() != null && modelDto.getTagetLibs().size() > 0){//模板里面有添加指标
for (ResultTagetLibDto libDto:
modelDto.getTagetLibs()) {
ResultDetail resultDetail = new ResultDetail();
resultDetail.setRecordId(resultRecord.getId());
resultDetail.setTarget(libDto.getName());
resultDetail.setType(modelDto.getType());
resultDetail.setKeyResult(libDto.getKeyResult());
resultDetail.setCheckWeight(libDto.getWeight());
resultDetail.setStaffId(staffInfo.getId());
resultDetail.setPriority(libDto.getOrderBy());
resultDetails.add(resultDetail);
}
}
}
//如果有数据插入lz_result_detail表
if(resultDetails.size() > 0){
//
resultDetailService.insertResultDetails(resultDetails);
}
//如果有数据插入lz_result_detail表
if(resultDetails.size() > 0){
//
resultDetailService.insertResultDetails(resultDetails);
}
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
//下面通知所有参与考核人员
//如果有下面通知所有管理人员
}else{
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
}
evaluationStartStaffService.insertEvaluationStartStaffs(evaluationStartStaffs);
//下面通知所有参与考核人员
//如果有下面通知所有管理人员
}else{
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
return 5;
}
return R.ok("发起成功").put("data", flowStart);
return 0;
}
@Override

View File

@ -3,10 +3,13 @@ package com.lz.modules.flow.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.modules.flow.dao.ResultScoreMapper;
import com.lz.modules.flow.entity.ResultScore;
import com.lz.modules.flow.model.ResultScoreDto;
import com.lz.modules.flow.service.ResultScoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 业绩详情评分表 服务类
@ -58,6 +61,16 @@ public class ResultScoreServiceImpl extends ServiceImpl<ResultScoreMapper, Resul
return resultScoreMapper.deleteResultScoreById(id);
}
@Override
public List<ResultScore> selectResultScoresByDetailId(Long id){
return resultScoreMapper.selectResultScoresByDetailId(id);
}
@Override
public List<ResultScore> selectResultScoresByDetailIdAndOrderByStaffIds(Long id, List<ResultScoreDto> scoreDtos){
return resultScoreMapper.selectResultScoresByDetailIdAndOrderByStaffIds(id, scoreDtos);
}
}

View File

@ -270,4 +270,9 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
}
}
@Override
public List<StaffRole> selectStaffRolesByStaffId(List<Long> mIds){
return staffRoleMapper.selectStaffRolesByStaffId(mIds);
}
}

View File

@ -11,21 +11,16 @@ import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.EvaluationGroup;
import com.lz.modules.flow.entity.FlowManager;
import com.lz.modules.flow.entity.ResultModel;
import com.lz.modules.flow.entity.StaffRole;
import com.lz.modules.flow.model.EvaluationGroupDto;
import com.lz.modules.flow.req.EvaluationGroupReq;
import com.lz.modules.flow.service.EvaluationGroupService;
import com.lz.modules.flow.service.FlowManagerService;
import com.lz.modules.flow.service.ResultModelService;
import com.lz.modules.flow.service.StaffRoleDepartmentService;
import com.lz.modules.flow.service.*;
import io.swagger.annotations.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -49,6 +44,9 @@ public class EvaluationGroupController {
@Autowired
private StaffRoleDepartmentService staffRoleDepartmentService;
@Autowired
private StaffRoleService staffRoleService;
@ -133,8 +131,8 @@ public class EvaluationGroupController {
@ApiOperation("保存考评组")
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = EvaluationGroup.class)})
public R save(@RequestBody @ApiParam EvaluationGroup evaluationGroup) {
EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName());
if(evaluationGroup.getId() != null && evaluationGroup.getId().intValue() > 0){
EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName());
if(evaluationGroup1 == null || evaluationGroup1.getId().equals(evaluationGroup.getId())){
evaluationGroupService.updateEvaluationGroupById(evaluationGroup);
}else {
@ -142,13 +140,43 @@ public class EvaluationGroupController {
}
}else{
EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName());
if(evaluationGroup1 != null){
return R.error("已经存在相同名称考核组");
}
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
}
//更新组管理员信息
if(evaluationGroup.getManagerIds() != null && evaluationGroup.getManagerIds().length() > 0){
List<Long> mIds = Arrays.stream(evaluationGroup.getManagerIds().split(",")).map(new Function<String, Long>() {
@Override
public Long apply(String s) {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
List<StaffRole> staffRoles = staffRoleService.selectByGroupId(evaluationGroup.getId());
if(staffRoles.size() > 0){
Map<Long, StaffRole> staffRoleMap =
staffRoles.stream().collect(Collectors.toMap(StaffRole::getStaffId, Function.identity(), (e, repace) -> e));
for(int i = 0; i < mIds.size();){
Long l = mIds.get(i);
if(staffRoleMap.containsKey(l)){
mIds.remove(l);
}
}
}
if(mIds.size() > 0){
staffRoles = new ArrayList<>();
for (Long id:mIds
) {
StaffRole staffRole = new StaffRole();
staffRole.setStaffId(id);
staffRole.setEvaluationGroupId(evaluationGroup.getId());
staffRoles.add(staffRole);
}
staffRoleService.saveBatch(staffRoles);
}
}
return R.ok().put("data", evaluationGroup);
}

View File

@ -14,12 +14,13 @@
<result column="type" property="type"/>
<result column="score" property="score"/>
<result column="evaluation_name" property="evaluationName"/>
<result column="department_id" property="departmentId"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, evaluation_id AS evaluationId, start_id AS startId, staff_id AS staffId, type AS type, score AS score, evaluation_name AS evaluationName
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, evaluation_id AS evaluationId, start_id AS startId, staff_id AS staffId, type AS type, score AS score, evaluation_name AS evaluationName, department_id AS departmentId
</sql>
@ -38,6 +39,7 @@
<if test="type != null">type, </if>
<if test="score != null">score, </if>
<if test="evaluationName != null">evaluation_name, </if>
<if test="departmentId != null">department_id, </if>
is_delete,
gmt_create,
gmt_modified
@ -48,6 +50,7 @@
<if test="type != null">#{ type}, </if>
<if test="score != null">#{ score}, </if>
<if test="evaluationName != null">#{ evaluationName}, </if>
<if test="departmentId != null">#{ departmentId}, </if>
0,
now(),
now()
@ -66,7 +69,8 @@
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="type != null">type = #{type},</if>
<if test="score != null">score = #{score},</if>
<if test="evaluationName != null">evaluation_name = #{evaluationName}</if>
<if test="evaluationName != null">evaluation_name = #{evaluationName},</if>
<if test="departmentId != null">department_id = #{departmentId}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -84,7 +88,8 @@
staff_id = #{staffId},
type = #{type},
score = #{score},
evaluation_name = #{evaluationName}
evaluation_name = #{evaluationName},
department_id = #{departmentId}
,gmt_modified = now()
where id = #{id}
</update>
@ -102,6 +107,7 @@
staff_id,
type,
evaluation_name,
department_id,
is_delete
)values
<foreach collection="list" item="item" separator=",">(
@ -110,6 +116,7 @@
#{ item.staffId},
#{ item.type},
#{ item.evaluationName},
#{ item.departmentId},
0
)
</foreach>

View File

@ -109,6 +109,7 @@
update lz_flow_chart_detail_record set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectFlowChartDetailRecordByGroupIdAndChartId" resultType="FlowChartDetailRecord" >
select * from lz_flow_chart_detail_record where evaluation_group_id=#{groupId} and chart_id = #{chartId} and is_delete = 0 order by step_index asc
</select>
@ -169,5 +170,10 @@
</update>
<select id="selectFlowChartDetailRecordsByFlowProcess" resultType="FlowChartDetailRecord" >
select * from lz_flow_chart_detail_record where evaluation_group_id=(select copy_id from lz_evaluation_group where id = #{groupId})
and chart_id = (select id from lz_flow_chart where flow_process = #{flowProcess}) and is_delete = 0 order by step_index asc
</select>
</mapper>

View File

@ -79,5 +79,17 @@
update lz_result_score set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectResultScoresByDetailId" resultType="ResultScore" >
select * from lz_result_score where detail_id=#{id} and is_delete = 0
</select>
<select id="selectResultScoresByDetailIdAndOrderByStaffIds" resultType="ResultScore" >
select * from lz_result_score where detail_id=#{id} and is_delete = 0 order by field(approval_id,
<foreach collection="list" item="item" separator=",">
#{item.approvalId}
</foreach>
)
</select>
</mapper>

View File

@ -115,6 +115,14 @@
select * from lz_staff_role where is_delete = 0 and evaluation_group_id = #{id}
</select>
<select id="selectStaffRolesByStaffId" resultType="com.lz.modules.flow.entity.StaffRole">
select * from lz_staff_role where is_delete = 0 and staff_id in (
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>
)
</select>
</mapper>

View File

@ -526,4 +526,23 @@
) as staffinfo left join lz_departments_staff_relate relate on staffinfo.id = relate.staff_id
) as info left join lz_departments dep on info.department_id = dep.department_id GROUP BY info.id
</select>
<select id="selectNamesByIds" resultType="com.lz.modules.app.entity.StaffEntity">
select * from lz_staff where id in (
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>
) order by field(id,
<foreach collection="list" item="item" separator=",">
#{item}
</foreach>
)
</select>
<select id="selectStaffsByGroupId" resultType="com.lz.modules.app.entity.StaffEntity">
select staff.* from (select * from lz_staff where id in (
select staff_id from lz_staff_role where is_delete = 0 and (evaluation_group_id = #{sIds} or evaluation_group_id = 0)
) and is_delete=0) as staff join lz_staff_occupation as occupation on staff.id = occupation.staff_id where occupation.staff_status=0
</select>
</mapper>

View File

@ -110,7 +110,7 @@ public class MysqlMain {
//list.add(new TablesBean("lz_flow_chart_detail_record"));
//list.add(new TablesBean("lz_flow_approval_role"));
list.add(new TablesBean("lz_flow_chart"));
list.add(new TablesBean("lz_evaluation_start_staff"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();