提交修改
This commit is contained in:
parent
00ed287025
commit
9b9ed98db6
@ -106,13 +106,11 @@ 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());
|
||||
@ -255,12 +253,13 @@ public class ResultRecordController extends AbstractController {
|
||||
public R commitApproval(ResultRecordReq req) {
|
||||
ResultRecord resultRecord = resultRecordService.selectResultRecordById(req.getRecordResultId());
|
||||
StaffEntity staffEntity = staffService.selectStaffById(resultRecord.getStaffId());
|
||||
StaffEntity mySelf = staffService.selectStaffById(getUserId());
|
||||
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffEntity.getId());
|
||||
Long flowId =flowDepartment !=null ? flowDepartment.getSelfFlowId() : 0l; // 表示是部门主管自己
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffEntity.getId());
|
||||
Long flowId = flowDepartment != null ? flowDepartment.getSelfFlowId() : 0l; // 表示是部门主管自己
|
||||
if (flowDepartment == null) {
|
||||
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffEntity.getId());
|
||||
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
|
||||
flowDepartment = flowDepartmentService.selectByStaffId(leader.getId());
|
||||
flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId());
|
||||
flowId = flowDepartment.getChildFlowId();//表示是部门下的普通员工
|
||||
}
|
||||
List<FlowDepartment> list = new ArrayList<>();
|
||||
@ -268,6 +267,9 @@ public class ResultRecordController extends AbstractController {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
if (flowDepartment.getParentId() != null && flowDepartment.getParentId() > 0) {
|
||||
flowDepartment = flowDepartmentService.selectFlowDepartmentById(flowDepartment.getParentId());
|
||||
list.add(flowDepartment);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<FlowRelation> flowRelations = flowRelationService.selectFlowRelationAll();
|
||||
@ -280,28 +282,31 @@ public class ResultRecordController extends AbstractController {
|
||||
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());
|
||||
int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1;
|
||||
int index = getDepartmentLevelIndex(flows, flowIndex);
|
||||
if (index < 0) { //表示流程己经结束
|
||||
lastFlowRecord.setFlowName(mySelf.getName() + "-审批通过");
|
||||
flowRecordService.updateCoverFlowRecordById(lastFlowRecord);
|
||||
resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId());// 更新用户权限
|
||||
return R.ok("流程审批结束");
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
flowRecord.setFlowIndex(flowIndex);
|
||||
flowRecord.setFlowId(flowId);
|
||||
String departmentLevel = approvalList.get(index);
|
||||
flowRecord.setDepartmentLevel(departmentLevel);
|
||||
flowRecord.setFlowIndex(flowIndex);
|
||||
|
||||
StaffEntity approvalStaff = null;
|
||||
List<StaffRoleDto> staffRoleDtos = new ArrayList<>();
|
||||
if (Constant.ME.equals(departmentLevel)) { //如果是自己
|
||||
@ -314,11 +319,11 @@ public class ResultRecordController extends AbstractController {
|
||||
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());
|
||||
Map<String, String> departmentIdMap = departmentsService.selectUserAllDepartmentIds(resultRecord.getDepartmentId());
|
||||
for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) {
|
||||
String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId());
|
||||
if(StringUtil.isNotBlank(value) ){
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(),staffRole.getRecordRoleId());
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(staffRole.getStaffId(),staffRole.getRoleId());
|
||||
staffRoleDtos.add(staffRoleDto);
|
||||
}
|
||||
}
|
||||
@ -328,14 +333,13 @@ public class ResultRecordController extends AbstractController {
|
||||
}
|
||||
} else {
|
||||
approvalStaff = staffService.selectStaffById(flowD.getStaffId());
|
||||
StaffRoleDto staffRoleDto = new StaffRoleDto(approvalStaff.getId(),flows.get(flowIndex-1).getRoleId());
|
||||
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.setFlowName(mySelf.getName() + "-" + flows.get(flowIndex - 1).getOptDesc());
|
||||
flowRecord.setApprovalStaffId(approvalStaff != null ? approvalStaff.getId() : null);
|
||||
flowRecord.setApprovalStaffName(approvalStaff !=null ? approvalStaff.getName() : null);
|
||||
|
||||
flowRecord.setApprovalStaffName(approvalStaff != null ? approvalStaff.getName() : null);
|
||||
flowRecordService.insertFlowRecord(flowRecord);
|
||||
resultRecord.setFlowStaffIdRole(JSON.toJSONString(staffRoleDtos));
|
||||
resultRecordService.updateResultRecordById(resultRecord);// 更新用户权限
|
||||
@ -343,6 +347,9 @@ public class ResultRecordController extends AbstractController {
|
||||
}
|
||||
|
||||
public int getDepartmentLevelIndex(List<Flow> list,int flowIndex) {
|
||||
if(flowIndex > list.size()){
|
||||
return -1 ;
|
||||
}
|
||||
List<Flow> flows = new ArrayList<>();
|
||||
for(int i = 0 ;i < flowIndex ;i ++){
|
||||
flows.add(list.get(i));
|
||||
@ -612,6 +619,4 @@ public class ResultRecordController extends AbstractController {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -22,8 +22,8 @@ public class ResultRecordReq {
|
||||
private String name;
|
||||
private String remark;
|
||||
|
||||
private List<Long> departmentStaffIds;
|
||||
private List<Long> staffIds;
|
||||
private List<String> departmentIds;
|
||||
|
||||
private Long recordResultId;
|
||||
private BigDecimal weight = new BigDecimal(0);
|
||||
private Integer type;
|
||||
@ -31,4 +31,5 @@ public class ResultRecordReq {
|
||||
private Integer isSelf = 1;
|
||||
private Long staffId;
|
||||
private Integer recordType;
|
||||
private String departmentLevel ;
|
||||
}
|
||||
|
||||
@ -35,5 +35,5 @@ public interface StaffRoleMapper extends BaseMapper<StaffRole> {
|
||||
|
||||
StaffRole selectByStaffId(@Param("staffId") Long staffId);
|
||||
|
||||
List<StaffRole> selectByRole(@Param("role") String role);
|
||||
List<StaffRole> selectByRole(@Param("departmentLevel") String departmentLevel);
|
||||
}
|
||||
@ -24,8 +24,6 @@ public class FlowRecord implements java.io.Serializable {
|
||||
private Date gmtCreate;
|
||||
//最后修改时间
|
||||
private Date gmtModified;
|
||||
//部门 id
|
||||
private String departmentId;
|
||||
//
|
||||
private String departmentLevel;
|
||||
//记录 id
|
||||
@ -104,21 +102,6 @@ public class FlowRecord implements java.io.Serializable {
|
||||
this.gmtModified = gmtModified;
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门 id
|
||||
* @return
|
||||
*/
|
||||
public String getDepartmentId() {
|
||||
return departmentId;
|
||||
}
|
||||
/**
|
||||
* 部门 id
|
||||
* @param departmentId
|
||||
*/
|
||||
public void setDepartmentId(String departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -261,7 +244,6 @@ public class FlowRecord implements java.io.Serializable {
|
||||
",isDelete=" + isDelete +
|
||||
",gmtCreate=" + gmtCreate +
|
||||
",gmtModified=" + gmtModified +
|
||||
",departmentId=" + departmentId +
|
||||
",departmentLevel=" + departmentLevel +
|
||||
",recordId=" + recordId +
|
||||
",approvalStaffId=" + approvalStaffId +
|
||||
|
||||
@ -27,9 +27,9 @@ public class StaffRole implements java.io.Serializable {
|
||||
//员工 id
|
||||
private Long staffId;
|
||||
//角色
|
||||
private String role;
|
||||
private String departmentLevel;
|
||||
//角色 id
|
||||
private Long recordRoleId;
|
||||
private Long roleId;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -109,30 +109,30 @@ public class StaffRole implements java.io.Serializable {
|
||||
* 角色
|
||||
* @return
|
||||
*/
|
||||
public String getRole() {
|
||||
return role;
|
||||
public String getDepartmentLevel() {
|
||||
return departmentLevel;
|
||||
}
|
||||
/**
|
||||
* 角色
|
||||
* @param role
|
||||
* @param departmentLevel
|
||||
*/
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
public void setDepartmentLevel(String departmentLevel) {
|
||||
this.departmentLevel = departmentLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色 id
|
||||
* @return
|
||||
*/
|
||||
public Long getRecordRoleId() {
|
||||
return recordRoleId;
|
||||
public Long getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
/**
|
||||
* 角色 id
|
||||
* @param recordRoleId
|
||||
* @param roleId
|
||||
*/
|
||||
public void setRecordRoleId(Long recordRoleId) {
|
||||
this.recordRoleId = recordRoleId;
|
||||
public void setRoleId(Long roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -143,8 +143,8 @@ public class StaffRole implements java.io.Serializable {
|
||||
",gmtCreate=" + gmtCreate +
|
||||
",gmtModified=" + gmtModified +
|
||||
",staffId=" + staffId +
|
||||
",role=" + role +
|
||||
",recordRoleId=" + recordRoleId +
|
||||
",departmentLevel=" + departmentLevel +
|
||||
",roleId=" + roleId +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@ public class StaffRoleDepartment implements java.io.Serializable {
|
||||
//
|
||||
private Long staffRoleId;
|
||||
//
|
||||
private Long departmentId;
|
||||
private String departmentId;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -107,14 +107,14 @@ public class StaffRoleDepartment implements java.io.Serializable {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Long getDepartmentId() {
|
||||
public String getDepartmentId() {
|
||||
return departmentId;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param departmentId
|
||||
*/
|
||||
public void setDepartmentId(Long departmentId) {
|
||||
public void setDepartmentId(String departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
|
||||
16
src/main/java/com/lz/modules/flow/model/ResultRecordDto.java
Normal file
16
src/main/java/com/lz/modules/flow/model/ResultRecordDto.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.lz.modules.flow.model;
|
||||
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class ResultRecordDto extends ResultRecord {
|
||||
private String departmentLevel;
|
||||
private String approvalStaffId;
|
||||
private String approvalStaffName;
|
||||
private String flowName;
|
||||
private Integer flowId;
|
||||
private Integer flowIndex;
|
||||
|
||||
}
|
||||
@ -1,7 +1,11 @@
|
||||
package com.lz.modules.flow.model;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StaffRoleDto {
|
||||
private Long staffId;
|
||||
@ -16,4 +20,11 @@ public class StaffRoleDto {
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<StaffRoleDto> staffRoleDtoList = new ArrayList<>();
|
||||
//StaffRoleDto staffRoleDto = new StaffRoleDto(314l,6l);
|
||||
//staffRoleDtoList.add(staffRoleDto);
|
||||
System.out.println(JSON.toJSONString(staffRoleDtoList));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -66,9 +66,8 @@ public class StaffRoleServiceImpl extends ServiceImpl<StaffRoleMapper, StaffRole
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StaffRole> selectByRole(String role) {
|
||||
return staffRoleMapper.selectByRole(role);
|
||||
public List<StaffRole> selectByRole(String departmentLevel) {
|
||||
return staffRoleMapper.selectByRole(departmentLevel);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.lz.modules.app.req.ResultRecordReq;
|
||||
import com.lz.modules.flow.model.ResultRecordDto;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -43,4 +44,8 @@ public interface ResultRecordMapper extends BaseMapper<ResultRecord> {
|
||||
List<ResultRecord> selectByConditionTest(ResultRecordReq req);
|
||||
|
||||
ResultRecord selectResultRecordByStaffId(@Param("staffId") Long staffId);
|
||||
|
||||
List<ResultRecordDto> selectByConditionByLeader(@Param("page") IPage page, @Param("req") ResultRecordReq params);
|
||||
|
||||
void updateFlowStaffIdRoleToNull(@Param("id") Long id);
|
||||
}
|
||||
@ -42,6 +42,12 @@ public class ResultRecord implements java.io.Serializable {
|
||||
private Integer type;
|
||||
//当前审批流转所在员工 id
|
||||
private String flowStaffIdRole;
|
||||
//员工所在部门 id
|
||||
private String departmentId;
|
||||
//员工所在部门名称
|
||||
private String departmentName;
|
||||
//员工姓名
|
||||
private String staffName;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -222,6 +228,55 @@ public class ResultRecord implements java.io.Serializable {
|
||||
this.flowStaffIdRole = flowStaffIdRole;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工所在部门 id
|
||||
* @return
|
||||
*/
|
||||
public String getDepartmentId() {
|
||||
return departmentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工所在部门 id
|
||||
*
|
||||
* @param departmentId
|
||||
*/
|
||||
public void setDepartmentId(String departmentId) {
|
||||
this.departmentId = departmentId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工所在部门名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getDepartmentName() {
|
||||
return departmentName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工所在部门名称
|
||||
* @param departmentName
|
||||
*/
|
||||
public void setDepartmentName(String departmentName) {
|
||||
this.departmentName = departmentName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 员工姓名
|
||||
* @return
|
||||
*/
|
||||
public String getStaffName() {
|
||||
return staffName;
|
||||
}
|
||||
/**
|
||||
* 员工姓名
|
||||
* @param staffName
|
||||
*/
|
||||
public void setStaffName(String staffName) {
|
||||
this.staffName = staffName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResultRecord{" +
|
||||
@ -237,6 +292,9 @@ public class ResultRecord implements java.io.Serializable {
|
||||
",staffId=" + staffId +
|
||||
",type=" + type +
|
||||
",flowStaffIdRole=" + flowStaffIdRole +
|
||||
",departmentId=" + departmentId +
|
||||
",departmentName=" + departmentName +
|
||||
",staffName=" + staffName +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -41,4 +41,6 @@ public interface ResultRecordService extends IService<ResultRecord> {
|
||||
void deleteBatchIds(List<Long> asList);
|
||||
|
||||
ResultRecord selectResultRecordByStaffId(Long userId);
|
||||
|
||||
void updateFlowStaffIdRoleToNull(Long id);
|
||||
}
|
||||
@ -1,20 +1,20 @@
|
||||
package com.lz.modules.sys.service.app.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.lz.common.utils.DateUtils;
|
||||
import com.lz.common.utils.ISelect;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.app.dao.DepartmentsDao;
|
||||
import com.lz.modules.app.dao.DepartmentsStaffRelateDao;
|
||||
import com.lz.modules.app.dto.EmployeesDto;
|
||||
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.req.ResultRecordReq;
|
||||
import com.lz.modules.app.resp.ResultRecordResp;
|
||||
import com.lz.modules.app.service.StaffService;
|
||||
import com.lz.modules.flow.entity.FlowDepartment;
|
||||
import com.lz.modules.flow.entity.StaffRole;
|
||||
import com.lz.modules.flow.service.FlowDepartmentService;
|
||||
import com.lz.modules.flow.service.StaffRoleService;
|
||||
import com.lz.modules.sys.dao.app.ResultRecordMapper;
|
||||
import com.lz.modules.sys.entity.SysUserEntity;
|
||||
import com.lz.modules.sys.entity.app.ResultRecord;
|
||||
@ -26,7 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -57,6 +56,12 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
@Autowired
|
||||
private StaffService staffService;
|
||||
|
||||
@Autowired
|
||||
private FlowDepartmentService flowDepartmentService;
|
||||
|
||||
@Autowired
|
||||
private StaffRoleService staffRoleService;
|
||||
|
||||
|
||||
|
||||
|
||||
@ -90,14 +95,11 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
|
||||
@Override
|
||||
public PageUtils queryPage(ResultRecordReq params, SysUserEntity user) {
|
||||
List<Long> departmentStaffIds = new ArrayList<>();
|
||||
List<Long> staffIds = new ArrayList<>();
|
||||
List<String> departmentIds = new ArrayList<>();
|
||||
List<DepartmentsEntity> tDepartments = departmentsDao.selectAll();
|
||||
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);
|
||||
@ -116,53 +118,35 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
getChildIds(departmentIds, params.getDepartment1(), departmentMap);
|
||||
}
|
||||
}
|
||||
params.setDepartmentIds(departmentIds);
|
||||
|
||||
if (departmentIds != null && departmentIds.size() > 0) {
|
||||
List<DepartmentsStaffRelateEntity> departmentsStaffRelateEntities = departmentsStaffRelateDao.selectByDepartmentIds(departmentIds);
|
||||
if(CollectionUtils.isNotEmpty(departmentsStaffRelateEntities)){
|
||||
Set<Long> setStaffId = departmentsStaffRelateEntities.stream().map(p->p.getStaffId()).collect(Collectors.toSet());
|
||||
departmentStaffIds = new ArrayList<>(setStaffId);
|
||||
}
|
||||
}
|
||||
|
||||
if(StringUtil.isNotBlank(params.getName())){
|
||||
List<StaffEntity> staffEntities = staffService.selectByName(params.getName());
|
||||
if(CollectionUtils.isNotEmpty(staffEntities)){
|
||||
staffIds = staffEntities.stream().map(p->p.getId()).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
params.setDepartmentStaffIds(departmentStaffIds);
|
||||
params.setStaffIds(staffIds);
|
||||
PageUtils pageUtils = null;
|
||||
if(params.getIsSelf() == 1){ // 我的业绩
|
||||
params.setStaffId(user.getUserId());
|
||||
pageUtils = PageUtils.startPage(params.getPage(), params.getLimit() ).doSelect(
|
||||
page -> resultRecordMapper.selectByCondition(page, params)
|
||||
);
|
||||
}else{ // 我们审批
|
||||
}else{ // 部门审批
|
||||
String departmentLevel = "";
|
||||
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(user.getUserId());
|
||||
if(flowDepartment !=null){
|
||||
departmentLevel = flowDepartment.getDepartmentLevel();
|
||||
}else{
|
||||
StaffRole staffRole = staffRoleService.selectByStaffId(user.getUserId());
|
||||
departmentLevel= staffRole.getDepartmentLevel();
|
||||
}
|
||||
params.setDepartmentLevel(departmentLevel);
|
||||
pageUtils = PageUtils.startPage(params.getPage(), params.getLimit() ).doSelect(
|
||||
page -> resultRecordMapper.selectByCondition(page, params)
|
||||
page -> resultRecordMapper.selectByConditionByLeader(page, params)
|
||||
);
|
||||
}
|
||||
|
||||
List<ResultRecord> resultRecords = pageUtils.getList();
|
||||
if(CollectionUtils.isNotEmpty(resultRecords)){
|
||||
List<ResultRecordResp> list = new ArrayList<>();
|
||||
Set<Long> viewStaffIdSet = resultRecords.stream().map(p->p.getStaffId()).collect(Collectors.toSet());
|
||||
List<Long> viewStaffId = new ArrayList<>(viewStaffIdSet);
|
||||
List<StaffEntity> staffEntities = staffService.selectByIds(viewStaffId);
|
||||
List<DepartmentsStaffRelateEntity> staffRelateEntities = departmentsStaffRelateDao.selectByStaffIds(viewStaffId);
|
||||
Map<Long ,StaffEntity> staffEntityMap = staffEntities.stream().collect(Collectors.toMap(StaffEntity::getId, p -> p));
|
||||
Map<String, DepartmentsEntity> departmentsEntityMap = tDepartments.stream().collect(Collectors.toMap(p -> p.getDepartmentId(), p -> p));
|
||||
Map<Long, DepartmentsStaffRelateEntity> staffRelateEntityMap = staffRelateEntities.stream().collect(Collectors.toMap(p -> p.getStaffId(), p -> p));
|
||||
for (ResultRecord resultRecord : resultRecords) {
|
||||
ResultRecordResp resp = new ResultRecordResp();
|
||||
BeanUtils.copyProperties(resultRecord, resp);
|
||||
resp.setStaffName(staffEntityMap.get(resp.getStaffId()) != null ? staffEntityMap.get(resp.getStaffId()).getName() : "");
|
||||
DepartmentsStaffRelateEntity relate = staffRelateEntityMap.get(resp.getStaffId());
|
||||
resp.setDepartmentName(relate != null && departmentsEntityMap.get(relate.getDepartmentId()) != null ?
|
||||
departmentsEntityMap.get(relate.getDepartmentId()).getDepartmentName() : "");
|
||||
list.add(resp);
|
||||
}
|
||||
pageUtils.setList(list);
|
||||
@ -206,5 +190,10 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
|
||||
return resultRecordMapper.selectResultRecordByStaffId(staffId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateFlowStaffIdRoleToNull(Long id) {
|
||||
resultRecordMapper.updateFlowStaffIdRoleToNull(id);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -16,12 +16,15 @@
|
||||
<result column="staff_id" property="staffId"/>
|
||||
<result column="type" property="type"/>
|
||||
<result column="flow_staff_id_role" property="flowStaffIdRole"/>
|
||||
<result column="department_id" property="departmentId"/>
|
||||
<result column="department_name" property="departmentName"/>
|
||||
<result column="staff_name" property="staffName"/>
|
||||
</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, flow_staff_id_role AS flowStaffIdRole
|
||||
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, department_id AS departmentId, department_name AS departmentName, staff_name AS staffName
|
||||
</sql>
|
||||
|
||||
|
||||
@ -42,6 +45,9 @@
|
||||
<if test="staffId != null">staff_id, </if>
|
||||
<if test="type != null">type, </if>
|
||||
<if test="flowStaffIdRole != null">flow_staff_id_role, </if>
|
||||
<if test="departmentId != null">department_id, </if>
|
||||
<if test="departmentName != null">department_name, </if>
|
||||
<if test="staffName != null">staff_name, </if>
|
||||
is_delete,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
@ -54,6 +60,9 @@
|
||||
<if test="staffId != null">#{ staffId}, </if>
|
||||
<if test="type != null">#{ type}, </if>
|
||||
<if test="flowStaffIdRole != null">#{ flowStaffIdRole}, </if>
|
||||
<if test="departmentId != null">#{ departmentId}, </if>
|
||||
<if test="departmentName != null">#{ departmentName}, </if>
|
||||
<if test="staffName != null">#{ staffName}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
@ -74,7 +83,10 @@
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="staffId != null">staff_id = #{staffId},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="flowStaffIdRole != null">flow_staff_id_role = #{flowStaffIdRole}</if>
|
||||
<if test="flowStaffIdRole != null">flow_staff_id_role = #{flowStaffIdRole},</if>
|
||||
<if test="departmentId != null">department_id = #{departmentId},</if>
|
||||
<if test="departmentName != null">department_name = #{departmentName},</if>
|
||||
<if test="staffName != null">staff_name = #{staffName}</if>
|
||||
</trim>
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
@ -94,7 +106,10 @@
|
||||
remark = #{remark},
|
||||
staff_id = #{staffId},
|
||||
type = #{type},
|
||||
flow_staff_id_role = #{flowStaffIdRole}
|
||||
flow_staff_id_role = #{flowStaffIdRole},
|
||||
department_id = #{departmentId},
|
||||
department_name = #{departmentName},
|
||||
staff_name = #{staffName}
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -104,6 +119,7 @@
|
||||
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 != '' ">
|
||||
@ -118,19 +134,21 @@
|
||||
<if test="req.remark != null and req.remark !='' ">
|
||||
AND remark LIKE CONCAT('%',#{req.remark},'%')
|
||||
</if>
|
||||
<if test="req.departmentStaffIds != null and req.departmentStaffIds.size() > 0 ">
|
||||
and staff_id in
|
||||
<foreach collection="req.departmentStaffIds" item="item" index="index" separator="," open="(" close=")">
|
||||
|
||||
<if test="req.name != null and req.name !='' ">
|
||||
AND staff_name LIKE CONCAT('%',#{req.name},'%')
|
||||
</if>
|
||||
|
||||
<if test="req.departmentIds != null and req.departmentIds.size() > 0 ">
|
||||
and department_id in
|
||||
<foreach collection="req.departmentIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="req.staffIds != null and req.staffIds.size() > 0 ">
|
||||
and staff_id in
|
||||
<foreach collection="req.staffIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
<if test="req.staffId != null and req.staffId !='' ">
|
||||
and staff_id = #{req.staffId}
|
||||
</if>
|
||||
and staff_id = #{req.staffId}
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
@ -147,10 +165,48 @@
|
||||
order by id desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectResultRecordByStaffId" resultType="com.lz.modules.sys.entity.app.ResultRecord">
|
||||
select * from lz_result_record where is_delete = 0 and staff_id = #{staffId} and type = 1 order by id desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectByConditionByLeader" resultType="com.lz.modules.flow.model.ResultRecordDto">
|
||||
select * from (
|
||||
select rd.*,department_level,approval_staff_id,approval_staff_name,flow_name,flow_id,flow_index
|
||||
from lz_flow_record fr left join lz_result_record rd on fr.record_id= rd.id
|
||||
where department_level = #{req.departmentLevel}
|
||||
<if test="req.monthBeginDate != null and req.monthBeginDate != '' ">
|
||||
AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{req.monthBeginDate}, '%Y-%m-%d %H:%i:%S')
|
||||
</if>
|
||||
<if test="req.monthEndDate != null and req.monthEndDate != '' ">
|
||||
AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') <![CDATA[ >= ]]> DATE_FORMAT(#{req.monthEndDate}, '%Y-%m-%d %H:%i:%S')
|
||||
</if>
|
||||
<if test="req.status != null">
|
||||
and rd.status = #{req.status}
|
||||
</if>
|
||||
<if test="req.remark != null and req.remark !='' ">
|
||||
AND rd.remark LIKE CONCAT('%',#{req.remark},'%')
|
||||
</if>
|
||||
|
||||
<if test="req.name != null and req.name !='' ">
|
||||
AND rd.staff_name LIKE CONCAT('%',#{req.name},'%')
|
||||
</if>
|
||||
<if test="req.departmentIds != null and req.departmentIds.size() > 0 ">
|
||||
and rd.department_id in
|
||||
<foreach collection="req.departmentIds" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="req.staffId != null and req.staffId !='' ">
|
||||
and rd.staff_id = #{req.staffId}
|
||||
</if>
|
||||
order by fr.id desc )
|
||||
a GROUP BY department_id and id
|
||||
</select>
|
||||
|
||||
<update id="updateFlowStaffIdRoleToNull">
|
||||
update lz_result_record set flow_staff_id_role = '[]' where id = #{id}
|
||||
</update>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
<result column="is_delete" property="isDelete"/>
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="department_id" property="departmentId"/>
|
||||
<result column="department_level" property="departmentLevel"/>
|
||||
<result column="record_id" property="recordId"/>
|
||||
<result column="approval_staff_id" property="approvalStaffId"/>
|
||||
@ -23,20 +22,15 @@
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<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, flow_name AS flowName, record_staff_id AS recordStaffId, flow_id AS flowId, flow_index AS flowIndex, status AS status
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, 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>
|
||||
|
||||
|
||||
<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>
|
||||
@ -50,7 +44,6 @@
|
||||
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>
|
||||
@ -73,7 +66,6 @@
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
||||
<if test="departmentId != null">department_id = #{departmentId},</if>
|
||||
<if test="departmentLevel != null">department_level = #{departmentLevel},</if>
|
||||
<if test="recordId != null">record_id = #{recordId},</if>
|
||||
<if test="approvalStaffId != null">approval_staff_id = #{approvalStaffId},</if>
|
||||
@ -95,7 +87,6 @@
|
||||
set
|
||||
is_delete = #{isDelete},
|
||||
gmt_create = #{gmtCreate},
|
||||
department_id = #{departmentId},
|
||||
department_level = #{departmentLevel},
|
||||
record_id = #{recordId},
|
||||
approval_staff_id = #{approvalStaffId},
|
||||
@ -115,6 +106,7 @@
|
||||
</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>
|
||||
|
||||
@ -78,7 +78,7 @@
|
||||
|
||||
|
||||
<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 * from lz_staff_role_department where staff_role_id=#{staffRoleId} and is_delete = 0
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
@ -9,14 +9,14 @@
|
||||
<result column="gmt_create" property="gmtCreate"/>
|
||||
<result column="gmt_modified" property="gmtModified"/>
|
||||
<result column="staff_id" property="staffId"/>
|
||||
<result column="role" property="role"/>
|
||||
<result column="record_role_id" property="recordRoleId"/>
|
||||
<result column="department_level" property="departmentLevel"/>
|
||||
<result column="role_id" property="roleId"/>
|
||||
</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, record_role_id AS recordRoleId
|
||||
id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, staff_id AS staffId, department_level AS departmentLevel, role_id AS roleId
|
||||
</sql>
|
||||
|
||||
|
||||
@ -30,15 +30,15 @@
|
||||
<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>
|
||||
<if test="recordRoleId != null">record_role_id, </if>
|
||||
<if test="departmentLevel != null">department_level, </if>
|
||||
<if test="roleId != null">role_id, </if>
|
||||
is_delete,
|
||||
gmt_create,
|
||||
gmt_modified
|
||||
)values(
|
||||
<if test="staffId != null">#{ staffId}, </if>
|
||||
<if test="role != null">#{ role}, </if>
|
||||
<if test="recordRoleId != null">#{ recordRoleId}, </if>
|
||||
<if test="departmentLevel != null">#{ departmentLevel}, </if>
|
||||
<if test="roleId != null">#{ roleId}, </if>
|
||||
0,
|
||||
now(),
|
||||
now()
|
||||
@ -53,8 +53,8 @@
|
||||
<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="recordRoleId != null">record_role_id = #{recordRoleId}</if>
|
||||
<if test="departmentLevel != null">department_level = #{departmentLevel},</if>
|
||||
<if test="roleId != null">role_id = #{roleId}</if>
|
||||
</trim>
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
@ -68,8 +68,8 @@
|
||||
is_delete = #{isDelete},
|
||||
gmt_create = #{gmtCreate},
|
||||
staff_id = #{staffId},
|
||||
role = #{role},
|
||||
record_role_id = #{recordRoleId}
|
||||
department_level = #{departmentLevel},
|
||||
role_id = #{roleId}
|
||||
,gmt_modified = now()
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -80,12 +80,13 @@
|
||||
</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>
|
||||
|
||||
<select id="selectByRole" resultType="com.lz.modules.flow.entity.StaffRole">
|
||||
select * from lz_staff_role where is_delete = 0 and role = #{role}
|
||||
select * from lz_staff_role where is_delete = 0 and department_level = #{departmentLevel}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user