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> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ButtonController.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DeviceGroupController.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/NcLogInfoController.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ObjectController.java
ÎļþÒÑɾ³ý 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); } } 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; 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()); } } 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 = "å·¥æ¥è¡¨-æ°å¢å·¥æ¥ä¿¡æ¯") lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Button.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ButtonPermission.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DncPassLog.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Menu.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/NcLogInfo.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectBase.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButton.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ObjectButtonPermission.java
ÎļþÒÑɾ³ý 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; 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; } 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; } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/ProcessSpecVersionDepartment.java
ÎļþÃû´Ó lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/MenuButton.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; } } 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; } } 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") 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); } } 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; lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/ext/MenuExt.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonMapper.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ButtonPermissionMapper.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncObjectMapper.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DncPassLogMapper.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuButtonMapper.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/MenuMapper.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/NcLogInfoMapper.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonMapper.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/ObjectButtonPermissionMapper.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/PermissionStreamMapper.java
ÎļþÒÑɾ³ý 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); } 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); } 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); } 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); } 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> { } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/ButtonMapper.xml
ÎļþÒÑɾ³ý 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> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DncPassLogMapper.xml
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/MenuMapper.xml
ÎļþÒÑɾ³ý 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> 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> 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> 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> 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> 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"> 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> 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> 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,"é¶ä»¶æ æ³æ¸ ç©ºç¨æ·æéï¼è¯·è³å°ä¿çä¸ä½å¯æä½ç¨æ·ï¼"); //æä½ä»£ç @ApiModelProperty(value = "æä½æ¯å¦æå", example = "true", required = true) 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,"å·¥åºä¸æå ³èçææ¡£ï¼æ æ³å é¤ï¼"), 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,"å·¥æ¥ä¸æå ³èçææ¡£æ°æ®"); //æä½ä»£ç lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonPermissionService.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IButtonService.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartApproveUserService.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDepartmentUserService.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceGroupDepartService.java
ÎļþÒÑɾ³ý 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); /** * lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDncPassLogService.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IMenuButtonService.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/INcLogInfoService.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonPermissionService.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectButtonService.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IObjectService.java
ÎļþÒÑɾ³ý 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); /** * éè¿ä¸ç»ä¸å¡idåç¨æ·idåç±»åæ¥è¯¢ * @param businessIds * @param userIds * @param businessType * @return */ List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndUserIds(List<String> businessIds,List<String> userIds,String businessType); /** * éè¿ä¸ç»ä¸å¡idåé¨é¨idåç±»åæ¥è¯¢ * @param businessIds * @param departIds * @param businessType * @return */ List<PermissionStreamNew> loadPermissionStreamNewByBusinessIdsAndDepartIds(List<String> businessIds,List<String> departIds,String businessType); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IPermissionStreamService.java
ÎļþÒÑɾ³ý 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); } 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 åuserId æ¥æ¾æé * @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); } 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); /** * æ ¹æ®ä¸ç»é¶ä»¶idè·å * @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); } 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 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(); //模æçæäº§åç»ææ } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonPermissionServiceImpl.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ButtonServiceImpl.java
ÎļþÒÑɾ³ý 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); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartApproveUserServiceImpl.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DepartmentUserServiceImpl.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceGroupDepartServiceImpl.java
ÎļþÒÑɾ³ý 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); } 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); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DncPassLogServiceImpl.java
ÎļþÒÑɾ³ý 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()+"ï¼ææ¡£åç§°:"+(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()+"æ ¼å¼ææ¡£ï¼ææ¡£åç§°:"+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()+"æ ¼å¼ææ¡£ï¼ææ¡£åç§°:"+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()+"æ ¼å¼ææ¡£ï¼ææ¡£åç§°:"+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()+"æ ¼å¼ææ¡£ï¼ææ¡£åç§°:"+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()+"æ ¼å¼ææ¡£ï¼ææ¡£åç§°:"+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()+"æ ¼å¼ææ¡£ï¼ææ¡£åç§°:"+fileName); iNcLogInfoService.saveLogNcInfos(ncLogInfo); return null; } 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); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/MenuButtonServiceImpl.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/NcLogInfoServiceImpl.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonPermissionServiceImpl.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectButtonServiceImpl.java
ÎļþÒÑɾ³ý lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ObjectServiceImpl.java
ÎļþÒÑɾ³ý 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); } 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åç¨æ·idè·åæé * @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); } /** * éè¿ä¸ç»ä¸å¡idåç¨æ·idåç±»åæ¥è¯¢ * @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; } /** * éè¿ä¸ç»ä¸å¡idåé¨é¨idåç±»åæ¥è¯¢ * @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; } } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PermissionStreamServiceImpl.java
ÎļþÒÑɾ³ý 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; } } 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 åuserId æ¥æ¾æé * @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); } } } 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; } /** * æ ¹æ®ä¸ç»é¶ä»¶idè·å * @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; } } 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); } 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 { 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); 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()); } } 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)); 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); } 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 { //æpartsIdï¼é¶ä»¶ä¸çå·¥åº processNode.setRField(processStream.getPartsId()); //æpsvIdï¼é¶ä»¶ä¸çå·¥åº 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); 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()); 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); /** * ä¸ç»idé彿æåèç¹ */ List<String> recursionChildrenByList(@Param("productionIds") List<String> productionIds); /** * æ ¹æ®ç¨æ·idå车é´idè·åç¨æ·æ¥æç车é´id * @param userId * @param productionId 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> 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); /** * éè¿ä¸ç»idè·åé¨é¨ * @param ids * @return */ List<String> findAllProductionIds(List<String> ids); } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -388,4 +388,14 @@ }); return map; } /** * éè¿ä¸ç»idè·åé¨é¨ * @param ids * @return */ @Override public List<String> findAllProductionIds(List<String> ids){ return this.baseMapper.recursionChildrenByList(ids); } }