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

This commit is contained in:
wulin 2020-11-18 11:25:18 +08:00
commit 1a555351da
9 changed files with 55 additions and 55 deletions

View File

@ -267,7 +267,7 @@ public class TestController {
R r = resultRecordService.initFlowRecord(resultRecordId);
}
// http://localhost:8080/lz_management/test/getAuth?userId=395
// http://localhost:8080/lz_management/test/getAuth?userId=314
@RequestMapping("/test/getAuth")
public R getAuth(Long userId) throws Exception{
Map<String,Integer> map = staffRoleService.getRoleByUserId(userId);

View File

@ -66,4 +66,6 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
StaffRole selectStaffRolesByStaffIdDepartmentLevelList(@Param("staffId") Long staffId, @Param("departmentLevels") List<String> departmentLevels);
List<StaffMenu> selectMenusByParentId(@Param("parentId") long parentId);
}

View File

@ -430,6 +430,10 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel())) {
insertPM(staffRole, RoleMenuEnums.BOSS.getType(), staffEntity);
} else if (RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
StaffRole masterPM = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(), Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()}));
if(masterPM !=null){
return R.error("主管理员只能设置一个,请更改主管理员。");
}
insertPM(staffRole, RoleMenuEnums.MASTER_PM.getType(), staffEntity);
} else if (RoleEnums.CHILD_PM.getName().equals(staffRole.getDepartmentLevel())) { //如果是子管理员
if(new Long(0).equals(roleModel.getEvaluationGroupId())){//全部考评组
@ -485,17 +489,28 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
if(CollectionUtils.isNotEmpty(commonStaffList)){
staffMenus.addAll(commonStaffList);
}
if(new Integer(1).equals(departmentsStaffRelateEntity.getIsLeader())){
List<StaffMenu> staffMenuDepartmentList= staffMenuService.selectByParentId( RoleMenuEnums.DEPARTMENT_PM.getType());
if(CollectionUtils.isNotEmpty(staffMenuDepartmentList)){
staffMenus.addAll(staffMenuDepartmentList);
}
}
if(CollectionUtils.isNotEmpty(staffRoleList)){
List<StaffMenu> staffMenuList = staffRoleMapper.selectAllMenus(userId);
if(CollectionUtils.isNotEmpty(staffMenuList)){
staffMenus.addAll(staffMenuList);
}
for(StaffRole staffRole: staffRoleList){
if(staffRole.getDepartmentLevel().equals(RoleEnums.MASTER_PM.getName())){ //如果是主管理员
List<StaffMenu> staffMenuList= staffMenuService.selectByParentId( RoleMenuEnums.MASTER_PM.getType());
if(CollectionUtils.isNotEmpty(staffMenuList)){
staffMenus.addAll(staffMenuList);
}
}else{
List<StaffMenu> staffMenuList = staffRoleMapper.selectAllMenus(staffRole.getStaffId());
if(CollectionUtils.isNotEmpty(staffMenuList)){
staffMenus.addAll(staffMenuList);
}
}
}
}
if(CollectionUtils.isNotEmpty(staffMenus) && staffMenus.size() > 0 ){
List<Long> authIds = new ArrayList<>();

View File

@ -51,13 +51,14 @@ public class AssessManagerController extends AbstractController{
@ApiOperation("获取考核列表")
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerListRes.class)})
public R assessList(@RequestBody AssessListReq req){
Long userId = null;
try {
Long userId = getUserId();
userId = getUserId();
req.setLoginUserId(userId);
PageUtils pageUtils = assessManagerService.assessList(req);
return R.ok().put("data",pageUtils);
} catch (Exception e) {
log.error("获取考核列表异常,",e);
log.error("获取考核列表异常,userId: " + userId,e);
return R.error(e.getMessage());
}
}
@ -67,12 +68,13 @@ public class AssessManagerController extends AbstractController{
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = AssessManagerDetailRes.class)})
public R assessDetail(@RequestBody AssessDetailReq req){
PageUtils pageUtils;
Long userId = null;
try {
Long userId = getUserId();
userId = getUserId();
req.setLoginUserId(userId);
pageUtils = assessManagerService.assessDetail(req);
} catch (Exception e) {
log.error("获取考核详情列表异常" ,e);
log.error("获取考核详情列表异常userId: " + userId,e);
return R.error(e.getMessage());
}
return R.ok().put("data",pageUtils);
@ -86,12 +88,13 @@ public class AssessManagerController extends AbstractController{
@ApiResponses({@ApiResponse(code = 200,message = "成功",response = ChartStatistical.class)})
public R assessChart(@RequestBody AssessDetailReq req){
List<ChartStatistical> process;
Long userId = null;
try {
Long userId = getUserId();
userId = getUserId();
req.setLoginUserId(userId);
process = chartResultService.countAssessNumByFlowProcess(req);
} catch (Exception e) {
log.error("获取详情顶部人数统计异常" ,e);
log.error("获取详情顶部人数统计异常userId: " + userId,e);
return R.error(e.getMessage());
}
return R.ok().put("data",process);

View File

@ -27,10 +27,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.*;
import java.util.function.Function;
import java.util.function.Supplier;
/**
@ -111,15 +109,7 @@ public class ChartController extends AbstractController{
return R.ok().put("data",ownResultResps);
}
public void main(String[] args) {
ExecutorService executor = Executors.newFixedThreadPool(10);
List<ResultRecord> resultRecords = Lists.newArrayList();
CompletableFuture<List<ResultRecord>> listCompletableFuture = CompletableFuture.supplyAsync(() -> resultRecordService.list(), executor);
try {
resultRecords = listCompletableFuture.get();
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -14,8 +14,8 @@ import lombok.Data;
@ApiModel("获取报表等级详情实体")
public class ChartResultReq extends BasePage{
@ApiModelProperty(value = "部门id",name = "departmentId")
private String departmentId;
@ApiModelProperty(value = "部门ids,逗号隔开",name = "departmentIds")
private String departmentIds;
@ApiModelProperty(value = "考核id",name = "startId")
private Long startId;

View File

@ -19,13 +19,11 @@ import com.lz.modules.flow.dao.EvaluationStartStaffMapper;
import com.lz.modules.flow.dao.FlowRecordMapper;
import com.lz.modules.flow.dao.FlowStartMapper;
import com.lz.modules.flow.entity.EvaluationGroup;
import com.lz.modules.flow.entity.EvaluationStartStaff;
import com.lz.modules.flow.entity.FlowStart;
import com.lz.modules.flow.model.GroupStaffs;
import com.lz.modules.flow.model.StartGroups;
import com.lz.modules.flow.service.EvaluationGroupService;
import com.lz.modules.flow.service.EvaluationStartStaffService;
import com.lz.modules.flow.service.FlowRecordService;
import com.lz.modules.flow.service.FlowStartService;
import com.lz.modules.job.business.DingtalkBusiness;
import com.lz.modules.performance.dto.ToScoreDingTalkDto;
@ -40,21 +38,12 @@ import com.lz.modules.performance.service.AssessService;
import com.lz.modules.sys.dao.app.ResultRecordMapper;
import com.lz.modules.sys.entity.app.ResultRecord;
import com.lz.modules.sys.service.app.ResultRecordService;
import com.sun.org.apache.regexp.internal.RE;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.stream.Collectors;
import static java.util.stream.Collectors.toList;
@ -122,7 +111,7 @@ public class AssessManagerServiceImpl implements AssessManagerService {
}else {
ResultRecord resultRecord = resultRecordMapper.selectOneByStartId(flowStart.getId(),mandepartmentIds);
int i = resultRecordMapper.countStartAndGroupNum(flowStart.getId(),mandepartmentIds);
res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + i + "");
res.setJoinNum(resultRecord == null? StringUtil.EMPTY : resultRecord.getStaffName() + ""+ i + "");
}
data.add(res);
@ -291,7 +280,6 @@ public class AssessManagerServiceImpl implements AssessManagerService {
Long evaluation = group.getId();
int i = evaluationStartStaffService.updateBatchToScore(req.getStartId(), group.getId());
log.info("更新evaluationStartStaff 数据 为已评分 " + i);
List<ToScoreDingTalkDto> dtos = resultRecordMapper.selectToScoreList(req.getStartId(), evaluation);
if(CollectionUtils.isNotEmpty(dtos)){
log.info("本次评分更新操作 num: " + dtos.size());
@ -347,17 +335,4 @@ public class AssessManagerServiceImpl implements AssessManagerService {
}
/* public static void main(String[] args) {
ExecutorService executorService = Executors.newFixedThreadPool(10);
CompletableFuture<List<Long>> future = CompletableFuture.supplyAsync(()-> Arrays.asList(1L,2L),executorService);
try {
List<Long> longs = future.get();
System.out.println();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}*/
}

View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.lz.common.exception.RRException;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
@ -182,7 +183,16 @@ public class ChartResultServiceImpl implements ChartResultService {
@Override
public PageUtils selectChartDetailList(ChartResultReq req) {
List<String> allDeparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(req.getDepartmentId());
String departmentIds = req.getDepartmentIds();
Set<String> allDepart = Sets.newHashSet();
if(StringUtil.isNotBlank(departmentIds)){
String[] split = departmentIds.split(",");
for(String s:split){
List<String> deparmentIds = staffService.selectAllDeparmentIdsByDepartmentParentId(s);
allDepart.addAll(deparmentIds);
}
}
List<String> allDeparmentIds = new ArrayList<>(allDepart);
//自己管理的和所有的部门交集
log.info("selectChartDetailList 查询部门:" + JSON.toJSONString(allDeparmentIds));
List<String> mandepartmentIds = assessService.roleDepartments(req.getLoginUserId());

View File

@ -169,6 +169,7 @@
select menu_id from lz_staff_role_menu where role_id in (
select id from lz_staff_role where staff_id = #{userId} and is_delete=0) and is_delete = 0 ) and is_delete = 0
</select>
<select id="selectAllStaffRoleByDepartmentLevel" resultType="com.lz.modules.flow.entity.StaffRole">
select * from lz_staff_role where is_delete = 0 and department_level in
<foreach collection="departmentLevels" item="item" index="index" separator="," open="(" close=")">
@ -188,7 +189,11 @@
</select>
<select id="selectAllGroupManageRoles" resultType="StaffRole" >
select * from lz_staff_role where evaluation_group_id=0 and is_delete=0 and is_delete=0
select * from lz_staff_role where evaluation_group_id=0 and is_delete=0
</select>
<select id="selectMenusByParentId" resultType="com.lz.modules.flow.entity.StaffMenu">
select * from lz_staff_menu where is_delete=0 and parent_id=#{parentId}
</select>