提交修改

This commit is contained in:
quyixiao 2020-11-26 15:06:48 +08:00
commit 98e6a57521
14 changed files with 93 additions and 9 deletions

View File

@ -57,4 +57,6 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
List<DepartmentsEntity> selectEntityByParentDepartmentIds(@Param("dIds") List<DepartmentsEntity> dIds);
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
int delDepartments(@Param("list") List<DepartmentsEntity> departmentsEntities);
}

View File

@ -57,5 +57,9 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
//查找父级部门
DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId);
List<DepartmentsEntity> selectAll();
int delDepartments(List<DepartmentsEntity> departmentsEntities);
}

View File

@ -295,5 +295,15 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
public DepartmentsEntity selectParentDepartmentByDepartmentId(String departmentId){
return departmentsDao.selectParentDepartmentByDepartmentId(departmentId);
}
@Override
public List<DepartmentsEntity> selectAll(){
return departmentsDao.selectAll();
}
@Override
public int delDepartments(List<DepartmentsEntity> departmentsEntities){
return departmentsDao.delDepartments(departmentsEntities);
}
}

View File

@ -71,8 +71,9 @@ public interface StaffRoleService extends IService<StaffRole> {
List<StaffRole> selectAllGroupManageRoles();
List<StaffRole> selectAllStaffRoleByDepartmentLevel(List<String> asList);
//获取指定组的请按不管理人员
List<StaffRole> selectByEvaluationGroupId(Long id);
StaffRole selectStaffRolesByStaffIdDepartmentLevelList(Long loginUserId, List<String> asList);
}

View File

@ -6,6 +6,7 @@ import com.lz.common.utils.DateUtils;
import com.lz.common.utils.DingTalkUtil;
import com.lz.common.utils.R;
import com.lz.modules.app.dao.StaffDao;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.entity.StaffEntity;
import com.lz.modules.app.entity.StaffOccupationEntity;
import com.lz.modules.app.entity.StaffSimpleInfo;
@ -30,6 +31,7 @@ import com.lz.modules.third.entity.ThirdMsgSendRecord;
import com.lz.modules.third.entity.WorkMsg;
import com.lz.modules.third.service.ThirdAppConfigService;
import com.lz.modules.third.service.ThirdMsgSendRecordService;
import org.apache.commons.collections.map.CompositeMap;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -131,7 +133,12 @@ public class DingtalkBusiness {
if(token != null && token.length() > 0){
//获取所有的部门详情
Map<String, DepartmentInfosBo> departmentInfosBos = dingTalkUtil.getDepartmentDetails(token, "1");
if(departmentInfosBos.size() > 0){
//获取所有部门信息
List<DepartmentsEntity> departmentsEntities = departmentsService.selectAll();
Map<String, DepartmentsEntity> mapDeparts =
departmentsEntities.stream().collect(Collectors.toMap(DepartmentsEntity::getDepartmentId, Function.identity(), (e, r) -> e));
//更新数据库中的部门相关信息
//departmentsService.updateDepartmentInfos(departmentInfosBos);
//删除原有的对应关系下面在更新
@ -140,6 +147,10 @@ public class DingtalkBusiness {
staffOccupationService.updateAllOccupation();
//获取飞书部门对应的用户详情
for (String key : departmentInfosBos.keySet()) {
if(mapDeparts.containsKey(key)){
//部门存在
mapDeparts.remove(key);
}
DepartmentInfosBo departmentInfo = departmentInfosBos.get(key);
//获取部门用户详情
List<DepartmentStaffBo> staffs = dingTalkUtil.getDepartmentStaffDetails(token, departmentInfo.getId());
@ -178,6 +189,10 @@ public class DingtalkBusiness {
DepartmentInfosBo departmentInfo = departmentInfosBos.get(key);
departmentsService.updateDepartmentInfo(departmentInfo);
}
if(mapDeparts.size() > 0){//有需要删除的部门信息
departmentsEntities = mapDeparts.values().stream().collect(Collectors.toList());
departmentsService.delDepartments(departmentsEntities);
}
}else{
logger.info("部门信息为空");

View File

@ -2,6 +2,7 @@ package com.lz.modules.performance.controller;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil;
@ -91,9 +92,35 @@ public class EvaluationGroupController extends AbstractController {
return Long.parseLong(s);
}
}).collect(Collectors.toList());
//下面的操作是防止在权限里面单独加绩效管理人员时导致前端展示不一致问题
//搜索管理表里面的人员去重
List<StaffRole> staffRoles = staffRoleService.selectAllGroupManageRoles();
if(staffRoles.size() > 0){
List<Long> roleIds = staffRoles.stream().map(new Function<StaffRole, Long>() {
@Override
public Long apply(StaffRole staffRole) {
return staffRole.getStaffId();
}
}).collect(Collectors.toList());
ids.addAll(roleIds);
}
//获取管理特定组的
staffRoles = staffRoleService.selectByEvaluationGroupId(evaluationGroup.getId());
if(staffRoles.size() > 0){
List<Long> roleIds = staffRoles.stream().map(new Function<StaffRole, Long>() {
@Override
public Long apply(StaffRole staffRole) {
return staffRole.getStaffId();
}
}).collect(Collectors.toList());
ids.addAll(roleIds);
}
//去重
Map<Long, Long> mapIds = ids.stream().collect(Collectors.toMap(Long::longValue,Function.identity(), (e, r) -> e));
ids = mapIds.values().stream().collect(Collectors.toList());
//指定人员搜索人员信息
List<StaffSimpleDto> staffSimpleDtos = staffService.selectStaffSimpleInfoByIds(ids);
evaluationGroupDto.setManagers(staffSimpleDtos);
}
if(evaluationGroup.getOutIds() != null && evaluationGroup.getOutIds().length() > 0){

View File

@ -103,8 +103,17 @@ public class AssessServiceImpl implements AssessService {
public List<String> roleDepartments(Long staffId) {
StaffRole staffRole = staffRoleService.selectByStaffId(staffId);
if(staffRole == null){
log.info("staffRole 为空");
return Collections.EMPTY_LIST;
log.info("staffRole 为空,不存在次人员权限配置信息staffId" + staffId);
//判断是否是领导
DepartmentsStaffRelateEntity entity = departmentsStaffRelateService.selectByStaffId(staffId);
if(entity == null || 0 == entity.getIsLeader()){
log.info("非 leader,此人员无管理部门权限");
return Collections.EMPTY_LIST;
}
List<String> depIds = staffService.selectAllDeparmentIdsByDepartmentParentId(entity.getDepartmentId());
log.info("获取部门领导管理部门ids: " + JSON.toJSONString(depIds));
return depIds;
}
log.info("获取 roleDepartment,staffRole: " + JSON.toJSONString(staffRole));
// 0 标识全部部门

View File

@ -75,6 +75,8 @@ public class SysLoginController extends AbstractController {
@Autowired
private StaffService staffService;
@Value(value = "${sms.code}")
private boolean sendSMSCode;
/**
* 验证码
@ -201,7 +203,7 @@ public class SysLoginController extends AbstractController {
}
}
//测试环境将不进行短信验证码
if (true) {
if (sendSMSCode) {
//账号不存在密码错误
if (!user.getPassword().equals(new Sha256Hash(form.getPassword(), user.getSalt()).toHex())) {
return R.error("密码不正确!");

View File

@ -62,7 +62,7 @@ public class OAuth2Filter extends AuthenticatingFilter {
httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
String json = new Gson().toJson(R.error(HttpStatus.SC_UNAUTHORIZED, "登录已过期,请重新登录"));
String json = new Gson().toJson(R.error(HttpStatus.SC_UNAUTHORIZED, "invalid token"));
httpResponse.getWriter().print(json);
return false;

View File

@ -35,6 +35,8 @@ dingtalk:
appid: 855818566
domain:
main: "http://192.168.43.94:8001"
sms:
code: false
##多数据源的配置
#dynamic:

View File

@ -34,7 +34,8 @@ dingtalk:
appid: 856016278
domain:
main: "https://lzmanagement.ldxinyong.com"
sms:
code: true
##多数据源的配置
#dynamic:
# datasource:

View File

@ -34,7 +34,8 @@ dingtalk:
appid: 855818566
domain:
main: "http:/localhost"
sms:
code: false
##多数据源的配置

View File

@ -182,6 +182,7 @@
and approval_staff_id = #{approvalStaffId}
and f.status = 1
and f.flow_process != 2
and r.start_id != 0
order by f.gmt_modified desc
</select>
@ -193,6 +194,7 @@
and approval_staff_id = #{approvalStaffId}
and f.status = 2
and f.flow_process != 2
and r.start_id != 0
order by f.gmt_modified desc
</select>

View File

@ -25,7 +25,7 @@
</select>
<select id="getDepartmentsByparentId" resultType="com.lz.modules.app.dto.DepartmentsDto">
select id, department_id,department_parent_id,member_count,department_name from lz_departments where department_parent_id=#{parentId}
select id, department_id,department_parent_id,member_count,department_name from lz_departments where department_parent_id=#{parentId} and is_delete=0
</select>
<update id="updateDepartment">
@ -179,5 +179,13 @@
and is_delete=0 limit 1
</select>
<update id="delDepartments">
UPDATE lz_departments set is_delete = 1 WHERE id in(
<foreach collection="list" item="item" separator=",">
#{item.id}
</foreach>
)
</update>
</mapper>