From d9e362b87eb57dcfdc2d9d07d5ed75503fd1bf33 Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Wed, 19 Aug 2020 22:43:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResultRecordController.java | 66 ++++++++++++++++--- .../app/dao/DepartmentsStaffRelateDao.java | 4 ++ .../DepartmentsStaffRelateService.java | 4 ++ .../DepartmentsStaffRelateServiceImpl.java | 10 +++ .../flow/dao/FlowDepartmentMapper.java | 2 + .../com/lz/modules/flow/dao/FlowMapper.java | 4 ++ .../modules/flow/dao/FlowRelationMapper.java | 4 ++ .../modules/flow/entity/FlowDepartment.java | 38 +++++------ .../flow/service/FlowDepartmentService.java | 2 + .../flow/service/FlowRelationService.java | 5 +- .../lz/modules/flow/service/FlowService.java | 5 +- .../impl/FlowDepartmentServiceImpl.java | 5 ++ .../service/impl/FlowRelationServiceImpl.java | 7 +- .../flow/service/impl/FlowServiceImpl.java | 6 ++ .../mapper/flow/FlowDepartmentMapper.xml | 61 +++++++++-------- src/main/resources/mapper/flow/FlowMapper.xml | 10 ++- .../mapper/flow/FlowRelationMapper.xml | 7 ++ .../generator/DepartmentsStaffRelateDao.xml | 10 +++ src/test/java/com/lz/mysql/MysqlMain.java | 2 +- 19 files changed, 182 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index 7a1b47b7..6dc2df41 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -10,9 +10,15 @@ 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.model.Auth; 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.sys.controller.AbstractController; import com.lz.modules.sys.entity.SysUserEntity; @@ -64,8 +70,14 @@ public class ResultRecordController extends AbstractController { @Autowired private RecordAuthService recordAuthService; + @Autowired + private FlowDepartmentService flowDepartmentService; + @Autowired + private FlowRelationService flowRelationService; + @Autowired + private FlowService flowService; /** * 列表 @@ -74,7 +86,7 @@ public class ResultRecordController extends AbstractController { @RequiresPermissions("user:lzresultrecord:list") public R list(ResultRecordReq req) { SysUserEntity user = getUser(); - PageUtils page = lzResultRecordService.queryPage(req,user); + PageUtils page = lzResultRecordService.queryPage(req, user); List departmentList1 = departmentsService.selectByParentDepartmentId("0"); return R.ok().put("page", page) .put("departmentList1", departmentList1); @@ -136,7 +148,7 @@ public class ResultRecordController extends AbstractController { } //保存文件价值观 - recordType =3; + recordType = 3; insertWenHuaJiaZhiGua("做人:相信、包容、担当", resultRecordNew.getId(), getUserId()); insertWenHuaJiaZhiGua("做事:用户第一、求真、极致", resultRecordNew.getId(), getUserId()); recordResultId = resultRecordNew.getId(); @@ -152,11 +164,11 @@ public class ResultRecordController extends AbstractController { int type1 = tempType1; int type2 = tempType2; if (tempType1 == 0) { - type1 = 1 ; + type1 = 1; list.add(getYeJi()); list.add(getYeJiKaoHe()); } - if(tempType2 == 0 ){ + if (tempType2 == 0) { type2 = 2; } firstRowspan = type1; @@ -189,7 +201,7 @@ public class ResultRecordController extends AbstractController { list.add(getWenHuaJiaZhiGua1(auth)); list.add(getWenHuaJiaZhiGua2(auth)); } - }else{ + } else { int type1 = 1; int type2 = 2; firstRowspan = type1; @@ -223,6 +235,39 @@ public class ResultRecordController extends AbstractController { .put("recordResultId", recordResultId); } + @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()); + DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId()); + flowDepartment = flowDepartmentService.selectByStaffId(leader.getId()); + flowId = flowDepartment.getChildFlowId();//表示是部门下的普通员工 + } + List list = new ArrayList<>(); + list.add(flowDepartment); + for (int i = 0; i < 10; i++) { + if (flowDepartment.getParentId() != null && flowDepartment.getParentId() > 0) { + flowDepartment = flowDepartmentService.selectFlowDepartmentById(flowDepartment.getParentId()); + } + } + List flowRelations = flowRelationService.selectFlowRelationAll(); + Map staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p)); + // approvalList = [ONE_D,TWO_D,HR,BOSS] + List approvalList = new ArrayList<>(); + for(FlowRelation flowRelation : flowRelations){ + if(staffEntityMap.get(flowRelation.getChild()) != null || flowRelation.getCanReplace() == 0){ + approvalList.add(flowRelation.getChild()); + } + } + List flows = flowService.selectByFlowId(flowId); + return R.ok("提交审批成功"); + } + + public void insertWenHuaJiaZhiGua(String target, Long recordId, Long staffId) { ResultDetail wenhua1 = new ResultDetail(); wenhua1.setTarget(target); @@ -243,7 +288,7 @@ public class ResultRecordController extends AbstractController { return result; } - public ResultDetailResp getYeJiKaoHe(){ + public ResultDetailResp getYeJiKaoHe() { ResultDetailResp respHeader = new ResultDetailResp(); respHeader.setKeyResult("业务考核结果"); respHeader.setCheckWeight(new BigDecimal(0.7)); @@ -274,7 +319,7 @@ public class ResultRecordController extends AbstractController { return wenhua2; } - public ResultDetailResp getWenHuaJiaZhiGuaResult1(){ + public ResultDetailResp getWenHuaJiaZhiGuaResult1() { ResultDetailResp tail1 = new ResultDetailResp(); tail1.setKeyResult("文化价值观考核结果"); tail1.setCheckWeight(new BigDecimal(0.3)); @@ -286,7 +331,7 @@ public class ResultRecordController extends AbstractController { } - public ResultDetailResp getWenHuaJiaZhiGuaResult2(){ + public ResultDetailResp getWenHuaJiaZhiGuaResult2() { ResultDetailResp tail2 = new ResultDetailResp(); tail2.setCheckRange("文化价值观考核结果"); tail2.setAcquireScore(new BigDecimal(0)); @@ -295,7 +340,7 @@ public class ResultRecordController extends AbstractController { return tail2; } - public ResultDetailResp getLastResult(){ + public ResultDetailResp getLastResult() { ResultDetailResp tail3 = new ResultDetailResp(); tail3.setCheckRange("最终绩效考核结果等级"); tail3.setAcquireScore(new BigDecimal(3.25)); @@ -427,7 +472,7 @@ public class ResultRecordController extends AbstractController { return R.ok("保存成功").put("recordId", recordId); } - public ResultRecord createResultRecord(int type ){ + public ResultRecord createResultRecord(int type) { ResultRecord resultRecord = new ResultRecord(); resultRecord.setMonthTime(new Date()); resultRecord.setCurrentFlowStaffId(getUserId()); @@ -442,6 +487,7 @@ public class ResultRecordController extends AbstractController { resultRecordService.insertResultRecord(resultRecord); return resultRecord; } + /** * 保存 */ diff --git a/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java b/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java index 20d0b7f1..d5268ea8 100644 --- a/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java +++ b/src/main/java/com/lz/modules/app/dao/DepartmentsStaffRelateDao.java @@ -49,4 +49,8 @@ public interface DepartmentsStaffRelateDao extends BaseMapper selectByStaffIds(@Param("staffIds") List staffIds); List selectAll(); + + DepartmentsStaffRelateEntity selectLastDepartmentByStaffId(@Param("staffId") Long staffId); + + DepartmentsStaffRelateEntity selectLeaderByDepartmentId(@Param("departmentId") String departmentId); } diff --git a/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java b/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java index f6830fc5..c6fc0abf 100644 --- a/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java +++ b/src/main/java/com/lz/modules/app/service/DepartmentsStaffRelateService.java @@ -31,5 +31,9 @@ public interface DepartmentsStaffRelateService extends IService selectAll(); List selectByStaffIds(List staffIds); + + DepartmentsStaffRelateEntity selectLastDepartmentByStaffId(Long staffId); + + DepartmentsStaffRelateEntity selectLeaderByDepartmentId(String departmentId); } diff --git a/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java b/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java index e726ea4e..dfb8acc2 100644 --- a/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java +++ b/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java @@ -70,5 +70,15 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl { FlowDepartment selectByStaffId(@Param("staffId") Long staffId); + + FlowDepartment selectByParentId(@Param("parentId") Long parentId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/dao/FlowMapper.java b/src/main/java/com/lz/modules/flow/dao/FlowMapper.java index 9d3a22f9..5889418e 100644 --- a/src/main/java/com/lz/modules/flow/dao/FlowMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/FlowMapper.java @@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.lz.modules.flow.entity.Flow; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + +import java.util.List; + @Mapper public interface FlowMapper extends BaseMapper { @@ -30,4 +33,5 @@ public interface FlowMapper extends BaseMapper { int deleteFlowById(@Param("id")Long id); + List selectByFlowId(@Param("flowId") Long flowId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/dao/FlowRelationMapper.java b/src/main/java/com/lz/modules/flow/dao/FlowRelationMapper.java index b0d874e3..ae8ec3c5 100644 --- a/src/main/java/com/lz/modules/flow/dao/FlowRelationMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/FlowRelationMapper.java @@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.lz.modules.flow.entity.FlowRelation; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + +import java.util.List; + @Mapper public interface FlowRelationMapper extends BaseMapper { @@ -30,4 +33,5 @@ public interface FlowRelationMapper extends BaseMapper { int deleteFlowRelationById(@Param("id")Long id); + List selectFlowRelationAll(); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java b/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java index a76bf13d..788cfa52 100644 --- a/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java +++ b/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java @@ -9,7 +9,7 @@ import java.util.Date; * 菜单权限表 *

*流转关系表 * @author quyixiao -* @since 2020-08-18 +* @since 2020-08-19 */ @Data @@ -24,8 +24,6 @@ public class FlowDepartment implements java.io.Serializable { private Date gmtCreate; //最后修改时间 private Date gmtModified; - // - private Long departmentId; //员工 id private Long taffId; //自己部门小伙伴 走的 流程id @@ -34,6 +32,8 @@ public class FlowDepartment implements java.io.Serializable { private Long selfFlowId; //部门级别 private String departmentLevel; + // + private Long parentId; /** * * @return @@ -94,21 +94,6 @@ public class FlowDepartment implements java.io.Serializable { this.gmtModified = gmtModified; } - /** - * - * @return - */ - public Long getDepartmentId() { - return departmentId; - } - /** - * - * @param departmentId - */ - public void setDepartmentId(Long departmentId) { - this.departmentId = departmentId; - } - /** * 员工 id * @return @@ -169,6 +154,21 @@ public class FlowDepartment implements java.io.Serializable { this.departmentLevel = departmentLevel; } + /** + * + * @return + */ + public Long getParentId() { + return parentId; + } + /** + * + * @param parentId + */ + public void setParentId(Long parentId) { + this.parentId = parentId; + } + @Override public String toString() { return "FlowDepartment{" + @@ -176,11 +176,11 @@ public class FlowDepartment implements java.io.Serializable { ",isDelete=" + isDelete + ",gmtCreate=" + gmtCreate + ",gmtModified=" + gmtModified + - ",departmentId=" + departmentId + ",taffId=" + taffId + ",childFlowId=" + childFlowId + ",selfFlowId=" + selfFlowId + ",departmentLevel=" + departmentLevel + + ",parentId=" + parentId + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/FlowDepartmentService.java b/src/main/java/com/lz/modules/flow/service/FlowDepartmentService.java index d81b307b..723d0c73 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowDepartmentService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowDepartmentService.java @@ -31,4 +31,6 @@ public interface FlowDepartmentService extends IService { FlowDepartment selectByStaffId(Long staffId); + + FlowDepartment selectByParentId(Long parentId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/FlowRelationService.java b/src/main/java/com/lz/modules/flow/service/FlowRelationService.java index 99110a24..f01c855b 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowRelationService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowRelationService.java @@ -3,6 +3,8 @@ package com.lz.modules.flow.service; import com.baomidou.mybatisplus.extension.service.IService; import com.lz.modules.flow.entity.FlowRelation; +import java.util.List; + /** *

* 流转关系表 服务类 @@ -30,6 +32,5 @@ public interface FlowRelationService extends IService { int deleteFlowRelationById(Long id); - - + List selectFlowRelationAll(); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/FlowService.java b/src/main/java/com/lz/modules/flow/service/FlowService.java index fc3f60c4..80a5a1f0 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowService.java @@ -3,6 +3,8 @@ package com.lz.modules.flow.service; import com.baomidou.mybatisplus.extension.service.IService; import com.lz.modules.flow.entity.Flow; +import java.util.List; + /** *

* 流转表 服务类 @@ -30,6 +32,5 @@ public interface FlowService extends IService { int deleteFlowById(Long id); - - + List selectByFlowId(Long flowId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowDepartmentServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowDepartmentServiceImpl.java index a654cd16..21fd4cfb 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowDepartmentServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowDepartmentServiceImpl.java @@ -63,5 +63,10 @@ public class FlowDepartmentServiceImpl extends ServiceImpl * 流转关系表 服务类 @@ -58,8 +60,11 @@ public class FlowRelationServiceImpl extends ServiceImpl selectFlowRelationAll() { - + return flowRelationMapper.selectFlowRelationAll(); + } } diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowServiceImpl.java index 113e5369..fe6a4aec 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowServiceImpl.java @@ -7,6 +7,8 @@ import com.lz.modules.flow.service.FlowService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** *

* 流转表 服务类 @@ -58,6 +60,10 @@ public class FlowServiceImpl extends ServiceImpl implements Fl return flowMapper.deleteFlowById(id); } + @Override + public List selectByFlowId(Long flowId) { + return flowMapper.selectByFlowId(flowId); + } } diff --git a/src/main/resources/mapper/flow/FlowDepartmentMapper.xml b/src/main/resources/mapper/flow/FlowDepartmentMapper.xml index 1cf152d8..d587b675 100644 --- a/src/main/resources/mapper/flow/FlowDepartmentMapper.xml +++ b/src/main/resources/mapper/flow/FlowDepartmentMapper.xml @@ -8,62 +8,61 @@ - + - id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, department_id AS departmentId, taff_id AS taffId, child_flow_id AS childFlowId, self_flow_id AS selfFlowId, department_level AS departmentLevel + 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 - insert into lz_flow_department( - department_id, - taff_id, - child_flow_id, - self_flow_id, - department_level, - is_delete, - gmt_create, - gmt_modified + taff_id, + child_flow_id, + self_flow_id, + department_level, + parent_id, + is_delete, + gmt_create, + gmt_modified )values( - #{ departmentId}, - #{ taffId}, - #{ childFlowId}, - #{ selfFlowId}, - #{ departmentLevel}, - 0, - now(), - now() + #{ taffId}, + #{ childFlowId}, + #{ selfFlowId}, + #{ departmentLevel}, + #{ parentId}, + 0, + now(), + now() ) update - lz_flow_department + lz_flow_department is_delete = #{isDelete}, gmt_create = #{gmtCreate}, - department_id = #{departmentId}, taff_id = #{taffId}, child_flow_id = #{childFlowId}, self_flow_id = #{selfFlowId}, - department_level = #{departmentLevel} + department_level = #{departmentLevel}, + parent_id = #{parentId} ,gmt_modified = now() where id = #{id} @@ -72,29 +71,33 @@ update - lz_flow_department - set + lz_flow_department + set is_delete = #{isDelete}, gmt_create = #{gmtCreate}, - department_id = #{departmentId}, taff_id = #{taffId}, child_flow_id = #{childFlowId}, self_flow_id = #{selfFlowId}, - department_level = #{departmentLevel} + department_level = #{departmentLevel}, + parent_id = #{parentId} ,gmt_modified = now() where id = #{id} - update lz_flow_department set is_delete = 1 where id=#{id} limit 1 + update lz_flow_department set is_delete = 1 where id=#{id} limit 1 - + + + diff --git a/src/main/resources/mapper/flow/FlowMapper.xml b/src/main/resources/mapper/flow/FlowMapper.xml index 290efbd3..8ea0fd1f 100644 --- a/src/main/resources/mapper/flow/FlowMapper.xml +++ b/src/main/resources/mapper/flow/FlowMapper.xml @@ -14,20 +14,15 @@ - id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, flow_id AS flowId, opt AS opt, opt_desc AS optDesc, role_id AS roleId - - - - insert into lz_flow( flow_id, @@ -79,10 +74,13 @@ where id = #{id} - update lz_flow set is_delete = 1 where id=#{id} limit 1 + + diff --git a/src/main/resources/mapper/flow/FlowRelationMapper.xml b/src/main/resources/mapper/flow/FlowRelationMapper.xml index a4806bc9..a2088363 100644 --- a/src/main/resources/mapper/flow/FlowRelationMapper.xml +++ b/src/main/resources/mapper/flow/FlowRelationMapper.xml @@ -27,6 +27,7 @@ + insert into lz_flow_relation( child, @@ -79,5 +80,11 @@ update lz_flow_relation set is_delete = 1 where id=#{id} limit 1 + + + + diff --git a/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml b/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml index 66caff3f..57b4030c 100644 --- a/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml +++ b/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml @@ -61,5 +61,15 @@ select * from lz_departments_staff_relate + + + + diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java index 94a0e25d..25d2366b 100644 --- a/src/test/java/com/lz/mysql/MysqlMain.java +++ b/src/test/java/com/lz/mysql/MysqlMain.java @@ -61,7 +61,7 @@ public class MysqlMain { } List list = new ArrayList(); - list.add(new TablesBean("sys_user_token")); + list.add(new TablesBean("lz_flow_department")); List list2 = new ArrayList(); Map map = MysqlUtil2ShowCreateTable.getComments(); From 23c29ad2db3c1724093e571a7db799762da1bb9f Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Thu, 20 Aug 2020 14:37:00 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/lz/common/utils/Constant.java | 1 + .../controller/ResultRecordController.java | 147 ++++++++++++++---- .../lz/modules/app/dao/DepartmentsDao.java | 3 + .../lz/modules/app/dto/DepartmentInfos.java | 18 +++ .../app/service/DepartmentsService.java | 2 + .../service/impl/DepartmentsServiceImpl.java | 26 +++- .../lz/modules/flow/dao/FlowRecordMapper.java | 3 + .../flow/dao/StaffRoleDepartmentMapper.java | 4 + .../lz/modules/flow/dao/StaffRoleMapper.java | 5 + .../modules/flow/entity/FlowDepartment.java | 16 +- .../lz/modules/flow/entity/FlowRecord.java | 46 ++---- .../com/lz/modules/flow/entity/StaffRole.java | 20 ++- .../lz/modules/flow/model/StaffRoleDto.java | 19 +++ .../flow/service/FlowRecordService.java | 2 + .../flow/service/RecordAuthService.java | 2 + .../service/StaffRoleDepartmentService.java | 3 + .../flow/service/StaffRoleService.java | 4 + .../service/impl/FlowRecordServiceImpl.java | 10 +- .../service/impl/RecordAuthServiceImpl.java | 18 +++ .../impl/StaffRoleDepartmentServiceImpl.java | 8 +- .../service/impl/StaffRoleServiceImpl.java | 7 + .../modules/sys/entity/app/ResultRecord.java | 34 +--- .../app/impl/ResultRecordServiceImpl.java | 1 + .../mapper/app/ResultRecordMapper.xml | 23 ++- .../mapper/flow/FlowDepartmentMapper.xml | 13 +- .../mapper/flow/FlowRecordMapper.xml | 85 +++++----- .../mapper/flow/StaffRoleDepartmentMapper.xml | 8 + .../resources/mapper/flow/StaffRoleMapper.xml | 48 +++--- .../mapper/generator/DepartmentsDao.xml | 16 ++ src/test/java/com/lz/mysql/MysqlMain.java | 3 +- 30 files changed, 418 insertions(+), 177 deletions(-) create mode 100644 src/main/java/com/lz/modules/app/dto/DepartmentInfos.java create mode 100644 src/main/java/com/lz/modules/flow/model/StaffRoleDto.java diff --git a/src/main/java/com/lz/common/utils/Constant.java b/src/main/java/com/lz/common/utils/Constant.java index 9dd512c3..5bf4b6e2 100644 --- a/src/main/java/com/lz/common/utils/Constant.java +++ b/src/main/java/com/lz/common/utils/Constant.java @@ -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"; } diff --git a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java index 6dc2df41..967ace03 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -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 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 staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole()); + listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(getUserId())); auth = getAuth(listAuth); } List resultDetails = resultDetailService.selectByRecordId(recordResultId); @@ -235,14 +241,24 @@ public class ResultRecordController extends AbstractController { .put("recordResultId", recordResultId); } + + public String initRole(Long staffId,Long roleId){ + List 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 flowRelations = flowRelationService.selectFlowRelationAll(); - Map staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p)); - // approvalList = [ONE_D,TWO_D,HR,BOSS] + Map staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p)); + // approvalList = [ME,ONE_D,TWO_D,HR,BOSS] List 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 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 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 staffRoles = staffRoleService.selectByRole(departmentLevel); + for(StaffRole staffRole: staffRoles ){ + List staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); + Map 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 list,int flowIndex) { + List 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(); } + + } diff --git a/src/main/java/com/lz/modules/app/dao/DepartmentsDao.java b/src/main/java/com/lz/modules/app/dao/DepartmentsDao.java index 142cfe19..b792bb26 100644 --- a/src/main/java/com/lz/modules/app/dao/DepartmentsDao.java +++ b/src/main/java/com/lz/modules/app/dao/DepartmentsDao.java @@ -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 { StaffDepartmentDto selectStaffAllDepartments(@Param("departmentId") String departmentId); int addDepartment(@Param("departments") DepartmentsEntity departments); + + DepartmentInfos selectUserAllDepartmentIds(@Param("departmentId") String departmentId); } diff --git a/src/main/java/com/lz/modules/app/dto/DepartmentInfos.java b/src/main/java/com/lz/modules/app/dto/DepartmentInfos.java new file mode 100644 index 00000000..fad3f271 --- /dev/null +++ b/src/main/java/com/lz/modules/app/dto/DepartmentInfos.java @@ -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; + +} diff --git a/src/main/java/com/lz/modules/app/service/DepartmentsService.java b/src/main/java/com/lz/modules/app/service/DepartmentsService.java index 52829f36..b235576c 100644 --- a/src/main/java/com/lz/modules/app/service/DepartmentsService.java +++ b/src/main/java/com/lz/modules/app/service/DepartmentsService.java @@ -38,5 +38,7 @@ public interface DepartmentsService extends IService { StaffDepartmentDto selectStaffAllDepartments(String departmentId); void updateDepartmentInfo(DepartmentInfosBo departmentInfosBo); + + Map selectUserAllDepartmentIds(String departmentId); } diff --git a/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java b/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java index 3e9dc04b..9b77cac1 100644 --- a/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java +++ b/src/main/java/com/lz/modules/app/service/impl/DepartmentsServiceImpl.java @@ -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 selectUserAllDepartmentIds(String departmentId) { + DepartmentInfos departmentInfos = departmentsDao.selectUserAllDepartmentIds(departmentId); + Map 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; + } + } diff --git a/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java b/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java index 7e34085b..1d814b4a 100644 --- a/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/FlowRecordMapper.java @@ -30,4 +30,7 @@ public interface FlowRecordMapper extends BaseMapper { int deleteFlowRecordById(@Param("id")Long id); + FlowRecord selectLastFlowRecordByRecordId(@Param("recordId") Long recordId); + + FlowRecord selectNotApprovalStaffIdFlowRecords(@Param("recordId") Long recordId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/dao/StaffRoleDepartmentMapper.java b/src/main/java/com/lz/modules/flow/dao/StaffRoleDepartmentMapper.java index 93cea6c5..2986d417 100644 --- a/src/main/java/com/lz/modules/flow/dao/StaffRoleDepartmentMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/StaffRoleDepartmentMapper.java @@ -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 { @@ -30,4 +33,5 @@ public interface StaffRoleDepartmentMapper extends BaseMapper selectStaffRoleDepartmentByStaffRoleId(@Param("staffRoleId") Long staffRoleId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java b/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java index e9734d3e..4fc0e08b 100644 --- a/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java +++ b/src/main/java/com/lz/modules/flow/dao/StaffRoleMapper.java @@ -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 { @@ -31,4 +34,6 @@ public interface StaffRoleMapper extends BaseMapper { StaffRole selectByStaffId(@Param("staffId") Long staffId); + + List selectByRole(@Param("role") String role); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java b/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java index 788cfa52..73cdd977 100644 --- a/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java +++ b/src/main/java/com/lz/modules/flow/entity/FlowDepartment.java @@ -9,7 +9,7 @@ import java.util.Date; * 菜单权限表 *

*流转关系表 * @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 + diff --git a/src/main/java/com/lz/modules/flow/entity/FlowRecord.java b/src/main/java/com/lz/modules/flow/entity/FlowRecord.java index a3bdf9dc..35d765dc 100644 --- a/src/main/java/com/lz/modules/flow/entity/FlowRecord.java +++ b/src/main/java/com/lz/modules/flow/entity/FlowRecord.java @@ -9,7 +9,7 @@ import java.util.Date; * 菜单权限表 *

*流转记录表 * @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 + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/entity/StaffRole.java b/src/main/java/com/lz/modules/flow/entity/StaffRole.java index 79508d20..09d73476 100644 --- a/src/main/java/com/lz/modules/flow/entity/StaffRole.java +++ b/src/main/java/com/lz/modules/flow/entity/StaffRole.java @@ -9,7 +9,7 @@ import java.util.Date; * 菜单权限表 *

*流转关系表 * @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 + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java b/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java new file mode 100644 index 00000000..326b255b --- /dev/null +++ b/src/main/java/com/lz/modules/flow/model/StaffRoleDto.java @@ -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; + } + + +} diff --git a/src/main/java/com/lz/modules/flow/service/FlowRecordService.java b/src/main/java/com/lz/modules/flow/service/FlowRecordService.java index 056fb5a9..5611fc00 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowRecordService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowRecordService.java @@ -30,5 +30,7 @@ public interface FlowRecordService extends IService { int deleteFlowRecordById(Long id); + FlowRecord selectLastFlowRecordByRecordId(Long recordResultId); + FlowRecord selectNotApprovalStaffIdFlowRecords(Long recordId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/RecordAuthService.java b/src/main/java/com/lz/modules/flow/service/RecordAuthService.java index 25c0b576..4e87d5f1 100644 --- a/src/main/java/com/lz/modules/flow/service/RecordAuthService.java +++ b/src/main/java/com/lz/modules/flow/service/RecordAuthService.java @@ -34,4 +34,6 @@ public interface RecordAuthService extends IService { List selectAuthInfo(Long roldId); + + Map selectRoleIdByStaffRoleInfo(String flowStaffIdRole); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/StaffRoleDepartmentService.java b/src/main/java/com/lz/modules/flow/service/StaffRoleDepartmentService.java index 5cc53085..8a04ae95 100644 --- a/src/main/java/com/lz/modules/flow/service/StaffRoleDepartmentService.java +++ b/src/main/java/com/lz/modules/flow/service/StaffRoleDepartmentService.java @@ -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; + /** *

* 流转关系表 服务类 @@ -30,4 +32,5 @@ public interface StaffRoleDepartmentService extends IService selectStaffRoleDepartmentByStaffRoleId(Long staffRoleId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/StaffRoleService.java b/src/main/java/com/lz/modules/flow/service/StaffRoleService.java index 249945d5..552413ee 100644 --- a/src/main/java/com/lz/modules/flow/service/StaffRoleService.java +++ b/src/main/java/com/lz/modules/flow/service/StaffRoleService.java @@ -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; + /** *

* 流转关系表 服务类 @@ -31,4 +33,6 @@ public interface StaffRoleService extends IService { StaffRole selectByStaffId(Long staffId); + + List selectByRole(String departmentLevel); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java index ccbda6ec..af24e959 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowRecordServiceImpl.java @@ -51,14 +51,20 @@ public class FlowRecordServiceImpl extends ServiceImpl @@ -64,5 +70,17 @@ public class RecordAuthServiceImpl extends ServiceImpl selectRoleIdByStaffRoleInfo(String flowStaffIdRole) { + Map staffEntityMap = new HashMap<>(); + if (StringUtil.isNotBlank(flowStaffIdRole)) { + List list = JSONObject.parseArray(flowStaffIdRole, StaffRoleDto.class); + if (CollectionUtils.isNotEmpty(list)) { + staffEntityMap = list.stream().collect(Collectors.toMap(StaffRoleDto::getStaffId, StaffRoleDto::getRole)); + } + } + return staffEntityMap; + } + } diff --git a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleDepartmentServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleDepartmentServiceImpl.java index dcb7d7cd..227d8dcb 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleDepartmentServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleDepartmentServiceImpl.java @@ -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; + /** *

* 流转关系表 服务类 @@ -58,8 +60,10 @@ public class StaffRoleDepartmentServiceImpl extends ServiceImpl selectStaffRoleDepartmentByStaffRoleId(Long staffRoleId) { + return staffRoleDepartmentMapper.selectStaffRoleDepartmentByStaffRoleId(staffRoleId); + } } diff --git a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java index 30ad54db..0215080a 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/StaffRoleServiceImpl.java @@ -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; + /** *

* 流转关系表 服务类 @@ -63,5 +65,10 @@ public class StaffRoleServiceImpl extends ServiceImpl selectByRole(String role) { + return staffRoleMapper.selectByRole(role); + } + } diff --git a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java index 8e9f1aea..eb7f5813 100644 --- a/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java +++ b/src/main/java/com/lz/modules/sys/entity/app/ResultRecord.java @@ -11,7 +11,7 @@ import java.util.Date; * 菜单权限表 *

*业绩记录表 * @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 + "}"; } } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java index bf8240ba..0bdc6ae5 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java @@ -97,6 +97,7 @@ public class ResultRecordServiceImpl extends ServiceImpl> departmentMap = null; + if(employeesDto == null || employeesDto.getExpire() < new Date().getTime()){ departmentMap = getStringListMap(tDepartments); Date expire = DateUtils.addMinute(new Date(),30); diff --git a/src/main/resources/mapper/app/ResultRecordMapper.xml b/src/main/resources/mapper/app/ResultRecordMapper.xml index 2aca7878..c6b540ab 100644 --- a/src/main/resources/mapper/app/ResultRecordMapper.xml +++ b/src/main/resources/mapper/app/ResultRecordMapper.xml @@ -15,16 +15,18 @@ - - + - 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 + + + @@ -39,8 +41,7 @@ remark, staff_id, type, - init_role_id, - current_flow_staff_id, + flow_staff_id_role, is_delete, gmt_create, gmt_modified @@ -52,8 +53,7 @@ #{ remark}, #{ staffId}, #{ type}, - #{ initRoleId}, - #{ currentFlowStaffId}, + #{ flowStaffIdRole}, 0, now(), now() @@ -74,8 +74,7 @@ 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} @@ -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 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 - select * from lz_flow_department where is_delete = 0 and taff_id = #{staffId} limit 1 diff --git a/src/main/resources/mapper/flow/FlowRecordMapper.xml b/src/main/resources/mapper/flow/FlowRecordMapper.xml index 9875db8b..0ca19c0f 100644 --- a/src/main/resources/mapper/flow/FlowRecordMapper.xml +++ b/src/main/resources/mapper/flow/FlowRecordMapper.xml @@ -13,66 +13,63 @@ - - + - 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 insert into lz_flow_record( - department_id, - department_level, - record_id, - approval_staff_id, - approval_staff_name, - role_id, - flow_name, - record_staff_id, - flow_id, - flow_index, - relation_index, - is_delete, - gmt_create, - gmt_modified + department_id, + department_level, + record_id, + approval_staff_id, + approval_staff_name, + flow_name, + record_staff_id, + flow_id, + flow_index, + status, + is_delete, + gmt_create, + gmt_modified )values( - #{ departmentId}, - #{ departmentLevel}, - #{ recordId}, - #{ approvalStaffId}, - #{ approvalStaffName}, - #{ roleId}, - #{ flowName}, - #{ recordStaffId}, - #{ flowId}, - #{ flowIndex}, - #{ relationIndex}, - 0, - now(), - now() + #{ departmentId}, + #{ departmentLevel}, + #{ recordId}, + #{ approvalStaffId}, + #{ approvalStaffName}, + #{ flowName}, + #{ recordStaffId}, + #{ flowId}, + #{ flowIndex}, + #{ status}, + 0, + now(), + now() ) update - lz_flow_record + lz_flow_record is_delete = #{isDelete}, gmt_create = #{gmtCreate}, @@ -81,12 +78,11 @@ 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} @@ -95,8 +91,8 @@ 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 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 + + + + + + diff --git a/src/main/resources/mapper/flow/StaffRoleDepartmentMapper.xml b/src/main/resources/mapper/flow/StaffRoleDepartmentMapper.xml index 8cc0acd3..000d5dbd 100644 --- a/src/main/resources/mapper/flow/StaffRoleDepartmentMapper.xml +++ b/src/main/resources/mapper/flow/StaffRoleDepartmentMapper.xml @@ -74,5 +74,13 @@ update lz_staff_role_department set is_delete = 1 where id=#{id} limit 1 + + + + + + diff --git a/src/main/resources/mapper/flow/StaffRoleMapper.xml b/src/main/resources/mapper/flow/StaffRoleMapper.xml index e258a2e9..5851817a 100644 --- a/src/main/resources/mapper/flow/StaffRoleMapper.xml +++ b/src/main/resources/mapper/flow/StaffRoleMapper.xml @@ -10,47 +10,51 @@ + - 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 insert into lz_staff_role( - staff_id, - role, - is_delete, - gmt_create, - gmt_modified + staff_id, + role, + record_role_id, + is_delete, + gmt_create, + gmt_modified )values( - #{ staffId}, - #{ role}, - 0, - now(), - now() + #{ staffId}, + #{ role}, + #{ recordRoleId}, + 0, + now(), + now() ) update - lz_staff_role + lz_staff_role is_delete = #{isDelete}, gmt_create = #{gmtCreate}, staff_id = #{staffId}, - role = #{role} + role = #{role}, + record_role_id = #{recordRoleId} ,gmt_modified = now() where id = #{id} @@ -59,23 +63,29 @@ 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 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 + + + diff --git a/src/main/resources/mapper/generator/DepartmentsDao.xml b/src/main/resources/mapper/generator/DepartmentsDao.xml index df137448..8a43c61b 100644 --- a/src/main/resources/mapper/generator/DepartmentsDao.xml +++ b/src/main/resources/mapper/generator/DepartmentsDao.xml @@ -91,6 +91,7 @@ where a.department_id = #{departmentId} + 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 @@ + + diff --git a/src/test/java/com/lz/mysql/MysqlMain.java b/src/test/java/com/lz/mysql/MysqlMain.java index 25d2366b..b76f4129 100644 --- a/src/test/java/com/lz/mysql/MysqlMain.java +++ b/src/test/java/com/lz/mysql/MysqlMain.java @@ -61,7 +61,8 @@ public class MysqlMain { } List list = new ArrayList(); - list.add(new TablesBean("lz_flow_department")); + list.add(new TablesBean("lz_staff_role")); + List list2 = new ArrayList(); Map map = MysqlUtil2ShowCreateTable.getComments(); From 00ed287025841becc817584e81ab292b65c5df44 Mon Sep 17 00:00:00 2001 From: quyixiao <2621048238@qq.com> Date: Thu, 20 Aug 2020 15:08:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lz/modules/app/controller/TestController.java | 6 ------ .../com/lz/modules/app/entity/StaffEntity.java | 4 ---- .../com/lz/modules/app/resp/ResultRecordResp.java | 14 ++------------ .../impl/DepartmentsStaffRelateServiceImpl.java | 2 +- .../modules/app/service/impl/StaffServiceImpl.java | 1 - .../flow/service/impl/RecordAuthServiceImpl.java | 3 +-- .../service/app/impl/ResultRecordServiceImpl.java | 4 ++-- .../resources/mapper/app/ResultRecordMapper.xml | 2 +- .../resources/mapper/flow/FlowDepartmentMapper.xml | 2 +- 9 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/lz/modules/app/controller/TestController.java b/src/main/java/com/lz/modules/app/controller/TestController.java index 18f4f6b3..02c19cce 100644 --- a/src/main/java/com/lz/modules/app/controller/TestController.java +++ b/src/main/java/com/lz/modules/app/controller/TestController.java @@ -63,12 +63,6 @@ public class TestController { } } - - - - - - @RequestMapping("/test/relate") public void relate(){ List list = departmentsStaffRelateService.selectAll(); diff --git a/src/main/java/com/lz/modules/app/entity/StaffEntity.java b/src/main/java/com/lz/modules/app/entity/StaffEntity.java index 9146c6a3..c04b2820 100644 --- a/src/main/java/com/lz/modules/app/entity/StaffEntity.java +++ b/src/main/java/com/lz/modules/app/entity/StaffEntity.java @@ -109,10 +109,6 @@ public class StaffEntity implements Serializable { * 工号 */ private String jobNumber; - /** - * 是否为领导 不存入staff表中 - * */ - private Integer isLeader; //密码 diff --git a/src/main/java/com/lz/modules/app/resp/ResultRecordResp.java b/src/main/java/com/lz/modules/app/resp/ResultRecordResp.java index 8aca047d..3346ff4a 100644 --- a/src/main/java/com/lz/modules/app/resp/ResultRecordResp.java +++ b/src/main/java/com/lz/modules/app/resp/ResultRecordResp.java @@ -34,16 +34,6 @@ public class ResultRecordResp { private String departmentName; - public String getStatusStr() { - if (this.status == 0) { - return "新建"; - } else if (this.status == 1) { - return "审批中"; - } else if (this.status == 2) { - return "拒绝"; - } else if (this.status == 3) { - return "审批通过"; - } - return ""; - } + private Integer type ; + } diff --git a/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java b/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java index 733d3454..676d97b8 100644 --- a/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java +++ b/src/main/java/com/lz/modules/app/service/impl/DepartmentsStaffRelateServiceImpl.java @@ -45,7 +45,7 @@ public class DepartmentsStaffRelateServiceImpl extends ServiceImpl impleme staffEntity.setUnionId(staffBo.getUnionId()); staffEntity.setAvatar(staffBo.getAvatar()); staffEntity.setJobNumber(staffBo.getEmployeeNo()); - staffEntity.setIsLeader(staffBo.getIsLeader()); return staffEntity; } diff --git a/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java index b44c36e4..2404036f 100644 --- a/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java +++ b/src/main/java/com/lz/modules/flow/service/impl/RecordAuthServiceImpl.java @@ -33,7 +33,6 @@ public class RecordAuthServiceImpl extends ServiceImpl list = JSONObject.parseArray(flowStaffIdRole, StaffRoleDto.class); if (CollectionUtils.isNotEmpty(list)) { - staffEntityMap = list.stream().collect(Collectors.toMap(StaffRoleDto::getStaffId, StaffRoleDto::getRole)); + staffEntityMap = list.stream().collect(Collectors.toMap(StaffRoleDto::getStaffId, StaffRoleDto::getRoleId)); } } return staffEntityMap; diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java index 0bdc6ae5..f98137b0 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultRecordServiceImpl.java @@ -124,6 +124,7 @@ public class ResultRecordServiceImpl extends ServiceImpl(setStaffId); } } + if(StringUtil.isNotBlank(params.getName())){ List staffEntities = staffService.selectByName(params.getName()); if(CollectionUtils.isNotEmpty(staffEntities)){ @@ -133,9 +134,8 @@ public class ResultRecordServiceImpl extends ServiceImpl resultRecordMapper.selectByCondition(page, params) diff --git a/src/main/resources/mapper/app/ResultRecordMapper.xml b/src/main/resources/mapper/app/ResultRecordMapper.xml index c6b540ab..38c51b7c 100644 --- a/src/main/resources/mapper/app/ResultRecordMapper.xml +++ b/src/main/resources/mapper/app/ResultRecordMapper.xml @@ -130,11 +130,11 @@ #{item} + and staff_id = #{req.staffId} order by id desc - - select * from lz_flow_department where is_delete = 0 and taff_id = #{staffId} limit 1 + select * from lz_flow_department where is_delete = 0 and staff_id = #{staffId} limit 1