提交修改

This commit is contained in:
quyixiao 2020-09-23 15:15:18 +08:00
parent d13dbdc42d
commit 735e53effb
7 changed files with 147 additions and 48 deletions

View File

@ -57,6 +57,9 @@ public class PageUtils<E> implements Serializable {
this.totalPage = (int) Math.ceil((double) totalCount / pageSize); this.totalPage = (int) Math.ceil((double) totalCount / pageSize);
} }
public PageUtils() {
}
public <E> PageUtils<E> doSelect(ISelect select) { public <E> PageUtils<E> doSelect(ISelect select) {
IPage page = new Page(this.currPage, this.pageSize); IPage page = new Page(this.currPage, this.pageSize);

View File

@ -6,8 +6,10 @@ import java.util.Map;
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.modules.flow.entity.Flow;
import com.lz.modules.flow.entity.FlowManager; import com.lz.modules.flow.entity.FlowManager;
import com.lz.modules.flow.model.FlowDto; import com.lz.modules.flow.model.FlowDto;
import com.lz.modules.flow.service.FlowDepartmentService;
import com.lz.modules.flow.service.FlowManagerService; import com.lz.modules.flow.service.FlowManagerService;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -31,6 +33,9 @@ public class FlowManagerController {
@Autowired @Autowired
private FlowManagerService flowManagerService; private FlowManagerService flowManagerService;
@Autowired
private FlowDepartmentService flowDepartmentService;
/** /**
* 列表 * 列表
*/ */
@ -59,6 +64,15 @@ public class FlowManagerController {
return R.ok().put("lzFlowManager", lzFlowManager); return R.ok().put("lzFlowManager", lzFlowManager);
} }
/**
* 信息
*/
@RequestMapping("/get/flowInfo/{staffId}")
public R flowInfo(@PathVariable("staffId") Long staffId){
return flowDepartmentService.selectFlowManager(staffId);
}
/** /**
* 保存 * 保存
*/ */

View File

@ -1,5 +1,6 @@
package com.lz.modules.flow.entity; package com.lz.modules.flow.entity;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
@ -26,6 +27,10 @@ public class FlowManager implements java.io.Serializable {
private Date gmtModified; private Date gmtModified;
//流程名称 //流程名称
private String name; private String name;
@TableField(exist=false)
private String type;
/** /**
* *
* @return * @return
@ -101,6 +106,14 @@ public class FlowManager implements java.io.Serializable {
this.name = name; this.name = name;
} }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
@Override @Override
public String toString() { public String toString() {
return "FlowManager{" + return "FlowManager{" +

View File

@ -1,7 +1,11 @@
package com.lz.modules.flow.service; package com.lz.modules.flow.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.lz.common.utils.R;
import com.lz.modules.flow.entity.FlowDepartment; import com.lz.modules.flow.entity.FlowDepartment;
import com.lz.modules.flow.entity.FlowManager;
import java.util.List;
/** /**
* <p> * <p>
@ -33,4 +37,6 @@ public interface FlowDepartmentService extends IService<FlowDepartment> {
FlowDepartment selectByStaffId(Long staffId); FlowDepartment selectByStaffId(Long staffId);
FlowDepartment selectByParentId(Long parentId); FlowDepartment selectByParentId(Long parentId);
R selectFlowManager(Long staffId);
} }

View File

@ -1,72 +1,123 @@
package com.lz.modules.flow.service.impl; package com.lz.modules.flow.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lz.common.utils.Constant;
import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R;
import com.lz.modules.app.entity.DepartmentsStaffRelateEntity;
import com.lz.modules.flow.dao.FlowDepartmentMapper; import com.lz.modules.flow.dao.FlowDepartmentMapper;
import com.lz.modules.flow.dao.FlowManagerMapper;
import com.lz.modules.flow.entity.FlowDepartment; import com.lz.modules.flow.entity.FlowDepartment;
import com.lz.modules.flow.entity.FlowManager;
import com.lz.modules.flow.model.TypeFlowDto;
import com.lz.modules.flow.service.FlowDepartmentService; import com.lz.modules.flow.service.FlowDepartmentService;
import com.lz.modules.sys.service.app.ResultRecordService;
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.util.ArrayList;
import java.util.List;
/** /**
* <p> * <p>
* 流转关系表 服务类 * 流转关系表 服务类
* </p> * </p>
* *
* @author quyixiao * @author quyixiao
* @since 2020-08-18 * @since 2020-08-18
*/ */
@Service @Service
public class FlowDepartmentServiceImpl extends ServiceImpl<FlowDepartmentMapper, FlowDepartment> implements FlowDepartmentService { public class FlowDepartmentServiceImpl extends ServiceImpl<FlowDepartmentMapper, FlowDepartment> implements FlowDepartmentService {
@Autowired @Autowired
private FlowDepartmentMapper flowDepartmentMapper; private FlowDepartmentMapper flowDepartmentMapper;
@Autowired
private FlowDepartmentService flowDepartmentService;
@Autowired
private ResultRecordService resultRecordService;
@Autowired
private FlowManagerMapper flowManagerMapper;
@Override
@Override public FlowDepartment selectFlowDepartmentById(Long id) {
public FlowDepartment selectFlowDepartmentById(Long id){ return flowDepartmentMapper.selectFlowDepartmentById(id);
return flowDepartmentMapper.selectFlowDepartmentById(id); }
}
@Override
@Override public Long insertFlowDepartment(FlowDepartment flowDepartment) {
public Long insertFlowDepartment(FlowDepartment flowDepartment){ return flowDepartmentMapper.insertFlowDepartment(flowDepartment);
return flowDepartmentMapper.insertFlowDepartment(flowDepartment); }
}
@Override
@Override public int updateFlowDepartmentById(FlowDepartment flowDepartment) {
public int updateFlowDepartmentById(FlowDepartment flowDepartment){ return flowDepartmentMapper.updateFlowDepartmentById(flowDepartment);
return flowDepartmentMapper.updateFlowDepartmentById(flowDepartment); }
}
@Override
@Override public int updateCoverFlowDepartmentById(FlowDepartment flowDepartment) {
public int updateCoverFlowDepartmentById(FlowDepartment flowDepartment){ return flowDepartmentMapper.updateCoverFlowDepartmentById(flowDepartment);
return flowDepartmentMapper.updateCoverFlowDepartmentById(flowDepartment); }
}
@Override
@Override public int deleteFlowDepartmentById(Long id) {
public int deleteFlowDepartmentById(Long id){ return flowDepartmentMapper.deleteFlowDepartmentById(id);
return flowDepartmentMapper.deleteFlowDepartmentById(id); }
}
@Override @Override
public FlowDepartment selectByStaffId(Long staffId) { public FlowDepartment selectByStaffId(Long staffId) {
return flowDepartmentMapper.selectByStaffId(staffId); return flowDepartmentMapper.selectByStaffId(staffId);
} }
@Override @Override
public FlowDepartment selectByParentId(Long parentId) { public FlowDepartment selectByParentId(Long parentId) {
return flowDepartmentMapper.selectByParentId(parentId); return flowDepartmentMapper.selectByParentId(parentId);
} }
@Override
public R selectFlowManager(Long staffId) {
Long flowId1 = 0l;
Long flowId2 = 0l;
FlowDepartment flowDepartment = flowDepartmentService.selectByStaffId(staffId);
if (flowDepartment == null) {
DepartmentsStaffRelateEntity leader = resultRecordService.getLeaderDepartmentsStaffRelateEntity(staffId);
if(leader != null){
flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId());
flowId1 = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.CHILD, 1); // 表示是子
flowId2 = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.CHILD, 2); // 表示是子
}
} else {
flowId1 = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.SELF, 1); // 表示是部门主管自己
flowId2 = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.SELF, 2); // 表示是部门主管自己
}
List<FlowManager> flowManagers = new ArrayList<>();
flowManagers.add(getFlowMnagers(flowId1,"type1"));
flowManagers.add(getFlowMnagers(flowId2,"type2"));
PageUtils pageUtils = new PageUtils();
pageUtils.setList(flowManagers);
return R.ok().put("page", pageUtils);
}
public FlowManager getFlowMnagers(Long flowId, String type) {
FlowManager flowManager = flowManagerMapper.selectFlowManagerById(flowId);
if (flowManager == null) {
flowManager = new FlowManager();
flowManager.setId(flowId);
flowManager.setName(flowId == 0 ? "" : flowId + "");
}
flowManager.setType(type);
return flowManager;
}
} }

View File

@ -6,6 +6,7 @@ import com.lz.common.utils.PageUtils;
import com.lz.common.utils.R; import com.lz.common.utils.R;
import com.lz.modules.app.dto.GraphicsStatisticalDto; import com.lz.modules.app.dto.GraphicsStatisticalDto;
import com.lz.modules.app.entity.DepartmentsEntity; 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.entity.StaffEntity;
import com.lz.modules.app.req.ResultRecordReq; import com.lz.modules.app.req.ResultRecordReq;
import com.lz.modules.app.resp.OwnResultResp; import com.lz.modules.app.resp.OwnResultResp;
@ -88,4 +89,7 @@ public interface ResultRecordService extends IService<ResultRecord> {
R reject( ResultRecord resultRecord,Integer status); R reject( ResultRecord resultRecord,Integer status);
StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel, List<StaffRoleDto> staffRoleDtos, Long roleId); StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel, List<StaffRoleDto> staffRoleDtos, Long roleId);
DepartmentsStaffRelateEntity getLeaderDepartmentsStaffRelateEntity(Long staffId);
} }

View File

@ -285,17 +285,7 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
List<FlowDepartment> list = new ArrayList<>(); List<FlowDepartment> list = new ArrayList<>();
Long flowId = flowDepartment != null ? TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.SELF, type) : 0l; // 表示是部门主管自己 Long flowId = flowDepartment != null ? TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.SELF, type) : 0l; // 表示是部门主管自己
if (flowDepartment == null) { if (flowDepartment == null) {
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId); DepartmentsStaffRelateEntity leader = getLeaderDepartmentsStaffRelateEntity(staffId);
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
if(leader == null){
Map<String, String> map = departmentsService.selectUserAllDepartmentInFo(departmentsStaffRelateEntity.getDepartmentId());
if (StringUtil.isNotBlank(map.get("dd2"))) {
leader = departmentsStaffRelateService.selectLeaderByDepartmentId(map.get("dd2"));
if(leader ==null && StringUtil.isNotBlank(map.get("dd3"))){
leader = departmentsStaffRelateService.selectLeaderByDepartmentId(map.get("dd3"));
}
}
}
flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId()); flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId());
flowId = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.CHILD, type);//表示是部门下的普通员工 flowId = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.CHILD, type);//表示是部门下的普通员工
list.add(flowDepartment); list.add(flowDepartment);
@ -311,6 +301,24 @@ public class ResultRecordServiceImpl extends ServiceImpl<ResultRecordMapper, Res
return new TwoTuple(flowId, list); return new TwoTuple(flowId, list);
} }
@Override
public DepartmentsStaffRelateEntity getLeaderDepartmentsStaffRelateEntity(Long staffId){
DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId);
DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId());
if(leader == null){
Map<String, String> map = departmentsService.selectUserAllDepartmentInFo(departmentsStaffRelateEntity.getDepartmentId());
if (StringUtil.isNotBlank(map.get("dd2"))) {
leader = departmentsStaffRelateService.selectLeaderByDepartmentId(map.get("dd2"));
if(leader ==null && StringUtil.isNotBlank(map.get("dd3"))){
leader = departmentsStaffRelateService.selectLeaderByDepartmentId(map.get("dd3"));
return leader;
}
}
}
return null;
}
@Override @Override
public ResultRecord createResultRecord(Long staffId, int type, Long roleId) { public ResultRecord createResultRecord(Long staffId, int type, Long roleId) {