提交修改
This commit is contained in:
commit
428fb0fe40
@ -40,6 +40,7 @@ import java.lang.reflect.Method;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
@ -95,6 +96,12 @@ public class ResultRecordController extends AbstractController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ResultCalculateService resultCalculateService;
|
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<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());//设置评分等级
|
resultRecordDetailDto.setGradeGroupId(resultModels.get(0).getGradeGroupId());//设置评分等级
|
||||||
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
|
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
|
||||||
resultRecordDetailDto.setAvatar(staffEntity.getAvatar());
|
resultRecordDetailDto.setAvatar(staffEntity.getAvatar());
|
||||||
@ -365,6 +416,42 @@ public class ResultRecordController extends AbstractController {
|
|||||||
) {
|
) {
|
||||||
dto.setCalculate(setCalculateValue(calculateModels, dto)) ;
|
dto.setCalculate(setCalculateValue(calculateModels, dto)) ;
|
||||||
weight = weight.add(dto.getCheckWeight());
|
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);
|
BeanUtils.copyProperties(dto, resultRecord);
|
||||||
List<ResultDetail> inserts = new ArrayList<>();
|
List<ResultDetail> inserts = new ArrayList<>();
|
||||||
List<ResultDetail> updates = new ArrayList<>();
|
List<ResultDetail> updates = new ArrayList<>();
|
||||||
|
|
||||||
|
List<ResultScore> insertScores = new ArrayList<>();
|
||||||
|
List<ResultScore> updateScores = new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
for (ResultRecortModelDto model:dto.getRecortModelDtos()
|
for (ResultRecortModelDto model:dto.getRecortModelDtos()
|
||||||
) {
|
) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
@ -497,13 +589,31 @@ public class ResultRecordController extends AbstractController {
|
|||||||
inserts.add(resultDetail);
|
inserts.add(resultDetail);
|
||||||
}
|
}
|
||||||
if(resultDetail.getIsDelete() == null || resultDetail.getIsDelete().intValue() == 0){
|
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());
|
weight = weight.add(resultDetail.getCheckWeight());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(weight.compareTo(model.getWeight()) == 1){
|
if(weight.compareTo(model.getWeight()) == 1){
|
||||||
return R.error(model.getName() + "的指标之和不能超过" + model.getWeight().multiply(BigDecimal.valueOf(100)) + "%");
|
return R.error(model.getName() + "的指标之和不能超过" + model.getWeight().multiply(BigDecimal.valueOf(100)) + "%");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//下面更新指标记录
|
||||||
if(inserts.size() > 0){
|
if(inserts.size() > 0){
|
||||||
resultDetailService.saveBatch(inserts);
|
resultDetailService.saveBatch(inserts);
|
||||||
}
|
}
|
||||||
@ -511,6 +621,14 @@ public class ResultRecordController extends AbstractController {
|
|||||||
resultDetailService.updateBatchById(updates);
|
resultDetailService.updateBatchById(updates);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//下面更新评分记录
|
||||||
|
if(insertScores.size() > 0){
|
||||||
|
resultScoreService.saveBatch(insertScores);
|
||||||
|
}
|
||||||
|
if(updateScores.size() > 0){
|
||||||
|
resultScoreService.updateBatchById(updateScores);
|
||||||
|
}
|
||||||
|
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -94,4 +94,8 @@ public interface StaffDao extends BaseMapper<StaffEntity> {
|
|||||||
List<StaffEntity> selectOnJobByIds(@Param("mIds") List<Long> mIds);
|
List<StaffEntity> selectOnJobByIds(@Param("mIds") List<Long> mIds);
|
||||||
|
|
||||||
StaffSimpleInfo selectStaffSimpleInfo(@Param("staffId") Long staffId);
|
StaffSimpleInfo selectStaffSimpleInfo(@Param("staffId") Long staffId);
|
||||||
|
|
||||||
|
List<StaffEntity> selectNamesByIds(@Param("list") List<Long> sIds);
|
||||||
|
|
||||||
|
List<StaffEntity> selectStaffsByGroupId(@Param("copyId") Long copyId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,5 +99,9 @@ public interface StaffService extends IService<StaffEntity> {
|
|||||||
List<StaffEntity> selectOnJobByIds(List<Long> mIds);
|
List<StaffEntity> selectOnJobByIds(List<Long> mIds);
|
||||||
|
|
||||||
StaffSimpleInfo selectStaffSimpleInfo(Long staffId);
|
StaffSimpleInfo selectStaffSimpleInfo(Long staffId);
|
||||||
|
|
||||||
|
List<StaffEntity> selectNamesByIds(List<Long> sIds);
|
||||||
|
//获取绩效考核管理员
|
||||||
|
List<StaffEntity> selectStaffsByGroupId(Long copyId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -519,5 +519,15 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
|||||||
return staffDao.selectStaffSimpleInfo(staffId);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,4 +41,6 @@ public interface FlowChartDetailRecordMapper extends BaseMapper<FlowChartDetailR
|
|||||||
int insertFlowChartDetailRecords(@Param("list") List<FlowChartDetailRecord> inserts);
|
int insertFlowChartDetailRecords(@Param("list") List<FlowChartDetailRecord> inserts);
|
||||||
|
|
||||||
int updateCoverFlowChartDetailRecordByIds(@Param("list") List<FlowChartDetailRecord> updaes);
|
int updateCoverFlowChartDetailRecordByIds(@Param("list") List<FlowChartDetailRecord> updaes);
|
||||||
|
|
||||||
|
List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(@Param("groupId") Long groupId, @Param("flowProcess") int flowProcess);
|
||||||
}
|
}
|
||||||
@ -9,8 +9,12 @@ package com.lz.modules.flow.dao;
|
|||||||
*/
|
*/
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.lz.modules.flow.entity.ResultScore;
|
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.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ResultScoreMapper extends BaseMapper<ResultScore> {
|
public interface ResultScoreMapper extends BaseMapper<ResultScore> {
|
||||||
|
|
||||||
@ -30,4 +34,7 @@ public interface ResultScoreMapper extends BaseMapper<ResultScore> {
|
|||||||
int deleteResultScoreById(@Param("id")Long id);
|
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);
|
||||||
}
|
}
|
||||||
@ -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> selectByCondition(@Param("page") IPage page, @Param("params") Map<String, Object> params);
|
||||||
|
|
||||||
List<StaffRole> selectByGroupId(@Param("id") Long id);
|
List<StaffRole> selectByGroupId(@Param("id") Long id);
|
||||||
|
|
||||||
|
List<StaffRole> selectStaffRolesByStaffId(@Param("list") List<Long> mIds);
|
||||||
}
|
}
|
||||||
@ -10,7 +10,7 @@ import java.util.Date;
|
|||||||
* <p>
|
* <p>
|
||||||
* </p>*发起考核考,核组人员对应关系表
|
* </p>*发起考核考,核组人员对应关系表
|
||||||
* @author quyixiao
|
* @author quyixiao
|
||||||
* @since 2020-10-23
|
* @since 2020-10-30
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@ -38,8 +38,8 @@ public class EvaluationStartStaff implements java.io.Serializable {
|
|||||||
//人员id
|
//人员id
|
||||||
@ApiModelProperty(value = "人员id", name = "staffId")
|
@ApiModelProperty(value = "人员id", name = "staffId")
|
||||||
private Long staffId;
|
private Long staffId;
|
||||||
//0考核人员,1管理人员
|
//0考核人员 1:考核人员
|
||||||
@ApiModelProperty(value = "0考核人员,1管理人员", name = "type")
|
@ApiModelProperty(value = "0考核人员 1:考核人员", name = "type")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
//0: 未通知评分 1: 已通知评分
|
//0: 未通知评分 1: 已通知评分
|
||||||
@ApiModelProperty(value = "0: 未通知评分 1: 已通知评分", name = "score")
|
@ApiModelProperty(value = "0: 未通知评分 1: 已通知评分", name = "score")
|
||||||
@ -47,6 +47,9 @@ public class EvaluationStartStaff implements java.io.Serializable {
|
|||||||
//考核组名称
|
//考核组名称
|
||||||
@ApiModelProperty(value = "考核组名称", name = "evaluationName")
|
@ApiModelProperty(value = "考核组名称", name = "evaluationName")
|
||||||
private String evaluationName;
|
private String evaluationName;
|
||||||
|
//员工所在的部门id
|
||||||
|
@ApiModelProperty(value = "员工所在的部门id", name = "departmentId")
|
||||||
|
private String departmentId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -153,14 +156,14 @@ public class EvaluationStartStaff implements java.io.Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 0考核人员,1管理人员
|
* 0考核人员 1:考核人员
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Integer getType() {
|
public Integer getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 0考核人员,1管理人员
|
* 0考核人员 1:考核人员
|
||||||
* @param type
|
* @param type
|
||||||
*/
|
*/
|
||||||
public void setType(Integer type) {
|
public void setType(Integer type) {
|
||||||
@ -197,6 +200,21 @@ public class EvaluationStartStaff implements java.io.Serializable {
|
|||||||
this.evaluationName = evaluationName;
|
this.evaluationName = evaluationName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 员工所在的部门id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getDepartmentId() {
|
||||||
|
return departmentId;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 员工所在的部门id
|
||||||
|
* @param departmentId
|
||||||
|
*/
|
||||||
|
public void setDepartmentId(String departmentId) {
|
||||||
|
this.departmentId = departmentId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EvaluationStartStaff{" +
|
return "EvaluationStartStaff{" +
|
||||||
@ -210,6 +228,7 @@ public class EvaluationStartStaff implements java.io.Serializable {
|
|||||||
",type=" + type +
|
",type=" + type +
|
||||||
",score=" + score +
|
",score=" + score +
|
||||||
",evaluationName=" + evaluationName +
|
",evaluationName=" + evaluationName +
|
||||||
|
",departmentId=" + departmentId +
|
||||||
"}";
|
"}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -27,6 +27,8 @@ public class EvaluationStartStaffDto {
|
|||||||
//0考核人员,1管理人员
|
//0考核人员,1管理人员
|
||||||
@ApiModelProperty(value = "0考核人员,1管理人员", name = "type")
|
@ApiModelProperty(value = "0考核人员,1管理人员", name = "type")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
@ApiModelProperty(value = "员工所在的部门id", name = "departmentId")
|
||||||
|
private String departmentId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
12
src/main/java/com/lz/modules/flow/model/GroupStaffs.java
Normal file
12
src/main/java/com/lz/modules/flow/model/GroupStaffs.java
Normal 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;
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -52,6 +53,9 @@ public class ResultDetailDto {
|
|||||||
//优先级,从大到小
|
//优先级,从大到小
|
||||||
@ApiModelProperty(value = "优先级,从小到大", name = "priority")
|
@ApiModelProperty(value = "优先级,从小到大", name = "priority")
|
||||||
private Integer priority;
|
private Integer priority;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "评分详细", name = "scoreDtos")
|
||||||
|
private List<ResultScoreDto> scoreDtos;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@ -27,6 +27,14 @@ public class ResultScoreDto {
|
|||||||
//审批人id
|
//审批人id
|
||||||
@ApiModelProperty(value = "审批人id", name = "approvalId")
|
@ApiModelProperty(value = "审批人id", name = "approvalId")
|
||||||
private Long approvalId;
|
private Long approvalId;
|
||||||
|
|
||||||
|
//审批人id
|
||||||
|
@ApiModelProperty(value = "审批人姓名", name = "approvalName")
|
||||||
|
private String approvalName;
|
||||||
|
|
||||||
|
//审批人id
|
||||||
|
@ApiModelProperty(value = "所占权重", name = "weight")
|
||||||
|
private BigDecimal weight;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
11
src/main/java/com/lz/modules/flow/model/StartGroups.java
Normal file
11
src/main/java/com/lz/modules/flow/model/StartGroups.java
Normal 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;
|
||||||
|
}
|
||||||
@ -50,6 +50,8 @@ public class EvaluationStartStaffReq implements java.io.Serializable {
|
|||||||
//0考核人员,1管理人员
|
//0考核人员,1管理人员
|
||||||
@ApiModelProperty(value = "0考核人员,1管理人员", name = "type")
|
@ApiModelProperty(value = "0考核人员,1管理人员", name = "type")
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
@ApiModelProperty(value = "员工所在的部门id", name = "departmentId")
|
||||||
|
private String departmentId;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
|
|||||||
@ -40,4 +40,6 @@ public interface FlowChartDetailRecordService extends IService<FlowChartDetailRe
|
|||||||
int insertFlowChartDetailRecords(List<FlowChartDetailRecord> inserts);
|
int insertFlowChartDetailRecords(List<FlowChartDetailRecord> inserts);
|
||||||
|
|
||||||
int updateCoverFlowChartDetailRecordByIds(List<FlowChartDetailRecord> updaes);
|
int updateCoverFlowChartDetailRecordByIds(List<FlowChartDetailRecord> updaes);
|
||||||
|
|
||||||
|
List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(Long groupId, int flowProcess);
|
||||||
}
|
}
|
||||||
@ -3,6 +3,7 @@ package com.lz.modules.flow.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.lz.common.utils.R;
|
import com.lz.common.utils.R;
|
||||||
import com.lz.modules.flow.entity.FlowStart;
|
import com.lz.modules.flow.entity.FlowStart;
|
||||||
|
import com.lz.modules.flow.model.StartGroups;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -35,6 +36,8 @@ public interface FlowStartService extends IService<FlowStart> {
|
|||||||
|
|
||||||
FlowStart selectFlowStartByName(String name);
|
FlowStart selectFlowStartByName(String name);
|
||||||
|
|
||||||
|
R startStaffs(StartGroups startGroupStaffIds);
|
||||||
|
|
||||||
R saveStart(FlowStart flowStart);
|
R saveStart(FlowStart flowStart);
|
||||||
|
|
||||||
R getModelById(Long id, int type);
|
R getModelById(Long id, int type);
|
||||||
|
|||||||
@ -2,6 +2,9 @@ package com.lz.modules.flow.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.lz.modules.flow.entity.ResultScore;
|
import com.lz.modules.flow.entity.ResultScore;
|
||||||
|
import com.lz.modules.flow.model.ResultScoreDto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@ -30,4 +33,7 @@ public interface ResultScoreService extends IService<ResultScore> {
|
|||||||
int deleteResultScoreById(Long id);
|
int deleteResultScoreById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
List<ResultScore> selectResultScoresByDetailId(Long id);
|
||||||
|
|
||||||
|
List<ResultScore> selectResultScoresByDetailIdAndOrderByStaffIds(Long id, List<ResultScoreDto> scoreDtos);
|
||||||
}
|
}
|
||||||
@ -49,4 +49,6 @@ public interface StaffRoleService extends IService<StaffRole> {
|
|||||||
List<SysMenuEntity> selectMenuList();
|
List<SysMenuEntity> selectMenuList();
|
||||||
|
|
||||||
List<StaffRole> selectByGroupId(Long id);
|
List<StaffRole> selectByGroupId(Long id);
|
||||||
|
|
||||||
|
List<StaffRole> selectStaffRolesByStaffId(List<Long> mIds);
|
||||||
}
|
}
|
||||||
@ -81,6 +81,11 @@ public class FlowChartDetailRecordServiceImpl extends ServiceImpl<FlowChartDetai
|
|||||||
return flowChartDetailRecordMapper.updateCoverFlowChartDetailRecordByIds(updaes);
|
return flowChartDetailRecordMapper.updateCoverFlowChartDetailRecordByIds(updaes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FlowChartDetailRecord> selectFlowChartDetailRecordsByFlowProcess(Long groupId, int flowProcess){
|
||||||
|
return flowChartDetailRecordMapper.selectFlowChartDetailRecordsByFlowProcess(groupId, flowProcess);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -10,9 +10,7 @@ import com.lz.modules.app.entity.StaffSimpleInfo;
|
|||||||
import com.lz.modules.app.service.StaffService;
|
import com.lz.modules.app.service.StaffService;
|
||||||
import com.lz.modules.flow.dao.FlowStartMapper;
|
import com.lz.modules.flow.dao.FlowStartMapper;
|
||||||
import com.lz.modules.flow.entity.*;
|
import com.lz.modules.flow.entity.*;
|
||||||
import com.lz.modules.flow.model.DepartManagers;
|
import com.lz.modules.flow.model.*;
|
||||||
import com.lz.modules.flow.model.ResultModelDto;
|
|
||||||
import com.lz.modules.flow.model.ResultTagetLibDto;
|
|
||||||
import com.lz.modules.flow.service.*;
|
import com.lz.modules.flow.service.*;
|
||||||
import com.lz.modules.performance.service.ResultTagetLibService;
|
import com.lz.modules.performance.service.ResultTagetLibService;
|
||||||
import com.lz.modules.sys.entity.app.ResultDetail;
|
import com.lz.modules.sys.entity.app.ResultDetail;
|
||||||
@ -123,6 +121,38 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|||||||
return flowStartMapper.selectFlowStartByName(name);
|
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
|
@Override
|
||||||
public R saveStart(FlowStart flowStart){
|
public R saveStart(FlowStart flowStart){
|
||||||
//下面生成或者合并发起绩效
|
//下面生成或者合并发起绩效
|
||||||
@ -151,7 +181,6 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系,减少数据库查找
|
Map<String, List<StaffEntity>> staffManages = new HashedMap();//部门(id+几级)和部门几级管理对应关系,减少数据库查找
|
||||||
//下面开始初始化流程
|
//下面开始初始化流程
|
||||||
List<Long> ids = Arrays.stream(flowStart.getGroupIds().split(",")).map(new Function<String, Long>() {
|
List<Long> ids = Arrays.stream(flowStart.getGroupIds().split(",")).map(new Function<String, Long>() {
|
||||||
@ -173,16 +202,37 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|||||||
|
|
||||||
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
return R.error(evaluationGroup.getName() + "——无有效考核人员");
|
||||||
}
|
}
|
||||||
|
switch (start(evaluationGroup, flowStart, staffManages, staffIds)){
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
private int start(EvaluationGroup evaluationGroup, FlowStart flowStart,
|
||||||
|
Map<String, List<StaffEntity>> staffManages, List<StaffSimpleInfo> staffIds){
|
||||||
|
|
||||||
|
|
||||||
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
|
List<ResultModelDto> resultModelDtos = resultModelService.selectResultDtoByGroupId(evaluationGroup.getId());
|
||||||
if(resultModelDtos.size() == 0){
|
if(resultModelDtos.size() == 0){
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||||
return R.error(evaluationGroup.getName() + "——没有设置考核模板");
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
|
List<FlowChart> flowCharts = flowChartService.selectFlowChartsByGroupId(evaluationGroup.getId());
|
||||||
if(flowCharts.size() == 0){
|
if(flowCharts.size() == 0){
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||||
return R.error(evaluationGroup.getName() + "——没有绩效流程节点");
|
return 2;
|
||||||
}
|
}
|
||||||
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
|
List<FlowChartDetailRecord> flowChartDetailRecords = new ArrayList<>();
|
||||||
for (FlowChart chart:flowCharts
|
for (FlowChart chart:flowCharts
|
||||||
@ -194,13 +244,14 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|||||||
|
|
||||||
if(flowChartDetailRecords.size() == 0){
|
if(flowChartDetailRecords.size() == 0){
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||||
return R.error(evaluationGroup.getName() + "——没有设置考核流程");
|
return 3;
|
||||||
}
|
}
|
||||||
Map<Long, String> chartNameMaps =
|
Map<Long, String> chartNameMaps =
|
||||||
flowCharts.stream().collect(Collectors.toMap(FlowChart::getId, FlowChart::getName));//流程节点与流程名称对应map,下面多次循环,减少数据库查找
|
flowCharts.stream().collect(Collectors.toMap(FlowChart::getId, FlowChart::getName));//流程节点与流程名称对应map,下面多次循环,减少数据库查找
|
||||||
|
|
||||||
List<StaffEntity> staffManagers = null;
|
//获取绩效考核管理员
|
||||||
if(!StringUtil.isEmpty(evaluationGroup.getManagerIds())){
|
List<StaffEntity> staffManagers = staffService.selectStaffsByGroupId(evaluationGroup.getCopyId());
|
||||||
|
/*if(!StringUtil.isEmpty(evaluationGroup.getManagerIds())){
|
||||||
List<Long> mIds = Arrays.stream(evaluationGroup.getManagerIds().split(","))
|
List<Long> mIds = Arrays.stream(evaluationGroup.getManagerIds().split(","))
|
||||||
.map(new Function<String, Long>() {
|
.map(new Function<String, Long>() {
|
||||||
@Override
|
@Override
|
||||||
@ -211,18 +262,21 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|||||||
//查找在职的管理人员
|
//查找在职的管理人员
|
||||||
staffManagers = staffService.selectOnJobByIds(mIds);
|
staffManagers = staffService.selectOnJobByIds(mIds);
|
||||||
|
|
||||||
}
|
}*/
|
||||||
if(staffManagers == null || staffManagers.size() == 0){
|
if(staffManagers == null || staffManagers.size() == 0){
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||||
return R.error(evaluationGroup.getName() + "——没有设置绩效管理人员");
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
|
//下面拷贝一份考评组信息发起后所使用的考评组id为复制后的id
|
||||||
|
if(evaluationGroup.getCopyId() == null){
|
||||||
evaluationGroup.setCopyId(evaluationGroup.getId());
|
evaluationGroup.setCopyId(evaluationGroup.getId());
|
||||||
evaluationGroup.setId(null);
|
evaluationGroup.setId(null);
|
||||||
evaluationGroup.setGmtCreate(null);
|
evaluationGroup.setGmtCreate(null);
|
||||||
evaluationGroup.setGmtModified(null);
|
evaluationGroup.setGmtModified(null);
|
||||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//拷贝考评组的指标信息
|
//拷贝考评组的指标信息
|
||||||
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
|
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
|
||||||
@ -318,7 +372,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|||||||
|
|
||||||
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
|
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
|
||||||
|
|
||||||
//下面初始化管理人员对应关系
|
/*//下面初始化管理人员对应关系
|
||||||
for (StaffEntity entity:staffManagers
|
for (StaffEntity entity:staffManagers
|
||||||
) {
|
) {
|
||||||
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
|
||||||
@ -329,7 +383,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|||||||
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
|
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
|
||||||
evaluationStartStaffs.add(evaluationStartStaff);
|
evaluationStartStaffs.add(evaluationStartStaff);
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
//下面初始化参与人员
|
//下面初始化参与人员
|
||||||
@ -340,6 +394,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|||||||
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
|
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
|
||||||
evaluationStartStaff.setStaffId(staffInfo.getId());
|
evaluationStartStaff.setStaffId(staffInfo.getId());
|
||||||
evaluationStartStaff.setStartId(flowStart.getId());
|
evaluationStartStaff.setStartId(flowStart.getId());
|
||||||
|
evaluationStartStaff.setDepartmentId(staffInfo.getDepartmentId());
|
||||||
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
|
evaluationStartStaff.setType(CheckStaffType.STAFF.getCode());
|
||||||
evaluationStartStaffs.add(evaluationStartStaff);
|
evaluationStartStaffs.add(evaluationStartStaff);
|
||||||
|
|
||||||
@ -476,11 +531,9 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
|
|||||||
//如果有下面通知所有管理人员
|
//如果有下面通知所有管理人员
|
||||||
}else{
|
}else{
|
||||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//事务回滚
|
||||||
return R.error(evaluationGroup.getName() + "——初始化考核流程失败");
|
return 5;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
|
||||||
return R.ok("发起成功").put("data", flowStart);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -3,10 +3,13 @@ package com.lz.modules.flow.service.impl;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.lz.modules.flow.dao.ResultScoreMapper;
|
import com.lz.modules.flow.dao.ResultScoreMapper;
|
||||||
import com.lz.modules.flow.entity.ResultScore;
|
import com.lz.modules.flow.entity.ResultScore;
|
||||||
|
import com.lz.modules.flow.model.ResultScoreDto;
|
||||||
import com.lz.modules.flow.service.ResultScoreService;
|
import com.lz.modules.flow.service.ResultScoreService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 业绩详情评分表 服务类
|
* 业绩详情评分表 服务类
|
||||||
@ -58,6 +61,16 @@ public class ResultScoreServiceImpl extends ServiceImpl<ResultScoreMapper, Resul
|
|||||||
return resultScoreMapper.deleteResultScoreById(id);
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -270,4 +270,9 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StaffRole> selectStaffRolesByStaffId(List<Long> mIds){
|
||||||
|
return staffRoleMapper.selectStaffRolesByStaffId(mIds);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,21 +11,16 @@ import com.lz.modules.app.service.StaffService;
|
|||||||
import com.lz.modules.flow.entity.EvaluationGroup;
|
import com.lz.modules.flow.entity.EvaluationGroup;
|
||||||
import com.lz.modules.flow.entity.FlowManager;
|
import com.lz.modules.flow.entity.FlowManager;
|
||||||
import com.lz.modules.flow.entity.ResultModel;
|
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.model.EvaluationGroupDto;
|
||||||
import com.lz.modules.flow.req.EvaluationGroupReq;
|
import com.lz.modules.flow.req.EvaluationGroupReq;
|
||||||
import com.lz.modules.flow.service.EvaluationGroupService;
|
import com.lz.modules.flow.service.*;
|
||||||
import com.lz.modules.flow.service.FlowManagerService;
|
|
||||||
import com.lz.modules.flow.service.ResultModelService;
|
|
||||||
import com.lz.modules.flow.service.StaffRoleDepartmentService;
|
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@ -49,6 +44,9 @@ public class EvaluationGroupController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private StaffRoleDepartmentService staffRoleDepartmentService;
|
private StaffRoleDepartmentService staffRoleDepartmentService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StaffRoleService staffRoleService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -133,8 +131,8 @@ public class EvaluationGroupController {
|
|||||||
@ApiOperation("保存考评组")
|
@ApiOperation("保存考评组")
|
||||||
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = EvaluationGroup.class)})
|
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = EvaluationGroup.class)})
|
||||||
public R save(@RequestBody @ApiParam EvaluationGroup evaluationGroup) {
|
public R save(@RequestBody @ApiParam EvaluationGroup evaluationGroup) {
|
||||||
if(evaluationGroup.getId() != null && evaluationGroup.getId().intValue() > 0){
|
|
||||||
EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName());
|
EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName());
|
||||||
|
if(evaluationGroup.getId() != null && evaluationGroup.getId().intValue() > 0){
|
||||||
if(evaluationGroup1 == null || evaluationGroup1.getId().equals(evaluationGroup.getId())){
|
if(evaluationGroup1 == null || evaluationGroup1.getId().equals(evaluationGroup.getId())){
|
||||||
evaluationGroupService.updateEvaluationGroupById(evaluationGroup);
|
evaluationGroupService.updateEvaluationGroupById(evaluationGroup);
|
||||||
}else {
|
}else {
|
||||||
@ -142,13 +140,43 @@ public class EvaluationGroupController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
EvaluationGroup evaluationGroup1 = evaluationGroupService.selectEvaluationGroupByName(evaluationGroup.getName());
|
|
||||||
if(evaluationGroup1 != null){
|
if(evaluationGroup1 != null){
|
||||||
return R.error("已经存在相同名称考核组");
|
return R.error("已经存在相同名称考核组");
|
||||||
}
|
}
|
||||||
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
|
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);
|
return R.ok().put("data", evaluationGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,12 +14,13 @@
|
|||||||
<result column="type" property="type"/>
|
<result column="type" property="type"/>
|
||||||
<result column="score" property="score"/>
|
<result column="score" property="score"/>
|
||||||
<result column="evaluation_name" property="evaluationName"/>
|
<result column="evaluation_name" property="evaluationName"/>
|
||||||
|
<result column="department_id" property="departmentId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
<!-- 通用查询结果列 -->
|
<!-- 通用查询结果列 -->
|
||||||
<sql id="Base_Column_List">
|
<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>
|
</sql>
|
||||||
|
|
||||||
|
|
||||||
@ -38,6 +39,7 @@
|
|||||||
<if test="type != null">type, </if>
|
<if test="type != null">type, </if>
|
||||||
<if test="score != null">score, </if>
|
<if test="score != null">score, </if>
|
||||||
<if test="evaluationName != null">evaluation_name, </if>
|
<if test="evaluationName != null">evaluation_name, </if>
|
||||||
|
<if test="departmentId != null">department_id, </if>
|
||||||
is_delete,
|
is_delete,
|
||||||
gmt_create,
|
gmt_create,
|
||||||
gmt_modified
|
gmt_modified
|
||||||
@ -48,6 +50,7 @@
|
|||||||
<if test="type != null">#{ type}, </if>
|
<if test="type != null">#{ type}, </if>
|
||||||
<if test="score != null">#{ score}, </if>
|
<if test="score != null">#{ score}, </if>
|
||||||
<if test="evaluationName != null">#{ evaluationName}, </if>
|
<if test="evaluationName != null">#{ evaluationName}, </if>
|
||||||
|
<if test="departmentId != null">#{ departmentId}, </if>
|
||||||
0,
|
0,
|
||||||
now(),
|
now(),
|
||||||
now()
|
now()
|
||||||
@ -66,7 +69,8 @@
|
|||||||
<if test="staffId != null">staff_id = #{staffId},</if>
|
<if test="staffId != null">staff_id = #{staffId},</if>
|
||||||
<if test="type != null">type = #{type},</if>
|
<if test="type != null">type = #{type},</if>
|
||||||
<if test="score != null">score = #{score},</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>
|
</trim>
|
||||||
,gmt_modified = now()
|
,gmt_modified = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
@ -84,7 +88,8 @@
|
|||||||
staff_id = #{staffId},
|
staff_id = #{staffId},
|
||||||
type = #{type},
|
type = #{type},
|
||||||
score = #{score},
|
score = #{score},
|
||||||
evaluation_name = #{evaluationName}
|
evaluation_name = #{evaluationName},
|
||||||
|
department_id = #{departmentId}
|
||||||
,gmt_modified = now()
|
,gmt_modified = now()
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@ -102,6 +107,7 @@
|
|||||||
staff_id,
|
staff_id,
|
||||||
type,
|
type,
|
||||||
evaluation_name,
|
evaluation_name,
|
||||||
|
department_id,
|
||||||
is_delete
|
is_delete
|
||||||
)values
|
)values
|
||||||
<foreach collection="list" item="item" separator=",">(
|
<foreach collection="list" item="item" separator=",">(
|
||||||
@ -110,6 +116,7 @@
|
|||||||
#{ item.staffId},
|
#{ item.staffId},
|
||||||
#{ item.type},
|
#{ item.type},
|
||||||
#{ item.evaluationName},
|
#{ item.evaluationName},
|
||||||
|
#{ item.departmentId},
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
|
|||||||
@ -109,6 +109,7 @@
|
|||||||
update lz_flow_chart_detail_record set is_delete = 1 where id=#{id} limit 1
|
update lz_flow_chart_detail_record set is_delete = 1 where id=#{id} limit 1
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|
||||||
<select id="selectFlowChartDetailRecordByGroupIdAndChartId" resultType="FlowChartDetailRecord" >
|
<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 * 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>
|
</select>
|
||||||
@ -169,5 +170,10 @@
|
|||||||
|
|
||||||
</update>
|
</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>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@ -79,5 +79,17 @@
|
|||||||
update lz_result_score set is_delete = 1 where id=#{id} limit 1
|
update lz_result_score set is_delete = 1 where id=#{id} limit 1
|
||||||
</update>
|
</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>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@ -115,6 +115,14 @@
|
|||||||
select * from lz_staff_role where is_delete = 0 and evaluation_group_id = #{id}
|
select * from lz_staff_role where is_delete = 0 and evaluation_group_id = #{id}
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|
||||||
|
|||||||
@ -526,4 +526,23 @@
|
|||||||
) as staffinfo left join lz_departments_staff_relate relate on staffinfo.id = relate.staff_id
|
) 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
|
) as info left join lz_departments dep on info.department_id = dep.department_id GROUP BY info.id
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|||||||
@ -110,7 +110,7 @@ public class MysqlMain {
|
|||||||
//list.add(new TablesBean("lz_flow_chart_detail_record"));
|
//list.add(new TablesBean("lz_flow_chart_detail_record"));
|
||||||
//list.add(new TablesBean("lz_flow_approval_role"));
|
//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>();
|
List<TablesBean> list2 = new ArrayList<TablesBean>();
|
||||||
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user