This commit is contained in:
杜建超 2020-10-23 17:55:59 +08:00
parent 246ee43638
commit aa7dfccc0c
14 changed files with 92 additions and 58 deletions

View File

@ -34,4 +34,6 @@ public interface EvaluationStartStaffMapper extends BaseMapper<EvaluationStartSt
Long insertEvaluationStartStaffs(@Param("list") List<EvaluationStartStaff> evaluationStartStaffs);
EvaluationStartStaff selectOneByStartIdAndStaffId(@Param("startId")Long startId,@Param("staffId")Long staffId);
}

View File

@ -33,4 +33,6 @@ public interface EvaluationStartStaffService extends IService<EvaluationStartSta
Long insertEvaluationStartStaffs(List<EvaluationStartStaff> evaluationStartStaffs);
EvaluationStartStaff selectOneByStartIdAndStaffId(Long startId,Long staffId);
}

View File

@ -89,6 +89,8 @@ public class EvaluationStartStaffServiceImpl extends ServiceImpl<EvaluationStart
}
@Override
public EvaluationStartStaff selectOneByStartIdAndStaffId(Long startId,Long staffId) {
return evaluationStartStaffMapper.selectOneByStartIdAndStaffId(startId,staffId);
}
}

View File

@ -1,34 +1,20 @@
package com.lz.modules.performance.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.flow.dao.FlowStartMapper;
import com.lz.modules.flow.entity.EvaluationGroup;
import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.flow.service.EvaluationGroupService;
import com.lz.modules.performance.req.AssessListReq;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.res.AssessManagerDetailRes;
import com.lz.modules.performance.res.AssessManagerListRes;
import com.lz.modules.performance.res.ChartStatistical;
import com.lz.modules.performance.res.ChartStatisticalRes;
import com.lz.modules.performance.service.AssessManagerService;
import com.lz.modules.sys.dao.app.ResultRecordMapper;
import com.lz.modules.sys.entity.app.ResultRecord;
import io.swagger.annotations.ApiImplicitParam;
import org.apache.commons.collections.CollectionUtils;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.ToLongFunction;
import java.util.stream.Collectors;
import org.springframework.web.bind.annotation.*;
/**
* @Author: djc
@ -37,41 +23,55 @@ import java.util.stream.Collectors;
*/
@RestController
@RequestMapping("/performance")
@Api(value="考核管理接口", tags={"考核管理"})
public class AssessManagerController {
@Autowired
private FlowStartMapper flowStartMapper;
@Autowired
private AssessManagerService assessManagerService;
@Autowired
private ResultRecordMapper resultRecordMapper;
@RequestMapping("assess/manager/list")
@PostMapping("assess/manager/list")
@ApiOperation("获取考核列表")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerListRes.class)})
public R assessList(@RequestBody AssessListReq req){
PageUtils pageUtils = assessManagerService.assessList(req);
return R.ok().put("data",pageUtils);
}
@RequestMapping("assess/manager/detail")
@PostMapping("assess/manager/detail")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerDetailRes.class)})
public R assessDetail(@RequestBody AssessDetailReq req){
AssessManagerDetailRes res = new AssessManagerDetailRes();
assessManagerService.assessDetail(req);
return R.ok();
}
@PostMapping("assess/manager/chart")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatistical.class)})
public R assessChart(@RequestBody AssessDetailReq req){
return R.ok();
@RequestMapping("assess/manager/delete")
}
@GetMapping("assess/manager/delete")
@ApiOperation("删除考核任务")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatisticalRes.class)})
@ApiImplicitParam(name = "assessId",value = "发起考核id", required = true, dataType = "Long",paramType = "query")
public R assessDelete(@RequestParam Long assessId){
FlowStart flowStart = flowStartMapper.selectFlowStartById(assessId);
if(flowStart == null){
return R.error("没有此条记录");
}
assessManagerService.assessDelete(flowStart);
resultRecordMapper.batchDeleteByStartId(flowStart.getId());
return R.ok();
}
}

View File

@ -29,7 +29,7 @@ import java.util.function.ToLongFunction;
*/
@RestController
@RequestMapping("/performance")
@Api(value="报表接口", tags={"报表统计"})
@Api(value="报表接口", tags={"绩效报表"})
public class ChartController extends AbstractController{
@Autowired
private ChartResultService chartResultService;

View File

@ -1,6 +1,8 @@
package com.lz.modules.performance.req;
import com.lz.modules.equipment.entity.model.BasePage;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -9,9 +11,12 @@ import lombok.Data;
* @Date: 2020/10/13 18:20
*/
@Data
@ApiModel("获取考核列表实体")
public class AssessListReq extends BasePage {
//考核类型 月度 季度
private int cycleType;
//考核类型 月度 自定义
@ApiModelProperty(value = "考核类型 0 月度 1 自定义",name = "cycleType")
private Integer cycleType;
//组名称
@ApiModelProperty(value = "考核名称",name = "name")
private String name;
}

View File

@ -3,6 +3,8 @@ package com.lz.modules.performance.res;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
* @Author: djc
* @Desc:
@ -15,9 +17,9 @@ public class AssessManagerDetailRes {
private String departmentName;
private String group;
private String evaluationName;
private String result;
private String allScore;
private String scoreLevel;
}

View File

@ -1,5 +1,7 @@
package com.lz.modules.performance.res;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
@ -8,14 +10,18 @@ import lombok.Data;
* @Date: 2020/10/21 11:42
*/
@Data
@ApiModel("考核列表实体")
public class AssessManagerListRes {
@ApiModelProperty(value = "id",name="id")
private Long id;
@ApiModelProperty(value = "考核名称",name="name")
private String name;
@ApiModelProperty(value = "时间周期",name="cycleTime")
private String cycleTime;
@ApiModelProperty(value = "参与人数",name="joinNum")
private String joinNum;
}

View File

@ -2,6 +2,7 @@ package com.lz.modules.performance.service;
import com.lz.common.utils.PageUtils;
import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.req.AssessListReq;
/**
@ -13,5 +14,6 @@ public interface AssessManagerService {
PageUtils assessList(AssessListReq req);
void assessDelete(FlowStart flowStart);
void assessDetail(AssessDetailReq req);
}

View File

@ -7,7 +7,10 @@ import com.lz.modules.flow.dao.FlowStartMapper;
import com.lz.modules.flow.entity.EvaluationGroup;
import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.flow.service.EvaluationGroupService;
import com.lz.modules.flow.service.EvaluationStartStaffService;
import com.lz.modules.performance.req.AssessDetailReq;
import com.lz.modules.performance.req.AssessListReq;
import com.lz.modules.performance.res.AssessManagerDetailRes;
import com.lz.modules.performance.res.AssessManagerListRes;
import com.lz.modules.performance.service.AssessManagerService;
import com.lz.modules.sys.dao.app.ResultRecordMapper;
@ -15,6 +18,7 @@ import com.lz.modules.sys.entity.app.ResultRecord;
import com.sun.org.apache.regexp.internal.RE;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
@ -24,6 +28,7 @@ import java.util.stream.Collectors;
* @Desc:
* @Date: 2020/10/22 17:28
*/
@Service("assessManagerService")
public class AssessManagerServiceImpl implements AssessManagerService {
@Autowired
private FlowStartMapper flowStartMapper;
@ -31,6 +36,8 @@ public class AssessManagerServiceImpl implements AssessManagerService {
private ResultRecordMapper resultRecordMapper;
@Autowired
private EvaluationGroupService evaluationGroupService;
@Autowired
private EvaluationStartStaffService evaluationStartStaffService;
@Override
public PageUtils assessList(AssessListReq req) {
@ -65,21 +72,17 @@ public class AssessManagerServiceImpl implements AssessManagerService {
}
@Override
public void assessDelete(FlowStart flowStart) {
String[] split = flowStart.getGroupIds().split(",");
List<Long> collect = Arrays.asList(split).stream().map(s -> Long.valueOf(s)).collect(Collectors.toList());
List<EvaluationGroup> evaluationGroups = evaluationGroupService.selectEvaluationGroupByIds(collect);
if(CollectionUtils.isEmpty(evaluationGroups)){
return ;
public void assessDetail(AssessDetailReq req) {
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
page -> resultRecordMapper.selectAssessListByStartId(page,null)
);
List<ResultRecord> list = pageUtils.getList();
if(CollectionUtils.isEmpty(list)){
return;
}
Set<String> staffIds = new HashSet<>();
evaluationGroups.stream().forEach(evaluationGroup -> {
List<String> strings = evaluationGroupService.selectAllStaffIdsByGroupId(evaluationGroup.getId());
staffIds.addAll(strings);
});
List<String> distStaffIds = new ArrayList<>(staffIds);
// 批量删除
resultRecordMapper.batchDeleteByStaffIdsAndMonth(distStaffIds,"","");
return;
List<AssessManagerDetailRes> data = new ArrayList<>();
}
}

View File

@ -79,9 +79,11 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<ResultRecord> selectResultRankList(@Param("page") IPage page, @Param("req") ChartResultReq req);
void batchDeleteByStaffIdsAndMonth(@Param("staffIds")List<String> staffIds,@Param("startTime")String startTime,@Param("endTime")String endTime);
void batchDeleteByStartId(@Param("startId")Long startId);
int countStartAndGroupNum(@Param("startId")Long startId);
ResultRecord selectOneByStartId(@Param("startId")Long startId);
List<ResultRecord> selectAssessListByStartId(@Param("page") IPage page,@Param("startId")Long startId);
}

View File

@ -354,24 +354,27 @@
</select>
<update id="batchDeleteByStaffIdsAndMonth">
<update id="batchDeleteByStartId">
update lz_result_record set is_delete = 1 where
is_delete = 0
and month_time = #{}
staff_id in
<foreach collection="staffIds" item="staff_id" open="(" close=")"
separator=",">
#{staff_id}
</foreach>
and start_id = #{startId}
</update>
<select id="countStartAndGroupNum" resultType="int">
select COUNT(1) from lz_result_record where is_delete = 0 and start_id = #{startId}
</select>
<select id="selectOneByStartId" resultType="int">
<select id="selectOneByStartId" resultType="com.lz.modules.sys.entity.app.ResultRecord">
select * from lz_result_record where is_delete = 0 and start_id = #{startId} limit 1
</select>
<select id="selectAssessListByStartId" resultType="com.lz.modules.performance.res.AssessManagerDetailRes">
select staff_name,department_name,all_score,score_level,evaluation_name from lz_result_record r
LEFT JOIN lz_evaluation_start_staff s
ON r.start_id = s.start_id and r.staff_id = s.staff_id
where r.is_delete = 0 and s.is_delete = 0
and r.start_id = #{startId}
</select>
</mapper>

View File

@ -107,5 +107,10 @@
;
</insert>
<select id="selectOneByStartIdAndStaffId" resultType="EvaluationStartStaff">
select * from lz_evaluation_start_staff where startId=#{startId} AND staffId =#{staffId} and is_delete = 0 limit 1
</select>
</mapper>

View File

@ -88,7 +88,7 @@
update lz_flow_start set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectListByTime" resultType="FlowStart">
<select id="selectListByTime" resultType="com.lz.modules.flow.entity.FlowStart">
select * from lz_flow_start where is_delete = 0
<if test="cycleType != null">
AND cycle_type = #{cycleType}