提交修改

This commit is contained in:
quyixiao 2020-10-21 11:49:27 +08:00
commit 03c55402bc
17 changed files with 144 additions and 42 deletions

View File

@ -1,12 +1,16 @@
package com.lz.modules.app.controller;
import com.alibaba.fastjson.JSON;
import com.dingtalk.api.response.OapiDepartmentListResponse;
import com.lz.common.utils.NumberUtil;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
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.resp.StaffRoleModel;
import com.lz.modules.app.service.DepartmentsService;
import com.lz.modules.app.service.DepartmentsStaffRelateService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.entity.RecordRole;
import com.lz.modules.flow.entity.StaffRole;
@ -22,6 +26,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -55,7 +60,8 @@ public class StaffRoleController {
@Autowired
private DepartmentsService departmentsService;
@Autowired
private DepartmentsStaffRelateService departmentsStaffRelateService;
/**
* 列表
@ -72,7 +78,21 @@ public class StaffRoleController {
@ApiOperation(value="根据groupId获取管理员列表")
@ApiImplicitParam(name = "groupId",value = "组id",defaultValue = "1",required = true, dataType = "Long",paramType = "query")
public R listByGroupId( Long groupId ) {
List<StaffRole> staffRoles = staffRoleService.selectByGroupId(groupId);
List<StaffRole> staffRoleList = staffRoleService.selectByGroupId(groupId);
List<StaffRoleModel> staffRoles = new ArrayList<>();
for(StaffRole staffRole:staffRoleList){
StaffRoleModel staffRoleModel = new StaffRoleModel();
BeanUtils.copyProperties(staffRole,staffRoleModel);
Long staffId = staffRole.getStaffId();
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId);
if(departmentsStaffRelateEntity !=null ){
DepartmentsEntity departmentsEntity = departmentsService.selectByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
if(departmentsEntity !=null){
staffRoleModel.setStaffName(staffRoleModel.getStaffName() + " "+departmentsEntity.getDepartmentName());
}
}
staffRoles.add(staffRoleModel);
}
return R.ok().put("staffRoles", staffRoles);
}

View File

@ -63,5 +63,5 @@ public interface DepartmentsStaffRelateDao extends BaseMapper<DepartmentsStaffRe
List<ReportProgressListDto> getDepartmentNameByStaffIds(@Param("staffIds") List<String> staffIds);
List<String> selectStaffIdsByDepartments(@Param("deparmentIds")List<String> deparmentIds);
}

View File

@ -31,4 +31,6 @@ public interface StaffOccupationDao extends BaseMapper<StaffOccupationEntity> {
void updateAllOccupation();
void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo);
List<String> removeDimissionStaffByStaffIds(@Param("staffIds") List<String> staffIds);
}

View File

@ -0,0 +1,32 @@
package com.lz.modules.app.resp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
public class StaffRoleModel {
//员工 id
@ApiModelProperty(value = "员工 id", name = "staffId")
private Long staffId;
//员工名称
@ApiModelProperty(value = "员工名称", name = "staffName")
private String staffName;
//组id
@ApiModelProperty(value = "组id", name = "evaluationGroupId")
private Long evaluationGroupId;
//是否是必选
@ApiModelProperty(value = "是否是必选,0不是必选1必选", name = "isSelect")
private Integer isSelect;
}

View File

@ -40,5 +40,7 @@ public interface DepartmentsStaffRelateService extends IService<DepartmentsStaff
DepartmentsStaffRelateEntity selectDepartmentByDepartmentId(String departmentId);
DepartmentsStaffRelateEntity selectByStaffId(Long staffId);
List<String> selectStaffIdsByDepartments(List<String> deparmentIds);
}

View File

@ -31,5 +31,7 @@ public interface StaffOccupationService extends IService<StaffOccupationEntity>
void updateAllOccupation();
void updateStatusByStaff(Long staffId, DepartmentStaffBo departmentStaffBo);
List<String> removeDimissionStaffByStaffIds(List<String> staffIds);
}

View File

@ -3,8 +3,10 @@ package com.lz.modules.app.service.impl;
import com.google.common.collect.Lists;
import com.lz.common.utils.StringUtil;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -90,4 +92,12 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl<DepartmentsSt
public DepartmentsStaffRelateEntity selectByStaffId(Long staffId) {
return departmentsStaffRelateDao.selectByStaffId(staffId);
}
@Override
public List<String> selectStaffIdsByDepartments(List<String> deparmentIds) {
if(CollectionUtils.isEmpty(deparmentIds)){
return Collections.EMPTY_LIST;
}
return departmentsStaffRelateDao.selectStaffIdsByDepartments(deparmentIds);
}
}

View File

@ -10,9 +10,12 @@ import com.lz.modules.app.dao.StaffOccupationDao;
import com.lz.modules.app.entity.StaffOccupationEntity;
import com.lz.modules.app.service.StaffOccupationService;
import com.lz.modules.job.model.responseBo.DepartmentStaffBo;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@ -62,4 +65,11 @@ public class StaffOccupationServiceImpl extends ServiceImpl<StaffOccupationDao,
staffOccupationDao.updateStatusByStaff(staffId, departmentStaffBo);
}
@Override
public List<String> removeDimissionStaffByStaffIds(List<String> staffIds) {
if(CollectionUtils.isEmpty(staffIds)){
return Collections.EMPTY_LIST;
}
return staffOccupationDao.removeDimissionStaffByStaffIds(staffIds);
}
}

View File

@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
@ -411,24 +412,13 @@ public class StaffServiceImpl extends ServiceImpl<StaffDao, StaffEntity> impleme
return Lists.newArrayList();
}
//获取所有人员
List<DepartmentsStaffRelateEntity> list = departmentsStaffRelateService.list(new QueryWrapper<DepartmentsStaffRelateEntity>()
.select("staff_id")
.eq("is_delete", 0)
.in("department_id", deparmentIds));
List<String> list = departmentsStaffRelateService.selectStaffIdsByDepartments(deparmentIds);
if(CollectionUtils.isEmpty(list)){
return Lists.newArrayList();
}
//获取人员个数去重
List<String> staffs = list.stream().map(e -> e.getStaffId() + "").collect(Collectors.toList());
staffs.removeIf(s -> {
StaffOccupationInfoDto occupationByStaffId = staffOccupationService.getOccupationByStaffId(Long.valueOf(s));
if(occupationByStaffId==null || "1".equals(occupationByStaffId.getStaffStatus())){
return true;
}
return false;
});
List<String> staffdistincts = staffs.stream().distinct().collect(Collectors.toList());
return staffdistincts;
//获取人员个数去重, 去除离职
List<String> data = staffOccupationService.removeDimissionStaffByStaffIds(list);
return new ArrayList<>(new HashSet(data));
}

View File

@ -44,6 +44,9 @@ public class StaffRole implements java.io.Serializable {
//组id
@ApiModelProperty(value = "组id", name = "evaluationGroupId")
private Long evaluationGroupId;
//是否是必选
@ApiModelProperty(value = "是否是必选", name = "isSelect")
private Integer isSelect;
/**
*
* @return
@ -179,6 +182,21 @@ public class StaffRole implements java.io.Serializable {
this.evaluationGroupId = evaluationGroupId;
}
/**
* 是否是必选
* @return
*/
public Integer getIsSelect() {
return isSelect;
}
/**
* 是否是必选
* @param isSelect
*/
public void setIsSelect(Integer isSelect) {
this.isSelect = isSelect;
}
@Override
public String toString() {
return "StaffRole{" +
@ -191,6 +209,7 @@ public class StaffRole implements java.io.Serializable {
",typeRoleIds=" + typeRoleIds +
",staffName=" + staffName +
",evaluationGroupId=" + evaluationGroupId +
",isSelect=" + isSelect +
"}";
}
}

View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.ISelect;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.app.service.StaffOccupationService;
import com.lz.modules.app.service.StaffService;
import com.lz.modules.flow.dao.EvaluationGroupMapper;
import com.lz.modules.flow.entity.EvaluationGroup;
@ -33,6 +34,8 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
private EvaluationGroupMapper evaluationGroupMapper;
@Autowired
private StaffService staffService;
@Autowired
private StaffOccupationService staffOccupationService;
@Autowired
private EvaluationGroupService evaluationGroupService;
@ -112,8 +115,10 @@ public class EvaluationGroupServiceImpl extends ServiceImpl<EvaluationGroupMappe
String[] split = outIds.split(",");
depStaffIds.removeAll(Arrays.asList(split));
}
//去重
return new ArrayList<>(new HashSet(depStaffIds));
List<String> distDepStaffIds = new ArrayList<>(new HashSet(depStaffIds));
//去除离职
List<String> data = staffOccupationService.removeDimissionStaffByStaffIds(distDepStaffIds);
return data;
}
@Override

View File

@ -1,18 +0,0 @@
package com.lz.modules.performance.res;
import lombok.Data;
/**
* @Author: djc
* @Desc:
* @Date: 2020/10/20 15:54
*/
@Data
public class AssessListRes {
//考核名称
private String name;
//时间周期
private String cycleTime;
//组人员
private String groupNum;
}

View File

@ -55,16 +55,19 @@ public class ChartResultServiceImpl implements ChartResultService {
AssessListReq query = new AssessListReq();
ChartStatisticalRes res;
BeanUtils.copyProperties(req,query);
List<ChartStatistical> process = resultRecordService.countNumByFlowProcess(query);
res = new ChartStatisticalRes();
res.setType(0);
res.setData(process);
data.add(res);
List<ChartStatistical> scoreLevel = resultRecordService.countNumByScoreLevel(query);
res = new ChartStatisticalRes();
res.setType(1);
res.setData(scoreLevel);
data.add(res);
List<String> strings = evaluationGroupService.selectAllStaffIdsByGroupId(3L);
List<ChartStatistical> depstaff = this.countDepartmentAndStaffNum(strings);
res = new ChartStatisticalRes();
@ -80,10 +83,12 @@ public class ChartResultServiceImpl implements ChartResultService {
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();

View File

@ -13,12 +13,13 @@
<result column="type_role_ids" property="typeRoleIds"/>
<result column="staff_name" property="staffName"/>
<result column="evaluation_group_id" property="evaluationGroupId"/>
<result column="is_select" property="isSelect"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, department_level AS departmentLevel, type_role_ids AS typeRoleIds, staff_name AS staffName, evaluation_group_id AS evaluationGroupId
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, department_level AS departmentLevel, type_role_ids AS typeRoleIds, staff_name AS staffName, evaluation_group_id AS evaluationGroupId, is_select AS isSelect
</sql>
@ -36,6 +37,7 @@
<if test="typeRoleIds != null">type_role_ids, </if>
<if test="staffName != null">staff_name, </if>
<if test="evaluationGroupId != null">evaluation_group_id, </if>
<if test="isSelect != null">is_select, </if>
is_delete,
gmt_create,
gmt_modified
@ -45,6 +47,7 @@
<if test="typeRoleIds != null">#{ typeRoleIds}, </if>
<if test="staffName != null">#{ staffName}, </if>
<if test="evaluationGroupId != null">#{ evaluationGroupId}, </if>
<if test="isSelect != null">#{ isSelect}, </if>
0,
now(),
now()
@ -62,7 +65,8 @@
<if test="departmentLevel != null">department_level = #{departmentLevel},</if>
<if test="typeRoleIds != null">type_role_ids = #{typeRoleIds},</if>
<if test="staffName != null">staff_name = #{staffName},</if>
<if test="evaluationGroupId != null">evaluation_group_id = #{evaluationGroupId}</if>
<if test="evaluationGroupId != null">evaluation_group_id = #{evaluationGroupId},</if>
<if test="isSelect != null">is_select = #{isSelect}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -79,7 +83,8 @@
department_level = #{departmentLevel},
type_role_ids = #{typeRoleIds},
staff_name = #{staffName},
evaluation_group_id = #{evaluationGroupId}
evaluation_group_id = #{evaluationGroupId},
is_select = #{isSelect}
,gmt_modified = now()
where id = #{id}
</update>

View File

@ -94,4 +94,13 @@
</foreach>
</select>
<select id="selectStaffIdsByDepartments" resultType="String">
SELECT staff_id from lz_departments_staff_relate where is_delete = 0 and
department_id in
<foreach collection="deparmentIds" item="department_id" open="(" close=")"
separator=",">
#{department_id}
</foreach>
</select>
</mapper>

View File

@ -59,4 +59,13 @@
update lz_staff_occupation set staff_status=#{departmentStaffBo.status},resignation_time=null, position=#{departmentStaffBo.position}, staff_no=#{departmentStaffBo.employeeNo} where is_delete=0 and staff_id = #{staffId}
</update>
<select id="removeDimissionStaffByStaffIds" resultType="String">
SELECT staff_id from lz_staff_occupation where staff_status = 0 and
staff_id in
<foreach collection="staffIds" item="staff_id" open="(" close=")"
separator=",">
#{staff_id}
</foreach>
</select>
</mapper>

View File

@ -73,7 +73,7 @@ public class MysqlMain {
list.add(new TablesBean("lz_flow_chart_role"));
list.add(new TablesBean("lz_flow_start"));
list.add(new TablesBean("lz_result_calculate"));
list.add(new TablesBean("lz_result_dimension"));
list.add(new TablesBean("lz_result_dimension"));'
list.add(new TablesBean("lz_result_grade"));*/
//list.add(new TablesBean("lz_result_model"));
//list.add(new TablesBean("lz_result_score"));