fix
This commit is contained in:
parent
c097dca611
commit
c9d38933ca
@ -54,19 +54,20 @@ public class ReportResultController extends AbstractController{
|
|||||||
|
|
||||||
|
|
||||||
@RequestMapping("chart")
|
@RequestMapping("chart")
|
||||||
public R reportChart(String monthTime,String departmentId){
|
public R reportChart(String selectMonthTime,String departmentId){
|
||||||
if(StringUtil.isBlank(monthTime)){
|
if(StringUtil.isBlank(selectMonthTime)){
|
||||||
monthTime = YearMonth.now().toString();
|
selectMonthTime = YearMonth.now().toString();
|
||||||
}
|
}
|
||||||
ReportChartResp data = new ReportChartResp();
|
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);
|
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
|
||||||
int total = staffService.countStaffByAllDeparmentIds(allDeparmentIds);
|
List<String> strings = staffService.staffsByAllDeparmentIds(allDeparmentIds);
|
||||||
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(monthTime);
|
int total = strings.size();
|
||||||
|
List<GraphicsStatisticalDto> staffLevels = resultRecordService.staffDistribution(selectMonthTime,strings);
|
||||||
List<String> names = new ArrayList<>();
|
List<String> names = new ArrayList<>();
|
||||||
List<Double> datas = new ArrayList<>();
|
List<Double> datas = new ArrayList<>();
|
||||||
int konwn = 0;
|
int konwn = 0;
|
||||||
@ -90,7 +91,6 @@ public class ReportResultController extends AbstractController{
|
|||||||
barDto.setDatas(datas);
|
barDto.setDatas(datas);
|
||||||
barDto.setTotal(total);
|
barDto.setTotal(total);
|
||||||
data.setStaffDistribution(barDto);
|
data.setStaffDistribution(barDto);
|
||||||
data.setMonthTime(YearMonth.now().toString());
|
|
||||||
return R.ok().put("data",data);
|
return R.ok().put("data",data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -80,8 +80,8 @@ public interface StaffService extends IService<StaffEntity> {
|
|||||||
|
|
||||||
//查询部门下的所有子部门
|
//查询部门下的所有子部门
|
||||||
List<String> selectAllDeparmentIdsByDepartmentParentId(String departmentId);
|
List<String> selectAllDeparmentIdsByDepartmentParentId(String departmentId);
|
||||||
//统计部门下的人数
|
//统计部门下的人
|
||||||
int countStaffByAllDeparmentIds(List<String> deparmentIds);
|
List<String> staffsByAllDeparmentIds(List<String> deparmentIds);
|
||||||
|
|
||||||
List<StaffEntity> selectAll();
|
List<StaffEntity> selectAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -404,9 +404,9 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int countStaffByAllDeparmentIds(List<String> deparmentIds) {
|
public List<String> staffsByAllDeparmentIds(List<String> deparmentIds) {
|
||||||
if(CollectionUtils.isEmpty(deparmentIds)){
|
if(CollectionUtils.isEmpty(deparmentIds)){
|
||||||
return 0;
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
//获取所有子部门
|
//获取所有子部门
|
||||||
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
|
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
|
||||||
@ -414,12 +414,12 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
|
|||||||
.eq("is_delete", 0)
|
.eq("is_delete", 0)
|
||||||
.in("department_id", deparmentIds));
|
.in("department_id", deparmentIds));
|
||||||
if(CollectionUtils.isEmpty(list)){
|
if(CollectionUtils.isEmpty(list)){
|
||||||
return 0;
|
return Lists.newArrayList();
|
||||||
}
|
}
|
||||||
//获取人员个数去重
|
//获取人员个数去重
|
||||||
List<String> staffs = list.stream().map(e -> e.getStaffId() + "").collect(Collectors.toList());
|
List<String> staffs = list.stream().map(e -> e.getStaffId() + "").collect(Collectors.toList());
|
||||||
List<String> staffdistincts = staffs.stream().distinct().collect(Collectors.toList());
|
List<String> staffdistincts = staffs.stream().distinct().collect(Collectors.toList());
|
||||||
return staffdistincts.size();
|
return staffdistincts;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,7 +54,7 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
|||||||
|
|
||||||
List<OwnResultResp> ownResult(@Param("userId") Long userId, @Param("status") int status);
|
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);
|
ResultRecord selectResultRecordByStaffIdStatus(@Param("staffId") Long staffId, @Param("status") int status);
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
|||||||
* @param monthTime
|
* @param monthTime
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<GraphicsStatisticalDto> staffDistribution(String monthTime);
|
List<GraphicsStatisticalDto> staffDistribution(String monthTime,List<String> staffIds);
|
||||||
|
|
||||||
|
|
||||||
Map<String, List<DepartmentsEntity>> getStringListMap(List<DepartmentsEntity> tDepartments);
|
Map<String, List<DepartmentsEntity>> getStringListMap(List<DepartmentsEntity> tDepartments);
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public class ChartServiceImpl implements ChartService {
|
|||||||
List<GraphicsStatisticalDto> dtos = new ArrayList<>();
|
List<GraphicsStatisticalDto> dtos = new ArrayList<>();
|
||||||
//获取所有人员总数
|
//获取所有人员总数
|
||||||
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
|
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(departmentId);
|
||||||
int total = staffService.countStaffByAllDeparmentIds(allDeparmentIds);
|
int total = staffService.staffsByAllDeparmentIds(allDeparmentIds).size();
|
||||||
//已提交
|
//已提交
|
||||||
int commit = resultRecordService.count(new QueryWrapper<ResultRecord>()
|
int commit = resultRecordService.count(new QueryWrapper<ResultRecord>()
|
||||||
.eq("is_delete", 0)
|
.eq("is_delete", 0)
|
||||||
|
|||||||
@ -678,7 +678,8 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<GraphicsStatisticalDto> staffDistribution(String monthTime) {
|
public List<GraphicsStatisticalDto> staffDistribution(String monthTime,List<String> staffIds) {
|
||||||
return resultRecordMapper.staffDistribution(monthTime);
|
|
||||||
|
return resultRecordMapper.staffDistribution(monthTime,staffIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -259,7 +259,13 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="staffDistribution" resultType="com.lz.modules.app.dto.GraphicsStatisticalDto">
|
<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>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user