1.查询可以被引用的部件接口开发完成
2.借用部件(可批量) 开发完成
3.修改原有新增、修改部件接口 完成
4.修改原有删除文档与导入文档接口 完成
5.修改工作流问题
| | |
| | | package org.jeecg.modules.dnc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.entity.ComponentInfo; |
| | | import org.jeecg.modules.dnc.entity.PermissionStream; |
| | |
| | | } |
| | | return new ResponseResult(CommonCode.FAIL); |
| | | } |
| | | |
| | | @AutoLog(value = "查询可以被引用的部件") |
| | | @ApiOperation(value = "查询可以被引用的部件", notes = "查询可以被引用的部件") |
| | | @GetMapping("/getByComponentId") |
| | | public Result<?> getByComponentId(ComponentInfo componentInfo, Integer pageNo, Integer pageSize) { |
| | | IPage<ComponentInfo> iPage = componentInfoService.getByComponentId(componentInfo, pageNo, pageSize); |
| | | return Result.OK(iPage); |
| | | } |
| | | |
| | | |
| | | @AutoLog(value = "借用部件(可批量)") |
| | | @ApiOperation(value = "借用部件(可批量)", notes = "借用部件(可批量)") |
| | | @PostMapping("/borrow") |
| | | public Result<?> borrowComponent(@RequestParam("oldId") String oldId, @RequestParam("newIds") String newIds) { |
| | | return componentInfoService.borrowComponent(oldId,newIds); |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.dnc.controller; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @AutoLog(value = "文档表-删除文档信息") |
| | | @ApiOperation(value = "文档表-删除文档信息", notes = "文档表-删除文档信息") |
| | | @DeleteMapping("/delete") |
| | | public ResponseResult deleteDocInfo(@RequestParam("id") String id) { |
| | | boolean b = docInfoService.deleteDocInfo(id); |
| | | @DeleteMapping("/delete/{id}/{attrType}/{attrId}") |
| | | public ResponseResult deleteDocInfo(@PathVariable("id") String id, @PathVariable("attrType") String attrType, @PathVariable("attrId") String attrId) { |
| | | boolean b = docInfoService.deleteDocInfo(id,attrType,attrId); |
| | | if(!b) |
| | | return new ResponseResult(CommonCode.FAIL); |
| | | return new ResponseResult(CommonCode.SUCCESS); |
| | |
| | | |
| | | @AutoLog(value = "文件表-批量删除文档接口") |
| | | @ApiOperation(value = "文件表-批量删除文档接口", notes = "文件表-批量删除文档接口") |
| | | @PostMapping("/batch/remove") |
| | | public ResponseResult batchRemoveDocInfo(@RequestBody String[] docIds) { |
| | | boolean b = docInfoService.batchRemoveDocInfo(docIds); |
| | | @PostMapping("/batch/remove/{docIds}/{attrType}/{attrId}") |
| | | public ResponseResult batchRemoveDocInfo(@PathVariable("docIds") String[] docIds, @PathVariable("attrType") String attrType, @PathVariable("attrId") String attrId) { |
| | | boolean b = docInfoService.batchRemoveDocInfo(docIds,attrType,attrId); |
| | | if(!b) |
| | | return new ResponseResult(CommonCode.FAIL); |
| | | return new ResponseResult(CommonCode.SUCCESS); |
| | |
| | | @TableLogic |
| | | @TableField(value = "delete_flag", select = false) |
| | | private Integer deleteFlag = 0; |
| | | //被借用id |
| | | @TableField(value = "borrow_id") |
| | | private String borrowId; |
| | | |
| | | //创建人 |
| | | private transient String createName; |
| | |
| | | package org.jeecg.modules.dnc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.dnc.entity.PermissionStreamNew; |
| | |
| | | List<ProductMix> loadProductMix(@Param("userId") String userId,@Param("productIdList")List<String> productIdList); |
| | | |
| | | /** |
| | | * 根据用户id、部门列表、id、业务类型获取对应结构树权限 |
| | | * @param userId |
| | | * @param productIdList |
| | | * @param businessId |
| | | * @param businessType |
| | | * @return |
| | | */ |
| | | @InterceptorIgnore( |
| | | tenantLine = "true", // 忽略多租户条件 |
| | | blockAttack = "true", // 绕过全表操作检查 |
| | | illegalSql = "true" // 禁用 SQL 注入检查 |
| | | ) |
| | | List<ProductMix> loadProductMixByBusinessId(@Param("userId") String userId,@Param("productIdList")List<String> productIdList, |
| | | @Param("businessId")String businessId,@Param("businessType")String businessType); |
| | | |
| | | /** |
| | | * 管理员获取所有权限 |
| | | * @return |
| | | */ |
| | |
| | | on comp.component_id=s.component_id |
| | | where delete_flag = 0 and parent_id=#{parentId} |
| | | </select> |
| | | |
| | | |
| | | <select id="findById" parameterType="Map" resultMap="componentExtPermsMapAs"> |
| | | select comp.component_id |
| | | , comp.parent_id |
| | | , comp.product_id |
| | | , comp.component_name |
| | | , comp.materiel_code |
| | | , comp.materiel_desp |
| | | , comp.component_model |
| | | , comp.component_scale |
| | | , comp.component_weight |
| | | , comp.rank_level |
| | | , comp.assemble_type |
| | | , comp.produce_type |
| | | , comp.process_type |
| | | , comp.structure_type |
| | | , comp.component_code |
| | | , comp.component_status |
| | | , comp.description |
| | | from nc_component_info comp |
| | | where comp.component_id=#{id} and comp.delete_flag=0 |
| | | </select> |
| | | </mapper> |
| | |
| | | WHERE nps_user.business_id IS NOT NULL |
| | | order by mix.tree_type, mix.create_time asc |
| | | </select> |
| | | <select id="loadProductMixByBusinessId" resultType="org.jeecg.modules.dnc.entity.ProductMix"> |
| | | WITH CTE_Hierarchy AS ( |
| | | SELECT |
| | | CAST(id AS VARCHAR(36)) AS id, |
| | | CAST(parent_id AS VARCHAR(36)) AS parent_id, |
| | | 1 AS LEVEL, |
| | | CAST('#' + id + '#' AS VARCHAR(MAX)) AS visit_path |
| | | FROM |
| | | nc_product_mix |
| | | WHERE |
| | | id = #{businessId} |
| | | AND tree_type = #{businessType} |
| | | UNION ALL |
| | | -- 向上递归父节点(带循环检测) |
| | | SELECT |
| | | CAST(p.id AS VARCHAR(36)), |
| | | CAST(p.parent_id AS VARCHAR(36)), |
| | | h.level + 1, |
| | | CAST(h.visit_path + '#' + p.id + '#' AS VARCHAR(MAX)) |
| | | FROM |
| | | nc_product_mix p |
| | | INNER JOIN CTE_Hierarchy h ON CAST(p.id AS VARCHAR(36)) = h.parent_id |
| | | WHERE |
| | | p.tree_type = #{businessType} |
| | | AND h.visit_path NOT LIKE '%#' + p.id + '#%' |
| | | AND h.level < 1000 |
| | | UNION ALL |
| | | -- 向下递归子节点(带循环检测) |
| | | SELECT |
| | | CAST(c.id AS VARCHAR(36)), |
| | | CAST(c.parent_id AS VARCHAR(36)), |
| | | h.level + 1, |
| | | CAST(h.visit_path + '#' + c.id + '#' AS VARCHAR(MAX)) |
| | | FROM |
| | | nc_product_mix c |
| | | INNER JOIN CTE_Hierarchy h ON CAST(c.parent_id AS VARCHAR(36)) = h.id |
| | | WHERE |
| | | c.tree_type = #{businessType} |
| | | AND h.visit_path NOT LIKE '%#' + c.id + '#%' |
| | | AND h.level < 1000 |
| | | ), |
| | | ExclusionCTE AS ( |
| | | SELECT DISTINCT id |
| | | FROM CTE_Hierarchy |
| | | WHERE LEVEL BETWEEN 1 AND 1000 |
| | | ) |
| | | SELECT DISTINCT |
| | | mix.id, |
| | | mix.tree_code 'code', |
| | | mix.tree_name 'name', |
| | | mix.parent_id, |
| | | mix.tree_type AS 'type', |
| | | mix.extend, |
| | | mix.create_time |
| | | FROM |
| | | nc_product_mix mix |
| | | LEFT JOIN nc_permission_stream_new nps_depart ON mix.id = nps_depart.business_id |
| | | AND nps_depart.delete_flag = '0' |
| | | <if test="productIdList != null and productIdList.size() > 0"> |
| | | AND nps_depart.depart_id IN |
| | | <foreach collection="productIdList" item="productId" index="index" open="(" close=")" separator=","> |
| | | #{productId} |
| | | </foreach> |
| | | </if> |
| | | AND nps_depart.user_id IS NULL |
| | | LEFT JOIN nc_permission_stream_new nps_user ON mix.id = nps_user.business_id |
| | | AND nps_user.user_id = #{userId} |
| | | AND nps_user.delete_flag = '0' |
| | | WHERE |
| | | nps_depart.business_id IS NOT NULL |
| | | AND nps_user.business_id IS NOT NULL |
| | | AND mix.tree_type = #{businessType} |
| | | AND NOT EXISTS (SELECT 1 FROM ExclusionCTE e WHERE e.id = mix.id) |
| | | ORDER BY |
| | | mix.tree_type, |
| | | mix.create_time ASC |
| | | OPTION (MAXRECURSION 0); |
| | | </select> |
| | | </mapper> |
| | |
| | | COMPONENT_CHILD_EXIST(false, 25108, "部件存在子部件!"), |
| | | COMPONENT_PARTS_EXIST(false, 25109, "部件有关联的零件信息!"), |
| | | COMPONENT_PROCESS_EXIST(false, 25110, "部件有关联的工序信息!"), |
| | | COMPONENT_DOC_EXIST(false, 25116, "部件有关联的文档信息!"), |
| | | COMPONENT_CODE_NONE(false, 25111, "请输入部件代号!"), |
| | | COMPONENT_IS_EXIST(false, 25112, "部件已存在!"), |
| | | COMPONENT_PN_NOT_VALID(false, 25113, "PN码不合法!"), |
| | | COMPONENT_PN_NOT_EXIST(false, 25114, "不存在该PN码对应的部件或零件!"), |
| | | COMPONENT_PN_NOT_ONLY(false, 25115, "PN码不唯一!"), |
| | | COMPONENT_USER_NONE(false,25016,"部件无法清空用户权限,请至少保留一位可操作用户!"); |
| | | COMPONENT_DOC_EXIST(false, 251111, "部件有关联的文档信息!"), |
| | | COMPONENT_CODE_NONE(false, 25112, "请输入部件代号!"), |
| | | COMPONENT_IS_EXIST(false, 25113, "部件已存在!"), |
| | | COMPONENT_BORROW_EXIST(false, 25114, "部件已被借用,请先删除借用再删除!"), |
| | | COMPONENT_PN_NOT_VALID(false, 25115, "PN码不合法!"), |
| | | COMPONENT_PN_NOT_EXIST(false, 25116, "不存在该PN码对应的部件或零件!"), |
| | | COMPONENT_PN_NOT_ONLY(false, 25117, "PN码不唯一!"), |
| | | COMPONENT_USER_NONE(false,25018,"部件无法清空用户权限,请至少保留一位可操作用户!"); |
| | | |
| | | //操作代码 |
| | | @ApiModelProperty(value = "操作是否成功", example = "true", required = true) |
| | |
| | | //提示信息 |
| | | @ApiModelProperty(value = "操作提示", example = "操作过于频繁!", required = true) |
| | | String message; |
| | | private ComponentInfoCode(boolean success, int code, String message){ |
| | | ComponentInfoCode(boolean success, int code, String message){ |
| | | this.success = success; |
| | | this.code = code; |
| | | this.message = message; |
| | |
| | | package org.jeecg.modules.dnc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.modules.dnc.dto.ComponentExt; |
| | | import org.jeecg.modules.dnc.entity.ComponentInfo; |
| | | import org.jeecg.modules.dnc.entity.DocInfo; |
| | |
| | | * @return |
| | | */ |
| | | List<DocInfo> getByComponentInfo(TreeInfoRequest treeInfoRequest); |
| | | |
| | | /** |
| | | * 查询可以被引用的部件 |
| | | * @param componentInfo |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | IPage<ComponentInfo> getByComponentId(ComponentInfo componentInfo, Integer pageNo, Integer pageSize); |
| | | |
| | | /** |
| | | * 借用部件(可批量) - 原有部件id,新部件ids |
| | | * @param oldId,newIds |
| | | * @return |
| | | */ |
| | | Result<?> borrowComponent(String oldId, String newIds); |
| | | } |
| | | |
| | | |
| | |
| | | * @param id |
| | | * @return |
| | | */ |
| | | boolean deleteDocInfo(String id); |
| | | boolean deleteDocInfo(String id,String attrType,String attrId); |
| | | /** |
| | | * 监控文件导入 |
| | | * @param pathFile |
| | |
| | | * @param docIds |
| | | * @return |
| | | */ |
| | | boolean batchRemoveDocInfo(String[] docIds); |
| | | boolean batchRemoveDocInfo(String[] docIds,String attrType,String attrId); |
| | | |
| | | /** |
| | | * 文档下载 |
| | |
| | | */ |
| | | List<ProductMix> loadProductMix(String userId,List<String> productIdList); |
| | | |
| | | /** |
| | | * 根据用户id、部门列表、id、业务类型获取对应结构树权限 |
| | | * @param userId |
| | | * @param productIdList |
| | | * @param businessId |
| | | * @param businessType |
| | | * @return |
| | | */ |
| | | List<ProductMix> loadProductMixByBusinessIdAndBusinessType(String userId,List<String> productIdList, |
| | | String businessId,String businessType); |
| | | |
| | | |
| | | /** |
| | | * 管理员获取所有权限 |
| | |
| | | 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.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.dnc.dto.ComponentExt; |
| | | import org.jeecg.modules.dnc.entity.*; |
| | |
| | | @Autowired |
| | | @Lazy |
| | | private IDocInfoService docInfoService; |
| | | @Autowired |
| | | private IDocRelativeService docRelativeService; |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean addComponentInfo(ComponentInfo componentInfo) { |
| | |
| | | if(!ValidateUtil.validateString(componentInfo.getComponentCode())) |
| | | ExceptionCast.cast(ComponentInfoCode.COMPONENT_CODE_NONE); |
| | | ComponentInfo en = getByCode(componentInfo.getComponentCode()); |
| | | if(en != null) |
| | | if(en != null&&componentInfo.getBorrowId()==null) |
| | | ExceptionCast.cast(ComponentInfoCode.COMPONENT_IS_EXIST); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | |
| | | ,componentInfo.getComponentName(),componentInfo.getComponentCode(),2,new Date()); |
| | | } |
| | | productMixService.save(productMix); |
| | | if (StrUtil.isNotEmpty(componentInfo.getBorrowId())){ |
| | | //借用部件,同步添加文件 |
| | | List<DocRelative> docRelativeList=docRelativeService. |
| | | list(new QueryWrapper<DocRelative>().eq("attribution_type","2").eq("attribution_id",componentInfo.getBorrowId())); |
| | | if (!docRelativeList.isEmpty()){ |
| | | docRelativeList.forEach(item -> { |
| | | DocRelative docRelative = new DocRelative(); |
| | | BeanUtil.copyProperties(item,docRelative); |
| | | docRelative.setId(null); |
| | | docRelative.setAttributionId(componentInfo.getComponentId()); |
| | | docRelativeService.save(docRelative); |
| | | }); |
| | | } |
| | | } |
| | | //添加权限 |
| | | PermissionStreamNew stream = new PermissionStreamNew(); |
| | | stream.setUserId(userId); |
| | |
| | | stream.setBusinessType("2"); |
| | | return permissionStreamNewService.save(stream); |
| | | } |
| | | return b; |
| | | List<ComponentInfo> list = super.lambdaQuery().eq(ComponentInfo::getBorrowId,id).list(); |
| | | if (list != null && !list.isEmpty()) { |
| | | list.forEach(item -> editComponentInfo(item.getComponentId(),componentInfo)); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | |
| | | if(childrenList != null && !childrenList.isEmpty()) { |
| | | ExceptionCast.cast(ComponentInfoCode.COMPONENT_CHILD_EXIST); |
| | | } |
| | | //验证产品下是否有零件 |
| | | //验证部件下是否有零件 |
| | | List<PartsInfo> partsInfoList = partsInfoService.getByComponentId(componentInfo.getProductId(), componentInfo.getComponentId()); |
| | | if(partsInfoList != null && !partsInfoList.isEmpty()) { |
| | | ExceptionCast.cast(ComponentInfoCode.COMPONENT_PARTS_EXIST); |
| | | } |
| | | //验证部件下是否有工序信息 |
| | | List<ProcessStream> processStreamList = processStreamService.findByComponentId(id); |
| | | if(processStreamList != null && !processStreamList.isEmpty()) { |
| | | ExceptionCast.cast(ComponentInfoCode.COMPONENT_PROCESS_EXIST); |
| | | } |
| | | //验证部件是否被借用 |
| | | List<ComponentInfo> list = super.lambdaQuery().eq(ComponentInfo::getBorrowId,id).list(); |
| | | if (list != null && !list.isEmpty()) { |
| | | ExceptionCast.cast(ComponentInfoCode.COMPONENT_BORROW_EXIST); |
| | | } |
| | | boolean b; |
| | | //验证是否存在文档 |
| | |
| | | } |
| | | return docInfos; |
| | | } |
| | | |
| | | /** |
| | | * 查询可以被引用的部件 |
| | | * @param componentInfo |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<ComponentInfo> getByComponentId(ComponentInfo componentInfo, Integer pageNo, Integer pageSize){ |
| | | //权限排除,不能引用自己上下级部件 |
| | | LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String productIds = loginUser.getProductionIds(); |
| | | IPage<ComponentInfo> page = new Page<>(pageNo, pageSize); |
| | | if (productIds != null && !productIds.isEmpty()) { |
| | | List<String> productIdList = Arrays.asList(productIds.split(",")); |
| | | List<ProductMix> productMixList = permissionStreamNewService. |
| | | loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),"2"); |
| | | List<Long> ids = productMixList.stream().map(ProductMix::getId).collect(Collectors.toList()); |
| | | //获取已经被借用的部件 |
| | | LambdaQueryWrapper<ComponentInfo> borrowQueryWrapper = new LambdaQueryWrapper<>(); |
| | | borrowQueryWrapper.in(ComponentInfo::getBorrowId,ids); |
| | | borrowQueryWrapper.eq(ComponentInfo::getParentId,componentInfo.getComponentId()); |
| | | List<String> borrowIds= super.list(borrowQueryWrapper).stream().map(ComponentInfo::getBorrowId).collect(Collectors.toList()); |
| | | LambdaQueryWrapper<ComponentInfo> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.like(StrUtil.isNotEmpty(componentInfo.getComponentName()),ComponentInfo::getComponentName, componentInfo.getComponentName()); |
| | | queryWrapper.like(StrUtil.isNotEmpty(componentInfo.getComponentCode()),ComponentInfo::getComponentCode, componentInfo.getComponentCode()); |
| | | queryWrapper.isNull(ComponentInfo::getBorrowId); |
| | | queryWrapper.in(ComponentInfo::getComponentId,ids); |
| | | if (!borrowIds.isEmpty()) { |
| | | queryWrapper.notIn(ComponentInfo::getComponentId,borrowIds); |
| | | } |
| | | queryWrapper.orderByDesc(ComponentInfo::getCreateTime); |
| | | page = super.page(page, queryWrapper); |
| | | } |
| | | return page; |
| | | } |
| | | |
| | | /** |
| | | * 借用部件(可批量) - 原有部件id,新部件ids |
| | | * @param oldId,newIds |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result<?> borrowComponent(String oldId, String newIds){ |
| | | LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | ComponentInfo componentInfo = super.getById(oldId); |
| | | if(componentInfo == null) { |
| | | return Result.error("部件不存在"); |
| | | } |
| | | List<String> productIdList = Arrays.asList(loginUser.getProductionIds().split(",")); |
| | | //获取可以借用的部件 |
| | | List<ProductMix> productMixList = permissionStreamNewService. |
| | | loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),"2"); |
| | | Set<Long> allowedIds = productMixList.stream() |
| | | .map(ProductMix::getId) |
| | | .collect(Collectors.toCollection(HashSet::new)); |
| | | List<String> newIdList = Arrays.asList(newIds.split(",")); |
| | | boolean allAllowed = newIdList.parallelStream() |
| | | .map(Long::parseLong) |
| | | .allMatch(allowedIds::contains); |
| | | if (!allAllowed) { |
| | | return Result.error("存在未授权的部件借用"); |
| | | } |
| | | //获取已经被借用的部件 |
| | | LambdaQueryWrapper<ComponentInfo> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.in(ComponentInfo::getBorrowId,newIdList); |
| | | queryWrapper.eq(ComponentInfo::getParentId,componentInfo.getComponentId()); |
| | | List<ComponentInfo> list = super.list(queryWrapper); |
| | | //判断是否已经被当前部件借用 |
| | | if(!list.isEmpty()) { |
| | | return Result.error("选择的部件已被当前部件借用"); |
| | | } |
| | | List<ComponentInfo> componentInfoList=listByIds(newIdList); |
| | | componentInfoList.forEach(item->{ |
| | | //添加部件信息、层级信息、权限信息 |
| | | ComponentInfo newComponentInfo=new ComponentInfo(); |
| | | BeanUtil.copyProperties(item,newComponentInfo); |
| | | newComponentInfo.setComponentId(null); |
| | | newComponentInfo.setProductId(componentInfo.getProductId()); |
| | | newComponentInfo.setParentId(componentInfo.getComponentId()); |
| | | newComponentInfo.setBorrowId(item.getComponentId()); |
| | | addComponentInfo(newComponentInfo); |
| | | }); |
| | | return Result.ok("部件借用成功"); |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 根据业务id查询设备类列表 |
| | | * @param businessId |
| | | * |
| | | * @param type |
| | | * @return |
| | | */ |
| | |
| | | package org.jeecg.modules.dnc.service.impl; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | private IDispatchFileService dispatchFileService; |
| | | @Autowired |
| | | private ISysParamsService sysParamsService; |
| | | @Autowired |
| | | @Lazy |
| | | private IComponentInfoService componentInfoService; |
| | | |
| | | /*备份处理*/ |
| | | @Override |
| | |
| | | docRelative.setAttributionType(uploadRequest.getAttributionType()); |
| | | docRelative.setClassificationId(docClass.getClassificationId()); |
| | | boolean b = docRelativeService.save(docRelative); |
| | | if (uploadRequest.getAttributionType()==2){ |
| | | //查询借用的部件 |
| | | List<ComponentInfo> borrowComponentInfoList=componentInfoService.list(new QueryWrapper<ComponentInfo>().eq("borrow_id", uploadRequest.getAttributionId())); |
| | | if (!borrowComponentInfoList.isEmpty()) { |
| | | borrowComponentInfoList.forEach(item->{ |
| | | DocRelative borrowDocRelative = new DocRelative(); |
| | | BeanUtil.copyProperties(docRelative,borrowDocRelative); |
| | | borrowDocRelative.setAttributionId(item.getComponentId()); |
| | | borrowDocRelative.setId(null); |
| | | docRelativeService.save(borrowDocRelative); |
| | | }); |
| | | } |
| | | } |
| | | if(!b) |
| | | ExceptionCast.cast(DocumentCode.DOC_UPLOAD_ERROR); |
| | | DocFile docFile = new DocFile(); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean deleteDocInfo(String id) { |
| | | public boolean deleteDocInfo(String id,String attrType,String attrId) { |
| | | if(!ValidateUtil.validateString(id)) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | DocInfo en = super.getById(id); |
| | |
| | | ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); |
| | | if(en.getDocStatus() != 1) |
| | | ExceptionCast.cast(DocumentCode.DOC_DEL_ERROR); |
| | | //查询对应的关系 |
| | | if ("2".equals(attrType)) { |
| | | //判断部件引用 |
| | | ComponentInfo componentInfo=componentInfoService.getById(attrId); |
| | | if(componentInfo!=null&&componentInfo.getBorrowId()!=null){ |
| | | //借用的部件,只删除自己的关系 |
| | | DocRelative docRelative=docRelativeService.getOne(new QueryWrapper<DocRelative>() |
| | | .eq("attribution_id", attrId).eq("attribution_type", 2).eq("doc_id",id)); |
| | | if(docRelative!=null){ |
| | | docRelativeService.removeById(docRelative.getId()); |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | FileOperate operate = fileOperateService.getByDocId(id); |
| | | if(operate != null) |
| | | ExceptionCast.cast(DocumentCode.DOC_IS_OPERATING); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean batchRemoveDocInfo(String[] docIds) { |
| | | public boolean batchRemoveDocInfo(String[] docIds,String attrType,String attrId) { |
| | | if(docIds == null || docIds.length < 1) |
| | | ExceptionCast.cast(CommonCode.INVALID_PARAM); |
| | | for(String docId : docIds) { |
| | | this.deleteDocInfo(docId); |
| | | this.deleteDocInfo(docId,attrType,attrId); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id、部门列表、id、业务类型获取对应结构树权限 |
| | | * @param userId |
| | | * @param productIdList |
| | | * @param businessId |
| | | * @param businessType |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ProductMix> loadProductMixByBusinessIdAndBusinessType(String userId,List<String> productIdList, |
| | | String businessId,String businessType){ |
| | | return baseMapper.loadProductMixByBusinessId(userId,productIdList,businessId,businessType); |
| | | } |
| | | |
| | | /** |
| | | * 管理员获取所有权限 |
| | | * @return |
| | | */ |
| | |
| | | .processInstanceId(flowTaskDto.getProcInsId()) |
| | | .singleResult(); |
| | | SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId()); |
| | | flowTaskDto.setStartUserId(startUser.getUsername()); |
| | | flowTaskDto.setStartUserName(startUser.getRealname()); |
| | | if (startUser!=null){ |
| | | flowTaskDto.setStartUserId(startUser.getUsername()); |
| | | flowTaskDto.setStartUserName(startUser.getRealname()); |
| | | } |
| | | List<String> departNamesByUsername = iFlowThirdService.getDepartNamesByUsername(historicProcessInstance.getStartUserId()); |
| | | flowTaskDto.setStartDeptName(CollUtil.join(departNamesByUsername,",")); |
| | | if (flowTaskDto.getTodoUsers() == null){ |
| | |
| | | package org.jeecg.modules.base.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.base.entity.WarehouseLocation; |
| | | import org.jeecg.modules.base.mapper.WarehouseLocationMapper; |
| | | import org.jeecg.modules.base.mapper.WarehouseMapper; |
| | | import org.jeecg.modules.base.service.IWarehouseLocationService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | |
| | | /** |
| | | * @Description: mom_base_warehouse_location |