提交修改

This commit is contained in:
quyixiao 2020-10-30 17:05:10 +08:00
commit 76e4779f89
22 changed files with 372 additions and 111 deletions

View File

@ -430,7 +430,7 @@ public class ResultRecordController extends AbstractController {
scores) {
if(scoreDto.getApprovalId().longValue() == score.getApprovalId().longValue()){
ResultScoreDto scoreDto1 = new ResultScoreDto();
BeanUtils.copyProperties(scoreDto1, score);
BeanUtils.copyProperties(score, scoreDto1);
scoreDto1.setApprovalId(scoreDto.getApprovalId());
scoreDto1.setApprovalName(scoreDto.getApprovalName());
scoreDto1.setWeight(scoreDto.getWeight());
@ -590,24 +590,28 @@ public class ResultRecordController extends AbstractController {
}
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(detailDto.getScoreDtos() != null){
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);
}
resultScore.setDetailId(detailDto.getId());
}
if(resultScore.getId() == null){
insertScores.add(resultScore);
}else{
updateScores.add(resultScore);
}
}
resultDetail.setAcquireScore(score);
weight = weight.add(resultDetail.getCheckWeight());
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)) + "%");

View File

@ -41,6 +41,6 @@ public interface EvaluationGroupMapper extends BaseMapper<EvaluationGroup> {
EvaluationGroup selectEvaluationGroupByName(@Param("name") String name);
void deleteByIds(@Param("ids") List<Long> ids);
void deleteByCopyIds(@Param("ids") List<Long> ids);
}

View File

@ -41,4 +41,9 @@ public interface EvaluationStartStaffMapper extends BaseMapper<EvaluationStartSt
int existByStartIdAndEvaluationId(@Param("startId") Long startId,@Param("evaluationId")Long evaluationId);
int updateBatchToScore(@Param("startId") Long startId,@Param("evaluationId")Long evaluationId);
int deleteEvaluationStartStaffChangeAssess(@Param("startId") Long startId,@Param("staffIds") List<String> staffIds);
List<Long> selectStaffIdsByStart(@Param("startId") Long startId);
}

View File

@ -6,6 +6,7 @@ import com.lz.common.utils.R;
import com.lz.modules.app.entity.StaffSimpleInfo;
import com.lz.modules.flow.entity.EvaluationGroup;
import com.lz.modules.flow.req.EvaluationGroupReq;
import com.lz.modules.performance.dto.CheckStaffDto;
import java.util.List;
@ -47,5 +48,7 @@ public interface EvaluationGroupService extends IService<EvaluationGroup> {
//获取考核组里面所有参与的人员信息去除重复去除离职
List<StaffSimpleInfo> selectAllStaffSimpleInfoByGroupId(EvaluationGroup evaluationGroup);
void deleteByIds(List<Long> ids);
void deleteByCopyIds(List<Long> ids);
List<CheckStaffDto> checkStaff(EvaluationGroup evaluationGroup);
}

View File

@ -38,4 +38,6 @@ public interface EvaluationStartStaffService extends IService<EvaluationStartSta
EvaluationStartStaff selectManagerEvaluationStartStaff(Long evaluationId, Long userId);
int updateBatchToScore(Long startId,Long evaluationId);
}

View File

@ -1,5 +1,6 @@
package com.lz.modules.flow.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.ISelect;
@ -18,6 +19,8 @@ import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.flow.req.EvaluationGroupReq;
import com.lz.modules.flow.service.EvaluationGroupService;
import com.lz.modules.flow.service.FlowStartService;
import com.lz.modules.performance.dto.CheckStaffDto;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -139,6 +142,11 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
if(evaluationGroup ==null ){
return Collections.EMPTY_LIST;
}
return getStaffIdsByGroup(evaluationGroup);
}
private List<String> getStaffIdsByGroup(EvaluationGroup evaluationGroup){
String depIds = evaluationGroup.getDepIds();
Set<String> allDeparmentIds = new HashSet<>();
if(StringUtils.isNotBlank(depIds)){
@ -165,7 +173,6 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
List<String> data = staffOccupationService.removeDimissionStaffByStaffIds(distDepStaffIds);
return data;
}
@Override
public List<EvaluationGroup> selectEvaluationGroupByIds(List<Long> ids){
return evaluationGroupMapper.selectEvaluationGroupByIds(ids);
@ -248,7 +255,31 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
@Override
public void deleteByIds(List<Long> ids) {
evaluationGroupMapper.deleteByIds(ids);
public void deleteByCopyIds(List<Long> ids) {
evaluationGroupMapper.deleteByCopyIds(ids);
}
@Override
public List<CheckStaffDto> checkStaff(EvaluationGroup evaluationGroup) {
List<CheckStaffDto> staffs= new ArrayList<>();
//本次参加人员
List<String> staffIdsByGroup = getStaffIdsByGroup(evaluationGroup);
//获取之前
List<EvaluationGroup> evaluationGroups = evaluationGroupMapper.selectList(new QueryWrapper<EvaluationGroup>()
.eq("is_delete", 0).eq("copy_id", 0));
if(CollectionUtils.isEmpty(evaluationGroups)){
return staffs;
}
evaluationGroups.stream().map(new Function<EvaluationGroup, CheckStaffDto>() {
@Override
public CheckStaffDto apply(EvaluationGroup evaluationGroup) {
//evaluationGroupService.
return null;
}
});
return null;
}
}

View File

@ -99,4 +99,8 @@ public class EvaluationStartStaffServiceImpl extends ServiceImpl<EvaluationStart
return evaluationStartStaffMapper.selectManagerEvaluationStartStaff(evaluationId,userId);
}
@Override
public int updateBatchToScore(Long startId,Long evaluationId) {
return evaluationStartStaffMapper.updateBatchToScore(startId, evaluationId);
}
}

View File

@ -251,63 +251,54 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
//获取绩效考核管理员
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){
if(evaluationGroup.getCopyId() == null || evaluationGroup.getCopyId().longValue() == 0L){
evaluationGroup.setCopyId(evaluationGroup.getId());
evaluationGroup.setId(null);
evaluationGroup.setGmtCreate(null);
evaluationGroup.setGmtModified(null);
evaluationGroupService.insertEvaluationGroup(evaluationGroup);
}
//拷贝考评组的指标信息
List<ResultTagetLib> resultTagetLibs = new ArrayList<>();
//拷贝考评组的指标信息
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
for (ResultModelDto dto:resultModelDtos
) {
//下面拷贝考评组里面的指标信息
ResultTagetLib resultTagetLib = new ResultTagetLib();
BeanUtils.copyProperties(libDto, resultTagetLib);
resultTagetLib.setModelId(resultModel.getId());//设置新的维度id
resultTagetLib.setId(null);
resultTagetLibs.add(resultTagetLib);
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);
}
}
if(resultTagetLibs.size() > 0){
//插入备份的考评组指标信息
resultTagetLibService.insertResultTagetLibs(resultTagetLibs);
}
@ -372,18 +363,7 @@ public class FlowStartServiceImpl extends ServiceImpl<FlowStartMapper, FlowStart
List<EvaluationStartStaff> evaluationStartStaffs = new ArrayList<>();
/*//下面初始化管理人员对应关系
for (StaffEntity entity:staffManagers
) {
EvaluationStartStaff evaluationStartStaff = new EvaluationStartStaff();
evaluationStartStaff.setEvaluationId(evaluationGroup.getId());
evaluationStartStaff.setEvaluationName(evaluationGroup.getName());
evaluationStartStaff.setStaffId(entity.getId());
evaluationStartStaff.setStartId(flowStart.getId());
evaluationStartStaff.setType(CheckStaffType.MANAGER.getCode());
evaluationStartStaffs.add(evaluationStartStaff);
}*/
//下面初始化参与人员

View File

@ -8,6 +8,7 @@ import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.performance.req.AssessChangeReq;
import com.lz.modules.performance.req.AssessListReq;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.req.AssessToScoreReq;
import com.lz.modules.performance.res.AssessManagerDetailRes;
import com.lz.modules.performance.res.AssessManagerListRes;
import com.lz.modules.performance.res.ChartStatistical;
@ -17,6 +18,7 @@ import com.lz.modules.performance.service.ChartResultService;
import com.lz.modules.sys.dao.app.ResultRecordMapper;
import com.lz.modules.sys.service.app.ResultRecordService;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -29,6 +31,7 @@ import java.util.List;
*/
@RestController
@RequestMapping("/performance")
@Slf4j
@Api(value="考核管理接口", tags={"考核管理"})
public class AssessManagerController {
@ -57,7 +60,13 @@ public class AssessManagerController {
if(req.getStartId()==null){
return R.error("考核id不能为空");
}
PageUtils pageUtils = assessManagerService.assessDetail(req);
PageUtils pageUtils = null;
try {
pageUtils = assessManagerService.assessDetail(req);
} catch (Exception e) {
log.error("获取考核详情列表异常" ,e);
return R.error();
}
return R.ok().put("data",pageUtils);
}
@ -71,7 +80,13 @@ public class AssessManagerController {
if(req.getStartId()==null){
return R.error("考核id不能为空");
}
List<ChartStatistical> process = chartResultService.countAssessNumByFlowProcess(req);
List<ChartStatistical> process = null;
try {
process = chartResultService.countAssessNumByFlowProcess(req);
} catch (Exception e) {
log.error("获取详情顶部人数统计异常" ,e);
return R.error();
}
return R.ok().put("data",process);
}
@ -90,9 +105,11 @@ public class AssessManagerController {
if(StringUtil.isBlank(req.getStaffIds())){
return R.error("变动人员不能为空");
}
String errorMsg = assessManagerService.assessChange(req);
if(StringUtil.isNotBlank(errorMsg)){
return R.error(errorMsg);
try {
assessManagerService.assessChange(req);
} catch (Exception e) {
log.error("考核管理变更异常" ,e);
return R.error(e.getMessage());
}
return R.ok();
@ -111,7 +128,25 @@ public class AssessManagerController {
if(flowStart == null){
return R.error("没有此条记录");
}
assessManagerService.accessDelete(flowStart);
try {
assessManagerService.accessDelete(flowStart);
} catch (Exception e) {
log.error("删除考核任务异常, id:" + assessId ,e);
return R.error();
}
return R.ok();
}
@PostMapping("assess/manager/toScore")
@ApiOperation("开始评分")
@ApiResponses({@ApiResponse(code = 200,message = "成功")})
public R assessToScore(@RequestBody @ApiParam AssessToScoreReq req){
try {
assessManagerService.toScore(req);
} catch (Exception e) {
log.error("开始评分异常" ,e);
return R.error();
}
return R.ok();
}
}

View File

@ -15,6 +15,7 @@ import com.lz.modules.performance.res.ResultRankListRes;
import com.lz.modules.performance.service.ChartResultService;
import com.lz.modules.sys.controller.AbstractController;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -28,6 +29,7 @@ import java.util.*;
@RestController
@RequestMapping("/performance")
@Api(value="报表接口", tags={"绩效报表"})
@Slf4j
public class ChartController extends AbstractController{
@Autowired
private ChartResultService chartResultService;
@ -38,7 +40,13 @@ public class ChartController extends AbstractController{
@ApiOperation("获取绩效报表统计")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatisticalRes.class)})
public R chartResult(@RequestParam(required = false) @ApiParam(name = "startId",value = "考核周期标识id") Long startId){
List<ChartStatisticalRes> chartStatisticalRes = chartResultService.chartReport(startId);
List<ChartStatisticalRes> chartStatisticalRes = null;
try {
chartStatisticalRes = chartResultService.chartReport(startId);
} catch (Exception e) {
log.error("获取绩效报表统计异常" ,e);
return R.error();
}
return R.ok().put("data",chartStatisticalRes);
}
@ -47,7 +55,13 @@ public class ChartController extends AbstractController{
@ApiOperation("获取考核类型列表")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStartsRes.class)})
public R chartStarts(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true)ChartStartsReq req){
PageUtils pageUtils = chartResultService.chartStarts(req);
PageUtils pageUtils = null;
try {
pageUtils = chartResultService.chartStarts(req);
} catch (Exception e) {
log.error("获取考核类型列表异常" ,e);
return R.error();
}
return R.ok().put("data",pageUtils);
}
@ -56,7 +70,13 @@ public class ChartController extends AbstractController{
@ApiOperation("获取报表等级详情")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ResultRankListRes.class)})
public R chartDetailList(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true) ChartResultReq req){
PageUtils pageUtils = chartResultService.selectChartDetailList(req);
PageUtils pageUtils = null;
try {
pageUtils = chartResultService.selectChartDetailList(req);
} catch (Exception e) {
log.error("获取报表等级详情异常" ,e);
return R.error();
}
return R.ok().put("data",pageUtils);
}

View File

@ -188,4 +188,15 @@ public class EvaluationGroupController {
return evaluationGroupService.deleteEvaluationGroupById(id);
//return R.ok();
}
@GetMapping("/checkStaff")
@ApiOperation("校验是否有跨组人员")
public R checkStaff(@RequestParam @RequestBody @ApiParam EvaluationGroup evaluationGroup) {
evaluationGroupService.checkStaff(evaluationGroup);
return R.ok();
}
}

View File

@ -7,6 +7,7 @@ import com.lz.modules.performance.res.TaskListRes;
import com.lz.modules.performance.service.AssessService;
import com.lz.modules.sys.controller.AbstractController;
import io.swagger.annotations.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/performance")
@Slf4j
@Api(value="事项接口", tags={"用户任务"})
public class UserTaskController extends AbstractController{
@Autowired
@ -29,7 +31,14 @@ public class UserTaskController extends AbstractController{
@ApiOperation("获取待办/处理事项")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = TaskListRes.class)})
public R list(@RequestBody @ApiParam(name = "body",value = "body请求体",required = true) AssessTaskReq req){
PageUtils pageUtils = assessService.userTaskList(req, 313L);
PageUtils pageUtils = null;
try {
//Long userId = getUserId();
pageUtils = assessService.userTaskList(req, 313L);
} catch (Exception e) {
log.error("获取用户事项异常 userId:" ,e);
return R.error();
}
return R.ok().put("data",pageUtils);
}
}

View File

@ -0,0 +1,18 @@
package com.lz.modules.performance.dto;
import lombok.Data;
/**
* @Author: djc
* @Desc:
* @Date: 2020/10/30 10:04
*/
@Data
public class CheckStaffDto {
private String staffName;
private Long evaluationId;
private Long staffId;
}

View File

@ -1,6 +1,7 @@
package com.lz.modules.performance.service;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.performance.req.AssessChangeReq;
import com.lz.modules.performance.req.AssessDetailReq;
@ -20,7 +21,7 @@ public interface AssessManagerService {
void accessDelete(FlowStart flowStart);
String assessChange(AssessChangeReq req);
R assessChange(AssessChangeReq req);
void toScore(AssessToScoreReq req);
}

View File

@ -1,16 +1,25 @@
package com.lz.modules.performance.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Maps;
import com.lz.common.exception.RRException;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dto.ApprovalDto;
import com.lz.modules.app.dto.StaffSimpleDto;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.dao.EvaluationStartStaffMapper;
import com.lz.modules.flow.dao.FlowStartMapper;
import com.lz.modules.flow.entity.EvaluationGroup;
import com.lz.modules.flow.entity.EvaluationStartStaff;
import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.flow.model.GroupStaffs;
import com.lz.modules.flow.model.StartGroups;
import com.lz.modules.flow.service.EvaluationGroupService;
import com.lz.modules.flow.service.EvaluationStartStaffService;
import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.flow.service.FlowStartService;
import com.lz.modules.performance.req.AssessChangeReq;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.req.AssessListReq;
@ -20,6 +29,7 @@ import com.lz.modules.performance.res.AssessManagerListRes;
import com.lz.modules.performance.service.AssessManagerService;
import com.lz.modules.sys.dao.app.ResultRecordMapper;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultRecordService;
import com.sun.org.apache.regexp.internal.RE;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -49,6 +59,12 @@ public class AssessManagerServiceImpl implements AssessManagerService {
private EvaluationStartStaffService evaluationStartStaffService;
@Autowired
private StaffService staffService;
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private EvaluationStartStaffMapper evaluationStartStaffMapper;
@Autowired
private FlowStartService flowStartService;
@Override
public PageUtils assessList(AssessListReq req) {
@ -99,7 +115,8 @@ public class AssessManagerServiceImpl implements AssessManagerService {
String[] split = groupIds.split(",");
List<String> ids = Arrays.asList(split);
List<Long> collect = ids.stream().map(s -> Long.valueOf(s)).collect(toList());
evaluationGroupService.deleteByIds(collect);
//删除副本组
evaluationGroupService.deleteByCopyIds(collect);
}
resultRecordMapper.batchDeleteByStartId(flowStart.getId());
return ;
@ -107,50 +124,81 @@ public class AssessManagerServiceImpl implements AssessManagerService {
@Override
public String assessChange(AssessChangeReq req) {
String ok = StringUtil.EMPTY;
public R assessChange(AssessChangeReq req) {
FlowStart flowStart = flowStartMapper.selectFlowStartById(req.getStartId());
if(flowStart == null){
return "暂无此考核组信息";
throw new RRException("暂无此考核组信息");
}
//获取本次考的所有考评组信息
String[] split = flowStart.getGroupIds().split(",");
List<String> strings = Arrays.asList(split);
List<Long> ids = strings.stream().map(s -> Long.valueOf(s)).collect(toList());
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(ids);
Set<String> staffIds = new HashSet<>();
//获取所有考核人员
for(EvaluationGroup group:evaluationGroups){
List<String> staff = evaluationGroupService.selectAllStaffIdsByGroupId(group.getId());
staffIds.addAll(staff);
}
List<String> all = new ArrayList<>(staffIds);
//获取变更人员
String[] changeStaffIds = req.getStaffIds().split(",");
List<String> change = Arrays.asList(changeStaffIds);
List<String> change = new ArrayList<>(Arrays.asList(changeStaffIds));
if(req.getChangeType() == 0){
//获取不在考评组的人员
//获取所有考核人员
List<String> all = new ArrayList<>();
//根据组id成员分组
Map<Long,List<String>> map = Maps.newHashMap();
for(EvaluationGroup group:evaluationGroups){
List<String> staff = evaluationGroupService.selectAllStaffIdsByGroupId(group.getId());
all.addAll(staff);
map.put(group.getId(),staff);
}
//获取不在考核组成员
List<String> notInGroup = change.stream().filter(item -> !all.contains(item)).collect(toList());
//获取不在考评组的人员
if(CollectionUtils.isNotEmpty(notInGroup)){
List<Long> collect = notInGroup.stream().map(s -> Long.valueOf(s)).collect(toList());
List<Long> collect = notInGroup.stream().map(s -> Long.valueOf(s)).distinct().collect(toList());
List<StaffSimpleDto> staffSimpleDtos = staffService.selectStaffSimpleInfoByIds(collect);
String notInGroupNames = StringUtil.EMPTY;
for(StaffSimpleDto dto:staffSimpleDtos){
notInGroupNames = notInGroupNames + dto.getName() + " ";
}
return notInGroupNames;
throw new RRException(notInGroupNames + "已在其他类型为月度的考评组中,是否改为到此考评组中进行考核");
}
//初始化添加用户的数据 TODO
return ok;
//初始化添加用户的数据
List<GroupStaffs> groupS = new ArrayList<>();
//排除已发起过的
List<Long> longs = evaluationStartStaffMapper.selectStaffIdsByStart(req.getStartId());
for(EvaluationGroup group:evaluationGroups){
GroupStaffs groupStaffs = new GroupStaffs();
groupStaffs.setEvaluationGroup(group);
List<String> staffs = map.get(group.getId());
staffs.retainAll(change);
List<Long> collect = staffs.stream().map(s -> Long.valueOf(s)).collect(toList());
collect.removeAll(longs);
groupStaffs.setStaffIds(collect);
groupS.add(groupStaffs);
}
StartGroups startGroups = new StartGroups();
startGroups.setStartId(req.getStartId());
startGroups.setGroups(groupS);
flowStartService.startStaffs(startGroups);
return R.ok();
}
if(req.getChangeType() == 1){
//删除本次考核任务
resultRecordMapper.batchDeleteByStartIdAndStaffId(req.getStartId(),change);
return ok;
evaluationStartStaffMapper.deleteEvaluationStartStaffChangeAssess(req.getStartId(),change);
return R.ok();
}
return ok;
return R.ok();
}
@ -158,11 +206,23 @@ public class AssessManagerServiceImpl implements AssessManagerService {
@Override
public void toScore(AssessToScoreReq req) {
String[] split = req.getEvaluationIds().split(",");
Arrays.asList(split);
/* evaluationStartStaffService.updateBatchById()
evaluationStartStaffService.saveBatch()*/
for(String s:split){
Long evaluation = Long.valueOf(s);
//更新评分
int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), evaluation);
List<Long> longs = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
//更新流程绩效
ApprovalDto approvalDto = new ApprovalDto();
approvalDto.setStatus(1);
approvalDto.setResultRecordId(1L);
approvalDto.setMenuName("开始评分");
try {
resultRecordService.newApproval(approvalDto);
} catch (Exception e) {
e.printStackTrace();
}
}
}
@ -183,4 +243,6 @@ public class AssessManagerServiceImpl implements AssessManagerService {
return evaluationStartStaffs;
}
}

View File

@ -28,6 +28,7 @@ import com.lz.modules.performance.service.ChartResultService;
import com.lz.modules.sys.dao.app.ResultRecordMapper;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultRecordService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -40,6 +41,7 @@ import java.util.*;
* @Date: 2020/10/14 16:53
*/
@Service("chartResultService")
@Slf4j
public class ChartResultServiceImpl implements ChartResultService {
@Autowired
@ -70,6 +72,7 @@ public class ChartResultServiceImpl implements ChartResultService {
//取最近一条记录
FlowStart flowStart = flowStartMapper.selectRecentlyLimt();
if(flowStart!=null){
log.info("首次进入,默认返回最新记录 flowStartId:" + flowStart.getId());
startId = flowStart.getId();
defaultTime = flowStart.getName();
defaultCycleType = flowStart.getCycleType();

View File

@ -89,5 +89,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<ChartStatistical> countAssessNumByFlowProcess(@Param("req")AssessDetailReq req);
void batchDeleteByStartIdAndStaffId(@Param("startId")Long startId,@Param("staffIds") List<String> staffIds);
int batchDeleteByStartIdAndStaffId(@Param("startId")Long startId,@Param("staffIds") List<String> staffIds);
List<Long> selectToScoreList(@Param("startId")Long startId,@Param("evaluationId")Long evaluationId);
}

View File

@ -461,5 +461,12 @@
)
</update>
<select id="selectToScoreList" resultType="long">
select id from lz_result_record where is_delete = 0
and start_id = #{startId}
and flow_process = 2
and evaluation_id = #{evaluationId}
</select>
</mapper>

View File

@ -122,9 +122,9 @@
select * from lz_evaluation_group where name=#{name} and is_delete = 0 limit 1
</select>
<update id="deleteByIds">
<update id="deleteByCopyIds">
update lz_evaluation_group set is_delete = 1 where is_delete=0
and id in (
and copy_id in (
<foreach collection="ids" item="id" separator=",">
#{id}
</foreach>

View File

@ -137,5 +137,35 @@
select count(1) from lz_evaluation_start_staff where is_delete = 0 and evaluation_id=#{evaluationId}
AND start_id =#{startId} and score = 1 limit 1
</select>
<update id="updateBatchToScore">
update
lz_evaluation_start_staff
set
score = 1,
,gmt_modified = now()
where is_delete = 0 and score = 0 and type = 0
and evaluation_id = #{evaluationId} and start_id = #{startId}
</update>
<update id="deleteEvaluationStartStaffChangeAssess">
update
lz_evaluation_start_staff
set
is_delete = 1,
,gmt_modified = now()
where is_delete = 0 and type = 0
and start_id = #{startId}
and staff_id in (
<foreach collection="staffIds" item="staff_id" separator=",">
#{staff_id}
</foreach>
)
</update>
<select id="selectStaffIdsByStart" resultType="long">
select staff_id from lz_evaluation_start_staff where start_id=#{startId} and is_delete = 0
</select>
</mapper>

View File

@ -541,7 +541,7 @@
<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)
select staff_id from lz_staff_role where is_delete = 0 and (evaluation_group_id = #{copyId} 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>

View File

@ -3,6 +3,7 @@ package com.lz.mysql;
import com.lz.common.utils.StringUtil;
import com.lz.modules.flow.entity.FlowChartRole;
import org.springframework.util.ResourceUtils;
import org.springframework.util.StopWatch;
import java.io.File;
import java.util.ArrayList;
@ -49,11 +50,43 @@ public class MysqlMain {
public static String dto_exclude = ",is_delete,gmt_create,gmt_modified,";//生成dto时排除字段前后都要加英文逗号
public static String req_exclude = ",,";//生成Req时排除字段前后都要加英文逗号
public static class TestStaticAndHuo{
public static int compare(Long a, Long b){
return a.compareTo(b);
}
public static boolean isEmpt(String str){
return str == null || str.length() == 0;
}
}
/**
* @param args
*/
public static void main(String[] args) throws Exception {
/*Long a = 2l;
Long b = 3l;
String value = "aaa";
StopWatch stopWatch = new StopWatch();
stopWatch.start("测试静态方法");
for(int i = 0; i < 10000; i++){
if(TestStaticAndHuo.isEmpt(value)){
}
}
stopWatch.stop();
stopWatch.start("测试对象方法");
for(int i = 0; i < 10000; i++){
if(value == null || value.length() == 0){
}
}
stopWatch.stop();
System.out.println(stopWatch.prettyPrint());*/
/*List<TestMap> testMaps = new ArrayList<>();
TestMap test = new TestMap();
test.setName("123");
@ -78,7 +111,6 @@ public class MysqlMain {
}
}).collect(Collectors.joining(","));*/
String path = ResourceUtils.getURL("classpath:").getPath();
System.out.println(path);
String dir = null;
@ -147,6 +179,8 @@ public class MysqlMain {
for (int i = 0; i < list2.size(); i++) {
MysqlUtilTable2XML.printXMLForMap(list2.get(i));
}
}
}