fix
This commit is contained in:
parent
53812d9e3d
commit
224f5f9f6c
@ -0,0 +1,15 @@
|
||||
package com.lz.modules.performance.res;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "报表统计实体")
|
||||
public class ChartStatistical {
|
||||
@ApiModelProperty(value = "描述",name = "desc")
|
||||
private String desc;
|
||||
|
||||
@ApiModelProperty(value = "人数",name = "num")
|
||||
private int num;
|
||||
}
|
||||
@ -21,12 +21,3 @@ public class ChartStatisticalRes {
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "报表统计实体")
|
||||
class ChartStatistical {
|
||||
@ApiModelProperty(value = "描述",name = "desc")
|
||||
private String desc;
|
||||
|
||||
@ApiModelProperty(value = "人数",name = "num")
|
||||
private int num;
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.lz.modules.performance.service;
|
||||
|
||||
import com.lz.modules.performance.req.ChartResultReq;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -13,6 +15,6 @@ public interface ChartResultService {
|
||||
|
||||
void chartReport(ChartResultReq req);
|
||||
|
||||
void chartDepartment(List<String>staffIds);
|
||||
List<ChartStatistical> countDepartmentAndStaffNum(List<String>staffIds);
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,23 @@
|
||||
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.utils.StringUtil;
|
||||
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
|
||||
import com.lz.modules.app.service.DepartmentsStaffRelateService;
|
||||
import com.lz.modules.performance.req.AssessListReq;
|
||||
import com.lz.modules.performance.req.ChartResultReq;
|
||||
import com.lz.modules.performance.res.ChartStatistical;
|
||||
import com.lz.modules.performance.res.ChartStatisticalRes;
|
||||
import com.lz.modules.performance.service.ChartResultService;
|
||||
import com.lz.modules.sys.service.app.ResultRecordService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Author: djc
|
||||
@ -20,6 +28,8 @@ import java.util.List;
|
||||
public class ChartResultServiceImpl implements ChartResultService {
|
||||
@Autowired
|
||||
private ResultRecordService resultRecordService;
|
||||
@Autowired
|
||||
private DepartmentsStaffRelateService departmentsStaffRelateService;
|
||||
@Override
|
||||
public void chartReport(ChartResultReq req) {
|
||||
AssessListReq query = new AssessListReq();
|
||||
@ -30,7 +40,31 @@ public class ChartResultServiceImpl implements ChartResultService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chartDepartment(List<String> staffIds) {
|
||||
|
||||
public List<ChartStatistical> countDepartmentAndStaffNum(List<String> staffIds) {
|
||||
if(CollectionUtils.isEmpty(staffIds)){
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
List<ChartStatistical> data = new ArrayList<>();
|
||||
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
|
||||
.eq("is_delete", 0)
|
||||
.in("staff_id", staffIds));
|
||||
Map<String,Integer> map = Maps.newHashMap();
|
||||
for(DepartmentsStaffRelateEntity entity:list){
|
||||
String departmentId = entity.getDepartmentId();
|
||||
Integer count = map.get(departmentId);
|
||||
if(null != count){
|
||||
map.put(departmentId,count + 1);
|
||||
}else {
|
||||
map.put(departmentId,1);
|
||||
}
|
||||
}
|
||||
for(String s:map.keySet()){
|
||||
ChartStatistical statistical = new ChartStatistical();
|
||||
statistical.setDesc(s);
|
||||
statistical.setNum(map.get(s));
|
||||
data.add(statistical);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user