diff --git a/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java b/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java index f0c82d48..0ae139aa 100644 --- a/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java +++ b/src/main/java/com/lz/common/emun/WorkMsgTypeEnum.java @@ -15,6 +15,7 @@ public enum WorkMsgTypeEnum { //绩效通过人事,老板审核的最终审核通知 PASS(3, "绩效通过", "去查看", "# 绩效通过\n ## 你的绩效已经通过"), URGING(4, "绩效催办", "去审批", "# 绩效催办\n ## @提醒您审批"), + END(5, "绩效终止", "去查看", "# 绩效终止\n ## @,你的绩效终止"), ; int type; String title; diff --git a/src/main/java/com/lz/common/utils/Constant.java b/src/main/java/com/lz/common/utils/Constant.java index c7705ffd..1182a9d7 100644 --- a/src/main/java/com/lz/common/utils/Constant.java +++ b/src/main/java/com/lz/common/utils/Constant.java @@ -167,7 +167,12 @@ public class Constant { public static final String SELF = "self"; public static final String TYPE = "type"; + public static final String node = "node"; + public static final String startNode = "startNode"; + public static final String OSS_BUCCKET = "my-wallet"; public static final Integer TWO = 2; public static final Integer ONE = 1; + public static final String WENHUAJIAZHIGUAN = "

做人:相信、包容、担当 

做事:用户第一、求真、极致

"; + public static final String WENHUAJIAZHIGUAN_TARGET = "

做人:相信、包容、担当  3.5分

1、尊重合作伙伴,坚决维护公司形象
2、倾听不同意见,积极参加各类公司项目活动,通过正确渠道(直属上级/部门负责人/HR)反馈问题提出改进意见;决策前充分讨论,决策后无论个人是否有异议,必须从言行上完全予以支持
3、严格遵守公司规章制度,遇事不推诿、不甩锅,勇于承担责任
4、实事求是,诚实守信,独立自主思考,珍惜彼此时间无需他人监督催促,客观反馈问题,遇到bug/工作问题,以查到底
5、今日事今日毕,按时汇报工作,今天的表现是明天最低的要求,不断追求更好的结果
6、以客户为中心,提供专业服务,做好公司内外部协作,无实质投诉
3.75分
1、拥抱变化,对公司不同层面的调整,持乐见状态,并予以高度支持配合
2、以团队目标为导向,包容不同类型的伙伴,不将个人喜好带入工作,接受更优秀的人才与思想,取长补短,互相成就
3、勇于接受挑战承担责任,为实现目标全力以赴,主动分享业务知识与经验,正面影响团队,改善团队士气与氛围
4、深入理解公司业务与部门协作方式,保持好奇心,以结果倒推需求,持续思考“为什么做”,辩证思考执行,保证大方向的正确与工作方式的持续迭代
5、对日常工作有极致要求,多角度对问题进行辩证探究,不钻牛角尖不随风摇摆,以最佳结果为导向持续倒逼更优方案
6、辨证看待用户意见,要以“用户为师”的心态坚持原则寻求解决,最终达到用户和公司都受益的结果"; } diff --git a/src/main/java/com/lz/common/utils/DingTalkUtil.java b/src/main/java/com/lz/common/utils/DingTalkUtil.java index 45ce1bde..5ad039d0 100644 --- a/src/main/java/com/lz/common/utils/DingTalkUtil.java +++ b/src/main/java/com/lz/common/utils/DingTalkUtil.java @@ -8,6 +8,8 @@ import com.dingtalk.api.DingTalkClient; import com.dingtalk.api.request.*; import com.dingtalk.api.response.*; import com.lz.modules.app.entity.StaffEntity; +import com.lz.modules.app.entity.StaffOccupationEntity; +import com.lz.modules.app.service.StaffOccupationService; import com.lz.modules.app.service.StaffService; import com.lz.modules.job.model.responseBo.DepartmentInfosBo; import com.lz.modules.job.model.responseBo.DepartmentStaffBo; @@ -55,6 +57,9 @@ public class DingTalkUtil { @Autowired private SysUserTokenService sysUserTokenService; + @Autowired + StaffOccupationService staffOccupationService; + CloseableHttpClient getHttpClient(){ @@ -325,20 +330,26 @@ public class DingTalkUtil { if(json.getIntValue("errcode") == 0){ String employeeId = json.getString("userid"); StaffEntity staffEntity = staffService.selectStaffByEmployeeId(employeeId); + if(staffEntity != null){ - //登录操作 - SysUserEntity user = new SysUserEntity(); - user.setPassword(staffEntity.getPassword()); - user.setMobile(staffEntity.getMobile()); - user.setUserId(staffEntity.getId()); - user.setEmail(staffEntity.getEmail()); - user.setSalt(staffEntity.getSalt()); - user.setStatus(1); - user.setType(1); - user.setRealName(staffEntity.getName()); - user.setUsername(staffEntity.getMobile()); - user.setUserNo(staffEntity.getMobile()); - return sysUserTokenService.createTokenSetTokenCode(user, code); + StaffOccupationEntity staffOccupationEntity = + staffOccupationService.getStaffOccupationByStaffId(staffEntity.getId()); + if(staffOccupationEntity != null && staffOccupationEntity.getStaffStatus() == 0){ + //登录操作 + SysUserEntity user = new SysUserEntity(); + user.setPassword(staffEntity.getPassword()); + user.setMobile(staffEntity.getMobile()); + user.setUserId(staffEntity.getId()); + user.setEmail(staffEntity.getEmail()); + user.setSalt(staffEntity.getSalt()); + user.setStatus(1); + user.setType(1); + user.setRealName(staffEntity.getName()); + user.setUsername(staffEntity.getMobile()); + user.setUserNo(staffEntity.getMobile()); + return sysUserTokenService.createTokenSetTokenCode(user, code); + } + } return R.error("用户不存在"); } diff --git a/src/main/java/com/lz/common/utils/PageUtils.java b/src/main/java/com/lz/common/utils/PageUtils.java index 559de80a..3d286efb 100644 --- a/src/main/java/com/lz/common/utils/PageUtils.java +++ b/src/main/java/com/lz/common/utils/PageUtils.java @@ -57,6 +57,9 @@ public class PageUtils implements Serializable { this.totalPage = (int) Math.ceil((double) totalCount / pageSize); } + public PageUtils() { + + } public PageUtils doSelect(ISelect select) { IPage page = new Page(this.currPage, this.pageSize); diff --git a/src/main/java/com/lz/config/ShiroConfig.java b/src/main/java/com/lz/config/ShiroConfig.java index 386981fe..98c33d21 100644 --- a/src/main/java/com/lz/config/ShiroConfig.java +++ b/src/main/java/com/lz/config/ShiroConfig.java @@ -64,8 +64,6 @@ public class ShiroConfig { filterMap.put("/captcha.jpg", "anon"); filterMap.put("/aaa.txt", "anon"); filterMap.put("/dtlg/login", "anon"); - filterMap.put("/oneCode/**", "anon"); - filterMap.put("/modules/**", "anon");//临时添加,后期去掉 filterMap.put("/dtlg/luck", "anon"); filterMap.put("/dtlg/look", "anon"); filterMap.put("/dtlg/jump", "anon"); diff --git a/src/main/java/com/lz/modules/app/controller/FlowManagerController.java b/src/main/java/com/lz/modules/app/controller/FlowManagerController.java new file mode 100644 index 00000000..65d5556c --- /dev/null +++ b/src/main/java/com/lz/modules/app/controller/FlowManagerController.java @@ -0,0 +1,144 @@ +package com.lz.modules.app.controller; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import com.alibaba.fastjson.JSON; +import com.lz.common.utils.PageUtils; +import com.lz.common.utils.R; +import com.lz.modules.app.entity.StaffEntity; +import com.lz.modules.app.resp.Step; +import com.lz.modules.flow.entity.Flow; +import com.lz.modules.flow.entity.FlowDepartment; +import com.lz.modules.flow.entity.FlowManager; +import com.lz.modules.flow.entity.FlowRelation; +import com.lz.modules.flow.model.FlowDto; +import com.lz.modules.flow.model.StaffRoleDto; +import com.lz.modules.flow.service.FlowDepartmentService; +import com.lz.modules.flow.service.FlowManagerService; +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 流程管理表 + * + * @author zgh + * @email zgh@ldxinyong.com + * @date 2020-09-22 17:25:35 + */ +@RestController +@RequestMapping("user/lzflowmanager") +public class FlowManagerController { + @Autowired + private FlowManagerService flowManagerService; + + @Autowired + private FlowDepartmentService flowDepartmentService; + + /** + * 列表 + */ + @RequestMapping("/list") + @RequiresPermissions("user:lzflowmanager:list") + public R list(@RequestParam Map params){ + PageUtils page = flowManagerService.queryPage(params); + + return R.ok().put("page", page); + } + + @RequestMapping("/menu/list") + public List menuList(){ + List flowDtoList = flowManagerService.getFowList(); + return flowDtoList; + } + + /** + * 信息 + */ + @RequestMapping("/info/{id}") + @RequiresPermissions("user:lzflowmanager:info") + public R info(@PathVariable("id") Long id){ + FlowManager lzFlowManager = flowManagerService.selectFlowManagerById(id); + + return R.ok().put("lzFlowManager", lzFlowManager); + } + + /** + * 信息 + */ + @RequestMapping("/get/flowInfo/{staffId}") + public R flowInfo(@PathVariable("staffId") Long staffId){ + return flowDepartmentService.selectFlowManager(staffId); + + + } + + + + /** + * 信息 + */ + @RequestMapping("/get/flow/{id}") + public R flow(@PathVariable("id") Long staffId){ + + + + + + + return R.ok(); + } + + + /** + * 信息 + */ + @RequestMapping("/save/flow") + public R saveFlow(Long id ,String data){ + + return R.ok(); + } + + /** + * 保存 + */ + @RequestMapping("/save") + @RequiresPermissions("user:lzflowmanager:save") + public R save(@RequestBody FlowManager lzFlowManager){ + flowManagerService.insertFlowManager(lzFlowManager); + + return R.ok(); + } + + /** + * 修改 + */ + @RequestMapping("/update") + @RequiresPermissions("user:lzflowmanager:update") + public R update(@RequestBody FlowManager lzFlowManager){ + flowManagerService.updateById(lzFlowManager); + + return R.ok(); + } + + /** + * 删除 + */ + @RequestMapping("/delete") + @RequiresPermissions("user:lzflowmanager:delete") + public R delete(@RequestBody Long[] ids){ + flowManagerService.deleteBatchIds(Arrays.asList(ids)); + + return R.ok(); + } + + +} 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 bbc7ccfb..da9b9341 100644 --- a/src/main/java/com/lz/modules/app/controller/ResultRecordController.java +++ b/src/main/java/com/lz/modules/app/controller/ResultRecordController.java @@ -40,7 +40,6 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.io.PrintWriter; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; @@ -133,7 +132,6 @@ public class ResultRecordController extends AbstractController { } } } - R r = lzResultRecordService.queryPage(req, user); r .put("departmentList1", departmentList1) .put("departmentList2", departmentList2) @@ -156,7 +154,7 @@ public class ResultRecordController extends AbstractController { @RequestMapping("/getStaffResultDetail") public R getStaffResultDetail(ResultRecordReq req) { int yeJiCheckNum = 0; - int wenHuaJiaZhiGuanNum = 0; + int wenHuaJiaZhiGuanNum = 1; int lastResultNum = 2; int commentNum = 0; int recordType = req.getRecordType(); @@ -230,18 +228,14 @@ public class ResultRecordController extends AbstractController { list.add(resp); } if (tempType2 == 0) { - wenHuaJiaZhiGuanNum = 2; list.add(resultDetailService.getYeJiKaoHe(BigDecimal.ZERO)); list.add(resultDetailService.getWenHuaJiaZhiGua1(auth)); - list.add(resultDetailService.getWenHuaJiaZhiGua2(auth)); } } else { yeJiCheckNum = 1; - wenHuaJiaZhiGuanNum = 2; list.add(resultDetailService.getYeJi()); list.add(resultDetailService.getYeJiKaoHe(BigDecimal.ZERO)); list.add(resultDetailService.getWenHuaJiaZhiGua1(auth)); - list.add(resultDetailService.getWenHuaJiaZhiGua2(auth)); } list.add(resultDetailService.getWenHuaJiaZhiGuaResult1(sumWenHuaJiaZhiGuan)); list.add(resultDetailService.getWenHuaJiaZhiGuaResult2()); @@ -359,7 +353,7 @@ public class ResultRecordController extends AbstractController { @RequestMapping("/recordIdsSubmit") public R recordIdsSubmit(String recordIds,Integer batchOpt) { if (StringUtil.isBlank(recordIds)) { - return R.error("请选择提交"); + return R.error("请勾选需要批量操作业绩!"); } List records = new ArrayList<>(); String ids[] = recordIds.split(","); @@ -370,29 +364,68 @@ public class ResultRecordController extends AbstractController { } } } - if (records == null) { - return R.error("请选择状态为待提交的记录"); - } R r = null; - if(batchOpt == 1){ - List resultRecords = resultRecordService.selectResultRecordByIds(records); + List resultRecords = resultRecordService.selectResultRecordByIds(records); + if(batchOpt == 1){ //提交审批 for (ResultRecord resultRecord : resultRecords) { - if (!resultRecord.getStatus().equals(3)) { - return R.error("您的提交记录中有状态不为侍提交的,请重新选择。"); + if (!StringUtil.in(resultRecord.getStatus(),1,2,3,5)) { + return R.error("您的提交记录中有状态不正确,请重新选择"); } } for (ResultRecord resultRecord : resultRecords) { - r = resultRecordService.approval(resultRecord.getId(), getUserId(),null); + r = resultRecordService.approval(resultRecord.getId(), resultRecord.getCurrentApprovalStaffId(),null,false); if (!r.isSuccess()) { return r; } } - }else if(batchOpt ==2 ){ - - }else if (batchOpt == 3 ){ - - }else if (batchOpt == 4 ){ - + } else if (batchOpt == 2) { //终止流程 + for (ResultRecord resultRecord : resultRecords) { + if (!StringUtil.in(resultRecord.getStatus(),1,2,3,5,6)) { + return R.error("您的提交记录中有状态不正确,请重新选择"); + } + } + for (ResultRecord resultRecord : resultRecords) { + r = resultRecordService.approval(resultRecord.getId(), resultRecord.getCurrentApprovalStaffId(), 7, true); + if (!r.isSuccess()) { + return r; + } + } + } else if (batchOpt == 3 || batchOpt == 4 ) { // 3 申述无效,直接驳回 ,4 领导重新打分 + for (ResultRecord resultRecord : resultRecords) { + if (!StringUtil.in(resultRecord.getStatus(),6)) { + return R.error("您的提交记录中有状态不正确,请重新选择"); + } + } + if(batchOpt == 3 ){ + for (ResultRecord resultRecord : resultRecords) { + r = resultRecordService.reject(resultRecord,1); //更新驳回状态 + if (!r.isSuccess()) { + return r; + } + } + } else { + for (ResultRecord resultRecord : resultRecords) { + List list = flowRecordService.selectFlowRecordByResultRecordIdType(resultRecord.getId(), 2); + for (int i = list.size() - 1; i >= 0; i--) { + FlowRecord flowRecord = list.get(i); + Long roleId = recordAuthService.getRoleIdByStaffRoleInfo(flowRecord.getFlowStaffIdRole(), flowRecord.getApprovalStaffId()); + List listAuth = recordAuthService.selectAuthInfo(roleId); + Auth auth = recordAuthService.getAuth(listAuth); + if (auth.getEditScore() > 0) {//表示是评分 + resultRecord.setFlowStaffIdRole(flowRecord.getFlowStaffIdRole()); + resultRecord.setCurrentApprovalStaffId(flowRecord.getApprovalStaffId()); + resultRecord.setCurrentApprovalStaffName(flowRecord.getApprovalStaffName()); + resultRecord.setStatus(1); + // 直接还原权限 + resultRecordService.updateResultRecordById(resultRecord); + break; + } else { + flowRecord.setStatus(1);//如果不是领导打分的话,直接删除掉 + flowRecordService.updateFlowRecordById(flowRecord); + } + } + } + } } if (r != null && r.isSuccess()) {//批量提交 StaffEntity mySelf = (StaffEntity) r.get("from"); @@ -492,12 +525,18 @@ public class ResultRecordController extends AbstractController { ResultDetail old = resultDetailService.selectResultDetailById(req.getId()); if (old != null) { com.lz.modules.app.utils.BeanUtils.copyProperty(old, req, false); + if(old.getType().equals(2)){ + old.setTarget(Constant.WENHUAJIAZHIGUAN); + } resultDetailService.updateResultDetailById(old); } else { ResultDetail resultDetail = new ResultDetail(); BeanUtils.copyProperties(req, resultDetail); resultDetail.setRecordId(resultRecord.getId()); resultDetail.setStaffId(resultRecord.getStaffId()); + if(req.getType().equals(2)){ + resultDetail.setTarget(Constant.WENHUAJIAZHIGUAN); + } resultDetailService.insertResultDetail(resultDetail); } List resultDetails = resultDetailService.selectByRecordId(resultRecord.getId()); diff --git a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java index 398b70d2..29d3f5b3 100644 --- a/src/main/java/com/lz/modules/app/controller/StaffRoleController.java +++ b/src/main/java/com/lz/modules/app/controller/StaffRoleController.java @@ -80,8 +80,7 @@ public class StaffRoleController { List roles = recordRoleService.selectAll(); return R.ok().put("lzStaffRole", lzStaffRole) .put("staffs", newList) - .put("targetRoles", roles) - ; + .put("targetRoles", roles); } /** 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 02c19cce..829e1482 100644 --- a/src/main/java/com/lz/modules/app/controller/TestController.java +++ b/src/main/java/com/lz/modules/app/controller/TestController.java @@ -1,18 +1,26 @@ package com.lz.modules.app.controller; +import com.alibaba.fastjson.JSON; import com.lz.modules.app.dao.DepartmentsDao; 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.resp.Step; 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.model.FlowModel; import com.lz.modules.sys.entity.app.ResultRecord; +import com.lz.modules.sys.service.app.ResultDetailService; import com.lz.modules.sys.service.app.ResultRecordService; +import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.swing.*; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -26,6 +34,12 @@ public class TestController { private DepartmentsService departmentsService; + @Autowired + private ResultDetailService resultDetailService; + + @Autowired + private StaffService staffService; + @Autowired private DepartmentsStaffRelateService departmentsStaffRelateService; @@ -72,4 +86,63 @@ public class TestController { departmentsStaffRelateService.updateById(l); } } + + /** + * { + * "type": "node", + * "left": 818, + * "top": 510, + * "uuid": "id3", + * "prev": [ + * "id1", + * "id2" + * ], + * "next": [ + * "id4", + * "id5" + * ], + * "formData": { + * "stepName": "名称1", + * "ruleGroupList": [{ + * "name": "名称2", + * "nextStep": "id5" + * }, + * { + * "name": "名称6", + * "nextStep": "id7" + * } + * ] + * }, + * "nextIfId": "id12", + * "nextElseId": "id11" + * } + */ + @RequestMapping("/test/step") + public void step(){ + Long staffId = 294l; + ResultRecord resultRecord = new ResultRecord(); + resultRecord.setType(2); + resultRecord.setStaffId(staffId); + DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(resultRecord.getStaffId()); + resultRecord.setDepartmentId(departmentsStaffRelateEntity.getDepartmentId()); + List test = resultDetailService.getStepList(resultRecord); + List list = new ArrayList<>(); + if(CollectionUtils.isNotEmpty(test)){ + Step step = test.get(0); + StaffEntity staffEntity = staffService.selectStaffById(staffId); + if(staffEntity !=null && !staffEntity.getName().equals(step.getName())){ + list.add(staffEntity.getName()); + } + for(Step s:test){ + list.add(s.getName()); + } + } + System.out.println(JSON.toJSONString(list)); + List flowModels = new ArrayList<>(); + FlowModel flowModel = new FlowModel(); + + for(String s:list){ + + } + } } 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 c04b2820..3d22e43d 100644 --- a/src/main/java/com/lz/modules/app/entity/StaffEntity.java +++ b/src/main/java/com/lz/modules/app/entity/StaffEntity.java @@ -19,6 +19,15 @@ import lombok.Data; public class StaffEntity implements Serializable { private static final long serialVersionUID = 1L; + public StaffEntity() { + + } + + public StaffEntity(Long id,String name) { + this.id = id; + this.name = name; + } + /** * 自增主键 */ diff --git a/src/main/java/com/lz/modules/app/enums/FlowNodeEnum.java b/src/main/java/com/lz/modules/app/enums/FlowNodeEnum.java new file mode 100644 index 00000000..d5f6cc47 --- /dev/null +++ b/src/main/java/com/lz/modules/app/enums/FlowNodeEnum.java @@ -0,0 +1,39 @@ +package com.lz.modules.app.enums; + +public enum FlowNodeEnum { + + startNode("开始", "startNode"), + endNode("结束", "endNode"), + tempNode("案例", "tempNode"), + ifNode("条件", "ifNode"), + expandNode("分组", "expandNode"), + nodeNode("节点", "nodeNode"); + + private String name; + private String desc ; + + FlowNodeEnum(String name, String desc) { + this.name = name; + this.desc = desc; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public static void main(String[] args) { + System.out.println(FlowNodeEnum.endNode.desc); + } +} diff --git a/src/main/java/com/lz/modules/equipment/controller/EmployeeController.java b/src/main/java/com/lz/modules/equipment/controller/EmployeeController.java index 7c5e60ea..9bf1e440 100644 --- a/src/main/java/com/lz/modules/equipment/controller/EmployeeController.java +++ b/src/main/java/com/lz/modules/equipment/controller/EmployeeController.java @@ -13,6 +13,7 @@ import com.lz.modules.equipment.service.SpecialApplyInfoService; import com.lz.modules.sys.controller.AbstractController; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -43,6 +44,7 @@ public class EmployeeController extends AbstractController { private IEquipmentInfoService iEquipmentInfoService; @PostMapping("findEmployeeByName") + @RequiresPermissions("user:device:pandian") public R findEmployeeByName(@RequestBody @ApiParam FindByNameModel nameModel){ PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect( page -> staffService.selectBySearchName(page, nameModel) @@ -52,6 +54,7 @@ public class EmployeeController extends AbstractController { } @PostMapping("findSpecialApplyByName") + @RequiresPermissions("user:device:pandian") public R findSpecialApplyByName(@RequestBody @ApiParam FindByNameModel nameModel){ List data = new ArrayList<>(); PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect( @@ -64,6 +67,7 @@ public class EmployeeController extends AbstractController { @PostMapping("findUsersEquipmentsByName") + @RequiresPermissions("user:device:pandian") public R findUsersEquipmentsByName(@RequestBody @ApiParam FindEquipmentsByNameModel nameModel){ PageUtils pageUtils = PageUtils.startPage(nameModel.getCurrPage(), nameModel.getPageSize()).doSelect( diff --git a/src/main/java/com/lz/modules/equipment/controller/EquipmentBrandController.java b/src/main/java/com/lz/modules/equipment/controller/EquipmentBrandController.java index 87e385d5..a357bcc6 100644 --- a/src/main/java/com/lz/modules/equipment/controller/EquipmentBrandController.java +++ b/src/main/java/com/lz/modules/equipment/controller/EquipmentBrandController.java @@ -10,6 +10,7 @@ import com.lz.modules.equipment.entity.EquipmentType; import com.lz.modules.equipment.entity.resp.EquipmentBrandResp; import com.lz.modules.equipment.service.EquipmentBrandService; import com.lz.modules.equipment.service.IEquipmentTypeService; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -56,6 +57,7 @@ public class EquipmentBrandController { * @throws Exception 异常 */ @RequestMapping("/modules/brand/equipmentBrandAdd") + @RequiresPermissions("user:device:brand:save") public R equipmentBrandAdd(@RequestBody EquipmentBrandReq req) throws Exception { EquipmentBrand equipmentBrand = new EquipmentBrand(); BeanUtils.copyProperty(equipmentBrand, req, true); @@ -84,6 +86,7 @@ public class EquipmentBrandController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/brand/equipmentBrandEdit") + @RequiresPermissions("user:device:brand:update") public R equipmentBrandEdit(@RequestBody EquipmentBrandReq req) throws Exception { EquipmentBrand equipmentBrand = equipmentBrandService.selectEquipmentBrandById(req.getId()); BeanUtils.copyProperty(equipmentBrand, req, true); @@ -97,6 +100,7 @@ public class EquipmentBrandController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/brand/equipmentBrandDelete") + @RequiresPermissions("user:device:brand:delete") public R equipmentBrandDelete(@RequestBody EquipmentBrandReq req) throws Exception { equipmentBrandService.deleteEquipmentBrandById(req.getId()); return R.ok("删除成功"); @@ -120,6 +124,7 @@ public class EquipmentBrandController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/brand/equipmentBrandList") + @RequiresPermissions("user:device:brand:list") public R equipmentBrandList(@RequestBody EquipmentBrandReq req) throws Exception { PageUtils page = equipmentBrandService.selectByCondition(req); diff --git a/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java b/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java index f3264b0b..72b9c884 100644 --- a/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java +++ b/src/main/java/com/lz/modules/equipment/controller/EquipmentController.java @@ -13,6 +13,7 @@ import com.lz.modules.sys.controller.AbstractController; import com.lz.modules.sys.entity.SysUserEntity; import io.swagger.annotations.*; import lombok.extern.slf4j.Slf4j; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; @@ -56,6 +57,7 @@ public class EquipmentController extends AbstractController { private SpecialApplyInfoService specialApplyInfoService; @GetMapping("findEquipmentById") + @RequiresPermissions("user:device:pandian") public R findEquipmentById(@Valid @RequestParam @NotNull(message = "设备标识不能为空") String code){ EquipmentInfo equipmentInfo = iEquipmentInfoService.selectEquipmentInfoByCode(code); if(equipmentInfo==null){ @@ -79,7 +81,7 @@ public class EquipmentController extends AbstractController { model.setSpecId(equipmentSpecs1.getId()); } }); - // addRecord(equipmentInfo); + addRecord(equipmentInfo); return R.ok().put("data", model); } @@ -103,6 +105,7 @@ public class EquipmentController extends AbstractController { }*/ @PostMapping("changeEquipmentInfo") + @RequiresPermissions("user:device:pandian") public R changeEquipmentState(@RequestBody @Valid ChangeEquipmentModel model){ EquipmentDto dto = new EquipmentDto(); BeanUtils.copyProperties(model,dto); @@ -118,6 +121,7 @@ public class EquipmentController extends AbstractController { @GetMapping("findRrBySpec") + @RequiresPermissions("user:device:pandian") public R getRrBySpec(@Valid @RequestParam @NotNull(message = "规格不能为空") Long specId){ List rrBySpec = equipmentQrService.findRrBySpec(specId); if(CollectionUtils.isEmpty(rrBySpec)){ @@ -151,6 +155,7 @@ public class EquipmentController extends AbstractController { @PostMapping("findEquipmentType") + @RequiresPermissions("user:device:pandian") public R findEquipmentType(@RequestBody @ApiParam FindEquipmentTypeModel model){ String[] split = null; int length = 0; diff --git a/src/main/java/com/lz/modules/equipment/controller/EquipmentInfoController.java b/src/main/java/com/lz/modules/equipment/controller/EquipmentInfoController.java index 0b728beb..fbd3d23a 100644 --- a/src/main/java/com/lz/modules/equipment/controller/EquipmentInfoController.java +++ b/src/main/java/com/lz/modules/equipment/controller/EquipmentInfoController.java @@ -9,6 +9,7 @@ import com.lz.modules.equipment.service.EquipmentBrandService; import com.lz.modules.equipment.service.IEquipmentInfoService; import com.lz.modules.equipment.service.IEquipmentTypeService; import com.lz.modules.equipment.service.TCountService; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -102,6 +103,7 @@ public class EquipmentInfoController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/usereq/equipmentInfoEdit") + @RequiresPermissions("user:device:update") public R equipmentInfoEdit(@RequestBody EquipmentInfoReq req) throws Exception { EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoById(req.getId()); BeanUtils.copyProperty(equipmentInfo, req, true); @@ -122,6 +124,7 @@ public class EquipmentInfoController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/usereq/equipmentInfoDelete") + @RequiresPermissions("user:device:delete") public R equipmentInfoDelete(@RequestBody EquipmentInfoReq req) throws Exception { equipmentInfoService.deleteEquipmentInfoById(req.getId()); return R.ok("删除成功"); @@ -149,9 +152,10 @@ public class EquipmentInfoController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/usereq/equipmentInfoList") + @RequiresPermissions("user:device:list") public R equipmentInfoList(@RequestBody EquipmentInfoReq req) throws Exception { List types = equipmentTypeService.selectAll(); - List tcounts = tCountService.selectListLimit(10); + List tcounts = tCountService.selectListLimit(100); EquipmentType type = new EquipmentType(); type.setId(null); type.setType("全部"); diff --git a/src/main/java/com/lz/modules/equipment/controller/EquipmentSpecsController.java b/src/main/java/com/lz/modules/equipment/controller/EquipmentSpecsController.java index 0367dfe0..0cb91227 100644 --- a/src/main/java/com/lz/modules/equipment/controller/EquipmentSpecsController.java +++ b/src/main/java/com/lz/modules/equipment/controller/EquipmentSpecsController.java @@ -11,6 +11,7 @@ import com.lz.modules.equipment.entity.resp.EquipmentSpecsResp; import com.lz.modules.equipment.service.EquipmentBrandService; import com.lz.modules.equipment.service.EquipmentSpecsService; import com.lz.modules.equipment.service.IEquipmentTypeService; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -59,6 +60,7 @@ public class EquipmentSpecsController { * @throws Exception 异常 */ @RequestMapping("/modules/specs/equipmentSpecsAdd") + @RequiresPermissions("user:device:specs:save") public R equipmentSpecsAdd(@RequestBody EquipmentSpecsReq req) throws Exception { EquipmentSpecs equipmentSpecs = new EquipmentSpecs(); BeanUtils.copyProperty(equipmentSpecs, req, true); @@ -88,6 +90,7 @@ public class EquipmentSpecsController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/specs/equipmentSpecsEdit") + @RequiresPermissions("user:device:specs:update") public R equipmentSpecsEdit(@RequestBody EquipmentSpecsReq req) throws Exception { EquipmentSpecs equipmentSpecs = equipmentSpecsService.selectEquipmentSpecsById(req.getId()); BeanUtils.copyProperty(equipmentSpecs, req, true); @@ -103,6 +106,7 @@ public class EquipmentSpecsController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/specs/equipmentSpecsDelete") + @RequiresPermissions("user:device:specs:delete") public R equipmentSpecsDelete(@RequestBody EquipmentSpecsReq req) throws Exception { equipmentSpecsService.deleteEquipmentSpecsById(req.getId()); return R.ok("删除成功"); @@ -144,6 +148,7 @@ public class EquipmentSpecsController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/specs/equipmentSpecsList") + @RequiresPermissions("user:device:specs:list") public R equipmentSpecsList(@RequestBody EquipmentSpecsReq req) throws Exception { PageUtils page = equipmentSpecsService.selectByCondition(req); List specsList = page.getList(); diff --git a/src/main/java/com/lz/modules/equipment/controller/EquipmentTypeController.java b/src/main/java/com/lz/modules/equipment/controller/EquipmentTypeController.java index 5f45f942..3c33384f 100644 --- a/src/main/java/com/lz/modules/equipment/controller/EquipmentTypeController.java +++ b/src/main/java/com/lz/modules/equipment/controller/EquipmentTypeController.java @@ -7,6 +7,7 @@ import com.lz.modules.app.utils.BeanUtils; import com.lz.modules.equipment.entity.EquipmentType; import com.lz.modules.equipment.entity.EquipmentTypeReq; import com.lz.modules.equipment.service.IEquipmentTypeService; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -47,6 +48,7 @@ public class EquipmentTypeController { * @throws Exception 异常 */ @RequestMapping("/modules/type/equipmentTypeAdd") + @RequiresPermissions("user:device:type:save") public R equipmentTypeAdd(@RequestBody EquipmentTypeReq req) throws Exception { EquipmentType equipmentType = new EquipmentType(); BeanUtils.copyProperty(equipmentType,req,true); @@ -72,6 +74,7 @@ public class EquipmentTypeController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/type/equipmentTypeEdit") + @RequiresPermissions("user:device:type:update") public R equipmentTypeEdit(@RequestBody EquipmentTypeReq req) throws Exception { EquipmentType equipmentType = equipmentTypeService.selectEquipmentTypeById(req.getId()); BeanUtils.copyProperty(equipmentType,req,true); @@ -84,6 +87,7 @@ public class EquipmentTypeController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/type/equipmentTypeDelete") + @RequiresPermissions("user:device:type:delete") public R equipmentTypeDelete(@RequestBody EquipmentTypeReq req) throws Exception { equipmentTypeService.deleteEquipmentTypeById(req.getId()); return R.ok("删除成功"); @@ -104,6 +108,7 @@ public class EquipmentTypeController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/type/equipmentTypeList") + @RequiresPermissions("user:device:type:list") public R equipmentTypeList(@RequestBody EquipmentTypeReq req) throws Exception { PageUtils page = equipmentTypeService.selectByCondition(req); return R.ok().put("total", page.getTotalCount()) diff --git a/src/main/java/com/lz/modules/equipment/controller/OneCodeController.java b/src/main/java/com/lz/modules/equipment/controller/OneCodeController.java index 8a3e0857..578f6950 100644 --- a/src/main/java/com/lz/modules/equipment/controller/OneCodeController.java +++ b/src/main/java/com/lz/modules/equipment/controller/OneCodeController.java @@ -7,6 +7,7 @@ import com.lz.common.utils.StringUtil; import com.lz.modules.equipment.entity.OneCode; import com.lz.modules.equipment.entity.OneCodeReq; import com.lz.modules.equipment.service.OneCodeService; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; @@ -30,6 +31,7 @@ public class OneCodeController { * 获取code编码, * */ @RequestMapping("/get/getPrints") + @RequiresPermissions("user:device:code:list") public R getPrints(@RequestBody OneCodeReq req) { PageUtils pageUtils = oneCodeService.selectByReq(req); @@ -41,6 +43,7 @@ public class OneCodeController { * 批量生成指定数量编码, * */ @RequestMapping("/new/prints") + @RequiresPermissions("user:device:code:save") public R prints(@RequestParam int counts) { List codes = new ArrayList<>(); @@ -56,6 +59,7 @@ public class OneCodeController { * 重打印一个编码,该编码已经在数据库中存在 * */ @RequestMapping("/re/print") + @RequiresPermissions("user:device:code:update") public R prints(@RequestParam String code) { OneCode oneCode = oneCodeService.selectByCode(code); if(oneCode != null){ diff --git a/src/main/java/com/lz/modules/equipment/controller/TCountController.java b/src/main/java/com/lz/modules/equipment/controller/TCountController.java index b90bbdcd..29f2c836 100644 --- a/src/main/java/com/lz/modules/equipment/controller/TCountController.java +++ b/src/main/java/com/lz/modules/equipment/controller/TCountController.java @@ -1,10 +1,14 @@ package com.lz.modules.equipment.controller; +import com.lz.common.utils.PageUtils; import com.lz.common.utils.R; import com.lz.modules.app.utils.BeanUtils; +import com.lz.modules.equipment.entity.EquipmentInfo; import com.lz.modules.equipment.entity.TCount; import com.lz.modules.equipment.entity.TCountReq; +import com.lz.modules.equipment.service.IEquipmentInfoService; import com.lz.modules.equipment.service.TCountService; +import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -26,6 +30,9 @@ public class TCountController { @Resource private TCountService tCountService; + @Resource + private IEquipmentInfoService equipmentInfoService; + /** * 添加盘点页面 * @@ -83,9 +90,17 @@ public class TCountController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/count/tCountDelete") + @RequiresPermissions("user:device:count:delete") public R tCountDelete(@RequestBody TCountReq req) throws Exception { - tCountService.deleteTCountById(req.getId()); - return R.ok("删除成功"); + TCount tcount = tCountService.selectTCountById(req.getId()); + + EquipmentInfo equipmentInfo = equipmentInfoService.selectEquipmentInfoByCount(tcount.getNum()); + if(equipmentInfo == null){ + tCountService.deleteTCountById(req.getId()); + return R.ok("删除成功"); + } + return R.error("改次盘点下面有盘点设备,无法删除"); + } @@ -96,6 +111,7 @@ public class TCountController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/count/newStart") + @RequiresPermissions("user:device:count:save") public R newStart() throws Exception { TCount tCount = tCountService.selectMaxTCount(); int count = 1 ; @@ -127,8 +143,10 @@ public class TCountController { * @throws Exception 异常 */ @RequestMapping(value = "/modules/count/tCountList") + @RequiresPermissions("user:device:count:list") public R tCountList(@RequestBody TCountReq req) throws Exception { + PageUtils page = tCountService.selectByReq(req); return R.ok().put("total", 1) - .put("rows", new ArrayList<>()); + .put("rows", page); } } diff --git a/src/main/java/com/lz/modules/equipment/dao/EquipmentInfoMapper.java b/src/main/java/com/lz/modules/equipment/dao/EquipmentInfoMapper.java index 95080d38..e5a9a368 100644 --- a/src/main/java/com/lz/modules/equipment/dao/EquipmentInfoMapper.java +++ b/src/main/java/com/lz/modules/equipment/dao/EquipmentInfoMapper.java @@ -42,4 +42,6 @@ public interface EquipmentInfoMapper extends BaseMapper { List selectByCondition(@Param("page") IPage page, @Param("req") EquipmentInfoReq req); List selectByStaffIdOrDepId(@Param("page") IPage page, @Param("nameModel") FindEquipmentsByNameModel nameModel); + + EquipmentInfo selectEquipmentInfoByCount(Integer count); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/equipment/dao/TCountMapper.java b/src/main/java/com/lz/modules/equipment/dao/TCountMapper.java index d9c53dd1..7e35a0e3 100644 --- a/src/main/java/com/lz/modules/equipment/dao/TCountMapper.java +++ b/src/main/java/com/lz/modules/equipment/dao/TCountMapper.java @@ -8,7 +8,9 @@ package com.lz.modules.equipment.dao; * @since 2020-08-10 */ import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; import com.lz.modules.equipment.entity.TCount; +import com.lz.modules.equipment.entity.TCountReq; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -36,4 +38,6 @@ public interface TCountMapper extends BaseMapper { TCount selectMaxCount(); List selectListLimit(@Param("limit") int limit); + + List selectByReq(@Param("page") IPage page, @Param("req") TCountReq req); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/equipment/service/IEquipmentInfoService.java b/src/main/java/com/lz/modules/equipment/service/IEquipmentInfoService.java index 73851ebf..38bad620 100644 --- a/src/main/java/com/lz/modules/equipment/service/IEquipmentInfoService.java +++ b/src/main/java/com/lz/modules/equipment/service/IEquipmentInfoService.java @@ -49,4 +49,6 @@ public interface IEquipmentInfoService extends IService { PageUtils selectByCondition(EquipmentInfoReq req); List selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel); + + EquipmentInfo selectEquipmentInfoByCount(Integer count); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/equipment/service/TCountService.java b/src/main/java/com/lz/modules/equipment/service/TCountService.java index c0ce9c2a..7bce1d2c 100644 --- a/src/main/java/com/lz/modules/equipment/service/TCountService.java +++ b/src/main/java/com/lz/modules/equipment/service/TCountService.java @@ -2,7 +2,9 @@ package com.lz.modules.equipment.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.lz.common.utils.PageUtils; import com.lz.modules.equipment.entity.TCount; +import com.lz.modules.equipment.entity.TCountReq; import java.util.List; @@ -36,4 +38,6 @@ public interface TCountService extends IService { TCount selectMaxTCount(); List selectListLimit(int limit); + + PageUtils selectByReq(TCountReq req); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java b/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java index 5f75109e..e4184bf0 100644 --- a/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java +++ b/src/main/java/com/lz/modules/equipment/service/impl/EquipmentInfoServiceImpl.java @@ -267,4 +267,9 @@ public class EquipmentInfoServiceImpl extends ServiceImpl selectByStaffIdOrDepId(IPage page, FindEquipmentsByNameModel nameModel){ return equipmentInfoMapper.selectByStaffIdOrDepId(page, nameModel); } + + @Override + public EquipmentInfo selectEquipmentInfoByCount(Integer count){ + return equipmentInfoMapper.selectEquipmentInfoByCount(count); + } } diff --git a/src/main/java/com/lz/modules/equipment/service/impl/TCountServiceImpl.java b/src/main/java/com/lz/modules/equipment/service/impl/TCountServiceImpl.java index b63a0926..f3ed0c18 100644 --- a/src/main/java/com/lz/modules/equipment/service/impl/TCountServiceImpl.java +++ b/src/main/java/com/lz/modules/equipment/service/impl/TCountServiceImpl.java @@ -1,9 +1,12 @@ package com.lz.modules.equipment.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lz.common.utils.PageUtils; import com.lz.modules.equipment.dao.TCountMapper; import com.lz.modules.equipment.entity.TCount; +import com.lz.modules.equipment.entity.TCountReq; import com.lz.modules.equipment.service.TCountService; +import lombok.Builder; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -70,5 +73,13 @@ public class TCountServiceImpl extends ServiceImpl impleme return tCountMapper.selectListLimit(limit); } + @Override + public PageUtils selectByReq(TCountReq req){ + PageUtils page = PageUtils.startPage(req.getPage(), req.getRows()).doSelect( + page1 -> tCountMapper.selectByReq(page1, req) + ); + return page; + } + } diff --git a/src/main/java/com/lz/modules/flow/dao/FlowManagerMapper.java b/src/main/java/com/lz/modules/flow/dao/FlowManagerMapper.java new file mode 100644 index 00000000..4673dfa3 --- /dev/null +++ b/src/main/java/com/lz/modules/flow/dao/FlowManagerMapper.java @@ -0,0 +1,39 @@ +package com.lz.modules.flow.dao; +/** +*

+* 流程管理表 服务类 +*

+* +* @author quyixiao +* @since 2020-09-22 +*/ +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.lz.modules.flow.entity.FlowManager; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +@Mapper +public interface FlowManagerMapper extends BaseMapper { + + + FlowManager selectFlowManagerById(@Param("id") Long id); + + + Long insertFlowManager(FlowManager flowManager); + + + int updateFlowManagerById(FlowManager flowManager); + + + int updateCoverFlowManagerById(FlowManager flowManager); + + + int deleteFlowManagerById(@Param("id") Long id); + + + List selectByCondition(@Param("page") IPage page, @Param("params") Map params); +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/entity/FlowManager.java b/src/main/java/com/lz/modules/flow/entity/FlowManager.java new file mode 100644 index 00000000..71576999 --- /dev/null +++ b/src/main/java/com/lz/modules/flow/entity/FlowManager.java @@ -0,0 +1,127 @@ +package com.lz.modules.flow.entity; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import java.util.Date; +/** +*

+* 菜单权限表 +*

*流程管理表 +* @author quyixiao +* @since 2020-09-22 +*/ + +@Data +@TableName("lz_flow_manager") +public class FlowManager implements java.io.Serializable { + // + @TableId(value = "id", type = IdType.AUTO) + private Long id; + //是否删除状态,1:删除,0:有效 + private Integer isDelete; + //创建时间 + private Date gmtCreate; + //最后修改时间 + private Date gmtModified; + //流程名称 + private String name; + + @TableField(exist=false) + private String type; + + /** + * + * @return + */ + public Long getId() { + return id; + } + /** + * + * @param id + */ + public void setId(Long id) { + this.id = id; + } + + /** + * 是否删除状态,1:删除,0:有效 + * @return + */ + public Integer getIsDelete() { + return isDelete; + } + /** + * 是否删除状态,1:删除,0:有效 + * @param isDelete + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * 创建时间 + * @return + */ + public Date getGmtCreate() { + return gmtCreate; + } + /** + * 创建时间 + * @param gmtCreate + */ + public void setGmtCreate(Date gmtCreate) { + this.gmtCreate = gmtCreate; + } + + /** + * 最后修改时间 + * @return + */ + public Date getGmtModified() { + return gmtModified; + } + /** + * 最后修改时间 + * @param gmtModified + */ + public void setGmtModified(Date gmtModified) { + this.gmtModified = gmtModified; + } + + /** + * 流程名称 + * @return + */ + public String getName() { + return name; + } + /** + * 流程名称 + * @param name + */ + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public String toString() { + return "FlowManager{" + + ",id=" + id + + ",isDelete=" + isDelete + + ",gmtCreate=" + gmtCreate + + ",gmtModified=" + gmtModified + + ",name=" + name + + "}"; + } +} \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/model/FlowDto.java b/src/main/java/com/lz/modules/flow/model/FlowDto.java new file mode 100644 index 00000000..ed533cd1 --- /dev/null +++ b/src/main/java/com/lz/modules/flow/model/FlowDto.java @@ -0,0 +1,30 @@ +package com.lz.modules.flow.model; + +import lombok.Data; + +import java.util.List; + +@Data +public class FlowDto { + private static final long serialVersionUID = 1L; + + /** + * 飞书部门id + */ + private String departmentId; + /** + * 飞书上级部门id + */ + private String departmentParentId; + /** + * 飞书显示部门人数 + */ + private String realName; + /** + * 组织架构名称/部门名称 + */ + private String departmentName; + private Long staffId; + private List list; + +} diff --git a/src/main/java/com/lz/modules/flow/model/FlowInfo.java b/src/main/java/com/lz/modules/flow/model/FlowInfo.java new file mode 100644 index 00000000..942bb33c --- /dev/null +++ b/src/main/java/com/lz/modules/flow/model/FlowInfo.java @@ -0,0 +1,14 @@ +package com.lz.modules.flow.model; + +import com.lz.modules.app.entity.DepartmentsStaffRelateEntity; +import lombok.Data; + +import java.util.List; + +@Data +public class FlowInfo { + private DepartmentsStaffRelateEntity parentDepartmentRelate; + + private List list; + +} diff --git a/src/main/java/com/lz/modules/flow/model/FlowModel.java b/src/main/java/com/lz/modules/flow/model/FlowModel.java new file mode 100644 index 00000000..6ef5fcfe --- /dev/null +++ b/src/main/java/com/lz/modules/flow/model/FlowModel.java @@ -0,0 +1,17 @@ +package com.lz.modules.flow.model; + +import lombok.Data; + +import java.util.List; + +@Data +public class FlowModel { + private String type; + private int left = 818; + private int top = 510; + private String uuid; + private List prev; + private List next; + private FormDataModel formData; + +} diff --git a/src/main/java/com/lz/modules/flow/model/FormDataModel.java b/src/main/java/com/lz/modules/flow/model/FormDataModel.java new file mode 100644 index 00000000..bb950fd2 --- /dev/null +++ b/src/main/java/com/lz/modules/flow/model/FormDataModel.java @@ -0,0 +1,11 @@ +package com.lz.modules.flow.model; + +import lombok.Data; + +import java.util.List; + +@Data +public class FormDataModel { + private String stepName; + private List ruleGroupList; +} diff --git a/src/main/java/com/lz/modules/flow/model/RuleGroupModel.java b/src/main/java/com/lz/modules/flow/model/RuleGroupModel.java new file mode 100644 index 00000000..603bb0ca --- /dev/null +++ b/src/main/java/com/lz/modules/flow/model/RuleGroupModel.java @@ -0,0 +1,10 @@ +package com.lz.modules.flow.model; + +import lombok.Data; + +@Data +public class RuleGroupModel { + private String name; + private String nextStep; + +} 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 723d0c73..6b4bad3e 100644 --- a/src/main/java/com/lz/modules/flow/service/FlowDepartmentService.java +++ b/src/main/java/com/lz/modules/flow/service/FlowDepartmentService.java @@ -1,7 +1,11 @@ package com.lz.modules.flow.service; 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.FlowManager; + +import java.util.List; /** *

@@ -33,4 +37,6 @@ public interface FlowDepartmentService extends IService { FlowDepartment selectByStaffId(Long staffId); FlowDepartment selectByParentId(Long parentId); + + R selectFlowManager(Long staffId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/flow/service/FlowManagerService.java b/src/main/java/com/lz/modules/flow/service/FlowManagerService.java new file mode 100644 index 00000000..56f3cbef --- /dev/null +++ b/src/main/java/com/lz/modules/flow/service/FlowManagerService.java @@ -0,0 +1,43 @@ +package com.lz.modules.flow.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import com.lz.common.utils.PageUtils; +import com.lz.modules.flow.entity.FlowManager; +import com.lz.modules.flow.model.FlowDto; + +import java.util.List; +import java.util.Map; + +/** +*

+* 流程管理表 服务类 +*

+* +* @author quyixiao +* @since 2020-09-22 +*/ +public interface FlowManagerService extends IService { + + + + FlowManager selectFlowManagerById(Long id); + + + Long insertFlowManager(FlowManager flowManager); + + + int updateFlowManagerById(FlowManager flowManager); + + + int updateCoverFlowManagerById(FlowManager flowManager); + + + int deleteFlowManagerById(Long id); + + + PageUtils queryPage(Map params); + + void deleteBatchIds(List asList); + + List getFowList(); +} \ 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 d25b64f4..7898bced 100644 --- a/src/main/java/com/lz/modules/flow/service/RecordAuthService.java +++ b/src/main/java/com/lz/modules/flow/service/RecordAuthService.java @@ -43,4 +43,6 @@ public interface RecordAuthService extends IService { String selectByStaffId(Long staffId); List selectAll(); + + Long getRoleIdByStaffRoleInfo(String flowStaffIdRole,Long approvalStaffId); } \ 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 21fd4cfb..eb7d5c38 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 @@ -1,72 +1,123 @@ package com.lz.modules.flow.service.impl; 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.FlowManagerMapper; 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.sys.service.app.ResultRecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; +import java.util.List; + /** -*

-* 流转关系表 服务类 -*

-* -* @author quyixiao -* @since 2020-08-18 -*/ + *

+ * 流转关系表 服务类 + *

+ * + * @author quyixiao + * @since 2020-08-18 + */ @Service public class FlowDepartmentServiceImpl extends ServiceImpl implements FlowDepartmentService { @Autowired - private FlowDepartmentMapper flowDepartmentMapper; + private FlowDepartmentMapper flowDepartmentMapper; + + @Autowired + private FlowDepartmentService flowDepartmentService; + + @Autowired + private ResultRecordService resultRecordService; + + @Autowired + private FlowManagerMapper flowManagerMapper; - - @Override - public FlowDepartment selectFlowDepartmentById(Long id){ - return flowDepartmentMapper.selectFlowDepartmentById(id); - } + @Override + public FlowDepartment selectFlowDepartmentById(Long id) { + return flowDepartmentMapper.selectFlowDepartmentById(id); + } - - @Override - public Long insertFlowDepartment(FlowDepartment flowDepartment){ - return flowDepartmentMapper.insertFlowDepartment(flowDepartment); - } + @Override + public Long insertFlowDepartment(FlowDepartment flowDepartment) { + return flowDepartmentMapper.insertFlowDepartment(flowDepartment); + } - - @Override - public int updateFlowDepartmentById(FlowDepartment flowDepartment){ - return flowDepartmentMapper.updateFlowDepartmentById(flowDepartment); - } + @Override + public int updateFlowDepartmentById(FlowDepartment flowDepartment) { + return flowDepartmentMapper.updateFlowDepartmentById(flowDepartment); + } - - @Override - public int updateCoverFlowDepartmentById(FlowDepartment flowDepartment){ - return flowDepartmentMapper.updateCoverFlowDepartmentById(flowDepartment); - } + @Override + public int updateCoverFlowDepartmentById(FlowDepartment flowDepartment) { + return flowDepartmentMapper.updateCoverFlowDepartmentById(flowDepartment); + } - - @Override - public int deleteFlowDepartmentById(Long id){ - return flowDepartmentMapper.deleteFlowDepartmentById(id); - } + @Override + public int deleteFlowDepartmentById(Long id) { + return flowDepartmentMapper.deleteFlowDepartmentById(id); + } @Override public FlowDepartment selectByStaffId(Long staffId) { return flowDepartmentMapper.selectByStaffId(staffId); } - @Override - public FlowDepartment selectByParentId(Long parentId) { - return flowDepartmentMapper.selectByParentId(parentId); - } + @Override + public FlowDepartment selectByParentId(Long 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 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; + } } diff --git a/src/main/java/com/lz/modules/flow/service/impl/FlowManagerServiceImpl.java b/src/main/java/com/lz/modules/flow/service/impl/FlowManagerServiceImpl.java new file mode 100644 index 00000000..78a1baaa --- /dev/null +++ b/src/main/java/com/lz/modules/flow/service/impl/FlowManagerServiceImpl.java @@ -0,0 +1,217 @@ +package com.lz.modules.flow.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.lz.common.utils.NumberUtil; +import com.lz.common.utils.PageUtils; +import com.lz.modules.app.dao.DepartmentsDao; +import com.lz.modules.app.dao.StaffDao; +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.service.DepartmentsStaffRelateService; +import com.lz.modules.flow.dao.FlowManagerMapper; +import com.lz.modules.flow.entity.FlowManager; +import com.lz.modules.flow.model.FlowDto; +import com.lz.modules.flow.model.FlowInfo; +import com.lz.modules.flow.service.FlowManagerService; +import com.lz.modules.flow.service.RecordRoleService; +import org.apache.commons.collections.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** +*

+* 流程管理表 服务类 +*

+* +* @author quyixiao +* @since 2020-09-22 +*/ + +@Service +public class FlowManagerServiceImpl extends ServiceImpl implements FlowManagerService { + + + @Autowired + private FlowManagerMapper flowManagerMapper; + + @Autowired + private DepartmentsDao departmentsDao; + + @Autowired + private DepartmentsStaffRelateService departmentsStaffRelateService; + + @Autowired + private StaffDao staffDao; + + @Autowired + private RecordRoleService recordRoleService; + + + + @Override + public FlowManager selectFlowManagerById(Long id){ + return flowManagerMapper.selectFlowManagerById(id); + } + + + + @Override + public Long insertFlowManager(FlowManager flowManager){ + return flowManagerMapper.insertFlowManager(flowManager); + } + + + + @Override + public int updateFlowManagerById(FlowManager flowManager){ + return flowManagerMapper.updateFlowManagerById(flowManager); + } + + + + @Override + public int updateCoverFlowManagerById(FlowManager flowManager){ + return flowManagerMapper.updateCoverFlowManagerById(flowManager); + } + + + + @Override + public int deleteFlowManagerById(Long id){ + return flowManagerMapper.deleteFlowManagerById(id); + } + + @Override + public PageUtils queryPage(Map params) { + + PageUtils pageUtils = PageUtils.startPage( + NumberUtil.objToIntDefault(params.get("page"), 1), + NumberUtil.objToIntDefault(params.get("limit"), 10)).doSelect( + page -> flowManagerMapper.selectByCondition(page, params) + ); + + return pageUtils; + } + + @Override + public void deleteBatchIds(List asList) { + + } + + @Override + public List getFowList() { + List tDepartments = departmentsDao.selectAll(); + List parentDepartments = tDepartments.stream() + //根据两个属性进行过滤 + .filter(s -> s.getDepartmentParentId().equals("1")) + .collect(Collectors.toList()); + List departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll(); + Map departmentsStaffRelateEntityMap = new HashMap<>(); + Map singleRelateMap = new HashMap<>(); + + for(DepartmentsStaffRelateEntity d : departmentsStaffRelateEntities){ + singleRelateMap.put(d.getDepartmentId(),d); + if(new Integer(1).equals(d.getIsLeader())){ + FlowInfo flowInfo = new FlowInfo(); + flowInfo.setParentDepartmentRelate(d); + List list = new ArrayList<>(); + for(DepartmentsStaffRelateEntity d2 : departmentsStaffRelateEntities){ + if(d2.getDepartmentId().equals(d.getDepartmentId()) && new Integer(0).equals(d2.getIsLeader())){ + list.add(d2); + } + } + flowInfo.setList(list); + departmentsStaffRelateEntityMap.put(d.getDepartmentId(),flowInfo); + } + } + + List staffEntities = staffDao.selectAll(); + Map staffMap = new HashMap<>(); + for(StaffEntity staffEntity : staffEntities){ + staffMap.put(staffEntity.getId(),staffEntity); + } + + List list = new ArrayList<>(); + for (DepartmentsEntity d : parentDepartments) { + StaffEntity staff = getStaff(departmentsStaffRelateEntityMap,staffMap,d.getDepartmentId(),singleRelateMap); + FlowDto entity = buildMenuEntity(d.getDepartmentId(),d.getDepartmentName() , "1", staff.getName(),staff.getId()); + List childList = getMenuList(tDepartments, entity,departmentsStaffRelateEntityMap,staffMap,singleRelateMap); + entity.setList(childList); + list.add(entity); + } + return list; + } + + + public FlowDto buildMenuEntity(String departmentId, String departmentName, String parentId, String realName,Long staffId) { + FlowDto flowDto = new FlowDto(); + flowDto.setDepartmentId(departmentId); + flowDto.setDepartmentName(departmentName); + flowDto.setDepartmentParentId(parentId); + flowDto.setRealName(realName); + flowDto.setStaffId(staffId); + return flowDto; + } + + + public StaffEntity getStaff(Map departmentsStaffRelateEntityMap, Map staffMap, String departmentId + , Map singleRelateMap) { + FlowInfo flowInfo = departmentsStaffRelateEntityMap.get(departmentId); + if (flowInfo != null) { + return doGetStaff(flowInfo.getParentDepartmentRelate(), staffMap); + } else { + return doGetStaff(singleRelateMap.get(departmentId), staffMap); + } + } + + public StaffEntity doGetStaff(DepartmentsStaffRelateEntity departmentsStaffRelateEntity, Map staffMap) { + if (departmentsStaffRelateEntity != null) { + StaffEntity staffEntity = staffMap.get(departmentsStaffRelateEntity.getStaffId()); + if (staffEntity != null) { + return staffEntity; + } + } + return new StaffEntity(0l,""); + } + + public List getMenuList(List tDepartments,FlowDto flowDto, + Map departmentsStaffRelateEntityMap, Map staffMap + , Map singleRelateMap) { + List flowDtos = new ArrayList<>(); + for (DepartmentsEntity child : tDepartments) { + if (child.getDepartmentParentId().equals(flowDto.getDepartmentId())) { + StaffEntity staff = getStaff(departmentsStaffRelateEntityMap, staffMap, child.getDepartmentId(), singleRelateMap); + FlowDto entity = buildMenuEntity(child.getDepartmentId(), + child.getDepartmentName(), flowDto.getDepartmentId(), staff.getName(),staff.getId()); + + List list = getMenuList(tDepartments, entity, departmentsStaffRelateEntityMap, staffMap, singleRelateMap); + if (CollectionUtils.isEmpty(list) || list.size() == 0) { + FlowInfo flowInfo = departmentsStaffRelateEntityMap.get(child.getDepartmentId()); + if (flowInfo != null && CollectionUtils.isNotEmpty(flowInfo.getList()) && flowInfo.getList().size() > 0) { + list = new ArrayList<>(); + for (DepartmentsStaffRelateEntity dr : flowInfo.getList()) { + StaffEntity staffEntity = staffMap.get(dr.getStaffId()); + FlowDto childEntiry = buildMenuEntity(dr.getDepartmentId() + "_" + dr.getStaffId(), + " ", + entity.getDepartmentId(), + staffEntity.getName(),staff.getId()); + list.add(childEntiry); + } + } + } + entity.setList(list); + flowDtos.add(entity); + } + } + return flowDtos; + } + + +} 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 e9c6b390..6e9e7d11 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 @@ -103,6 +103,21 @@ public class RecordAuthServiceImpl extends ServiceImpl list = JSONObject.parseArray(flowStaffIdRole, StaffRoleDto.class); + if (CollectionUtils.isNotEmpty(list)) { + for(StaffRoleDto staffRoleDto:list){ + if(staffRoleDto.getStaffId().equals(approvalStaffId)){ + return staffRoleDto.getRoleId(); + } + } + } + } + return 0l; + } + public Auth getAuth(List auths) { Map map = new HashMap<>(); 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 140e1d6b..609bd8f9 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 @@ -5,12 +5,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.Maps; import com.lz.common.utils.NumberUtil; 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.StaffDao; import com.lz.modules.app.dto.StaffRoleResp; 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.service.DepartmentsStaffRelateService; import com.lz.modules.flow.dao.RecordRoleMapper; import com.lz.modules.flow.dao.StaffRoleDepartmentMapper; import com.lz.modules.flow.dao.StaffRoleMapper; @@ -18,13 +19,11 @@ import com.lz.modules.flow.entity.RecordRole; import com.lz.modules.flow.entity.StaffRole; import com.lz.modules.flow.entity.StaffRoleDepartment; import com.lz.modules.flow.service.RecordRoleService; -import com.lz.modules.flow.service.StaffRoleDepartmentService; import com.lz.modules.flow.service.StaffRoleService; import com.lz.modules.sys.entity.SysMenuEntity; import com.lz.modules.sys.entity.SysRoleEntity; import com.lz.modules.sys.service.app.ResultRecordService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -70,6 +69,9 @@ public class StaffRoleServiceImpl extends ServiceImpl s.getDepartmentParentId().equals("1")) .collect(Collectors.toList()); - + List departmentsStaffRelateEntities = departmentsStaffRelateService.selectAll(); + Map departmentsStaffRelateEntityMap = new HashMap<>(); + for(DepartmentsStaffRelateEntity d : departmentsStaffRelateEntities){ + if(new Integer(1).equals(d.getIsLeader())){ + departmentsStaffRelateEntityMap.put(d.getDepartmentId(),d); + } + } + List staffEntities = staffDao.selectAll(); + Map staffMap = new HashMap<>(); + for(StaffEntity staffEntity : staffEntities){ + staffMap.put(staffEntity.getId(),staffEntity); + } List list = new ArrayList<>(); - for(DepartmentsEntity d:parentDepartments){ - SysMenuEntity entity = recordRoleService.buildMenuEntity(NumberUtil.objToLongDefault(d.getDepartmentId(),0l),d.getDepartmentName(),0l,""); - getMenuList(tDepartments,entity,list); + for (DepartmentsEntity d : parentDepartments) { + String departmentName = d.getDepartmentName() + getSuffix(departmentsStaffRelateEntityMap,staffMap,d.getDepartmentId()); + SysMenuEntity entity = recordRoleService.buildMenuEntity(NumberUtil.objToLongDefault(d.getDepartmentId(), 0l),departmentName , 0l, ""); + getMenuList(tDepartments, entity, list,departmentsStaffRelateEntityMap,staffMap); list.add(entity); } return list; } - public void getMenuList(List tDepartments,SysMenuEntity sysMenuEntity,List list) { + public String getSuffix(Map departmentsStaffRelateEntityMap, Map staffMap,String departmentId){ + String suffix = ""; + DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateEntityMap.get(departmentId); + if(departmentsStaffRelateEntity !=null){ + StaffEntity staffEntity = staffMap.get(departmentsStaffRelateEntity.getStaffId()); + if(staffEntity !=null ){ + suffix = " , "+staffEntity.getName(); + } + } + return suffix; + } + + public void getMenuList(List tDepartments,SysMenuEntity sysMenuEntity,List list, + Map departmentsStaffRelateEntityMap, Map staffMap) { for(DepartmentsEntity child : tDepartments) { if(NumberUtil.objToLongDefault(child.getDepartmentParentId(),0l).equals(sysMenuEntity.getMenuId())){ + String departmentName = child.getDepartmentName() + getSuffix(departmentsStaffRelateEntityMap,staffMap,child.getDepartmentId()); SysMenuEntity entity = recordRoleService.buildMenuEntity(NumberUtil.objToLongDefault(child.getDepartmentId(),0l), - child.getDepartmentName(),sysMenuEntity.getMenuId(),sysMenuEntity.getName()); - getMenuList(tDepartments,entity,list); + departmentName,sysMenuEntity.getMenuId(),sysMenuEntity.getName()); + getMenuList(tDepartments,entity,list,departmentsStaffRelateEntityMap,staffMap); list.add(entity); } } diff --git a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java index f4912ea3..823ff78b 100644 --- a/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java +++ b/src/main/java/com/lz/modules/sys/dao/app/ResultRecordMapper.java @@ -49,7 +49,7 @@ public interface ResultRecordMapper extends BaseMapper { List selectByConditionByLeader(@Param("page") IPage page, @Param("req") ResultRecordReq params); - void updateFlowStaffIdRoleToNull(@Param("id") Long id); + void updateFlowStaffIdRoleToNull(@Param("id") Long id, @Param("status") Integer status); List selectResultRecordByIds(@Param("recordIds") List recordIds); 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 acc4c94c..d1e966dd 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 @@ -28,7 +28,7 @@ public class ResultRecord implements java.io.Serializable { private Date gmtModified; //月份 private Date monthTime; - //0.新建,1 提交审批中,2 拒绝, 3 侍提交 ,4 审批通过,5 驳回 + //0.新建,1 提交审批中,2 拒绝, 3 侍提交 ,4 审批通过,5 驳回,6申述,7 流程终止 private Integer status; //最后得分 private BigDecimal lastScore; diff --git a/src/main/java/com/lz/modules/sys/service/app/ResultDetailService.java b/src/main/java/com/lz/modules/sys/service/app/ResultDetailService.java index 2bc7186a..af396fe7 100644 --- a/src/main/java/com/lz/modules/sys/service/app/ResultDetailService.java +++ b/src/main/java/com/lz/modules/sys/service/app/ResultDetailService.java @@ -56,7 +56,7 @@ public interface ResultDetailService extends IService { ResultDetailResp getLastResult(BigDecimal bigDecimal); - void insertWenHuaJiaZhiGua(String s, Long id, Long userId); + void insertWenHuaJiaZhiGua(String s, Long id, Long userId,BigDecimal checkWeight); String initRole(Long staffId, Long l); diff --git a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java index 94b26fbf..ef5f1553 100644 --- a/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java +++ b/src/main/java/com/lz/modules/sys/service/app/ResultRecordService.java @@ -7,11 +7,13 @@ import com.lz.common.utils.R; import com.lz.modules.app.dto.GraphicsStatisticalDto; import com.lz.modules.app.dto.ReportProgressListDto; 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.OwnResultResp; import com.lz.modules.app.utils.t.TwoTuple; import com.lz.modules.flow.entity.Flow; +import com.lz.modules.flow.model.StaffRoleDto; import com.lz.modules.sys.entity.SysUserEntity; import com.lz.modules.sys.entity.app.ResultRecord; @@ -51,9 +53,9 @@ public interface ResultRecordService extends IService { ResultRecord selectResultRecordByStaffId(Long userId); - void updateFlowStaffIdRoleToNull(Long id); + void updateFlowStaffIdRoleToNull(Long id,Integer status); - R approval(Long resultRecordId, Long userId,Integer status); + R approval(Long resultRecordId, Long userId,Integer status,boolean flagEnd); List selectResultRecordByIds(List recordIds); @@ -86,8 +88,8 @@ public interface ResultRecordService extends IService { ResultRecord selectResultRecordByStaffIdStatus(Long staffId, int status); - R reject( ResultRecord resultRecord,ResultRecordReq req, Long userId); - - // ReportProgressListDto targetReportList(String monthTime); + R reject( ResultRecord resultRecord,Integer status); + StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel, List staffRoleDtos, Long roleId); + DepartmentsStaffRelateEntity getLeaderDepartmentsStaffRelateEntity(Long staffId); } \ No newline at end of file diff --git a/src/main/java/com/lz/modules/sys/service/app/impl/ResultDetailServiceImpl.java b/src/main/java/com/lz/modules/sys/service/app/impl/ResultDetailServiceImpl.java index 1ef12c76..d5d8afed 100644 --- a/src/main/java/com/lz/modules/sys/service/app/impl/ResultDetailServiceImpl.java +++ b/src/main/java/com/lz/modules/sys/service/app/impl/ResultDetailServiceImpl.java @@ -3,6 +3,7 @@ package com.lz.modules.sys.service.app.impl; import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.lz.common.utils.BigDecimalUtil; +import com.lz.common.utils.Constant; import com.lz.common.utils.StringUtil; import com.lz.modules.app.entity.StaffEntity; import com.lz.modules.app.resp.ResultDetailResp; @@ -139,17 +140,17 @@ public class ResultDetailServiceImpl extends ServiceImpl getStepList(ResultRecord resultRecord) { Long staffId = resultRecord.getStaffId(); int type = resultRecord.getType(); - String departmentId = resultRecord.getDepartmentId(); List stepList = new ArrayList<>(); - StaffEntity mySelf = staffService.selectStaffById(staffId); - TwoTuple> flowInfo = resultRecordService.getFlowInfo(staffId, type); - Long flowId = flowInfo.getFirst(); - List list = flowInfo.getSecond(); - List flowRelations = flowRelationService.selectFlowRelationAll(); - Map staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p)); - //approvalList = [ME,ONE_D,TWO_D,HR,BOSS] - List approvalList = new ArrayList<>(); - Map roleNameMap = new HashMap<>(); - approvalList.add("ME"); - roleNameMap.put("ME",mySelf.getName()); - for (FlowRelation flowRelation : flowRelations) { - FlowDepartment flowDepartment = staffEntityMap.get(flowRelation.getChild()); - if (flowDepartment != null || flowRelation.getCanReplace() == 0) { - approvalList.add(flowRelation.getChild()); - String departmentLevel = flowRelation.getChild(); - if(flowDepartment != null ){ - StaffEntity flowStaff = staffService.selectStaffById(flowDepartment.getStaffId()); - roleNameMap.put(departmentLevel,flowStaff.getName()); - }else{ - List staffRoles = staffRoleService.selectByRole(departmentLevel); - Long approvalStaffId = 0l; - for (StaffRole staffRole : staffRoles) { - List staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); - Map departmentIdMap = departmentsService.selectUserAllDepartmentIds(departmentId); - for (StaffRoleDepartment staffRoleDepartment : staffRoleDepartments) { - String value = departmentIdMap.get(staffRoleDepartment.getDepartmentId()); - if (StringUtil.isNotBlank(value)) { - approvalStaffId =staffRole.getStaffId(); - break; - } - } - } - StaffEntity flowStaff = staffService.selectStaffById(approvalStaffId); - roleNameMap.put(departmentLevel,flowStaff.getName()); - } - } - } - log.info("approvalList approval : " + Arrays.toString(approvalList.toArray()) + " roleNameMap : " + JSON.toJSONString(roleNameMap)); - List flows = flowService.selectByFlowId(flowId); List flowRecordList = flowRecordService.selectFlowRecordByResultRecordIdFlowId(resultRecord.getId()); SimpleDateFormat myFmt2 = new SimpleDateFormat("MM-dd HH:mm"); FlowRecord lastFlowRecord = null; @@ -270,8 +231,41 @@ public class ResultDetailServiceImpl extends ServiceImpl approvalList = new ArrayList<>(); + Map roleNameMap = new HashMap<>(); + approvalList.add("ME"); + roleNameMap.put("ME",mySelf.getName()); + + TwoTuple> flowInfo = resultRecordService.getFlowInfo(staffId, type); + List list = flowInfo.getSecond(); + + List flowRelations = flowRelationService.selectFlowRelationAll(); + Map staffEntityMap = list.stream().collect(Collectors.toMap(FlowDepartment::getDepartmentLevel, p -> p)); + + Long flowId = flowInfo.getFirst(); + List flows = flowService.selectByFlowId(flowId); + int flowIndex = lastFlowRecord != null ? lastFlowRecord.getFlowIndex() + 1 : 1; log.info("flowIndex = " + flowIndex); + for (FlowRelation flowRelation : flowRelations) { + FlowDepartment flowDepartment = staffEntityMap.get(flowRelation.getChild()); + if (flowDepartment != null || flowRelation.getCanReplace() == 0) { + approvalList.add(flowRelation.getChild()); + String departmentLevel = flowRelation.getChild(); + if(flowDepartment != null ){ + StaffEntity flowStaff = staffService.selectStaffById(flowDepartment.getStaffId()); + roleNameMap.put(departmentLevel,flowStaff.getName()); + }else{ + Long roleId = flows.get(flowIndex - 1).getRoleId(); + List staffRoleDtos = new ArrayList<>(); + StaffEntity approvalStaff = resultRecordService.getApprovalStaff(resultRecord, departmentLevel, staffRoleDtos, roleId); + roleNameMap.put(departmentLevel,approvalStaff.getName()); + } + } + } + + log.info("approvalList approval : " + Arrays.toString(approvalList.toArray()) + " roleNameMap : " + JSON.toJSONString(roleNameMap)); for (int i = flowIndex; i < flowIndex + 10; i++) { int index = resultRecordService.getDepartmentLevelIndex(flows, i); if (index < 0 || index >= approvalList.size()) { @@ -280,6 +274,7 @@ public class ResultDetailServiceImpl extends ServiceImpl resultRecordMapper.selectByConditionByLeader(page, params) ); @@ -271,8 +275,8 @@ public class ResultRecordServiceImpl extends ServiceImpl list = new ArrayList<>(); Long flowId = flowDepartment != null ? TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.SELF, type) : 0l; // 表示是部门主管自己 if (flowDepartment == null) { - DepartmentsStaffRelateEntity departmentsStaffRelateEntity = departmentsStaffRelateService.selectLastDepartmentByStaffId(staffId); - DepartmentsStaffRelateEntity leader = departmentsStaffRelateService.selectLeaderByDepartmentId(departmentsStaffRelateEntity.getDepartmentId()); - if(leader == null){ - Map 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")); - } - } - } + DepartmentsStaffRelateEntity leader = getLeaderDepartmentsStaffRelateEntity(staffId); flowDepartment = flowDepartmentService.selectByStaffId(leader.getStaffId()); flowId = TypeFlowDto.getFlowId(flowDepartment.getFlowIds(), Constant.CHILD, type);//表示是部门下的普通员工 list.add(flowDepartment); @@ -307,6 +301,24 @@ public class ResultRecordServiceImpl extends ServiceImpl 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 leader; + } + @Override public ResultRecord createResultRecord(Long staffId, int type, Long roleId) { @@ -366,8 +378,7 @@ public class ResultRecordServiceImpl extends ServiceImpl staffRoleMap = recordAuthService.selectRoleIdByStaffRoleInfo(resultRecord.getFlowStaffIdRole()); List listAuth = recordAuthService.selectAuthInfo(staffRoleMap.get(userId)); Auth auth = recordAuthService.getAuth(listAuth); @@ -397,13 +409,12 @@ public class ResultRecordServiceImpl extends ServiceImpl> flowInfo = getFlowInfo(resultRecord.getStaffId(), resultRecord.getType()); Long flowId = flowInfo.getFirst(); @@ -428,17 +439,23 @@ public class ResultRecordServiceImpl extends ServiceImpl= approvalList.size()) { //表示流程己经结束 + if (index < 0 || index >= approvalList.size() || flagEnd) { //表示流程己经结束 lastFlowRecord.setFlowName(mySelf.getName() + "-审批通过"); lastFlowRecord.setStatusName(FlowRecordEnum.END.getName()); flowRecordService.updateCoverFlowRecordById(lastFlowRecord); - resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId());// 更新用户权限 - return R.ok("流程审批结束") - .put("from", staff) - .put("to", staff) - .put("type", WorkMsgTypeEnum.PASS); + resultRecordService.updateFlowStaffIdRoleToNull(resultRecord.getId(), status != null ? status : 4);// 更新状态 + if (flagEnd) { + return R.ok("流程终止") + .put("from", staff) + .put("to", staff) + .put("type", WorkMsgTypeEnum.END); + } else { + return R.ok("流程审批结束") + .put("from", staff) + .put("to", staff) + .put("type", WorkMsgTypeEnum.PASS); + } } - FlowRecord flowRecord = new FlowRecord(); flowRecord.setRecordId(resultRecordId); flowRecord.setRecordStaffId(resultRecord.getStaffId()); @@ -455,7 +472,7 @@ public class ResultRecordServiceImpl extends ServiceImpl staffRoleDtos, Long roleId) { + @Override + public StaffEntity getApprovalStaff(ResultRecord resultRecord, String departmentLevel,List staffRoleDtos, Long roleId) { + StaffEntity approvalStaff = null; List staffRoles = staffRoleService.selectByRole(departmentLevel); for (StaffRole staffRole : staffRoles) { List staffRoleDepartments = staffRoleDepartmentService.selectStaffRoleDepartmentByStaffRoleId(staffRole.getId()); @@ -568,17 +587,17 @@ public class ResultRecordServiceImpl extends ServiceImpl flowRecords = flowRecordService.selectFlowRecordByResultRecordIdType(req.getRecordResultId(),resultRecord.getType()); - if(flowRecords!=null && flowRecords.size() == 2){ // 表示可以撤回 - r = reject(resultRecord, req, userId); + r = reject(resultRecord,status); + } else if (req.getStatus() == 7) { + List flowRecords = flowRecordService.selectFlowRecordByResultRecordIdType(req.getRecordResultId(), resultRecord.getType()); + if (flowRecords != null && flowRecords.size() == 2) { // 表示可以撤回 + r = reject(resultRecord,5); } else if (flowRecords != null && flowRecords.size() > 2) { return R.error("你的领导己经审批,不能撤回了"); } @@ -593,7 +612,7 @@ public class ResultRecordServiceImpl extends ServiceImpl flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(req.getRecordResultId()); + public R reject( ResultRecord resultRecord,Integer status){ + List flowRecords = flowRecordService.selectFlowRecordByResultRecordIdFlowId(resultRecord.getId()); StaffEntity mySelf = staffService.selectStaffById(resultRecord.getStaffId()); StaffEntity approvalStaff = mySelf; if (flowRecords.size() >= 2) { FlowRecord secondFlowRecord = flowRecords.get(flowRecords.size() - 2); resultRecord.setFlowStaffIdRole(secondFlowRecord.getFlowStaffIdRole()); - resultRecord.setStatus(req.getStatus()); + resultRecord.setStatus(status); //更新驳回状态为5 List list = JSONObject.parseArray(resultRecord.getFlowStaffIdRole(), StaffRoleDto.class); if (CollectionUtils.isNotEmpty(list)) { StaffRoleDto staffRoleDto = list.get(0); @@ -626,17 +645,18 @@ public class ResultRecordServiceImpl extends ServiceImpl + and department_level = #{req.departmentLevel} + + AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') = ]]> DATE_FORMAT(#{req.monthBeginDate}, '%Y-%m-%d %H:%i:%S') @@ -199,9 +203,11 @@ AND DATE_FORMAT(rd.month_time, '%Y-%m-%d %H:%i:%S') DATE_FORMAT(#{req.monthEndDate}, '%Y-%m-%d %H:%i:%S') + and rd.status = #{req.status} + AND rd.remark LIKE CONCAT('%',#{req.remark},'%') @@ -225,7 +231,7 @@ and rd.staff_id = #{req.staffId} - + and rd.current_approval_staff_id = #{req.approvalStaffId} order by fr.id desc ) @@ -243,7 +249,7 @@ - update lz_result_record set flow_staff_id_role = '[]',status = 4,current_approval_staff_id = null ,current_approval_staff_name = null where id = #{id} + update lz_result_record set flow_staff_id_role = '[]',status = #{status},current_approval_staff_id = null ,current_approval_staff_name = null where id = #{id} + + diff --git a/src/main/resources/mapper/equipment/TCountMapper.xml b/src/main/resources/mapper/equipment/TCountMapper.xml index de55da27..adcba9e1 100644 --- a/src/main/resources/mapper/equipment/TCountMapper.xml +++ b/src/main/resources/mapper/equipment/TCountMapper.xml @@ -66,14 +66,18 @@ - update equipment_t_count set is_delete = 1 where id=#{id} limit 1 + update equipment_t_count set is_delete = 1 where id=#{id} and is_delete = 0 limit 1 + + diff --git a/src/main/resources/mapper/flow/FlowManagerMapper.xml b/src/main/resources/mapper/flow/FlowManagerMapper.xml new file mode 100644 index 00000000..fc800581 --- /dev/null +++ b/src/main/resources/mapper/flow/FlowManagerMapper.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + id AS id, is_delete AS isDelete, gmt_create AS gmtCreate, gmt_modified AS gmtModified, name AS name + + + + + + + + + + insert into lz_flow_manager( + name, + is_delete, + gmt_create, + gmt_modified + )values( + #{ name}, + 0, + now(), + now() + ) + + + + + update + lz_flow_manager + + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + name = #{name} + + ,gmt_modified = now() + where id = #{id} + + + + + update + lz_flow_manager + set + is_delete = #{isDelete}, + gmt_create = #{gmtCreate}, + name = #{name} + ,gmt_modified = now() + where id = #{id} + + + + + update lz_flow_manager 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 f52f9b19..74573101 100644 --- a/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml +++ b/src/main/resources/mapper/generator/DepartmentsStaffRelateDao.xml @@ -58,7 +58,7 @@ group by staff_id - select * from sys_user where username = #{username} + select * from sys_user where username = #{username} or mobile = #{username} limit 1