From c06fab29ca7826a6dc9736c1ba8ce1e26a11c829 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期四, 06 三月 2025 15:57:08 +0800 Subject: [PATCH] 新增层级结构工艺规程版本、结构树表、新权限表 修改原有权限验证 删除原有代码 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionDepartmentServiceImpl.java | 135 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessSpecVersionController.java | 58 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductMix.java | 47 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java | 39 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductMixService.java | 17 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java | 331 ---- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java | 24 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java | 3 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionPermissionService.java | 57 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionDepartmentMapper.java | 27 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStreamNew.java | 46 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/WorkStepController.java | 5 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java | 8 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java | 5 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java | 75 - lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionPermissionMapper.xml | 26 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java | 96 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml | 26 lxzn-module-dnc/pom.xml | 6 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java | 706 ++++++--- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductMixMapper.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/flow/service/impl/AssignFileStreamServiceImpl.java | 57 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamNewService.java | 85 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java | 12 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionDepartmentService.java | 57 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionDepartmentMapper.xml | 26 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java | 6 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductMixController.java | 35 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java | 2 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml | 4 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java | 87 - lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java | 433 ++++++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java | 1 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java | 3 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionMapper.java | 17 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionDepartment.java | 24 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java | 81 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml | 4 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java | 35 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml | 4 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java | 5 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionPermission.java | 36 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductMixServiceImpl.java | 35 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStep.java | 3 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamNewMapper.java | 17 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PermissionStreamNewMapper.xml | 16 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionService.java | 105 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepMapper.xml | 5 /dev/null | 470 ------ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamNewServiceImpl.java | 227 +++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java | 111 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionPermissionServiceImpl.java | 128 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersion.java | 67 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionMapper.xml | 25 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml | 5 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java | 97 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java | 10 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionPermissionMapper.java | 32 59 files changed, 2,566 insertions(+), 1,552 deletions(-) diff --git a/lxzn-module-dnc/pom.xml b/lxzn-module-dnc/pom.xml index 48ee57c..4f22301 100644 --- a/lxzn-module-dnc/pom.xml +++ b/lxzn-module-dnc/pom.xml @@ -52,6 +52,12 @@ <version>3.4.3</version> <scope>compile</scope> </dependency> + <!-- pom.xml 娣诲姞FastUtil渚濊禆 --> + <dependency> + <groupId>it.unimi.dsi</groupId> + <artifactId>fastutil</artifactId> + <version>8.5.6</version> + </dependency> </dependencies> </project> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ButtonController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ButtonController.java deleted file mode 100644 index fab5254..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ButtonController.java +++ /dev/null @@ -1,131 +0,0 @@ -package org.jeecg.modules.dnc.controller; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.modules.dnc.entity.Button; -import org.jeecg.modules.dnc.request.ButtonRequest; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.QueryListResponseResult; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.response.ResponseResult; -import org.jeecg.modules.dnc.service.IButtonService; -import org.jeecgframework.poi.excel.def.NormalExcelConstants; -import org.jeecgframework.poi.excel.entity.ExportParams; -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.util.Collections; -import java.util.List; - -@Slf4j -@Api(tags = "鎸夐挳绠$悊") -@RestController -@RequestMapping("/ucenter/btn") -public class ButtonController { - @Autowired - private IButtonService buttonService; - - @AutoLog(value = "鎸夐挳绠$悊-鏂板鎸夐挳瀵硅薄") - @ApiOperation(value = "鎸夐挳绠$悊-鏂板鎸夐挳瀵硅薄", notes = "鎸夐挳绠$悊-鏂板鎸夐挳瀵硅薄") - @PostMapping("/add") - public ResponseResult addButton(@RequestBody Button button) { - boolean b = buttonService.addButton(button); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "鎸夐挳绠$悊-鏍规嵁鎸夐挳绫诲瀷鏌ヨ鎸夐挳鍒楄〃") - @ApiOperation(value = "鎸夐挳绠$悊-鏍规嵁鎸夐挳绫诲瀷鏌ヨ鎸夐挳鍒楄〃", notes = "鎸夐挳绠$悊-鏍规嵁鎸夐挳绫诲瀷鏌ヨ鎸夐挳鍒楄〃") - @GetMapping("/find/list") - public QueryListResponseResult<Button> findByButtonType(@RequestParam("buttonType") Integer buttonType) { - List<Button> list = buttonService.findByButtonType(buttonType); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - @AutoLog(value = "鎸夐挳绠$悊-鍒嗛〉鍒楄〃鏌ヨ") - @ApiOperation(value = "鎸夐挳绠$悊-鍒嗛〉鍒楄〃鏌ヨ", notes = "鎸夐挳绠$悊-鍒嗛〉鍒楄〃鏌ヨ") - @GetMapping("/find/page/{page}/{size}") - public QueryPageResponseResult<Button> findByPageList(@PathVariable("page") int page, @PathVariable("size") int size, ButtonRequest buttonRequest) { - return buttonService.findByPageList(page, size, buttonRequest); - } - - @AutoLog(value = "鎸夐挳绠$悊-缂栬緫鎸夐挳") - @ApiOperation(value = "鎸夐挳绠$悊-缂栬緫鎸夐挳", notes = "鎸夐挳绠$悊-缂栬緫鎸夐挳") - @PutMapping("/edit/{id}") - public ResponseResult editButton(@PathVariable("id") String id,@RequestBody Button button) { - boolean b = buttonService.editButton(id,button); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "鎸夐挳绠$悊-鍒犻櫎鎸夐挳") - @ApiOperation(value = "鎸夐挳绠$悊-鍒犻櫎鎸夐挳", notes = "鎸夐挳绠$悊-鍒犻櫎鎸夐挳") - @DeleteMapping("/delete") - public ResponseResult deleteButton(@RequestParam("id") String id) { - boolean b = buttonService.deleteButtonById(id); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "鎸夐挳绠$悊-鏌ヨ瑙掕壊鍒嗛厤鍜屾湭鍒嗛厤鐨勭郴缁熸寜閽�") - @ApiOperation(value = "鎸夐挳绠$悊-鏌ヨ瑙掕壊鍒嗛厤鍜屾湭鍒嗛厤鐨勭郴缁熸寜閽�", notes = "鎸夐挳绠$悊-鏌ヨ瑙掕壊鍒嗛厤鍜屾湭鍒嗛厤鐨勭郴缁熸寜閽�") - @GetMapping("/get/role") - public QueryListResponseResult<Button> findPermsByRoleId(@RequestParam("roleId") String roleId) { - List<Button> list = buttonService.findPermsByRoleId(roleId); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - @AutoLog(value = "鎸夐挳绠$悊-鑾峰彇鑿滃崟鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽�") - @ApiOperation(value = "鎸夐挳绠$悊-鑾峰彇鑿滃崟鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽�", notes = "鎸夐挳绠$悊-鑾峰彇鑿滃崟鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽�") - @GetMapping("/get/menu") - public QueryListResponseResult<Button> findByMenuId(@RequestParam("menuId") String menuId) { - List<Button> list = buttonService.findByMenuId(menuId); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - @AutoLog(value = "鎸夐挳绠$悊-鑾峰彇瀵硅薄鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽�") - @ApiOperation(value = "鎸夐挳绠$悊-鑾峰彇瀵硅薄鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽�", notes = "鎸夐挳绠$悊-鑾峰彇瀵硅薄鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽�") - @GetMapping("/get/object") - public QueryListResponseResult<Button> findByObjectId(@RequestParam("objectId") String objectId) { - List<Button> list = buttonService.findByObjectId(objectId); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - @AutoLog(value = "鎸夐挳绠$悊-瀵煎嚭鑷畾涔�") - @ApiOperation(value = "鎸夐挳绠$悊-瀵煎嚭鑷畾涔�", notes = "鎸夐挳绠$悊-瀵煎嚭鑷畾涔�") - @GetMapping("/exportXls") - public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response) { - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); - List<Button> list = buttonService.list(); - //mv.addObject(NormalExcelConstants.FILE_NAME,"瀵煎嚭Excel鏂囦欢鍚嶅瓧"); - //娉ㄨВ瀵硅薄Class - mv.addObject(NormalExcelConstants.CLASS,Button.class); - //鑷畾涔夊鍑哄瓧娈� - //mv.addObject(NormalExcelConstants.EXPORT_FIELDS,"name,keyWord,punchTime"); - //鑷畾涔夎〃鏍煎弬鏁� - mv.addObject(NormalExcelConstants.PARAMS,new ExportParams("鑷畾涔夊鍑篍xcel妯℃澘鍐呭鏍囬", "鑷畾涔塖heet鍚嶅瓧")); - //瀵煎嚭鏁版嵁鍒楄〃 - mv.addObject(NormalExcelConstants.DATA_LIST,list); - return mv; - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java deleted file mode 100644 index 542e144..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.jeecg.modules.dnc.controller; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.common.system.base.controller.JeecgController; -import org.jeecg.modules.dnc.entity.DeviceGroup; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.QueryListResponseResult; -import org.jeecg.modules.dnc.response.ResponseResult; -import org.jeecg.modules.dnc.service.IDeviceGroupService; -import org.jeecg.modules.dnc.ucenter.Department; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.Collections; -import java.util.List; - -@Slf4j -@Api(tags = "璁惧鍒嗙粍琛�") -@RestController -@RequestMapping("/nc/device/group") -public class DeviceGroupController extends JeecgController<DeviceGroup, IDeviceGroupService> { - - @Autowired - private IDeviceGroupService deviceGroupService; - - @AutoLog(value = "璁惧鍒嗙粍琛�-鏂板璁惧鍒嗙粍") - @ApiOperation(value = "璁惧鍒嗙粍琛�-鏂板璁惧鍒嗙粍", notes = "璁惧鍒嗙粍琛�-鏂板璁惧鍒嗙粍") - @PostMapping("/add") - public ResponseResult addDeviceGroup(@RequestBody DeviceGroup deviceGroup) { - boolean b = deviceGroupService.addDeviceGroup(deviceGroup); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "璁惧鍒嗙粍琛�-缂栬緫璁惧鍒嗙粍") - @ApiOperation(value = "璁惧鍒嗙粍琛�-缂栬緫璁惧鍒嗙粍", notes = "璁惧鍒嗙粍琛�-缂栬緫璁惧鍒嗙粍") - @PutMapping("/edit/{id}") - public ResponseResult editDeviceGroup(@PathVariable("id") String id, @RequestBody DeviceGroup deviceGroup) { - boolean b = deviceGroupService.editDeviceGroup(id, deviceGroup); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "璁惧鍒嗙粍琛�-鍒犻櫎璁惧鍒嗙粍") - @ApiOperation(value = "璁惧鍒嗙粍琛�-鍒犻櫎璁惧鍒嗙粍", notes = "璁惧鍒嗙粍琛�-鍒犻櫎璁惧鍒嗙粍") - @DeleteMapping("/delete") - public ResponseResult deleteDeviceGroup(@RequestParam("id") String id) { - boolean b = deviceGroupService.deleteDeviceGroup(id); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - - @AutoLog(value = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍宸插垎閰嶇殑閮ㄩ棬") - @ApiOperation(value = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍宸插垎閰嶇殑閮ㄩ棬", notes = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍宸插垎閰嶇殑閮ㄩ棬") - @GetMapping("/get/perm/depart/{groupId}") - public QueryListResponseResult<Department> getDepartPermsList(@PathVariable("groupId") String groupId) { - List<Department> list = deviceGroupService.getDepartPermsList(groupId); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - - @AutoLog(value = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍鏈垎閰嶇殑閮ㄩ棬") - @ApiOperation(value = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍鏈垎閰嶇殑閮ㄩ棬", notes = "璁惧鍒嗙粍琛�-鑾峰彇鍒嗙粍鏈垎閰嶇殑閮ㄩ棬") - @GetMapping("/get/non/perm/depart/{groupId}") - public QueryListResponseResult<Department> getDepartNonPermsList(@PathVariable("groupId") String groupId) { - List<Department> list = deviceGroupService.getDepartNonPermsList(groupId); - if(list == null) - list = Collections.emptyList(); - return new QueryListResponseResult<>(CommonCode.SUCCESS, list); - } - -// @AutoLog(value = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�") -// @ApiOperation(value = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�", notes = "璁惧鍒嗙粍琛�-缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄�") -// @PostMapping("/assign/add/depart/{groupId}/{relativeFlag}") -// public ResponseResult assignAddDepartment(@PathVariable("groupId") String groupId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { -// boolean b = deviceGroupService.assignAddDepartment(groupId, relativeFlag, departmentIds); -// if(b) { -// return new ResponseResult(CommonCode.SUCCESS); -// } -// return new ResponseResult(CommonCode.FAIL); -// } -// -// @AutoLog(value = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺") -// @ApiOperation(value = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺", notes = "璁惧鍒嗙粍琛�-绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺") -// @PostMapping("/assign/remove/depart/{groupId}/{relativeFlag}") -// public ResponseResult assignRemoveDepartment(@PathVariable("groupId") String groupId, @PathVariable("relativeFlag") Integer relativeFlag, @RequestBody String[] departmentIds) { -// boolean b = deviceGroupService.assignRemoveDepartment(groupId, relativeFlag, departmentIds); -// if(b) { -// return new ResponseResult(CommonCode.SUCCESS); -// } -// return new ResponseResult(CommonCode.FAIL); -// } - - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java deleted file mode 100644 index 678a805..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java +++ /dev/null @@ -1,61 +0,0 @@ -package org.jeecg.modules.dnc.controller; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.modules.dnc.entity.NcLogInfo; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.service.INcLogInfoService; -import org.jeecg.modules.dnc.request.NcLogInfoRequest; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -/** - * @Description: DNC鏃ュ織绠$悊 - * @Author: - * @Date: 2024-12-17 - * @Version: V1.0 - */ -@Slf4j -@Api(tags = "DNC鏃ュ織绠$悊琛�") -@RestController -@RequestMapping("/doc/ncloginfo") -public class NcLogInfoController { - @Autowired - private INcLogInfoService iNcLogInfoService; - - /** - * 鏃ュ織鏌ヨ - * @param page - * @param size - * @param ncLogInfoRequest - * @return - */ - @AutoLog(value = "DNC鏃ュ織绠$悊琛�-鏃ュ織鏌ヨ") - @ApiOperation(value = "DNC鏃ュ織绠$悊琛�-鏃ュ織鏌ヨ", notes = "DNC鏃ュ織绠$悊琛�-鏃ュ織鏌ヨ") - @GetMapping("/find/page/{page}/{size}") - public QueryPageResponseResult<NcLogInfo> findPageList(@PathVariable("page") int page, @PathVariable("size") int size, NcLogInfoRequest ncLogInfoRequest) { - return iNcLogInfoService.findByPageList(page, size, ncLogInfoRequest); - } - - /** - * 瀵煎嚭 - * @param ncLogInfoRequest - * @return - */ - @AutoLog(value = "DNC鏃ュ織绠$悊琛�-瀵煎嚭鏃ュ織") - @ApiOperation(value = "DNC鏃ュ織绠$悊琛�-瀵煎嚭鏃ュ織", notes = "DNC鏃ュ織绠$悊琛�-瀵煎嚭鏃ュ織") - @GetMapping("/exportXls") - public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response,NcLogInfoRequest ncLogInfoRequest){ - return iNcLogInfoService.exportLogList(ncLogInfoRequest); - } - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ObjectController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ObjectController.java deleted file mode 100644 index ef38516..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ObjectController.java +++ /dev/null @@ -1,76 +0,0 @@ -package org.jeecg.modules.dnc.controller; - -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import lombok.extern.slf4j.Slf4j; -import org.jeecg.common.aspect.annotation.AutoLog; -import org.jeecg.modules.dnc.entity.Button; -import org.jeecg.modules.dnc.entity.ObjectBase; -import org.jeecg.modules.dnc.request.ObjectBaseRequest; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.response.ResponseResult; -import org.jeecg.modules.dnc.service.IObjectService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import java.util.List; -@Slf4j -@Api(tags = "Dnc瀵硅薄绠$悊") -@RestController -@RequestMapping("/ucenter/obj") -public class ObjectController { - @Autowired - private IObjectService objectService; - - @AutoLog(value = "Dnc瀵硅薄绠$悊-鏂板绠$悊瀵硅薄淇℃伅") - @ApiOperation(value = "Dnc瀵硅薄绠$悊-鏂板绠$悊瀵硅薄淇℃伅", notes = "Dnc瀵硅薄绠$悊-鏂板绠$悊瀵硅薄淇℃伅") - @PostMapping("/add") - public ResponseResult addObject(@RequestBody ObjectBase objectBase) { - boolean b = objectService.addObject(objectBase); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "Dnc瀵硅薄绠$悊-缂栬緫瀵硅薄") - @ApiOperation(value = "Dnc瀵硅薄绠$悊-缂栬緫瀵硅薄", notes = "Dnc瀵硅薄绠$悊-缂栬緫瀵硅薄") - @PutMapping("/edit/{id}") - public ResponseResult editObject(@PathVariable("id") String id,@RequestBody ObjectBase objectBase) { - boolean b = objectService.editObject(id,objectBase); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "Dnc瀵硅薄绠$悊-鍒嗛〉鏌ヨ瀵硅薄") - @ApiOperation(value = "Dnc瀵硅薄绠$悊-鍒嗛〉鏌ヨ瀵硅薄", notes = "Dnc瀵硅薄绠$悊-鍒嗛〉鏌ヨ瀵硅薄") - @GetMapping("/find/page/{page}/{size}") - public QueryPageResponseResult<ObjectBase> findByPageList(@PathVariable("page") int page, @PathVariable("size") int size, ObjectBaseRequest objectRequest) { - return objectService.findPageList(page,size,objectRequest); - } - - @AutoLog(value = "Dnc瀵硅薄绠$悊-鍒犻櫎瀵硅薄") - @ApiOperation(value = "Dnc瀵硅薄绠$悊-鍒犻櫎瀵硅薄", notes = "Dnc瀵硅薄绠$悊-鍒犻櫎瀵硅薄") - @DeleteMapping("/delete") - public ResponseResult deleteObjectById(@RequestParam("id") String id) { - boolean b = objectService.deleteObjectById(id); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } - - @AutoLog(value = "Dnc瀵硅薄绠$悊-鎸囨淳瀵硅薄鐨勬搷浣滄寜閽�") - @ApiOperation(value = "Dnc瀵硅薄绠$悊-鎸囨淳瀵硅薄鐨勬搷浣滄寜閽�", notes = "Dnc瀵硅薄绠$悊-鎸囨淳瀵硅薄鐨勬搷浣滄寜閽�") - @PostMapping("/assign/button/{objectId}") - public ResponseResult assignButton(@PathVariable("objectId") String objectId, @RequestBody List<Button> buttonList) { - boolean b = objectService.assignButton(objectId, buttonList); - if(b) { - return new ResponseResult(CommonCode.SUCCESS); - } - return new ResponseResult(CommonCode.FAIL); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessSpecVersionController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessSpecVersionController.java new file mode 100644 index 0000000..624d960 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProcessSpecVersionController.java @@ -0,0 +1,58 @@ +package org.jeecg.modules.dnc.controller; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.ProcessSpecVersion; +import org.jeecg.modules.dnc.entity.WorkStep; +import org.jeecg.modules.dnc.response.CommonCode; +import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IProcessSpecVersionService; +import org.jeecg.modules.dnc.service.IWorkStepService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +@Slf4j +@Api(tags = "宸ヨ壓瑙勭▼鐗堟湰") +@RestController +@RequestMapping("/nc/processSpecVersion") +public class ProcessSpecVersionController extends JeecgController<ProcessSpecVersion, IProcessSpecVersionService> { + + @Autowired + private IProcessSpecVersionService processSpecVersionService; + + @AutoLog(value = "宸ヨ壓瑙勭▼鐗堟湰琛�-鏂板宸ヨ壓瑙勭▼鐗堟湰淇℃伅") + @ApiOperation(value = "宸ヨ壓瑙勭▼鐗堟湰琛�-鏂板宸ヨ壓瑙勭▼鐗堟湰淇℃伅", notes = "宸ヨ壓瑙勭▼鐗堟湰琛�-鏂板宸ヨ壓瑙勭▼鐗堟湰淇℃伅") + @PostMapping("/add") + public ResponseResult addWorkStep(@RequestBody ProcessSpecVersion processSpecVersion) { + boolean b = processSpecVersionService.addProcessSpecVersion(processSpecVersion); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "宸ヨ壓瑙勭▼鐗堟湰琛�-缂栬緫宸ヨ壓瑙勭▼鐗堟湰淇℃伅") + @ApiOperation(value = "宸ヨ壓瑙勭▼鐗堟湰琛�-缂栬緫宸ヨ壓瑙勭▼鐗堟湰淇℃伅", notes = "宸ヨ壓瑙勭▼鐗堟湰琛�-缂栬緫宸ヨ壓瑙勭▼鐗堟湰淇℃伅") + @PutMapping("/edit/{id}") + public ResponseResult editWorkStep(@PathVariable("id") String id, @RequestBody ProcessSpecVersion processSpecVersion) { + boolean b = processSpecVersionService.editProcessSpecVersion(id, processSpecVersion); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } + + @AutoLog(value = "宸ヨ壓瑙勭▼鐗堟湰琛�-鍒犻櫎宸ヨ壓瑙勭▼鐗堟湰淇℃伅") + @ApiOperation(value = "宸ヨ壓瑙勭▼鐗堟湰琛�-鍒犻櫎宸ヨ壓瑙勭▼鐗堟湰淇℃伅", notes = "宸ヨ壓瑙勭▼鐗堟湰琛�-鍒犻櫎宸ヨ壓瑙勭▼鐗堟湰淇℃伅") + @DeleteMapping("/delete/{id}") + public ResponseResult deleteWorkStep(@PathVariable("id") String id) { + boolean b = processSpecVersionService.deleteProcessSpecVersion(id); + if(b) { + return new ResponseResult(CommonCode.SUCCESS); + } + return new ResponseResult(CommonCode.FAIL); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java index 3b319f7..3012aad 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java @@ -15,6 +15,7 @@ import org.jeecg.modules.dnc.response.QueryListResponseResult; import org.jeecg.modules.dnc.response.ResponseResult; import org.jeecg.modules.dnc.service.IProductInfoService; +import org.jeecg.modules.dnc.service.IProductMixService; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.ucenter.UserDepartExt; import org.jeecg.modules.dnc.utils.ValidateUtil; diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductMixController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductMixController.java new file mode 100644 index 0000000..91fdd0a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductMixController.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.dnc.controller; + +import cn.hutool.core.lang.tree.Tree; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.aspect.annotation.AutoLog; +import org.jeecg.modules.dnc.service.IProductMixService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@Slf4j +@Api(tags = "缁撴瀯鏍�") +@RestController +@RequestMapping("/nc/product") +public class ProductMixController { + @Autowired + private IProductMixService iProductMixService; + + /** + * 鑾峰彇浜у搧缁撴瀯鏍� + * @return + */ + @AutoLog(value = "鑾峰彇浜у搧缁撴瀯鏍�") + @ApiOperation(value = "鑾峰彇浜у搧缁撴瀯鏍�", notes = "鑾峰彇浜у搧缁撴瀯鏍�") + @GetMapping(value = "/getTree") + public Result<?> getTree() { + return Result.OK(iProductMixService.getTree()); + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/WorkStepController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/WorkStepController.java index f8e3431..f4c4934 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/WorkStepController.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/WorkStepController.java @@ -8,9 +8,12 @@ import org.jeecg.modules.dnc.entity.WorkStep; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.response.ResponseResult; +import org.jeecg.modules.dnc.service.IProductMixService; import org.jeecg.modules.dnc.service.IWorkStepService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; + +import java.util.List; @Slf4j @Api(tags = "宸ユ琛�") @@ -19,6 +22,8 @@ public class WorkStepController extends JeecgController<WorkStep, IWorkStepService> { @Autowired private IWorkStepService iWorkStepService; + @Autowired + private IProductMixService iProductMixService; @AutoLog(value = "宸ユ琛�-鏂板宸ユ淇℃伅") @ApiOperation(value = "宸ユ琛�-鏂板宸ユ淇℃伅", notes = "宸ユ琛�-鏂板宸ユ淇℃伅") diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java deleted file mode 100644 index e73db26..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.jeecg.modules.dnc.entity; - -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.jeecgframework.poi.excel.annotation.Excel; -import org.jeecgframework.poi.excel.annotation.ExcelTarget; - -import java.io.Serializable; -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName(value = "sys_button") -@ExcelTarget("button") -public class Button implements Serializable { - @TableId - private String buttonId; - @Excel(name = "鎸夐挳鏉冮檺") - private String buttonPerm; - @Excel(name = "鎸夐挳鍚嶇О") - private String buttonName; - private String buttonIcon; - private Integer priority; - private Integer buttonType; - @JsonIgnore - @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) - private Date createTime; - @JsonIgnore - @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) - private Date updateTime; - @JsonIgnore - @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) - private String createUser; - @JsonIgnore - @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) - private String updateUser; - @JsonIgnore - @TableLogic - @TableField(value = "delete_flag", select = false) - private Integer deleteFlag = 0; - - @TableField(exist = false) - private String buttonAlias; - - @TableField(exist = false) - private String buttonUrl; - - @TableField(exist = false) - private String permCode; - - @TableField(exist = false) - private Boolean checked = false; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java deleted file mode 100644 index 693fd4e..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.jeecg.modules.dnc.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName(value = "sys_button_permission") -public class ButtonPermission { - @TableId - private String permId; - private String roleId; - private String buttonId; - @JsonIgnore - @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) - private Date createTime; - @JsonIgnore - @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) - private String createUser; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java deleted file mode 100644 index 625a104..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jeecg.modules.dnc.entity; - -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; - -/** - * @author clown - * * @date 2023/11/29 - */ -@Data -@NoArgsConstructor -@TableName(value = "dnc_pass_log") -public class DncPassLog { - @TableId - private String id; - //鍚嶇О - private String passName; - //搴忓彿 - private String sequenceOrder; - //鏃堕棿 - private String dayTime; - //绫诲瀷 - private String passType; - // 鏂囦欢鍚嶇О - private String passLogFileName; - //椤哄簭鍙� - private Integer sequenceNumber; - - private Date createTime; - - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java deleted file mode 100644 index 2f0aa53..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.jeecg.modules.dnc.entity; - -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName(value = "sys_menu") -public class Menu implements Serializable { - @TableId - private String menuId; - private String permCode; - private String menuName; - private String parentId; - private String iconCls; - private String menuUrl; - private Integer priority; - private Integer rankLevel; - @JsonIgnore - @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) - private Date createTime; - @JsonIgnore - @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) - private Date updateTime; - @JsonIgnore - @TableField(value = "create_by", select = false, fill = FieldFill.INSERT) - private String createBy; - @JsonIgnore - @TableField(value = "update_by", select = false, fill = FieldFill.UPDATE) - private String updateBy; - @JsonIgnore - @TableLogic - @TableField(value = "delete_flag", select = false) - private Integer deleteFlag = 0; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java deleted file mode 100644 index 4cacc60..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -package org.jeecg.modules.dnc.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.jeecgframework.poi.excel.annotation.Excel; - -import java.io.Serializable; -import java.util.Date; - -/** - * * @Description: 鏃ュ織琛� - * @author clown - * * @date 2023/12/4 - */ -@Data -@NoArgsConstructor -@TableName(value = "nc_log_info") -public class NcLogInfo implements Serializable { - @TableId - private String id; - /*妯″潡*/ - @Excel(name = "妯″潡",width = 15) - private String moduleInfo; - /** - * 鏃ュ織鍐呭 - */ - @Excel(name = "鏃ュ織鍐呭",width = 15) - private String logContent; - /*鍔熻兘*/ - /** - * 鎿嶄綔绫诲瀷锛� 2娣诲姞锛�3淇敼锛�4鍒犻櫎 7 鍏朵粬锛� - */ - private Integer operateType; - - /** - * 鎿嶄綔绫诲瀷锛� 2娣诲姞锛�3淇敼锛�4鍒犻櫎 7 鍏朵粬锛� - */ - @Excel(name = "鎿嶄綔绫诲瀷",width = 15) - - private transient String operateTypeStr; - - /** - * IP - */ - @Excel(name = "IP",width = 15) - private String ip; - /** - * 璐﹀彿 - */ - @Excel(name = "璐﹀彿",width = 15) - private String userName; - /*濮撳悕*/ - private String nickName; - /** - * 澶囨敞/浠呬慨鏀逛娇鐢ㄥ偍瀛樹慨鏀瑰墠鐨勬暟鎹� - */ - private String remark; - - @Excel(name = "鎿嶄綔鏃堕棿", width = 20,format = "yyyy-MM-dd HH:mm:ss") - @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") - @TableField(value = "create_time", fill = FieldFill.INSERT) - private Date createTime; - - @Excel(name = "鎿嶄綔浜�",width = 15) - @TableField(value = "create_by",fill = FieldFill.INSERT) - private String createBy; - - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectBase.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectBase.java deleted file mode 100644 index 4c78de1..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectBase.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.jeecg.modules.dnc.entity; - -import com.baomidou.mybatisplus.annotation.*; -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName(value = "sys_object") -public class ObjectBase { - @TableId - private String objectId; - private String objectPerm; - private String objectName; - private String objectIcon; - private Integer priority; - @JsonIgnore - @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) - private Date createTime; - @JsonIgnore - @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) - private Date updateTime; - @JsonIgnore - @TableField(value = "create_by", select = false, fill = FieldFill.INSERT) - private String createBy; - @JsonIgnore - @TableField(value = "update_by", select = false, fill = FieldFill.UPDATE) - private String updateBy; - @JsonIgnore - @TableLogic - @TableField(value = "delete_flag", select = false) - private Integer deleteFlag = 0; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java deleted file mode 100644 index e86d8e9..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jeecg.modules.dnc.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.io.Serializable; -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName(value = "sys_object_button") -public class ObjectButton implements Serializable { - @TableId - private String objectButtonId; - private String objectId; - private String buttonId; - private String buttonAlias; - private String buttonUrl; - private String permCode; - @JsonIgnore - @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) - private Date createTime; - @JsonIgnore - @TableField(value = "create_by", select = false, fill = FieldFill.INSERT) - private String createBy; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java deleted file mode 100644 index a5f324c..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.jeecg.modules.dnc.entity; - -import com.baomidou.mybatisplus.annotation.FieldFill; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; - -@Data -@NoArgsConstructor -@TableName(value = "sys_object_button_permission") -public class ObjectButtonPermission { - @TableId - private String permId; - private String roleId; - private String objectId; - private String buttonId; - @JsonIgnore - @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) - private Date createTime; - @JsonIgnore - @TableField(value = "create_by", select = false, fill = FieldFill.INSERT) - private String createBy; -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java index d0f3ef8..068e65a 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStream.java @@ -24,6 +24,9 @@ //闆朵欢id @TableField(value = "parts_id") private String partsId; + //宸ュ簭鐗堟湰id + @TableField(value = "process_version_id") + private String processVersionId; //宸ュ簭id @TableField(value = "process_id") private String processId; diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStreamNew.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStreamNew.java new file mode 100644 index 0000000..450ab76 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/PermissionStreamNew.java @@ -0,0 +1,46 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.*; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.Api; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_permission_stream_new") +@Api(value = "鐢ㄦ埛鏉冮檺璁板綍琛紙鏂帮級") +public class PermissionStreamNew { + @TableId(value = "id") + private String id; + //涓氬姟id + @TableField(value = "business_id") + private String businessId; + //涓氬姟绫诲瀷 + @TableField(value = "business_type") + private String businessType; + //鐢ㄦ埛id + @TableField(value = "user_id") + private String userId; + //DNC閮ㄩ棬id + @TableField(value = "depart_id") + private String departId; + @JsonIgnore + @TableField(value = "create_time") + private Date createTime; + @JsonIgnore + @TableField(value = "update_time") + private Date updateTime; + @JsonIgnore + @TableField(value = "create_by") + private String createBy; + @JsonIgnore + @TableField(value = "update_by") + private String updateBy; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersion.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersion.java new file mode 100644 index 0000000..65661eb --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersion.java @@ -0,0 +1,67 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableLogic; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.Api; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.jeecg.common.aspect.annotation.Dict; + +import java.io.Serializable; +import java.util.Date; + +@Data +@NoArgsConstructor +@TableName(value = "nc_process_spec_version") +@Api(value = "宸ヨ壓瑙勭▼鐗堟湰") +public class ProcessSpecVersion implements Serializable { + private static final long serialVersionUID = 1529244980533421687L; + //id + @TableField(value = "id") + private String id; + //浜у搧id + @TableField(value = "product_id") + private String productId; + //閮ㄤ欢id + @TableField(value = "component_id") + private String componentId; + //闆朵欢id + @TableField(value = "parts_id") + private String partsId; + //宸ヨ壓瑙勭▼鐗堟湰鍙� + @TableField(value = "process_spec_version_code") + private String processSpecVersionCode; + //宸ヨ壓瑙勭▼鍚嶇О + @TableField(value = "process_spec_version_name") + private String processSpecVersionName; + //鎻忚堪 + @TableField(value = "description") + private String description; + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "create_time", fill = FieldFill.INSERT) + private Date createTime; + @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @TableField(value = "update_time", fill = FieldFill.INSERT) + private Date updateTime; + @JsonIgnore + @TableField(value = "create_by", select = false, fill = FieldFill.INSERT) + @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") + private String createBy; + @JsonIgnore + @TableField(value = "update_by", select = false, fill = FieldFill.UPDATE) + @Dict(dictTable = "sys_user", dicCode = "username", dicText = "realname") + private String updateBy; + @JsonIgnore + @TableLogic + @TableField(value = "delete_flag", select = false) + private Integer deleteFlag = 0; + //鍒涘缓浜� + private transient String createName; + //鏇存柊浜� + private transient String updateName; + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/MenuButton.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionDepartment.java similarity index 60% rename from lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/MenuButton.java rename to lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionDepartment.java index adb3e81..b118add 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/MenuButton.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionDepartment.java @@ -8,24 +8,28 @@ import lombok.Data; import lombok.NoArgsConstructor; -import java.io.Serializable; import java.util.Date; @Data @NoArgsConstructor -@TableName(value = "sys_menu_button") -public class MenuButton implements Serializable { - @TableId - private String menuButtonId; - private String menuId; - private String buttonId; - private String buttonAlias; - private String buttonUrl; - private String permCode; +@TableName(value = "nc_process_spec_version_department") +public class ProcessSpecVersionDepartment { + @TableId(value = "id") + private String id; + @TableField(value = "psv_id") + private String psvId; + @TableField(value = "depart_id") + private String departId; @JsonIgnore @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) private Date createTime; @JsonIgnore @TableField(value = "create_by", select = false, fill = FieldFill.INSERT) private String createBy; + + public ProcessSpecVersionDepartment(String partsId, String departId){ + this.psvId = partsId; + this.departId = departId; + } + } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionPermission.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionPermission.java new file mode 100644 index 0000000..c652cfc --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionPermission.java @@ -0,0 +1,36 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonIgnore; +import io.swagger.annotations.Api; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +@Data +@NoArgsConstructor +@TableName(value = "nc_process_spec_version_permission") +@Api(value = "宸ヨ壓瑙勭▼鐗堟湰鐢ㄦ埛鏉冮檺") +public class ProcessSpecVersionPermission { + + @TableId(value = "id") + private String id; + @TableField(value = "psv_id") + private String psvId; + @TableField(value = "user_id") + private String userId; + @JsonIgnore + @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) + private Date createTime; + @JsonIgnore + @TableField(value = "create_by", select = false, fill = FieldFill.INSERT) + private String createBy; + + public ProcessSpecVersionPermission(String psvId, String userId){ + this.psvId = psvId; + this.userId = userId; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java index 890213f..df056cc 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessStream.java @@ -22,6 +22,8 @@ private String componentId; @TableField(value = "parts_id") private String partsId; + @TableField(value = "psv_id") + private String psvId; @TableField(value = "process_name") private String processName; @TableField(value = "process_code") diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductMix.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductMix.java new file mode 100644 index 0000000..d205a13 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProductMix.java @@ -0,0 +1,47 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.ArrayList; +import java.util.List; + +@Getter +@Data +@NoArgsConstructor +@TableName(value = "nc_product_mix") +public class ProductMix { + // id + private long id; + // 鐖剁骇 id + @TableField(value = "parent_id") + private long parentId; + // 鍚嶇О + @TableField(value = "name") + private String name; + // code + @TableField(value = "code") + private String code; + // 绫诲瀷 + @TableField(value = "type") + private String type; + + private transient List<ProductMix> children = new ArrayList<>(); + + public ProductMix(long id, long parentId, String name, String code, String type) { + this.id = id; + this.parentId = parentId; + this.name = name; + this.code = code; + this.type = type; + this.children = new ArrayList<>(); + } + + public void addChild(ProductMix child) { + this.children.add(child); + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStep.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStep.java index f8f546d..b688b0e 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStep.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/WorkStep.java @@ -32,6 +32,9 @@ //闆朵欢id @TableField(value = "parts_id") private String partsId; + //宸ヨ壓瑙勭▼id + @TableField(value = "psv_id") + private String psvId; //宸ュ簭id @TableField(value = "process_id") private String processId; diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java deleted file mode 100644 index c88dbb8..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java +++ /dev/null @@ -1,23 +0,0 @@ -package org.jeecg.modules.dnc.ext; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import org.jeecg.modules.dnc.entity.Menu; - -import java.util.List; - -@Data -@NoArgsConstructor -@EqualsAndHashCode(callSuper = false) -public class MenuExt extends Menu { - private List<MenuExt> childList; - - public boolean hasChild() { - boolean b = true; - if(this.getChildList() == null || this.getChildList().size() < 1) { - b = false; - } - return b; - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java deleted file mode 100644 index 43b49d1..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import org.jeecg.modules.dnc.entity.Button; - -import java.util.List; - -public interface ButtonMapper extends BaseMapper<Button> { - - /** - * 鑾峰彇绯荤粺鎸夐挳鐨勬潈闄� - * @return - */ - List<Button> getButtonPerms(@Param("userId") String userId); - - /** - * 鑾峰彇鐢ㄦ埛瀵瑰簲瑙掕壊鐨勮彍鍗曟搷浣滄潈闄� - * @param userId - * @return - */ - List<Button> getMenuButtonPerms(@Param("userId") String userId, @Param("menuUrl") String menuUrl); - - /** - * 鑾峰彇鐢ㄦ埛瀵瑰簲瑙掕壊鐨勫璞℃搷浣滄潈闄� - * @param userId - * @return - */ - List<Button> getObjectButtonPerms(@Param("userId") String userId, @Param("objectPerm") String objectPerm); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java deleted file mode 100644 index 326bd26..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.dnc.entity.ButtonPermission; - -public interface ButtonPermissionMapper extends BaseMapper<ButtonPermission> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncObjectMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncObjectMapper.java deleted file mode 100644 index a3506b1..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncObjectMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.dnc.entity.ObjectBase; - -public interface DncObjectMapper extends BaseMapper<ObjectBase> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java deleted file mode 100644 index 8ab732a..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java +++ /dev/null @@ -1,18 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Param; -import org.jeecg.modules.dnc.entity.DncPassLog; - -/** - * @author clown - * * @date 2023/11/29 - */ -public interface DncPassLogMapper extends BaseMapper<DncPassLog> { - /** - * 鏌ヨ鏌愪竴澶╂渶鍚庝竴鏉¤褰� - * @param dayTime - * @return - */ - DncPassLog findDateTimeDay(@Param("dayTime")String dayTime); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java deleted file mode 100644 index 4d58416..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.dnc.entity.MenuButton; - -public interface MenuButtonMapper extends BaseMapper<MenuButton> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java deleted file mode 100644 index 1475067..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.conditions.Wrapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.baomidou.mybatisplus.core.toolkit.Constants; -import org.apache.ibatis.annotations.Param; -import org.jeecg.modules.dnc.entity.Menu; -import org.jeecg.modules.dnc.ext.MenuExt; - -import java.util.List; - -public interface MenuMapper extends BaseMapper<Menu> { - - List<Menu> findByUserId(@Param(Constants.WRAPPER) Wrapper<Menu> wrapper); - - List<MenuExt> findByParentId(@Param("parentId") String parentId); - - List<MenuExt> findExtAll(); - - List<MenuExt> findExtAllBySingleSelect(); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java deleted file mode 100644 index 9202b4d..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.dnc.entity.NcLogInfo; - -/** - * * @Description: 鏃ュ織琛� - * @author clown - * * @date 2023/12/4 - */ -public interface NcLogInfoMapper extends BaseMapper<NcLogInfo> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java deleted file mode 100644 index 99e85dd..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.dnc.entity.ObjectButton; - -public interface ObjectButtonMapper extends BaseMapper<ObjectButton> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java deleted file mode 100644 index 939ce2d..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.dnc.entity.ObjectButtonPermission; - -public interface ObjectButtonPermissionMapper extends BaseMapper<ObjectButtonPermission> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java deleted file mode 100644 index 662c7f4..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package org.jeecg.modules.dnc.mapper; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.jeecg.modules.dnc.entity.PermissionStream; - -public interface PermissionStreamMapper extends BaseMapper<PermissionStream> { -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamNewMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamNewMapper.java new file mode 100644 index 0000000..f377469 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamNewMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.PermissionStreamNew; +import org.jeecg.modules.dnc.entity.ProductMix; + +import java.util.List; + +public interface PermissionStreamNewMapper extends BaseMapper<PermissionStreamNew> { + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇缁撴瀯鏍戞潈闄� + * @param userId + * @return + */ + List<ProductMix> loadProductMix(String userId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionDepartmentMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionDepartmentMapper.java new file mode 100644 index 0000000..c8872c8 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionDepartmentMapper.java @@ -0,0 +1,27 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.dnc.entity.ProcessSpecVersionDepartment; +import org.jeecg.modules.system.entity.MdcProduction; + +import java.util.List; + + +public interface ProcessSpecVersionDepartmentMapper extends BaseMapper<ProcessSpecVersionDepartment> { + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param psvId + * @return + */ + List<MdcProduction> getDepartPermsByPsvId(@Param("psvId") String psvId); + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param psvId + * @return + */ + List<MdcProduction> getDepartNonPermsByPsvId(@Param("psvId") String psvId); + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionMapper.java new file mode 100644 index 0000000..e0fc8ae --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionMapper.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ProcessSpecVersion; +import org.jeecg.modules.dnc.entity.WorkStep; + +import java.util.List; + +public interface ProcessSpecVersionMapper extends BaseMapper<ProcessSpecVersion> { + + /** + * 鏌ヨ宸ヨ壓瑙勭▼鐗堟湰淇℃伅 + * @param userId + * @return + */ + List<ProcessSpecVersion> getByUserPerms(String userId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionPermissionMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionPermissionMapper.java new file mode 100644 index 0000000..7fd285a --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProcessSpecVersionPermissionMapper.java @@ -0,0 +1,32 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.fasterxml.jackson.annotation.JsonIgnore; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.dnc.entity.ProcessSpecVersion; +import org.jeecg.modules.dnc.entity.ProcessSpecVersionPermission; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.Date; +import java.util.List; + +public interface ProcessSpecVersionPermissionMapper extends BaseMapper<ProcessSpecVersionPermission> { + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛 + * @param psvId + * @return + */ + List<UserDepartExt> getUserPermsBypsvId(@Param("psvId") String psvId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛 + * @param psvId + * @return + */ + List<SysUser> getUserNonPermsBypsvId(@Param("psvId") String psvId); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductMixMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductMixMapper.java new file mode 100644 index 0000000..d22845e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ProductMixMapper.java @@ -0,0 +1,7 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.ProductMix; + +public interface ProductMixMapper extends BaseMapper<ProductMix> { +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml deleted file mode 100644 index 3c68622..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> - <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > -<mapper namespace="org.jeecg.modules.dnc.mapper.ButtonMapper"> - <select id="getButtonPerms" parameterType="String" resultType="org.jeecg.modules.dnc.entity.Button"> - select distinct b.button_id - , b.button_perm - , b.button_name - , b.button_icon - from (select button_id,button_perm,button_name,button_icon from sys_button where button_type=1 and delete_flag=0) b - inner join sys_button_permission p on b.button_id=p.button_id - inner join sys_role r on p.role_id=r.id - inner join sys_user_role u - on u.role_id=r.id - where u.user_id=#{userId} - </select> - - - <select id="getMenuButtonPerms" parameterType="java.util.Map" resultType="org.jeecg.modules.dnc.entity.Button"> - select distinct b.button_id - , b.button_perm - , b.button_name - , b.button_icon - , mb.button_alias - , mb.button_url - , mb.perm_code - from (select button_id,button_perm,button_name,button_icon from sys_button where button_type=2 and delete_flag=0) b - inner join sys_menu_button mb on b.button_id=mb.button_id - inner join (select menu_id from sys_menu where menu_url=#{menuUrl}) m on mb.menu_id=m.menu_id - inner join sys_menu_button_permission mbp on mb.menu_id=mbp.menu_id and mb.button_id=mbp.button_id - inner join sys_role r on mbp.role_id=r.id - inner join sys_user_role u - on u.role_id=r.id - where u.user_id=#{userId} - </select> - - <select id="getObjectButtonPerms" parameterType="java.util.Map" resultType="org.jeecg.modules.dnc.entity.Button"> - select distinct b.button_id - , b.button_perm - , b.button_name - , b.button_icon - , ob.button_alias - , ob.button_url - , ob.perm_code - from (select button_id,button_perm,button_name,button_icon from sys_button where button_type=2 and delete_flag=0) b - inner join sys_object_button ob on b.button_id=ob.button_id - inner join (select object_id from sys_object where object_perm=#{objectPerm}) o on ob.object_id=o.object_id - inner join sys_object_button_permission obp on ob.object_id=obp.object_id and ob.button_id=obp.button_id - inner join sys_role r on obp.role_id=r.role_id - inner join sys_user_role u - on u.role_id=r.role_id - where u.user_id=#{userId} - </select> -</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml index e6285f0..d31a3cb 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ComponentInfoMapper.xml @@ -128,8 +128,8 @@ , (select sys_user.realname from sys_user where comp.update_by=sys_user.username) as updateName from nc_component_info comp inner join - (select distinct component_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s - on comp.component_id=s.component_id + (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s + on comp.component_id = s.business_id and s.business_type='2' where delete_flag = 0 </select> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DncPassLogMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DncPassLogMapper.xml deleted file mode 100644 index 3c74dd4..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DncPassLogMapper.xml +++ /dev/null @@ -1,9 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > -<mapper namespace="org.jeecg.modules.dnc.mapper.DncPassLogMapper"> - <select id="findDateTimeDay" resultType="org.jeecg.modules.dnc.entity.DncPassLog" parameterType="String"> - select top 1 * - from dnc_pass_log u - where day_time = #{dayTime} order by create_time desc - </select> -</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml deleted file mode 100644 index 67a7489..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml +++ /dev/null @@ -1,123 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" ?> -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > -<mapper namespace="org.jeecg.modules.dnc.mapper.MenuMapper"> - <select id="findByUserId" parameterType="String" resultType="org.jeecg.modules.dnc.entity.Menu"> - select m.menu_id - , m.perm_code - , m.menu_name - , m.parent_id - , m.menu_url - , m.icon_cls - , m.priority - , m.rank_level - from sys_menu m left join sys_menu_permission p on m.menu_id=p.menu_id - left join sys_role r on p.role_id=r.id - left join sys_user_role u - on u.role_id=r.role_id - ${ew.customSqlSegment} - </select> - - <!-- - 1銆乵ybatis鑷姩寮�鍚┘宄版爣璇嗚浆鎹� menu_name 鑷姩杞负menuName - 2銆佸疄浣撶被濡傛灉涓烘墿灞曠被鍨嬶紝闇�瑕佸姞鍏d鏍囩 鏍囪瘑id瀛楁绫� 涓嶇劧id瀵瑰簲鐨勫瓧娈垫棤娉曡祴鍊� - 3銆佸绾у叧鑱旇鍙ユ槸鍒嗗紑鏌ヨ鐨� 鏁版嵁閲忓ぇ鐨勬儏鍐典笅鎬ц兘浣庝笅 - 4銆佸鏋滅‘瀹氱骇鏍� 鍙互浣跨敤绾ц仈鏌ヨ涓�娆℃煡璇� 渚嬪瓙锛� - --> - <resultMap id="menuExtBaseResult" type="org.jeecg.modules.dnc.ext.MenuExt"> - <id column="menu_id" property="menuId" /> - <collection column="menu_id" property="childList" select="findByParentId"> - </collection> - </resultMap> - - <resultMap id="menuExtSingleSelectResult" type="org.jeecg.modules.dnc.ext.MenuExt"> - <id column="menu_id_one" property="menuId" /> - <result column="perm_code_one" property="permCode" /> - <result column="menu_name_one" property="menuName" /> - <result column="parent_id_one" property="parentId" /> - <result column="menu_url_one" property="menuUrl" /> - <result column="icon_cls_one" property="iconCls" /> - <result column="priority_one" property="priority" /> - <result column="rank_level_one" property="rankLevel" /> - <collection property="childList" ofType="org.jeecg.modules.dnc.ext.MenuExt"> - <id column="menu_id_two" property="menuId" /> - <result column="perm_code_two" property="permCode" /> - <result column="menu_name_two" property="menuName" /> - <result column="parent_id_two" property="parentId" /> - <result column="menu_url_two" property="menuUrl" /> - <result column="icon_cls_two" property="iconCls" /> - <result column="priority_two" property="priority" /> - <result column="rank_level_two" property="rankLevel" /> - <collection property="childList" ofType="org.jeecg.modules.dnc.ext.MenuExt"> - <id column="menu_id_three" property="menuId" /> - <result column="perm_code_three" property="permCode" /> - <result column="menu_name_three" property="menuName" /> - <result column="parent_id_three" property="parentId" /> - <result column="menu_url_three" property="menuUrl" /> - <result column="icon_cls_three" property="iconCls" /> - <result column="priority_three" property="priority" /> - <result column="rank_level_three" property="rankLevel" /> - </collection> - </collection> - </resultMap> - - <select id="findExtAll" resultMap="menuExtBaseResult"> - select menu_id - , perm_code - , menu_name - , parent_id - , menu_url - , icon_cls - , priority - , rank_level - from sys_menu - where rank_level=1 - </select> - - <select id="findByParentId" resultMap="menuExtBaseResult"> - select menu_id - , perm_code - , menu_name - , parent_id - , menu_url - , icon_cls - , priority - , rank_level - from sys_menu - where parent_id=#{parentId} - </select> - - <select id="findExtAllBySingleSelect" resultMap="menuExtSingleSelectResult"> - select am.menu_id as menu_id_one - , am.perm_code as perm_code_one - , am.menu_name as menu_name_one - , am.parent_id as parent_id_one - , am.menu_url as menu_url_one - , am.icon_cls as icon_cls_one - , am.priority as priority_one - , am.rank_level as rank_level_one - - , bm.menu_id as menu_id_two - , bm.perm_code as perm_code_two - , bm.menu_name as menu_name_two - , bm.parent_id as parent_id_two - , bm.menu_url as menu_url_two - , bm.icon_cls as icon_cls_two - , bm.priority as priority_two - , bm.rank_level as rank_level_two - - , cm.menu_id as menu_id_three - , cm.perm_code as perm_code_three - , cm.menu_name as menu_name_three - , cm.parent_id as parent_id_three - , cm.menu_url as menu_url_three - , cm.icon_cls as icon_cls_three - , cm.priority as priority_three - , cm.rank_level as rank_level_three - from sys_menu am - left join (select * from sys_menu where delete_flag=0) bm - on bm.parent_id = am.menu_id - left join (select * from sys_menu where delete_flag=0) cm - on cm.parent_id = bm.menu_id - where am.rank_level=1 and am.delete_flag=0 - </select> -</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml index 0147846..6e602bb 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PartsInfoMapper.xml @@ -26,8 +26,8 @@ , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName from nc_parts_info p inner join - (select distinct parts_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s - on p.parts_id = s.parts_id + (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s + on p.parts_id = s.business_id and s.business_type='3' where p.delete_flag = 0 </select> </mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PermissionStreamNewMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PermissionStreamNewMapper.xml new file mode 100644 index 0000000..45a8357 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/PermissionStreamNewMapper.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.PermissionStreamNewMapper"> + <select id="loadProductMix" resultType="org.jeecg.modules.dnc.entity.ProductMix"> + SELECT + mix.* + FROM + nc_product_mix mix + LEFT JOIN nc_permission_stream_new nps ON mix.id = nps.business_id + AND nps.user_id = #{userId} + AND nps.delete_flag = '0' + WHERE + nps.business_id IS NOT NULL + OR nps.business_id IS NULL + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionDepartmentMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionDepartmentMapper.xml new file mode 100644 index 0000000..38a9055 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionDepartmentMapper.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ProcessSpecVersionDepartmentMapper"> + <select id="getDepartPermsByPsvId" resultType="org.jeecg.modules.system.entity.MdcProduction"> + select u.id + , u.production_name + , u.parent_id + , u.production_order + , u.org_type + , org_code + from mdc_production u + inner join + (select depart_id from nc_process_spec_version_department where psv_id=#{psvId}) p + on u.id=p.depart_id + </select> + <select id="getDepartNonPermsByPsvId" resultType="org.jeecg.modules.system.entity.MdcProduction"> + select u.id + , u.production_name + , u.parent_id + , u.production_order + , u.org_type + , org_code + from mdc_production u + where u.id not in (select depart_id from nc_process_spec_version_department where psv_id=#{psvId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionMapper.xml new file mode 100644 index 0000000..aa2076e --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionMapper.xml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ProcessSpecVersionMapper"> + <select id="getByUserPerms" resultType="org.jeecg.modules.dnc.entity.ProcessSpecVersion"> + select + p.id + , p.product_id + , p.component_id + , p.parts_id + , p.process_spec_version_name + , p.process_spec_version_code + , p.CREATE_TIME + , p.create_by + , p.UPDATE_TIME + , p.update_by + , p.description + , (select sys_user.realname from sys_user where p.create_by=sys_user.username) as createName + , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName + from nc_process_spec_version p + inner join + (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s + on p.id = s.business_id AND s.business_type='4' + where p.delete_flag = 0 + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionPermissionMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionPermissionMapper.xml new file mode 100644 index 0000000..60f025f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessSpecVersionPermissionMapper.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > +<mapper namespace="org.jeecg.modules.dnc.mapper.ProcessSpecVersionPermissionMapper"> + <select id="getUserPermsBypsvId" resultType="org.jeecg.modules.dnc.ucenter.UserDepartExt"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + inner join + (select user_id from nc_process_spec_version_permission where psv_id=#{psvId}) p + on u.id=p.user_id + </select> + <select id="getUserNonPermsBypsvId" resultType="org.jeecg.modules.system.entity.SysUser"> + select u.id + , u.username + , u.realname + , u.avatar + , u.phone + , u.email + from sys_user u + where u.id not in (select user_id from nc_process_spec_version_permission where psv_id=#{psvId}) + </select> +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml index c44d000..a7d298a 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProcessStreamMapper.xml @@ -7,6 +7,7 @@ , p.product_id , p.component_id , p.parts_id + , p.psv_id , p.PROCESS_NAME , p.PROCESS_CODE , p.CRAFT_NO @@ -24,8 +25,8 @@ , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName from nc_process_stream p inner join - (select distinct PROCESS_ID from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s - on p.PROCESS_ID = s.PROCESS_ID + (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s + on p.PROCESS_ID = s.business_id and s.business_type='5' where p.delete_flag = 0 </select> <select id="findByPartsAndComponents" resultType="org.jeecg.modules.dnc.entity.ProcessStream"> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml index f0dc586..2a8b420 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ProductInfoMapper.xml @@ -15,8 +15,8 @@ , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName from nc_product_info p inner join - (select distinct product_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s - on p.product_id = s.product_id + (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s + on p.product_id = s.business_id and s.business_type='1' where p.delete_flag = 0 order by p.create_time asc </select> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepMapper.xml index db50589..ecfcb12 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepMapper.xml +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/WorkStepMapper.xml @@ -7,6 +7,7 @@ , p.product_id , p.component_id , p.parts_id + , p.psv_id , p.PROCESS_ID , p.step_name , p.step_code @@ -25,8 +26,8 @@ , (select sys_user.realname from sys_user where p.update_by=sys_user.username) as updateName from nc_work_step p inner join - (select distinct step_id from nc_permission_stream where delete_flag = 0 and user_id=#{userId}) s - on p.id = s.step_id + (select business_id,business_type from nc_permission_stream_new where delete_flag = 0 and user_id=#{userId}) s + on p.id = s.business_id and s.business_type='6' where p.delete_flag = 0 </select> </mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java index da32471..d7bd592 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/PartsInfoCode.java @@ -12,11 +12,15 @@ PARTS_NOT_EXIST(false,25204,"闆朵欢涓嶅瓨鍦紒"), PARTS_USER_NOT_PERM(false,25205,"娌℃湁璇ラ浂浠剁殑鏉冮檺锛�"), PARTS_DELETE_ERROR(false,25206,"鍒犻櫎闆朵欢澶辫触锛�"), - PARTS_PROCESS_EXIST(false,25207,"闆朵欢鏈夊叧鑱旂殑宸ュ簭淇℃伅锛�"), + PARTS_PROCESS_EXIST(false,25207,"闆朵欢鏈夊叧鑱旂殑宸ヨ壓瑙勭▼鐗堟湰淇℃伅锛�"), PARTS_DOC_EXIST(false,25208,"闆朵欢鏈夊叧鑱旂殑鏂囨。鏁版嵁"), - PARTS_CODE_NONE(false,25208,"璇疯緭鍏ラ浂浠朵唬鍙凤紒"), - PARTS_IS_EXIST(false,25209,"闆朵欢宸插瓨鍦紒"), - PARTS_USER_NONE(false,25210,"闆朵欢鏃犳硶娓呯┖鐢ㄦ埛鏉冮檺锛岃鑷冲皯淇濈暀涓�浣嶅彲鎿嶄綔鐢ㄦ埛锛�"); + PARTS_CODE_NONE(false,25209,"璇疯緭鍏ラ浂浠朵唬鍙凤紒"), + PARTS_IS_EXIST(false,25210,"闆朵欢宸插瓨鍦紒"), + PROCESSSPECVERSION_NOT_EXIST(false,25211,"宸ヨ壓瑙勭▼涓嶅瓨鍦紒"), + PROCESSSPECVERSION_IS_EXIST(false,25212,"宸ヨ壓瑙勭▼宸插瓨鍦紒"), + PROCESSSPECVERSION_CODE_NONE(false,25213,"璇疯緭鍏ュ伐鑹鸿绋嬬増鏈彿锛�"), + PROCESSSPECVERSION_PROCESS_EXIST(false,25214,"宸ヨ壓瑙勭▼鐗堟湰鏈夊叧鑱旂殑宸ュ簭淇℃伅锛�"), + PARTS_USER_NONE(false,25215,"闆朵欢鏃犳硶娓呯┖鐢ㄦ埛鏉冮檺锛岃鑷冲皯淇濈暀涓�浣嶅彲鎿嶄綔鐢ㄦ埛锛�"); //鎿嶄綔浠g爜 @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java index fb21cf8..66cbd21 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ProcessInfoCode.java @@ -10,6 +10,7 @@ PROCESS_PRODUCT_NONE(false,25402,"鏃犳晥鐨勪骇鍝侊紒"), PROCESS_COMPONENT_NONE(false,25403,"鏃犳晥鐨勯儴浠讹紒"), PROCESS_PARTS_NONE(false,25404,"鏃犳晥鐨勯浂浠讹紒"), + PROCESSSPECVERSION_NONE(false,254014,"鏃犳晥鐨勫伐鑹鸿绋嬬増鏈紒"), PROCESS_NOT_EXIST(false,25405,"鏃犳晥鐨勫伐搴忥紒"), PROCESS_HAS_DOC(false,25406,"宸ュ簭涓嬫湁鍏宠仈鐨勬枃妗o紝鏃犳硶鍒犻櫎锛�"), PROCESS_CODE_NONE(false,25407,"璇疯緭鍏ュ伐搴忓彿锛�"), @@ -17,7 +18,7 @@ WORKSTEP_NAME_NONE(false,25409,"璇疯緭鍏ュ伐姝ュ悕绉帮紒"), WORKSTEP_NOT_EXIST(false,25410,"鏃犳晥鐨勫伐姝ワ紒"), WORKSTEP_IS_EXIST(false,25411,"璇ュ伐姝ュ凡瀛樺湪锛�"), - WORKSTEP_HAS_DATA(false,25412,"宸ユ涓嬫湁鍏宠仈鐨勫伐搴忔暟鎹�"), + WORKSTEP_HAS_DATA(false,25412,"宸ュ簭涓嬫湁鍏宠仈鐨勫伐姝ユ暟鎹�"), WORKSTEP_HAS_DOC(false,25413,"宸ユ涓嬫湁鍏宠仈鐨勬枃妗f暟鎹�"); //鎿嶄綔浠g爜 diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java deleted file mode 100644 index 2bc212b..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.ButtonPermission; - -import java.util.List; -import java.util.Map; - -public interface IButtonPermissionService extends IService<ButtonPermission> { - /** - * 鏍规嵁瑙掕壊id鍒犻櫎绯荤粺鎸夐挳鏉冮檺 - * @param roleId - * @return - */ - boolean deleteByRoleId(String roleId); - - /** - * 鑾峰彇瑙掕壊鍒嗛厤鐨勭郴缁熸寜閽� - * @param roleId - * @return - */ - Map<String, ButtonPermission> getMapByRoleId(String roleId); - - /** - * 鑾峰彇鎸夐挳鐨勬墍鏈夋潈闄� - * @param buttonId - * @return - */ - List<ButtonPermission> findByButtonId(String buttonId); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java deleted file mode 100644 index 494f206..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java +++ /dev/null @@ -1,94 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.entity.Button; -import org.jeecg.modules.dnc.request.ButtonRequest; - -import java.util.List; - -public interface IButtonService extends IService<Button> { - /** - * 鏂板鎸夐挳瀵硅薄 - * @param button - * @return - */ - boolean addButton(Button button); - - /** - * 鏍规嵁鏉冮檺鐮佹煡鎵炬寜閽� - * @param permCode - * @return - */ - Button getByPermCode(String permCode); - - /** - * 鏍规嵁鎸夐挳绫诲瀷鏌ヨ鎸夐挳鍒楄〃 - * @param buttonType - * @return - */ - List<Button> findByButtonType(Integer buttonType); - - /** - * 鍒嗛〉鏌ヨ鎸夐挳 - * @param page - * @param size - * @param buttonRequest - * @return - */ - QueryPageResponseResult<Button> findByPageList(int page, int size, ButtonRequest buttonRequest); - /** - * 鑾峰彇绯荤粺鎸夐挳鐨勬潈闄� - * @return - */ - List<Button> getButtonPerms(String userId); - - /** - * 鑾峰彇鐢ㄦ埛瀵瑰簲瑙掕壊鐨勮彍鍗曟搷浣滄潈闄� - * @param userId - * @return - */ - List<Button> getMenuButtonPerms(String userId, String menuUrl); - - /** - * 鑾峰彇鐢ㄦ埛瀵瑰簲瑙掕壊鐨勫璞℃搷浣滄潈闄� - * @param userId - * @return - */ - List<Button> getObjectButtonPerms(String userId, String objectPerm); - - /** - * 缂栬緫鎸夐挳 - * @param id - * @param button - * @return - */ - boolean editButton(String id,Button button); - - /** - * 鍒犻櫎鎸夐挳 - * @param id - * @return - */ - boolean deleteButtonById(String id); - - /** - * 鏌ヨ瑙掕壊鍒嗛厤鍜屾湭鍒嗛厤鐨勭郴缁熸寜閽� - * @param roleId - * @return - */ - List<Button> findPermsByRoleId(String roleId); - - /** - * 鑾峰彇鑿滃崟鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽� - * @param menuId - * @return - */ - List<Button> findByMenuId(String menuId); - /** - * 鑾峰彇瀵硅薄鍒嗛厤鐨勬寜閽垪琛� 鍖呭惈鏈垎閰嶆寜閽� - * @param objectId - * @return - */ - List<Button> findByObjectId(String objectId); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java deleted file mode 100644 index 07adefc..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java +++ /dev/null @@ -1,47 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.ucenter.DepartApproveUser; - -import java.util.List; -import java.util.Map; - -public interface IDepartApproveUserService extends IService<DepartApproveUser> { - - /** - * 鏍规嵁閮ㄩ棬id鏌ユ壘瀹℃壒鍊欓�変汉 - * @param departIds - * @return - */ - List<String> getByDepartIds(List<String> departIds); - - /** - * 鑾峰彇閮ㄩ棬鍘熸湁鐨勫鎵逛汉 - * @param departId - * @return - */ - Map<String, DepartApproveUser> getByDepartId(String departId); - - /** - * 鍒犻櫎閮ㄩ棬鐨勫鎵逛汉 - * @param departId - * @return - */ - boolean deleteByDepartId(String departId); - - /** - * 鏌ユ壘鍞竴 - * @param departId - * @param userId - * @return - */ - DepartApproveUser getByDepartIdAndUserId(String departId, String userId); - - /** - * 绉婚櫎涓�缁勬潈闄� - * @param list - * @return - */ - boolean removeByCollection(List<DepartApproveUser> list); - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java deleted file mode 100644 index 84a7f4c..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java +++ /dev/null @@ -1,37 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.ucenter.DepartmentUser; - -import java.util.List; - -public interface IDepartmentUserService extends IService<DepartmentUser> { - /** - * 鏍规嵁鐢ㄦ埛id鍒犻櫎鐢ㄦ埛鎵�鍦ㄧ殑閮ㄩ棬淇℃伅 - * @param userId - * @return - */ - boolean deleteByUserId(String userId); - - /** - * 绉婚櫎涓�缁勬暟鎹� - * @param departmentUserList - * @return - */ - boolean removeByCollection(List<DepartmentUser> departmentUserList); - - /** - * 鏌ヨ鍞竴 - * @param userId - * @param departId - * @return - */ - DepartmentUser getByUserIdAndDepartId(String userId, String departId); - - /** - * 鑾峰彇閮ㄩ棬涓嬬殑鐢ㄦ埛淇℃伅 - * @param departId - * @return - */ - List<DepartmentUser> findByDepartId(String departId); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java deleted file mode 100644 index 557b7f3..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.DeviceGroupDepart; -import org.jeecg.modules.dnc.ucenter.Department; - -import java.util.List; - -public interface IDeviceGroupDepartService extends IService<DeviceGroupDepart> { - /** - * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬鍒楄〃 - * @param groupId - * @return - */ - List<Department> getDepartPermsByGroupId(String groupId); - - /** - * 鑾峰彇鏈垎閰嶇殑閮ㄩ棬鍒楄〃 - * @param groupId - * @return - */ - List<Department> getDepartNonPermsByGroupId(String groupId); - - /** - * 鏍规嵁鍒嗙粍鍜岄儴闂ㄦ煡璇㈠敮涓�鐨勬潈闄愭暟鎹� - * @param groupId - * @param departId - * @return - */ - DeviceGroupDepart getDepartByGroupAndDepartId(String groupId, String departId); - - /** - * 鍒犻櫎閮ㄩ棬鏉冮檺 - * @param departList - * @return - */ - boolean removeByCollection(List<DeviceGroupDepart> departList); - - /** - * 鏍规嵁groupId鍒犻櫎鏉冮檺 - * @param groupId - * @return - */ - boolean deleteByGroupId(String groupId); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java index 374ddc5..d5cdd2c 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupService.java @@ -10,27 +10,7 @@ import java.util.List; public interface IDeviceGroupService extends IService<DeviceGroup> { - /** - * 鏂板璁惧鍒嗙粍 - * @param deviceGroup - * @return - */ - boolean addDeviceGroup(DeviceGroup deviceGroup); - /** - * 鎸夊悕绉版煡璇㈡暟鎹� - * @param groupName - * @return - */ - DeviceGroup findByGroupName(String groupName); - - /** - * 缂栬緫璁惧鍒嗙粍 - * @param id - * @param deviceGroup - * @return - */ - boolean editDeviceGroup(String id, DeviceGroup deviceGroup); /** * 鏌ヨ鎵�鏈夌埗鑺傜偣鍚嶇О * @param parentId @@ -38,12 +18,7 @@ * @return */ List<String> findListParentTree(String parentId,List<String> stringList); - /** - * 鍒犻櫎璁惧鍒嗙粍 - * @param id - * @return - */ - boolean deleteDeviceGroup(String id); + /** * 鑾峰彇璁惧鐖跺瓙鐖跺瓙缁撴瀯鏁版嵁 @@ -93,54 +68,6 @@ * @return */ boolean assignRemoveUser(DeviceGroup deviceGroup, Collection<SysUser> userList); - - /** - * 鑾峰彇鍒嗙粍宸插垎閰嶇殑閮ㄩ棬 - * @param groupId - * @return - */ - List<Department> getDepartPermsList(String groupId); - - /** - * 鑾峰彇鍒嗙粍鏈垎閰嶇殑閮ㄩ棬 - * @param groupId - * @return - */ - List<Department> getDepartNonPermsList(String groupId); - -// /** -// * 缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄� -// * @param groupId -// * @param relativeFlag -// * @param departmentIds -// * @return -// */ -// boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds); -// -// /** -// * 绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺 -// * @param groupId -// * @param relativeFlag -// * @param departmentIds -// * @return -// */ -// boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds); - - /** - * 缁欏垎缁勫垎閰嶉儴闂ㄦ潈闄� - * @param deviceGroup - * @param departmentList - * @return - */ - boolean assignAddDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList); - - /** - * 绉婚櫎鍒嗙粍鍒嗛厤閮ㄩ棬鏉冮檺 - * @param deviceGroup - * @param departmentList - * @return - */ - boolean assignRemoveDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList); /** * diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java deleted file mode 100644 index b0d76b4..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.DncPassLog; - -/** - * @author clown - * * @date 2023/11/29 - */ -public interface IDncPassLogService extends IService<DncPassLog> { - - /** - * 鏌ヨ鏌愪竴澶╃殑鏁版嵁 - * @param dateDay - * @return - */ - DncPassLog findDayTime(String dateDay); - - /** - * 鍙戦�佹枃浠� - */ - void fileClientTxtOrNc(); - - /** - * 鍒犻櫎鍥哄畾璺緞涓嬭秴鏃舵枃浠� - * @return - */ - void deleteNcSendFile(); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java deleted file mode 100644 index 810433e..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.MenuButton; - -import java.util.List; -import java.util.Map; - -public interface IMenuButtonService extends IService<MenuButton> { - - /** - * 鏍规嵁鑿滃崟id鍒犻櫎淇℃伅 - * @param menuId - * @return - */ - boolean deleteByMenuId(String menuId); - - /** - * 鑾峰彇鑿滃崟鍒嗛厤鐨勬寜閽垪琛� - * @param menuId - * @return - */ - Map<String, MenuButton> getMapByMenuId(String menuId); - - /** - * 鑾峰彇鎸夐挳鍏宠仈鐨勮彍鍗曟暟鎹� - * @param buttonId - * @return - */ - List<MenuButton> findByButtonId(String buttonId); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java deleted file mode 100644 index 4f7a6dc..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.NcLogInfo; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.request.NcLogInfoRequest; -import org.springframework.web.servlet.ModelAndView; - -/** - * @author clown - * * @date 2023/12/4 - */ -public interface INcLogInfoService extends IService<NcLogInfo> { - /** - * 鍒嗛〉鏌ヨ - * @param page - * @param size - * @param requestParams - * @return - */ - QueryPageResponseResult<NcLogInfo> findByPageList(int page, int size, NcLogInfoRequest requestParams); - - /** - * 淇濆瓨鏁版嵁 - * @param logInfo - * @return - */ - boolean saveLogNcInfos(NcLogInfo logInfo); - - /** - * 淇濆瓨鏁版嵁 - * @param moduleInfo - * @param operateType - * @param logContent - * @return - */ - boolean saveLogInfo(String moduleInfo,Integer operateType, String logContent); - - /** - * 瀵煎嚭鏌ヨList - * @param requestParams - * @return - */ - ModelAndView exportLogList(NcLogInfoRequest requestParams); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java deleted file mode 100644 index 85dd572..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.ObjectButtonPermission; - -import java.util.List; -import java.util.Map; - -public interface IObjectButtonPermissionService extends IService<ObjectButtonPermission> { - /** - * 鏍规嵁瑙掕壊id鍒犻櫎瀵硅薄鎸夐挳鎿嶄綔鏉冮檺 - * @param roleId - * @return - */ - boolean deleteByRoleId(String roleId); - - /** - * 鑾峰彇瑙掕壊鍒嗛厤鐨勮彍鍗曟寜閽� - * @param roleId - * @return - */ - Map<String, ObjectButtonPermission> getMapByRoleId(String roleId); - - /** - * 鑾峰彇瀵硅薄鐨勫叧鑱旀暟鎹� - * @param objId - * @return - */ - List<ObjectButtonPermission> findByObjectId(String objId); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java deleted file mode 100644 index 96ae679..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.ObjectButton; - -import java.util.List; -import java.util.Map; - -public interface IObjectButtonService extends IService<ObjectButton> { - /** - * 鏍规嵁瀵硅薄id鍒犻櫎淇℃伅 - * @param objectId - * @return - */ - boolean deleteByObjectId(String objectId); - - /** - * 鑾峰彇瀵硅薄鍒嗛厤鐨勬寜閽垪琛� - * @param objectId - * @return - */ - Map<String, ObjectButton> getMapByObjectId(String objectId); - - /** - * 鑾峰彇鎸夐挳鍏宠仈鐨勫璞℃暟鎹� - * @param id - * @return - */ - List<ObjectButton> findByButtonId(String id); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectService.java deleted file mode 100644 index 9563339..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectService.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.Button; -import org.jeecg.modules.dnc.entity.ObjectBase; -import org.jeecg.modules.dnc.request.ObjectBaseRequest; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; - -import java.util.List; - -public interface IObjectService extends IService<ObjectBase> { - /** - * 鏂板绠$悊瀵硅薄淇℃伅 - * @param objectBase - * @return - */ - boolean addObject(ObjectBase objectBase); - - /** - * 鏍规嵁鏉冮檺鐮佹煡鎵惧璞� - * @param permCode - * @return - */ - ObjectBase getByPermCode(String permCode); - - /** - * 鎸囨淳瀵硅薄鐨勬搷浣滄寜閽� - * @param objectId - * @param buttonList - * @return - */ - boolean assignButton(String objectId, List<Button> buttonList); - - /** - * 缂栬緫瀵硅薄 - * @param id - * @param objectBase - * @return - */ - boolean editObject(String id, ObjectBase objectBase); - - /** - * 鍒犻櫎瀵硅薄 - * @param id - * @return - */ - boolean deleteObjectById(String id); - - /** - * 鍒嗛〉鏌ヨ瀵硅薄 - * @param page - * @param size - * @param buttonRequest - * @return - */ - QueryPageResponseResult<ObjectBase> findPageList(int page, int size, ObjectBaseRequest buttonRequest ); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamNewService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamNewService.java new file mode 100644 index 0000000..d43bc80 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamNewService.java @@ -0,0 +1,85 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.PermissionStreamNew; +import org.jeecg.modules.dnc.entity.ProductMix; + +import java.util.List; + +public interface IPermissionStreamNewService extends IService<PermissionStreamNew> { + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇缁撴瀯鏍戞潈闄� + * @param userId + * @return + */ + List<ProductMix> loadProductMix(String userId); + + /** + * 閫氳繃涓氬姟id鍜屼笟鍔$被鍨嬭幏鍙栨潈闄� + * @param businessId + * @param businessType + * @return + */ + List<PermissionStreamNew> loadPermissionStreamNewByBusinessId(String businessId,String businessType,String type); + + /** + * 閫氳繃涓氬姟id鍜屼笟鍔$被鍨嬪拰鐢ㄦ埛id鑾峰彇鐢ㄦ埛鏉冮檺 + * @param businessId + * @param businessType + * @param userId + * @return + */ + PermissionStreamNew loadPermissionStreamNewByBusinessIdAndUserId(String businessId, String userId,String businessType); + + /** + * 閫氳繃涓氬姟id鍜屼笟鍔$被鍨嬪拰閮ㄩ棬id鑾峰彇閮ㄩ棬鏉冮檺 + * @param businessId + * @param businessType + * @param departId + * @return + */ + PermissionStreamNew loadPermissionStreamNewByBusinessIdAndDepartId(String businessId, String departId,String businessType); + + /** + * 閫氳繃businessId鑾峰彇鏉冮檺 + * @param businessId + * @param businessType + * @return + */ + List<PermissionStreamNew> loadProductMixByBusinessId(String businessId,String businessType); + + + /** + * 閫氳繃涓氬姟id涓庣被鍨嬪垹闄ゆ潈闄� + * @param businessId + * @param businessType + * @return + */ + boolean deletePermissionStreamNewByBusinessId(String businessId,String businessType,String type); + + /** + * 閫氳繃List<PermissionStreamNew>鎵归噺鍒犻櫎 + * @param permissionStreamNewList + * @return + */ + boolean deletePermissionStreamNewByList(List<PermissionStreamNew> permissionStreamNewList); + + /** + * 閫氳繃涓�缁勪笟鍔d鍜岀敤鎴穒d鍜岀被鍨嬫煡璇� + * @param businessIds + * @param userIds + * @param businessType + * @return + */ + List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndUserIds(List<String> businessIds,List<String> userIds,String businessType); + + /** + * 閫氳繃涓�缁勪笟鍔d鍜岄儴闂╥d鍜岀被鍨嬫煡璇� + * @param businessIds + * @param departIds + * @param businessType + * @return + */ + List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndDepartIds(List<String> businessIds,List<String> departIds,String businessType); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java deleted file mode 100644 index a639bbc..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java +++ /dev/null @@ -1,238 +0,0 @@ -package org.jeecg.modules.dnc.service; - -import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.PermissionStream; - -import java.util.List; - -public interface IPermissionStreamService extends IService<PermissionStream> { - /** - * 鏍规嵁浜у搧缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param userId - * @return - */ - PermissionStream getByProductIdAndUserId(String productId, String userId); - /** - * 鏍规嵁閮ㄤ欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param userId - * @return - */ - PermissionStream getByComponentIdAndUserId(String productId, String componentId, String userId); - - /** - * 鏍规嵁闆朵欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param userId - * @param partsId - * @return - */ - PermissionStream getByPartsIdAndUserId(String productId, String componentId, String partsId, String userId); - - /** - * 鏍规嵁闆朵欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param userId - * @param partsId - * @return - */ - PermissionStream getByProcessIdAndUserId(String productId, String componentId, String partsId,String processId,String userId); - - /** - * 鏍规嵁闆朵欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param userId - * @param partsId - * @return - */ - PermissionStream getByStepIdAndUserId(String productId, String componentId, String partsId,String processId,String stepId, String userId); - - /** - * 鏍规嵁浜у搧缂栧彿鏌ユ壘閮ㄩ棬鏉冮檺 - * @param productId - * @return - */ - List<PermissionStream> getByProductId(String productId); - /** - * 鏍规嵁閮ㄤ欢缂栧彿鏌ユ壘閮ㄩ棬鏉冮檺 - * @param productId - * @param componentId - * @return - */ - List<PermissionStream> getByComponentId(String productId, String componentId); - - /** - * 鏍规嵁闆朵欢缂栧彿鏌ユ壘閮ㄩ棬鏉冮檺 - * @param productId - * @param componentId - * @param partsId - * @return - */ - List<PermissionStream> getByPartsId(String productId, String componentId, String partsId); - - /** - * 鏍规嵁宸ュ簭缂栧彿鏌ユ壘閮ㄩ棬鏉冮檺 - * @param productId - * @param componentId - * @param partsId - * @param processId - * @return - */ - List<PermissionStream> getByProcessId(String productId, String componentId, String partsId, String processId); - - /** - * 鏍规嵁宸ユ缂栧彿鏌ユ壘閮ㄩ棬鏉冮檺 - * @param productId - * @param componentId - * @param partsId - * @param processId - * @param stepId - * @return - */ - List<PermissionStream> getByStepId(String productId, String componentId, String partsId,String processId,String stepId); - - /** - * 鍒犻櫎鐢ㄦ埛鏉冮檺 - * @param productId - * @return - */ - boolean deleteUserPermsByProductId(String productId); - /** - * 鍒犻櫎鐢ㄦ埛鏉冮檺 - * @param productId - * @return - */ - boolean deleteUserPermsByComponentId(String productId, String componentId); - /** - * 鍒犻櫎鐢ㄦ埛鏉冮檺 - * @param productId - * @return - */ - boolean deleteUserPermsByPartsId(String productId, String componentId, String partsId); - - /** - * 鍒犻櫎閮ㄩ棬鏉冮檺 - * @param productId - * @return - */ - boolean deleteDepartPermsByProductId(String productId); - /** - * 鍒犻櫎閮ㄩ棬鏉冮檺 - * @param productId - * @return - */ - boolean deleteDepartPermsByComponentId(String productId, String componentId); - /** - * 鍒犻櫎閮ㄩ棬鏉冮檺 - * @param productId - * @return - */ - boolean deleteDepartPermsByPartsId(String productId, String componentId, String partsId); - - /** - * 绉婚櫎鏉冮檺鏁版嵁 - * @param permissionStreamList - * @return - */ - boolean removeByCollection(List<PermissionStream> permissionStreamList); - - /** - * 鏌ヨ浜у搧鐨勫敮涓�閮ㄩ棬鏉冮檺 - * @param productId - * @param departId - * @return - */ - PermissionStream getByProductIdAndDepartId(String productId, String departId); - - /** - * 鏍规嵁閮ㄤ欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param departId - * @return - */ - PermissionStream getByComponentIdAndDepartId(String productId, String componentId, String departId); - - /** - * 鏍规嵁闆朵欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param departId - * @param partsId - * @return - */ - PermissionStream getByPartsIdAndDepartId(String productId, String componentId, String partsId, String departId); - - /** - * 鏍规嵁宸ュ簭缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param departId - * @param partsId - * @param processId - * @return - */ - PermissionStream getByProcessIdAndDepartId(String productId, String componentId, String partsId,String processId, String departId); - - /** - * 鏍规嵁宸ユ缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param departId - * @param partsId - * @param processId - * @param stepId - * @return - */ - PermissionStream getByStepIdAndDepartId(String productId, String componentId, String partsId,String processId,String stepId, String departId); - - /** - * 鑾峰彇閮ㄩ棬鍏宠仈鐨勬潈闄愪俊鎭� - * @param departId - * @return - */ - List<PermissionStream> findByDepartId(String departId); - - /** - * 鑾峰彇鐢ㄦ埛鐨勫叧鑱旀潈闄愭暟鎹� - * @param userId - * @return - */ - List<PermissionStream> findByUserId(String userId); - - /** - * 鏌ヨ閮ㄤ欢涓嬬殑鏉冮檺淇℃伅 - * @param componentIds - * @param userIds - * @return - */ - List<PermissionStream> getByComponentIdsAndUserIds(List<String> componentIds, List<String> userIds); - - /** - * 鏌ヨ閮ㄤ欢涓嬬殑鏉冮檺淇℃伅 - * @param componentIds - * @param departIds - * @return - */ - List<PermissionStream> getByComponentIdsAndDepartIds(List<String> componentIds, List<String> departIds); - /** - * 鏌ヨ闆朵欢涓嬬殑鏉冮檺淇℃伅 - * @param partsIds - * @param userIds - * @return - */ - List<PermissionStream> getByPartsIdsAndUserIds(List<String> partsIds, List<String> userIds); - - /** - * 鏌ヨ闆朵欢涓嬬殑鏉冮檺淇℃伅 - * @param partsIds - * @param departIds - * @return - */ - List<PermissionStream> getByPartsIdsAndDepartIds(List<String> partsIds, List<String> departIds); -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionDepartmentService.java new file mode 100644 index 0000000..aeb33fc --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionDepartmentService.java @@ -0,0 +1,57 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.ComponentDepartment; +import org.jeecg.modules.dnc.entity.PartsDepartment; +import org.jeecg.modules.dnc.entity.ProcessSpecVersion; +import org.jeecg.modules.dnc.entity.ProcessSpecVersionDepartment; +import org.jeecg.modules.system.entity.MdcProduction; + +import java.util.List; + +public interface IProcessSpecVersionDepartmentService extends IService<ProcessSpecVersionDepartment> { + + /** + * 鏍规嵁宸ヨ壓瑙勭▼鐗堟湰id鍒犻櫎閮ㄩ棬鏉冮檺 + * @param psvId + * @return + */ + boolean deleteByPsvId(String psvId); + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param psvId + * @return + */ + List<MdcProduction> getDepartPermsByPsvId(String psvId); + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param psvId + * @return + */ + List<MdcProduction> getDepartNonPermsByPsvId(String psvId); + + /** + * 鏌ヨ閮ㄩ棬鏉冮檺 + * @param psvId + * @param departId + * @return + */ + ProcessSpecVersionDepartment getByProcessSpecVersionIdAndDepartId(String psvId, String departId); + + /** + * 绉婚櫎閮ㄩ棬鏉冮檺 + * @param processSpecVersionDepartments + * @return + */ + boolean removeByCollection(List<ProcessSpecVersionDepartment> processSpecVersionDepartments); + + /** + * 鏌ヨ涓�缁勯儴闂ㄦ潈闄� + * @param psvIds + * @param ids + * @return + */ + List<ProcessSpecVersionDepartment> getByPsvIdsAndDepartIds(List<String> psvIds, List<String> ids); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionPermissionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionPermissionService.java new file mode 100644 index 0000000..298b124 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionPermissionService.java @@ -0,0 +1,57 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.PartsPermission; +import org.jeecg.modules.dnc.entity.ProcessSpecVersionPermission; +import org.jeecg.modules.dnc.entity.ProcessionPermission; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.List; + +public interface IProcessSpecVersionPermissionService extends IService<ProcessSpecVersionPermission> { + /** + * 鏍规嵁psvId 鍜寀serId 鏌ユ壘鏉冮檺 + * @param psvId + * @param userId + * @return + */ + ProcessSpecVersionPermission getByPsvIdAndUserId(String psvId, String userId); + + /** + * 鏌ヨ涓�缁勬潈闄� + * @param psvIds + * @param ids + * @return + */ + List<ProcessSpecVersionPermission> getByPsvIdsAndUserIds(List<String> psvIds, List<String> ids); + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛 + * @param psvId + * @return + */ + List<UserDepartExt> getUserPermsByProductId(String psvId); + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛 + * @param psvId + * @return + */ + List<SysUser> getUserNonPermsByProductId(String psvId); + + /** + * 鏍规嵁psvId 鍒犻櫎 + * @param psvId + * @return + */ + boolean deleteByPsvId(String psvId); + + + /** + * 鏍规嵁涓�缁勬暟鎹Щ闄ゆ潈闄� + * @param permissionList + * @return + */ + boolean removeByCollection(List<ProcessSpecVersionPermission> permissionList); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionService.java new file mode 100644 index 0000000..abd1bcc --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessSpecVersionService.java @@ -0,0 +1,105 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.PartsInfo; +import org.jeecg.modules.dnc.entity.ProcessSpecVersion; +import org.jeecg.modules.system.entity.MdcProduction; +import org.jeecg.modules.system.entity.SysUser; + +import java.util.Collection; +import java.util.List; + +public interface IProcessSpecVersionService extends IService<ProcessSpecVersion> { + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇鎺堟潈鐨勫伐鑹鸿绋嬬増鏈〃淇℃伅 + * @param userId + * @return + */ + List<ProcessSpecVersion> getByUserPerms(String userId); + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇鎺堟潈鐨勫伐鑹鸿绋嬬増鏈〃淇℃伅 + * @param userId + * @param queryParam 鏌ヨ鏉′欢 + * @return + */ + List<ProcessSpecVersion> getByUserPerms(String userId,String queryParam); + + /** + * 鏂板宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭� + * @param ProcessSpecVersion + * @return + */ + boolean addProcessSpecVersion(ProcessSpecVersion ProcessSpecVersion); + + /** + * 缂栬緫宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭� + * @param id + * @param ProcessSpecVersion + * @return + */ + boolean editProcessSpecVersion(String id ,ProcessSpecVersion ProcessSpecVersion); + + /** + * 鍒犻櫎宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭� + * @param id + * @return + */ + boolean deleteProcessSpecVersion(String id); + + + /** + * 鑾峰彇鍞竴 闆朵欢缂栧彿 + * @param processSpecVersionCode + * @return + */ + ProcessSpecVersion getByCode(String processSpecVersionCode); + + /** + * 鏍规嵁闆朵欢id鑾峰彇 + * @param partsId + * @return + */ + List<ProcessSpecVersion> getByPartsId(String partsId); + + /** + * 鏍规嵁涓�缁勯浂浠秈d鑾峰彇 + * @param partsIds + * @return + */ + List<ProcessSpecVersion> getByPartsIds(List<String> partsIds); + + + /** + * 鍒嗛厤鐢ㄦ埛鏉冮檺 + * @param processSpecVersion + * @param userList + * @return + */ + boolean assignAddUser(ProcessSpecVersion processSpecVersion, Collection<SysUser> userList); + + /** + * 绉婚櫎鐢ㄦ埛鏉冮檺 + * @param processSpecVersion + * @param userList + * @return + */ + boolean assignRemoveUser(ProcessSpecVersion processSpecVersion, Collection<SysUser> userList); + /** + * 鍒嗛厤閮ㄩ棬鏉冮檺 + * @param processSpecVersion + * @param departmentList + * @return + */ + boolean assignAddDepart(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> departmentList); + + /** + * 鍒嗛厤閮ㄩ棬鏉冮檺 + * @param processSpecVersion + * @param departmentList + * @return + */ + boolean assignRemoveDepart(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> departmentList); + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java index 163ea8e..0a0a182 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java @@ -58,18 +58,18 @@ /** * 鑾峰彇闆朵欢鍏宠仈鐨勫伐搴忎俊鎭� - * @param partsId + * @param psvId * @return */ - List<ProcessStream> findByPartsId(String partsId); + List<ProcessStream> findBypsvId(String psvId); /** * 鑾峰彇闆朵欢涓嬬殑宸ュ簭鍙� * @param processNo - * @param partsId + * @param psvsId * @return */ - ProcessStream findByProcessNoAndPartsId(String processNo, String partsId); + ProcessStream findByProcessNoAndPartsId(String processNo, String psvsId); /** * 鑾峰彇閮ㄤ欢涓嬬殑宸ュ簭鍙� * @param processNo diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductMixService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductMixService.java new file mode 100644 index 0000000..d6d8a13 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductMixService.java @@ -0,0 +1,17 @@ +package org.jeecg.modules.dnc.service; + +import cn.hutool.core.lang.tree.Tree; +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.common.api.vo.Result; +import org.jeecg.modules.dnc.entity.ProductMix; + +import java.util.List; + +public interface IProductMixService extends IService<ProductMix> { + + //鑾峰彇灏佽浜у搧缁撴瀯鏍� + public List<ProductMix> getTree(); + + //妯℃嫙鐢熸垚浜у搧缁撴瀯鏍� + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java deleted file mode 100644 index 89f82e9..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.mapper.ButtonPermissionMapper; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.dnc.entity.ButtonPermission; -import org.jeecg.modules.dnc.response.RoleCode; -import org.jeecg.modules.dnc.service.IButtonPermissionService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class ButtonPermissionServiceImpl extends ServiceImpl<ButtonPermissionMapper, ButtonPermission> implements IButtonPermissionService { - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteByRoleId(String roleId) { - if(!ValidateUtil.validateString(roleId)) - ExceptionCast.cast(RoleCode.ROLE_ID_NONE); - LambdaQueryWrapper<ButtonPermission> lambdaUpdate = Wrappers.lambdaQuery(); - lambdaUpdate.eq(ButtonPermission::getRoleId, roleId); - return super.remove(lambdaUpdate); - } - - @Override - public Map<String, ButtonPermission> getMapByRoleId(String roleId) { - if(!ValidateUtil.validateString(roleId)) - return null; - Map<String, ButtonPermission> map = new HashMap<>(); - List<ButtonPermission> list = super.lambdaQuery().eq(ButtonPermission::getRoleId, roleId).list(); - if(list == null || list.isEmpty()) - return null; - list.forEach(item -> { - map.put(item.getButtonId(), item); - }); - return map; - } - - @Override - public List<ButtonPermission> findByButtonId(String buttonId) { - return super.lambdaQuery().eq(ButtonPermission::getButtonId, buttonId).list(); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java deleted file mode 100644 index c44da4c..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java +++ /dev/null @@ -1,209 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.entity.ObjectButton; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.mapper.ButtonMapper; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.service.IButtonPermissionService; -import org.jeecg.modules.dnc.service.IButtonService; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.dnc.entity.Button; -import org.jeecg.modules.dnc.entity.ButtonPermission; -import org.jeecg.modules.dnc.entity.MenuButton; -import org.jeecg.modules.dnc.service.IMenuButtonService; -import org.jeecg.modules.dnc.request.ButtonRequest; -import org.jeecg.modules.dnc.response.ButtonCode; -import org.jeecg.modules.dnc.service.IObjectButtonService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.List; -import java.util.Map; - -@Service -public class ButtonServiceImpl extends ServiceImpl<ButtonMapper, Button> implements IButtonService { - @Autowired - private IButtonPermissionService buttonPermissionService; - @Autowired - private IMenuButtonService menuButtonService; - @Autowired - private IObjectButtonService objectButtonService; - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean addButton(Button button) { - if(button == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(!ValidateUtil.validateString(button.getButtonPerm())) - ExceptionCast.cast(ButtonCode.BTN_PERM_CODE_NONE); - if(!ValidateUtil.validateString(button.getButtonName())) - ExceptionCast.cast(ButtonCode.BTN_NAME_NONE); - if(!ValidateUtil.validateInteger(button.getButtonType())) - ExceptionCast.cast(ButtonCode.BTN_TYPE_NONE); - Button en = getByPermCode(button.getButtonPerm()); - if(en != null) - ExceptionCast.cast(ButtonCode.BTN_PERM_CODE_EXIST); - return super.save(button); - } - - @Override - public Button getByPermCode(String permCode){ - if(!ValidateUtil.validateString(permCode)) - return null; - List<Button> list = super.lambdaQuery().eq(Button::getButtonPerm, permCode).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - public List<Button> findByButtonType(Integer buttonType) { - if(!ValidateUtil.validateInteger(buttonType)) - return null; - return super.lambdaQuery().eq(Button::getButtonType, buttonType).list(); - } - - @Override - public QueryPageResponseResult<Button> findByPageList(int page, int size, ButtonRequest buttonRequest) { - if(page < 1 || size < 1) { - ExceptionCast.cast(CommonCode.INVALID_PAGE); - } - IPage<Button> pageData = new Page<>(page, size); - LambdaQueryChainWrapper<Button> lambdaQuery = super.lambdaQuery(); - if(buttonRequest != null) { - if(ValidateUtil.validateString(buttonRequest.getButtonName())) { - lambdaQuery.like(Button::getButtonName, buttonRequest.getButtonName()); - } - if(ValidateUtil.validateString(buttonRequest.getButtonPerm())) { - lambdaQuery.like(Button::getButtonPerm, buttonRequest.getButtonPerm()); - } - if(ValidateUtil.validateInteger(buttonRequest.getButtonType())) { - lambdaQuery.eq(Button::getButtonType, buttonRequest.getButtonType()); - } - if(ValidateUtil.validateString(buttonRequest.getAscStr())) { - String[] ascArr = buttonRequest.getAscStr().split(","); -// ((Page<Button>) pageData).setAsc(ascArr); - } - if(ValidateUtil.validateString(buttonRequest.getDescStr())) { - String[] descStr = buttonRequest.getDescStr().split(","); -// ((Page<Button>) pageData).setDesc(descStr); - } - } - IPage<Button> userIPage = lambdaQuery.page(pageData); - return new QueryPageResponseResult<>(CommonCode.SUCCESS, userIPage); - } - - @Override - public List<Button> getButtonPerms(String userId) { - return this.getBaseMapper().getButtonPerms(userId); - } - - @Override - public List<Button> getMenuButtonPerms(String userId, String menuUrl) { - return this.getBaseMapper().getMenuButtonPerms(userId, menuUrl); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public List<Button> getObjectButtonPerms(String userId, String objectPerm) { - return this.getBaseMapper().getObjectButtonPerms(userId, objectPerm); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean editButton(String id, Button button) { - if(!ValidateUtil.validateString(id) || button == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - button.setButtonId(id); - Button en = getByPermCode(button.getButtonPerm()); - if(en != null && !en.getButtonId().equals(button.getButtonId())) { - ExceptionCast.cast(ButtonCode.BTN_PERM_CODE_EXIST); - } - return super.updateById(button); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteButtonById(String id) { - if(!ValidateUtil.validateString(id)) { - ExceptionCast.cast(CommonCode.INVALID_PARAM); - } - Button button = super.getById(id); - if(button == null) - ExceptionCast.cast(ButtonCode.BTN_NOT_EXIST); - List<ButtonPermission> buttonPermissionList = buttonPermissionService.findByButtonId(id); - if(buttonPermissionList != null && !buttonPermissionList.isEmpty()) - ExceptionCast.cast(ButtonCode.BTN_ROLE_EXIST); - List<MenuButton> menuButtonList = menuButtonService.findByButtonId(id); - if(menuButtonList != null && !menuButtonList.isEmpty()) - ExceptionCast.cast(ButtonCode.BTN_MENU_EXIST); - List<ObjectButton> objectButtonList = objectButtonService.findByButtonId(id); - if(objectButtonList != null && !objectButtonList.isEmpty()) - ExceptionCast.cast(ButtonCode.BTN_OBJ_EXIST); - return super.removeById(id); - } - - @Override - public List<Button> findPermsByRoleId(String roleId) { - if(!ValidateUtil.validateString(roleId)) - return null; - List<Button> list = findByButtonType(1); - if(list == null || list.isEmpty()) - return null; - Map<String, ButtonPermission> map = buttonPermissionService.getMapByRoleId(roleId); - if(map == null || map.isEmpty()) - return list; - list.forEach(item -> { - if(map.containsKey(item.getButtonId())) { - item.setChecked(true); - } - }); - return list; - } - - @Override - public List<Button> findByMenuId(String menuId) { - if(!ValidateUtil.validateString(menuId)) - return null; - List<Button> list = findByButtonType(2); - if(list == null || list.isEmpty()) - return null; - Map<String, MenuButton> map = menuButtonService.getMapByMenuId(menuId); - if(map == null || map.isEmpty()) - return list; - list.forEach(item -> { - if(map.containsKey(item.getButtonId())) { - item.setChecked(true); - item.setButtonAlias(map.get(item.getButtonId()).getButtonAlias()); - item.setPermCode(map.get(item.getButtonId()).getPermCode()); - } - }); - return list; - } - - @Override - public List<Button> findByObjectId(String objectId) { - if(!ValidateUtil.validateString(objectId)) - return null; - List<Button> list = findByButtonType(2); - if(list == null || list.isEmpty()) - return null; - Map<String, ObjectButton> map = objectButtonService.getMapByObjectId(objectId); - if(map == null || map.isEmpty()) - return list; - list.forEach(item -> { - if(map.containsKey(item.getButtonId())) { - item.setChecked(true); - item.setButtonAlias(map.get(item.getButtonId()).getButtonAlias()); - item.setPermCode(map.get(item.getButtonId()).getPermCode()); - } - }); - return list; - } - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java index 58c024a..486ed9f 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java @@ -41,7 +41,7 @@ @Autowired public ProductInfoMapper productInfoMapper; @Autowired - private IPermissionStreamService permissionStreamService; + private IPermissionStreamNewService permissionStreamNewService; @Autowired private IComponentDepartmentService componentDepartmentService; @Autowired @@ -74,8 +74,7 @@ String userId = user.getId(); if(!ValidateUtil.validateString(userId)) ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - - List<PermissionStream> oldPermissionList; + List<PermissionStreamNew> oldPermissionList; ProductInfo productInfo = productInfoMapper.selectById(componentInfo.getProductId()); if(productInfo == null) ExceptionCast.cast(ComponentInfoCode.COMPONENT_PRODUCT_NONE); @@ -84,10 +83,10 @@ if(en == null) { ExceptionCast.cast(ComponentInfoCode.COMPONENT_PARENT_NOT_EXIST); } - oldPermissionList = permissionStreamService.getByComponentId(en.getProductId(), en.getComponentId()); + oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(en.getComponentId(),"2","1"); componentInfo.setRankLevel(en.getRankLevel() + 1); } else { - oldPermissionList = permissionStreamService.getByProductId(productInfo.getProductId()); + oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(productInfo.getProductId(),"1","1"); componentInfo.setParentId(null); componentInfo.setRankLevel(1); } @@ -98,17 +97,17 @@ ExceptionCast.cast(CommonCode.FAIL); //閮ㄩ棬鏉冮檺 List<ComponentDepartment> componentDepartmentList = new ArrayList<>(); - List<PermissionStream> componentDepartPermList = new ArrayList<>(); + List<PermissionStreamNew> componentDepartPermList = new ArrayList<>(); if(oldPermissionList != null && !oldPermissionList.isEmpty()) { oldPermissionList.forEach(item -> { ComponentDepartment componentDepartment = new ComponentDepartment(); componentDepartment.setComponentId(componentInfo.getComponentId()); componentDepartment.setDepartId(item.getDepartId()); componentDepartmentList.add(componentDepartment); - PermissionStream permissionStream = new PermissionStream(); - permissionStream.setProductId(componentInfo.getProductId()); - permissionStream.setComponentId(componentInfo.getComponentId()); + PermissionStreamNew permissionStream = new PermissionStreamNew(); + permissionStream.setBusinessId(componentInfo.getComponentId()); permissionStream.setDepartId(item.getDepartId()); + permissionStream.setBusinessType("2"); componentDepartPermList.add(permissionStream); }); } @@ -118,7 +117,7 @@ ExceptionCast.cast(CommonCode.FAIL); } if(!componentDepartPermList.isEmpty()) { - b = permissionStreamService.saveBatch(componentDepartPermList); + b = permissionStreamNewService.saveBatch(componentDepartPermList); if(!b) ExceptionCast.cast(CommonCode.FAIL); } @@ -128,11 +127,11 @@ } //鍘婚櫎榛樿鏂板宸ュ簭锛岃浆涓烘墜鍔ㄦ坊鍔� //娣诲姞鏉冮檺 - PermissionStream stream = new PermissionStream(); + PermissionStreamNew stream = new PermissionStreamNew(); stream.setUserId(userId); - stream.setProductId(componentInfo.getProductId()); - stream.setComponentId(componentInfo.getComponentId()); - return permissionStreamService.save(stream); + stream.setBusinessId(componentInfo.getComponentId()); + stream.setBusinessType("2"); + return permissionStreamNewService.save(stream); } @Override @@ -166,13 +165,13 @@ if(!b) return false; } - PermissionStream stream = permissionStreamService.getByComponentIdAndUserId(en.getProductId(), id, userId); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,"2"); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setUserId(userId); - stream.setProductId(en.getProductId()); - stream.setComponentId(id); - return permissionStreamService.save(stream); + stream.setBusinessId(id); + stream.setBusinessType("2"); + return permissionStreamNewService.save(stream); } return b; } @@ -227,10 +226,10 @@ b = componentDepartmentService.deleteByComponentId(item.getComponentId()); if(!b) ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); - b = permissionStreamService.deleteUserPermsByComponentId(item.getProductId(), item.getComponentId()); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","0"); if(!b) ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); - b = permissionStreamService.deleteDepartPermsByComponentId(item.getProductId(), item.getComponentId()); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","1"); if(!b) ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); b = super.removeById(item.getComponentId()); @@ -273,10 +272,10 @@ b = componentDepartmentService.deleteByComponentId(id); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamService.deleteUserPermsByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","0"); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamService.deleteDepartPermsByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1"); if(!b) ExceptionCast.cast(CommonCode.FAIL); return super.removeById(id); @@ -300,7 +299,7 @@ if(componentInfo == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ComponentPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ComponentPermission en = componentPermissionService.getByComponentIdAndUserId(componentInfo.getComponentId(), item.getId()); if(en == null) { @@ -309,12 +308,12 @@ en.setComponentId(componentInfo.getComponentId()); permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByComponentIdAndUserId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(), "2 "); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setUserId(item.getId()); - stream.setProductId(componentInfo.getProductId()); - stream.setComponentId(componentInfo.getComponentId()); + stream.setBusinessId(componentInfo.getComponentId()); + stream.setBusinessType("2"); permissionStreamList.add(stream); } }); @@ -325,7 +324,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -339,13 +338,13 @@ if(componentInfo == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ComponentPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ComponentPermission en = componentPermissionService.getByComponentIdAndUserId(componentInfo.getComponentId(), item.getId()); if(en != null) { permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByComponentIdAndUserId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(), "2 "); if(stream != null) { permissionStreamList.add(stream); } @@ -361,7 +360,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -375,7 +374,7 @@ if(componentInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ComponentDepartment> componentDepartments = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId()); if(en == null) { @@ -384,12 +383,12 @@ en.setComponentId(componentInfo.getComponentId()); componentDepartments.add(en); } - PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2"); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); - stream.setProductId(componentInfo.getProductId()); - stream.setComponentId(componentInfo.getComponentId()); + stream.setBusinessId(componentInfo.getComponentId()); + stream.setBusinessType("2"); permissionStreamList.add(stream); } }); @@ -400,7 +399,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -414,13 +413,13 @@ if(componentInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ComponentDepartment> componentDepartments = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ComponentDepartment en = componentDepartmentService.getByComponentIdAndDepartId(componentInfo.getComponentId(), item.getId()); if(en != null) { componentDepartments.add(en); } - PermissionStream stream = permissionStreamService.getByComponentIdAndDepartId(componentInfo.getProductId(), componentInfo.getComponentId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2"); if(stream != null) { permissionStreamList.add(stream); } @@ -432,7 +431,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java deleted file mode 100644 index 186547b..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java +++ /dev/null @@ -1,81 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.ucenter.DepartApproveUser; -import org.jeecg.modules.dnc.mapper.DepartApproveUserMapper; -import org.jeecg.modules.dnc.service.IDepartApproveUserService; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class DepartApproveUserServiceImpl extends ServiceImpl<DepartApproveUserMapper, DepartApproveUser> implements IDepartApproveUserService { - @Override - public List<String> getByDepartIds(List<String> departIds) { - if(departIds == null || departIds.isEmpty()) - return null; - List<DepartApproveUser> list = super.lambdaQuery().in(DepartApproveUser::getDepartId, departIds).list(); - if(list == null || list.isEmpty()) - return null; - List<String> userIds = new ArrayList<>(); - list.forEach(item -> { - userIds.add(item.getUserId()); - }); - return userIds; - } - - @Override - public Map<String, DepartApproveUser> getByDepartId(String departId) { - if(!ValidateUtil.validateString(departId)) - return null; - List<DepartApproveUser> list = super.lambdaQuery().eq(DepartApproveUser::getDepartId, departId).list(); - if(list == null || list.isEmpty()) - return null; - Map<String, DepartApproveUser> map = new HashMap<>(); - list.forEach(item ->{ - map.put(item.getUserId(), item); - }); - return map; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteByDepartId(String departId) { - if(!ValidateUtil.validateString(departId)) - return false; - LambdaQueryWrapper<DepartApproveUser> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(DepartApproveUser::getDepartId, departId); - return super.remove(lambdaQueryWrapper); - } - - @Override - public DepartApproveUser getByDepartIdAndUserId(String departId, String userId) { - if(!ValidateUtil.validateString(departId) || !ValidateUtil.validateString(userId)) - return null; - List<DepartApproveUser> list = super.lambdaQuery().eq(DepartApproveUser::getDepartId, departId).eq(DepartApproveUser::getUserId, userId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean removeByCollection(List<DepartApproveUser> list) { - if(list == null || list.isEmpty()) - return false; - if(list.size() == 1) - return super.removeById(list.get(0).getApproveId()); - List<String> ids = new ArrayList<>(); - list.forEach(item -> { - ids.add(item.getApproveId()); - }); - return super.removeByIds(ids); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java deleted file mode 100644 index 1ce0c56..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.ucenter.DepartmentUser; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.mapper.DepartmentUserMapper; -import org.jeecg.modules.dnc.response.UcenterCode; -import org.jeecg.modules.dnc.service.IDepartmentUserService; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; - -@Service -public class DepartmentUserServiceImpl extends ServiceImpl<DepartmentUserMapper, DepartmentUser> implements IDepartmentUserService { - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteByUserId(String userId) { - if(!ValidateUtil.validateString(userId)) - ExceptionCast.cast(UcenterCode.UCENTER_USER_ID_NONE); - LambdaQueryWrapper<DepartmentUser> lambdaUpdate = Wrappers.lambdaQuery(); - lambdaUpdate.eq(DepartmentUser::getUserId, userId); - return super.remove(lambdaUpdate); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean removeByCollection(List<DepartmentUser> list) { - if(list == null || list.isEmpty()) - return false; - if(list.size() == 1) - return super.removeById(list.get(0).getDepartUserId()); - List<String> ids = new ArrayList<>(); - list.forEach(item -> { - ids.add(item.getDepartUserId()); - }); - return super.removeByIds(ids); - } - - @Override - public DepartmentUser getByUserIdAndDepartId(String userId, String departId) { - if(!ValidateUtil.validateString(userId) || !ValidateUtil.validateString(departId)) - return null; - List<DepartmentUser> list = super.lambdaQuery().eq(DepartmentUser::getUserId, userId).eq(DepartmentUser::getDepartId, departId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - public List<DepartmentUser> findByDepartId(String departId) { - return super.lambdaQuery().eq(DepartmentUser::getDepartId, departId).list(); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java deleted file mode 100644 index 91b3247..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java +++ /dev/null @@ -1,60 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.entity.DeviceGroupDepart; -import org.jeecg.modules.dnc.mapper.DeviceGroupDepartMapper; -import org.jeecg.modules.dnc.ucenter.Department; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.dnc.service.IDeviceGroupDepartService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; - -@Service -public class DeviceGroupDepartServiceImpl extends ServiceImpl<DeviceGroupDepartMapper, DeviceGroupDepart> implements IDeviceGroupDepartService { - @Override - public List<Department> getDepartPermsByGroupId(String groupId) { - return super.getBaseMapper().getDepartPermsByGroupId(groupId); - } - - @Override - public List<Department> getDepartNonPermsByGroupId(String groupId) { - return super.getBaseMapper().getDepartNonPermsByGroupId(groupId); - } - - @Override - public DeviceGroupDepart getDepartByGroupAndDepartId(String groupId, String departId) { - if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateString(departId)) - return null; - List<DeviceGroupDepart> list = super.lambdaQuery().eq(DeviceGroupDepart::getGroupId, groupId).eq(DeviceGroupDepart::getDepartId, departId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean removeByCollection(List<DeviceGroupDepart> departList) { - if(departList == null || departList.isEmpty()) - return false; - if(departList.size() == 1) - return super.removeById(departList.get(0).getGroupDepartId()); - List<String> ids = new ArrayList<>(); - departList.forEach(item -> { - ids.add(item.getGroupDepartId()); - }); - return super.removeByIds(ids); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteByGroupId(String groupId) { - LambdaQueryWrapper<DeviceGroupDepart> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(DeviceGroupDepart::getGroupId, groupId); - return super.remove(lambdaQueryWrapper); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java index 077f156..539911d 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupServiceImpl.java @@ -37,145 +37,10 @@ @Autowired private IDevicePermissionStreamService devicePermissionStreamService; @Autowired - private IDeviceGroupDepartService deviceGroupDepartService; - @Autowired @Lazy private IDeviceInfoService deviceInfoService; - @Autowired - private INcLogInfoService iNcLogInfoService; - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean addDeviceGroup(DeviceGroup deviceGroup) { - if(deviceGroup == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(!ValidateUtil.validateString(deviceGroup.getGroupName())) - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NAME); - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - if(!ValidateUtil.validateString(userId)) - ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - DeviceGroup en = findByGroupName(deviceGroup.getGroupName()); - if(en != null) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_EXIST); - } - List<DevicePermissionStream> oldDepartPermList = null; - if (ValidateUtil.validateString(deviceGroup.getParentId())) { - en = super.getById(deviceGroup.getParentId()); - if(en == null) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PARENT_NOT_EXIST); - } - deviceGroup.setRankLevel(en.getRankLevel() + 1); - oldDepartPermList = devicePermissionStreamService.getDepartPermByGroupId(en.getGroupId()); - } else { - deviceGroup.setParentId(null); - deviceGroup.setRankLevel(1); - } - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(2); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍒嗙粍鍚嶇О锛�"+deviceGroup.getGroupName()+"锛屽垎缁勬弿杩帮細"+deviceGroup.getDescription()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); - boolean b = super.save(deviceGroup); - if(!b) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_SAVE_ERROR); - } - if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { - List<DeviceGroupDepart> groupDepartList = new ArrayList<>(); - List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); - oldDepartPermList.forEach(item -> { - DeviceGroupDepart dp = new DeviceGroupDepart(); - dp.setDepartId(item.getDepartId()); - dp.setGroupId(deviceGroup.getGroupId()); - groupDepartList.add(dp); - DevicePermissionStream stream = new DevicePermissionStream(); - stream.setDepartId(item.getDepartId()); - stream.setGroupId(deviceGroup.getGroupId()); - permissionStreamList.add(stream); - }); - if(!groupDepartList.isEmpty()) { - b = deviceGroupDepartService.saveBatch(groupDepartList); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); - } - if(!permissionStreamList.isEmpty()) { - b = devicePermissionStreamService.saveBatch(permissionStreamList); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); - } - } - DeviceGroupPermission permission = new DeviceGroupPermission(); - permission.setGroupId(deviceGroup.getGroupId()); - permission.setUserId(userId); - b = groupPermissionService.save(permission); - if(!b) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_SAVE_ERROR); - } - DevicePermissionStream stream = new DevicePermissionStream(); - stream.setGroupId(deviceGroup.getGroupId()); - stream.setUserId(userId); - if (StringUtils.isNotBlank(deviceGroup.getParentId())) { - String path = null; - List<String> strings = findListParentTree(deviceGroup.getParentId(),null); - if (strings != null && !strings.isEmpty()) { - path = StringUtils.join(strings.toArray(), "/"); - } - FileUtilS.saveFileFromPath(path + "/" + deviceGroup.getGroupName()); - } else { - FileUtilS.saveFileFromPath(deviceGroup.getGroupName()); - } - return devicePermissionStreamService.save(stream); - } - @Override - public DeviceGroup findByGroupName(String groupName) { - if(!ValidateUtil.validateString(groupName)) - return null; - List<DeviceGroup> list = super.lambdaQuery().eq(DeviceGroup::getGroupName, groupName).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean editDeviceGroup(String id, DeviceGroup deviceGroup) { - if(!ValidateUtil.validateString(id) || deviceGroup == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - DeviceGroup en = super.getById(id); - if(en == null) - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); - deviceGroup.setGroupId(id); - deviceGroup.setParentId(null); - deviceGroup.setRankLevel(null); - if (StringUtils.isNotBlank(en.getParentId())) { - String path = null; - List<String> strings = findListParentTree(en.getParentId(),null); - if (strings != null && !strings.isEmpty()) { - path = StringUtils.join(strings.toArray(), "/"); - } - FileUtilS.updateFileFromPath( path + "/"+ deviceGroup.getGroupName(), - path + "/"+ en.getGroupName()); - } else { - FileUtilS.updateFileFromPath(deviceGroup.getGroupName(),en.getGroupName()); - } - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(3); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍒嗙粍鍚嶇О锛�"+deviceGroup.getGroupName()); - //淇敼淇濆瓨澶囨敞 - ncLogInfo.setRemark(JSONObject.toJSONString(en)); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); - return super.updateById(deviceGroup); - } // 鏌ヨ鎵�浠ョ埗鑺傜偣 @Override public List<String> findListParentTree(String parentId,List<String> stringList){ @@ -200,44 +65,6 @@ } } return stringList; - } - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteDeviceGroup(String id) { - if(!ValidateUtil.validateString(id)) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - DeviceGroup en = super.getById(id); - if(en == null) - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); - List<DeviceGroup> childList = getChildrenByParentId(id); - if(childList != null && !childList.isEmpty()) - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_CHILD_EXIST); - List<DeviceInfo> deviceInfoList = deviceInfoService.getByGroupId(en.getGroupId()); - if(deviceInfoList != null && !deviceInfoList.isEmpty()) - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_DEVICE_EXIST); - boolean b = groupPermissionService.deleteByGroupId(en.getGroupId()); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); - b = deviceGroupDepartService.deleteByGroupId(en.getGroupId()); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); - b = devicePermissionStreamService.deleteUserByGroupId(en.getGroupId()); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); - b = devicePermissionStreamService.deleteDepartByGroupId(en.getGroupId()); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); - //鍒犻櫎瀵瑰簲鏂囦欢 - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(4); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍒嗙粍鍚嶇О锛�"+en.getGroupName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); - return super.removeById(en.getGroupId()); } @Override @@ -350,164 +177,6 @@ ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_USER_NONE); if(!permissionList.isEmpty()) { boolean b = groupPermissionService.removeByCollection(permissionList); - if(!b) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - } - if(!permissionStreamList.isEmpty()) { - boolean b = devicePermissionStreamService.removeByCollection(permissionStreamList); - if(!b) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - } - return true; - } - - @Override - public List<Department> getDepartPermsList(String groupId) { - return deviceGroupDepartService.getDepartPermsByGroupId(groupId); - } - - @Override - public List<Department> getDepartNonPermsList(String groupId) { - return deviceGroupDepartService.getDepartNonPermsByGroupId(groupId); - } - -// @Override -// @Transactional(rollbackFor = {Exception.class}) -// public boolean assignAddDepartment(String groupId, Integer relativeFlag, String[] departmentIds) { -// if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1) -// ExceptionCast.cast(CommonCode.INVALID_PARAM); -// List<String> ids = new ArrayList<>(departmentIds.length); -// Collections.addAll(ids, departmentIds); -// Collection<Department> departmentList = departmentService.listByIds(ids); -// if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length) -// ExceptionCast.cast(CommonCode.INVALID_PARAM); -// DeviceGroup deviceGroup = super.getById(groupId); -// if(deviceGroup == null) -// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); -// boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId()); -// if(!b1) { -// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); -// } -// b1 = assignAddDepartment(deviceGroup, departmentList); -// if(!b1) { -// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); -// } -// if(relativeFlag == 1) { -// //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� -// List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId()); -// if(childrenList != null && !childrenList.isEmpty()) { -// childrenList.forEach(item -> { -// boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId()); -// if(b) { -// b = assignAddDepartment(item, departmentList); -// if(!b) { -// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); -// } -// } -// }); -// } -// } -// return true; -// } -// -// @Override -// @Transactional(rollbackFor = {Exception.class}) -// public boolean assignRemoveDepartment(String groupId, Integer relativeFlag, String[] departmentIds) { -// if(!ValidateUtil.validateString(groupId) || !ValidateUtil.validateInteger(relativeFlag) || departmentIds == null || departmentIds.length < 1) -// ExceptionCast.cast(CommonCode.INVALID_PARAM); -// List<String> ids = new ArrayList<>(departmentIds.length); -// Collections.addAll(ids, departmentIds); -// Collection<Department> departmentList = departmentService.listByIds(ids); -// if(departmentList == null || departmentList.isEmpty() || departmentList.size() != departmentIds.length) -// ExceptionCast.cast(CommonCode.INVALID_PARAM); -// DeviceGroup deviceGroup = super.getById(groupId); -// if(deviceGroup == null) -// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_NOT_EXIST); -// boolean b1 = deviceInfoService.checkDevicePerm(1, deviceGroup.getGroupId()); -// if(!b1) { -// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); -// } -// b1 = assignRemoveDepartment(deviceGroup, departmentList); -// if(!b1) { -// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); -// } -// if(relativeFlag == 1) { -// //鑾峰彇鍒嗙粍涓嬫墍鏈夌殑瀛愬垎缁� -// List<DeviceGroup> childrenList = getChildrenByParentId(deviceGroup.getGroupId()); -// if(childrenList != null && !childrenList.isEmpty()) { -// childrenList.forEach(item -> { -// boolean b = deviceInfoService.checkDevicePerm(1, item.getGroupId()); -// if(b) { -// b = assignRemoveDepartment(item, departmentList); -// if(!b) { -// ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); -// } -// } -// }); -// } -// } -// return true; -// } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean assignAddDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList) { - if(deviceGroup == null || departmentList == null || departmentList.isEmpty()) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - List<DeviceGroupDepart> deviceGroupDepartList = new ArrayList<>(); - List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); - departmentList.forEach(item -> { - DeviceGroupDepart en = deviceGroupDepartService.getDepartByGroupAndDepartId(deviceGroup.getGroupId(), item.getDepartId()); - if(en == null) { - en = new DeviceGroupDepart(); - en.setDepartId(item.getDepartId()); - en.setGroupId(deviceGroup.getGroupId()); - deviceGroupDepartList.add(en); - } - DevicePermissionStream stream = devicePermissionStreamService.getByGroupIdAndDepartId(deviceGroup.getGroupId(), item.getDepartId()); - if(stream == null) { - stream = new DevicePermissionStream(); - stream.setDepartId(item.getDepartId()); - stream.setGroupId(deviceGroup.getGroupId()); - permissionStreamList.add(stream); - } - }); - if(!deviceGroupDepartList.isEmpty()) { - boolean b = deviceGroupDepartService.saveBatch(deviceGroupDepartList); - if(!b) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - } - if(!permissionStreamList.isEmpty()) { - boolean b = devicePermissionStreamService.saveBatch(permissionStreamList); - if(!b) { - ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); - } - } - return true; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean assignRemoveDepartment(DeviceGroup deviceGroup, Collection<Department> departmentList) { - if(deviceGroup == null || departmentList == null || departmentList.isEmpty()) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - List<DeviceGroupDepart> departList = new ArrayList<>(); - List<DevicePermissionStream> permissionStreamList = new ArrayList<>(); - departmentList.forEach(item -> { - DeviceGroupDepart en = deviceGroupDepartService.getDepartByGroupAndDepartId(deviceGroup.getGroupId(), item.getDepartId()); - if(en != null) { - departList.add(en); - } - DevicePermissionStream stream = devicePermissionStreamService.getByGroupIdAndDepartId(deviceGroup.getGroupId(), item.getDepartId()); - if(stream != null) { - permissionStreamList.add(stream); - } - }); - if(!departList.isEmpty()) { - boolean b = deviceGroupDepartService.removeByCollection(departList); if(!b) { ExceptionCast.cast(DeviceGroupCode.DEVICE_GROUP_PERM_ERROR); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java index 0a2e79f..4f6f295 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceInfoServiceImpl.java @@ -63,8 +63,6 @@ @Lazy private IProductInfoService productInfoService; @Autowired - private INcLogInfoService iNcLogInfoService; - @Autowired private IMdcProductionService mdcProductionService; @Autowired private IMdcEquipmentService mdcEquipmentService; @@ -100,15 +98,6 @@ if(group == null) { ExceptionCast.cast(DeviceCode.DEVICE_GROUP_NONE); } - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(2); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("璁惧鍚嶇О锛�"+deviceInfo.getDeviceName()+"锛岃澶囩紪鍙凤細"+deviceInfo.getDeviceNo()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); boolean b = super.save(deviceInfo); if(!b) { ExceptionCast.cast(DeviceCode.DEVICE_SAVE_ERROR); @@ -151,17 +140,6 @@ ExceptionCast.cast(DeviceCode.DEVICE_NOT_EXIST); deviceInfo.setDeviceId(id); deviceInfo.setGroupId(null); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(3); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("璁惧鍚嶇О锛�"+deviceInfo.getDeviceName()); - //淇敼淇濆瓨澶囨敞 - ncLogInfo.setRemark(JSONObject.toJSONString(en)); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.updateById(deviceInfo); } @@ -185,15 +163,6 @@ b = devicePermissionStreamService.deleteDepartByDeviceId(en.getGroupId(), en.getDeviceId()); if(!b) ExceptionCast.cast(CommonCode.FAIL); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(4); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("璁惧鍚嶇О锛�"+en.getDeviceName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.removeById(en.getDeviceId()); } @@ -369,6 +338,8 @@ @Override @Transactional(rollbackFor = {Exception.class}) public boolean assignAddUser(MdcEquipment mdcEquipment, Collection<SysUser> userList) { + + if(mdcEquipment == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); MdcProductionEquipment mdcProductionEquipment=mdcProductionEquipmentService @@ -387,7 +358,7 @@ if(stream == null) { stream = new DevicePermissionStream(); stream.setUserId(item.getId()); - stream.setGroupId(mdcProductionEquipment.getId()); + stream.setGroupId(mdcProductionEquipment.getProductionId()); stream.setDeviceId(mdcEquipment.getId()); permissionStreamList.add(stream); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java deleted file mode 100644 index c70aaea..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java +++ /dev/null @@ -1,289 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import cn.hutool.crypto.SmUtil; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.apache.commons.lang3.StringUtils; -import org.jeecg.common.system.vo.DictModel; -import org.jeecg.modules.dnc.dto.SysLogTypeObjectDto; -import org.jeecg.modules.dnc.entity.DncPassLog; -import org.jeecg.modules.dnc.mapper.DncPassLogMapper; -import org.jeecg.modules.dnc.response.SysLogMessageDto; -import org.jeecg.modules.dnc.utils.FileClient; -import org.jeecg.modules.dnc.utils.SyslogClient; -import org.jeecg.modules.dnc.utils.TelnetUtil; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.dnc.utils.date.DateUtil; -import org.jeecg.modules.system.service.ISysDictItemService; -import org.jeecg.modules.system.service.ISysDictService; -import org.jeecg.modules.dnc.service.IDncPassLogService; -import org.jeecg.modules.dnc.utils.file.FileUtilS; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.PropertySource; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Service; - -import java.io.File; -import java.io.IOException; -import java.net.InetAddress; -import java.net.UnknownHostException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.time.Duration; -import java.time.Instant; -import java.util.List; -import java.util.stream.Stream; - -/** - * @author clown - * * @date 2023/11/29 - */ -@Service -public class DncPassLogServiceImpl extends ServiceImpl<DncPassLogMapper, DncPassLog> implements IDncPassLogService { - - @Value("${securedoc.serverIp}") - private String serverIp; - @Value("${securedoc.serverPort}") - private String serverPort; - @Value("${securedoc.username}") - private String usernameService; - @Value("${securedoc.pwd}") - private String pwdService; - @Value("${securedoc.addressToken}") - private String addressToken; - @Value("${securedoc.addressUploadFile}") - private String addressUploadFile; - @Value("${securedoc.localFilePath}") - private String localFilePathC; - @Value("${securedoc.servicePath}") - private String servicePathS; - @Value("${securedoc.copyFilePath}") - private String newFilePathC; - @Value("${securedoc.logIp}") - private String logIp; - @Value("${securedoc.logPort}") - private String logPort; - @Autowired - private ISysDictService iSysDictService; - @Autowired - private ISysDictItemService iSysDictItemService; - - @Override - public DncPassLog findDayTime(String dateDay) { - if (!ValidateUtil.validateString(dateDay)) { - return null; - } - return super.baseMapper.findDateTimeDay(dateDay); - } - - @Override - @Scheduled(cron = "${fileCron}") - public void fileClientTxtOrNc() { - SysLogMessageDto message = new SysLogMessageDto(); - String host = "127.0.0.1"; - if (StringUtils.isNotBlank(serverIp)) { - host = serverIp; - } - String port = "8299"; - if (StringUtils.isNotBlank(serverPort)) { - port = serverPort; - } - String username = "admin"; - if (StringUtils.isNotBlank(usernameService)) { - username = usernameService; - } - String pwd = "123"; - if (StringUtils.isNotBlank(pwdService)) { - pwd = pwdService; - } - //鏂囦欢鏈湴鍦板潃锛屾牴鎹湴鍧�鎵惧埌鏂囦欢锛屽皢鏂囦欢瑙f瀽鎴愭枃浠舵祦 - String localFilePath = "/jar/test/a/"; -// String localFilePath = "E:\\test\\a\\"; - if (StringUtils.isNotBlank(localFilePathC)) { - localFilePath = localFilePathC; - } - //鏂囦欢涓婁紶鐩殑鍦板潃锛屽皢鏂囦欢涓婁紶鍒拌鍦板潃 - String servicePath = "/jar/test/b/"; -// String servicePath = "E:\\test\\b\\"; - if (StringUtils.isNotBlank(servicePathS)) { - servicePath = servicePathS; - } - boolean btelnetPort = TelnetUtil.telnetPort(serverIp,Integer.valueOf(serverPort),10); - if (!btelnetPort) { - System.out.println("鏈嶅姟鍣ㄨ繛鎺ワ細 " + serverIp + ":" + serverPort + " 寮傚父锛�" ); - return; - } - //绗竴姝ワ紝鑾峰彇token - String token = null; - try { - token = FileClient.getToken(host,port,username,pwd,addressToken); - } catch (Throwable throwable) { - throwable.printStackTrace(); - } - - //鑻ヨ幏鍙杢oken鎴愬姛锛屽啀杩涜涓婁紶鏂囦欢鎺ュ彛璋冪敤 - if (token !=null && !token.equals("")){ - try { - File f3 = new File(localFilePath); - File[] files = f3.listFiles(); - for (File fi : files){ - if (fi.isFile()){ - SysLogTypeObjectDto objectName = new SysLogTypeObjectDto(); - objectName.setDateTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_DATE_TIME_SMALL)); - objectName.setFileName(fi.getName()); - objectName.setFileSize(FileUtilS.changeFileFormatKb(String.valueOf(new File(localFilePath).length()))); - objectName.setSourceAddress(localFilePath); - objectName.setDestination(serverIp);//鏈嶅姟绔疘P - //椤哄簭鍙� - DncPassLog passLog = getById("num0001"); - if (passLog == null) { - passLog = new DncPassLog(); - passLog.setId("num0001"); - passLog.setSequenceNumber(1); - objectName.setFileNum(Integer.toString(1)); - save(passLog); - } else { - Integer number = passLog.getSequenceNumber()+1; - removeById("num0001"); - objectName.setFileNum(Integer.toString(number)); - - passLog = new DncPassLog(); - passLog.setId("num0001"); - passLog.setSequenceNumber(number); - save(passLog); - } - - InetAddress address = null; - try { - address = InetAddress.getLocalHost(); - String ip = address.getHostAddress(); - objectName.setSourceAddress("20.10.17.11");//瀹㈡埛绔疘P - objectName.setAddress(ip); - } catch (UnknownHostException e) { - objectName.setSourceAddress("127.0.0.1"); - objectName.setAddress("127.0.0.1"); - } - objectName.setDestination(host); - objectName.setResult("澶辫触"); - //鑾峰彇鏌愪釜鏂囦欢涓嬬殑鎵�鏈夋枃浠� - String loFilePath = localFilePath + fi.getName(); - String servicePathName =servicePath + fi.getName(); -// String loFilePath = localFilePath + "\\" + fi.getName(); -// String servicePathName =servicePath + "\\" + fi.getName(); - File file = new File(loFilePath); - if (file == null || !file.exists()){ - objectName.setAbstract1("sm3"); - } else { - String sm3 = SmUtil.sm3(file); - objectName.setAbstract1(sm3); - } - - String b = FileClient.uploadFile(host,port,token,fi.getName(),servicePathName,loFilePath,addressUploadFile); - //鏂囦欢澶囦唤鍒犻櫎 - if (b == null) { - try { - objectName.setResult("澶辫触"); - objectName.setTypes("error"); - SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString()); - }catch (Exception e) { - return; - } - } - else if ( b.equals("鎴愬姛")) { - //澶囦唤鏁版嵁 - boolean fCopy = FileUtilS.copyNcFile(loFilePath,newFilePathC + "/" + DateUtil.format(DateUtil.getNow(), - DateUtil.STR_YEARMONTHDAY) + "/" +fi.getName()); - if (fCopy) { - FileUtilS.deleteNcFile(loFilePath); - } else { - FileUtilS.copyNcFile(loFilePath,newFilePathC + "/" + DateUtil.format(DateUtil.getNow(), - DateUtil.STR_YEARMONTHDAY) + "/" +fi.getName()); - FileUtilS.deleteNcFile(loFilePath); - } - try { - objectName.setTypes("Info"); - objectName.setResult("鎴愬姛"); - SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString()); - }catch (Exception e) { - return; - } - } else { - try { - objectName.setResult("澶辫触"); - objectName.setTypes("error"); - SyslogClient.sendClient(logIp,Integer.valueOf(logPort),objectName.toString()); - }catch (Exception e) { - return; - } - } - } - } - - } catch (Throwable throwable) { - throwable.printStackTrace(); - } - } - } - - /** - * 瀹氭椂浠诲姟鎵ц鍣ㄥ弬鏁� 姣忓ぉ鍑屾櫒1.30鎵ц - */ - @Override -// @Scheduled(cron = "0 30 1 * * ?") - public void deleteNcSendFile() { - Integer day; - //鍙栧瓧鍏告椂闂� - List<DictModel> singleDictionaries=iSysDictService.queryDictItemsByCode("DEL_TIME_SEND"); - if (singleDictionaries.size()!=1){ - return; - }else { - day= Integer.valueOf(singleDictionaries.get(0).getValue()); - } - Path ncDirectory = Paths.get("jar/NC"); - //澶╄浆绉� - long dayToSecond = day * 24 * 60 * 60; - if (Files.exists(ncDirectory) && Files.isDirectory(ncDirectory)) { - // 閫掑綊鏌ユ壘NC鐩綍涓嬫墍鏈夊悕涓簊end鐨勬枃浠跺す - try (Stream<Path> sendFolders = Files.walk(ncDirectory) - .filter(Files::isDirectory) - .filter(path -> path.getFileName().toString().equalsIgnoreCase("send"))) { - sendFolders.forEach(sendFolder -> { - try { - // 鑾峰彇褰撳墠鏃堕棿 - Instant now = Instant.now(); - // 閬嶅巻SEND鏂囦欢澶瑰唴鐨勬墍鏈夋枃浠� - Files.walk(sendFolder) - .filter(Files::isRegularFile) - .forEach(file -> { - try { - // 鑾峰彇鏂囦欢鐨勬渶鍚庝慨鏀规椂闂� - Instant lastModified = Files.getLastModifiedTime(file).toInstant(); - // 璁$畻鏃堕棿宸� - Duration duration = Duration.between(lastModified, now); - // 鍒ゆ柇鏄惁瓒呮椂锛堟椂闂村瓨鍦ㄥ瓧鍏镐腑锛宐ase_single_dictionary锛� - if (duration.getSeconds() > dayToSecond) { - try { - Files.delete(file); - System.out.println("宸插垹闄ゆ枃浠�: " + file); - } catch (IOException e) { - System.err.println("鍒犻櫎鏂囦欢 " + file + " 鏃跺嚭鐜伴敊璇�: " + e.getMessage()); - } - } - } catch (IOException e) { - System.err.println("鑾峰彇鏂囦欢 " + file + " 鐨勬渶鍚庝慨鏀规椂闂存椂鍑虹幇閿欒: " + e.getMessage()); - } - }); - } catch (IOException e) { - System.err.println("閬嶅巻 " + sendFolder + " 鏂囦欢澶规椂鍑虹幇閿欒: " + e.getMessage()); - } - }); - } catch (IOException e) { - System.err.println("鏌ユ壘send鏂囦欢澶规椂鍑虹幇閿欒: " + e.getMessage()); - } - } else { - System.err.println("jar鐨凬C鐩綍涓嶅瓨鍦ㄦ垨涓嶆槸鏈夋晥鐨勭洰褰�"); - } - } - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java index d80aefb..809ae76 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java @@ -59,8 +59,7 @@ private IDeviceInfoService deviceInfoService; @Autowired private IDeviceGroupService deviceGroupService; - @Autowired - private INcLogInfoService iNcLogInfoService; + /*澶囦唤澶勭悊*/ @Override @@ -140,15 +139,6 @@ } } - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("瀵煎叆"+docClass.getClassificationName()+"锛屾枃妗e悕绉�:"+(docFile.getFileName()+"."+docFile.getFileSuffix())); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); boolean saveBool = super.save(docInfo); return saveBool; } @@ -304,17 +294,6 @@ docInfo.setClassificationId(null); docInfo.setPublishFileId(null); docInfo.setPublishVersion(null); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(3); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鏂囨。鍚嶇О锛�"+docInfo.getDocName()); - //淇敼淇濆瓨澶囨敞 - ncLogInfo.setRemark(JSONObject.toJSONString(en)); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.updateById(docInfo); } @@ -337,15 +316,6 @@ b = docRelativeService.deleteByDocId(id); if(!b) ExceptionCast.cast(CommonCode.FAIL); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("浜у搧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(4); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鏂囨。鍚嶇О锛�"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.removeById(id); } @@ -384,16 +354,6 @@ docFile.setFilePath(fileUploadResult.getFilePath()); docFile.setFileSize(fileUploadResult.getFileSize()); docFile.setFileSuffix(fileUploadResult.getFileSuffix()); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍏ュ簱"+docFile.getFileSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+docFile.getFileName()); - ncLogInfo.setRemark(JSONObject.toJSONString(en)); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); boolean b = fileOperateService.deleteByDocId(id); if(!b) ExceptionCast.cast(CommonCode.FAIL); @@ -452,15 +412,6 @@ DocFile old = docFileService.getDocFileNearest(en.getDocId()); if(old == null) ExceptionCast.cast(DocumentCode.DOC_PUBLISH_FILE_NONE); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍙戝竷"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); if(old.getDocVersion().contains(".")) { DocFile docFile = new DocFile(); BeanUtils.copyProperties(pubFile, docFile); @@ -487,15 +438,6 @@ ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); if(en.getDocStatus() != 2) ExceptionCast.cast(DocumentCode.DOC_REPUBLISH_ERROR); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("閲嶆柊鍙戝竷"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 1).update(); } @@ -512,15 +454,6 @@ FileOperate operate = fileOperateService.getByDocId(id); if(operate != null) ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("褰掓。"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return super.lambdaUpdate().eq(DocInfo::getDocId, id).set(DocInfo::getDocStatus, 3).update(); } @@ -538,15 +471,6 @@ DocInfo en = super.getById(id); if(en == null) ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍙栨秷鍑哄簱"+en.getDocSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+en.getDocName()); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return fileOperateService.deleteByDocId(id); } @@ -757,15 +681,6 @@ String filePath = docFile.getFilePath(); String fileEncodeName = docFile.getFileEncodeName(); FileUtilS.downLoadFile(response, fileEncodeName, filePath, fileName); - //娣诲姞鏃ュ織 - NcLogInfo ncLogInfo = new NcLogInfo(); - //妯″潡 - ncLogInfo.setModuleInfo("璁惧缁撴瀯鏍�"); - //绫诲瀷 - ncLogInfo.setOperateType(7); - //鏃ュ織鍐呭 - ncLogInfo.setLogContent("鍑哄簱"+docFile.getFileSuffix()+"鏍煎紡鏂囨。锛屾枃妗e悕绉�:"+fileName); - iNcLogInfoService.saveLogNcInfos(ncLogInfo); return null; } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java index 3322582..b53fc4a 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java @@ -3,8 +3,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.entity.DeviceInfo; -import org.jeecg.modules.dnc.entity.DncPassLog; import org.jeecg.modules.dnc.entity.DocInfo; import org.jeecg.modules.dnc.entity.DocRelative; import org.jeecg.modules.dnc.exception.ExceptionCast; @@ -40,8 +38,6 @@ private IDeviceGroupService deviceGroupService; @Value("${securedoc.localFilePath}") private String localFilePath; - @Autowired - private IDncPassLogService dncPassLogService; @Autowired private IMdcEquipmentService iMdcEquipmentService; @Autowired @@ -97,30 +93,12 @@ if (!deleteFile) { return false; } - DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)); - Integer fileTxt = 0, fileNc =0; - if (dncPassLog !=null) { - fileTxt = dncPassLog.getSequenceNumber() + 1; - fileNc = fileTxt + 1; - } else { - fileTxt = 1; - fileNc = fileTxt + 1; - } - String sequence = String.format("%06d",fileTxt); - DncPassLog passInfoNc = new DncPassLog(); - passInfoNc.setSequenceNumber(fileNc); - passInfoNc.setSequenceOrder(sequence); - passInfoNc.setDayTime(DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)); - passInfoNc.setPassType("02"); - passInfoNc.setPassName(info.getDocName()+"."+info.getDocSuffix()); - passInfoNc.setCreateTime(DateUtil.getNow()); - dncPassLogService.save(passInfoNc); //澶勭悊鏂囦欢鍚嶇О 鏂囦欢璺緞 NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); ncTxt.setEquipmentId(mdcEquipment.getEquipmentId()); ncTxt.setFilePath(path + "/"+ mdcEquipment.getEquipmentId() + "/" ); - ncTxt.setFileTxtName("02A"+DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)+sequence); + ncTxt.setFileTxtName("02A"+DateUtil.format(DateUtil.getNow(),DateUtil.STR_YEARMONTHDAY)); ncTxt.setOrigFileName(info.getDocName()); ncTxt.setOrigFileSuffix(info.getDocSuffix()); ncTxt.setFileAddOrDelete(2); diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java deleted file mode 100644 index d108d35..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.entity.MenuButton; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.mapper.MenuButtonMapper; -import org.jeecg.modules.dnc.response.MenuCode; -import org.jeecg.modules.dnc.service.IMenuButtonService; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class MenuButtonServiceImpl extends ServiceImpl<MenuButtonMapper, MenuButton> implements IMenuButtonService { - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteByMenuId(String menuId) { - if(!ValidateUtil.validateString(menuId)) - ExceptionCast.cast(MenuCode.MENU_ID_NONE); - LambdaQueryWrapper<MenuButton> lambdaUpdate = Wrappers.lambdaQuery(); - lambdaUpdate.eq(MenuButton::getMenuId, menuId); - return super.remove(lambdaUpdate); - } - - @Override - public Map<String, MenuButton> getMapByMenuId(String menuId) { - if(!ValidateUtil.validateString(menuId)) - return null; - List<MenuButton> list = super.lambdaQuery().eq(MenuButton::getMenuId, menuId).list(); - if(list == null || list.isEmpty()) - return null; - Map<String, MenuButton> map = new HashMap<>(); - list.forEach(item -> { - map.put(item.getButtonId(), item); - }); - return map; - } - - @Override - public List<MenuButton> findByButtonId(String buttonId) { - return super.lambdaQuery().eq(MenuButton::getButtonId, buttonId).list(); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java deleted file mode 100644 index d2bb3e3..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java +++ /dev/null @@ -1,148 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.apache.shiro.SecurityUtils; -import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.common.util.IpUtils; -import org.jeecg.common.util.SpringContextUtils; -import org.jeecg.modules.dnc.entity.NcLogInfo; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.mapper.NcLogInfoMapper; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.system.entity.SysUser; -import org.jeecg.modules.system.service.ISysDictService; -import org.jeecg.modules.system.service.ISysUserService; -import org.jeecgframework.poi.excel.def.NormalExcelConstants; -import org.jeecgframework.poi.excel.entity.ExportParams; -import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; -import org.jeecg.modules.dnc.request.NcLogInfoRequest; -import org.jeecg.modules.dnc.service.INcLogInfoService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.web.servlet.ModelAndView; - -import javax.servlet.http.HttpServletRequest; -import java.util.List; - -/** - * @author clown - * * @date 2023/12/4 - */ -@Service -public class NcLogInfoServiceImpl extends ServiceImpl<NcLogInfoMapper, NcLogInfo> implements INcLogInfoService { - - @Autowired - private ISysUserService userService; - - @Autowired - private ISysDictService iSysDictService; - - @Override - public QueryPageResponseResult<NcLogInfo> findByPageList(int page, int size, NcLogInfoRequest requestParams) { - if(page < 1 || size < 1) { - ExceptionCast.cast(CommonCode.INVALID_PAGE); - } - IPage<NcLogInfo> pageData = new Page<>(page, size); - QueryWrapper<NcLogInfo> queryWrapper=new QueryWrapper<>(); - if(requestParams != null) { - queryWrapper.eq(StrUtil.isNotEmpty(requestParams.getUsername()),"user_mame",requestParams.getOperateType()); - if(requestParams.getOperateType() != null) { - queryWrapper.eq("operate_type", requestParams.getOperateType()); - } - queryWrapper.like(StrUtil.isNotEmpty(requestParams.getLogContent()),"log_content",requestParams.getLogContent()); - queryWrapper.ge(StrUtil.isNotEmpty(requestParams.getStartTime()),"create_time",requestParams.getStartTime()); - queryWrapper.le(StrUtil.isNotEmpty(requestParams.getEndTime()),"create_time",requestParams.getEndTime()); - } - queryWrapper.orderByDesc("create_time"); - IPage<NcLogInfo> userIPage = this.page(pageData, queryWrapper); - /*if (userIPage != null && userIPage.getRecords() != null && !userIPage.getRecords().isEmpty()) { - for (NcLogInfo nc : userIPage.getRecords()) { - User user = userService.getById(nc.getCreateBy()); - if (user != null) { - nc.setNickname(user.getNickname()); - nc.setUsername(user.getUsername()); - } - } - }*/ - return new QueryPageResponseResult<>(CommonCode.SUCCESS, userIPage); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean saveLogNcInfos(NcLogInfo logInfo) { - HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); - //璁剧疆IP鍦板潃 - logInfo.setIp(IpUtils.getIpAddr(request)); - super.save(logInfo); - SysUser user = userService.getById(logInfo.getCreateBy()); - if (user != null) { - logInfo.setNickName(user.getRealname()); - logInfo.setUserName(user.getUsername()); - } - super.saveOrUpdate(logInfo); - return true; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean saveLogInfo(String moduleInfo, Integer operateType, String logContent) { - HttpServletRequest request = SpringContextUtils.getHttpServletRequest(); - NcLogInfo logInfo = new NcLogInfo(); - logInfo.setModuleInfo(moduleInfo); - logInfo.setOperateType(operateType); - logInfo.setLogContent(logContent); - //璁剧疆IP鍦板潃 - logInfo.setIp(IpUtils.getIpAddr(request)); - super.save(logInfo); - SysUser user = userService.getById(logInfo.getCreateBy()); - if (user != null) { - logInfo.setNickName(user.getRealname()); - logInfo.setUserName(user.getUsername()); - } - super.saveOrUpdate(logInfo); - return true; - } - - /** - * 瀵煎嚭鏌ヨList - * @param requestParams - * @return - */ - @Override - @Transactional - public ModelAndView exportLogList(NcLogInfoRequest requestParams){ - QueryWrapper<NcLogInfo> queryWrapper=new QueryWrapper<>(); - if(requestParams != null) { - queryWrapper.eq(StrUtil.isNotEmpty(requestParams.getUsername()),"user_mame",requestParams.getOperateType()); - if(requestParams.getOperateType() != null) { - queryWrapper.eq("operate_type", requestParams.getOperateType()); - } - queryWrapper.like(StrUtil.isNotEmpty(requestParams.getLogContent()),"log_content",requestParams.getLogContent()); - queryWrapper.ge(StrUtil.isNotEmpty(requestParams.getStartTime()),"create_time",requestParams.getStartTime()); - queryWrapper.le(StrUtil.isNotEmpty(requestParams.getEndTime()),"create_time",requestParams.getEndTime()); - } - queryWrapper.orderByDesc("create_time"); - List<NcLogInfo> ncLogInfoList=this.list(queryWrapper); - ncLogInfoList.forEach(item->{ - //缈昏瘧鐢ㄦ埛鍚嶃�佹搷浣滅被鍨� - item.setOperateTypeStr(iSysDictService.queryDictTextByKey("OPERATE_TYPE",item.getOperateType().toString())); - item.setCreateBy(userService.getById(item.getCreateBy()).getRealname()); - }); - LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); - String userId = user.getId(); - ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); - mv.addObject(NormalExcelConstants.FILE_NAME, "DNC鏃ュ織绠$悊"); - mv.addObject(NormalExcelConstants.CLASS, NcLogInfo.class); - ExportParams exportParams = new ExportParams("DNC鏃ュ織绠$悊" + "鎶ヨ〃", "瀵煎嚭浜�:" + userService.getById(userId).getRealname(), "DNC鏃ュ織绠$悊"); - mv.addObject(NormalExcelConstants.PARAMS, exportParams); - mv.addObject(NormalExcelConstants.DATA_LIST, ncLogInfoList); - return mv; - } - -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java deleted file mode 100644 index 448765b..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.entity.ObjectButtonPermission; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.service.IObjectButtonPermissionService; -import org.jeecg.modules.dnc.mapper.ObjectButtonPermissionMapper; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.dnc.response.RoleCode; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class ObjectButtonPermissionServiceImpl extends ServiceImpl<ObjectButtonPermissionMapper, ObjectButtonPermission> implements IObjectButtonPermissionService { - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteByRoleId(String roleId) { - if(!ValidateUtil.validateString(roleId)) - ExceptionCast.cast(RoleCode.ROLE_ID_NONE); - LambdaQueryWrapper<ObjectButtonPermission> lambdaUpdate = Wrappers.lambdaQuery(); - lambdaUpdate.eq(ObjectButtonPermission::getRoleId, roleId); - return super.remove(lambdaUpdate); - } - - @Override - public Map<String, ObjectButtonPermission> getMapByRoleId(String roleId) { - if(!ValidateUtil.validateString(roleId)) - return null; - List<ObjectButtonPermission> list = super.lambdaQuery().eq(ObjectButtonPermission::getRoleId, roleId).list(); - if(list == null || list.isEmpty()) - return null; - Map<String, ObjectButtonPermission> map = new HashMap<>(); - list.forEach(item -> { - map.put(item.getObjectId() + "_" + item.getButtonId(), item); - }); - return map; - } - - @Override - public List<ObjectButtonPermission> findByObjectId(String objId) { - return super.lambdaQuery().eq(ObjectButtonPermission::getObjectId, objId).list(); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java deleted file mode 100644 index c2d2f10..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.entity.ObjectButton; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.response.ObjectCode; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.dnc.mapper.ObjectButtonMapper; -import org.jeecg.modules.dnc.service.IObjectButtonService; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -@Service -public class ObjectButtonServiceImpl extends ServiceImpl<ObjectButtonMapper, ObjectButton> implements IObjectButtonService { - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteByObjectId(String objectId) { - if(!ValidateUtil.validateString(objectId)) - ExceptionCast.cast(ObjectCode.OBJ_ID_NONE); - LambdaQueryWrapper<ObjectButton> lambdaUpdate = Wrappers.lambdaQuery(); - lambdaUpdate.eq(ObjectButton::getObjectId, objectId); - return super.remove(lambdaUpdate); - } - - @Override - public Map<String, ObjectButton> getMapByObjectId(String objectId) { - if(!ValidateUtil.validateString(objectId)) - return null; - List<ObjectButton> list = super.lambdaQuery().eq(ObjectButton::getObjectId, objectId).list(); - if(list == null || list.isEmpty()) - return null; - Map<String, ObjectButton> map = new HashMap<>(); - list.forEach(item -> { - map.put(item.getButtonId(), item); - }); - return map; - } - - @Override - public List<ObjectButton> findByButtonId(String id) { - return super.lambdaQuery().eq(ObjectButton::getButtonId,id).list(); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectServiceImpl.java deleted file mode 100644 index dfa4bf2..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectServiceImpl.java +++ /dev/null @@ -1,158 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.jeecg.modules.dnc.entity.Button; -import org.jeecg.modules.dnc.entity.ObjectBase; -import org.jeecg.modules.dnc.entity.ObjectButton; -import org.jeecg.modules.dnc.entity.ObjectButtonPermission; -import org.jeecg.modules.dnc.exception.ExceptionCast; -import org.jeecg.modules.dnc.mapper.DncObjectMapper; -import org.jeecg.modules.dnc.request.ObjectBaseRequest; -import org.jeecg.modules.dnc.response.CommonCode; -import org.jeecg.modules.dnc.response.ObjectCode; -import org.jeecg.modules.dnc.response.QueryPageResponseResult; -import org.jeecg.modules.dnc.service.IButtonService; -import org.jeecg.modules.dnc.service.IObjectButtonPermissionService; -import org.jeecg.modules.dnc.service.IObjectButtonService; -import org.jeecg.modules.dnc.service.IObjectService; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -@Service -public class ObjectServiceImpl extends ServiceImpl<DncObjectMapper, ObjectBase> implements IObjectService { - @Autowired - private IObjectButtonService objectButtonService; - @Autowired - private IButtonService buttonService; - @Autowired - private IObjectButtonPermissionService objectButtonPermissionService; - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean addObject(ObjectBase objectBase) { - if(objectBase == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(!ValidateUtil.validateString(objectBase.getObjectPerm())) - ExceptionCast.cast(ObjectCode.OBJ_PERM_CODE_NONE); - if(!ValidateUtil.validateString(objectBase.getObjectName())) - ExceptionCast.cast(ObjectCode.OBJ_NAME_NONE); - ObjectBase en = getByPermCode(objectBase.getObjectPerm()); - if(en != null) - ExceptionCast.cast(ObjectCode.OBJ_PERM_CODE_EXIST); - return super.save(objectBase); - } - - @Override - public ObjectBase getByPermCode(String permCode) { - if(!ValidateUtil.validateString(permCode)) - return null; - List<ObjectBase> list = super.lambdaQuery().eq(ObjectBase::getObjectPerm, permCode).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean assignButton(String objectId, List<Button> buttonList) { - if(!ValidateUtil.validateString(objectId)) - ExceptionCast.cast(ObjectCode.OBJ_ID_NONE); - ObjectBase objectBase = super.getById(objectId); - if(objectBase == null) - ExceptionCast.cast(ObjectCode.OBJ_NOT_EXIST); - boolean b = objectButtonService.deleteByObjectId(objectId); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); - if(buttonList != null && !buttonList.isEmpty()) { - List<ObjectButton> objButtons = new ArrayList<>(); - List<String> ids = new ArrayList<>(); - buttonList.forEach(item -> { - final ObjectButton en = new ObjectButton(); - en.setObjectId(objectBase.getObjectId()); - en.setButtonId(item.getButtonId()); - en.setButtonUrl(item.getButtonUrl()); - if(ValidateUtil.validateString(item.getButtonAlias())) { - en.setButtonAlias(item.getButtonAlias()); - }else { - en.setButtonAlias(item.getButtonName()); - } - en.setPermCode(objectBase.getObjectPerm() + "_" + item.getButtonPerm()); - objButtons.add(en); - ids.add(item.getButtonId()); - }); - Collection<Button> buttons = buttonService.listByIds(ids); - if(buttons == null || buttons.isEmpty() || buttons.size() != buttonList.size()) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(!objButtons.isEmpty()) - return objectButtonService.saveBatch(objButtons); - } - return b; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean editObject(String id, ObjectBase objectBase) { - if(!ValidateUtil.validateString(id) || objectBase == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - ObjectBase en = super.getById(id); - if (en == null) { - ExceptionCast.cast(ObjectCode.OBJ_ID_NOT_EXIST); - } - objectBase.setObjectId(id); - objectBase.setObjectPerm(null); - return super.updateById(objectBase); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteObjectById(String id) { - if(!ValidateUtil.validateString(id)) { - ExceptionCast.cast(CommonCode.INVALID_PARAM); - } - ObjectBase en = super.getById(id); - if (en == null) - ExceptionCast.cast(ObjectCode.OBJ_ID_NOT_EXIST); - List<ObjectButtonPermission> objectButtonPermissions = objectButtonPermissionService.findByObjectId(id); - if(objectButtonPermissions != null && !objectButtonPermissions.isEmpty()) - ExceptionCast.cast(ObjectCode.OBJ_ROLE_EXIST); - boolean b = objectButtonService.deleteByObjectId(id); - if(!b) - ExceptionCast.cast(CommonCode.FAIL); - return super.removeById(id); - } - - @Override - public QueryPageResponseResult<ObjectBase> findPageList(int page, int size, ObjectBaseRequest buttonRequest) { - if(page < 1 || size < 1) { - ExceptionCast.cast(CommonCode.INVALID_PAGE); - } - IPage<ObjectBase> pageData = new Page<>(page, size); - LambdaQueryChainWrapper<ObjectBase> lambdaQuery = super.lambdaQuery(); - if(buttonRequest != null) { - if(ValidateUtil.validateString(buttonRequest.getObjectName())) { - lambdaQuery.eq(ObjectBase::getObjectName, buttonRequest.getObjectName()); - } - if(ValidateUtil.validateString(buttonRequest.getObjectPerm())) { - lambdaQuery.like(ObjectBase::getObjectPerm, buttonRequest.getObjectPerm()); - } - if(ValidateUtil.validateString(buttonRequest.getAscStr())) { - String[] ascArr = buttonRequest.getAscStr().split(","); -// ((Page<ObjectBase>) pageData).setAsc(ascArr); - } - if(ValidateUtil.validateString(buttonRequest.getDescStr())) { - String[] descStr = buttonRequest.getDescStr().split(","); -// ((Page<ObjectBase>) pageData).setDesc(descStr); - } - } - IPage<ObjectBase> userIPage = lambdaQuery.page(pageData); - return new QueryPageResponseResult<>(CommonCode.SUCCESS, userIPage); - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java index 8cee5f7..b5d9480 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java @@ -45,16 +45,11 @@ @Autowired private IPartsPermissionService partsPermissionService; @Autowired - private IPermissionStreamService permissionStreamService; + private IPermissionStreamNewService permissionStreamNewService; @Autowired private IPartsDepartmentService partsDepartmentService; @Autowired - @Lazy - private IProcessStreamService processStreamService; - @Autowired - private IDocInfoService docInfoService; - @Autowired - private INcLogInfoService iNcLogInfoService; + private IProcessSpecVersionService processSpecVersionService; @Autowired private IDocRelativeService iDocRelativeService; @Autowired @@ -87,20 +82,19 @@ ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE); partsInfo.setPartsStatus(1); boolean b = super.save(partsInfo); - List<PermissionStream> oldDepartPermList = permissionStreamService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); + List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1"); if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { List<PartsDepartment> partsDepartmentList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); oldDepartPermList.forEach(item -> { PartsDepartment pd = new PartsDepartment(); pd.setDepartId(item.getDepartId()); pd.setPartsId(partsInfo.getPartsId()); partsDepartmentList.add(pd); - PermissionStream perm = new PermissionStream(); + PermissionStreamNew perm = new PermissionStreamNew(); perm.setDepartId(item.getDepartId()); - perm.setProductId(partsInfo.getProductId()); - perm.setComponentId(partsInfo.getComponentId()); - perm.setPartsId(partsInfo.getPartsId()); + perm.setBusinessId(partsInfo.getPartsId()); + perm.setBusinessType("3"); permissionStreamList.add(perm); }); if(!partsDepartmentList.isEmpty()) { @@ -109,7 +103,7 @@ ExceptionCast.cast(CommonCode.FAIL); } if(!permissionStreamList.isEmpty()) { - b = permissionStreamService.saveBatch(permissionStreamList); + b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) ExceptionCast.cast(CommonCode.FAIL); } @@ -121,12 +115,11 @@ ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } //娣诲姞鐢ㄦ埛鏉冮檺 - PermissionStream stream = new PermissionStream(); - stream.setProductId(partsInfo.getProductId()); - stream.setComponentId(partsInfo.getComponentId()); - stream.setPartsId(partsInfo.getPartsId()); + PermissionStreamNew stream = new PermissionStreamNew(); + stream.setBusinessId(partsInfo.getPartsId()); + stream.setBusinessType("3"); stream.setUserId(userId); - return permissionStreamService.save(stream); + return permissionStreamNewService.save(stream); } @Override @@ -157,14 +150,13 @@ if(!b) return false; } - PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(en.getProductId(), en.getComponentId(), id, userId); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId( id, userId,"3"); if(stream == null) { - stream = new PermissionStream(); - stream.setProductId(en.getProductId()); - stream.setComponentId(en.getComponentId()); - stream.setPartsId(id); + stream = new PermissionStreamNew(); + stream.setBusinessId(id); + stream.setBusinessType("3"); stream.setUserId(userId); - return permissionStreamService.save(stream); + return permissionStreamNewService.save(stream); } return b; } @@ -220,10 +212,10 @@ b = partsDepartmentService.deleteByPartsId(item.getPartsId()); if(!b) ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); - b = permissionStreamService.deleteUserPermsByPartsId(item.getProductId(), item.getComponentId(), item.getPartsId()); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),"3","0"); if(!b) ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); - b = permissionStreamService.deleteDepartPermsByPartsId(item.getProductId(), item.getComponentId(), item.getPartsId()); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),"3","1"); if(!b) ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); b = super.removeById(item.getPartsId()); @@ -241,8 +233,8 @@ PartsInfo partsInfo = super.getById(partsId); if(partsInfo == null) ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); - List<ProcessStream> processStreams = processStreamService.findByPartsId(partsId); - if(processStreams != null && !processStreams.isEmpty()) + List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByPartsId(partsId); + if(processSpecVersions != null && !processSpecVersions.isEmpty()) ExceptionCast.cast(PartsInfoCode.PARTS_PROCESS_EXIST); boolean b = partsPermissionService.deleteByPartsId(partsInfo.getPartsId()); //楠岃瘉鏄惁瀛樺湪鏂囨。 @@ -255,10 +247,10 @@ b = partsDepartmentService.deleteByPartsId(partsInfo.getPartsId()); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamService.deleteUserPermsByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId()); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,"3","0"); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamService.deleteDepartPermsByPartsId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId()); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,"3","1"); if(!b) ExceptionCast.cast(CommonCode.FAIL); return super.removeById(partsInfo.getPartsId()); @@ -270,7 +262,7 @@ if(partsInfo == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<PartsPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { PartsPermission en = partsPermissionService.getByPartsIdAndUserId(partsInfo.getPartsId(), item.getId()); if(en == null) { @@ -279,13 +271,12 @@ en.setPartsId(partsInfo.getPartsId()); permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),"3"); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setUserId(item.getId()); - stream.setProductId(partsInfo.getProductId()); - stream.setComponentId(partsInfo.getComponentId()); - stream.setPartsId(partsInfo.getPartsId()); + stream.setBusinessId(partsInfo.getPartsId()); + stream.setBusinessType("3"); permissionStreamList.add(stream); } }); @@ -296,7 +287,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -310,21 +301,18 @@ if(partsInfo == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<PartsPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { PartsPermission en = partsPermissionService.getByPartsIdAndUserId(partsInfo.getPartsId(), item.getId()); if(en != null) { permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),"3"); if(stream != null) { permissionStreamList.add(stream); } }); //娓呯┖鐢ㄦ埛鏉冮檺鏍¢獙 - /*List<PartsPermission> exitsList = partsPermissionService.getByPartsId(partsInfo.getPartsId()); - if(exitsList.size() <= permissionList.size()) - ExceptionCast.cast(PartsInfoCode.PARTS_USER_NONE);*/ if(!permissionList.isEmpty()) { boolean b = partsPermissionService.removeByCollection(permissionList); if(!b) { @@ -332,7 +320,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -346,7 +334,7 @@ if(partsInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<PartsDepartment> partsDepartments = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId()); if(en == null) { @@ -355,14 +343,12 @@ en.setPartsId(partsInfo.getPartsId()); partsDepartments.add(en); } - PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), - partsInfo.getPartsId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),"3"); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); - stream.setProductId(partsInfo.getProductId()); - stream.setComponentId(partsInfo.getComponentId()); - stream.setPartsId(partsInfo.getPartsId()); + stream.setBusinessId(partsInfo.getPartsId()); + stream.setBusinessType("3"); permissionStreamList.add(stream); } }); @@ -373,7 +359,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -387,14 +373,13 @@ if(partsInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<PartsDepartment> partsDepartments = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId()); if(en != null) { partsDepartments.add(en); } - PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), - partsInfo.getPartsId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),"3"); if(stream != null) { permissionStreamList.add(stream); } @@ -406,7 +391,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamNewServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamNewServiceImpl.java new file mode 100644 index 0000000..87c16f7 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamNewServiceImpl.java @@ -0,0 +1,227 @@ +package org.jeecg.modules.dnc.service.impl; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.collections4.ListUtils; +import org.jeecg.modules.dnc.entity.PermissionStream; +import org.jeecg.modules.dnc.entity.PermissionStreamNew; +import org.jeecg.modules.dnc.entity.ProductMix; +import org.jeecg.modules.dnc.mapper.PermissionStreamNewMapper; +import org.jeecg.modules.dnc.service.IPermissionStreamNewService; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class PermissionStreamNewServiceImpl extends ServiceImpl<PermissionStreamNewMapper, PermissionStreamNew> implements IPermissionStreamNewService { + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇缁撴瀯鏍戞潈闄� + * @param userId + * @return + */ + @Override + public List<ProductMix> loadProductMix(String userId){ + return baseMapper.loadProductMix(userId); + } + + /** + * 閫氳繃涓氬姟id鍜屼笟鍔$被鍨嬭幏鍙栨潈闄� + * @param businessId + * @param businessType + * @return + */ + @Override + public List<PermissionStreamNew> loadPermissionStreamNewByBusinessId(String businessId,String businessType,String type){ + QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId); + queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType); + //鐢ㄦ埛鏉冮檺锛岄儴闂ㄥ瓧娈典负绌� + if("0".equals(type)) { + queryWrapper.isNotNull("user_id"); + }else if("1".equals(type)){ + queryWrapper.isNull("user_id"); + } + queryWrapper.eq("delete_flag",0); + return baseMapper.selectList(queryWrapper); + } + + /** + * 閫氳繃涓氬姟id鍜岀敤鎴穒d鑾峰彇鏉冮檺 + * @param businessId + * @param userId + * @return + */ + @Override + public PermissionStreamNew loadPermissionStreamNewByBusinessIdAndUserId(String businessId, String userId,String businessType){ + QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId); + queryWrapper.eq(StrUtil.isNotEmpty(userId),"user_id",userId); + queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType); + queryWrapper.eq("delete_flag",0); + queryWrapper.isNull("depart_id"); + return baseMapper.selectOne(queryWrapper); + } + + /** + * 閫氳繃涓氬姟id鍜屼笟鍔$被鍨嬪拰閮ㄩ棬id鑾峰彇閮ㄩ棬鏉冮檺 + * @param businessId + * @param businessType + * @param departId + * @return + */ + @Override + public PermissionStreamNew loadPermissionStreamNewByBusinessIdAndDepartId(String businessId, String departId,String businessType){ + QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId); + queryWrapper.eq(StrUtil.isNotEmpty(departId),"depart_id",departId); + queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType); + queryWrapper.eq("delete_flag",0); + queryWrapper.isNull("user_id"); + return baseMapper.selectOne(queryWrapper); + } + + /** + * 閫氳繃businessId鑾峰彇鏉冮檺 + * @param businessId + * @return + */ + @Override + public List<PermissionStreamNew> loadProductMixByBusinessId(String businessId,String businessType){ + QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId); + queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType); + queryWrapper.eq("delete_flag",0); + return baseMapper.selectList(queryWrapper); + } + + /** + * 閫氳繃涓氬姟id涓庣被鍨嬪垹闄ゆ潈闄� + * @param businessId + * @param businessType + * @param type 0锛氱敤鎴锋潈闄愶紝1锛氶儴闂ㄦ潈闄� + * @return + */ + @Override + public boolean deletePermissionStreamNewByBusinessId(String businessId,String businessType,String type){ + QueryWrapper<PermissionStreamNew> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(StrUtil.isNotEmpty(businessId),"business_id",businessId); + queryWrapper.eq(StrUtil.isNotEmpty(businessType),"business_type",businessType); + //鐢ㄦ埛鏉冮檺锛岄儴闂ㄥ瓧娈典负绌� + if("0".equals(type)){ + queryWrapper.isNotNull("user_id"); + queryWrapper.isNull("depart_id"); + }else if("1".equals(type)){ + queryWrapper.isNull("user_id"); + queryWrapper.isNotNull("depart_id"); + } + queryWrapper.eq("delete_flag",0); + return baseMapper.delete(queryWrapper)>0; + } + + /** + * 閫氳繃List<PermissionStreamNew>鎵归噺鍒犻櫎 + * @param permissionStreamNewList + * @return + */ + @Override + public boolean deletePermissionStreamNewByList(List<PermissionStreamNew> permissionStreamNewList){ + if(permissionStreamNewList == null || permissionStreamNewList.isEmpty()) + return false; + if(permissionStreamNewList.size() == 1) { + return super.removeById(permissionStreamNewList.get(0).getId()); + } + List<String> ids = new ArrayList<>(); + permissionStreamNewList.forEach(item -> { + ids.add(item.getId()); + }); + return super.removeByIds(ids); + } + + /** + * 閫氳繃涓�缁勪笟鍔d鍜岀敤鎴穒d鍜岀被鍨嬫煡璇� + * @param businessIds + * @param userIds + * @param businessType + * @return + */ + @Override + public List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndUserIds(List<String> businessIds,List<String> userIds,String businessType){ + if(businessIds == null || businessIds.isEmpty() || userIds == null || userIds.isEmpty()) + return null; + List<PermissionStreamNew> total = new ArrayList<>(); + List<List<String>> compListArr; + List<List<String>> userIdsArr; + if(businessIds.size() > 1000){ + compListArr = ListUtils.partition(businessIds, 100); + }else { + compListArr = ListUtils.partition(businessIds, 1000); + } + if(userIds.size() > 1000){ + userIdsArr = ListUtils.partition(userIds, 100); + }else { + userIdsArr = ListUtils.partition(userIds, 1000); + } + for(List<String> compList : compListArr) { + for(List<String> userIdList : userIdsArr){ + LambdaQueryWrapper<PermissionStreamNew> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(PermissionStreamNew::getBusinessId, compList); + queryWrapper.in(PermissionStreamNew::getUserId, userIdList); + queryWrapper.eq(PermissionStreamNew::getBusinessType, businessType); + queryWrapper.isNull(PermissionStreamNew::getDepartId); + queryWrapper.eq(PermissionStreamNew::getDeleteFlag,0); + List<PermissionStreamNew> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } + + /** + * 閫氳繃涓�缁勪笟鍔d鍜岄儴闂╥d鍜岀被鍨嬫煡璇� + * @param businessIds + * @param departIds + * @param businessType + * @return + */ + @Override + public List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndDepartIds(List<String> businessIds,List<String> departIds,String businessType){ + if(businessIds == null || businessIds.isEmpty() || departIds == null || departIds.isEmpty()) + return null; + List<PermissionStreamNew> total = new ArrayList<>(); + List<List<String>> compListArr; + List<List<String>> departListArr; + if(businessIds.size() > 1000){ + compListArr = ListUtils.partition(businessIds, 100); + }else { + compListArr = ListUtils.partition(businessIds, 1000); + } + if(departIds.size() > 1000){ + departListArr = ListUtils.partition(departIds, 100); + }else { + departListArr = ListUtils.partition(departIds, 1000); + } + for(List<String> compList : compListArr) { + for(List<String> departList : departListArr){ + LambdaQueryWrapper<PermissionStreamNew> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(PermissionStreamNew::getBusinessId, compList); + queryWrapper.in(PermissionStreamNew::getDepartId, departList); + queryWrapper.eq(PermissionStreamNew::getBusinessType, businessType); + queryWrapper.isNull(PermissionStreamNew::getUserId); + queryWrapper.eq(PermissionStreamNew::getDeleteFlag,0); + List<PermissionStreamNew> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java deleted file mode 100644 index b5011d4..0000000 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java +++ /dev/null @@ -1,470 +0,0 @@ -package org.jeecg.modules.dnc.service.impl; - -import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.jeecg.modules.dnc.entity.PermissionStream; -import org.jeecg.modules.dnc.mapper.PermissionStreamMapper; -import org.jeecg.modules.dnc.utils.ValidateUtil; -import org.jeecg.modules.dnc.service.IPermissionStreamService; -import org.apache.commons.collections4.ListUtils; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; - -@Service -public class PermissionStreamServiceImpl extends ServiceImpl<PermissionStreamMapper, PermissionStream> implements IPermissionStreamService { - @Override - public PermissionStream getByProductIdAndUserId(String productId, String userId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). - eq(PermissionStream::getUserId, userId).isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - public PermissionStream getByComponentIdAndUserId(String productId, String componentId, String userId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId) - || !ValidateUtil.validateString(componentId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). - eq(PermissionStream::getUserId, userId).eq(PermissionStream::getComponentId, componentId) - .isNull(PermissionStream::getPartsId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - public PermissionStream getByPartsIdAndUserId(String productId, String componentId, String partsId, String userId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId) - || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(partsId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). - eq(PermissionStream::getUserId, userId).eq(PermissionStream::getComponentId, componentId) - .eq(PermissionStream::getPartsId, partsId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - /** - * 鏍规嵁闆朵欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄�-宸ュ簭 - * @param productId - * @param componentId - * @param userId - * @param partsId - * @return - */ - @Override - public PermissionStream getByProcessIdAndUserId(String productId, String componentId, String partsId,String processId,String userId){ - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId) - || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(processId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). - eq(PermissionStream::getUserId, userId).eq(PermissionStream::getComponentId, componentId) - .eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId) - .eq(PermissionStream::getProcessId, processId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - /** - * 鏍规嵁闆朵欢缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄�-宸ユ - * @param productId - * @param componentId - * @param userId - * @param partsId - * @return - */ - @Override - public PermissionStream getByStepIdAndUserId(String productId, String componentId, String partsId,String processId,String stepId, String userId){ - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(userId) - || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(processId) - || !ValidateUtil.validateString(stepId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). - eq(PermissionStream::getUserId, userId).eq(PermissionStream::getComponentId, componentId) - .eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId) - .eq(PermissionStream::getProcessId, processId) - .eq(PermissionStream::getStepId, stepId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - public List<PermissionStream> getByProductId(String productId) { - if(!ValidateUtil.validateString(productId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). - isNull(PermissionStream::getUserId).isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId).list(); - if(list == null || list.isEmpty()) - return null; - return list; - } - - @Override - public List<PermissionStream> getByComponentId(String productId, String componentId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). - isNull(PermissionStream::getUserId).eq(PermissionStream::getComponentId, componentId) - .isNull(PermissionStream::getPartsId).list(); - if(list == null || list.isEmpty()) - return null; - return list; - } - - @Override - public List<PermissionStream> getByPartsId(String productId, String componentId, String partsId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId) - || !ValidateUtil.validateString(partsId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId). - isNull(PermissionStream::getUserId).eq(PermissionStream::getComponentId, componentId) - .eq(PermissionStream::getPartsId, partsId).list(); - if(list == null || list.isEmpty()) - return null; - return list; - } - - @Override - public List<PermissionStream> getByProcessId(String productId, String componentId, String partsId, String processId){ - List<PermissionStream> list = super.lambdaQuery() - .eq(StrUtil.isNotEmpty(productId),PermissionStream::getProductId, productId) - .eq(StrUtil.isNotEmpty(componentId),PermissionStream::getComponentId, componentId) - .eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId) - .eq(StrUtil.isNotEmpty(processId),PermissionStream::getProcessId,processId).list(); - if(list == null || list.isEmpty()) - return null; - return list; - } - - @Override - public List<PermissionStream> getByStepId(String productId, String componentId, String partsId,String processId,String stepId){ - List<PermissionStream> list = super.lambdaQuery() - .eq(StrUtil.isNotEmpty(productId),PermissionStream::getProductId, productId) - .eq(StrUtil.isNotEmpty(componentId),PermissionStream::getComponentId, componentId) - .eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId) - .eq(StrUtil.isNotEmpty(processId),PermissionStream::getProcessId,processId) - .eq(StrUtil.isNotEmpty(stepId),PermissionStream::getStepId,stepId).list(); - if(list == null || list.isEmpty()) - return null; - return list; - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteUserPermsByProductId(String productId) { - if(!ValidateUtil.validateString(productId)) - return false; - LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getDepartId) - .isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId); - return super.remove(lambdaQueryWrapper); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteUserPermsByComponentId(String productId, String componentId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId)) - return false; - LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getDepartId) - .eq(PermissionStream::getComponentId, componentId).isNull(PermissionStream::getPartsId); - return super.remove(lambdaQueryWrapper); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteUserPermsByPartsId(String productId, String componentId, String partsId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId) - || !ValidateUtil.validateString(partsId)) - return false; - LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getDepartId) - .eq(PermissionStream::getComponentId, componentId).eq(PermissionStream::getPartsId, partsId); - return super.remove(lambdaQueryWrapper); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteDepartPermsByProductId(String productId) { - if(!ValidateUtil.validateString(productId)) - return false; - LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getUserId) - .isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId); - return super.remove(lambdaQueryWrapper); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteDepartPermsByComponentId(String productId, String componentId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId)) - return false; - LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getUserId) - .eq(PermissionStream::getComponentId, componentId).isNull(PermissionStream::getPartsId); - return super.remove(lambdaQueryWrapper); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean deleteDepartPermsByPartsId(String productId, String componentId, String partsId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(componentId) - || !ValidateUtil.validateString(partsId)) - return false; - LambdaQueryWrapper<PermissionStream> lambdaQueryWrapper = Wrappers.lambdaQuery(); - lambdaQueryWrapper.eq(PermissionStream::getProductId, productId).isNull(PermissionStream::getUserId) - .eq(PermissionStream::getComponentId, componentId).eq(PermissionStream::getPartsId, partsId); - return super.remove(lambdaQueryWrapper); - } - - @Override - @Transactional(rollbackFor = {Exception.class}) - public boolean removeByCollection(List<PermissionStream> permissionStreamList) { - if(permissionStreamList == null || permissionStreamList.isEmpty()) - return false; - if(permissionStreamList.size() == 1) { - return super.removeById(permissionStreamList.get(0).getStreamId()); - } - List<String> ids = new ArrayList<>(); - permissionStreamList.forEach(item -> { - ids.add(item.getStreamId()); - }); - return super.removeByIds(ids); - } - - @Override - public PermissionStream getByProductIdAndDepartId(String productId, String departId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) - .isNull(PermissionStream::getComponentId).isNull(PermissionStream::getPartsId) - .isNull(PermissionStream::getUserId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - public PermissionStream getByComponentIdAndDepartId(String productId, String componentId, String departId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId) || !ValidateUtil.validateString(componentId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) - .eq(PermissionStream::getComponentId, componentId).isNull(PermissionStream::getPartsId) - .isNull(PermissionStream::getUserId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - public PermissionStream getByPartsIdAndDepartId(String productId, String componentId, String partsId, String departId) { - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId) - || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(partsId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) - .eq(PermissionStream::getComponentId, componentId).eq(PermissionStream::getPartsId, partsId) - .isNull(PermissionStream::getUserId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - /** - * 鏍规嵁宸ュ簭缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param departId - * @param partsId - * @param processId - * @return - */ - @Override - public PermissionStream getByProcessIdAndDepartId(String productId, String componentId, String partsId,String processId, String departId){ - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId) - || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(processId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) - .eq(PermissionStream::getComponentId, componentId).eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId).eq(PermissionStream::getProcessId,processId) - .isNull(PermissionStream::getUserId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - /** - * 鏍规嵁宸ユ缂栧彿锛岀敤鎴风紪鍙锋煡鎵炬潈闄� - * @param productId - * @param componentId - * @param departId - * @param partsId - * @param processId - * @param stepId - * @return - */ - @Override - public PermissionStream getByStepIdAndDepartId(String productId, String componentId, String partsId,String processId,String stepId, String departId){ - if(!ValidateUtil.validateString(productId) || !ValidateUtil.validateString(departId) - || !ValidateUtil.validateString(componentId) || !ValidateUtil.validateString(processId) - || !ValidateUtil.validateString(stepId)) - return null; - List<PermissionStream> list = super.lambdaQuery().eq(PermissionStream::getProductId, productId).eq(PermissionStream::getDepartId, departId) - .eq(PermissionStream::getComponentId, componentId).eq(StrUtil.isNotEmpty(partsId),PermissionStream::getPartsId, partsId).eq(PermissionStream::getProcessId,processId) - .eq(PermissionStream::getStepId,stepId) - .isNull(PermissionStream::getUserId).list(); - if(list == null || list.isEmpty()) - return null; - return list.get(0); - } - - @Override - public List<PermissionStream> findByDepartId(String departId) { - return super.lambdaQuery().eq(PermissionStream::getDepartId, departId).list(); - } - - @Override - public List<PermissionStream> findByUserId(String userId) { - return super.lambdaQuery().eq(PermissionStream::getUserId, userId).list(); - } - - @Override - public List<PermissionStream> getByComponentIdsAndUserIds(List<String> componentIds, List<String> userIds) { - if(componentIds == null || componentIds.isEmpty() || userIds == null || userIds.isEmpty()) - return null; - List<PermissionStream> total = new ArrayList<>(); - List<List<String>> compListArr; - List<List<String>> userListArr; - if(componentIds.size() > 1000){ - compListArr = ListUtils.partition(componentIds, 100); - }else { - compListArr = ListUtils.partition(componentIds, 1000); - } - if(userIds.size() > 1000){ - userListArr = ListUtils.partition(userIds, 100); - }else { - userListArr = ListUtils.partition(userIds, 1000); - } - for(List<String> compList : compListArr) { - for(List<String> userList : userListArr){ - LambdaQueryWrapper<PermissionStream> queryWrapper = Wrappers.lambdaQuery(); - queryWrapper.in(PermissionStream::getComponentId, compList); - queryWrapper.in(PermissionStream::getUserId, userList); - queryWrapper.isNull(PermissionStream::getPartsId); - queryWrapper.isNull(PermissionStream::getDepartId); - List<PermissionStream> list = super.list(queryWrapper); - if(list != null && !list.isEmpty()){ - total.addAll(list); - } - } - } - return total; - } - - @Override - public List<PermissionStream> getByComponentIdsAndDepartIds(List<String> componentIds, List<String> departIds) { - if(componentIds == null || componentIds.isEmpty() || departIds == null || departIds.isEmpty()) - return null; - List<PermissionStream> total = new ArrayList<>(); - List<List<String>> compListArr; - List<List<String>> departListArr; - if(componentIds.size() > 1000){ - compListArr = ListUtils.partition(componentIds, 100); - }else { - compListArr = ListUtils.partition(componentIds, 1000); - } - if(departIds.size() > 1000){ - departListArr = ListUtils.partition(departIds, 100); - }else { - departListArr = ListUtils.partition(departIds, 1000); - } - for(List<String> compList : compListArr) { - for(List<String> departList : departListArr){ - LambdaQueryWrapper<PermissionStream> queryWrapper = Wrappers.lambdaQuery(); - queryWrapper.in(PermissionStream::getComponentId, compList); - queryWrapper.in(PermissionStream::getDepartId, departList); - queryWrapper.isNull(PermissionStream::getUserId); - queryWrapper.isNull(PermissionStream::getPartsId); - List<PermissionStream> list = super.list(queryWrapper); - if(list != null && !list.isEmpty()){ - total.addAll(list); - } - } - } - return total; - } - - @Override - public List<PermissionStream> getByPartsIdsAndUserIds(List<String> partsIds, List<String> userIds) { - if(partsIds == null || partsIds.isEmpty() || userIds == null || userIds.isEmpty()) - return null; - List<PermissionStream> total = new ArrayList<>(); - List<List<String>> compListArr; - List<List<String>> userListArr; - if(partsIds.size() > 1000){ - compListArr = ListUtils.partition(partsIds, 100); - }else { - compListArr = ListUtils.partition(partsIds, 1000); - } - if(userIds.size() > 1000){ - userListArr = ListUtils.partition(userIds, 100); - }else { - userListArr = ListUtils.partition(userIds, 1000); - } - for(List<String> compList : compListArr) { - for(List<String> userList : userListArr){ - LambdaQueryWrapper<PermissionStream> queryWrapper = Wrappers.lambdaQuery(); - queryWrapper.in(PermissionStream::getPartsId, compList);//闆朵欢 - queryWrapper.in(PermissionStream::getUserId, userList); - queryWrapper.isNull(PermissionStream::getDepartId); - List<PermissionStream> list = super.list(queryWrapper); - if(list != null && !list.isEmpty()){ - total.addAll(list); - } - } - } - return total; - } - - @Override - public List<PermissionStream> getByPartsIdsAndDepartIds(List<String> partsIds, List<String> departIds) { - if(partsIds == null || partsIds.isEmpty() || departIds == null || departIds.isEmpty()) - return null; - List<PermissionStream> total = new ArrayList<>(); - List<List<String>> compListArr; - List<List<String>> departListArr; - if(partsIds.size() > 1000){ - compListArr = ListUtils.partition(partsIds, 100); - }else { - compListArr = ListUtils.partition(partsIds, 1000); - } - if(departIds.size() > 1000){ - departListArr = ListUtils.partition(departIds, 100); - }else { - departListArr = ListUtils.partition(departIds, 1000); - } - for(List<String> compList : compListArr) { - for(List<String> departList : departListArr){ - LambdaQueryWrapper<PermissionStream> queryWrapper = Wrappers.lambdaQuery(); - queryWrapper.in(PermissionStream::getPartsId, compList); - queryWrapper.in(PermissionStream::getDepartId, departList); - queryWrapper.isNull(PermissionStream::getUserId); - List<PermissionStream> list = super.list(queryWrapper); - if(list != null && !list.isEmpty()){ - total.addAll(list); - } - } - } - return total; - } -} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionDepartmentServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionDepartmentServiceImpl.java new file mode 100644 index 0000000..63f7056 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionDepartmentServiceImpl.java @@ -0,0 +1,135 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.collections4.ListUtils; +import org.jeecg.modules.dnc.entity.ProcessSpecVersionDepartment; +import org.jeecg.modules.dnc.entity.PartsDepartment; +import org.jeecg.modules.dnc.entity.ProcessSpecVersionDepartment; +import org.jeecg.modules.dnc.mapper.ProcessSpecVersionDepartmentMapper; +import org.jeecg.modules.dnc.service.IProcessSpecVersionDepartmentService; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.MdcProduction; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; + +@Service +public class ProcessSpecVersionDepartmentServiceImpl extends ServiceImpl<ProcessSpecVersionDepartmentMapper, ProcessSpecVersionDepartment> implements IProcessSpecVersionDepartmentService { + + /** + * 鏍规嵁宸ヨ壓瑙勭▼鐗堟湰id鍒犻櫎閮ㄩ棬鏉冮檺 + * @param psvId + * @return + */ + @Override + public boolean deleteByPsvId(String psvId) { + if(!ValidateUtil.validateString(psvId)) + return false; + LambdaQueryWrapper<ProcessSpecVersionDepartment> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ProcessSpecVersionDepartment::getPsvId, psvId); + return super.remove(lambdaQueryWrapper); + } + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param psvId + * @return + */ + @Override + public List<MdcProduction> getDepartPermsByPsvId(String psvId){ + return super.baseMapper.getDepartPermsByPsvId(psvId); + } + + /** + * 鑾峰彇宸插垎閰嶇殑閮ㄩ棬 + * @param psvId + * @return + */ + @Override + public List<MdcProduction> getDepartNonPermsByPsvId(String psvId){ + return super.baseMapper.getDepartNonPermsByPsvId(psvId); + } + + /** + * 鏌ヨ閮ㄩ棬鏉冮檺 + * @param psvId + * @param departId + * @return + */ + @Override + public ProcessSpecVersionDepartment getByProcessSpecVersionIdAndDepartId(String psvId, String departId){ + if(!ValidateUtil.validateString(psvId) || !ValidateUtil.validateString(psvId)) + return null; + List<ProcessSpecVersionDepartment> list = super.lambdaQuery().eq(ProcessSpecVersionDepartment::getPsvId, psvId).eq(ProcessSpecVersionDepartment::getDepartId, departId).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + + /** + * 绉婚櫎閮ㄩ棬鏉冮檺 + * @param processSpecVersionDepartments + * @return + */ + @Override + public boolean removeByCollection(List<ProcessSpecVersionDepartment> processSpecVersionDepartments){ + if(processSpecVersionDepartments == null || processSpecVersionDepartments.isEmpty()) + return false; + if(processSpecVersionDepartments.size() == 1) + return super.removeById(processSpecVersionDepartments.get(0).getId()); + List<String> ids = new ArrayList<>(); + processSpecVersionDepartments.forEach(item -> { + ids.add(item.getId()); + }); + if(ids.size() > 1000){ + List<List<String>> idsArr = ListUtils.partition(ids, 1000); + for(List<String> arr : idsArr){ + super.removeByIds(arr); + } + return true; + }else { + return super.removeByIds(ids); + } + } + + /** + * 鏌ヨ涓�缁勯儴闂ㄦ潈闄� + * @param psvIds + * @param ids + * @return + */ + @Override + public List<ProcessSpecVersionDepartment> getByPsvIdsAndDepartIds(List<String> psvIds, List<String> ids){ + if(psvIds == null || psvIds.isEmpty() || ids == null || ids.isEmpty()) + return null; + List<ProcessSpecVersionDepartment> total = new ArrayList<>(); + List<List<String>> compListArr; + List<List<String>> departListArr; + if(psvIds.size() > 1000){ + compListArr = ListUtils.partition(psvIds, 100); + }else { + compListArr = ListUtils.partition(psvIds, 1000); + } + if(ids.size() > 1000){ + departListArr = ListUtils.partition(ids, 100); + }else { + departListArr = ListUtils.partition(ids, 1000); + } + for(List<String> compList : compListArr) { + for(List<String> departList : departListArr){ + LambdaQueryWrapper<ProcessSpecVersionDepartment> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(ProcessSpecVersionDepartment::getPsvId, compList); + queryWrapper.in(ProcessSpecVersionDepartment::getDepartId, departList); + List<ProcessSpecVersionDepartment> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionPermissionServiceImpl.java new file mode 100644 index 0000000..a1765ed --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionPermissionServiceImpl.java @@ -0,0 +1,128 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.collections4.ListUtils; +import org.jeecg.modules.dnc.entity.PartsPermission; +import org.jeecg.modules.dnc.entity.ProcessSpecVersionPermission; +import org.jeecg.modules.dnc.entity.ProcessionPermission; +import org.jeecg.modules.dnc.entity.WorkStepPermission; +import org.jeecg.modules.dnc.mapper.ProcessSpecVersionPermissionMapper; +import org.jeecg.modules.dnc.service.IProcessSpecVersionPermissionService; +import org.jeecg.modules.dnc.ucenter.UserDepartExt; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.SysUser; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; +import java.util.List; +@Service +public class ProcessSpecVersionPermissionServiceImpl extends ServiceImpl<ProcessSpecVersionPermissionMapper, ProcessSpecVersionPermission> implements IProcessSpecVersionPermissionService { + /** + * 鏍规嵁psvId 鍜寀serId 鏌ユ壘鏉冮檺 + * @param psvId + * @param userId + * @return + */ + @Override + public ProcessSpecVersionPermission getByPsvIdAndUserId(String psvId, String userId){ + if(!ValidateUtil.validateString(psvId) || !ValidateUtil.validateString(userId)) + return null; + List<ProcessSpecVersionPermission> permissions = super.lambdaQuery().eq(ProcessSpecVersionPermission::getPsvId, psvId).eq(ProcessSpecVersionPermission::getUserId, userId).list(); + if(permissions == null || permissions.isEmpty()) + return null; + return permissions.get(0); + } + + /** + * 鏌ヨ涓�缁勬潈闄� + * @param psvIds + * @param ids + * @return + */ + @Override + public List<ProcessSpecVersionPermission> getByPsvIdsAndUserIds(List<String> psvIds, List<String> ids){ + if(psvIds == null || psvIds.isEmpty() || ids == null || ids.isEmpty()) + return null; + List<ProcessSpecVersionPermission> total = new ArrayList<>(); + List<List<String>> psvsListArr; + List<List<String>> userListArr; + if(psvIds.size() > 1000){ + psvsListArr = ListUtils.partition(psvIds, 100); + }else { + psvsListArr = ListUtils.partition(psvIds, 1000); + } + if(ids.size() > 1000){ + userListArr = ListUtils.partition(ids, 100); + }else { + userListArr = ListUtils.partition(ids, 1000); + } + for(List<String> compList : psvsListArr) { + for(List<String> userList : userListArr){ + LambdaQueryWrapper<ProcessSpecVersionPermission> queryWrapper = Wrappers.lambdaQuery(); + queryWrapper.in(ProcessSpecVersionPermission::getPsvId, compList); + queryWrapper.in(ProcessSpecVersionPermission::getUserId, userList); + List<ProcessSpecVersionPermission> list = super.list(queryWrapper); + if(list != null && !list.isEmpty()){ + total.addAll(list); + } + } + } + return total; + } + + /** + * 鑾峰彇宸插垎閰嶇殑鐢ㄦ埛 + * @param psvId + * @return + */ + @Override + public List<UserDepartExt> getUserPermsByProductId(String psvId){ + return super.baseMapper.getUserPermsBypsvId(psvId); + } + + /** + * 鑾峰彇鏈垎閰嶇殑鐢ㄦ埛 + * @param psvId + * @return + */ + @Override + public List<SysUser> getUserNonPermsByProductId(String psvId){ + return super.baseMapper.getUserNonPermsBypsvId(psvId); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean deleteByPsvId(String psvId) { + if(!ValidateUtil.validateString(psvId)) + return false; + LambdaQueryWrapper<ProcessSpecVersionPermission> lambdaQueryWrapper = Wrappers.lambdaQuery(); + lambdaQueryWrapper.eq(ProcessSpecVersionPermission::getPsvId, psvId); + return super.remove(lambdaQueryWrapper); + } + + @Override + @Transactional(rollbackFor = {Exception.class}) + public boolean removeByCollection(List<ProcessSpecVersionPermission> permissionList) { + if(permissionList == null || permissionList.isEmpty()) + return false; + if(permissionList.size() == 1) + return super.removeById(permissionList.get(0).getId()); + List<String> ids = new ArrayList<>(); + permissionList.forEach(item -> { + ids.add(item.getId()); + }); + if(ids.size() > 1000){ + List<List<String>> idsArr = ListUtils.partition(ids, 1000); + for(List<String> arr : idsArr){ + super.removeByIds(arr); + } + return true; + }else { + return super.removeByIds(ids); + } + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java new file mode 100644 index 0000000..b4c0ab1 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java @@ -0,0 +1,433 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.ComponentInfoMapper; +import org.jeecg.modules.dnc.mapper.PartsInfoMapper; +import org.jeecg.modules.dnc.mapper.ProcessSpecVersionMapper; +import org.jeecg.modules.dnc.mapper.ProductInfoMapper; +import org.jeecg.modules.dnc.response.*; +import org.jeecg.modules.dnc.service.*; +import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.system.entity.MdcProduction; +import org.jeecg.modules.system.entity.SysUser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +@Service +public class ProcessSpecVersionServiceImpl extends ServiceImpl<ProcessSpecVersionMapper, ProcessSpecVersion> implements IProcessSpecVersionService{ + @Autowired + private ProductInfoMapper productInfoMapper; + @Autowired + private ComponentInfoMapper componentInfoMapper; + @Autowired + private PartsInfoMapper processSpecVersionMapper; + @Autowired + private IPermissionStreamNewService permissionStreamNewService; + @Autowired + @Lazy + private IProcessStreamService processStreamService; + @Autowired + private IProcessSpecVersionPermissionService processSpecVersionPermissionService; + @Autowired + private IProcessSpecVersionDepartmentService processSpecVersionDepartmentService; + @Autowired + private IProductPermissionService productPermissionService; + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇鎺堟潈鐨勫伐鑹鸿绋嬬増鏈〃淇℃伅 + * @param userId + * @return + */ + @Override + public List<ProcessSpecVersion> getByUserPerms(String userId){ + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + return super.getBaseMapper().getByUserPerms(userId); + } + + /** + * 鏍规嵁鐢ㄦ埛id鑾峰彇鎺堟潈鐨勫伐鑹鸿绋嬬増鏈〃淇℃伅 + * @param userId + * @param queryParam 鏌ヨ鏉′欢 + * @return + */ + @Override + public List<ProcessSpecVersion> getByUserPerms(String userId,String queryParam){ + if(!ValidateUtil.validateString(userId)) + return Collections.emptyList(); + if(!ValidateUtil.validateString(queryParam)) + return Collections.emptyList(); + LambdaQueryWrapper<ProcessSpecVersion> queryWrapper = Wrappers.lambdaQuery(); + if(ValidateUtil.validateString(queryParam)) { + queryWrapper.and(wrapper->wrapper.like(ProcessSpecVersion::getProcessSpecVersionName, queryParam) + .or() + .like(ProcessSpecVersion::getProcessSpecVersionName, queryParam)); + } + queryWrapper.orderByAsc(ProcessSpecVersion::getCreateTime); + return super.list(queryWrapper); + } + + /** + * 鏂板宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭� + * @param ProcessSpecVersion + * @return + */ + @Override + public boolean addProcessSpecVersion(ProcessSpecVersion ProcessSpecVersion){ + if(ProcessSpecVersion == null) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + if(!ValidateUtil.validateString(ProcessSpecVersion.getProcessSpecVersionName())) + ExceptionCast.cast(PartsInfoCode.PARTS_NAME_NONE); + if(!ValidateUtil.validateString(ProcessSpecVersion.getProductId())) + ExceptionCast.cast(PartsInfoCode.PARTS_PRODUCT_NONE); + if(!ValidateUtil.validateString(ProcessSpecVersion.getComponentId())) + ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE); + if(!ValidateUtil.validateString(ProcessSpecVersion.getPartsId())) + ExceptionCast.cast(ProcessInfoCode.PROCESS_PARTS_NONE); + if(!ValidateUtil.validateString(ProcessSpecVersion.getProcessSpecVersionCode())) + ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_CODE_NONE); + ProcessSpecVersion en = getByCode(ProcessSpecVersion.getProcessSpecVersionCode()); + if(en != null) + ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_IS_EXIST); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + ProductInfo productInfo = productInfoMapper.selectById(ProcessSpecVersion.getProductId()); + if(productInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_PRODUCT_NONE); + ComponentInfo componentInfo = componentInfoMapper.selectById(ProcessSpecVersion.getComponentId()); + if(componentInfo == null) + ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE); + PartsInfo processSpecVersion = processSpecVersionMapper.selectById(ProcessSpecVersion.getPartsId()); + if(processSpecVersion == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + boolean b = super.save(ProcessSpecVersion); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞閮ㄩ棬鏉冮檺 + List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(ProcessSpecVersion.getPartsId(),"3","1"); + if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { + List<ProcessSpecVersionDepartment> processSpecVersionDepartmentList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); + oldDepartPermList.forEach(item -> { + ProcessSpecVersionDepartment pd = new ProcessSpecVersionDepartment(); + pd.setDepartId(item.getDepartId()); + pd.setPsvId(ProcessSpecVersion.getId()); + processSpecVersionDepartmentList.add(pd); + PermissionStreamNew perm = new PermissionStreamNew(); + perm.setDepartId(item.getDepartId()); + perm.setBusinessId(ProcessSpecVersion.getId()); + perm.setBusinessType("4"); + permissionStreamList.add(perm); + }); + if(!processSpecVersionDepartmentList.isEmpty()) { + b = processSpecVersionDepartmentService.saveBatch(processSpecVersionDepartmentList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + if(!permissionStreamList.isEmpty()) { + b = permissionStreamNewService.saveBatch(permissionStreamList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + } + //娣诲姞鐢ㄦ埛鏉冮檺 + b = productPermissionService.add(ProcessSpecVersion.getId(), userId,"4"); + if (!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); + } + //娣诲姞鐢ㄦ埛鏉冮檺 + PermissionStreamNew stream = new PermissionStreamNew(); + stream.setBusinessId(ProcessSpecVersion.getId()); + stream.setBusinessType("4"); + stream.setUserId(userId); + return permissionStreamNewService.save(stream); + } + + /** + * 缂栬緫宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭� + * @param id + * @param processSpecVersion + * @return + */ + @Override + public boolean editProcessSpecVersion(String id ,ProcessSpecVersion processSpecVersion){ + if(!ValidateUtil.validateString(id) || processSpecVersion == null) + ExceptionCast.cast(CommonCode.SUCCESS); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + if(!ValidateUtil.validateString(userId)) + ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); + ProcessSpecVersion en = super.getById(id); + if(en == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + processSpecVersion.setId(id); + processSpecVersion.setProductId(null); + processSpecVersion.setComponentId(null); + processSpecVersion.setPartsId(null); + boolean b = super.updateById(processSpecVersion); + if(!b) + return false; + ProcessSpecVersionPermission permission = processSpecVersionPermissionService.getByPsvIdAndUserId(id, userId); + if(permission == null) { + permission = new ProcessSpecVersionPermission(id,userId); + b = processSpecVersionPermissionService.save(permission); + if(!b) + return false; + } + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,"4"); + if(stream == null) { + stream = new PermissionStreamNew(); + stream.setBusinessId(id); + stream.setUserId(userId); + return permissionStreamNewService.save(stream); + } + return b; + } + + /** + * 鍒犻櫎宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭� + * @param id + * @return + */ + @Override + public boolean deleteProcessSpecVersion(String id){ + if(!ValidateUtil.validateString(id)) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + ProcessSpecVersion processSpecVersion = super.getById(id); + if(processSpecVersion == null) + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + List<ProcessStream> processStreams = processStreamService.findBypsvId(id); + if(processStreams!= null &&!processStreams.isEmpty()) + ExceptionCast.cast(PartsInfoCode.PARTS_PROCESS_EXIST); + boolean b = processSpecVersionPermissionService.deleteByPsvId(processSpecVersion.getId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = processSpecVersionDepartmentService.deleteByPsvId(processSpecVersion.getId()); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(processSpecVersion.getId(),"4","0"); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(processSpecVersion.getId(),"4","1"); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + return super.removeById(processSpecVersion.getId()); + } + + @Override + public ProcessSpecVersion getByCode(String processSpecVersionCode) { + if(ValidateUtil.validateString(processSpecVersionCode)) { + List<ProcessSpecVersion> list = super.lambdaQuery().eq(ProcessSpecVersion::getProcessSpecVersionCode, processSpecVersionCode).list(); + if(list == null || list.isEmpty()) + return null; + return list.get(0); + } + return null; + } + + @Override + public List<ProcessSpecVersion> getByPartsId(String partsId) { + if(ValidateUtil.validateString(partsId)) { + List<ProcessSpecVersion> list = super.lambdaQuery().eq(ProcessSpecVersion::getPartsId, partsId).list(); + if(list == null || list.isEmpty()) + return null; + return list; + } + return null; + } + + /** + * 鏍规嵁涓�缁勯浂浠秈d鑾峰彇 + * @param partsIds + * @return + */ + @Override + public List<ProcessSpecVersion> getByPartsIds(List<String> partsIds){ + if(partsIds == null || partsIds.isEmpty()) + return Collections.emptyList(); + List<ProcessSpecVersion> list = super.lambdaQuery().in(ProcessSpecVersion::getPartsId, partsIds).list(); + if(list == null || list.isEmpty()) + return null; + else + return list; + } + + + /** + * 鍒嗛厤鐢ㄦ埛鏉冮檺 + * @param processSpecVersion + * @param userList + * @return + */ + @Override + public boolean assignAddUser(ProcessSpecVersion processSpecVersion, Collection<SysUser> userList){ + if(processSpecVersion == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ProcessSpecVersionPermission> permissionList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + ProcessSpecVersionPermission en = processSpecVersionPermissionService.getByPsvIdAndUserId(processSpecVersion.getId(), item.getId()); + if(en == null) { + en = new ProcessSpecVersionPermission(); + en.setUserId(item.getId()); + en.setPsvId(processSpecVersion.getId()); + permissionList.add(en); + } + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(), item.getId(),"4"); + if(stream == null) { + stream = new PermissionStreamNew(); + stream.setUserId(item.getId()); + stream.setBusinessId(processSpecVersion.getId()); + stream.setBusinessType("4"); + permissionStreamList.add(stream); + } + }); + if(!permissionList.isEmpty()) { + boolean b = processSpecVersionPermissionService.saveBatch(permissionList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + + /** + * 绉婚櫎鐢ㄦ埛鏉冮檺 + * @param processSpecVersion + * @param userList + * @return + */ + @Override + public boolean assignRemoveUser(ProcessSpecVersion processSpecVersion, Collection<SysUser> userList){ + if(processSpecVersion == null || userList == null || userList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ProcessSpecVersionPermission> permissionList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); + userList.forEach(item -> { + ProcessSpecVersionPermission en = processSpecVersionPermissionService.getByPsvIdAndUserId(processSpecVersion.getId(), item.getId()); + if(en != null) { + permissionList.add(en); + } + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(), item.getId(),"4"); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + //娓呯┖鐢ㄦ埛鏉冮檺鏍¢獙 + if(!permissionList.isEmpty()) { + boolean b = processSpecVersionPermissionService.removeByCollection(permissionList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + /** + * 鍒嗛厤閮ㄩ棬鏉冮檺 + * @param processSpecVersion + * @param departmentList + * @return + */ + @Override + public boolean assignAddDepart(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> departmentList){ + if(processSpecVersion == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ProcessSpecVersionDepartment> partsDepartments = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + ProcessSpecVersionDepartment en = processSpecVersionDepartmentService.getByProcessSpecVersionIdAndDepartId(processSpecVersion.getId(), item.getId()); + if(en == null) { + en = new ProcessSpecVersionDepartment(); + en.setDepartId(item.getId()); + en.setPsvId(processSpecVersion.getId()); + partsDepartments.add(en); + } + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processSpecVersion.getId(), item.getId(),"4"); + if(stream == null) { + stream = new PermissionStreamNew(); + stream.setDepartId(item.getId()); + stream.setBusinessId(processSpecVersion.getId()); + stream.setBusinessType("4"); + permissionStreamList.add(stream); + } + }); + if(!partsDepartments.isEmpty()) { + boolean b = processSpecVersionDepartmentService.saveBatch(partsDepartments); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + + /** + * 鍒嗛厤閮ㄩ棬鏉冮檺 + * @param processSpecVersion + * @param departmentList + * @return + */ + @Override + public boolean assignRemoveDepart(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> departmentList){ + if(processSpecVersion == null || departmentList == null || departmentList.isEmpty()) + ExceptionCast.cast(CommonCode.INVALID_PARAM); + List<ProcessSpecVersionDepartment> partsDepartments = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); + departmentList.forEach(item -> { + ProcessSpecVersionDepartment en = processSpecVersionDepartmentService.getByProcessSpecVersionIdAndDepartId(processSpecVersion.getId(), item.getId()); + if(en != null) { + partsDepartments.add(en); + } + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processSpecVersion.getId(), item.getId(),"3"); + if(stream != null) { + permissionStreamList.add(stream); + } + }); + if(!partsDepartments.isEmpty()) { + boolean b = processSpecVersionDepartmentService.removeByCollection(partsDepartments); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + if(!permissionStreamList.isEmpty()) { + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); + if(!b) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + } + return true; + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java index 045fc53..8bb0199 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import liquibase.pro.packaged.P; import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.dnc.exception.ExceptionCast; @@ -40,14 +41,12 @@ @Autowired private IProcessInfoService processInfoService; @Autowired - private IPartsInfoService partsInfoService; - @Autowired - private IDocInfoService docInfoService; + private IProcessSpecVersionService processSpecVersionService; @Autowired @Lazy private IDeviceInfoService deviceInfoService; @Autowired - private IPermissionStreamService permissionStreamService; + private IPermissionStreamNewService permissionStreamNewService; @Autowired private IProcessionDepartmentService processionDepartmentService; @Autowired @@ -62,6 +61,7 @@ @Override @Transactional(rollbackFor = {Exception.class}) public boolean addProcessStream(ProcessStream stream) { + List<PermissionStreamNew> oldDepartPermList=new ArrayList<>(); if(stream == null) ExceptionCast.cast(CommonCode.INVALID_PARAM); if(!ValidateUtil.validateString(stream.getProductId())) @@ -76,18 +76,19 @@ String userId = user.getId(); if(!ValidateUtil.validateString(userId)) ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - if(ValidateUtil.validateString(stream.getPartsId())) { - PartsInfo partsInfo = partsInfoService.getById(stream.getPartsId()); - if(partsInfo == null) - ExceptionCast.cast(ProcessInfoCode.PROCESS_PARTS_NONE); - if(!stream.getProductId().equals(partsInfo.getProductId())) + if(ValidateUtil.validateString(stream.getPsvId())) { + ProcessSpecVersion psv = processSpecVersionService.getById(stream.getPsvId()); + if(psv == null) + ExceptionCast.cast(ProcessInfoCode.PROCESSSPECVERSION_NONE); + if(!stream.getProductId().equals(psv.getProductId())) ExceptionCast.cast(ProcessInfoCode.PROCESS_PRODUCT_NONE); - if(!stream.getComponentId().equals(partsInfo.getComponentId())) + if(!stream.getComponentId().equals(psv.getComponentId())) ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE); - ProcessStream en = findByProcessNoAndPartsId(stream.getProcessCode(), partsInfo.getPartsId()); + ProcessStream en = findByProcessNoAndPartsId(stream.getProcessCode(), psv.getId()); if(en != null) { ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); } + oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(psv.getId(),"4","1"); }else { ComponentInfo componentInfo = componentInfoService.getById(stream.getComponentId()); if(componentInfo == null) @@ -99,25 +100,48 @@ if(en != null) { ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); } + oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1"); } boolean b = super.save(stream); if(!b) ExceptionCast.cast(CommonCode.FAIL); + //娣诲姞閮ㄩ棬鏉冮檺 + if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { + List<ProcessionDepartment> processionDepartmentList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); + oldDepartPermList.forEach(item -> { + ProcessionDepartment pd = new ProcessionDepartment(); + pd.setDepartId(item.getDepartId()); + pd.setProcessId(stream.getProcessId()); + processionDepartmentList.add(pd); + PermissionStreamNew perm = new PermissionStreamNew(); + perm.setDepartId(item.getDepartId()); + perm.setBusinessId(stream.getProcessId()); + perm.setBusinessType("5"); + permissionStreamList.add(perm); + }); + if(!processionDepartmentList.isEmpty()) { + b = processionDepartmentService.saveBatch(processionDepartmentList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + if(!permissionStreamList.isEmpty()) { + b = permissionStreamNewService.saveBatch(permissionStreamList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + } //娣诲姞鐢ㄦ埛鏉冮檺 b = productPermissionService.add(stream.getProcessId(), userId,"5"); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } //娣诲姞鏉冮檺楠岃瘉 - PermissionStream permissionStream = new PermissionStream(); + PermissionStreamNew permissionStream = new PermissionStreamNew(); permissionStream.setUserId(userId); - permissionStream.setProductId(stream.getProductId()); - permissionStream.setComponentId(stream.getComponentId()); - if (StrUtil.isNotEmpty(stream.getPartsId())){ - permissionStream.setPartsId(stream.getPartsId()); - } - permissionStream.setProcessId(stream.getProcessId()); - return permissionStreamService.save(permissionStream); + permissionStream.setBusinessId(stream.getProcessId()); + permissionStream.setBusinessType("5"); + return permissionStreamNewService.save(permissionStream); } @Override @@ -190,13 +214,13 @@ } @Override - public List<ProcessStream> findByPartsId(String partsId) { - return super.lambdaQuery().eq(ProcessStream::getPartsId, partsId).list(); + public List<ProcessStream> findBypsvId(String psvId) { + return super.lambdaQuery().eq(ProcessStream::getPsvId, psvId).list(); } @Override - public ProcessStream findByProcessNoAndPartsId(String processNo, String partsId) { - List<ProcessStream> list = super.lambdaQuery().eq(ProcessStream::getPartsId, partsId).eq(ProcessStream::getProcessCode, processNo).list(); + public ProcessStream findByProcessNoAndPartsId(String processNo, String psvsId) { + List<ProcessStream> list = super.lambdaQuery().eq(ProcessStream::getPsvId, psvsId).eq(ProcessStream::getProcessCode, processNo).list(); if(list == null || list.isEmpty()) return null; return list.get(0); @@ -262,7 +286,7 @@ if(processStream == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionDepartment> processionDepartmentList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProcessionDepartment en = processionDepartmentService.getByProcessIdAndDepartId(processStream.getProcessId(), item.getId()); if(en == null) { @@ -271,14 +295,12 @@ en.setProcessId(processStream.getProcessId()); processionDepartmentList.add(en); } - PermissionStream stream = permissionStreamService.getByProcessIdAndDepartId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(),item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),"5"); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); - stream.setProductId(processStream.getProductId()); - stream.setComponentId(processStream.getComponentId()); - stream.setPartsId(processStream.getPartsId()); - stream.setProcessId(processStream.getProcessId()); + stream.setBusinessId(processStream.getProcessId()); + stream.setBusinessType("5"); permissionStreamList.add(stream); } }); @@ -289,7 +311,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -314,14 +336,13 @@ if(processStream == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionDepartment> processionDepartmentList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProcessionDepartment en = processionDepartmentService.getByProcessIdAndDepartId(processStream.getProcessId(), item.getId()); if(en != null) { processionDepartmentList.add(en); } - PermissionStream stream = permissionStreamService.getByProcessIdAndDepartId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId() - ,processStream.getProcessId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),"5"); if(stream != null) { permissionStreamList.add(stream); } @@ -333,7 +354,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -347,7 +368,7 @@ if(processStream == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ProcessionPermission en = processStreamPermissionService.getByProcessIdAndUserId(processStream.getProcessId(), item.getId()); if(en == null) { @@ -356,14 +377,12 @@ en.setProcessId(processStream.getProcessId()); permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByProcessIdAndUserId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),"5"); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setUserId(item.getId()); - stream.setProductId(processStream.getProductId()); - stream.setComponentId(processStream.getComponentId()); - stream.setPartsId(processStream.getPartsId()); - stream.setProcessId(processStream.getProcessId()); + stream.setBusinessId(processStream.getProcessId()); + stream.setBusinessType("5"); permissionStreamList.add(stream); } }); @@ -374,7 +393,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -388,13 +407,13 @@ if(processStream == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProcessionPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ProcessionPermission en = processStreamPermissionService.getByProcessIdAndUserId(processStream.getProcessId(), item.getId()); if(en != null) { permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByProcessIdAndUserId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(),processStream.getProcessId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),"5"); if(stream != null) { permissionStreamList.add(stream); } @@ -407,7 +426,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java index d77d2be..02ec1f9 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessionDepartmentService.java @@ -1,21 +1,16 @@ package org.jeecg.modules.dnc.service.impl; -import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.collections4.ListUtils; -import org.jeecg.modules.dnc.entity.PartsDepartment; -import org.jeecg.modules.dnc.entity.ProcessStream; import org.jeecg.modules.dnc.entity.ProcessionDepartment; import org.jeecg.modules.dnc.mapper.ProcessionDepartmentMapper; import org.jeecg.modules.dnc.service.IProcessionDepartmentService; -import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.stereotype.Service; import java.util.*; -import java.util.function.Function; @Service public class ProcessionDepartmentService extends ServiceImpl<ProcessionDepartmentMapper, ProcessionDepartment> implements IProcessionDepartmentService { diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java index 0e8b19d..ee0c849 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java @@ -1,15 +1,15 @@ package org.jeecg.modules.dnc.service.impl; -import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import liquibase.pro.packaged.S; import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.dnc.dto.ComponentExt; import org.jeecg.modules.dnc.exception.ExceptionCast; +import org.jeecg.modules.dnc.mapper.ProcessSpecVersionPermissionMapper; import org.jeecg.modules.dnc.mapper.ProductInfoMapper; import org.jeecg.modules.dnc.response.*; import org.jeecg.modules.dnc.service.*; @@ -26,6 +26,8 @@ import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import redis.clients.jedis.Jedis; + import java.util.*; import java.util.stream.Collectors; @@ -39,11 +41,13 @@ @Lazy private IPartsInfoService partsInfoService; @Autowired + private IProcessSpecVersionService processSpecVersionService; + @Autowired private IProductPermissionService productPermissionService; @Autowired private IProductDepartmentService productDepartmentService; @Autowired - private IPermissionStreamService permissionStreamService; + private IPermissionStreamNewService permissionStreamNewService; @Autowired private IComponentDepartmentService componentDepartmentService; @Autowired @@ -52,6 +56,10 @@ private IPartsDepartmentService partsDepartmentService; @Autowired private IPartsPermissionService partsPermissionService; + @Autowired + private IProcessSpecVersionPermissionService processSpecVersionPermissionService; + @Autowired + private IProcessSpecVersionDepartmentService processSpecVersionDepartmentService; @Autowired private ISysUserService userService; @Autowired @@ -98,10 +106,11 @@ if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } - PermissionStream stream = new PermissionStream(); - stream.setProductId(productInfo.getProductId()); + PermissionStreamNew stream = new PermissionStreamNew(); + stream.setBusinessId(productInfo.getProductId()); stream.setUserId(userId); - return permissionStreamService.save(stream); + stream.setBusinessType("1"); + return permissionStreamNewService.save(stream); } @Override @@ -131,12 +140,13 @@ return false; } } - PermissionStream stream = permissionStreamService.getByProductIdAndUserId(id, userId); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId, "1"); if (stream == null) { - stream = new PermissionStream(); - stream.setProductId(id); + stream = new PermissionStreamNew(); + stream.setBusinessId(productInfo.getProductId()); stream.setUserId(userId); - return permissionStreamService.save(stream); + stream.setBusinessType("1"); + return permissionStreamNewService.save(stream); } return b; } @@ -155,6 +165,10 @@ List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId); if (partsInfos == null) partsInfos = Collections.emptyList(); + //宸ヨ壓瑙勭▼鐗堟湰 + List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByUserPerms(userId); + if (processSpecVersions == null) + processSpecVersions = Collections.emptyList(); //宸ュ簭 List<ProcessStream> processStreams = processStreamService.getByuserPerms(userId); if (processStreams == null) @@ -163,7 +177,7 @@ List<WorkStep> workStepList = workStepService.getByUserPerms(userId); if (workStepList == null) workStepList = Collections.emptyList(); - return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos, processStreams, workStepList); + return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos, processSpecVersions,processStreams, workStepList); } @Override @@ -219,10 +233,10 @@ b = productDepartmentService.deleteByProductId(id); if (!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamService.deleteUserPermsByProductId(id); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","0"); if (!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamService.deleteDepartPermsByProductId(id); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","1"); if (!b) ExceptionCast.cast(CommonCode.FAIL); return super.removeById(id); @@ -240,33 +254,37 @@ ProductInfo productInfo = super.getById(paramId); if (productInfo == null) ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); - PermissionStream permission = permissionStreamService.getByProductIdAndUserId(paramId, userId); + PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(paramId, userId,"1"); return permission != null; } else if (nodeType == 2) { ComponentInfo componentInfo = componentInfoService.getById(paramId); if (componentInfo == null) ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST); - PermissionStream permission = permissionStreamService.getByComponentIdAndUserId(componentInfo.getProductId(), paramId, userId); + PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(componentInfo.getComponentId(), userId,"2"); return permission != null; } else if (nodeType == 3) { PartsInfo partsInfo = partsInfoService.getById(paramId); if (partsInfo == null) ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); - PermissionStream permission = permissionStreamService.getByPartsIdAndUserId(partsInfo.getProductId(), partsInfo.getComponentId(), paramId, userId); + PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), userId, "3"); + return permission != null; + } else if (nodeType == 4) { + ProcessSpecVersion processSpecVersion = processSpecVersionService.getById(paramId); + if (processSpecVersion == null) + ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NOT_EXIST); + PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(),userId,"4"); return permission != null; } else if (nodeType == 5) { ProcessStream processStream = processStreamService.getById(paramId); if (processStream == null) ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); - PermissionStream permission = permissionStreamService.getByProcessIdAndUserId(processStream.getProductId(), processStream.getComponentId() - , processStream.getPartsId(), processStream.getProcessId(), userId); + PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), userId,"5"); return permission != null; } else if (nodeType == 6) { WorkStep workStep = workStepService.getById(paramId); if (workStep == null) ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST); - PermissionStream permission = permissionStreamService.getByStepIdAndUserId(workStep.getProductId(), workStep.getComponentId() - , workStep.getPartsId(), workStep.getProcessId(), workStep.getId(), userId); + PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(), userId,"6"); return permission != null; } return false; @@ -282,6 +300,8 @@ return componentPermissionService.getUserPermsByComponentId(paramId); } else if (nodeType == 3) { return partsPermissionService.getUserPermsByProductId(paramId); + } else if (nodeType == 4) { + return processSpecVersionPermissionService.getUserPermsByProductId(paramId); } else if (nodeType == 5) { return iProcessStreamPermissionService.getUserPermsByProductId(paramId); } else if (nodeType == 6) { @@ -301,6 +321,8 @@ return componentPermissionService.getUserNonPermsByComponentId(paramId); } else if (nodeType == 3) { return partsPermissionService.getUserNonPermsByProductId(paramId); + } else if (nodeType == 4) { + return processSpecVersionPermissionService.getUserNonPermsByProductId(paramId); } else if (nodeType == 5) { return iProcessStreamPermissionService.getUserNonPermsByProductId(paramId); } else if (nodeType == 6) { @@ -320,12 +342,13 @@ return componentDepartmentService.getDepartPermsByComponentId(paramId); } else if (nodeType == 3) { return partsDepartmentService.getDepartPermsByPartsId(paramId); - } else if (nodeType == 5) { + } else if (nodeType == 4) { + return processSpecVersionDepartmentService.getDepartPermsByPsvId(paramId); + }else if (nodeType == 5) { return processionDepartmentService.getDepartPermsByProcessId(paramId); } else if (nodeType == 6) { return workStepDepartmentService.getDepartPermsByStepId(paramId); } - //todo 灏佽鏍戠姸缁撴瀯 else { return null; } @@ -341,6 +364,8 @@ return componentDepartmentService.getDepartNonPermsByComponentId(paramId); } else if (nodeType == 3) { return partsDepartmentService.getDepartNonPermsByProductId(paramId); + } else if (nodeType == 4) { + return processionDepartmentService.getDepartNonPermsByProcessId(paramId); } else if (nodeType == 5) { return processionDepartmentService.getDepartNonPermsByProcessId(paramId); } else if (nodeType == 6) { @@ -367,16 +392,19 @@ Collection<SysUser> userList = userService.listByIds(ids); validateSysUserList(userList, ids); switch (nodeType) { - case 6: - return handleWorkStep(paramId, null,userList); - case 5: - return handleProcessStream(paramId, relativeFlag, null,userList); - case 3: - return handlePartsInfo(paramId, relativeFlag, null,userList); case 1: return handleProductInfo(paramId, relativeFlag, null,userList); case 2: return handleComponentInfo(paramId, relativeFlag, null,userList); + case 3: + return handlePartsInfo(paramId, relativeFlag, null,userList); + case 4: + return handleProcessSpecVersion(paramId, relativeFlag, null,userList); + case 5: + return handleProcessStream(paramId, relativeFlag, null,userList); + case 6: + return handleWorkStep(paramId, null,userList); + default: return false; } @@ -395,19 +423,23 @@ validateInputParameters(nodeType, paramId, relativeFlag, "2", departmentIds); List<String> ids = new ArrayList<>(departmentIds.length); Collections.addAll(ids, departmentIds); - Collection<MdcProduction> mdcProductionList = mdcProductionService.listByIds(ids); - validateMdcProductionList(mdcProductionList, ids); + List<String> deps=mdcProductionService.findAllProductionIds(ids); + Collection<MdcProduction> mdcProductionList = mdcProductionService.listByIds(deps); + validateMdcProductionList(mdcProductionList, deps); switch (nodeType) { - case 6: - return handleWorkStep(paramId, mdcProductionList,null); - case 5: - return handleProcessStream(paramId, relativeFlag, mdcProductionList,null); - case 3: - return handlePartsInfo(paramId, relativeFlag, mdcProductionList,null); case 1: return handleProductInfo(paramId, relativeFlag, mdcProductionList,null); case 2: return handleComponentInfo(paramId, relativeFlag, mdcProductionList,null); + case 3: + return handlePartsInfo(paramId, relativeFlag, mdcProductionList,null); + case 4: + return handleProcessSpecVersion(paramId, relativeFlag, mdcProductionList,null); + case 5: + return handleProcessStream(paramId, relativeFlag, mdcProductionList,null); + case 6: + return handleWorkStep(paramId, mdcProductionList,null); + default: return false; } @@ -428,16 +460,18 @@ Collection<SysUser> userList = userService.listByIds(userIdsList); validateSysUserList(userList, userIdsList); switch (nodeType) { - case 6: - return handleWorkStepRemoval(paramId, userList,null); - case 5: - return handleProcessStreamRemoval(paramId, relativeFlag, userList,null); - case 3: - return handlePartsInfoRemoval(paramId, relativeFlag, userList,null); case 1: return handleProductInfoRemoval(paramId, relativeFlag, userList,null); case 2: return handleComponentInfoRemoval(paramId, relativeFlag, userList,null); + case 3: + return handlePartsInfoRemoval(paramId, relativeFlag, userList,null); + case 4: + return handleProcessSpecVersionRemoval(paramId, relativeFlag, userList,null); + case 5: + return handleProcessStreamRemoval(paramId, relativeFlag, userList,null); + case 6: + return handleWorkStepRemoval(paramId, userList,null); default: return false; } @@ -456,20 +490,24 @@ @Transactional(rollbackFor = {Exception.class}) public boolean assignRemoveDepartmentAll(Integer nodeType, String paramId, Integer relativeFlag, String[] departmentIds) { validateInputParameters(nodeType, paramId, relativeFlag, "2", departmentIds); - List<String> departmentIdList = Arrays.asList(departmentIds); - Collection<MdcProduction> mdcProductionList = mdcProductionService.listByIds(departmentIdList); - validateMdcProductionList(mdcProductionList, departmentIdList); + List<String> ids = new ArrayList<>(departmentIds.length); + Collections.addAll(ids, departmentIds); + List<String> deps=mdcProductionService.findAllProductionIds(ids); + Collection<MdcProduction> mdcProductionList = mdcProductionService.listByIds(deps); + validateMdcProductionList(mdcProductionList, deps); switch (nodeType) { - case 6: - return handleWorkStepRemoval(paramId,null,mdcProductionList); - case 5: - return handleProcessStreamRemoval(paramId, relativeFlag, null,mdcProductionList); - case 3: - return handlePartsInfoRemoval(paramId, relativeFlag,null, mdcProductionList); case 1: return handleProductInfoRemoval(paramId, relativeFlag,null, mdcProductionList); case 2: return handleComponentInfoRemoval(paramId, relativeFlag, null,mdcProductionList); + case 3: + return handlePartsInfoRemoval(paramId, relativeFlag,null, mdcProductionList); + case 4: + return handleProcessSpecVersionRemoval(paramId, relativeFlag, null,mdcProductionList); + case 5: + return handleProcessStreamRemoval(paramId, relativeFlag, null,mdcProductionList); + case 6: + return handleWorkStepRemoval(paramId,null,mdcProductionList); default: return false; } @@ -481,7 +519,7 @@ if (productInfo == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProductPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ProductPermission en = productPermissionService.getByProductIdAndUserId(productInfo.getProductId(), item.getId()); if (en == null) { @@ -490,11 +528,12 @@ en.setProductId(productInfo.getProductId()); permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByProductIdAndUserId(productInfo.getProductId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(productInfo.getProductId(), item.getId(),"1"); if (stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setUserId(item.getId()); - stream.setProductId(productInfo.getProductId()); + stream.setBusinessId(productInfo.getProductId()); + stream.setBusinessType("1"); permissionStreamList.add(stream); } }); @@ -505,7 +544,7 @@ } } if (!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b =permissionStreamNewService.saveBatch(permissionStreamList); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -519,13 +558,13 @@ if (productInfo == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProductPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { ProductPermission en = productPermissionService.getByProductIdAndUserId(productInfo.getProductId(), item.getId()); if (en != null) { permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByProductIdAndUserId(productInfo.getProductId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(productInfo.getProductId(), item.getId(),"1"); if (stream != null) { permissionStreamList.add(stream); } @@ -541,7 +580,7 @@ } } if (!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -555,7 +594,7 @@ if (productInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProductDepartment> productDepartmentList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId()); if (en == null) { @@ -564,11 +603,12 @@ en.setProductId(productInfo.getProductId()); productDepartmentList.add(en); } - PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(productInfo.getProductId(), item.getId(),"1"); if (stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); - stream.setProductId(productInfo.getProductId()); + stream.setBusinessId(productInfo.getProductId()); + stream.setBusinessType("1"); permissionStreamList.add(stream); } }); @@ -579,7 +619,7 @@ } } if (!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -593,13 +633,13 @@ if (productInfo == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<ProductDepartment> productDepartmentList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { ProductDepartment en = productDepartmentService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId()); if (en != null) { productDepartmentList.add(en); } - PermissionStream stream = permissionStreamService.getByProductIdAndDepartId(productInfo.getProductId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(productInfo.getProductId(), item.getId(),"1"); if (stream != null) { permissionStreamList.add(stream); } @@ -611,7 +651,7 @@ } } if (!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -627,11 +667,7 @@ ProcessStream processStream = processStreamService.getById(paramId); if (processStream == null) return null; - List<PermissionStream> permissionStreamList = permissionStreamService.list(new QueryWrapper<PermissionStream>() - .eq(StrUtil.isNotEmpty(processStream.getProductId()), "product_id", processStream.getProductId()) - .eq(StrUtil.isNotEmpty(processStream.getComponentId()), "component_id", processStream.getComponentId()) - .eq(StrUtil.isNotEmpty(processStream.getPartsId()), "parts_id", processStream.getPartsId()) - .eq(StrUtil.isNotEmpty(processStream.getProcessId()), "process_id", processStream.getProcessId())); + List<PermissionStreamNew> permissionStreamList = permissionStreamNewService.loadProductMixByBusinessId(processStream.getProcessId(),"5"); if (permissionStreamList == null || permissionStreamList.isEmpty()) return null; permissionStreamList.forEach(item -> { @@ -642,12 +678,7 @@ WorkStep workStep = workStepService.getById(paramId); if (workStep == null) return null; - List<PermissionStream> permissionStreamList = permissionStreamService.list(new QueryWrapper<PermissionStream>() - .eq(StrUtil.isNotEmpty(workStep.getProductId()), "product_id", workStep.getProductId()) - .eq(StrUtil.isNotEmpty(workStep.getComponentId()), "component_id", workStep.getComponentId()) - .eq(StrUtil.isNotEmpty(workStep.getPartsId()), "parts_id", workStep.getPartsId()) - .eq(StrUtil.isNotEmpty(workStep.getProcessId()), "process_id", workStep.getProcessId()) - .eq(StrUtil.isNotEmpty(workStep.getId()), "step_id", workStep.getId())); + List<PermissionStreamNew> permissionStreamList = permissionStreamNewService.loadProductMixByBusinessId(workStep.getId(),"6"); if (permissionStreamList == null || permissionStreamList.isEmpty()) return null; permissionStreamList.forEach(item -> { @@ -752,6 +783,7 @@ List<ProductInfo> productInfos = this.getByUserPerms(userId, queryParam); List<ComponentInfo> componentInfos = componentInfoService.getByUserPerms(userId, queryParam); List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId, null, queryParam); + List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByUserPerms(userId, queryParam); List<ProcessStream> processStreams = processStreamService.getByuserPerms(userId, queryParam); List<WorkStep> workSteps = workStepService.getByUserPerms(userId, queryParam); List<ComponentInfo> componentInfoList = new ArrayList<>(); @@ -879,7 +911,7 @@ //杞崲鏁版嵁 List<ComponentExt> componentExtList = ComponentExt.convertToExtList(componentInfoList); - return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos, processStreams, workSteps); + return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos,processSpecVersions, processStreams, workSteps); } @Override @@ -894,6 +926,9 @@ //闆朵欢 case 3: return partsInfoService.deletePartsInfo(id); + //宸ヨ壓瑙勭▼鐗堟湰 + case 4: + return processSpecVersionService.deleteProcessSpecVersion(id); //宸ュ簭 case 5: return processStreamService.deleteProcessStream(id); @@ -940,13 +975,13 @@ } } - private void handleRelativePermissions(String productId, List<String> componentIds, String processId, String partsId, Collection<SysUser> userList) { + private void handleRelativePermissions(String productId, List<String> componentIds, String processId, String partsId,String psvId ,Collection<SysUser> userList) { List<ComponentPermission> componentPermissionList = new ArrayList<>(); List<PartsPermission> partsPermissionList = new ArrayList<>(); + List<ProcessSpecVersionPermission> processSpecVersionPermissionList = new ArrayList<>(); List<ProcessionPermission> processionPermissionList = new ArrayList<>(); List<WorkStepPermission> workStepPermissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); - + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); // 澶勭悊閮ㄤ欢鏉冮檺 if (componentIds != null && !componentIds.isEmpty()) { handleComponentPermissions(componentIds, userList, componentPermissionList, permissionStreamList); @@ -956,9 +991,28 @@ .map(PartsInfo::getPartsId) .collect(Collectors.toList()); handlePartsPermissions(partsIds, userList, partsPermissionList, permissionStreamList); + List<String> psvIds = processSpecVersionService.getByPartsIds(partsIds).stream().map(ProcessSpecVersion::getId).collect(Collectors.toList()); + handlePsvPermissions(psvIds, userList, processSpecVersionPermissionList, permissionStreamList); List<ProcessStream> processStreamList = processStreamService.getByComponentIdList(productId, componentIds, partsIds); processStreamApi(productId, userList, processionPermissionList, workStepPermissionList, permissionStreamList, processStreamList); } + } + + // 澶勭悊闆朵欢鏉冮檺 + if (partsId != null) { + List<ProcessSpecVersion> processStreamList = processSpecVersionService.list(new QueryWrapper<ProcessSpecVersion>().eq("id", psvId)); + if (processStreamList != null && !processStreamList.isEmpty()) { + List<String> psvIds = processStreamList.stream() + .map(ProcessSpecVersion::getId) + .collect(Collectors.toList()); + handlePsvPermissions(psvIds,userList,processSpecVersionPermissionList,permissionStreamList); + } + } + + // 澶勭悊宸ヨ壓瑙勭▼鐗堟湰鏉冮檺 + if (psvId!= null) { + List<ProcessStream> processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", psvId)); + processStreamApi(productId, userList, processionPermissionList, workStepPermissionList, permissionStreamList, processStreamList); } // 澶勭悊宸ュ簭鏉冮檺 @@ -972,17 +1026,14 @@ } } - // 澶勭悊闆朵欢鏉冮檺 - if (partsId != null) { - List<ProcessStream> processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsId)); - processStreamApi(productId, userList, processionPermissionList, workStepPermissionList, permissionStreamList, processStreamList); - } - if (!componentPermissionList.isEmpty()) { componentPermissionService.saveBatch(componentPermissionList); } if (!partsPermissionList.isEmpty()) { partsPermissionService.saveBatch(partsPermissionList); + } + if (!processSpecVersionPermissionList.isEmpty()) { + processSpecVersionPermissionService.saveBatch(processSpecVersionPermissionList); } if (!processionPermissionList.isEmpty()) { iProcessStreamPermissionService.saveBatch(processionPermissionList); @@ -991,11 +1042,12 @@ iWorkStepPermissionService.saveBatch(workStepPermissionList); } if (!permissionStreamList.isEmpty()) { - permissionStreamService.saveBatch(permissionStreamList); + permissionStreamNewService.saveBatch(permissionStreamList); } } - private void processStreamApi(String productId, Collection<SysUser> userList, List<ProcessionPermission> processionPermissionList, List<WorkStepPermission> workStepPermissionList, List<PermissionStream> permissionStreamList, List<ProcessStream> processStreamList) { + private void processStreamApi(String productId, Collection<SysUser> userList, List<ProcessionPermission> processionPermissionList, + List<WorkStepPermission> workStepPermissionList, List<PermissionStreamNew> permissionStreamList, List<ProcessStream> processStreamList) { if (processStreamList != null && !processStreamList.isEmpty()) { List<String> processIds = processStreamList.stream() .map(ProcessStream::getProcessId) @@ -1012,7 +1064,7 @@ } private void handleComponentPermissions(List<String> componentIds, Collection<SysUser> userList, - List<ComponentPermission> componentPermissionList, List<PermissionStream> permissionStreamList) { + List<ComponentPermission> componentPermissionList, List<PermissionStreamNew> permissionStreamList) { Map<String, ComponentPermission> componentPermissionMap = new HashMap<>(); Map<String, ComponentInfo> componentInfoMap = new HashMap<>(); String key; @@ -1034,16 +1086,16 @@ ComponentPermission cp = entry.getValue(); componentPermissionList.add(cp); ComponentInfo cpInfo = componentInfoMap.get(cp.getComponentId()); - PermissionStream s = new PermissionStream(); - s.setProductId(cpInfo.getProductId()); - s.setComponentId(cpInfo.getComponentId()); + PermissionStreamNew s = new PermissionStreamNew(); + s.setBusinessId(cpInfo.getProductId()); + s.setBusinessType("1"); s.setUserId(cp.getUserId()); permissionStreamList.add(s); } } private void handlePartsPermissions(List<String> partsIds, Collection<SysUser> userList, - List<PartsPermission> partsPermissionList, List<PermissionStream> permissionStreamList) { + List<PartsPermission> partsPermissionList, List<PermissionStreamNew> permissionStreamList) { Map<String, PartsPermission> partsPermissionHashMap = new HashMap<>(); Map<String, PartsInfo> partsInfoMap = new HashMap<>(); String key; @@ -1065,17 +1117,47 @@ PartsPermission pp = entry.getValue(); partsPermissionList.add(pp); PartsInfo ptInfo = partsInfoMap.get(pp.getPartsId()); - PermissionStream s = new PermissionStream(); - s.setProductId(ptInfo.getProductId()); - s.setComponentId(ptInfo.getComponentId()); - s.setPartsId(ptInfo.getPartsId()); + PermissionStreamNew s = new PermissionStreamNew(); + s.setBusinessId(ptInfo.getPartsId()); + s.setBusinessType("3"); + s.setUserId(pp.getUserId()); + permissionStreamList.add(s); + } + } + + private void handlePsvPermissions(List<String> psvIds, Collection<SysUser> userList, + List<ProcessSpecVersionPermission> processSpecVersionPermissionList, List<PermissionStreamNew> permissionStreamList) { + Map<String, ProcessSpecVersionPermission> processSpecVersionPermissionMap = new HashMap<>(); + Map<String, ProcessSpecVersion> processStreamMap = new HashMap<>(); + String key; + for (ProcessSpecVersion p : processSpecVersionService.listByIds(psvIds)) { + processStreamMap.put(p.getId(), p); + for (SysUser u : userList) { + key = p.getId() + "," + u.getId(); + processSpecVersionPermissionMap.put(key, new ProcessSpecVersionPermission(p.getId(), u.getId())); + } + } + List<ProcessSpecVersionPermission> processSpecVersionPermissions = processSpecVersionPermissionService.getByPsvIdsAndUserIds(psvIds, userList.stream().map(SysUser::getId).collect(Collectors.toList())); + if (processSpecVersionPermissions != null && !processSpecVersionPermissions.isEmpty()) { + for (ProcessSpecVersionPermission processionPermission : processSpecVersionPermissions) { + key = processionPermission.getPsvId() + "," + processionPermission.getUserId(); + processSpecVersionPermissionMap.remove(key); + } + } + for (Map.Entry<String, ProcessSpecVersionPermission> entry : processSpecVersionPermissionMap.entrySet()) { + ProcessSpecVersionPermission pp = entry.getValue(); + processSpecVersionPermissionList.add(pp); + ProcessSpecVersion processSpecVersion = processStreamMap.get(pp.getPsvId()); + PermissionStreamNew s = new PermissionStreamNew(); + s.setBusinessId(processSpecVersion.getId()); + s.setBusinessType("4"); s.setUserId(pp.getUserId()); permissionStreamList.add(s); } } private void handleProcessPermissions(List<String> processIds, Collection<SysUser> userList, - List<ProcessionPermission> processionPermissionList, List<PermissionStream> permissionStreamList) { + List<ProcessionPermission> processionPermissionList, List<PermissionStreamNew> permissionStreamList) { Map<String, ProcessionPermission> processionPermissionHashMap = new HashMap<>(); Map<String, ProcessStream> processStreamMap = new HashMap<>(); String key; @@ -1097,18 +1179,16 @@ ProcessionPermission pp = entry.getValue(); processionPermissionList.add(pp); ProcessStream processStream = processStreamMap.get(pp.getProcessId()); - PermissionStream s = new PermissionStream(); - s.setProductId(processStream.getProductId()); - s.setComponentId(processStream.getComponentId()); - s.setPartsId(processStream.getPartsId()); - s.setProcessId(processStream.getProcessId()); + PermissionStreamNew s = new PermissionStreamNew(); + s.setBusinessId(processStream.getProcessId()); + s.setBusinessType("5"); s.setUserId(pp.getUserId()); permissionStreamList.add(s); } } private void handleWorkStepPermissions(List<String> workStepIds, Collection<SysUser> userList, - List<WorkStepPermission> workStepPermissionList, List<PermissionStream> permissionStreamList) { + List<WorkStepPermission> workStepPermissionList, List<PermissionStreamNew> permissionStreamList) { Map<String, WorkStepPermission> workStepPermissionHashMap = new HashMap<>(); Map<String, WorkStep> workStepHashMap = new HashMap<>(); String key; @@ -1130,12 +1210,9 @@ WorkStepPermission ws = entry.getValue(); workStepPermissionList.add(ws); WorkStep workStep = workStepHashMap.get(ws.getStepId()); - PermissionStream s = new PermissionStream(); - s.setProductId(workStep.getProductId()); - s.setComponentId(workStep.getComponentId()); - s.setPartsId(workStep.getPartsId()); - s.setProcessId(workStep.getProcessId()); - s.setStepId(workStep.getId()); + PermissionStreamNew s = new PermissionStreamNew(); + s.setBusinessId(workStep.getId()); + s.setBusinessType("6"); s.setUserId(ws.getUserId()); permissionStreamList.add(s); } @@ -1177,7 +1254,7 @@ ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } if (relativeFlag == 1) { - handleRelativePermissions(processStream.getProductId(), null, processStream.getProcessId(), null, userList); + handleRelativePermissions(processStream.getProductId(), null, processStream.getProcessId(), null,null, userList); } }else { result = processStreamService.assignAddDepart(processStream, mdcProductionList); @@ -1185,7 +1262,37 @@ ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } if (relativeFlag == 1) { - handleRelatedPermissions(processStream, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamService); + handleRelatedPermissions(processStream, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamNewService); + } + } + return true; + } + + private boolean handleProcessSpecVersion(String paramId, Integer relativeFlag, Collection<MdcProduction> mdcProductionList,Collection<SysUser> userList) { + ProcessSpecVersion processSpecVersion = processSpecVersionService.getById(paramId); + if (processSpecVersion == null) { + ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NOT_EXIST); + } + boolean hasPerm = checkProductPerm(4, processSpecVersion.getId()); + if (!hasPerm) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + boolean result; + if (userList!=null){ + result = processSpecVersionService.assignAddUser(processSpecVersion, userList); + if (!result) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + if (relativeFlag == 1) { + handleRelativePermissions(processSpecVersion.getProductId(), null, null,null, processSpecVersion.getId(), userList); + } + }else { + result = processSpecVersionService.assignAddDepart(processSpecVersion, mdcProductionList); + if (!result) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + if (relativeFlag == 1) { + handleRelatedPermissionsForProcessSpecVersion(processSpecVersion, mdcProductionList); } } return true; @@ -1207,7 +1314,7 @@ ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } if (relativeFlag == 1) { - handleRelativePermissions(partsInfo.getProductId(), null, null, partsInfo.getPartsId(), userList); + handleRelativePermissions(partsInfo.getProductId(), null, null, partsInfo.getPartsId(),null, userList); } }else { result = partsInfoService.assignAddDepart(partsInfo, mdcProductionList); @@ -1242,7 +1349,7 @@ List<String> componentIds = componentInfoList.stream() .map(ComponentInfo::getComponentId) .collect(Collectors.toList()); - handleRelativePermissions(productInfo.getProductId(), componentIds, null, null, userList); + handleRelativePermissions(productInfo.getProductId(), componentIds, null, null, null,userList); } } }else { @@ -1281,7 +1388,7 @@ .collect(Collectors.toList()); } componentIds.add(componentInfo.getComponentId()); - handleRelativePermissions(componentInfo.getProductId(), componentIds, null, null, userList); + handleRelativePermissions(componentInfo.getProductId(), componentIds, null, null,null, userList); } }else { result = componentInfoService.assignAddDepart(componentInfo, mdcProductionList); @@ -1295,7 +1402,8 @@ return true; } - private void handleRelatedPermissions(Object parentEntity, Collection<MdcProduction> mdcProductionList, IWorkStepService workStepService, IWorkStepDepartmentService workStepDepartmentService, IPermissionStreamService permissionStreamService) { + private void handleRelatedPermissions(Object parentEntity, Collection<MdcProduction> mdcProductionList, IWorkStepService workStepService, + IWorkStepDepartmentService workStepDepartmentService, IPermissionStreamNewService permissionStreamNewService) { String parentId = getParentId(parentEntity); List<WorkStep> workStepList = workStepService.list(new QueryWrapper<WorkStep>().eq("process_id", parentId)); if (workStepList == null || workStepList.isEmpty()) { @@ -1323,48 +1431,54 @@ } List<WorkStepDepartment> newWorkStepDepartments = new ArrayList<>(); - List<PermissionStream> newPermissionStreams = new ArrayList<>(); + List<PermissionStreamNew> newPermissionStreams = new ArrayList<>(); for (Map.Entry<String, WorkStepDepartment> entry : allPermissions.entrySet()) { WorkStepDepartment wsDep = entry.getValue(); newWorkStepDepartments.add(wsDep); WorkStep workStep = workStepMap.get(wsDep.getStepId()); - PermissionStream permStream = new PermissionStream(); - permStream.setProductId(workStep.getProductId()); - permStream.setComponentId(workStep.getComponentId()); - permStream.setPartsId(workStep.getPartsId()); - permStream.setProcessId(workStep.getProcessId()); - permStream.setStepId(workStep.getId()); + PermissionStreamNew permStream = new PermissionStreamNew(); + permStream.setBusinessId(workStep.getId()); + permStream.setBusinessType("6"); permStream.setDepartId(wsDep.getDepartId()); newPermissionStreams.add(permStream); } - if (!newWorkStepDepartments.isEmpty()) { workStepDepartmentService.saveBatch(newWorkStepDepartments); } if (!newPermissionStreams.isEmpty()) { - permissionStreamService.saveBatch(newPermissionStreams); + permissionStreamNewService.saveBatch(newPermissionStreams); } } private void handleRelatedPermissionsForParts(PartsInfo partsInfo, Collection<MdcProduction> mdcProductionList) { - // 澶勭悊宸ュ簭鏉冮檺 - handleProcessPermissions(partsInfo,null, mdcProductionList); - // 澶勭悊宸ユ鏉冮檺 - handleWorkStepPermissions(partsInfo, mdcProductionList); + // 澶勭悊宸ヨ壓瑙勭▼鐗堟湰 + List<ProcessSpecVersion> processSpecVersionList = processSpecVersionService.list(new QueryWrapper<ProcessSpecVersion>().eq("parts_id", partsInfo.getPartsId())); + processSpecVersionList.forEach(item->{ + processSpecVersionService.assignAddDepart(item, mdcProductionList); + handleRelatedPermissionsForProcessSpecVersion(item, mdcProductionList); + }); } - private void handleProcessPermissions(PartsInfo partsInfo,ComponentInfo componentInfo,Collection<MdcProduction> mdcProductionList) { + private void handleRelatedPermissionsForProcessSpecVersion(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> mdcProductionList) { + // 澶勭悊宸ュ簭鏉冮檺 + handleProcessPermissions(processSpecVersion,null, mdcProductionList); + // 澶勭悊宸ユ鏉冮檺 + handleWorkStepPermissions(processSpecVersion, mdcProductionList); + + } + + private void handleProcessPermissions(ProcessSpecVersion processSpecVersion,ComponentInfo componentInfo,Collection<MdcProduction> mdcProductionList) { List<ProcessStream> processStreamList=new ArrayList<>(); if (componentInfo != null) { processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("component_id", componentInfo.getComponentId())); }else { - processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsInfo.getPartsId())); + processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", processSpecVersion.getId())); } if (processStreamList == null || processStreamList.isEmpty()) { return; } processStreamList.forEach(item->{ - handleRelatedPermissions(item, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamService); + handleRelatedPermissions(item, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamNewService); }); Map<String, ProcessionDepartment> allProcessPermissions = new HashMap<>(); Map<String, ProcessStream> processStreamMap = new HashMap<>(); @@ -1388,16 +1502,14 @@ } List<ProcessionDepartment> newProcessPermissions = new ArrayList<>(); - List<PermissionStream> newPermissionStreams = new ArrayList<>(); + List<PermissionStreamNew> newPermissionStreams = new ArrayList<>(); for (Map.Entry<String, ProcessionDepartment> entry : allProcessPermissions.entrySet()) { ProcessionDepartment procDep = entry.getValue(); newProcessPermissions.add(procDep); ProcessStream processStream = processStreamMap.get(procDep.getProcessId()); - PermissionStream permStream = new PermissionStream(); - permStream.setProductId(processStream.getProductId()); - permStream.setComponentId(processStream.getComponentId()); - permStream.setPartsId(processStream.getPartsId()); - permStream.setProcessId(processStream.getProcessId()); + PermissionStreamNew permStream = new PermissionStreamNew(); + permStream.setBusinessId(processStream.getProcessId()); + permStream.setBusinessType("5"); permStream.setDepartId(procDep.getDepartId()); newPermissionStreams.add(permStream); } @@ -1406,22 +1518,22 @@ processionDepartmentService.saveBatch(newProcessPermissions); } if (!newPermissionStreams.isEmpty()) { - permissionStreamService.saveBatch(newPermissionStreams); + permissionStreamNewService.saveBatch(newPermissionStreams); } } - private void handleWorkStepPermissions(PartsInfo partsInfo, Collection<MdcProduction> mdcProductionList) { - List<ProcessStream> processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsInfo.getPartsId())); + private void handleWorkStepPermissions(ProcessSpecVersion processSpecVersion, Collection<MdcProduction> mdcProductionList) { + List<ProcessStream> processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", processSpecVersion.getId())); if (processStreamList == null || processStreamList.isEmpty()) { return; } List<String> processIds = processStreamList.stream().map(ProcessStream::getProcessId).collect(Collectors.toList()); - List<WorkStep> workStepList = workStepService.getByProcessIds(partsInfo.getProductId(), processIds); + List<WorkStep> workStepList = workStepService.getByProcessIds(processSpecVersion.getProductId(), processIds); if (workStepList == null || workStepList.isEmpty()) { return; } workStepList.forEach(item->{ - handleRelatedPermissions(item, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamService); + handleRelatedPermissions(item, mdcProductionList, workStepService, workStepDepartmentService, permissionStreamNewService); }); } @@ -1463,14 +1575,14 @@ } List<ComponentDepartment> newComponentPermissions = new ArrayList<>(); - List<PermissionStream> newPermissionStreams = new ArrayList<>(); + List<PermissionStreamNew> newPermissionStreams = new ArrayList<>(); for (Map.Entry<String, ComponentDepartment> entry : allComponentPermissions.entrySet()) { ComponentDepartment compDep = entry.getValue(); newComponentPermissions.add(compDep); ComponentInfo componentInfo = componentInfoMap.get(compDep.getComponentId()); - PermissionStream permStream = new PermissionStream(); - permStream.setProductId(componentInfo.getProductId()); - permStream.setComponentId(componentInfo.getComponentId()); + PermissionStreamNew permStream = new PermissionStreamNew(); + permStream.setBusinessId(componentInfo.getComponentId()); + permStream.setBusinessType("2"); permStream.setDepartId(compDep.getDepartId()); newPermissionStreams.add(permStream); } @@ -1479,7 +1591,7 @@ componentDepartmentService.saveBatch(newComponentPermissions); } if (!newPermissionStreams.isEmpty()) { - permissionStreamService.saveBatch(newPermissionStreams); + permissionStreamNewService.saveBatch(newPermissionStreams); } } @@ -1537,14 +1649,14 @@ } List<ComponentDepartment> newComponentPermissions = new ArrayList<>(); - List<PermissionStream> newPermissionStreams = new ArrayList<>(); + List<PermissionStreamNew> newPermissionStreams = new ArrayList<>(); for (Map.Entry<String, ComponentDepartment> entry : allComponentPermissions.entrySet()) { ComponentDepartment compDep = entry.getValue(); newComponentPermissions.add(compDep); childComponent = componentInfoMap.get(compDep.getComponentId()); - PermissionStream permStream = new PermissionStream(); - permStream.setProductId(childComponent.getProductId()); - permStream.setComponentId(childComponent.getComponentId()); + PermissionStreamNew permStream = new PermissionStreamNew(); + permStream.setBusinessId(childComponent.getComponentId()); + permStream.setBusinessType("2"); permStream.setDepartId(compDep.getDepartId()); newPermissionStreams.add(permStream); } @@ -1553,7 +1665,7 @@ componentDepartmentService.saveBatch(newComponentPermissions); } if (!newPermissionStreams.isEmpty()) { - permissionStreamService.saveBatch(newPermissionStreams); + permissionStreamNewService.saveBatch(newPermissionStreams); } } } @@ -1564,6 +1676,7 @@ return; } for (PartsInfo partsInfo : partsInfoList) { + partsInfoService.assignAddDepart(partsInfo, mdcProductionList); handleRelatedPermissionsForParts(partsInfo, mdcProductionList); } } @@ -1579,77 +1692,6 @@ /**绉婚櫎鏉冮檺*/ - - private boolean handleWorkStepRemoval(String paramId, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) { - WorkStep workStep = workStepService.getById(paramId); - if (workStep == null) { - ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST); - } - checkProductPerm(6, workStep.getId()); - if (userList!=null){ - return workStepService.assignRemoveUser(workStep, userList); - }else { - return workStepService.assignRemoveDepart(workStep, mdcProductionList); - } - } - - private boolean handleProcessStreamRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) { - ProcessStream processStream = processStreamService.getById(paramId); - if (processStream == null) { - ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); - } - checkProductPerm(5, processStream.getProcessId()); - boolean result; - if (userList!=null){ - result = processStreamService.assignRemoveUser(processStream, userList); - if (!result) { - ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); - } - if (relativeFlag == 1) { - handleRelatedRemovals(processStream.getProcessId(), userList, - workStepService, iWorkStepPermissionService, permissionStreamService, - "process_id"); - } - }else { - result = processStreamService.assignRemoveDepart(processStream, mdcProductionList); - if (!result) { - ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); - } - if (relativeFlag == 1) { - handleRelatedDepartmentRemovals(processStream.getProcessId(), mdcProductionList, - workStepService, workStepDepartmentService, permissionStreamService, - "process_id"); - } - } - return true; - } - - private boolean handlePartsInfoRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) { - PartsInfo partsInfo = partsInfoService.getById(paramId); - if (partsInfo == null) { - ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); - } - checkProductPerm(3, partsInfo.getPartsId()); - boolean result; - if (userList!=null){ - result = partsInfoService.assignRemoveUser(partsInfo, userList); - if (!result) { - ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); - } - if (relativeFlag == 1) { - handlePartsRelatedRemovals(null,partsInfo, userList); - } - }else { - result = partsInfoService.assignRemoveDepart(partsInfo, mdcProductionList); - if (!result) { - ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); - } - if (relativeFlag == 1) { - handlePartsRelatedDepartmentRemovals(null,partsInfo, mdcProductionList); - } - } - return true; - } private boolean handleProductInfoRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) { ProductInfo productInfo = super.getById(paramId); @@ -1705,10 +1747,108 @@ return true; } + private boolean handlePartsInfoRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) { + PartsInfo partsInfo = partsInfoService.getById(paramId); + if (partsInfo == null) { + ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); + } + checkProductPerm(3, partsInfo.getPartsId()); + boolean result; + if (userList!=null){ + result = partsInfoService.assignRemoveUser(partsInfo, userList); + if (!result) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + if (relativeFlag == 1) { + handlePartRelatedRemovals(partsInfo, userList); + } + }else { + result = partsInfoService.assignRemoveDepart(partsInfo, mdcProductionList); + if (!result) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + if (relativeFlag == 1) { + handlePartRelatedDepartmentRemovals(partsInfo, mdcProductionList); + } + } + return true; + } + + private boolean handleProcessSpecVersionRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) { + ProcessSpecVersion processSpecVersion = processSpecVersionService.getById(paramId); + if (processSpecVersion == null) { + ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NOT_EXIST); + } + checkProductPerm(4, processSpecVersion.getPartsId()); + boolean result; + if (userList!=null){ + result = processSpecVersionService.assignRemoveUser(processSpecVersion, userList); + if (!result) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + if (relativeFlag == 1) { + handleProcessSpecVersionRelatedRemovals(null,processSpecVersion, userList); + } + }else { + result = processSpecVersionService.assignRemoveDepart(processSpecVersion, mdcProductionList); + if (!result) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + if (relativeFlag == 1) { + handleProcessSpecVersionRelatedDepartmentRemovals(null,processSpecVersion, mdcProductionList); + } + } + return true; + } + + private boolean handleProcessStreamRemoval(String paramId, Integer relativeFlag, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) { + ProcessStream processStream = processStreamService.getById(paramId); + if (processStream == null) { + ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); + } + checkProductPerm(5, processStream.getProcessId()); + boolean result; + if (userList!=null){ + result = processStreamService.assignRemoveUser(processStream, userList); + if (!result) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + if (relativeFlag == 1) { + handleRelatedRemovals(processStream.getProcessId(), userList, + workStepService, iWorkStepPermissionService, permissionStreamNewService, + "process_id"); + } + }else { + result = processStreamService.assignRemoveDepart(processStream, mdcProductionList); + if (!result) { + ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); + } + if (relativeFlag == 1) { + handleRelatedDepartmentRemovals(processStream.getProcessId(), mdcProductionList, + workStepService, workStepDepartmentService, permissionStreamNewService, + "process_id"); + } + } + return true; + } + + private boolean handleWorkStepRemoval(String paramId, Collection<SysUser> userList, Collection<MdcProduction> mdcProductionList) { + WorkStep workStep = workStepService.getById(paramId); + if (workStep == null) { + ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST); + } + checkProductPerm(6, workStep.getId()); + if (userList!=null){ + return workStepService.assignRemoveUser(workStep, userList); + }else { + return workStepService.assignRemoveDepart(workStep, mdcProductionList); + } + } + private void handleRelatedRemovals(String parentId, Collection<SysUser> userList, IWorkStepService workStepService, IWorkStepPermissionService workStepPermissionService, - IPermissionStreamService permissionStreamService, + IPermissionStreamNewService permissionStreamNewService, String queryField) { List<WorkStep> workStepList = workStepService.list(new QueryWrapper<WorkStep>().eq(queryField, parentId)); if (workStepList.isEmpty()) { @@ -1717,20 +1857,20 @@ List<String> workStepIds = workStepList.stream().map(WorkStep::getId).collect(Collectors.toList()); List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList()); List<WorkStepPermission> workStepPermissions = workStepPermissionService.getByStepIdsAndUserIds(workStepIds, userIdList); - List<PermissionStream> permissionStreams = permissionStreamService.getByPartsIdsAndDepartIds(workStepIds, userIdList); + List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndUserIds(workStepIds, userIdList,"6"); if (!workStepPermissions.isEmpty()) { workStepPermissionService.removeByCollection(workStepPermissions); } if (!permissionStreams.isEmpty()) { - permissionStreamService.removeByCollection(permissionStreams); + permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams); } } private void handleRelatedDepartmentRemovals(String parentId, Collection<MdcProduction> mdcProductionList, IWorkStepService workStepService, IWorkStepDepartmentService workStepDepartmentService, - IPermissionStreamService permissionStreamService, + IPermissionStreamNewService permissionStreamNewService, String queryField) { List<WorkStep> workStepList = workStepService.list(new QueryWrapper<WorkStep>().eq(queryField, parentId)); if (workStepList.isEmpty()) { @@ -1739,22 +1879,22 @@ List<String> workStepIds = workStepList.stream().map(WorkStep::getId).collect(Collectors.toList()); List<String> departmentIdList = mdcProductionList.stream().map(MdcProduction::getId).collect(Collectors.toList()); List<WorkStepDepartment> workStepDepartments = workStepDepartmentService.getByPartsIdsAndDepartIds(workStepIds, departmentIdList); - List<PermissionStream> permissionStreams = permissionStreamService.getByPartsIdsAndDepartIds(workStepIds, departmentIdList); + List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndDepartIds(workStepIds, departmentIdList,"6"); if (!workStepDepartments.isEmpty()) { workStepDepartmentService.removeByCollection(workStepDepartments); } if (!permissionStreams.isEmpty()) { - permissionStreamService.removeByCollection(permissionStreams); + permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams); } } - private void handlePartsRelatedRemovals(ComponentInfo componentInfo,PartsInfo partsInfo,Collection<SysUser> userList) { + private void handleProcessSpecVersionRelatedRemovals(ComponentInfo componentInfo,ProcessSpecVersion processSpecVersion,Collection<SysUser> userList) { List<ProcessStream> processStreamList =new ArrayList<>(); String productId=""; - if (partsInfo!=null){ - processStreamList= processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsInfo.getPartsId())); - productId=partsInfo.getProductId(); + if (processSpecVersion!=null){ + processStreamList= processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", processSpecVersion.getId())); + productId=processSpecVersion.getProductId(); }else { processStreamList= processStreamService.list(new QueryWrapper<ProcessStream>().eq("component_id", componentInfo.getComponentId()).isNull("parts_id")); productId=componentInfo.getProductId(); @@ -1770,13 +1910,13 @@ } List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList()); List<ProcessionPermission> processionPermissions = iProcessStreamPermissionService.getByProcessIdsAndUserIds(processIds, userIdList); - List<PermissionStream> permissionStreams = permissionStreamService.getByPartsIdsAndUserIds(processIds, userIdList); + List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndUserIds(processIds, userIdList,"5"); if (!processionPermissions.isEmpty()) { iProcessStreamPermissionService.removeByCollection(processionPermissions); } if (!permissionStreams.isEmpty()) { - permissionStreamService.removeByCollection(permissionStreams); + permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams); } } @@ -1786,13 +1926,13 @@ } List<String> departmentIdList = mdcProductionList.stream().map(MdcProduction::getId).collect(Collectors.toList()); List<ProcessionDepartment> processionDepartments = processionDepartmentService.getByPartsIdsAndDepartIds(processIds, departmentIdList); - List<PermissionStream> permissionStreams = permissionStreamService.getByPartsIdsAndDepartIds(processIds, departmentIdList); + List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndDepartIds(processIds, departmentIdList,"5"); if (!processionDepartments.isEmpty()) { processionDepartmentService.removeByCollection(processionDepartments); } if (!permissionStreams.isEmpty()) { - permissionStreamService.removeByCollection(permissionStreams); + permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams); } } @@ -1800,7 +1940,7 @@ List<WorkStep> workStepList = workStepService.getByProcessIds(productId, processIds); if (workStepList!=null){ workStepList.forEach(item->{ - handleRelatedRemovals(item.getProcessId(), userList, workStepService, iWorkStepPermissionService, permissionStreamService, "process_id"); + handleRelatedRemovals(item.getProcessId(), userList, workStepService, iWorkStepPermissionService, permissionStreamNewService, "process_id"); }); } } @@ -1809,7 +1949,7 @@ List<WorkStep> workStepList = workStepService.getByProcessIds(productId, processIds); if (workStepList!=null){ workStepList.forEach(item->{ - handleRelatedDepartmentRemovals(item.getProcessId(), mdcProductionList, workStepService, workStepDepartmentService, permissionStreamService, "process_id"); + handleRelatedDepartmentRemovals(item.getProcessId(), mdcProductionList, workStepService, workStepDepartmentService, permissionStreamNewService, "process_id"); }); } } @@ -1820,8 +1960,30 @@ handleComponentRemovals(componentIds, userList); handlePartsRemovals(productInfo.getProductId(), componentIds, userList); componentInfoList.forEach(item->{ - handlePartsRelatedRemovals(item,null, userList); + handleProcessSpecVersionRelatedRemovals(item,null, userList); }); + } + + private void handlePartRelatedRemovals(PartsInfo partsInfo, Collection<SysUser> userList) { + List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByPartsId(partsInfo.getPartsId()); + if (processSpecVersions!=null){ + List<String> psvIds = processSpecVersions.stream().map(ProcessSpecVersion::getId).collect(Collectors.toList()); + handleProcessSpecVersionRemovals(psvIds, userList); + processSpecVersions.forEach(item->{ + handleProcessSpecVersionRelatedRemovals(null,item, userList); + }); + } + } + + private void handlePartRelatedDepartmentRemovals(PartsInfo partsInfo, Collection<MdcProduction> mdcProductionList) { + List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.getByPartsId(partsInfo.getPartsId()); + if (processSpecVersions!=null){ + List<String> psvIds = processSpecVersions.stream().map(ProcessSpecVersion::getId).collect(Collectors.toList()); + handleProcessSpecVersionDepartmentRemovals(psvIds, mdcProductionList); + processSpecVersions.forEach(item->{ + handleProcessSpecVersionRelatedDepartmentRemovals(null,item, mdcProductionList); + }); + } } private void handleProductRelatedDepartmentRemovals(ProductInfo productInfo, Collection<MdcProduction> mdcProductionList) { @@ -1830,7 +1992,7 @@ handleComponentDepartmentRemovals(componentIds, mdcProductionList); handlePartsDepartmentRemovals(productInfo.getProductId(), componentIds, mdcProductionList); componentInfoList.forEach(item->{ - handlePartsRelatedDepartmentRemovals(item,null, mdcProductionList); + handleProcessSpecVersionRelatedDepartmentRemovals(item,null, mdcProductionList); }); } @@ -1840,15 +2002,46 @@ } List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList()); List<ComponentPermission> componentPermissions = componentPermissionService.getByComponentIdsAndUserIds(componentIds, userIdList); - List<PermissionStream> permissionStreams = permissionStreamService.getByComponentIdsAndUserIds(componentIds, userIdList); + List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndUserIds(componentIds, userIdList,"2"); if (!componentPermissions.isEmpty()) { componentPermissionService.removeByCollection(componentPermissions); } if (!permissionStreams.isEmpty()) { - permissionStreamService.removeByCollection(permissionStreams); + permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams); } } + + private void handleProcessSpecVersionRemovals(List<String> psvIds, Collection<SysUser> userList) { + if (psvIds.isEmpty()) { + return; + } + List<String> userIdList = userList.stream().map(SysUser::getId).collect(Collectors.toList()); + List<ProcessSpecVersionPermission> processSpecVersionPermissions = processSpecVersionPermissionService.getByPsvIdsAndUserIds(psvIds, userIdList); + List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndUserIds(psvIds, userIdList,"4"); + if (!processSpecVersionPermissions.isEmpty()) { + processSpecVersionPermissionService.removeByCollection(processSpecVersionPermissions); + } + if (!permissionStreams.isEmpty()) { + permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams); + } + } + + private void handleProcessSpecVersionDepartmentRemovals(List<String> psvIds, Collection<MdcProduction> mdcProductionList) { + if (psvIds.isEmpty()) { + return; + } + List<String> departmentIdList = mdcProductionList.stream().map(MdcProduction::getId).collect(Collectors.toList()); + List<ProcessSpecVersionDepartment> processSpecVersionDepartments =processSpecVersionDepartmentService.getByPsvIdsAndDepartIds(psvIds, departmentIdList); + List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndDepartIds(psvIds, departmentIdList,"4"); + if (!processSpecVersionDepartments.isEmpty()) { + processSpecVersionDepartmentService.removeByCollection(processSpecVersionDepartments); + } + if (!permissionStreams.isEmpty()) { + permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams); + } + } + private void handleComponentDepartmentRemovals(List<String> componentIds, Collection<MdcProduction> mdcProductionList) { if (componentIds.isEmpty()) { @@ -1856,28 +2049,29 @@ } List<String> departmentIdList = mdcProductionList.stream().map(MdcProduction::getId).collect(Collectors.toList()); List<ComponentDepartment> componentDepartments = componentDepartmentService.getByComponentIdsAndDepartIds(componentIds, departmentIdList); - List<PermissionStream> permissionStreams = permissionStreamService.getByComponentIdsAndDepartIds(componentIds, departmentIdList); + List<PermissionStreamNew> permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdsAndDepartIds(componentIds, departmentIdList,"2"); if (!componentDepartments.isEmpty()) { componentDepartmentService.removeByCollection(componentDepartments); } if (!permissionStreams.isEmpty()) { - permissionStreamService.removeByCollection(permissionStreams); + permissionStreamNewService.deletePermissionStreamNewByList(permissionStreams); } } - private void handlePartsRemovals(String productId, List<String> componentIds, Collection<SysUser> userList) { + private void handlePartsRemovals(String productId, List<String> componentIds,Collection<SysUser> userList) { List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(productId, componentIds); partsInfoList.forEach(item->{ partsInfoService.assignRemoveUser(item,userList); - handlePartsRelatedRemovals(null,item, userList); + //鍒犻櫎 + handlePartRelatedRemovals(item, userList); }); } private void handlePartsDepartmentRemovals(String productId, List<String> componentIds, Collection<MdcProduction> mdcProductionList) { List<PartsInfo> partsInfoList = partsInfoService.getByComponentIdList(productId, componentIds); partsInfoList.forEach(item->{ partsInfoService.assignRemoveDepart(item,mdcProductionList); - handlePartsRelatedDepartmentRemovals(null,item, mdcProductionList); + handlePartRelatedDepartmentRemovals(item, mdcProductionList); }); } @@ -1893,7 +2087,7 @@ handlePartsDepartmentRemovals(componentInfo.getProductId(), componentIds, mdcProductionList); if (childrenList != null) { childrenList.forEach(item->{ - handlePartsRelatedDepartmentRemovals(item,null, mdcProductionList); + handleProcessSpecVersionRelatedDepartmentRemovals(item,null, mdcProductionList); }); } }else { @@ -1901,21 +2095,21 @@ handlePartsRemovals(componentInfo.getProductId(), componentIds, userList); if (childrenList != null) { childrenList.forEach(item->{ - handlePartsRelatedRemovals(item,null, userList); + handleProcessSpecVersionRelatedRemovals(item,null, userList); }); } } } - private void handlePartsRelatedDepartmentRemovals(ComponentInfo componentInfo,PartsInfo partsInfo, Collection<MdcProduction> mdcProductionList) { + private void handleProcessSpecVersionRelatedDepartmentRemovals(ComponentInfo componentInfo,ProcessSpecVersion processSpecVersion, Collection<MdcProduction> mdcProductionList) { List<ProcessStream> processStreamList=new ArrayList<>(); String productId=""; if (componentInfo!=null){ processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("component_id", componentInfo.getComponentId())); productId=componentInfo.getProductId(); }else { - processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("parts_id", partsInfo.getPartsId())); - productId=partsInfo.getProductId(); + processStreamList = processStreamService.list(new QueryWrapper<ProcessStream>().eq("psv_id", processSpecVersion.getId())); + productId=processSpecVersion.getProductId(); } List<String> processIds = processStreamList.stream().map(ProcessStream::getProcessId).collect(Collectors.toList()); handleProcessDepartmentRemovals(processIds, mdcProductionList); diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductMixServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductMixServiceImpl.java new file mode 100644 index 0000000..9e0d90f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductMixServiceImpl.java @@ -0,0 +1,35 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.api.vo.Result; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.entity.ProductMix; +import org.jeecg.modules.dnc.mapper.ProductMixMapper; +import org.jeecg.modules.dnc.service.IPermissionStreamNewService; +import org.jeecg.modules.dnc.service.IProductMixService; +import org.jeecg.modules.dnc.utils.TreeBuilder; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import java.util.List; + +@Service +public class ProductMixServiceImpl extends ServiceImpl<ProductMixMapper, ProductMix> implements IProductMixService { + + @Autowired + private IPermissionStreamNewService permissionStreamNewService; + + @Override + public List<ProductMix> getTree() { + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + List<ProductMix> rawData = permissionStreamNewService.loadProductMix(loginUser.getId()); + TreeBuilder builder = new TreeBuilder(); + TreeBuilder.CleanResult cleanResult = builder.preprocessData(rawData); + List<ProductMix> sorted = builder.topologicalSort( + cleanResult.getValidNodes(), + cleanResult.getNodeMap() + ); + return builder.assembleTree(sorted, cleanResult.getNodeMap()); + } +} \ No newline at end of file diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java index ad31cdc..dec1d4f 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductPermissionServiceImpl.java @@ -17,6 +17,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.annotation.Resource; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -27,6 +28,8 @@ private IComponentPermissionService componentPermissionService; @Autowired private IPartsPermissionService partsPermissionService; + @Resource + private IProcessSpecVersionPermissionService processSpecVersionPermissionService; @Autowired private IProcessStreamPermissionService processStreamPermissionService; @Autowired @@ -127,6 +130,9 @@ // 闆朵欢鏉冮檺 partsPermissionService.save(new PartsPermission(id, userId)); break; + case "4": + //宸ヨ壓瑙勭▼鐗堟湰鍙� + processSpecVersionPermissionService.save(new ProcessSpecVersionPermission(id, userId)); case "5": // 宸ュ簭鏉冮檺 processStreamPermissionService.save(new ProcessionPermission(id, userId)); diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java index cdbe6cf..d4dd1eb 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java @@ -39,9 +39,8 @@ */ @Service public class WorkStepServiceImpl extends ServiceImpl<WorkStepMapper, WorkStep> implements IWorkStepService { - @Autowired - private IPermissionStreamService permissionStreamService; + private IPermissionStreamNewService permissionStreamNewService; @Autowired private IWorkStepDepartmentService workStepDepartmentService; @@ -112,23 +111,43 @@ boolean b =super.save(workStep); if(!b) ExceptionCast.cast(CommonCode.FAIL); - //娣诲姞鐢ㄦ埛鏉冮檺 + //娣诲姞閮ㄩ棬鏉冮檺 + List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(workStep.getProcessId(),"5","1"); + if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { + List<WorkStepDepartment> workStepDepartmentList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); + oldDepartPermList.forEach(item -> { + WorkStepDepartment pd = new WorkStepDepartment(); + pd.setDepartId(item.getDepartId()); + pd.setStepId(workStep.getId()); + workStepDepartmentList.add(pd); + PermissionStreamNew perm = new PermissionStreamNew(); + perm.setBusinessId(workStep.getId()); + perm.setBusinessType("6"); + permissionStreamList.add(perm); + }); + if(!workStepDepartmentList.isEmpty()) { + b = workStepDepartmentService.saveBatch(workStepDepartmentList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + if(!permissionStreamList.isEmpty()) { + b = permissionStreamNewService.saveBatch(permissionStreamList); + if(!b) + ExceptionCast.cast(CommonCode.FAIL); + } + } //娣诲姞鐢ㄦ埛鏉冮檺 b = productPermissionService.add(workStep.getId(), userId,"6"); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } //娣诲姞鏉冮檺楠岃瘉 - PermissionStream permissionStream = new PermissionStream(); + PermissionStreamNew permissionStream = new PermissionStreamNew(); permissionStream.setUserId(userId); - permissionStream.setProductId(workStep.getProductId()); - permissionStream.setComponentId(workStep.getComponentId()); - if (StrUtil.isNotEmpty(workStep.getPartsId())){ - permissionStream.setPartsId(workStep.getPartsId()); - } - permissionStream.setProcessId(workStep.getProcessId()); - permissionStream.setStepId(workStep.getId()); - return permissionStreamService.save(permissionStream); + permissionStream.setBusinessId(workStep.getId()); + permissionStream.setBusinessType("6"); + return permissionStreamNewService.save(permissionStream); } /** @@ -146,13 +165,6 @@ WorkStep en = super.getById(id); if(en == null) ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST); -// workStep.setStepId(id); -// workStep.setProductId(null); -// workStep.setComponentId(null); -// workStep.setPartsId(null); -// workStep.setProcessId(null); -// workStep.setStepName(workStep.getStepName().toUpperCase()); -// workStep.setStepCode(null); return super.updateById(workStep); } @@ -174,7 +186,7 @@ if(workStep == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<WorkStepDepartment> workStepDepartmentList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { WorkStepDepartment en = workStepDepartmentService.getByStepIdAndDepartId(workStep.getId(), item.getId()); if(en == null) { @@ -183,16 +195,12 @@ en.setStepId(workStep.getId()); workStepDepartmentList.add(en); } - PermissionStream stream = permissionStreamService.getByStepIdAndDepartId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId(),workStep.getProcessId(),workStep.getId(),item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(workStep.getId(),item.getId(),"6"); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); - stream.setProductId(workStep.getProductId()); - stream.setComponentId(workStep.getComponentId()); - stream.setPartsId(workStep.getPartsId()); - stream.setProcessId(workStep.getProcessId()); - stream.setStepId(workStep.getId()); - + stream.setBusinessId(workStep.getId()); + stream.setBusinessType("6"); permissionStreamList.add(stream); } }); @@ -203,7 +211,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -243,14 +251,13 @@ if(workStep == null || departmentList == null || departmentList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<WorkStepDepartment> workStepDepartmentList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); departmentList.forEach(item -> { WorkStepDepartment en = workStepDepartmentService.getByStepIdAndDepartId(workStep.getId(), item.getId()); if(en != null) { workStepDepartmentList.add(en); } - PermissionStream stream = permissionStreamService.getByStepIdAndDepartId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId() - ,workStep.getProcessId(),workStep.getId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(workStep.getId(),item.getId(),"6"); if(stream != null) { permissionStreamList.add(stream); } @@ -262,7 +269,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -295,7 +302,7 @@ if(workStep == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<WorkStepPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { WorkStepPermission en = workStepPermissionService.getByStepIdAndUserId(workStep.getId(), item.getId()); if(en == null) { @@ -304,16 +311,12 @@ en.setStepId(workStep.getId()); permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByStepIdAndUserId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId() - ,workStep.getProcessId(),workStep.getId(), item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),item.getId(),"6"); if(stream == null) { - stream = new PermissionStream(); + stream = new PermissionStreamNew(); stream.setUserId(item.getId()); - stream.setProductId(workStep.getProductId()); - stream.setComponentId(workStep.getComponentId()); - stream.setPartsId(workStep.getPartsId()); - stream.setProcessId(workStep.getProcessId()); - stream.setStepId(workStep.getId()); + stream.setBusinessId(workStep.getId()); + stream.setBusinessType("6"); permissionStreamList.add(stream); } }); @@ -324,7 +327,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.saveBatch(permissionStreamList); + boolean b = permissionStreamNewService.saveBatch(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } @@ -338,14 +341,13 @@ if(workStep == null || userList == null || userList.isEmpty()) ExceptionCast.cast(CommonCode.INVALID_PARAM); List<WorkStepPermission> permissionList = new ArrayList<>(); - List<PermissionStream> permissionStreamList = new ArrayList<>(); + List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); userList.forEach(item -> { WorkStepPermission en = workStepPermissionService.getByStepIdAndUserId(workStep.getId(), item.getId()); if(en != null) { permissionList.add(en); } - PermissionStream stream = permissionStreamService.getByStepIdAndUserId(workStep.getProductId(), workStep.getComponentId(), - workStep.getPartsId(),workStep.getProcessId(), workStep.getId(),item.getId()); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),item.getId(),"6"); if(stream != null) { permissionStreamList.add(stream); } @@ -358,7 +360,7 @@ } } if(!permissionStreamList.isEmpty()) { - boolean b = permissionStreamService.removeByCollection(permissionStreamList); + boolean b = permissionStreamNewService.deletePermissionStreamNewByList(permissionStreamList); if(!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_USER_PERM_ERROR); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java index cfbbd53..7e2d0c5 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/support/ProductTreeWrapper.java @@ -14,15 +14,18 @@ public class ProductTreeWrapper { public static List<CommonGenericTree> loadTree(List<ProductInfo> productInfoList, List<ComponentExt> componentInfoList, - List<PartsInfo> partsInfoList,List<ProcessStream> processStreams, List<WorkStep> workStepList) { + List<PartsInfo> partsInfoList,List<ProcessSpecVersion> processSpecVersionList, + List<ProcessStream> processStreams, List<WorkStep> workStepList) { List<CommonGenericTree> tree = new ArrayList<CommonGenericTree>();// TreeNode闆嗗悎锛屽瓨鏀炬墍鏈夋爲瀵硅薄銆� Map<String, CommonGenericTree> productMap = new HashMap<>(); Map<String, CommonGenericTree> componentMap = new HashMap<>(); Map<String, CommonGenericTree> partsMap = new HashMap<>(); + Map<String, CommonGenericTree> pvsMap = new HashMap<>(); Map<String, CommonGenericTree> processMap = new HashMap<>(); CommonGenericTree<ProductInfo> node; CommonGenericTree<ComponentInfo> componentNode; CommonGenericTree<PartsInfo> partsNode; + CommonGenericTree<ProcessSpecVersion> pvsNode; CommonGenericTree<ProcessStream> processNode; CommonGenericTree<WorkStep> workStepNode; for(ProductInfo productInfo : productInfoList) { @@ -64,7 +67,25 @@ partsMap.put(parts.getPartsId(), partsNode); } - //宸ュ簭瀛樺湪閮ㄤ欢鎴栬�呴浂浠朵笅 + //宸ヨ壓瑙勭▼鐗堟湰瀛樺湪闆朵欢涓� + for(ProcessSpecVersion processSpecVersion : processSpecVersionList) { + pvsNode = new CommonGenericTree(); + pvsNode.setId(processSpecVersion.getId()); + pvsNode.setLabel("[" + processSpecVersion.getProcessSpecVersionCode()+ "]" + processSpecVersion.getProcessSpecVersionName()); + pvsNode.setParentId(null); + pvsNode.setIconClass(""); + pvsNode.setType(4); + pvsNode.setRField(processSpecVersion.getPartsId()); + pvsNode.setEntity(processSpecVersion); + if(partsMap.containsKey(pvsNode.getRField())) { + partsNode = partsMap.get(pvsNode.getRField()); + pvsNode.setParentId(partsNode.getId()); + partsNode.addChildren(pvsNode); + } + pvsMap.put(processSpecVersion.getId(),pvsNode); + } + + //宸ュ簭瀛樺湪閮ㄤ欢鎴栬�呭伐鑹鸿绋嬬増鏈笅 for(ProcessStream processStream : processStreams) { processNode = new CommonGenericTree(); processNode.setId(processStream.getProcessId()); @@ -72,7 +93,7 @@ processNode.setParentId(null); processNode.setIconClass(""); processNode.setType(5); - if (StrUtil.isEmpty(processStream.getPartsId())) { + if (StrUtil.isEmpty(processStream.getPsvId())) { //娌℃湁partsId锛岄儴浠朵笅鐨勫伐搴� processNode.setRField(processStream.getComponentId()); processNode.setEntity(processStream); @@ -82,13 +103,13 @@ componentNode.addChildren(processNode); } }else { - //鏈塸artsId锛岄浂浠朵笅鐨勫伐搴� - processNode.setRField(processStream.getPartsId()); + //鏈塸svId锛岄浂浠朵笅鐨勫伐搴� + processNode.setRField(processStream.getPsvId()); processNode.setEntity(processStream); - if(partsMap.containsKey(processNode.getRField())) { - partsNode = partsMap.get(processNode.getRField()); - processNode.setParentId(partsNode.getId()); - partsNode.addChildren(processNode); + if(pvsMap.containsKey(processNode.getRField())) { + pvsNode = pvsMap.get(processNode.getRField()); + processNode.setParentId(pvsNode.getId()); + pvsNode.addChildren(processNode); } } processMap.put(processStream.getProcessId(),processNode); diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/flow/service/impl/AssignFileStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/flow/service/impl/AssignFileStreamServiceImpl.java index b4b380b..ae4f369 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/flow/service/impl/AssignFileStreamServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/flow/service/impl/AssignFileStreamServiceImpl.java @@ -75,7 +75,7 @@ @Autowired private IWorkStepService workStepService; @Autowired - private IPermissionStreamService permissionStreamService; + private IPermissionStreamNewService permissionStreamNewService; @Autowired private IDocClassificationService classificationService; @Autowired @@ -92,8 +92,6 @@ private ISynchronizedFlagService synchronizedFlagService; @Autowired private IDeviceGroupService deviceGroupService; - @Autowired - private IDncPassLogService dncPassLogService; @Autowired private IDeviceCharactersService iDeviceCharactersService; @Autowired @@ -206,7 +204,7 @@ if (deviceDoc != null) { handleExistingDeviceDoc(docFile, mdcEquipment, stream.getDeviceId()); } - List<PermissionStream> permissionStreams = getPermissionStreams(stream); + PermissionStreamNew permissionStreams = getPermissionStreams(stream); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = user.getId(); saveBusinessObject(stream, userId); @@ -575,8 +573,9 @@ } //鏉冮檺鏍¢獙 - private List<PermissionStream> getPermissionStreams(AssignFileStream stream) { - List<PermissionStream> permissionStreams = new ArrayList<>(); + private PermissionStreamNew getPermissionStreams(AssignFileStream stream) { + PermissionStreamNew permissionStreams; + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); if (stream.getAttributionType().equals("5")) { // 宸ュ簭 ProcessStream processStream = processStreamService.getById(stream.getAttributionId()); @@ -587,8 +586,7 @@ stream.setComponentId(processStream.getComponentId()); stream.setPartsId(processStream.getPartsId()); stream.setProcessId(processStream.getProcessId()); - permissionStreams = permissionStreamService - .getByProcessId(processStream.getProductId(), processStream.getComponentId(), processStream.getPartsId(), processStream.getProcessId()); + permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(),user.getId(),"5"); } else { // 宸ユ WorkStep workStep = workStepService.getById(stream.getAttributionId()); @@ -600,10 +598,9 @@ stream.setPartsId(workStep.getPartsId()); stream.setProcessId(workStep.getProcessId()); stream.setStepId(workStep.getId()); - permissionStreams = permissionStreamService - .getByStepId(workStep.getProductId(), workStep.getComponentId(), workStep.getPartsId(), workStep.getProcessId(), workStep.getId()); + permissionStreams = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),user.getId(),"6"); } - if (permissionStreams == null || permissionStreams.isEmpty()) { + if (permissionStreams == null ) { ExceptionCast.cast(ActivitiCode.ACT_NODE_DEPART_NONE); } return permissionStreams; @@ -713,44 +710,10 @@ if (strings != null && !strings.isEmpty()) { String path = StringUtils.join(strings.toArray(), "/"); Date dateFirst = DateUtil.getNow(); - DncPassLog passInfoTxt = new DncPassLog(); - passInfoTxt.setDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); - DncPassLog dncPassLog = dncPassLogService.findDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); - Integer fileTxt = 0, fileNc = 0; - if (dncPassLog != null) { - fileTxt = dncPassLog.getSequenceNumber() + 1; - fileNc = fileTxt + 1; - } else { - fileTxt = 1; - fileNc = fileTxt + 1; - } - String sequence = String.format("%06d", fileTxt); - String sequenceNc = String.format("%06d", fileNc); - passInfoTxt.setSequenceNumber(fileTxt); - passInfoTxt.setSequenceOrder(sequence); - passInfoTxt.setCreateTime(dateFirst); - passInfoTxt.setPassType("02"); - dncPassLogService.save(passInfoTxt); - - DncPassLog passInfoNc = new DncPassLog(); - passInfoNc.setSequenceNumber(fileNc); - passInfoNc.setSequenceOrder(sequenceNc); - passInfoNc.setDayTime(DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); - passInfoNc.setPassType("02"); - passInfoNc.setPassName(docFile.getFileName()); - try { - Thread.sleep(1000); - Date date = new Date(); - passInfoNc.setCreateTime(date); - } catch (InterruptedException e) { - Thread.currentThread().interrupt(); - } - dncPassLogService.save(passInfoNc); - NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); ncTxt.setEquipmentId(mdcEquipment.getEquipmentId()); - ncTxt.setFileNcName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY) + sequenceNc); - ncTxt.setFileTxtName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY) + sequence); + ncTxt.setFileNcName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); + ncTxt.setFileTxtName("02A" + DateUtil.format(dateFirst, DateUtil.STR_YEARMONTHDAY)); ncTxt.setFilePath(path + "/" + mdcEquipment.getEquipmentId() + "/"); ncTxt.setOrigFileName(docFile.getFileName()); ncTxt.setOrigFileSuffix(docFile.getFileSuffix()); diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java index 60f15e2..42b9355 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java @@ -28,6 +28,11 @@ List<String> recursionChildren(@Param("productionId") String productionId); /** + * 涓�缁刬d閫掑綊鎵�鏈夊瓙鑺傜偣 + */ + List<String> recursionChildrenByList(@Param("productionIds") List<String> productionIds); + + /** * 鏍规嵁鐢ㄦ埛id鍜岃溅闂磇d鑾峰彇鐢ㄦ埛鎷ユ湁鐨勮溅闂磇d * @param userId * @param productionId diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml index f5228ba..963f879 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml @@ -42,4 +42,30 @@ t3.id = #{userId} AND t1.org_type = '3' </select> + <select id="recursionChildrenByList" resultType="java.lang.String"> + WITH temp (id) AS ( + -- 鍒濆鏌ヨ锛岃幏鍙栨寚瀹� id 鐨勮褰� + SELECT + id + FROM + mdc_production + WHERE + id IN + <foreach collection = "productionIds" item = "id" index = "index" open = "(" close = ")" separator = ","> + #{id} + </foreach> + UNION ALL + -- 閫掑綊鏌ヨ锛屾煡鎵惧瓙鑺傜偣 + SELECT + a.id + FROM + mdc_production a + INNER JOIN temp ON a.parent_id = temp.id + ) +-- 鏈�缁堟煡璇紝浣跨敤 DISTINCT 鍘婚噸 + SELECT DISTINCT + id + FROM + temp; + </select> </mapper> diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java index ca00c50..95dcec9 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java @@ -111,4 +111,11 @@ * @return */ Map<String, MdcProduction> getUserAssignedDepart(String userId); + + /** + * 閫氳繃涓�缁刬d鑾峰彇閮ㄩ棬 + * @param ids + * @return + */ + List<String> findAllProductionIds(List<String> ids); } diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java index ceba76d..9b7711e 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java @@ -388,4 +388,14 @@ }); return map; } + + /** + * 閫氳繃涓�缁刬d鑾峰彇閮ㄩ棬 + * @param ids + * @return + */ + @Override + public List<String> findAllProductionIds(List<String> ids){ + return this.baseMapper.recursionChildrenByList(ids); + } } -- Gitblit v1.9.3