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

This commit is contained in:
杜建超 2020-11-24 11:54:57 +08:00
commit 6540811216
14 changed files with 97 additions and 44 deletions

View File

@ -86,7 +86,9 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
List<FlowRecord> selectLastFlowRecordsById(@Param("recordId") Long recordId); List<FlowRecord> selectLastFlowRecordsById(@Param("recordId") Long recordId);
List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") int flowIndex); List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(@Param("recordId") Long recordId, @Param("flowIndex") int flowIndex, @Param("status") int status);
List<FlowRecord> selectSkipFlowRecordsById(@Param("recordId") Long recordId); List<FlowRecord> selectSkipFlowRecordsById(@Param("recordId") Long recordId);
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
} }

View File

@ -81,7 +81,9 @@ public interface FlowRecordService extends IService<FlowRecord> {
//获取最后流程同一个小节点的所有数据 //获取最后流程同一个小节点的所有数据
List<FlowRecord> selectLastFlowRecordsById(Long recordId); List<FlowRecord> selectLastFlowRecordsById(Long recordId);
//获取制定步骤一个小节点的所有数据 //获取制定步骤一个小节点的所有数据
List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex); List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
List<FlowRecord> selectSkipFlowRecordsById(Long recordId); List<FlowRecord> selectSkipFlowRecordsById(Long recordId);
List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status);
} }

View File

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

View File

@ -217,8 +217,8 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
} }
@Override @Override
public List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex){ public List<FlowRecord> selectLastFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status){
return flowRecordMapper.selectLastFlowRecordsByIdAndFlowIndex(recordId, flowIndex); return flowRecordMapper.selectLastFlowRecordsByIdAndFlowIndex(recordId, flowIndex, status);
} }
@Override @Override
@ -226,4 +226,9 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return flowRecordMapper.selectSkipFlowRecordsById(recordId); return flowRecordMapper.selectSkipFlowRecordsById(recordId);
} }
@Override
public List<FlowRecord> selectFirstFlowRecordsByIdAndFlowIndex(Long recordId, int flowIndex, int status){
return flowRecordMapper.selectFirstFlowRecordsByIdAndFlowIndex(recordId, flowIndex, status);
}
} }

View File

@ -33,12 +33,10 @@ import com.lz.modules.sys.entity.SysRoleEntity;
import com.lz.modules.sys.service.app.ResultRecordService; import com.lz.modules.sys.service.app.ResultRecordService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.lang.reflect.Array;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -401,9 +399,15 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
staffRoleMenuService.deleteStaffRoleMenuByRoleId(staffRole.getId()); staffRoleMenuService.deleteStaffRoleMenuByRoleId(staffRole.getId());
staffRoleEvaluationGroupService.deleteStaffRoleEvaluationGroupByRoleId(staffRole.getId()); staffRoleEvaluationGroupService.deleteStaffRoleEvaluationGroupByRoleId(staffRole.getId());
com.lz.modules.app.utils.BeanUtils.copyProperty(staffRole, roleModel); com.lz.modules.app.utils.BeanUtils.copyProperty(staffRole, roleModel);
staffEntity = staffDao.selectStaffById(staffRole.getStaffId()); staffEntity = staffDao.selectStaffById(roleModel.getStaffId());
staffRole.setStaffName(staffEntity.getName()); staffRole.setStaffName(staffEntity.getName());
//如果当前子管理员修改成主管理员
if (RoleEnums.MASTER_PM.getName().equals(roleModel.getDepartmentLevel())) {
StaffRole data = staffRoleMapper.selectStaffRolesByStaffIdDepartmentLevelList(roleModel.getStaffId(), Arrays.asList(new String[]{RoleEnums.CHILD_PM.getName()}));
if(data !=null){
staffRoleMapper.deleteStaffRoleById(data.getId()); //删除子管理员
}
}
staffRoleMapper.updateStaffRoleById(staffRole); staffRoleMapper.updateStaffRoleById(staffRole);
if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel()) || if (RoleEnums.BOSS.getName().equals(staffRole.getDepartmentLevel()) ||
RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) { RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
@ -425,9 +429,11 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
com.lz.modules.app.utils.BeanUtils.copyProperty(staffRole, roleModel); com.lz.modules.app.utils.BeanUtils.copyProperty(staffRole, roleModel);
staffRole.setStaffName(staffEntity.getName()); staffRole.setStaffName(staffEntity.getName());
List<StaffRole> masterPMs = staffRoleMapper.selectStaffRolesByDepartmentLevelList(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()})); if (RoleEnums.MASTER_PM.getName().equals(staffRole.getDepartmentLevel())) {
if(CollectionUtils.isNotEmpty(masterPMs)){ List<StaffRole> masterPMs = staffRoleMapper.selectStaffRolesByDepartmentLevelList(Arrays.asList(new String[]{RoleEnums.MASTER_PM.getName()}));
return R.error("主管理员只能设置一个,如果想添加,只能更改管理员。"); if (CollectionUtils.isNotEmpty(masterPMs)) {
return R.error("主管理员只能设置一个,如果想添加,只能更改管理员。");
}
} }
staffRoleMapper.insertStaffRole(staffRole); staffRoleMapper.insertStaffRole(staffRole);
} }

View File

@ -522,35 +522,42 @@ public class DingtalkBusiness {
}else{ }else{
if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.REJECT.getType()){//被拒 if(workMsgTypeEnum.getType() == WorkMsgTypeEnum.REJECT.getType()){//被拒
logger.info("任务驳回"); logger.info("任务驳回");
cancelRecords = flowRecordService.selectLastFlowRecordsByIdAndFlowIndex(fromStaff.getResultRecord().getId() cancelRecords = flowRecordService.selectFirstFlowRecordsByIdAndFlowIndex(fromStaff.getResultRecord().getId()
, flowRecords.get(0).getFlowIndex().intValue() + 1);//获取下一步的数据 , flowRecords.get(0).getFlowIndex().intValue() + 1, 0);//获取下一步的数据
}else{ }else{
logger.info("任务流转下一步"); logger.info("任务流转下一步");
cancelRecords = flowRecordService.selectLastFlowRecordsByIdAndFlowIndex(fromStaff.getResultRecord().getId() cancelRecords = flowRecordService.selectLastFlowRecordsByIdAndFlowIndex(fromStaff.getResultRecord().getId()
, flowRecords.get(0).getFlowIndex().intValue() - 1);//获取上一步的数据 , flowRecords.get(0).getFlowIndex().intValue() - 1, 1);//获取上一步的数据
} }
} }
logger.info("查询到可能需要更新的待办任务数量{}", cancelRecords.size()); logger.info("查询到可能需要更新的待办任务数量{}", cancelRecords.size());
if(cancelRecords.size() > 0){ if(cancelRecords.size() > 0){
int flowIndex = cancelRecords.get(0).getFlowIndex().intValue();
for (FlowRecord flowRecord:cancelRecords for (FlowRecord flowRecord:cancelRecords
) { ) {
if(flowRecord.getStatus().intValue() == 1 if(flowRecord.getFlowIndex() == flowIndex){//同一个小结点的才进来
|| flowRecord.getStatus().intValue() == 3 if(flowRecord.getStatus().intValue() == 1
|| flowRecord.getStatus().intValue() == 4 || flowRecord.getStatus().intValue() == 3
|| workMsgTypeEnum.getType() == WorkMsgTypeEnum.REJECT.getType()){ || flowRecord.getStatus().intValue() == 4
logger.info("将要更新人员的待办任务人员id:{}, 姓名:{}", flowRecord.getApprovalStaffId(), || workMsgTypeEnum.getType() == WorkMsgTypeEnum.REJECT.getType()){
flowRecord.getApprovalStaffName()); logger.info("将要更新人员的待办任务人员id:{}, 姓名:{}", flowRecord.getApprovalStaffId(),
ThirdMsgSendRecord thirdMsgSendRecord = flowRecord.getApprovalStaffName());
thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus( ThirdMsgSendRecord thirdMsgSendRecord =
fromStaff.getResultRecord().getId(), thirdMsgSendRecordService.selectThirdMsgSendRecordByWorkIdAndStaffIdAndTypeAndStatus(
flowRecord.getApprovalStaffId(), 1, 1); fromStaff.getResultRecord().getId(),
if(thirdMsgSendRecord != null){//把原来的任务更新掉 flowRecord.getApprovalStaffId(), 1, 1);
dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token); if(thirdMsgSendRecord != null){//把原来的任务更新掉
}else{ dingTalkUtil.updateWorkMSG(thirdMsgSendRecord, token);
logger.info("无需更新待办任务"); }else{
logger.info("无需更新待办任务");
}
} }
}else{
logger.info("已经取消完毕");
break;
} }
} }
} }
//给下一步需要处理的人员发送待办任务 //给下一步需要处理的人员发送待办任务

View File

@ -2,6 +2,7 @@ package com.lz.modules.performance.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
import com.lz.common.utils.PageUtils; import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R; import com.lz.common.utils.R;
import com.lz.common.utils.StringUtil; import com.lz.common.utils.StringUtil;
@ -91,9 +92,35 @@ public class EvaluationGroupController extends AbstractController {
return Long.parseLong(s); return Long.parseLong(s);
} }
}).collect(Collectors.toList()); }).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); List<StaffSimpleDto> staffSimpleDtos = staffService.selectStaffSimpleInfoByIds(ids);
evaluationGroupDto.setManagers(staffSimpleDtos); evaluationGroupDto.setManagers(staffSimpleDtos);
} }
if(evaluationGroup.getOutIds() != null && evaluationGroup.getOutIds().length() > 0){ if(evaluationGroup.getOutIds() != null && evaluationGroup.getOutIds().length() > 0){

View File

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

View File

@ -62,7 +62,7 @@ public class OAuth2Filter extends AuthenticatingFilter {
httpResponse.setHeader("Access-Control-Allow-Credentials", "true"); httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin()); 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); httpResponse.getWriter().print(json);
return false; return false;

View File

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

View File

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

View File

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

View File

@ -310,11 +310,17 @@
</select> </select>
<select id="selectLastFlowRecordsByIdAndFlowIndex" resultType="com.lz.modules.flow.entity.FlowRecord"> <select id="selectLastFlowRecordsByIdAndFlowIndex" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and flow_index = #{flowIndex} and record_id = #{recordId} select * from lz_flow_record where is_delete = 0 and flow_index <![CDATA[<=]]> #{flowIndex}
and record_id = #{recordId} and status=#{status} order by flow_index desc
</select> </select>
<select id="selectSkipFlowRecordsById" resultType="com.lz.modules.flow.entity.FlowRecord"> <select id="selectSkipFlowRecordsById" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and (status=4 or status=3) and record_id = #{recordId} select * from lz_flow_record where is_delete = 0 and (status=4 or status=3) and record_id = #{recordId}
</select> </select>
<select id="selectFirstFlowRecordsByIdAndFlowIndex" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and flow_index <![CDATA[>=]]> #{flowIndex}
and record_id = #{recordId} and status=#{status} order by flow_index asc
</select>
</mapper> </mapper>

View File

@ -95,9 +95,6 @@
</update> </update>
<select id="selectByStaffId" resultType="com.lz.modules.flow.entity.StaffRole"> <select id="selectByStaffId" resultType="com.lz.modules.flow.entity.StaffRole">
select * from lz_staff_role where is_delete = 0 and staff_id = #{staffId} limit 1 select * from lz_staff_role where is_delete = 0 and staff_id = #{staffId} limit 1
</select> </select>