Merge branch 'version_report' of http://gitlab.ldxinyong.com/enterpriseManagement/lz_management into version_report

This commit is contained in:
wulin 2020-09-22 16:45:29 +08:00
commit 9d5c3c9fb8
8 changed files with 27 additions and 20 deletions

View File

@ -54,19 +54,20 @@ public class ReportResultController extends AbstractController{
@RequestMapping("chart")
public R reportChart(String monthTime,String departmentId){
if(StringUtil.isBlank(monthTime)){
monthTime = YearMonth.now().toString();
public R reportChart(String selectMonthTime,String departmentId){
if(StringUtil.isBlank(selectMonthTime)){
selectMonthTime = YearMonth.now().toString();
}
ReportChartResp data = new ReportChartResp();
//月初目标
List<GraphicsStatisticalDto> start = chartService.resultProgressDistribution(ResultRecordTypeEnum.TARGET.getType(),monthTime,departmentId);
List<GraphicsStatisticalDto> start = chartService.resultProgressDistribution(ResultRecordTypeEnum.TARGET.getType(),selectMonthTime,departmentId);
//月末结果
List<GraphicsStatisticalDto> end = chartService.resultProgressDistribution(ResultRecordTypeEnum.RESULT.getType(),monthTime,departmentId);
List<GraphicsStatisticalDto> end = chartService.resultProgressDistribution(ResultRecordTypeEnum.RESULT.getType(),selectMonthTime,departmentId);
//人员等级分布
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
int total = staffService.countStaffByAllDeparmentIds(allDeparmentIds);
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(monthTime);
List<String> strings = staffService.staffsByAllDeparmentIds(allDeparmentIds);
int total = strings.size();
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(selectMonthTime,strings);
List<String> names = new ArrayList<>();
List<Double> datas = new ArrayList<>();
int konwn = 0;
@ -90,7 +91,6 @@ public class ReportResultController extends AbstractController{
barDto.setDatas(datas);
barDto.setTotal(total);
data.setStaffDistribution(barDto);
data.setMonthTime(YearMonth.now().toString());
return R.ok().put("data",data);
}

View File

@ -80,8 +80,8 @@ public interface StaffService extends IService<StaffEntity> {
//查询部门下的所有子部门
List<String> selectAllDeparmentIdsByDepartmentParentId(String departmentId);
//统计部门下的人
int countStaffByAllDeparmentIds(List<String> deparmentIds);
//统计部门下的人
List<String> staffsByAllDeparmentIds(List<String> deparmentIds);
List<StaffEntity> selectAll();
}

View File

@ -404,9 +404,9 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
@Override
public int countStaffByAllDeparmentIds(List<String> deparmentIds) {
public List<String> staffsByAllDeparmentIds(List<String> deparmentIds) {
if(CollectionUtils.isEmpty(deparmentIds)){
return 0;
return Lists.newArrayList();
}
//获取所有子部门
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
@ -414,12 +414,12 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
.eq("is_delete", 0)
.in("department_id", deparmentIds));
if(CollectionUtils.isEmpty(list)){
return 0;
return Lists.newArrayList();
}
//获取人员个数去重
List<String> staffs = list.stream().map(e -> e.getStaffId() + "").collect(Collectors.toList());
List<String> staffdistincts = staffs.stream().distinct().collect(Collectors.toList());
return staffdistincts.size();
return staffdistincts;
}

View File

@ -54,7 +54,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
List<OwnResultResp> ownResult(@Param("userId") Long userId, @Param("status") int status);
List<GraphicsStatisticalDto> staffDistribution(@Param("monthTime") String monthTime);
List<GraphicsStatisticalDto> staffDistribution(@Param("monthTime") String monthTime,@Param("staffIds") List<String> staffIds);
ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);
}

View File

@ -78,7 +78,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
* @param monthTime
* @return
*/
List<GraphicsStatisticalDto> staffDistribution(String monthTime);
List<GraphicsStatisticalDto> staffDistribution(String monthTime,List<String> staffIds);
Map<String, List<DepartmentsEntity>> getStringListMap(List<DepartmentsEntity> tDepartments);

View File

@ -30,7 +30,7 @@ public class ChartServiceImpl implements ChartService {
List<GraphicsStatisticalDto> dtos = new ArrayList<>();
//获取所有人员总数
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
int total = staffService.countStaffByAllDeparmentIds(allDeparmentIds);
int total = staffService.staffsByAllDeparmentIds(allDeparmentIds).size();
//已提交
int commit = resultRecordService.count(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0)

View File

@ -678,7 +678,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
}
@Override
public List<GraphicsStatisticalDto> staffDistribution(String monthTime) {
return resultRecordMapper.staffDistribution(monthTime);
public List<GraphicsStatisticalDto> staffDistribution(String monthTime,List<String> staffIds) {
return resultRecordMapper.staffDistribution(monthTime,staffIds);
}
}

View File

@ -259,7 +259,13 @@
</select>
<select id="staffDistribution" resultType="com.lz.modules.app.dto.GraphicsStatisticalDto">
SELECT count(score_level) number ,score_level category from lz_result_record where is_delete = 0 and status =4 and type =2 and score_level !=0 and DATE_FORMAT(month_time,'%Y-%m') = #{monthTime} GROUP BY score_level
SELECT count(score_level) number ,score_level category from lz_result_record where
is_delete = 0 and status =4 and type =2 and score_level !=0 and DATE_FORMAT(month_time,'%Y-%m') = #{monthTime}
and staff_id in
<foreach collection="staffIds" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
GROUP BY score_level
</select>