This commit is contained in:
杜建超 2020-11-10 11:55:41 +08:00
parent c3240963b4
commit 45ece6ebb6
8 changed files with 89 additions and 23 deletions

View File

@ -45,7 +45,7 @@ public interface EvaluationGroupMapper extends BaseMapper<EvaluationGroup> {
void deleteByCopyIds(@Param("ids") List<Long> ids);
List<Long> selectIdsByCopyIds(@Param("copyIds")String copyIds);
List<Long> selectIdsByCopyIds(@Param("copyIds")String copyIds,@Param("startId")Long startId);
EvaluationGroup selectEvaluationGroupByCopyId(@Param("copyId")Long copyId,@Param("startId")Long startId);

View File

@ -54,4 +54,7 @@ public interface EvaluationGroupService extends IService<EvaluationGroup> {
void deleteByCopyIds(List<Long> ids);
R checkStaff(CheckStaffReq checkStaffReq);
String getEvaluationCopyIdsByEvaluationIds(String evaluationIds,Long startId);
}

View File

@ -349,4 +349,17 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
}
return 0;
}
@Override
public String getEvaluationCopyIdsByEvaluationIds(String evaluationIds,Long startId) {
if(StringUtil.isBlank(evaluationIds)){
return StringUtil.EMPTY;
}
List<Long> ids = evaluationGroupMapper.selectIdsByCopyIds(evaluationIds,startId);
if(CollectionUtils.isEmpty(ids)){
return StringUtil.EMPTY;
}
return StringUtils.join(ids,",");
}
}

View File

@ -134,8 +134,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
public PageUtils assessDetail(AssessDetailReq req) {
//拼接拷贝组
if(StringUtil.isNotBlank(req.getEvaluationIds())){
List<Long> evaluationIds = evaluationGroupMapper.selectIdsByCopyIds(req.getEvaluationIds());
req.setCopyEvaluationIds(StringUtils.join(evaluationIds,","));
req.setCopyEvaluationIds(evaluationGroupService.getEvaluationCopyIdsByEvaluationIds(req.getEvaluationIds(),req.getStartId()));
}
PageUtils pageUtils = PageUtils.startPage(req.getCurrPage(),req.getPageSize()).doSelect(
page -> resultRecordMapper.selectAssessListByStartId(page,req)

View File

@ -12,6 +12,7 @@ import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.dao.EvaluationGroupMapper;
import com.lz.modules.flow.dao.FlowChartMapper;
import com.lz.modules.flow.dao.FlowStartMapper;
import com.lz.modules.flow.entity.FlowChart;
@ -67,6 +68,8 @@ public class ChartResultServiceImpl implements ChartResultService {
private FlowChartService flowChartService;
@Autowired
private AssessService assessService;
@Autowired
private EvaluationGroupMapper evaluationGroupMapper;
private static final Long processId = 1L;
@ -97,7 +100,7 @@ public class ChartResultServiceImpl implements ChartResultService {
res = new ChartStatisticalRes();
res.setType(0);
res.setStatisticals(buildProcess(process,startId,mandepartmentIds));
res.setStatisticals(buildProcess(process,startId,mandepartmentIds,null));
res.setDefaultTime(defaultTime);
if(StringUtil.isNotBlank(defaultTime)){
res.setDefaultId(startId);
@ -222,22 +225,29 @@ public class ChartResultServiceImpl implements ChartResultService {
@Override
public List<ChartStatistical> countAssessNumByFlowProcess(AssessDetailReq req) {
List<ChartStatistical> process = resultRecordMapper.countAssessNumByFlowProcess(req);
req.setCopyEvaluationIds(evaluationGroupService.getEvaluationCopyIdsByEvaluationIds(req.getEvaluationIds(),req.getStartId()));
//获取自己管理的部门
List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());
List<ChartStatistical> data = buildProcess(process, req.getStartId(),mandepartmentIds);
req.setDepartmentIds(mandepartmentIds);
List<ChartStatistical> process = resultRecordMapper.countAssessNumByFlowProcess(req);
List<ChartStatistical> data = buildProcess(process, req.getStartId(),mandepartmentIds,req);
return data;
}
//构建流程默认人数
private List<ChartStatistical> buildProcess(List<ChartStatistical> process,Long startId,List<String> mandepartmentIds){
private List<ChartStatistical> buildProcess(List<ChartStatistical> process,Long startId,List<String> mandepartmentIds,AssessDetailReq req){
List<ChartStatistical> data = Lists.newArrayList();
Map map = Maps.newHashMap();
int count = resultRecordService.count(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0)
.eq("start_id", startId)
.in(CollectionUtils.isNotEmpty(mandepartmentIds),"department_id",mandepartmentIds));
int count;
if(req == null){
count = resultRecordService.count(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0)
.eq("start_id", startId)
.in(CollectionUtils.isNotEmpty(mandepartmentIds),"department_id",mandepartmentIds));
}
else {
count = resultRecordMapper.countAssessNumJoin(req);
}
ChartStatistical all = new ChartStatistical();
all.setDesc("参与人数");
all.setNum(count);

View File

@ -94,4 +94,6 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
int batchDeleteByStartIdAndStaffId(@Param("startId")Long startId,@Param("staffIds") List<String> staffIds);
List<ToScoreDingTalkDto> selectToScoreList(@Param("startId")Long startId, @Param("evaluationId")Long evaluationId);
int countAssessNumJoin(@Param("req")AssessDetailReq req);
}

View File

@ -476,37 +476,75 @@
</select>
<select id="countAssessNumByFlowProcess" resultType="com.lz.modules.performance.res.ChartStatistical">
SELECT count(flow_process) num,flow_process as 'desc' from lz_result_record
where is_delete=0
and start_id =#{req.startId}
<if test="req.evaluationIds !=null and req.evaluationIds !=''">
and evaluation_id in(
<foreach collection="req.evaluationIds.split(',')" item="evaluation_id" open="(" separator="," close=")">
SELECT count(flow_process) num,flow_process as 'desc' 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 =#{req.startId}
<if test="req.copyEvaluationIds !=null and req.copyEvaluationIds !=''">
and r.evaluation_id in(
<foreach collection="req.copyEvaluationIds.split(',')" item="evaluation_id" open="(" separator="," close=")">
#{evaluation_id}
</foreach>
)
</if>
<if test="req.flowProcess !=null">
and flow_process = #{req.flowProcess}
and r.flow_process = #{req.flowProcess}
</if>
<if test="req.staffName !=null and req.staffName!=''">
and staff_name LIKE CONCAT('%',#{req.staffName},'%')
and r.staff_name LIKE CONCAT('%',#{req.staffName},'%')
</if>
<if test="req.staffIds !=null and req.staffIds !=''">
and staff_id in(
and r.staff_id in(
<foreach collection="req.staffIds.split(',')" item="staff_id" open="(" separator="," close=")">
#{staff_id}
</foreach>
)
</if>
<if test="req.departmentIds !=null and req.departmentIds.size()!=0">
and department_id in (
and r.department_id in (
<foreach collection="req.departmentIds" item="department_id" separator=",">
#{department_id}
</foreach>
)
</if>
GROUP BY r.flow_process
</select>
<select id="countAssessNumJoin" resultType="int">
SELECT count(1) num 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 =#{req.startId}
<if test="req.copyEvaluationIds !=null and req.copyEvaluationIds !=''">
and r.evaluation_id in(
<foreach collection="req.copyEvaluationIds.split(',')" item="evaluation_id" open="(" separator="," close=")">
#{evaluation_id}
</foreach>
)
</if>
<if test="req.flowProcess !=null">
and r.flow_process = #{req.flowProcess}
</if>
<if test="req.staffName !=null and req.staffName!=''">
and r.staff_name LIKE CONCAT('%',#{req.staffName},'%')
</if>
<if test="req.staffIds !=null and req.staffIds !=''">
and r.staff_id in(
<foreach collection="req.staffIds.split(',')" item="staff_id" open="(" separator="," close=")">
#{staff_id}
</foreach>
)
</if>
<if test="req.departmentIds !=null and req.departmentIds.size()!=0">
and r.department_id in (
<foreach collection="req.departmentIds" item="department_id" separator=",">
#{department_id}
</foreach>
)
</if>
GROUP BY flow_process
</select>

View File

@ -155,6 +155,7 @@
#{copy_id}
</foreach>
)
and start_id = #{startId}
</select>
<select id="selectEvaluationGroupByCopyId" resultType="EvaluationGroup" >