From 438b6be5ea9ed484b50a45a0f210b80180473491 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期二, 11 二月 2025 11:51:45 +0800 Subject: [PATCH] dnc与mdc部门进行整合 使用Mdc部门进行处理 修改所属部门为所属车间 修改yml文件数据库地址 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java | 5 lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml | 2 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml | 8 + lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/model/MdcProductionTreeModel.java | 5 + lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java | 37 ++++-- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java | 10 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java | 12 ++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/model/MdcEquipmentTree.java | 16 +++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocRelativeService.java | 3 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocRelativeMapper.java | 3 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java | 15 +++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocFileServiceImpl.java | 3 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java | 18 ++- lxzn-module-dnc/pom.xml | 6 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/FindsEquipmentProductionUtil.java | 2 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceCharacters.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java | 8 lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java | 9 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocRelativeMapper.xml | 46 +++++--- lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiSignExamine.java | 2 lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java | 51 ++++++++++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java | 3 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java | 4 25 files changed, 212 insertions(+), 62 deletions(-) diff --git a/lxzn-module-dnc/pom.xml b/lxzn-module-dnc/pom.xml index 1e40853..ed3a17f 100644 --- a/lxzn-module-dnc/pom.xml +++ b/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> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java index 34e5ef3..f11db6b 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiDefinition.java +++ b/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") diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiSignExamine.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiSignExamine.java index 9741240..ae8e5a4 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/entity/ActivitiSignExamine.java +++ b/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") diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java index 34bc76c..b2b524d 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/ActivitiDefinitionServiceImpl.java +++ b/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) + //淇敼涓簃dc杞﹂棿 + 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) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java index 82b3031..e1c09c3 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/activiti/service/impl/AssignFileStreamServiceImpl.java +++ b/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锛屾枃浠禝D */ public String getDeviceSpecialChar(String deviceId, String fileId){ - DeviceInfo deviceInfo = deviceInfoService.getById(deviceId); - if(deviceInfo == null) + //鏇挎崲涓簃dc璁惧琛� +// 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(), diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java index 91181e2..8b77545 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/DocRelativeController.java +++ b/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); diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceCharacters.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceCharacters.java index 6383363..a64fbc6 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DeviceCharacters.java +++ b/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; diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocRelativeMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocRelativeMapper.java index 79ae672..60ed32d 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DocRelativeMapper.java +++ b/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); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocRelativeMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocRelativeMapper.xml index d281d41..3d25f8a 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocRelativeMapper.xml +++ b/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> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocRelativeService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocRelativeService.java index 0d1c7e2..c4f8396 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDocRelativeService.java +++ b/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); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocFileServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocFileServiceImpl.java index 3bbba55..920cf7a 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocFileServiceImpl.java +++ b/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(); diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java index 7db259e..9ebf535 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java @@ -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()); diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java index 2944228..2463c9b 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocRelativeServiceImpl.java @@ -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 淇敼涓簃dc璁惧 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); diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java index 816cc92..c834e49 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentController.java +++ b/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) { diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java index afb4a9a..c299755 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipment.java +++ b/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; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java index 06246bc..76376d4 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java +++ b/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); /** * 鏌ユ壘璁惧鐩戞帶淇℃伅 diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml index 828999f..a4943b3 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml +++ b/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> \ No newline at end of file +</mapper> diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/model/MdcEquipmentTree.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/model/MdcEquipmentTree.java index c4a05b1..33d8b12 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/model/MdcEquipmentTree.java +++ b/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; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java index 5e20315..3fe672c 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java +++ b/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); /** * 鏌ヨ鍗曡〃鏁版嵁 diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java index ad9d45f..1937aa0 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java +++ b/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; } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/FindsEquipmentProductionUtil.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/FindsEquipmentProductionUtil.java index bb55ef2..3ca0618 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/util/FindsEquipmentProductionUtil.java +++ b/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)); } } diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/model/MdcProductionTreeModel.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/model/MdcProductionTreeModel.java index c7f84f5..2af1b4b 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/model/MdcProductionTreeModel.java +++ b/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; //浠ヤ笅鎵�鏈夊瓧娈靛潎涓嶮dcProduction鐩稿悓 private String id; diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java index cfd203d..df9cba2 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java @@ -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); } diff --git a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java index 120968b..1e330f5 100644 --- a/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java +++ b/lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java @@ -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; + } } diff --git a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml b/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml index 481e2df..3e0af92 100644 --- a/lxzn-module-system/lxzn-system-start/src/main/resources/application-dev.yml +++ b/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 -- Gitblit v1.9.3