lxzn-module-dnc/pom.xml
@@ -46,6 +46,12 @@ <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> </dependency> <dependency> <groupId>org.jeecgframework.boot</groupId> <artifactId>lxzn-module-mdc</artifactId> <version>3.4.3</version> <scope>compile</scope> </dependency> </dependencies> </project> lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java
@@ -20,7 +20,7 @@ @TableField(value = "act_name") private String actName; @TableField(value = "depart_id") @Dict(dictTable = "sys_department",dicCode = "depart_id",dicText = "depart_name") @Dict(dictTable = "mdc_production",dicCode = "id",dicText = "production_name") private String departId; @TableField(value = "approve_users") @Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname") lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiSignExamine.java
@@ -20,7 +20,7 @@ @TableField(value = "act_name") private String actName; @TableField(value = "depart_id") @Dict(dictTable = "sys_department",dicCode = "depart_id",dicText = "depart_name") @Dict(dictTable = "mdc_production",dicCode = "id",dicText = "production_name") private String departId; @TableField(value = "proofreader_user") @Dict(dictTable = "sys_user", dicCode = "id", dicText = "realname") lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java
@@ -16,7 +16,9 @@ import org.jeecg.modules.dnc.response.QueryPageResponseResult; import org.jeecg.modules.dnc.ucenter.Department; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.service.IMdcProductionService; import org.jeecg.modules.system.service.ISysUserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -30,6 +32,8 @@ private DepartmentMapper departmentMapper; @Autowired private ISysUserService userService; @Autowired private IMdcProductionService iMdcProductionService; @Override @Transactional(rollbackFor = {Exception.class}) public boolean addDefinition(ActivitiDefinition definition) { @@ -39,8 +43,9 @@ ActivitiDefinition en = getByDepartId(definition.getDepartId()); if(en != null) ExceptionCast.cast(ActivitiDefinitionCode.DEF_IS_EXIST); Department department = departmentMapper.selectById(definition.getDepartId()); if(department == null) //修改为mdc车间 MdcProduction mdcProduction=iMdcProductionService.getById(definition.getDepartId()); if(mdcProduction == null) ExceptionCast.cast(ActivitiDefinitionCode.DEF_DEPART_NONE); String[] userIds = definition.getApproveUsers().split(","); if(userIds == null|| userIds.length < 1) lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java
@@ -39,6 +39,9 @@ import org.jeecg.modules.dnc.utils.ValidateUtil; import org.jeecg.modules.dnc.utils.date.DateUtil; import org.jeecg.modules.dnc.utils.file.FileUtilS; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.system.service.IMdcProductionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.StringRedisTemplate; @@ -93,7 +96,10 @@ private IDncPassLogService dncPassLogService; @Autowired private IDeviceCharactersService iDeviceCharactersService; @Autowired private IMdcEquipmentService iMdcEquipmentService; @Autowired private IMdcProductionService iMdcProductionService; @Autowired private StringRedisTemplate redisTemplate; @@ -136,15 +142,17 @@ * 设备ID,文件ID */ public String getDeviceSpecialChar(String deviceId, String fileId){ DeviceInfo deviceInfo = deviceInfoService.getById(deviceId); if(deviceInfo == null) //替换为mdc设备表 // DeviceInfo deviceInfo = deviceInfoService.getById(deviceId); MdcEquipment mdcEquipment = iMdcEquipmentService.getById(deviceId); if(mdcEquipment == null) ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); // DocFile docFile = docFileService.getById(fileId); DocInfo docInfo = docInfoService.getOne(new QueryWrapper<DocInfo>().eq("publish_file_id",fileId)); if(docInfo == null) ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); List<DeviceCharacters> deviceCharactersList=iDeviceCharactersService.list( new LambdaQueryWrapper<DeviceCharacters>().eq(DeviceCharacters::getDeviceNo,deviceInfo.getDeviceNo())); new LambdaQueryWrapper<DeviceCharacters>().eq(DeviceCharacters::getDeviceNo,mdcEquipment.getEquipmentId())); if (deviceCharactersList.isEmpty()){ return ""; }else { @@ -320,8 +328,9 @@ if(docInfo == null || docInfo.getDocStatus() == 3) ExceptionCast.cast(ActivitiCode.ACT_DOC_ERROR); DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId()); if(deviceInfo == null) MdcEquipment mdcEquipment = iMdcEquipmentService.getById(stream.getDeviceId()); // DeviceInfo deviceInfo = deviceInfoService.getById(stream.getDeviceId()); if(mdcEquipment == null) ExceptionCast.cast(ActivitiCode.ACT_ASSIGN_DEVICE_NONE); DocFile docFile = docFileService.getById(stream.getFileId()); if(docFile == null) @@ -329,10 +338,10 @@ DocInfo deviceDoc = docInfoService.getByDocAttrAndDocId(stream.getDocId(), 4, stream.getDeviceId()); if(deviceDoc != null) { // 删除 备份 覆盖 原有的 List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); List<String> strings=iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); if (strings != null && !strings.isEmpty()) { String path = StringUtils.join(strings.toArray(), "/"); boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ deviceInfo.getDeviceNo(), boolean copyFileNc = FileUtilS.copyFileNcToBak(path + "/"+ mdcEquipment.getEquipmentId(), docFile.getFileName(), docFile.getFileSuffix()); } } @@ -395,16 +404,16 @@ //TODO //插入文件传输任务表 List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); List<String> strings=iMdcProductionService.findListParentTreeAll(mdcEquipment.getId()); if (strings != null && !strings.isEmpty()) { String path = StringUtils.join(strings.toArray(), "/"); boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ deviceInfo.getDeviceNo(), boolean copyFileNc = FileUtilS.copyFileNc(docFile.getFilePath(),path + "/"+ mdcEquipment.getEquipmentId(), docFile.getFileEncodeName(), docFile.getFileName(),docFile.getFileSuffix()); if (!copyFileNc) { ExceptionCast.cast(ActivitiCode.ACT_FILE_ERROR); } else { FileUtilS.deleteZipFromToSend(path + "/"+ deviceInfo.getDeviceNo(), FileUtilS.deleteZipFromToSend(path + "/"+ mdcEquipment.getEquipmentId(), docFile.getFileName(),docFile.getFileSuffix()); } @@ -463,10 +472,10 @@ dncPassLogService.save(passInfoNc); NcTxtFilePathInfo ncTxt = new NcTxtFilePathInfo(); ncTxt.setEquipmentId(deviceInfo.getDeviceNo()); 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.setFilePath(path + "/"+ deviceInfo.getDeviceNo() + "/" ); ncTxt.setFilePath(path + "/"+ mdcEquipment.getEquipmentId() + "/" ); ncTxt.setOrigFileName(docFile.getFileName()); ncTxt.setOrigFileSuffix(docFile.getFileSuffix()); ncTxt.setFileAddOrDelete(1); @@ -495,7 +504,7 @@ localFilePath + "\\" + ncTxt.getFileNcName(), docFile.getFileSuffix()); */ boolean copyFileNc = FileUtilS.copyFileUpName(path + "/"+ deviceInfo.getDeviceNo() +"/send/" + boolean copyFileNc = FileUtilS.copyFileUpName(path + "/"+ mdcEquipment.getEquipmentId() +"/send/" + docFile.getFileName(), localFilePath + ncTxt.getFileNcName(), // localFilePath + "\\" + ncTxt.getFileNcName(), lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java
@@ -11,6 +11,7 @@ import org.jeecg.modules.dnc.response.QueryListResponseResult; import org.jeecg.modules.dnc.response.ResponseResult; import org.jeecg.modules.dnc.service.IDocRelativeService; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -38,8 +39,8 @@ @AutoLog(value = "设备关联文档表-查询文档下的所有关联设备信息") @ApiOperation(value = "设备关联文档表-查询文档下的所有关联设备信息", notes = "设备关联文档表-查询文档下的所有关联设备信息") @GetMapping("/get/device/{docId}") public QueryListResponseResult<DeviceInfo> findDeviceByDocId(@PathVariable("docId") String docId) { List<DeviceInfo> list = relativeService.findDeviceByDocId(docId); public QueryListResponseResult<MdcEquipment> findDeviceByDocId(@PathVariable("docId") String docId) { List<MdcEquipment> list = relativeService.findDeviceByDocId(docId); if(list == null) list = Collections.emptyList(); return new QueryListResponseResult<>(CommonCode.SUCCESS, list); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceCharacters.java
@@ -24,7 +24,7 @@ @TableField(value = "device_no") private String deviceNo; @TableField(value = "depart_id") @Dict(dictTable = "sys_department",dicCode = "depart_id",dicText = "depart_name") @Dict(dictTable = "mdc_production",dicCode = "id",dicText = "production_name") private String departId; @TableField(value = "control_system") private String controlSystem; lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocRelativeMapper.java
@@ -4,6 +4,7 @@ import org.jeecg.modules.dnc.entity.DeviceInfo; import org.jeecg.modules.dnc.entity.DocRelative; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcEquipment; import java.util.List; @@ -13,5 +14,5 @@ * @param docId * @return */ List<DeviceInfo> findDeviceByDocId(@Param("docId") String docId); List<MdcEquipment> findDeviceByDocId(@Param("docId") String docId); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocRelativeMapper.xml
@@ -1,24 +1,32 @@ <?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.DocRelativeMapper"> <select id="findDeviceByDocId" resultType="org.jeecg.modules.dnc.entity.DeviceInfo" parameterType="String"> select d.device_id , d.group_id , d.device_no , d.device_name , d.control_system , d.device_model , d.link_ip , d.link_port , d.depart_id , g.group_name , s.depart_name from nc_device_info d inner join (select distinct attribution_id from nc_doc_relative where doc_id=#{docId} and delete_flag=0 and attribution_type=4) dp on d.device_id=dp.attribution_id inner join nc_device_group g on d.group_id=g.group_id inner join sys_department s on d.depart_id=s.depart_id <select id="findDeviceByDocId" resultType="org.jeecg.modules.mdc.entity.MdcEquipment" parameterType="String"> SELECT d.id, d.equipment_id, d.equipment_name, d.control_system, d.equipment_model, d.equipment_type, d.equipment_ip, d.data_port, p.production_name FROM mdc_equipment d JOIN mdc_production_equipment g ON d.id = g.equipment_id JOIN mdc_production p ON p.id = g.production_id WHERE EXISTS ( SELECT 1 FROM nc_doc_relative nr WHERE nr.doc_id = #{docId} AND nr.delete_flag = 0 AND nr.attribution_type = 4 AND nr.attribution_id = d.id ); </select> </mapper> lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocRelativeService.java
@@ -3,6 +3,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import org.jeecg.modules.dnc.entity.DeviceInfo; import org.jeecg.modules.dnc.entity.DocRelative; import org.jeecg.modules.mdc.entity.MdcEquipment; import java.util.List; @@ -46,5 +47,5 @@ * @param docId * @return */ List<DeviceInfo> findDeviceByDocId(String docId); List<MdcEquipment> findDeviceByDocId(String docId); } lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocFileServiceImpl.java
@@ -16,6 +16,7 @@ import org.jeecg.modules.dnc.service.IDocFileService; import org.jeecg.modules.dnc.service.IDocInfoService; import org.jeecg.modules.dnc.service.IDocRelativeService; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; @@ -86,7 +87,7 @@ if(docFile == null) { ExceptionCast.cast(DocumentCode.DOC_FILE_ERROR); } List<DeviceInfo> deviceList = docRelativeService.findDeviceByDocId(docFile.getDocId()); List<MdcEquipment> deviceList = docRelativeService.findDeviceByDocId(docFile.getDocId()); if(deviceList != null && !deviceList.isEmpty()) ExceptionCast.cast(DocumentCode.DOC_DEVICE_EXIST); DocInfo docInfo = new DocInfo(); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java
@@ -25,6 +25,7 @@ import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.response.*; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.system.service.ISysDictService; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -359,7 +360,7 @@ DocInfo en = super.getById(id); if(en == null) ExceptionCast.cast(DocumentCode.DOC_NOT_EXIST); List<DeviceInfo> deviceList = docRelativeService.findDeviceByDocId(en.getDocId()); List<MdcEquipment> deviceList = docRelativeService.findDeviceByDocId(en.getDocId()); if(deviceList != null && !deviceList.isEmpty()) ExceptionCast.cast(DocumentCode.DOC_DEVICE_EXIST); String suffix = FileUtilS.getFileSuffix(file.getOriginalFilename()); lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java
@@ -19,6 +19,9 @@ import org.jeecg.modules.dnc.utils.file.FileUtilS; import org.apache.commons.lang3.StringUtils; import org.jeecg.modules.mdc.entity.MdcEquipment; import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.system.service.IMdcProductionService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -39,6 +42,10 @@ private String localFilePath; @Autowired private IDncPassLogService dncPassLogService; @Autowired private IMdcEquipmentService iMdcEquipmentService; @Autowired private IMdcProductionService iMdcProductionService; @Override @@ -80,6 +87,7 @@ if (b && docRel) { DocInfo info = docInfoMapper.selectById(docId); //todo 修改为mdc设备 DeviceInfo deviceInfo = deviceInfoService.getById(attrId); List<String> strings = deviceGroupService.findListParentTreeAll(deviceInfo.getGroupId()); if (strings != null && !strings.isEmpty()) { @@ -150,7 +158,7 @@ @Override @Transactional(rollbackFor = {Exception.class}) public List<DeviceInfo> findDeviceByDocId(String docId) { public List<MdcEquipment> findDeviceByDocId(String docId) { if(!ValidateUtil.validateString(docId)) ExceptionCast.cast(CommonCode.INVALID_PARAM); return super.getBaseMapper().findDeviceByDocId(docId); lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java
@@ -405,12 +405,12 @@ @AutoLog(value = "设备表-加载产线设备树") @ApiOperation(value = "设备表-加载产线设备树", notes = "设备表-加载产线设备树") @GetMapping(value = "/queryTreeListByProduction") public Result<List<MdcEquipmentTree>> queryTreeListByProduction() { public Result<List<MdcEquipmentTree>> queryTreeListByProduction(String type) { Result<List<MdcEquipmentTree>> result = new Result<>(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = user.getId(); try { List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProduction(userId); List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProduction(userId,type); result.setSuccess(true); result.setResult(mdcEquipmentTreeList); } catch (Exception e) { @@ -530,10 +530,10 @@ @AutoLog(value = "设备表-通过车间ids获取设备树") @ApiOperation(value = "设备表-通过车间ids获取设备树", notes = "设备表-通过车间ids获取设备树") @GetMapping(value = "/loadTreeListByProductionIds") public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids) { public Result<?> loadTreeListByProductionIds(@RequestParam(name = "ids", required = true) String ids,@RequestParam(name = "type", required = true)String type) { Result<List<MdcEquipmentTree>> result = new Result<>(); try { List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids); List<MdcEquipmentTree> mdcEquipmentTreeList = mdcEquipmentService.loadTreeListByProductionIds(ids,type); result.setSuccess(true); result.setResult(mdcEquipmentTreeList); } catch (Exception e) { lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java
@@ -152,6 +152,18 @@ @ApiModelProperty(value = "设备种类") private String deviceCategory; /** * 是否DNC设备 */ @ApiModelProperty(value = "是否DNC设备") private String deviceTypeDnc; /** * 是否MDC设备 */ @ApiModelProperty(value = "是否MDC设备") private String deviceTypeMdc; /**部门名称*/ @Excel(name = "部门名称", width = 15) private transient String orgCodeTxt; lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -56,7 +56,7 @@ /** * 根据产线id查询设备 */ List<MdcEquipment> queryByProductionId(@Param("productionId") String productionId); List<MdcEquipment> queryByProductionId(@Param("productionId") String productionId,@Param("type")String type); /** * 查找设备监控信息 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -71,6 +71,12 @@ WHERE mpe.equipment_id = me.id AND mpe.production_id = #{ productionId } <if test="type == 'DNC'"> AND me.device_type_dnc = '1' </if> <if test="type == 'MDC'"> AND me.device_type_mdc = '1' </if> ORDER BY me.equipment_id </select> @@ -276,4 +282,4 @@ t1.id = #{ id } </select> </mapper> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/model/MdcEquipmentTree.java
@@ -22,7 +22,7 @@ @EqualsAndHashCode(callSuper = false) @Accessors(chain = true) @ApiModel(value = "设备树结构数据实体", description = "设备") public class MdcEquipmentTree implements Serializable { public class MdcEquipmentTree<T> implements Serializable { private static final long serialVersionUID = -5202127219834067917L; @@ -60,6 +60,18 @@ * 父级id(前端请求用) */ private String parentId; /** * 车间描述 */ private String memo; private T entity; /** * 类型 1 车间 2设备 */ private Integer type; private List<MdcEquipmentTree> children = new ArrayList<>(); @@ -99,6 +111,8 @@ this.key = treeModel.getId(); this.value = treeModel.getId(); this.title = treeModel.getProductionName(); this.memo = treeModel.getMemo(); this.type =treeModel.getType(); return this; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -106,7 +106,7 @@ /** * 加载产线设备树 */ List<MdcEquipmentTree> loadTreeListByProduction(String userId); List<MdcEquipmentTree> loadTreeListByProduction(String userId,String type); /** * 设备监控列表 @@ -198,7 +198,7 @@ * @param ids * @return */ List<MdcEquipmentTree> loadTreeListByProductionIds(String ids); List<MdcEquipmentTree> loadTreeListByProductionIds(String ids,String type); /** * 查询单表数据 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -1,5 +1,6 @@ package org.jeecg.modules.mdc.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.metadata.IPage; @@ -260,6 +261,7 @@ if (equipmentList != null && !equipmentList.isEmpty()) { for (MdcEquipment mdcEquipment : equipmentList) { MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment); tree.setParentId(mdcEquipmentTree.getKey()); mdcEquipmentTree.getChildren().add(tree); } @@ -293,7 +295,7 @@ @Override public List<MdcEquipmentTree> loadTreeListByProduction(String userId) { public List<MdcEquipmentTree> loadTreeListByProduction(String userId,String type) { //获取所有产线数据 List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder)); //根据用户id获取拥有的产线信息集合 @@ -310,7 +312,7 @@ //组装产线设备树 List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list); //填充设备数据 FillEquipmentByProduction(treeList); FillEquipmentByProduction(treeList,type); return treeList; } @@ -609,19 +611,21 @@ /** * 产线设备树填充设备数据 */ private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList) { private void FillEquipmentByProduction(List<MdcEquipmentTree> treeList,String type) { for (MdcEquipmentTree mdcEquipmentTree : treeList) { List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey()); List<MdcEquipment> equipmentList = this.baseMapper.queryByProductionId(mdcEquipmentTree.getKey(),type); if (equipmentList != null && !equipmentList.isEmpty()) { for (MdcEquipment mdcEquipment : equipmentList) { MdcEquipmentTree tree = new MdcEquipmentTree().convert(mdcEquipment); tree.setParentId(mdcEquipmentTree.getKey()); tree.setEntity(mdcEquipment); tree.setType(2); mdcEquipmentTree.getChildren().add(tree); } mdcEquipmentTree.setLeaf(false); } if (!mdcEquipmentTree.getChildren().isEmpty()) { FillEquipmentByProduction(mdcEquipmentTree.getChildren()); FillEquipmentByProduction(mdcEquipmentTree.getChildren(),type); } } } @@ -816,7 +820,7 @@ * @return */ @Override public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids) { public List<MdcEquipmentTree> loadTreeListByProductionIds(String ids,String type) { List<String> productionIds = Arrays.asList(ids.split(",")); //获取所有产线数据 List<MdcProduction> productionList = mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder)); @@ -832,7 +836,7 @@ //组装产线设备树 List<MdcEquipmentTree> treeList = FindsEquipmentProductionUtil.wrapEquipmentProductionTreeList(list); //填充设备数据 FillEquipmentByProduction(treeList); FillEquipmentByProduction(treeList,type); return treeList; } lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/FindsEquipmentProductionUtil.java
@@ -36,6 +36,7 @@ List<MdcProductionTreeModel> treeList = new ArrayList<>(); for (MdcProductionTreeModel mdcProductionTreeModel : recordList) { if (oConvertUtils.isEmpty(mdcProductionTreeModel.getParentId())) { mdcProductionTreeModel.setType(1); treeList.add(mdcProductionTreeModel); idList.add(new MdcEquipmentTree().convertByProduction(mdcProductionTreeModel)); } @@ -54,6 +55,7 @@ MdcProductionTreeModel m = recordList.get(i1); if (m.getParentId() != null && m.getParentId().equals(model.getId())) { model.getChildren().add(m); m.setType(1); mdcEquipmentTree.getChildren().add(new MdcEquipmentTree().convertByProduction(m)); } } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/model/MdcProductionTreeModel.java
@@ -39,6 +39,11 @@ private String title; private boolean isLeaf; /** * 类型 */ private Integer type; //以下所有字段均与MdcProduction相同 private String id; lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java
@@ -83,4 +83,19 @@ * 根据用户id查询用户工段权限 */ String findThreeProductionId(String userId); /** * 查询所有父节点和本节点名称 * @param id * @return */ List<String> findListParentTreeAll(String id); /** * 查询所有父节点名称 * @param parentId * @param stringList * @return */ List<String> findListParentTree(String parentId,List<String> stringList); } lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -2,6 +2,7 @@ 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.IdWorker; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.lang3.StringUtils; @@ -312,4 +313,54 @@ } } } /** * 查询所有父节点和本节点名称 * @param id * @return */ @Override public List<String> findListParentTreeAll(String id){ MdcProductionEquipment mdcProductionEquipment=productionEquipmentMapper.selectOne(new QueryWrapper<MdcProductionEquipment>().eq("equipment_id",id)); if (mdcProductionEquipment==null) { return null; } List<String> strings = new ArrayList<>(); MdcProduction en=super.getById(mdcProductionEquipment.getProductionId()); if (en == null) { return null; } strings.add(en.getProductionName()); if (StringUtils.isEmpty(en.getParentId())) { return strings; } else { return findListParentTree(en.getParentId(),strings); } } // 查询所以父节点 @Override public List<String> findListParentTree(String parentId,List<String> stringList){ if (StringUtils.isEmpty(parentId)) { return null; } if (stringList == null || stringList.isEmpty()) { stringList = new ArrayList<>(); } boolean p = true; if (p) { MdcProduction en = super.getById(parentId); if (en != null) { stringList.add(0,en.getProductionName()); } if (StringUtils.isNotBlank(en.getParentId())) { parentId = en.getParentId(); findListParentTree(parentId,stringList); } else { p = false; return stringList; } } return stringList; } } lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml
@@ -126,7 +126,7 @@ connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000 datasource: master: url: jdbc:sqlserver://192.168.124.118:1433;databasename=LXZN_TEST_HANGYU url: jdbc:sqlserver://192.168.1.118:1433;databasename=LXZN_TEST_HANGYU username: sa password: 123 driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver