提交修改

This commit is contained in:
quyixiao 2020-08-20 14:37:00 +08:00
parent 59c8fb1df4
commit 23c29ad2db
30 changed files with 418 additions and 177 deletions

View File

@ -153,6 +153,7 @@ public class Constant {
public static final String INVELOMENT_TYPE_ONLINE = "online";
public static final String INVELOMENT_TYPE_PRE_ENV = "preissue";
public static final String FORMAL_APP_IDENTIFY = "www";
public static final String ME = "ME";
}

View File

@ -1,5 +1,6 @@
package com.lz.modules.app.controller;
import com.alibaba.fastjson.JSON;
import com.lz.common.utils.*;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dto.StaffDepartmentDto;
@ -10,16 +11,11 @@ import com.lz.modules.app.resp.ResultDetailResp;
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.Flow;
import com.lz.modules.flow.entity.FlowDepartment;
import com.lz.modules.flow.entity.FlowRelation;
import com.lz.modules.flow.entity.RecordAuth;
import com.lz.modules.flow.entity.*;
import com.lz.modules.flow.model.Auth;
import com.lz.modules.flow.model.StaffRoleDto;
import com.lz.modules.flow.req.ResultDetailReq;
import com.lz.modules.flow.service.FlowDepartmentService;
import com.lz.modules.flow.service.FlowRelationService;
import com.lz.modules.flow.service.FlowService;
import com.lz.modules.flow.service.RecordAuthService;
import com.lz.modules.flow.service.*;
import com.lz.modules.sys.controller.AbstractController;
import com.lz.modules.sys.entity.SysUserEntity;
import com.lz.modules.sys.entity.app.ResultDetail;
@ -79,6 +75,15 @@ public class ResultRecordController extends AbstractController {
@Autowired
private FlowService flowService;
@Autowired
private FlowRecordService flowRecordService;
@Autowired
private StaffRoleService staffRoleService;
@Autowired
private StaffRoleDepartmentService staffRoleDepartmentService;
/**
* 列表
*/
@ -101,11 +106,13 @@ public class ResultRecordController extends AbstractController {
@RequestMapping("/getStaffResultDetail")
public R getStaffResultDetail(ResultRecordReq req) {
int firstRowspan = 0;
int secondRowspan = 0;
int threeRowspan = 0;
int fourRowspan = 0;
int fiveRowspan = 0;
int recordType = req.getRecordType();
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
StaffEntity staffEntity = staffService.getById(resultRecord != null ? resultRecord.getStaffId() : getUserId());
@ -130,7 +137,7 @@ public class ResultRecordController extends AbstractController {
if (resultRecordOld != null) {
Long recordId = resultRecordOld.getId();
resultRecordOld.setId(null);
resultRecordOld.setInitRoleId(8l);
resultRecordOld.setFlowStaffIdRole(initRole(resultRecordOld.getStaffId(), 8l));
resultRecordService.insertResultRecord(resultRecordOld);
resultRecordNew = resultRecordOld;
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordId);
@ -142,18 +149,17 @@ public class ResultRecordController extends AbstractController {
resultDetailService.insertResultDetail(resultDetail);
}
}
} else {
resultRecordNew = createResultRecord(2);
resultRecordNew = createResultRecord(getUserId(),2);
}
//保存文件价值观
recordType = 3;
insertWenHuaJiaZhiGua("做人:相信、包容、担当", resultRecordNew.getId(), getUserId());
insertWenHuaJiaZhiGua("做事:用户第一、求真、极致", resultRecordNew.getId(), getUserId());
recordResultId = resultRecordNew.getId();
} else if (resultRecord != null) {
listAuth = recordAuthService.selectAuthInfo(resultRecord.getInitRoleId());
Map<Long, Long> staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole());
listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId()));
auth = getAuth(listAuth);
}
List<ResultDetail> resultDetails = resultDetailService.selectByRecordId(recordResultId);
@ -235,14 +241,24 @@ public class ResultRecordController extends AbstractController {
.put("recordResultId", recordResultId);
}
public String initRole(Long staffId,Long roleId){
List<StaffRoleDto> staffRoles = new ArrayList<>();
StaffRoleDto staffRole = new StaffRoleDto() ;
staffRole.setStaffId(staffId);
staffRole.setRoleId(roleId);
staffRoles.add(staffRole);
return JSON.toJSONString(staffRoles);
}
@RequestMapping("/commitApproval")
public R commitApproval(ResultRecordReq req) {
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffEntity.getId());
Long flowId = flowDepartment.getSelfFlowId(); // 表示是部门主管自己
if(flowDepartment == null){
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffEntity.getId());
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffEntity.getId());
Long flowId =flowDepartment !=null ? flowDepartment.getSelfFlowId() : 0l; // 表示是部门主管自己
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffEntity.getId());
if (flowDepartment == null) {
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
flowDepartment = flowDepartmentService.selectByStaffId(leader.getId());
flowId = flowDepartment.getChildFlowId();//表示是部门下的普通员工
@ -255,18 +271,96 @@ public class ResultRecordController extends AbstractController {
}
}
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
Map<String ,FlowDepartment> staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p));
// approvalList = [ONE_D,TWO_D,HR,BOSS]
Map<String, FlowDepartment> staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p));
// approvalList = [ME,ONE_D,TWO_D,HR,BOSS]
List<String> approvalList = new ArrayList<>();
for(FlowRelation flowRelation : flowRelations){
if(staffEntityMap.get(flowRelation.getChild()) != null || flowRelation.getCanReplace() == 0){
approvalList.add("ME");
for (FlowRelation flowRelation : flowRelations) {
if (staffEntityMap.get(flowRelation.getChild()) != null || flowRelation.getCanReplace() == 0) {
approvalList.add(flowRelation.getChild());
}
}
List<Flow> flows = flowService.selectByFlowId(flowId);
FlowRecord lastFlowRecord = flowRecordService.selectLastFlowRecordByRecordId(req.getRecordResultId());
FlowRecord notFlowRecord = flowRecordService.selectNotApprovalStaffIdFlowRecords(resultRecord.getId());
if (notFlowRecord != null) {
notFlowRecord.setApprovalStaffId(getUserId());
StaffEntity mySelf = staffService.selectStaffById(resultRecord.getStaffId());
notFlowRecord.setFlowName(mySelf.getName() + flows.get(notFlowRecord.getFlowIndex() - 1).getOptDesc());
}
StaffEntity staff = staffService.selectStaffById(resultRecord.getStaffId());
FlowRecord flowRecord = new FlowRecord();
flowRecord.setRecordId(req.getRecordResultId());
flowRecord.setRecordStaffId(resultRecord.getStaffId());
flowRecord.setDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;
int index = getDepartmentLevelIndex(flows, flowIndex);
String departmentLevel = approvalList.get(index);
flowRecord.setDepartmentLevel(departmentLevel);
flowRecord.setFlowIndex(flowIndex);
StaffEntity approvalStaff = null;
List<StaffRoleDto> staffRoleDtos = new ArrayList<>();
if (Constant.ME.equals(departmentLevel)) { //如果是自己
approvalStaff = staff; // 是自己进行审批
StaffRoleDto staffRoleDto = new StaffRoleDto(staff.getId(),flows.get(flowIndex-1).getRoleId());
staffRoleDtos.add(staffRoleDto);
} else {
FlowDepartment flowD = staffEntityMap.get(departmentLevel);
if (flowD == null) {
List<StaffRole> staffRoles = staffRoleService.selectByRole(departmentLevel);
for(StaffRole staffRole: staffRoles ){
List<StaffRoleDepartment> staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId());
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(departmentsStaffRelateEntity.getDepartmentId());
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
if(StringUtil.isNotBlank(value) ){
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(),staffRole.getRecordRoleId());
staffRoleDtos.add(staffRoleDto);
}
}
}
if(staffRoleDtos.size() == 1 ){ //表示只有一个审批的用户
approvalStaff = staffService.selectStaffById(staffRoleDtos.get(0).getStaffId());
}
} else {
approvalStaff = staffService.selectStaffById(flowD.getStaffId());
StaffRoleDto staffRoleDto = new StaffRoleDto(approvalStaff.getId(),flows.get(flowIndex-1).getRoleId());
staffRoleDtos.add(staffRoleDto);
}
}
flowRecord.setFlowName((approvalStaff !=null ? approvalStaff.getName() : "")+ flows.get(flowIndex-1).getOptDesc());
flowRecord.setApprovalStaffId(approvalStaff != null ? approvalStaff.getId() : null);
flowRecord.setApprovalStaffName(approvalStaff !=null ? approvalStaff.getName() : null);
flowRecordService.insertFlowRecord(flowRecord);
resultRecord.setFlowStaffIdRole(JSON.toJSONString(staffRoleDtos));
resultRecordService.updateResultRecordById(resultRecord);// 更新用户权限
return R.ok("提交审批成功");
}
public int getDepartmentLevelIndex(List<Flow> list,int flowIndex) {
List<Flow> flows = new ArrayList<>();
for(int i = 0 ;i < flowIndex ;i ++){
flows.add(list.get(i));
}
int index = 0;
for (Flow flow : flows) {
String opt = flow.getOpt();
String opts[] = opt.split("");
for (String p : opts) {
if ("+".equals(p)) {
index++;
} else {
index--;
}
}
}
return index;
}
public void insertWenHuaJiaZhiGua(String target, Long recordId, Long staffId) {
ResultDetail wenhua1 = new ResultDetail();
@ -457,7 +551,7 @@ public class ResultRecordController extends AbstractController {
} else {
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordId());
if (resultRecord == null) {
createResultRecord(req.getRecordType());
createResultRecord(getUserId(), req.getRecordType());
}
recordId = resultRecord.getId();
req.setKeyResult(StringUtil.decodeBase64(req.getKeyResult()));
@ -472,14 +566,13 @@ public class ResultRecordController extends AbstractController {
return R.ok("保存成功").put("recordId", recordId);
}
public ResultRecord createResultRecord(int type) {
public ResultRecord createResultRecord(Long staffId ,int type) {
ResultRecord resultRecord = new ResultRecord();
resultRecord.setMonthTime(new Date());
resultRecord.setCurrentFlowStaffId(getUserId());
if (type == 1) {
resultRecord.setInitRoleId(7l);
resultRecord.setFlowStaffIdRole(initRole(staffId,7l));
} else {
resultRecord.setInitRoleId(8l);
resultRecord.setFlowStaffIdRole(initRole(staffId,8l));
}
resultRecord.setStaffId(getUserId());
resultRecord.setStatus(0);
@ -519,4 +612,6 @@ public class ResultRecordController extends AbstractController {
return R.ok();
}
}

View File

@ -1,5 +1,6 @@
package com.lz.modules.app.dao;
import com.lz.modules.app.dto.DepartmentInfos;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dto.StaffDepartmentDto;
import com.lz.modules.app.entity.DepartmentsEntity;
@ -39,4 +40,6 @@ public interface DepartmentsDao extends BaseMapper<DepartmentsEntity> {
StaffDepartmentDto selectStaffAllDepartments(@Param("departmentId") String departmentId);
int addDepartment(@Param("departments") DepartmentsEntity departments);
DepartmentInfos selectUserAllDepartmentIds(@Param("departmentId") String departmentId);
}

View File

@ -0,0 +1,18 @@
package com.lz.modules.app.dto;
import lombok.Data;
@Data
public class DepartmentInfos {
private String dd1;
private String dn1;
private String dd2;
private String dn2;
private String dd3;
private String dn3;
private String dd4;
private String dn4;
private String dd5;
private String dn5;
}

View File

@ -38,5 +38,7 @@ public interface DepartmentsService extends IService<DepartmentsEntity> {
StaffDepartmentDto selectStaffAllDepartments(String departmentId);
void updateDepartmentInfo(DepartmentInfosBo departmentInfosBo);
Map<String,String> selectUserAllDepartmentIds(String departmentId);
}

View File

@ -7,8 +7,9 @@ import com.google.common.collect.Lists;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.Query;
import com.lz.common.utils.StringUtil;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dao.DepartmentsDao;
import com.lz.modules.app.dto.DepartmentInfos;
import com.lz.modules.app.dto.DepartmentsDto;
import com.lz.modules.app.dto.StaffDepartmentDto;
import com.lz.modules.app.entity.DepartmentsEntity;
import com.lz.modules.app.service.DepartmentsService;
@ -17,6 +18,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -142,5 +144,27 @@ public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsDao, Departme
}
}
@Override
public Map<String, String> selectUserAllDepartmentIds(String departmentId) {
DepartmentInfos departmentInfos = departmentsDao.selectUserAllDepartmentIds(departmentId);
Map<String, String> map = new HashMap<>();
if (StringUtil.isNotBlank(departmentInfos.getDd1())) {
map.put(departmentInfos.getDd1(), departmentInfos.getDn1());
}
if (StringUtil.isNotBlank(departmentInfos.getDd2())) {
map.put(departmentInfos.getDd2(), departmentInfos.getDn2());
}
if (StringUtil.isNotBlank(departmentInfos.getDd3())) {
map.put(departmentInfos.getDd3(), departmentInfos.getDn3());
}
if (StringUtil.isNotBlank(departmentInfos.getDd4())) {
map.put(departmentInfos.getDd4(), departmentInfos.getDn4());
}
if (StringUtil.isNotBlank(departmentInfos.getDd5())) {
map.put(departmentInfos.getDd5(), departmentInfos.getDn5());
}
return map;
}
}

View File

@ -30,4 +30,7 @@ public interface FlowRecordMapper extends BaseMapper<FlowRecord> {
int deleteFlowRecordById(@Param("id")Long id);
FlowRecord selectLastFlowRecordByRecordId(@Param("recordId") Long recordId);
FlowRecord selectNotApprovalStaffIdFlowRecords(@Param("recordId") Long recordId);
}

View File

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.flow.entity.StaffRoleDepartment;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface StaffRoleDepartmentMapper extends BaseMapper<StaffRoleDepartment> {
@ -30,4 +33,5 @@ public interface StaffRoleDepartmentMapper extends BaseMapper<StaffRoleDepartmen
int deleteStaffRoleDepartmentById(@Param("id")Long id);
List<StaffRoleDepartment> selectStaffRoleDepartmentByStaffRoleId(@Param("staffRoleId") Long staffRoleId);
}

View File

@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lz.modules.flow.entity.StaffRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface StaffRoleMapper extends BaseMapper<StaffRole> {
@ -31,4 +34,6 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
StaffRole selectByStaffId(@Param("staffId") Long staffId);
List<StaffRole> selectByRole(@Param("role") String role);
}

View File

@ -9,7 +9,7 @@ import java.util.Date;
* 菜单权限表
* </p>*流转关系表
* @author quyixiao
* @since 2020-08-19
* @since 2020-08-20
*/
@Data
@ -25,7 +25,7 @@ public class FlowDepartment implements java.io.Serializable {
//最后修改时间
private Date gmtModified;
//员工 id
private Long taffId;
private Long staffId;
//自己部门小伙伴 走的 流程id
private Long childFlowId;
//自己走的流程 id
@ -98,15 +98,15 @@ public class FlowDepartment implements java.io.Serializable {
* 员工 id
* @return
*/
public Long getTaffId() {
return taffId;
public Long getStaffId() {
return staffId;
}
/**
* 员工 id
* @param taffId
* @param staffId
*/
public void setTaffId(Long taffId) {
this.taffId = taffId;
public void setStaffId(Long staffId) {
this.staffId = staffId;
}
/**
@ -176,7 +176,7 @@ public class FlowDepartment implements java.io.Serializable {
",isDelete=" + isDelete +
",gmtCreate=" + gmtCreate +
",gmtModified=" + gmtModified +
",taffId=" + taffId +
",staffId=" + staffId +
",childFlowId=" + childFlowId +
",selfFlowId=" + selfFlowId +
",departmentLevel=" + departmentLevel +

View File

@ -9,7 +9,7 @@ import java.util.Date;
* 菜单权限表
* </p>*流转记录表
* @author quyixiao
* @since 2020-08-18
* @since 2020-08-20
*/
@Data
@ -25,7 +25,7 @@ public class FlowRecord implements java.io.Serializable {
//最后修改时间
private Date gmtModified;
//部门 id
private Long departmentId;
private String departmentId;
//
private String departmentLevel;
//记录 id
@ -34,8 +34,6 @@ public class FlowRecord implements java.io.Serializable {
private Long approvalStaffId;
//审批员工名称
private String approvalStaffName;
//角色 id
private Long roleId;
//流程名称
private String flowName;
//record 表中的员工 id
@ -44,8 +42,8 @@ public class FlowRecord implements java.io.Serializable {
private Long flowId;
//流程中的第几个步骤
private Integer flowIndex;
//在人员关系中的第几步
private Integer relationIndex;
//0表示正常状态1 表示被驳回无用的流程
private Integer status;
/**
*
* @return
@ -110,14 +108,14 @@ public class FlowRecord implements java.io.Serializable {
* 部门 id
* @return
*/
public Long getDepartmentId() {
public String getDepartmentId() {
return departmentId;
}
/**
* 部门 id
* @param departmentId
*/
public void setDepartmentId(Long departmentId) {
public void setDepartmentId(String departmentId) {
this.departmentId = departmentId;
}
@ -181,21 +179,6 @@ public class FlowRecord implements java.io.Serializable {
this.approvalStaffName = approvalStaffName;
}
/**
* 角色 id
* @return
*/
public Long getRoleId() {
return roleId;
}
/**
* 角色 id
* @param roleId
*/
public void setRoleId(Long roleId) {
this.roleId = roleId;
}
/**
* 流程名称
* @return
@ -257,18 +240,18 @@ public class FlowRecord implements java.io.Serializable {
}
/**
* 在人员关系中的第几步
* 0表示正常状态1 表示被驳回无用的流程
* @return
*/
public Integer getRelationIndex() {
return relationIndex;
public Integer getStatus() {
return status;
}
/**
* 在人员关系中的第几步
* @param relationIndex
* 0表示正常状态1 表示被驳回无用的流程
* @param status
*/
public void setRelationIndex(Integer relationIndex) {
this.relationIndex = relationIndex;
public void setStatus(Integer status) {
this.status = status;
}
@Override
@ -283,12 +266,11 @@ public class FlowRecord implements java.io.Serializable {
",recordId=" + recordId +
",approvalStaffId=" + approvalStaffId +
",approvalStaffName=" + approvalStaffName +
",roleId=" + roleId +
",flowName=" + flowName +
",recordStaffId=" + recordStaffId +
",flowId=" + flowId +
",flowIndex=" + flowIndex +
",relationIndex=" + relationIndex +
",status=" + status +
"}";
}
}

View File

@ -9,7 +9,7 @@ import java.util.Date;
* 菜单权限表
* </p>*流转关系表
* @author quyixiao
* @since 2020-08-18
* @since 2020-08-20
*/
@Data
@ -28,6 +28,8 @@ public class StaffRole implements java.io.Serializable {
private Long staffId;
//角色
private String role;
//角色 id
private Long recordRoleId;
/**
*
* @return
@ -118,6 +120,21 @@ public class StaffRole implements java.io.Serializable {
this.role = role;
}
/**
* 角色 id
* @return
*/
public Long getRecordRoleId() {
return recordRoleId;
}
/**
* 角色 id
* @param recordRoleId
*/
public void setRecordRoleId(Long recordRoleId) {
this.recordRoleId = recordRoleId;
}
@Override
public String toString() {
return "StaffRole{" +
@ -127,6 +144,7 @@ public class StaffRole implements java.io.Serializable {
",gmtModified=" + gmtModified +
",staffId=" + staffId +
",role=" + role +
",recordRoleId=" + recordRoleId +
"}";
}
}

View File

@ -0,0 +1,19 @@
package com.lz.modules.flow.model;
import lombok.Data;
@Data
public class StaffRoleDto {
private Long staffId;
private Long roleId;
public StaffRoleDto() {
}
public StaffRoleDto(Long staffId, Long roleId) {
this.staffId = staffId;
this.roleId = roleId;
}
}

View File

@ -30,5 +30,7 @@ public interface FlowRecordService extends IService<FlowRecord> {
int deleteFlowRecordById(Long id);
FlowRecord selectLastFlowRecordByRecordId(Long recordResultId);
FlowRecord selectNotApprovalStaffIdFlowRecords(Long recordId);
}

View File

@ -34,4 +34,6 @@ public interface RecordAuthService extends IService<RecordAuth> {
List<RecordAuth> selectAuthInfo(Long roldId);
Map<Long ,Long > selectRoleIdByStaffRoleInfo(String flowStaffIdRole);
}

View File

@ -3,6 +3,8 @@ package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.flow.entity.StaffRoleDepartment;
import java.util.List;
/**
* <p>
* 流转关系表 服务类
@ -30,4 +32,5 @@ public interface StaffRoleDepartmentService extends IService<StaffRoleDepartment
int deleteStaffRoleDepartmentById(Long id);
List<StaffRoleDepartment> selectStaffRoleDepartmentByStaffRoleId(Long staffRoleId);
}

View File

@ -3,6 +3,8 @@ package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.modules.flow.entity.StaffRole;
import java.util.List;
/**
* <p>
* 流转关系表 服务类
@ -31,4 +33,6 @@ public interface StaffRoleService extends IService<StaffRole> {
StaffRole selectByStaffId(Long staffId);
List<StaffRole> selectByRole(String departmentLevel);
}

View File

@ -51,14 +51,20 @@ public class FlowRecordServiceImpl extends ServiceImpl<FlowRecordMapper, FlowRec
return flowRecordMapper.updateCoverFlowRecordById(flowRecord);
}
@Override
public int deleteFlowRecordById(Long id){
return flowRecordMapper.deleteFlowRecordById(id);
}
@Override
public FlowRecord selectLastFlowRecordByRecordId(Long recordId) {
return flowRecordMapper.selectLastFlowRecordByRecordId(recordId);
}
@Override
public FlowRecord selectNotApprovalStaffIdFlowRecords(Long recordId) {
return flowRecordMapper.selectNotApprovalStaffIdFlowRecords(recordId);
}
}

View File

@ -1,14 +1,20 @@
package com.lz.modules.flow.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.StringUtil;
import com.lz.modules.flow.dao.RecordAuthMapper;
import com.lz.modules.flow.entity.RecordAuth;
import com.lz.modules.flow.model.StaffRoleDto;
import com.lz.modules.flow.service.RecordAuthService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
@ -64,5 +70,17 @@ public class RecordAuthServiceImpl extends ServiceImpl<RecordAuthMapper, RecordA
return recordAuthMapper.selectAuthInfo(roleId);
}
@Override
public Map<Long, Long> selectRoleIdByStaffRoleInfo(String flowStaffIdRole) {
Map<Long, Long> staffEntityMap = new HashMap<>();
if (StringUtil.isNotBlank(flowStaffIdRole)) {
List<StaffRoleDto> list = JSONObject.parseArray(flowStaffIdRole, StaffRoleDto.class);
if (CollectionUtils.isNotEmpty(list)) {
staffEntityMap = list.stream().collect(Collectors.toMap(StaffRoleDto::getStaffId, StaffRoleDto::getRole));
}
}
return staffEntityMap;
}
}

View File

@ -7,6 +7,8 @@ import com.lz.modules.flow.service.StaffRoleDepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 流转关系表 服务类
@ -58,8 +60,10 @@ public class StaffRoleDepartmentServiceImpl extends ServiceImpl<StaffRoleDepartm
return staffRoleDepartmentMapper.deleteStaffRoleDepartmentById(id);
}
@Override
public List<StaffRoleDepartment> selectStaffRoleDepartmentByStaffRoleId(Long staffRoleId) {
return staffRoleDepartmentMapper.selectStaffRoleDepartmentByStaffRoleId(staffRoleId);
}
}

View File

@ -7,6 +7,8 @@ import com.lz.modules.flow.service.StaffRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* <p>
* 流转关系表 服务类
@ -63,5 +65,10 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
return staffRoleMapper.selectByStaffId(staffId);
}
@Override
public List<StaffRole> selectByRole(String role) {
return staffRoleMapper.selectByRole(role);
}
}

View File

@ -11,7 +11,7 @@ import java.util.Date;
* 菜单权限表
* </p>*业绩记录表
* @author quyixiao
* @since 2020-08-18
* @since 2020-08-20
*/
@Data
@ -40,10 +40,8 @@ public class ResultRecord implements java.io.Serializable {
private Long staffId;
//类型 ,1 表示提交目标2 表示提交结果
private Integer type;
//在新建时的角色 id
private Long initRoleId;
//当前审批流转所在员工 id
private Long currentFlowStaffId;
private String flowStaffIdRole;
/**
*
* @return
@ -209,34 +207,19 @@ public class ResultRecord implements java.io.Serializable {
this.type = type;
}
/**
* 在新建时的角色 id
* @return
*/
public Long getInitRoleId() {
return initRoleId;
}
/**
* 在新建时的角色 id
* @param initRoleId
*/
public void setInitRoleId(Long initRoleId) {
this.initRoleId = initRoleId;
}
/**
* 当前审批流转所在员工 id
* @return
*/
public Long getCurrentFlowStaffId() {
return currentFlowStaffId;
public String getFlowStaffIdRole() {
return flowStaffIdRole;
}
/**
* 当前审批流转所在员工 id
* @param currentFlowStaffId
* @param flowStaffIdRole
*/
public void setCurrentFlowStaffId(Long currentFlowStaffId) {
this.currentFlowStaffId = currentFlowStaffId;
public void setFlowStaffIdRole(String flowStaffIdRole) {
this.flowStaffIdRole = flowStaffIdRole;
}
@Override
@ -253,8 +236,7 @@ public class ResultRecord implements java.io.Serializable {
",remark=" + remark +
",staffId=" + staffId +
",type=" + type +
",initRoleId=" + initRoleId +
",currentFlowStaffId=" + currentFlowStaffId +
",flowStaffIdRole=" + flowStaffIdRole +
"}";
}
}

View File

@ -97,6 +97,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
if (StringUtil.isNotBlank(params.getDepartment1()) || StringUtil.isNotBlank(params.getDepartment2())
|| StringUtil.isNotBlank(params.getDepartment3())) {
Map<String,List<DepartmentsEntity>> departmentMap = null;
if(employeesDto == null || employeesDto.getExpire() < new Date().getTime()){
departmentMap = getStringListMap(tDepartments);
Date expire = DateUtils.addMinute(new Date(),30);

View File

@ -15,16 +15,18 @@
<result column="remark" property="remark"/>
<result column="staff_id" property="staffId"/>
<result column="type" property="type"/>
<result column="init_role_id" property="initRoleId"/>
<result column="current_flow_staff_id" property="currentFlowStaffId"/>
<result column="flow_staff_id_role" property="flowStaffIdRole"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, month_time AS monthTime, status AS status, last_score AS lastScore, all_score AS allScore, remark AS remark, staff_id AS staffId, type AS type, init_role_id AS initRoleId, current_flow_staff_id AS currentFlowStaffId
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, month_time AS monthTime, status AS status, last_score AS lastScore, all_score AS allScore, remark AS remark, staff_id AS staffId, type AS type, flow_staff_id_role AS flowStaffIdRole
</sql>
<select id="selectResultRecordById" resultType="ResultRecord" >
select * from lz_result_record where id=#{id} and is_delete = 0 limit 1
</select>
@ -39,8 +41,7 @@
<if test="remark != null">remark, </if>
<if test="staffId != null">staff_id, </if>
<if test="type != null">type, </if>
<if test="initRoleId != null">init_role_id, </if>
<if test="currentFlowStaffId != null">current_flow_staff_id, </if>
<if test="flowStaffIdRole != null">flow_staff_id_role, </if>
is_delete,
gmt_create,
gmt_modified
@ -52,8 +53,7 @@
<if test="remark != null">#{ remark}, </if>
<if test="staffId != null">#{ staffId}, </if>
<if test="type != null">#{ type}, </if>
<if test="initRoleId != null">#{ initRoleId}, </if>
<if test="currentFlowStaffId != null">#{ currentFlowStaffId}, </if>
<if test="flowStaffIdRole != null">#{ flowStaffIdRole}, </if>
0,
now(),
now()
@ -74,8 +74,7 @@
<if test="remark != null">remark = #{remark},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="type != null">type = #{type},</if>
<if test="initRoleId != null">init_role_id = #{initRoleId},</if>
<if test="currentFlowStaffId != null">current_flow_staff_id = #{currentFlowStaffId}</if>
<if test="flowStaffIdRole != null">flow_staff_id_role = #{flowStaffIdRole}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -95,18 +94,16 @@
remark = #{remark},
staff_id = #{staffId},
type = #{type},
init_role_id = #{initRoleId},
current_flow_staff_id = #{currentFlowStaffId}
flow_staff_id_role = #{flowStaffIdRole}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteResultRecordById" parameterType="java.lang.Long">
update lz_result_record set is_delete = 1 where id=#{id} limit 1
update lz_result_record set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectByCondition" resultType="com.lz.modules.sys.entity.app.ResultRecord">
select * from lz_result_record where is_delete = 0
<if test="req.monthBeginDate != null and req.monthBeginDate != '' ">

View File

@ -8,7 +8,7 @@
<result column="is_delete" property="isDelete"/>
<result column="gmt_create" property="gmtCreate"/>
<result column="gmt_modified" property="gmtModified"/>
<result column="taff_id" property="taffId"/>
<result column="staff_id" property="staffId"/>
<result column="child_flow_id" property="childFlowId"/>
<result column="self_flow_id" property="selfFlowId"/>
<result column="department_level" property="departmentLevel"/>
@ -18,7 +18,7 @@
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, taff_id AS taffId, child_flow_id AS childFlowId, self_flow_id AS selfFlowId, department_level AS departmentLevel, parent_id AS parentId
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, child_flow_id AS childFlowId, self_flow_id AS selfFlowId, department_level AS departmentLevel, parent_id AS parentId
</sql>
@ -31,7 +31,7 @@
<insert id="insertFlowDepartment" parameterType="FlowDepartment" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_department(
<if test="taffId != null">taff_id, </if>
<if test="staffId != null">staff_id, </if>
<if test="childFlowId != null">child_flow_id, </if>
<if test="selfFlowId != null">self_flow_id, </if>
<if test="departmentLevel != null">department_level, </if>
@ -40,7 +40,7 @@
gmt_create,
gmt_modified
)values(
<if test="taffId != null">#{ taffId}, </if>
<if test="staffId != null">#{ staffId}, </if>
<if test="childFlowId != null">#{ childFlowId}, </if>
<if test="selfFlowId != null">#{ selfFlowId}, </if>
<if test="departmentLevel != null">#{ departmentLevel}, </if>
@ -58,7 +58,7 @@
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="taffId != null">taff_id = #{taffId},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="childFlowId != null">child_flow_id = #{childFlowId},</if>
<if test="selfFlowId != null">self_flow_id = #{selfFlowId},</if>
<if test="departmentLevel != null">department_level = #{departmentLevel},</if>
@ -75,7 +75,7 @@
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
taff_id = #{taffId},
staff_id = #{staffId},
child_flow_id = #{childFlowId},
self_flow_id = #{selfFlowId},
department_level = #{departmentLevel},
@ -89,6 +89,7 @@
update lz_flow_department set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectByStaffId" resultType="com.lz.modules.flow.entity.FlowDepartment">
select * from lz_flow_department where is_delete = 0 and taff_id = #{staffId} limit 1
</select>

View File

@ -13,66 +13,63 @@
<result column="record_id" property="recordId"/>
<result column="approval_staff_id" property="approvalStaffId"/>
<result column="approval_staff_name" property="approvalStaffName"/>
<result column="role_id" property="roleId"/>
<result column="flow_name" property="flowName"/>
<result column="record_staff_id" property="recordStaffId"/>
<result column="flow_id" property="flowId"/>
<result column="flow_index" property="flowIndex"/>
<result column="relation_index" property="relationIndex"/>
<result column="status" property="status"/>
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, department_id AS departmentId, department_level AS departmentLevel, record_id AS recordId, approval_staff_id AS approvalStaffId, approval_staff_name AS approvalStaffName, role_id AS roleId, flow_name AS flowName, record_staff_id AS recordStaffId, flow_id AS flowId, flow_index AS flowIndex, relation_index AS relationIndex
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, department_id AS departmentId, department_level AS departmentLevel, record_id AS recordId, approval_staff_id AS approvalStaffId, approval_staff_name AS approvalStaffName, flow_name AS flowName, record_staff_id AS recordStaffId, flow_id AS flowId, flow_index AS flowIndex, status AS status
</sql>
<select id="selectFlowRecordById" resultType="FlowRecord" >
select * from lz_flow_record where id=#{id} and is_delete = 0 limit 1
select * from lz_flow_record where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertFlowRecord" parameterType="FlowRecord" useGeneratedKeys="true" keyProperty="id" >
insert into lz_flow_record(
<if test="departmentId != null">department_id, </if>
<if test="departmentLevel != null">department_level, </if>
<if test="recordId != null">record_id, </if>
<if test="approvalStaffId != null">approval_staff_id, </if>
<if test="approvalStaffName != null">approval_staff_name, </if>
<if test="roleId != null">role_id, </if>
<if test="flowName != null">flow_name, </if>
<if test="recordStaffId != null">record_staff_id, </if>
<if test="flowId != null">flow_id, </if>
<if test="flowIndex != null">flow_index, </if>
<if test="relationIndex != null">relation_index, </if>
is_delete,
gmt_create,
gmt_modified
<if test="departmentId != null">department_id, </if>
<if test="departmentLevel != null">department_level, </if>
<if test="recordId != null">record_id, </if>
<if test="approvalStaffId != null">approval_staff_id, </if>
<if test="approvalStaffName != null">approval_staff_name, </if>
<if test="flowName != null">flow_name, </if>
<if test="recordStaffId != null">record_staff_id, </if>
<if test="flowId != null">flow_id, </if>
<if test="flowIndex != null">flow_index, </if>
<if test="status != null">status, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="departmentId != null">#{ departmentId}, </if>
<if test="departmentLevel != null">#{ departmentLevel}, </if>
<if test="recordId != null">#{ recordId}, </if>
<if test="approvalStaffId != null">#{ approvalStaffId}, </if>
<if test="approvalStaffName != null">#{ approvalStaffName}, </if>
<if test="roleId != null">#{ roleId}, </if>
<if test="flowName != null">#{ flowName}, </if>
<if test="recordStaffId != null">#{ recordStaffId}, </if>
<if test="flowId != null">#{ flowId}, </if>
<if test="flowIndex != null">#{ flowIndex}, </if>
<if test="relationIndex != null">#{ relationIndex}, </if>
0,
now(),
now()
<if test="departmentId != null">#{ departmentId}, </if>
<if test="departmentLevel != null">#{ departmentLevel}, </if>
<if test="recordId != null">#{ recordId}, </if>
<if test="approvalStaffId != null">#{ approvalStaffId}, </if>
<if test="approvalStaffName != null">#{ approvalStaffName}, </if>
<if test="flowName != null">#{ flowName}, </if>
<if test="recordStaffId != null">#{ recordStaffId}, </if>
<if test="flowId != null">#{ flowId}, </if>
<if test="flowIndex != null">#{ flowIndex}, </if>
<if test="status != null">#{ status}, </if>
0,
now(),
now()
)
</insert>
<update id="updateFlowRecordById" parameterType="FlowRecord" >
update
lz_flow_record
lz_flow_record
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
@ -81,12 +78,11 @@
<if test="recordId != null">record_id = #{recordId},</if>
<if test="approvalStaffId != null">approval_staff_id = #{approvalStaffId},</if>
<if test="approvalStaffName != null">approval_staff_name = #{approvalStaffName},</if>
<if test="roleId != null">role_id = #{roleId},</if>
<if test="flowName != null">flow_name = #{flowName},</if>
<if test="recordStaffId != null">record_staff_id = #{recordStaffId},</if>
<if test="flowId != null">flow_id = #{flowId},</if>
<if test="flowIndex != null">flow_index = #{flowIndex},</if>
<if test="relationIndex != null">relation_index = #{relationIndex}</if>
<if test="status != null">status = #{status}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -95,8 +91,8 @@
<update id="updateCoverFlowRecordById" parameterType="FlowRecord" >
update
lz_flow_record
set
lz_flow_record
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
department_id = #{departmentId},
@ -104,20 +100,29 @@
record_id = #{recordId},
approval_staff_id = #{approvalStaffId},
approval_staff_name = #{approvalStaffName},
role_id = #{roleId},
flow_name = #{flowName},
record_staff_id = #{recordStaffId},
flow_id = #{flowId},
flow_index = #{flowIndex},
relation_index = #{relationIndex}
status = #{status}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteFlowRecordById" parameterType="java.lang.Long">
update lz_flow_record set is_delete = 1 where id=#{id} limit 1
update lz_flow_record set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectLastFlowRecordByRecordId" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and status = 0 order by id desc limit 1
</select>
<select id="selectNotApprovalStaffIdFlowRecords" resultType="com.lz.modules.flow.entity.FlowRecord">
select * from lz_flow_record where is_delete = 0 and record_id = #{recordId} and status = 0 and (approval_staff_id is null or approval_staff_id = '') order by id desc limit 1
</select>
</mapper>

View File

@ -74,5 +74,13 @@
update lz_staff_role_department set is_delete = 1 where id=#{id} limit 1
</update>
<select id="selectStaffRoleDepartmentByStaffRoleId" resultType="com.lz.modules.flow.entity.StaffRoleDepartment">
select * from lz_staff_role_department where staff_role_id=#{staffRoleId} and is_delete = 0 limit 1
</select>
</mapper>

View File

@ -10,47 +10,51 @@
<result column="gmt_modified" property="gmtModified"/>
<result column="staff_id" property="staffId"/>
<result column="role" property="role"/>
<result column="record_role_id" property="recordRoleId"/>
</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, role AS role
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, role AS role, record_role_id AS recordRoleId
</sql>
<select id="selectStaffRoleById" resultType="StaffRole" >
select * from lz_staff_role where id=#{id} and is_delete = 0 limit 1
select * from lz_staff_role where id=#{id} and is_delete = 0 limit 1
</select>
<insert id="insertStaffRole" parameterType="StaffRole" useGeneratedKeys="true" keyProperty="id" >
insert into lz_staff_role(
<if test="staffId != null">staff_id, </if>
<if test="role != null">role, </if>
is_delete,
gmt_create,
gmt_modified
<if test="staffId != null">staff_id, </if>
<if test="role != null">role, </if>
<if test="recordRoleId != null">record_role_id, </if>
is_delete,
gmt_create,
gmt_modified
)values(
<if test="staffId != null">#{ staffId}, </if>
<if test="role != null">#{ role}, </if>
0,
now(),
now()
<if test="staffId != null">#{ staffId}, </if>
<if test="role != null">#{ role}, </if>
<if test="recordRoleId != null">#{ recordRoleId}, </if>
0,
now(),
now()
)
</insert>
<update id="updateStaffRoleById" parameterType="StaffRole" >
update
lz_staff_role
lz_staff_role
<trim prefix="set" suffixOverrides=",">
<if test="isDelete != null">is_delete = #{isDelete},</if>
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
<if test="staffId != null">staff_id = #{staffId},</if>
<if test="role != null">role = #{role}</if>
<if test="role != null">role = #{role},</if>
<if test="recordRoleId != null">record_role_id = #{recordRoleId}</if>
</trim>
,gmt_modified = now()
where id = #{id}
@ -59,23 +63,29 @@
<update id="updateCoverStaffRoleById" parameterType="StaffRole" >
update
lz_staff_role
set
lz_staff_role
set
is_delete = #{isDelete},
gmt_create = #{gmtCreate},
staff_id = #{staffId},
role = #{role}
role = #{role},
record_role_id = #{recordRoleId}
,gmt_modified = now()
where id = #{id}
</update>
<update id="deleteStaffRoleById" parameterType="java.lang.Long">
update lz_staff_role set is_delete = 1 where id=#{id} limit 1
update lz_staff_role set is_delete = 1 where id=#{id} limit 1
</update>
<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 id="selectByRole" resultType="com.lz.modules.flow.entity.StaffRole">
select * from lz_staff_role where is_delete = 0 and role = #{role}
</select>

View File

@ -91,6 +91,7 @@
where a.department_id = #{departmentId}
</select>
<insert id="addDepartment" useGeneratedKeys="true" keyProperty="id">
INSERT INTO
lz_departments(department_id,department_parent_id,member_count,department_name,chat_id,leader_employee_id,leader_open_id,status)
@ -100,4 +101,19 @@
</insert>
<select id="selectUserAllDepartmentIds" resultType="com.lz.modules.app.dto.DepartmentInfos">
select
d1.department_id dd1,d1.department_name dn1 ,
d2.department_id dd2,d2.department_name dn2,
d3.department_id dd3,d3.department_name dn3 ,
d4.department_id dd4,d4.department_name dn4,
d5.department_id dd5,d5.department_name dn5
from lz_departments d1
left join lz_departments d2 on d1.department_parent_id = d2.department_id
left join lz_departments d3 on d2.department_parent_id = d3.department_id
left join lz_departments d4 on d3.department_parent_id = d4.department_id
left join lz_departments d5 on d4.department_parent_id = d5.department_id
where d1.department_id = #{departmentId}
</select>
</mapper>

View File

@ -61,7 +61,8 @@ public class MysqlMain {
}
List<TablesBean> list = new ArrayList<TablesBean>();
list.add(new TablesBean("lz_flow_department"));
list.add(new TablesBean("lz_staff_role"));
List<TablesBean> list2 = new ArrayList<TablesBean>();
Map<String, String> map = MysqlUtil2ShowCreateTable.getComments();