DNC平移航宇救生 > 树结构新增工序、工步,去除默认新增工序,新增工步
已重命名1个文件
已添加7个文件
已修改10个文件
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.WorkStep; |
| | | import org.jeecg.modules.dnc.response.CommonCode; |
| | | import org.jeecg.modules.dnc.response.ResponseResult; |
| | | 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/workStep") |
| | | public class WorkStepController extends JeecgController<WorkStep, IWorkStepService> { |
| | | @Autowired |
| | | private IWorkStepService iWorkStepService; |
| | | |
| | | @AutoLog(value = "å·¥æ¥è¡¨-æ°å¢å·¥æ¥ä¿¡æ¯") |
| | | @ApiOperation(value = "å·¥æ¥è¡¨-æ°å¢å·¥æ¥ä¿¡æ¯", notes = "å·¥æ¥è¡¨-æ°å¢å·¥æ¥ä¿¡æ¯") |
| | | @PostMapping("/add") |
| | | public ResponseResult addWorkStep(@RequestBody WorkStep workStep) { |
| | | boolean b = iWorkStepService.addWorkStep(workStep); |
| | | 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 WorkStep workStep) { |
| | | boolean b = iWorkStepService.editWorkStep(id, workStep); |
| | | if(b) { |
| | | return new ResponseResult(CommonCode.SUCCESS); |
| | | } |
| | | return new ResponseResult(CommonCode.FAIL); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @TableName(value = "nc_permission_stream") |
| | | @Api(value = "ç¨æ·æé") |
| | | public class PermissionStream { |
| | | @TableId(value = "stream_id") |
| | | private String streamId; |
| | | //产åid |
| | | @TableField(value = "product_id") |
| | | private String productId; |
| | | //é¨ä»¶id |
| | | @TableField(value = "component_id") |
| | | private String componentId; |
| | | //é¶ä»¶id |
| | | @TableField(value = "parts_id") |
| | | private String partsId; |
| | | //å·¥åºid |
| | | @TableField(value = "process_id") |
| | | private String processId; |
| | | //å·¥æ¥id |
| | | @TableField(value = "step_id") |
| | | private String stepId; |
| | | //ç¨æ·id |
| | | @TableField(value = "user_id") |
| | | private String userId; |
| | | //DNCé¨é¨id |
| | | @TableField(value = "depart_id") |
| | | private String departId; |
| | | @JsonIgnore |
| | |
| | | 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_process_stream") |
| | | @Api(value = "å
¨é¨å·¥åºè¡¨") |
| | | public class ProcessStream { |
| | | @TableId(value = "process_id") |
| | | private String processId; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.JsonIgnore; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.Data; |
| | | import lombok.NoArgsConstructor; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @NoArgsConstructor |
| | | @TableName(value = "nc_work_step") |
| | | @Api(value = "å·¥æ¥") |
| | | public class WorkStep { |
| | | //å·¥æ¥id |
| | | @TableField(value = "step_id") |
| | | private String stepId; |
| | | //产åid |
| | | @TableField(value = "product_id") |
| | | private String productId; |
| | | //é¨ä»¶id |
| | | @TableField(value = "component_id") |
| | | private String componentId; |
| | | //é¶ä»¶id |
| | | @TableField(value = "parts_id") |
| | | private String partsId; |
| | | //å·¥åºid |
| | | @TableField(value = "process_id") |
| | | private String processId; |
| | | //å·¥æ¥åç§° |
| | | @TableField(value = "step_name") |
| | | private String stepName; |
| | | //å·¥æ¥å· |
| | | @TableField(value = "step_code") |
| | | private String stepCode; |
| | | //å·¥èºç¼å· |
| | | @TableField(value = "craft_no") |
| | | private String craftNo; |
| | | //å·¥èºè§ç¨çæ¬ |
| | | @TableField(value = "craft_version") |
| | | private String craftVersion; |
| | | //å·¥æ¥ç±»å |
| | | @TableField(value = "step_type") |
| | | private Integer stepType; |
| | | @JsonIgnore |
| | | @TableField(value = "create_time", select = false, fill = FieldFill.INSERT) |
| | | private Date createTime; |
| | | @JsonIgnore |
| | | @TableField(value = "update_time", select = false, fill = FieldFill.UPDATE) |
| | | private Date updateTime; |
| | | @JsonIgnore |
| | | @TableField(value = "create_user", select = false, fill = FieldFill.INSERT) |
| | | private String createUser; |
| | | @JsonIgnore |
| | | @TableField(value = "update_user", select = false, fill = FieldFill.UPDATE) |
| | | private String updateUser; |
| | | @JsonIgnore |
| | | @TableLogic |
| | | @TableField(value = "delete_flag", select = false) |
| | | private Integer deleteFlag = 0; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.dnc.entity.ProcessStream; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface ProcessStreamMapper extends BaseMapper<ProcessStream> { |
| | | /** |
| | | * æ¥è¯¢å·¥åºä¿¡æ¯ |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<ProcessStream> getByUserPerms(String userId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.dnc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.jeecg.modules.dnc.entity.SynchronizedFlag; |
| | | import org.jeecg.modules.dnc.entity.WorkStep; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface WorkStepMapper extends BaseMapper<WorkStep> { |
| | | /** |
| | | * æ¥è¯¢å·¥æ¥ä¿¡æ¯ |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<WorkStep> getByUserPerms(String userId); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.ProcessStreamMapper"> |
| | | <select id="getByUserPerms" resultType="org.jeecg.modules.dnc.entity.ProcessStream"> |
| | | select |
| | | p.PROCESS_ID |
| | | , p.product_id |
| | | , p.component_id |
| | | , p.parts_id |
| | | , p.PROCESS_NAME |
| | | , p.PROCESS_CODE |
| | | , p.CRAFT_NO |
| | | , p.PROCESS_TYPE |
| | | , p.PROCESSING_EQUIPMENT_MODEL |
| | | , p.PROCESSING_EQUIPMENT_CODE |
| | | , p.ASSEMBLE_STEP |
| | | , p.ASSEMBLE_NAME |
| | | , p.DESCRIPTION |
| | | , p.CREATE_TIME |
| | | , p.CREATE_USER |
| | | , p.UPDATE_TIME |
| | | , p.UPDATE_USER |
| | | 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 |
| | | where p.delete_flag = 0 |
| | | </select> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?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.WorkStepMapper"> |
| | | <select id="getByUserPerms" resultType="org.jeecg.modules.dnc.entity.WorkStep"> |
| | | select |
| | | p.step_id |
| | | , p.product_id |
| | | , p.component_id |
| | | , p.parts_id |
| | | , p.PROCESS_ID |
| | | , p.step_name |
| | | , p.step_code |
| | | , p.CRAFT_NO |
| | | , p.craft_version |
| | | , p.step_type |
| | | , p.CREATE_TIME |
| | | , p.create_by |
| | | , p.UPDATE_TIME |
| | | , p.update_by |
| | | 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.step_id = s.step_id |
| | | where p.delete_flag = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | PROCESS_NOT_EXIST(false,25405,"æ æçé¶ä»¶ï¼"), |
| | | PROCESS_HAS_DOC(false,25406,"å·¥åºä¸æå
³èçææ¡£ï¼æ æ³å é¤ï¼"), |
| | | PROCESS_CODE_NONE(false,25407,"请è¾å
¥å·¥åºå·ï¼"), |
| | | PROCESS_IS_EXIST(false,25408,"该工åºå·²åå¨ï¼"); |
| | | PROCESS_IS_EXIST(false,25408,"该工åºå·²åå¨ï¼"), |
| | | WORKSTEP_NAME_NONE(false,25409,"请è¾å
¥å·¥æ¥åç§°ï¼"), |
| | | WORKSTEP_NOT_EXIST(false,25410,"æ æçå·¥æ¥ï¼"), |
| | | WORKSTEP_IS_EXIST(false,25411,"该工æ¥å·²åå¨ï¼"); |
| | | |
| | | //æä½ä»£ç |
| | | @ApiModelProperty(value = "æä½æ¯å¦æå", example = "true", required = true) |
| | |
| | | * @return |
| | | */ |
| | | List<ProcessStream> validateDeviceProcessInfo(String pnCode, String deviceNo); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idè·åææçå·¥åºä¿¡æ¯ |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<ProcessStream> getByuserPerms(String userId); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idè·åææçå·¥åºä¿¡æ¯ |
| | | * @param userId |
| | | * @param queryParam æ¥è¯¢æ¡ä»¶ |
| | | * @return |
| | | */ |
| | | List<ProcessStream> getByuserPerms(String userId,String queryParam); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.dnc.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.dnc.entity.ProcessStream; |
| | | import org.jeecg.modules.dnc.entity.ProductInfo; |
| | | import org.jeecg.modules.dnc.entity.SynchronizedFlag; |
| | | import org.jeecg.modules.dnc.entity.WorkStep; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: å·¥æ¥ |
| | | * @Author: server-boot |
| | | * @Date: 2025-01-14 |
| | | * @Version: V1.0 |
| | | */ |
| | | public interface IWorkStepService extends IService<WorkStep> { |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idè·åææçå·¥æ¥ä¿¡æ¯ |
| | | * @param userId |
| | | * @return |
| | | */ |
| | | List<WorkStep> getByUserPerms(String userId); |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idè·åææçå·¥æ¥ä¿¡æ¯ |
| | | * @param userId |
| | | * @param queryParam æ¥è¯¢æ¡ä»¶ |
| | | * @return |
| | | */ |
| | | List<WorkStep> getByUserPerms(String userId,String queryParam); |
| | | |
| | | /** |
| | | * æ°å¢äº§åä¿¡æ¯ |
| | | * @param workStep |
| | | * @return |
| | | */ |
| | | boolean addWorkStep(WorkStep workStep); |
| | | |
| | | /** |
| | | * ç¼è¾äº§åä¿¡æ¯ |
| | | * @param id |
| | | * @param workStep |
| | | * @return |
| | | */ |
| | | boolean editWorkStep(String id ,WorkStep workStep); |
| | | |
| | | /** |
| | | * è·åå·¥åºä¸çå·¥æ¥å· |
| | | * @param processId |
| | | * @return |
| | | */ |
| | | WorkStep getByWorkStepNo(String processId,String craftNo); |
| | | |
| | | } |
| | |
| | | b = componentPermissionService.save(permission); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | //æ·»å é»è®¤å·¥åº |
| | | //å»é¤é»è®¤æ°å¢å·¥åºï¼è½¬ä¸ºæå¨æ·»å |
| | | /*/æ·»å é»è®¤å·¥åº |
| | | ProcessStream processStream = new ProcessStream(); |
| | | processStream.setProductId(componentInfo.getProductId()); |
| | | processStream.setComponentId(componentInfo.getComponentId()); |
| | |
| | | iNcLogInfoService.saveLogNcInfos(ncLogInfogx); |
| | | b = processStreamService.save(processStream); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | ExceptionCast.cast(CommonCode.FAIL);*/ |
| | | //æ·»å æé |
| | | PermissionStream stream = new PermissionStream(); |
| | | stream.setUserId(userId); |
| | |
| | | b = partsPermissionService.save(permission); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | //æ·»å é»è®¤å·¥åº |
| | | ProcessStream processStream = new ProcessStream(); |
| | | processStream.setProductId(partsInfo.getProductId()); |
| | | processStream.setComponentId(partsInfo.getComponentId()); |
| | | processStream.setPartsId(partsInfo.getPartsId()); |
| | | processStream.setProcessCode("1"); |
| | | b = processStreamService.save(processStream); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | // if(!b) |
| | | // ExceptionCast.cast(CommonCode.FAIL); |
| | | //æ·»å ç¨æ·æé |
| | | PermissionStream stream = new PermissionStream(); |
| | | stream.setProductId(partsInfo.getProductId()); |
| | | stream.setComponentId(partsInfo.getComponentId()); |
| | | stream.setPartsId(partsInfo.getPartsId()); |
| | | stream.setUserId(userId); |
| | | //æ·»å æ¥å¿ |
| | | NcLogInfo ncLogInfogx = new NcLogInfo(); |
| | | //模å |
| | | ncLogInfogx.setModuleInfo("产åç»ææ "); |
| | | //ç±»å |
| | | ncLogInfogx.setOperateType(2); |
| | | //æ¥å¿å
容 |
| | | ncLogInfogx.setLogContent("é¶ä»¶åç§°ï¼"+partsInfo.getPartsName()+"çæé»è®¤å·¥åºï¼å·¥åºå·ï¼"+processStream.getProcessCode()); |
| | | iNcLogInfoService.saveLogNcInfos(ncLogInfogx); |
| | | // //æ·»å æ¥å¿ |
| | | // NcLogInfo ncLogInfogx = new NcLogInfo(); |
| | | // //模å |
| | | // ncLogInfogx.setModuleInfo("产åç»ææ "); |
| | | // //ç±»å |
| | | // ncLogInfogx.setOperateType(2); |
| | | // //æ¥å¿å
容 |
| | | // ncLogInfogx.setLogContent("é¶ä»¶åç§°ï¼"+partsInfo.getPartsName()+"çæé»è®¤å·¥åºï¼å·¥åºå·ï¼"+processStream.getProcessCode()); |
| | | // iNcLogInfoService.saveLogNcInfos(ncLogInfogx); |
| | | return permissionStreamService.save(stream); |
| | | } |
| | | |
| | |
| | | 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.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; |
| | | 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.exception.ExceptionCast; |
| | | import org.jeecg.modules.dnc.mapper.ProcessStreamMapper; |
| | | import org.jeecg.modules.dnc.response.CommonCode; |
| | | import org.jeecg.modules.dnc.response.ComponentInfoCode; |
| | | import org.jeecg.modules.dnc.response.DeviceCode; |
| | | import org.jeecg.modules.dnc.response.ProcessInfoCode; |
| | | import org.jeecg.modules.dnc.response.*; |
| | | |
| | | import org.jeecg.modules.dnc.service.*; |
| | | import org.jeecg.modules.dnc.utils.ValidateUtil; |
| | |
| | | private IDeviceInfoService deviceInfoService; |
| | | @Autowired |
| | | private INcLogInfoService iNcLogInfoService; |
| | | @Autowired |
| | | private IPermissionStreamService permissionStreamService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | |
| | | ExceptionCast.cast(ProcessInfoCode.PROCESS_NAME_NONE); |
| | | if(!ValidateUtil.validateString(stream.getProcessCode())) |
| | | ExceptionCast.cast(ProcessInfoCode.PROCESS_CODE_NONE); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | 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) |
| | |
| | | boolean b = super.save(stream); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | ProcessInfo processInfo = new ProcessInfo(); |
| | | processInfo.setProcessName(stream.getProcessName()); |
| | | processInfo.setDescription(stream.getDescription()); |
| | | return processInfoService.addOrEdit(processInfo); |
| | | // ProcessInfo processInfo = new ProcessInfo(); |
| | | // processInfo.setProcessName(stream.getProcessName()); |
| | | // processInfo.setDescription(stream.getDescription()); |
| | | // boolean processInfoB= processInfoService.addOrEdit(processInfo); |
| | | // if(!processInfoB) |
| | | // ExceptionCast.cast(CommonCode.FAIL); |
| | | //æ·»å æééªè¯ |
| | | PermissionStream permissionStream = new PermissionStream(); |
| | | 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); |
| | | } |
| | | |
| | | @Override |
| | |
| | | ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProcessStream> getByuserPerms(String userId){ |
| | | if(!ValidateUtil.validateString(userId)) |
| | | return Collections.emptyList(); |
| | | return super.getBaseMapper().getByUserPerms(userId); |
| | | } |
| | | |
| | | @Override |
| | | public List<ProcessStream> getByuserPerms(String userId,String queryParam){ |
| | | if(!ValidateUtil.validateString(userId)) |
| | | return Collections.emptyList(); |
| | | if(!ValidateUtil.validateString(queryParam)) |
| | | return Collections.emptyList(); |
| | | LambdaQueryWrapper<ProcessStream> queryWrapper = Wrappers.lambdaQuery(); |
| | | if(ValidateUtil.validateString(queryParam)) { |
| | | queryWrapper.and(wrapper->wrapper.like(ProcessStream::getProcessName, queryParam) |
| | | .or() |
| | | .like(ProcessStream::getProcessName, queryParam)); |
| | | } |
| | | queryWrapper.orderByAsc(ProcessStream::getCreateTime); |
| | | return super.list(queryWrapper); |
| | | } |
| | | } |
| | |
| | | @Lazy |
| | | private IProcessStreamService processStreamService; |
| | | @Autowired |
| | | private IWorkStepService workStepService; |
| | | @Autowired |
| | | private IDocInfoService docInfoService; |
| | | @Autowired |
| | | private INcLogInfoService iNcLogInfoService; |
| | |
| | | |
| | | @Override |
| | | public List<CommonGenericTree> loadProductTree(String userId) { |
| | | //产å |
| | | List<ProductInfo> productInfoList = getByUserPerms(userId); |
| | | if(productInfoList == null || productInfoList.isEmpty()) |
| | | return Collections.emptyList(); |
| | | //é¨ä»¶ |
| | | List<ComponentExt> componentInfoList = componentInfoService.getByUserPermsAs(userId); |
| | | if(componentInfoList == null) |
| | | componentInfoList = Collections.emptyList(); |
| | | //é¶ä»¶ |
| | | List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId); |
| | | if(partsInfos == null) |
| | | partsInfos = Collections.emptyList(); |
| | | return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos); |
| | | //å·¥åº |
| | | List<ProcessStream> processStreams=processStreamService.getByuserPerms(userId); |
| | | if(processStreams==null) |
| | | processStreams = Collections.emptyList(); |
| | | //å·¥æ¥ |
| | | List<WorkStep> workStepList=workStepService.getByUserPerms(userId); |
| | | if(workStepList==null) |
| | | workStepList = Collections.emptyList(); |
| | | return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos,processStreams,workStepList); |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<ProductInfo> productInfos = this.getByUserPerms(userId, queryParam); |
| | | List<ComponentInfo> componentInfos = componentInfoService.getByUserPerms(userId, queryParam); |
| | | List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId, null, queryParam); |
| | | |
| | | List<ProcessStream> processStreams=processStreamService.getByuserPerms(userId, queryParam); |
| | | List<WorkStep> workSteps=workStepService.getByUserPerms(userId, queryParam); |
| | | List<ComponentInfo> componentInfoList = new ArrayList<>(); |
| | | List<ProductInfo> productInfoList = new ArrayList<>(); |
| | | |
| | |
| | | |
| | | if(!componentInfoMap.containsKey(p.getComponentId())) { |
| | | component = componentInfoService.getById(p.getComponentId()); |
| | | if(component != null) { |
| | | componentInfoMap.put(component.getComponentId(), component); |
| | | componentInfoList.add(component); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | for (ProcessStream processStream : processStreams) { |
| | | if (!productInfoMap.containsKey(processStream.getProductId())) { |
| | | product = super.getById(processStream.getProductId()); |
| | | if(product != null) { |
| | | productInfoMap.put(product.getProductId(), product); |
| | | productInfoList.add(product); |
| | | } |
| | | } |
| | | |
| | | if(!componentInfoMap.containsKey(processStream.getComponentId())) { |
| | | component = componentInfoService.getById(processStream.getComponentId()); |
| | | if(component != null) { |
| | | componentInfoMap.put(component.getComponentId(), component); |
| | | componentInfoList.add(component); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | for (WorkStep workStep :workSteps){ |
| | | if (!productInfoMap.containsKey(workStep.getProductId())) { |
| | | product = super.getById(workStep.getProductId()); |
| | | if(product != null) { |
| | | productInfoMap.put(product.getProductId(), product); |
| | | productInfoList.add(product); |
| | | } |
| | | } |
| | | |
| | | if(!componentInfoMap.containsKey(workStep.getComponentId())) { |
| | | component = componentInfoService.getById(workStep.getComponentId()); |
| | | if(component != null) { |
| | | componentInfoMap.put(component.getComponentId(), component); |
| | | componentInfoList.add(component); |
| | |
| | | //è½¬æ¢æ°æ® |
| | | List<ComponentExt> componentExtList = ComponentExt.convertToExtList(componentInfoList); |
| | | |
| | | return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos); |
| | | return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos,processStreams,workSteps); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 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.PartsInfoMapper; |
| | | import org.jeecg.modules.dnc.mapper.WorkStepMapper; |
| | | import org.jeecg.modules.dnc.response.CommonCode; |
| | | import org.jeecg.modules.dnc.response.ProcessInfoCode; |
| | | import org.jeecg.modules.dnc.response.ProductInfoCode; |
| | | import org.jeecg.modules.dnc.response.UcenterCode; |
| | | import org.jeecg.modules.dnc.service.IPartsInfoService; |
| | | import org.jeecg.modules.dnc.service.IPermissionStreamService; |
| | | import org.jeecg.modules.dnc.service.IWorkStepService; |
| | | import org.jeecg.modules.dnc.utils.ValidateUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @Description: TODO |
| | | * @Author: zhangherong |
| | | * @Date: Created in 2020/9/20 9:19 |
| | | * @Version: 1.0 |
| | | * @Modified By: |
| | | */ |
| | | @Service |
| | | public class WorkStepServiceImpl extends ServiceImpl<WorkStepMapper, WorkStep> implements IWorkStepService { |
| | | |
| | | @Autowired |
| | | private IPermissionStreamService permissionStreamService; |
| | | |
| | | @Override |
| | | public List<WorkStep> getByUserPerms(String userId) { |
| | | if(!ValidateUtil.validateString(userId)) |
| | | return Collections.emptyList(); |
| | | return super.getBaseMapper().getByUserPerms(userId); |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®ç¨æ·idè·åææçå·¥æ¥ä¿¡æ¯ |
| | | * @param userId |
| | | * @param queryParam æ¥è¯¢æ¡ä»¶ |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<WorkStep> getByUserPerms(String userId,String queryParam){ |
| | | if(!ValidateUtil.validateString(userId)) |
| | | return Collections.emptyList(); |
| | | if(!ValidateUtil.validateString(queryParam)) |
| | | return Collections.emptyList(); |
| | | LambdaQueryWrapper<WorkStep> queryWrapper = Wrappers.lambdaQuery(); |
| | | if(ValidateUtil.validateString(queryParam)) { |
| | | queryWrapper.and(wrapper->wrapper.like(WorkStep::getStepName, queryParam) |
| | | .or() |
| | | .like(WorkStep::getStepName, queryParam)); |
| | | } |
| | | queryWrapper.orderByAsc(WorkStep::getCreateTime); |
| | | return super.list(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢äº§åä¿¡æ¯ |
| | | * @param workStep |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean addWorkStep(WorkStep workStep){ |
| | | if(workStep == null) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | if(!ValidateUtil.validateString(workStep.getProductId())) |
| | | ExceptionCast.cast(ProcessInfoCode.PROCESS_PRODUCT_NONE); |
| | | if(!ValidateUtil.validateString(workStep.getComponentId())) |
| | | ExceptionCast.cast(ProcessInfoCode.PROCESS_COMPONENT_NONE); |
| | | if(!ValidateUtil.validateString(workStep.getStepName())) |
| | | ExceptionCast.cast(ProcessInfoCode.PROCESS_NAME_NONE); |
| | | if(!ValidateUtil.validateString(workStep.getStepCode())) |
| | | ExceptionCast.cast(ProcessInfoCode.PROCESS_CODE_NONE); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | if(!ValidateUtil.validateString(userId)) |
| | | ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); |
| | | WorkStep en =getByWorkStepNo(workStep.getProcessId(), workStep.getCraftNo()); |
| | | if(en != null) { |
| | | ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST); |
| | | } |
| | | boolean b =super.save(workStep); |
| | | if(!b) |
| | | ExceptionCast.cast(CommonCode.FAIL); |
| | | //æ·»å æééªè¯ |
| | | PermissionStream permissionStream = new PermissionStream(); |
| | | 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.getStepId()); |
| | | return permissionStreamService.save(permissionStream); |
| | | } |
| | | |
| | | /** |
| | | * ç¼è¾äº§åä¿¡æ¯ |
| | | * @param id |
| | | * @param workStep |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean editWorkStep(String id ,WorkStep workStep){ |
| | | if(!ValidateUtil.validateString(id) || workStep == null) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | if(!ValidateUtil.validateString(workStep.getStepName())) |
| | | ExceptionCast.cast(ProcessInfoCode.PROCESS_NAME_NONE); |
| | | 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); |
| | | } |
| | | |
| | | @Override |
| | | public WorkStep getByWorkStepNo(String processId,String craftNo){ |
| | | if(ValidateUtil.validateString(processId)) { |
| | | List<WorkStep> list = super.lambdaQuery().eq(WorkStep::getProcessId, processId).eq(WorkStep::getCraftNo,craftNo).list(); |
| | | if(list == null || list.isEmpty()) |
| | | return null; |
| | | return list.get(0); |
| | | } |
| | | return null; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | package org.jeecg.modules.dnc.service.support; |
| | | |
| | | import org.jeecg.modules.dnc.entity.PartsInfo; |
| | | import org.jeecg.modules.dnc.entity.ProductInfo; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import org.jeecg.modules.dnc.entity.*; |
| | | import org.jeecg.modules.dnc.response.CommonGenericTree; |
| | | import org.jeecg.modules.dnc.entity.ComponentInfo; |
| | | import org.jeecg.modules.dnc.dto.ComponentExt; |
| | |
| | | |
| | | public class ProductTreeWrapper { |
| | | |
| | | public static List<CommonGenericTree> loadTree(List<ProductInfo> productInfoList, List<ComponentExt> componentInfoList, List<PartsInfo> partsInfoList) { |
| | | public static List<CommonGenericTree> loadTree(List<ProductInfo> productInfoList, List<ComponentExt> componentInfoList, |
| | | List<PartsInfo> partsInfoList,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> processMap = new HashMap<>(); |
| | | CommonGenericTree<ProductInfo> node; |
| | | CommonGenericTree<ComponentInfo> componentNode; |
| | | CommonGenericTree<PartsInfo> partsNode; |
| | | CommonGenericTree<ProcessStream> processNode; |
| | | CommonGenericTree<WorkStep> workStepNode; |
| | | for(ProductInfo productInfo : productInfoList) { |
| | | node = new CommonGenericTree(); |
| | | node.setId(productInfo.getProductId()); |
| | |
| | | partsNode.setParentId(componentNode.getId()); |
| | | componentNode.addChildren(partsNode); |
| | | } |
| | | partsMap.put(parts.getPartsId(), partsNode); |
| | | } |
| | | |
| | | //å·¥åºåå¨é¨ä»¶æè
é¶ä»¶ä¸ |
| | | for(ProcessStream processStream : processStreams) { |
| | | processNode = new CommonGenericTree(); |
| | | processNode.setId(processStream.getProcessId()); |
| | | processNode.setLabel("[" + processStream.getProcessCode()+ "]" + processStream.getProcessName()); |
| | | processNode.setParentId(null); |
| | | processNode.setIconClass(""); |
| | | processNode.setType(4); |
| | | if (StrUtil.isEmpty(processStream.getPartsId())) { |
| | | //没æpartsIdï¼é¨ä»¶ä¸çå·¥åº |
| | | processNode.setRField(processStream.getComponentId()); |
| | | processNode.setEntity(processStream); |
| | | if(componentMap.containsKey(processNode.getRField())) { |
| | | componentNode = componentMap.get(processNode.getRField()); |
| | | processNode.setParentId(componentNode.getId()); |
| | | componentNode.addChildren(processNode); |
| | | } |
| | | }else { |
| | | //æpartsIdï¼é¶ä»¶ä¸çå·¥åº |
| | | processNode.setRField(processStream.getPartsId()); |
| | | processNode.setEntity(processStream); |
| | | if(partsMap.containsKey(processNode.getRField())) { |
| | | partsNode = partsMap.get(processNode.getRField()); |
| | | processNode.setParentId(partsNode.getId()); |
| | | partsNode.addChildren(processNode); |
| | | } |
| | | } |
| | | processMap.put(processStream.getProcessId(),processNode); |
| | | } |
| | | |
| | | //å·¥æ¥åå¨å·¥åºä¸ |
| | | for (WorkStep workStep : workStepList) { |
| | | workStepNode = new CommonGenericTree(); |
| | | workStepNode.setId(workStep.getStepId()); |
| | | workStepNode.setLabel("[" + workStep.getStepCode() + "]" + workStep.getStepName()); |
| | | workStepNode.setParentId(null); |
| | | workStepNode.setIconClass(""); |
| | | workStepNode.setType(5); |
| | | workStepNode.setRField(workStep.getProcessId()); |
| | | workStepNode.setEntity(workStep); |
| | | if (processMap.containsKey(workStepNode.getRField())) { |
| | | processNode = processMap.get(workStepNode.getRField()); |
| | | workStepNode.setParentId(processNode.getId()); |
| | | processNode.addChildren(workStepNode); |
| | | } |
| | | } |
| | | |
| | | return tree; |
| | | } |
| | | |