This commit is contained in:
杜建超 2020-11-10 15:32:08 +08:00
parent 46718b37cf
commit 0b93cceee9
2 changed files with 13 additions and 18 deletions

View File

@ -91,7 +91,7 @@ public class ChartController extends AbstractController{
@RequestMapping("/own/result")
@PostMapping("/own/result")
@ApiOperation("获取个人成长曲线")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = OwnResultResp.class)})
public R ownResult(Long userId){

View File

@ -9,6 +9,7 @@ import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
@ -38,6 +39,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* @Author: djc
@ -123,24 +126,16 @@ public class ChartResultServiceImpl implements ChartResultService {
data.add(res);
//如果不是默认获得发起考核信息
if(flowStart == null){
flowStart = flowStartMapper.selectFlowStartById(startId);
}
String[] split = flowStart.getGroupIds().split(",");
Set<String> staffIds = new HashSet<>();
for(String s:split){
List<String> strings = evaluationGroupService.selectAllStaffIdsByGroupId(Long.valueOf(s));
staffIds.addAll(strings);
}
log.info("chartReport 所有人员:" + JSON.toJSONString(staffIds));
//自己管理的和发起的人员交集
List<String> manstaffIds = staffService.staffsByAllDeparmentIds(mandepartmentIds);
log.info("chartReport 管理人员:" + JSON.toJSONString(manstaffIds));
manstaffIds.retainAll(staffIds);
log.info("chartReport 交集人员:" + JSON.toJSONString(manstaffIds));
List<String> all = new ArrayList<>(manstaffIds);
List<ChartStatistical> depstaff = this.countDepartmentAndStaffNum(all);
List<Object> objects = resultRecordService.listObjs(new QueryWrapper<ResultRecord>()
.eq("is_delete", 0)
.eq("start_id", startId)
.in(mandepartmentIds != null, "department_id", mandepartmentIds).select("staff_id"));
if(CollectionUtils.isEmpty(objects)){
return data;
}
List<String> collect = objects.stream().map(o -> String.valueOf(o)).collect(Collectors.toList());
List<ChartStatistical> depstaff = this.countDepartmentAndStaffNum(collect);
res = new ChartStatisticalRes();
res.setType(2);
res.setStatisticals(buildDepStaffs(depstaff));