From 1930b4e59d60c015ffa7bfee92e4bc227b90dcb3 Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期三, 28 五月 2025 15:41:41 +0800 Subject: [PATCH] 1.Dnc产品结构树检索nc文件 2.新增批次功能 3.新增审签查询流程 4.修改刀具系统查询 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceTypeMapper.xml | 25 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/CutterController.java | 15 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiCode.java | 4 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/CutterServiceImpl.java | 139 ++++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/GuideCardBatchController.java | 166 +++++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/GuideCardBatchServiceImpl.java | 71 ++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java | 39 lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/DispatchFileController.java | 15 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java | 17 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java | 134 ++++ lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java | 28 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml | 77 + lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/IMsiWebapiJsonService.java | 2 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/TreeInfoRequest.java | 16 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IGuideCardBatchService.java | 20 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceTypeMapper.java | 11 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java | 243 ++++++- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/ICutterService.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocInfo.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceTypeService.java | 7 lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/impl/MsiWebapiJsonServiceImpl.java | 63 ++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceTypeServiceImpl.java | 10 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java | 22 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/GuideCardBatchMapper.java | 14 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java | 144 ++++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/IDispatchFileService.java | 7 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/GuideCardBatch.java | 163 +++++ lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java | 45 lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java | 28 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/GuideCardBatchMapper.xml | 5 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/constant/DocAttributionTypeEnum.java | 39 + lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Cutter.java | 10 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DocInfoServiceImpl.java | 28 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java | 91 +- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java | 15 36 files changed, 1,512 insertions(+), 222 deletions(-) diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/constant/DocAttributionTypeEnum.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/constant/DocAttributionTypeEnum.java new file mode 100644 index 0000000..0e8acd3 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/constant/DocAttributionTypeEnum.java @@ -0,0 +1,39 @@ +package org.jeecg.modules.dnc.constant; + +public enum DocAttributionTypeEnum { + + PRODUCT(1, "浜у搧"), + COMPONENT(2, "閮ㄤ欢/瀛愰儴浠�"), + PARTS(3, "闆朵欢"), + OPERATION(4, "宸ヨ壓瑙勭▼鐗堟湰"), + PROCESS(5, "宸ュ簭"), + WORKSITE(6, "宸ユ"), + DEVICE(7, "璁惧"); + + private Integer code; + private String name; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + DocAttributionTypeEnum() { + } + + DocAttributionTypeEnum(Integer code, String name) { + this.code = code; + this.name = name; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/CutterController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/CutterController.java index 186190a..3d85d1a 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/CutterController.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/CutterController.java @@ -95,4 +95,19 @@ public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { return super.importExcel(request, response, Cutter.class); } + + /** + * 鎻愬彇鍒�鍏� + * @param docId 鏂囨。Id + * @return + */ + @AutoLog(value = "鍒�鍏蜂俊鎭�-鎻愬彇鍒�鍏�") + @ApiOperation(value = "鍒�鍏蜂俊鎭�-鎻愬彇鍒�鍏�", notes = "鍒�鍏蜂俊鎭�-鎻愬彇鍒�鍏�") + @GetMapping("/extractCutterInfo/{docId}/{attributionType}/{attributionId}") + public Result<?> extractCutterInfo(@PathVariable("docId") String docId + ,@PathVariable("attributionType") Integer attributionType + ,@PathVariable("attributionId") String attributionId) { + return service.extractAndSaveFromContent(docId,attributionId,attributionType); + } + } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/GuideCardBatchController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/GuideCardBatchController.java new file mode 100644 index 0000000..8f1b9c3 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/GuideCardBatchController.java @@ -0,0 +1,166 @@ +package org.jeecg.modules.dnc.controller; + +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +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.common.system.base.controller.JeecgController; +import org.jeecg.modules.dnc.entity.GuideCardBatch; +import org.jeecg.modules.dnc.service.IGuideCardBatchService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; + + /** + * @Description: nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛� + * @Author: jeecg-boot + * @Date: 2025-05-27 + * @Version: V1.0 + */ +@Api(tags="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�") +@RestController +@RequestMapping("/dnc/guideCardBatch") +@Slf4j +public class GuideCardBatchController extends JeecgController<GuideCardBatch, IGuideCardBatchService> { + @Autowired + private IGuideCardBatchService guideCardBatchService; + + /** + * 鍒嗛〉鍒楄〃鏌ヨ + * + * @param guideCardBatch + * @param pageNo + * @param pageSize + * @param req + * @return + */ + //@AutoLog(value = "nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-鍒嗛〉鍒楄〃鏌ヨ") + @ApiOperation(value="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-鍒嗛〉鍒楄〃鏌ヨ", notes="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-鍒嗛〉鍒楄〃鏌ヨ") + @GetMapping(value = "/list") + public Result<IPage<GuideCardBatch>> queryPageList(GuideCardBatch guideCardBatch, + @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, + @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, + HttpServletRequest req) { + QueryWrapper<GuideCardBatch> queryWrapper = new QueryWrapper<>(); + queryWrapper.eq(StrUtil.isNotEmpty(guideCardBatch.getDocId()), "doc_id", guideCardBatch.getDocId()); + queryWrapper.like(StrUtil.isNotEmpty(guideCardBatch.getSerialNumber()), "serial_number", guideCardBatch.getSerialNumber()); + queryWrapper.like(StrUtil.isNotEmpty(guideCardBatch.getProcessingBatch()), "processing_batch", guideCardBatch.getProcessingBatch()); + queryWrapper.like(StrUtil.isNotEmpty(guideCardBatch.getFixtureInformation()), "fixture_information", guideCardBatch.getFixtureInformation()); + queryWrapper.orderByAsc("create_time"); + Page<GuideCardBatch> page = new Page<GuideCardBatch>(pageNo, pageSize); + IPage<GuideCardBatch> pageList = guideCardBatchService.page(page, queryWrapper); + return Result.OK(pageList); + } + + /** + * 娣诲姞 + * + * @param guideCardBatch + * @return + */ + @AutoLog(value = "nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-娣诲姞") + @ApiOperation(value="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-娣诲姞", notes="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-娣诲姞") + //@RequiresPermissions("org.jeecg.modules:nc_guide_card_batch:add") + @PostMapping(value = "/add") + public Result<String> add(@RequestBody GuideCardBatch guideCardBatch) { + guideCardBatchService.save(guideCardBatch); + return Result.OK("娣诲姞鎴愬姛锛�"); + } + + /** + * 缂栬緫 + * + * @param guideCardBatch + * @return + */ + @AutoLog(value = "nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-缂栬緫") + @ApiOperation(value="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-缂栬緫", notes="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-缂栬緫") + //@RequiresPermissions("org.jeecg.modules:nc_guide_card_batch:edit") + @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) + public Result<String> edit(@RequestBody GuideCardBatch guideCardBatch) { + guideCardBatchService.updateById(guideCardBatch); + return Result.OK("缂栬緫鎴愬姛!"); + } + + /** + * 閫氳繃id鍒犻櫎 + * + * @param id + * @return + */ + @AutoLog(value = "nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-閫氳繃id鍒犻櫎") + @ApiOperation(value="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-閫氳繃id鍒犻櫎", notes="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-閫氳繃id鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:nc_guide_card_batch:delete") + @DeleteMapping(value = "/delete") + public Result<String> delete(@RequestParam(name="id",required=true) String id) { + guideCardBatchService.removeById(id); + return Result.OK("鍒犻櫎鎴愬姛!"); + } + + /** + * 鎵归噺鍒犻櫎 + * + * @param ids + * @return + */ + @AutoLog(value = "nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-鎵归噺鍒犻櫎") + @ApiOperation(value="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-鎵归噺鍒犻櫎", notes="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-鎵归噺鍒犻櫎") + //@RequiresPermissions("org.jeecg.modules:nc_guide_card_batch:deleteBatch") + @DeleteMapping(value = "/deleteBatch") + public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) { + this.guideCardBatchService.removeByIds(Arrays.asList(ids.split(","))); + return Result.OK("鎵归噺鍒犻櫎鎴愬姛!"); + } + + /** + * 閫氳繃id鏌ヨ + * + * @param id + * @return + */ + //@AutoLog(value = "nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-閫氳繃id鏌ヨ") + @ApiOperation(value="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-閫氳繃id鏌ヨ", notes="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�-閫氳繃id鏌ヨ") + @GetMapping(value = "/queryById") + public Result<GuideCardBatch> queryById(@RequestParam(name="id",required=true) String id) { + GuideCardBatch guideCardBatch = guideCardBatchService.getById(id); + if(guideCardBatch==null) { + return Result.error("鏈壘鍒板搴旀暟鎹�"); + } + return Result.OK(guideCardBatch); + } + + /** + * 瀵煎嚭excel + * + * @param request + * @param guideCardBatch + */ + //@RequiresPermissions("org.jeecg.modules:nc_guide_card_batch:exportXls") + @RequestMapping(value = "/exportXls") + public ModelAndView exportXls(HttpServletRequest request, GuideCardBatch guideCardBatch) { + return super.exportXls(request, guideCardBatch, GuideCardBatch.class, "nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�"); + } + + /** + * 閫氳繃excel瀵煎叆鏁版嵁 + * + * @param request + * @param response + * @return + */ + //@RequiresPermissions("nc_guide_card_batch:importExcel") + @RequestMapping(value = "/importExcel", method = RequestMethod.POST) + public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { + return super.importExcel(request, response, GuideCardBatch.class); + } + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java index 179adb6..09e695b 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/controller/ProductInfoController.java @@ -288,4 +288,19 @@ return Result.ok(list); } + /** + * 閫氳繃浠e彿銆佸悕绉般�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * @param treeInfoRequest + * @return + */ + @AutoLog(value = "闆朵欢淇℃伅琛�-閫氳繃浠e彿銆佸悕绉般�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲NC鏂囦欢") + @ApiOperation(value = "闆朵欢淇℃伅琛�-閫氳繃浠e彿銆佸悕绉般�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲NC鏂囦欢", notes = "闆朵欢淇℃伅琛�-閫氳繃浠e彿銆佸悕绉般�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲NC鏂囦欢") + @GetMapping("/query/nc") + public Result<?> queryOtherFileInfo(TreeInfoRequest treeInfoRequest) { + List<DocInfo> list = productInfoService.getByTreeNcFileInfo(treeInfoRequest); + if (list == null) + list = Collections.emptyList(); + return Result.ok(list); + } + } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Cutter.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Cutter.java index 4e95a6a..ad604fe 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Cutter.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/Cutter.java @@ -33,6 +33,11 @@ @TableField(value = "attribution_type") private Integer attributionType; + //瀵瑰簲鏂囨。id + @Excel(name = "瀵瑰簲鏂囨。id", width = 15) + @TableField(value = "doc_id") + private String docId; + //鍒�鍏峰悕绉� @Excel(name = "鍒�鍏峰悕绉�", width = 15) @TableField(value = "cutter_name") @@ -64,6 +69,11 @@ @TableField(value = "quantity") private Integer quantity; + //鍒�鍏疯鏍� + @Excel(name = "鍒�鍏疯鏍�", width = 15) + @TableField(value = "cutter_spec") + private String cutterSpec; + //鎻忚堪 @Excel(name = "鎻忚堪", width = 15) @TableField(value = "description") diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocInfo.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocInfo.java index e12a456..9e3df96 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocInfo.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/DocInfo.java @@ -69,6 +69,7 @@ @TableField(exist = false) private String attributionId; @TableField(exist = false) + @Dict(dictTable = "nc_doc_classification", dicCode = "classification_id", dicText = "classification_code") private String classificationId; //鍚屾鐘舵�� 1 鏈悓姝� 2 宸插悓姝� @TableField(exist = false) @@ -81,5 +82,11 @@ //鎵�灞炶妭鐐逛唬鍙� @TableField(exist = false) private String nodeCode; + //璁惧绫诲悕绉� + @TableField(exist = false) + private String deviceName; + //璁惧绫诲垎绾� + @TableField(exist = false) + private String deviceCode; } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/GuideCardBatch.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/GuideCardBatch.java new file mode 100644 index 0000000..a3bd5f4 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/entity/GuideCardBatch.java @@ -0,0 +1,163 @@ +package org.jeecg.modules.dnc.entity; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Description: nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛� + * @Author: jeecg-boot + * @Date: 2025-05-27 + * @Version: V1.0 + */ +@Data +@TableName("nc_guide_card_batch") +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = false) +@ApiModel(value="nc_guide_card_batch瀵硅薄", description="nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛�") +public class GuideCardBatch implements Serializable { + private static final long serialVersionUID = 1L; + + /**涓婚敭*/ + @TableId(type = IdType.ASSIGN_ID) + @ApiModelProperty(value = "涓婚敭") + private String id; + /**nc鏂囨。琛ㄤ富閿�*/ + @Excel(name = "nc鏂囨。琛ㄤ富閿�", width = 15) + @ApiModelProperty(value = "nc鏂囨。琛ㄤ富閿�") + private String docId; + /**mes鏍囪瘑*/ + @Excel(name = "mes鏍囪瘑", width = 15) + @ApiModelProperty(value = "mes鏍囪瘑") + private String mesSign; + /**鎵规鍙�*/ + @Excel(name = "鎵规鍙�", width = 15) + @ApiModelProperty(value = "鎵规鍙�") + private String batchNumber; + /**娴佹按鍙�*/ + @Excel(name = "娴佹按鍙�", width = 15) + @ApiModelProperty(value = "娴佹按鍙�") + private String serialNumber; + /**鍗曚綅*/ + @Excel(name = "鍗曚綅", width = 15) + @ApiModelProperty(value = "鍗曚綅") + private String unit; + /**绋嬪簭鏂囦欢鍚�*/ + @Excel(name = "绋嬪簭鏂囦欢鍚�", width = 15) + @ApiModelProperty(value = "绋嬪簭鏂囦欢鍚�") + private String docName; + /**闆朵欢鍥惧彿*/ + @Excel(name = "闆朵欢鍥惧彿", width = 15) + @ApiModelProperty(value = "闆朵欢鍥惧彿") + private String partsCode; + /**闆朵欢鍚嶇О*/ + @Excel(name = "闆朵欢鍚嶇О", width = 15) + @ApiModelProperty(value = "闆朵欢鍚嶇О") + private String partsName; + /**闆朵欢鏉愭枡*/ + @Excel(name = "闆朵欢鏉愭枡", width = 15) + @ApiModelProperty(value = "闆朵欢鏉愭枡") + private String materielDesp; + /**澶瑰叿*/ + @Excel(name = "澶瑰叿", width = 15) + @ApiModelProperty(value = "澶瑰叿") + private String fixtureInformation; + /**宸ュ簭锛堝伐姝ュ彿锛�*/ + @Excel(name = "宸ュ簭锛堝伐姝ュ彿锛�", width = 15) + @ApiModelProperty(value = "宸ュ簭锛堝伐姝ュ彿锛�") + private String processWorkCode; + /**鍔犲伐鎵规*/ + @Excel(name = "鍔犲伐鎵规", width = 15) + @ApiModelProperty(value = "鍔犲伐鎵规") + private String processingBatch; + /**鍔犲伐鏁伴噺*/ + @Excel(name = "鍔犲伐鏁伴噺", width = 15) + @ApiModelProperty(value = "鍔犲伐鏁伴噺") + private String processingQuantity; + /**鍔犲伐璁惧*/ + @Excel(name = "鍔犲伐璁惧", width = 15) + @ApiModelProperty(value = "鍔犲伐璁惧") + private String processingEquipment; + /**鍥剧墖*/ + @Excel(name = "鍥剧墖", width = 15) + @ApiModelProperty(value = "鍥剧墖") + private String picture; + /**璇存槑淇℃伅*/ + @Excel(name = "璇存槑淇℃伅", width = 15) + @ApiModelProperty(value = "璇存槑淇℃伅") + private String remake; + /**娴佺▼鐘舵��*/ + @Excel(name = "娴佺▼鐘舵��", width = 15) + @ApiModelProperty(value = "娴佺▼鐘舵��") + private String flowStatus; + /**缂栧啓浜�*/ + @Excel(name = "缂栧啓浜�", width = 15) + @ApiModelProperty(value = "缂栧啓浜�") + private String compiler; + /**缂栧啓鏃ユ湡*/ + @Excel(name = "缂栧啓鏃ユ湡", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "缂栧啓鏃ユ湡") + private Date compilerTime; + /**鏍″浜�*/ + @Excel(name = "鏍″浜�", width = 15) + @ApiModelProperty(value = "鏍″浜�") + private String proofreader; + /**鏍″鏃ユ湡*/ + @Excel(name = "鏍″鏃ユ湡", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "鏍″鏃ユ湡") + private Date proofreaderTime; + /**鎿嶄綔鑰�*/ + @Excel(name = "鎿嶄綔鑰�", width = 15) + @ApiModelProperty(value = "鎿嶄綔鑰�") + private String operator; + /**棣栨鏃ユ湡*/ + @Excel(name = "棣栨鏃ユ湡", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "棣栨鏃ユ湡") + private Date inspectionTime; + /**瀹℃壒浜�*/ + @Excel(name = "瀹℃壒浜�", width = 15) + @ApiModelProperty(value = "瀹℃壒浜�") + private String approver; + /**瀹℃壒鏃ユ湡*/ + @Excel(name = "瀹℃壒鏃ユ湡", width = 15, format = "yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern="yyyy-MM-dd") + @ApiModelProperty(value = "瀹℃壒鏃ユ湡") + private Date approverTime; + /**鍒涘缓浜�*/ + @ApiModelProperty(value = "鍒涘缓浜�") + private String createBy; + /**鍒涘缓鏃ユ湡*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "鍒涘缓鏃ユ湡") + private Date createTime; + /**鏇存柊浜�*/ + @ApiModelProperty(value = "鏇存柊浜�") + private String updateBy; + /**鏇存柊鏃ユ湡*/ + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") + @ApiModelProperty(value = "鏇存柊鏃ユ湡") + private Date updateTime; + /**鎵�灞為儴闂�*/ + @ApiModelProperty(value = "鎵�灞為儴闂�") + private String sysOrgCode; +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceTypeMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceTypeMapper.java index cc95862..57eca5d 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceTypeMapper.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/DeviceTypeMapper.java @@ -1,7 +1,18 @@ package org.jeecg.modules.dnc.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Param; import org.jeecg.modules.dnc.entity.DeviceType; +import java.util.List; + public interface DeviceTypeMapper extends BaseMapper<DeviceType> { + + /** + * 妫�绱C鏌ヨ瀵瑰簲鐨勮澶囩被 + * @param attributionIds,attributionType,deviceManagementName,deviceManagementCode + * @return + */ + List<DeviceType> getDeviceTypeByAttribution(@Param("attributionIds") List<String> attributionIds, @Param("attributionType") Integer attributionType, + @Param("deviceManagementName") String deviceManagementName,@Param("deviceManagementCode") String deviceManagementCode); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/GuideCardBatchMapper.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/GuideCardBatchMapper.java new file mode 100644 index 0000000..3e6ef18 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/GuideCardBatchMapper.java @@ -0,0 +1,14 @@ +package org.jeecg.modules.dnc.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.jeecg.modules.dnc.entity.GuideCardBatch; + +/** + * @Description: nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛� + * @Author: jeecg-boot + * @Date: 2025-05-27 + * @Version: V1.0 + */ +public interface GuideCardBatchMapper extends BaseMapper<GuideCardBatch> { + +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceTypeMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceTypeMapper.xml index 9736052..1539214 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceTypeMapper.xml +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DeviceTypeMapper.xml @@ -1,4 +1,29 @@ <?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.DeviceTypeMapper"> + <select id="getDeviceTypeByAttribution" resultType="org.jeecg.modules.dnc.entity.DeviceType"> + SELECT + nc_device_type.*, + nc_device_management.device_management_name, + nc_device_management.device_management_code + FROM + nc_device_type + LEFT JOIN nc_device_management + ON nc_device_type.device_management_id = nc_device_management.id + WHERE + 1 = 1 + <if test="attributionIds != null and attributionIds.size() > 0"> + AND nc_device_type.attribution_id IN + <foreach collection="attributionIds" item="attributionId" open="(" close=")" separator=","> + #{attributionId} + </foreach> + </if> + AND nc_device_type.attribution_type = #{attributionType} + <if test="deviceManagementName != null and deviceManagementName != ''"> + AND nc_device_management.device_management_name LIKE CONCAT('%', #{deviceManagementName}, '%') + </if> + <if test="deviceManagementCode != null and deviceManagementCode != ''"> + AND nc_device_management.device_management_code LIKE CONCAT('%', #{deviceManagementCode}, '%') + </if> + </select> </mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml index 6f4ebd9..751da89 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/DocInfoMapper.xml @@ -2,33 +2,48 @@ <!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.DocInfoMapper"> <select id="findDocExtList" parameterType="String" resultType="org.jeecg.modules.dnc.entity.DocInfo"> - select - u.doc_id - ,r.classification_id - , CONCAT(u.doc_name, '.', u.doc_suffix) as doc_name - ,u.doc_alias - ,u.doc_code - ,u.doc_suffix - ,r.attribution_type - ,r.attribution_id - ,u.doc_status - ,u.doc_dispatch_status - ,u.publish_file_id - ,u.publish_version - ,u.description - ,u.CREATE_TIME - ,u.create_by - ,u.UPDATE_TIME - ,u.update_by - ,(case when o.doc_id is null then 1 else 2 end) as pullStatus - ,o.create_by as pullUser - from (select classification_id, doc_id,attribution_type,attribution_id from nc_doc_relative where delete_flag=0) r - inner join - (select * from nc_doc_info where delete_flag=0) u - on r.doc_id = u.doc_id - left join (select doc_id, create_by from nc_file_operate where delete_flag=0) o - on u.doc_id=o.doc_id - ${ew.customSqlSegment} + SELECT + u.doc_id, + r.classification_id, + CONVERT(VARCHAR(500), + CONCAT( + u.doc_name COLLATE Chinese_PRC_CI_AS, + '.' COLLATE Chinese_PRC_CI_AS, + u.doc_suffix COLLATE Chinese_PRC_CI_AS + ) + ) AS doc_name, -- 缁熶竴鎺掑簭瑙勫垯骞舵樉寮忚浆鎹㈢被鍨� + u.doc_alias, + u.doc_code, + u.doc_suffix, + r.attribution_type, + r.attribution_id, + u.doc_status, + u.doc_dispatch_status, + u.publish_file_id, + u.publish_version, + u.description, + u.CREATE_TIME, + u.create_by, + u.UPDATE_TIME, + u.update_by, + (CASE WHEN o.doc_id IS NULL THEN 1 ELSE 2 END) AS pullStatus, + o.create_by AS pullUser + FROM ( + SELECT classification_id, doc_id, attribution_type, attribution_id + FROM nc_doc_relative + WHERE delete_flag = 0 + ) r + INNER JOIN ( + SELECT * + FROM nc_doc_info + WHERE delete_flag = 0 + ) u ON r.doc_id = u.doc_id + LEFT JOIN ( + SELECT doc_id, create_by + FROM nc_file_operate + WHERE delete_flag = 0 + ) o ON u.doc_id = o.doc_id + ${ew.customSqlSegment} </select> @@ -36,7 +51,13 @@ select u.doc_id ,r.classification_id - , CONCAT(u.doc_name, '.', u.doc_suffix) as doc_name + , CONVERT(VARCHAR(500), + CONCAT( + u.doc_name COLLATE Chinese_PRC_CI_AS, + '.' COLLATE Chinese_PRC_CI_AS, + u.doc_suffix COLLATE Chinese_PRC_CI_AS + ) + ) AS doc_name -- 缁熶竴鎺掑簭瑙勫垯骞舵樉寮忚浆鎹㈢被鍨� ,u.doc_alias ,u.doc_code ,u.doc_suffix diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/GuideCardBatchMapper.xml b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/GuideCardBatchMapper.xml new file mode 100644 index 0000000..900a406 --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/mapper/xml/GuideCardBatchMapper.xml @@ -0,0 +1,5 @@ +<?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.GuideCardBatchMapper"> + +</mapper> diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/TreeInfoRequest.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/TreeInfoRequest.java index af2c999..0a889ce 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/TreeInfoRequest.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/request/TreeInfoRequest.java @@ -18,12 +18,24 @@ private List<String> partsIds; + private List<String> psvIds; + + private List<String> processIds; + + /**鑺傜偣鍚嶇О*/ private String treeName; - private String structureType; - + /**鑺傜偣缂栧彿*/ private String treeCode; + /**鏁版帶绯荤粺绫诲埆*/ + private String deviceManagementName; + + /**杞存暟*/ + private String deviceManagementCode; + + private String structureType; + @ApiModelProperty(value = "鏂囨。id") private String docId; diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiCode.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiCode.java index 62e9fef..5b0277e 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiCode.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/response/ActivitiCode.java @@ -23,7 +23,7 @@ ACT_DOC_ERROR(false,21015,"鍚姩娴佺▼澶辫触锛屾枃妗d俊鎭敊璇紒"), ACT_DEVICE_DOC_ERROR(false,21016,"鍚姩娴佺▼澶辫触锛岃澶囧凡瀛樺湪璇ユ枃妗o紒"), ACT_DOC_ERROR_DELEVE(false,21017,"鍚姩娴佺▼澶辫触锛岄噸澶嶆暟鎹垹闄ゅけ璐ワ紒"), - ACT_DEVICE_DOC_FILELABLE(false,21016,"瀵嗘爣绯荤粺寮傚父,锛�"); + ACT_DEVICE_DOC_FILELABLE(false,21018,"瀵嗘爣绯荤粺寮傚父,锛�"); //鎿嶄綔浠g爜 @ApiModelProperty(value = "鎿嶄綔鏄惁鎴愬姛", example = "true", required = true) @@ -35,7 +35,7 @@ //鎻愮ず淇℃伅 @ApiModelProperty(value = "鎿嶄綔鎻愮ず", example = "鎿嶄綔杩囦簬棰戠箒锛�", required = true) String message; - private ActivitiCode(boolean success, int code, String message){ + ActivitiCode(boolean success, int code, String message){ this.success = success; this.code = code; this.message = message; diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/ICutterService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/ICutterService.java index 6ff0f68..ad99cbf 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/ICutterService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/ICutterService.java @@ -34,4 +34,11 @@ */ Result<?> query(Cutter cutter, Integer pageNo, Integer pageSize); + /** + * 浠嶯C鏂囦欢鍐呭鎻愬彇鍒�鍏蜂俊鎭苟淇濆瓨 + * @param docId 鏂囨。id + */ + Result<?> extractAndSaveFromContent(String docId,String attributionId,Integer attributionType); + + } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceTypeService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceTypeService.java index b576bb8..332868e 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceTypeService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IDeviceTypeService.java @@ -42,4 +42,11 @@ */ Result<?> getByBusinessId(String businessId, String type); + /** + * 妫�绱C鏌ヨ瀵瑰簲鐨勮澶囩被 + * @param attributionIds,attributionType,systemType,deviceManagementCode + * @return + */ + List<DeviceType> getDeviceTypeByAttribution(List<String> attributionIds, Integer attributionType, String systemType, String deviceManagementCode); + } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IGuideCardBatchService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IGuideCardBatchService.java new file mode 100644 index 0000000..b40927f --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IGuideCardBatchService.java @@ -0,0 +1,20 @@ +package org.jeecg.modules.dnc.service; + +import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.GuideCardBatch; + +/** + * @Description: nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛� + * @Author: jeecg-boot + * @Date: 2025-05-27 + * @Version: V1.0 + */ +public interface IGuideCardBatchService extends IService<GuideCardBatch> { + + /** + * 鐢熸垚娴佹按鍙� + * @param code + * @return + */ + String getSerialNumber(String code); +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java index 6c4e4ad..4a73048 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProcessStreamService.java @@ -1,8 +1,10 @@ package org.jeecg.modules.dnc.service; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.dnc.entity.DocInfo; import org.jeecg.modules.dnc.entity.ProcessStream; import org.jeecg.modules.dnc.request.ProcessStreamRequest; +import org.jeecg.modules.dnc.request.TreeInfoRequest; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; @@ -140,4 +142,19 @@ * @return */ boolean assignRemoveUser(ProcessStream processStream, Collection<SysUser> userList); + + /** + * 閫氳繃宸ュ簭鍙枫�佸伐搴忓悕绉扮瓑鏌ヨ瀵瑰簲鐢靛瓙鏍锋澘 + * @param treeInfoRequest + * @return + */ + List<DocInfo> getByProcessStreamOtherFile(TreeInfoRequest treeInfoRequest); + + /** + * 閫氳繃宸ュ簭鍙枫�佸伐搴忓悕绉扮瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * NC鏂囦欢瀛樺湪璁惧绫讳笅闈� + * @param treeInfoRequest + * @return + */ + List<DocInfo> getByProcessStreamNCFile(TreeInfoRequest treeInfoRequest); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java index c3be206..34f769f 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IProductInfoService.java @@ -232,5 +232,12 @@ * @return */ List<DocInfo> getByTreeOtherFileInfo(TreeInfoRequest treeInfoRequest); + + /** + * 閫氳繃浠e彿銆佸悕绉般�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * @param treeInfoRequest + * @return + */ + List<DocInfo> getByTreeNcFileInfo(TreeInfoRequest treeInfoRequest); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java index b0edf35..5bac62d 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/IWorkStepService.java @@ -1,7 +1,9 @@ package org.jeecg.modules.dnc.service; import com.baomidou.mybatisplus.extension.service.IService; -import org.jeecg.modules.dnc.entity.*; +import org.jeecg.modules.dnc.entity.DocInfo; +import org.jeecg.modules.dnc.entity.WorkStep; +import org.jeecg.modules.dnc.request.TreeInfoRequest; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; @@ -98,4 +100,22 @@ * @return */ boolean assignRemoveUser(WorkStep workStep, Collection<SysUser> userList); + + + /** + * 閫氳繃宸ユ鍙枫�佸伐姝ュ悕绉扮瓑鏌ヨ瀵瑰簲鐢靛瓙鏍锋澘 + * NC鏂囦欢瀛樺湪璁惧绫讳笅闈� + * @param treeInfoRequest + * @return + */ + List<DocInfo> getByWorkStepOtherFile(TreeInfoRequest treeInfoRequest); + + /** + * 閫氳繃宸ユ鍙枫�佸伐姝ュ悕绉扮瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * NC鏂囦欢瀛樺湪璁惧绫讳笅闈� + * @param treeInfoRequest + * @return + */ + List<DocInfo> getByWorkStepNCFile(TreeInfoRequest treeInfoRequest); + } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java index 96d8f04..511a5c5 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ComponentInfoSeServiceImpl.java @@ -11,6 +11,7 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.dto.ComponentExt; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.exception.ExceptionCast; @@ -89,10 +90,10 @@ if(en == null) { ExceptionCast.cast(ComponentInfoCode.COMPONENT_PARENT_NOT_EXIST); } - oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(en.getComponentId(),"2","1"); + oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(en.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1"); componentInfo.setRankLevel(en.getRankLevel() + 1); } else { - oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(productInfo.getProductId(),"1","1"); + oldPermissionList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(productInfo.getProductId(),DocAttributionTypeEnum.PRODUCT.getCode().toString(),"1"); componentInfo.setParentId(null); componentInfo.setRankLevel(1); } @@ -113,7 +114,7 @@ PermissionStreamNew permissionStream = new PermissionStreamNew(); permissionStream.setBusinessId(componentInfo.getComponentId()); permissionStream.setDepartId(item.getDepartId()); - permissionStream.setBusinessType("2"); + permissionStream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); componentDepartPermList.add(permissionStream); }); } @@ -127,7 +128,7 @@ if(!b) ExceptionCast.cast(CommonCode.FAIL); } - b = productPermissionService.add(componentInfo.getComponentId(), userId,"2"); + b = productPermissionService.add(componentInfo.getComponentId(), userId,DocAttributionTypeEnum.COMPONENT.getCode().toString()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } @@ -145,7 +146,7 @@ if (StrUtil.isNotEmpty(componentInfo.getBorrowId())){ //鍊熺敤閮ㄤ欢,鍚屾娣诲姞鏂囦欢 List<DocRelative> docRelativeList=docRelativeService. - list(new QueryWrapper<DocRelative>().eq("attribution_type","2").eq("attribution_id",componentInfo.getBorrowId())); + list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.COMPONENT.getCode().toString()).eq("attribution_id",componentInfo.getBorrowId())); if (!docRelativeList.isEmpty()){ docRelativeList.forEach(item -> { DocRelative docRelative = new DocRelative(); @@ -160,7 +161,7 @@ PermissionStreamNew stream = new PermissionStreamNew(); stream.setUserId(userId); stream.setBusinessId(componentInfo.getComponentId()); - stream.setBusinessType("2"); + stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); return permissionStreamNewService.addPermissionStreamNew(stream); } @@ -200,12 +201,12 @@ if(!b) return false; } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,"2"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,DocAttributionTypeEnum.COMPONENT.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setUserId(userId); stream.setBusinessId(id); - stream.setBusinessType("2"); + stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); return permissionStreamNewService.save(stream); } List<ComponentInfo> list = super.lambdaQuery().eq(ComponentInfo::getBorrowId,id).list(); @@ -265,10 +266,10 @@ b = componentDepartmentService.deleteByComponentId(item.getComponentId()); if(!b) ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","0"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"0"); if(!b) ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),"2","1"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1"); if(!b) ExceptionCast.cast(ComponentInfoCode.COMPONENT_DELETE_PERM_NONE); b = super.removeById(item.getComponentId()); @@ -307,7 +308,7 @@ } boolean b; //楠岃瘉鏄惁瀛樺湪鏂囨。 - List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","2").eq("attribution_id",id)); + List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.COMPONENT.getCode().toString()).eq("attribution_id",id)); if (!docRelativeList.isEmpty()){ ExceptionCast.cast(ComponentInfoCode.COMPONENT_DOC_EXIST); } @@ -317,10 +318,10 @@ b = componentDepartmentService.deleteByComponentId(id); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","0"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"0"); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1"); if(!b) ExceptionCast.cast(CommonCode.FAIL); b = productMixService.removeById(id); @@ -361,7 +362,7 @@ stream = new PermissionStreamNew(); stream.setUserId(item.getId()); stream.setBusinessId(componentInfo.getComponentId()); - stream.setBusinessType("2"); + stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); permissionStreamList.add(stream); } }); @@ -431,12 +432,12 @@ en.setComponentId(componentInfo.getComponentId()); componentDepartments.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),DocAttributionTypeEnum.COMPONENT.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); stream.setBusinessId(componentInfo.getComponentId()); - stream.setBusinessType("2"); + stream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); permissionStreamList.add(stream); } }); @@ -467,7 +468,7 @@ if(en != null) { componentDepartments.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),"2"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(componentInfo.getComponentId(), item.getId(),DocAttributionTypeEnum.COMPONENT.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -613,7 +614,7 @@ if (productIds != null && !productIds.isEmpty()) { List<String> productIdList = Arrays.asList(productIds.split(",")); List<ProductMix> productMixList = permissionStreamNewService. - loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),"2"); + loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString()); List<Long> ids = productMixList.stream().map(ProductMix::getId).collect(Collectors.toList()); //鑾峰彇宸茬粡鑷韩琚�熺敤鐨勯儴浠� LambdaQueryWrapper<ComponentInfo> borrowQueryWrapper = new LambdaQueryWrapper<>(); @@ -651,7 +652,7 @@ List<String> productIdList = Arrays.asList(loginUser.getProductionIds().split(",")); //鑾峰彇鍙互鍊熺敤鐨勯儴浠� List<ProductMix> productMixList = permissionStreamNewService. - loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),"2"); + loadProductMixByBusinessIdAndBusinessType(loginUser.getId(),productIdList,componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString()); Set<Long> allowedIds = productMixList.stream() .map(ProductMix::getId) .collect(Collectors.toCollection(HashSet::new)); diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/CutterServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/CutterServiceImpl.java index 8422256..07d23d7 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/CutterServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/CutterServiceImpl.java @@ -5,20 +5,42 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.dnc.entity.Cutter; +import org.jeecg.modules.dnc.entity.DocFile; +import org.jeecg.modules.dnc.entity.DocInfo; import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.CutterMapper; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.service.ICutterService; +import org.jeecg.modules.dnc.service.IDocFileService; +import org.jeecg.modules.dnc.service.IDocInfoService; import org.jeecg.modules.dnc.utils.ValidateUtil; +import org.jeecg.modules.dnc.utils.file.FileUtilS; +import org.jeecg.modules.system.service.ISysDictService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; @Service +@Slf4j public class CutterServiceImpl extends ServiceImpl<CutterMapper, Cutter> implements ICutterService { + + @Autowired + private IDocInfoService docInfoService; + + @Autowired + private IDocFileService docFileService; + + @Autowired + private ISysDictService sysDictService; /** * 鏂板鍒�鍏蜂俊鎭� @@ -108,6 +130,8 @@ queryWrapper.eq(StrUtil.isNotEmpty(cutter.getAttributionId()),"attribution_id",cutter.getAttributionId()); queryWrapper.eq("attribution_type",cutter.getAttributionType()); queryWrapper.eq(StrUtil.isNotEmpty(cutter.getCutterCode()),"cutter_code",cutter.getCutterCode()); + queryWrapper.eq(StrUtil.isNotEmpty(cutter.getCutterType()),"cutter_type",cutter.getCutterType()); + queryWrapper.eq(StrUtil.isNotEmpty(cutter.getCutterSpacing()),"cutter_spacing",cutter.getCutterSpacing()); return baseMapper.selectList(queryWrapper); } @@ -123,6 +147,7 @@ if (cutter.getAttributionType() != null){ queryWrapper.eq("attribution_type",cutter.getAttributionType()); } + queryWrapper.eq(StrUtil.isNotEmpty(cutter.getDocId()),"doc_id",cutter.getDocId()); queryWrapper.like(StrUtil.isNotEmpty(cutter.getCutterCode()),"cutter_code",cutter.getCutterCode()); queryWrapper.like(StrUtil.isNotEmpty(cutter.getCutterName()),"cutter_name",cutter.getCutterName()); queryWrapper.orderByDesc("create_time"); @@ -130,4 +155,118 @@ IPage<Cutter> cutterIPage = baseMapper.selectPage(page, queryWrapper); return Result.OK(cutterIPage); } + + /** + * 浠嶯C鏂囦欢鍐呭鎻愬彇鍒�鍏蜂俊鎭苟淇濆瓨 + */ + @Override + @Transactional + public Result<?> extractAndSaveFromContent(String docId,String attributionId,Integer attributionType){ + DocInfo docInfo=docInfoService.getById(docId); + if (docInfo == null) { + return Result.error("鏈壘鍒板搴旀枃妗d俊鎭紝鏃犳硶鎻愬彇鍒�鍏蜂俊鎭�"); + } + docInfo.setAttributionId(attributionId); + docInfo.setAttributionType(attributionType); + DocFile docFile=docFileService.getById(docInfo.getPublishFileId()); + if (docFile == null) { + return Result.error("鏈壘鍒板搴旀枃浠朵俊鎭紝鏃犳硶鎻愬彇鍒�鍏蜂俊鎭�"); + } + String filePath = docFile.getFilePath(); + String fileEncodeName = docFile.getFileEncodeName(); + //鏂囨。鍐呭 + List<String> list = FileUtilS.readFile(fileEncodeName, filePath); + if (list == null || list.isEmpty()) { + return Result.error("鏂囨。鍐呭涓虹┖锛屾棤娉曟彁鍙栧垁鍏蜂俊鎭�"); + } + List<Cutter> cutterList = extractToolAfterM6(docInfo,list); + // 淇濆瓨鍒�鍏� + if (!cutterList.isEmpty()) { + this.saveBatch(cutterList); + //TODO鍙戦�佸垁鍏风鐞嗘暟鎹� + return Result.OK("鎻愬彇鍒�鍏蜂俊鎭垚鍔�"); + }else { + return Result.error("鏈彂鐜板垁鍏风殑鍙傛暟淇℃伅娉ㄩ噴锛屾棤娉曟彁鍙栧垁鍏蜂俊鎭�"); + } + } + + public List<Cutter> extractToolAfterM6(DocInfo docInfo, List<String> ncLines) { + List<Cutter> cutterList = new ArrayList<>(); + String currentToolCode = null; // 鐢ㄤ簬杩借釜褰撳墠鎹㈠垁鎸囦护鐨勫垁鍏峰彿 + + for (String line : ncLines) { + String trimmedLine = line.trim(); + + // 1. 鍖归厤 M6 鎹㈠垁鎸囦护锛屾彁鍙� T浠g爜锛堝 T01 M06 鎴� T 02 M06锛� + if (trimmedLine.contains("M6")||trimmedLine.contains("M06")) { + currentToolCode = extractToolCodeFromM6Line(trimmedLine); + } + + // 2. 鍖归厤鍒�鍏峰弬鏁版敞閲婏紙绱ц窡鍦� M6 鍚庣殑鎷彿鍐呭锛� + if (currentToolCode != null && trimmedLine.startsWith("(") && trimmedLine.endsWith(")")) { + String toolDescription = trimmedLine.substring(1, trimmedLine.length() - 1).trim(); + if (!toolDescription.isEmpty()) { + Cutter cutter = new Cutter(); + cutter.setDocId(docInfo.getDocId()); + cutter.setAttributionId(docInfo.getAttributionId()); + cutter.setAttributionType(docInfo.getAttributionType()); + cutter.setDescription(toolDescription); + + // 浠庡垁鍏锋弿杩颁腑鎻愬彇 cutterCode (渚嬪浠� "90E-10A" 涓彁鍙� "E") + extractToolInfoFromDescription(toolDescription, cutter); + + // 璁剧疆鍒�鍏烽棿璺濓紙浣跨敤T浠g爜鎴栧叾浠栭�昏緫锛� + cutter.setCutterSpacing(currentToolCode); + + // 鎷嗗垎鍒�鍏峰悕绉颁笌瑙勬牸锛堢畝鍗曟寜绌烘牸鍒嗗壊锛屽墠閮ㄥ垎涓哄悕绉帮紝鍚庨儴鍒嗕负瑙勬牸锛� + String[] parts = toolDescription.split(" ", 2); + if (parts.length >= 1) { + cutter.setCutterName(parts[0]); + } + cutterList.add(cutter); + currentToolCode = null; // 閲嶇疆锛岄伩鍏嶉噸澶嶅尮閰� + } + } + } + + return cutterList; + } + + /** + * 浠庡垁鍏锋弿杩颁腑鎻愬彇 cutterType 鍜� cutterCode + * 渚嬪: "8CH-90A" -> cutterType="CH", cutterCode="90A" + */ + private void extractToolInfoFromDescription(String description, Cutter cutter) { + // 鎻愬彇鍒�鍏峰瀷鍙凤紙涓�涓垨澶氫釜杩炵画鐨勫ぇ鍐欏瓧姣嶏級 + String cutterType = extractCutterType(description); + cutter.setCutterType(cutterType); + // 鎻愬彇鐮存姌鍙峰悗鐨勮鏍奸儴鍒� + String cutterSpec = ""; + int dashIndex = description.indexOf('-'); + if (dashIndex != -1 && dashIndex < description.length() - 1) { + cutterSpec = description.substring(dashIndex + 1).trim(); + cutter.setCutterSpec(cutterSpec); + } + } + + /** + * 鎻愬彇鍒�鍏峰瀷鍙凤紙涓�涓垨澶氫釜杩炵画鐨勫ぇ鍐欏瓧姣嶏級 + */ + private String extractCutterType(String description) { + Pattern pattern = Pattern.compile("[A-Z]+"); + Matcher matcher = pattern.matcher(description); + + if (matcher.find()) { + return matcher.group(); + } + + return description; + } + + // 杈呭姪鏂规硶锛氫粠 M6 琛屾彁鍙� T浠g爜锛堟敮鎸� T01 鎴� T 01 鏍煎紡锛� + private String extractToolCodeFromM6Line(String line) { + Matcher matcher = Pattern.compile("T(\\d+)").matcher(line); + return matcher.find() ? "T" + matcher.group(1).trim() : null; + } } + diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceTypeServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceTypeServiceImpl.java index d6ddbe8..413e084 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceTypeServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/DeviceTypeServiceImpl.java @@ -147,4 +147,14 @@ }); return Result.OK(list); } + + /** + * 妫�绱C鏌ヨ瀵瑰簲鐨勮澶囩被 + * @param attributionIds,attributionType,deviceManagementName,deviceManagementCode + * @return + */ + @Override + public List<DeviceType> getDeviceTypeByAttribution(List<String> attributionIds, Integer attributionType, String deviceManagementName, String deviceManagementCode){ + return this.baseMapper.getDeviceTypeByAttribution(attributionIds, attributionType, deviceManagementName, deviceManagementCode); + } } 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 3b4b965..32a53c1 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 @@ -159,19 +159,21 @@ } } boolean saveBool = super.save(docInfo); - SysParams sysParams=sysParamsService.getSysPramBySettingKey("nc_dispatch_file"); - if (sysParams ==null){ - throw new JeecgBootException("鏈厤缃鍏C涓庣數瀛愬浘鐗堟槸鍚﹁Е鍙戝绛炬祦绋嬶紝璇疯仈绯荤鐞嗗憳"); - }else { - if (saveBool&&sysParams.getSettingValue().equals("1")){ - //瑙﹀彂瀹$ - DispatchFile dispatchFile = new DispatchFile(); - dispatchFile.setDocId(docInfo.getDocId()); - dispatchFile.setFileId(docFile.getFileId()); - dispatchFile.setAttributionId(uploadRequest.getAttributionId()); - dispatchFile.setAttributionType(String.valueOf(uploadRequest.getAttributionType())); - dispatchFile.setDocClassCode(uploadRequest.getDocClassCode()); - dispatchFileService.saveDispatchFile(dispatchFile); + if (uploadRequest.getDocClassCode().equals("NC")||uploadRequest.getDocClassCode().equals("other")){ + SysParams sysParams=sysParamsService.getSysPramBySettingKey("nc_dispatch_file"); + if (sysParams ==null){ + throw new JeecgBootException("鏈厤缃鍏C涓庣數瀛愬浘鐗堟槸鍚﹁Е鍙戝绛炬祦绋嬶紝璇疯仈绯荤鐞嗗憳"); + }else { + if (saveBool&&sysParams.getSettingValue().equals("1")){ + //瑙﹀彂瀹$ + DispatchFile dispatchFile = new DispatchFile(); + dispatchFile.setDocId(docInfo.getDocId()); + dispatchFile.setFileId(docFile.getFileId()); + dispatchFile.setAttributionId(uploadRequest.getAttributionId()); + dispatchFile.setAttributionType(String.valueOf(uploadRequest.getAttributionType())); + dispatchFile.setDocClassCode(uploadRequest.getDocClassCode()); + dispatchFileService.saveDispatchFile(dispatchFile); + } } } return saveBool; diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/GuideCardBatchServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/GuideCardBatchServiceImpl.java new file mode 100644 index 0000000..e108ded --- /dev/null +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/GuideCardBatchServiceImpl.java @@ -0,0 +1,71 @@ +package org.jeecg.modules.dnc.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.common.util.DateUtils; +import org.jeecg.modules.dnc.entity.GuideCardBatch; +import org.jeecg.modules.dnc.mapper.GuideCardBatchMapper; +import org.jeecg.modules.dnc.service.IGuideCardBatchService; +import org.jeecg.modules.system.service.ISysDictService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * @Description: nc鏂囦欢瀵瑰簲鏁版帶绋嬪簭鍔犲伐纭琛� + * @Author: jeecg-boot + * @Date: 2025-05-27 + * @Version: V1.0 + */ +@Service +public class GuideCardBatchServiceImpl extends ServiceImpl<GuideCardBatchMapper, GuideCardBatch> implements IGuideCardBatchService { + + @Autowired + private ISysDictService sysDictService; + + /** + * 鐢熸垚娴佹按鍙� + * @param code + * @return + */ + @Override + public String getSerialNumber(String code) { + // 浜嬩欢缂栧彿鏍煎紡锛氬勾浠藉悗涓や綅 + 鍗曚綅缂栫爜 + 鎿嶄綔宸ヨ处鍙� + 娴佹按鍙凤紙4浣嶏級 + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + + // 鑾峰彇褰撳墠骞翠唤鍚庝袱浣� + String yearSuffix = DateUtils.formatDate(new Date(), "yy"); + + // 鏌ヨ褰撳勾鎵�鏈夎褰� + QueryWrapper<GuideCardBatch> wrapper = new QueryWrapper<>(); + wrapper.likeRight("create_time", DateUtils.formatDate(new Date(), "yyyy")); + wrapper.isNotNull("serial_number"); + wrapper.orderByDesc("SUBSTR(serial_number, -4)"); + + List<GuideCardBatch> list = this.list(wrapper); + + // 鐢熸垚娴佹按鍙烽�昏緫 + String serialSuffix; + if (!list.isEmpty()) { + // 鎻愬彇鏈�鏂版祦姘村彿鐨勫悗鍥涗綅 + String lastSerial = list.get(0).getSerialNumber(); + String lastSuffix = lastSerial.substring(lastSerial.length() - 4); + + // 娴佹按鍙疯嚜澧烇紙澶勭悊9999婧㈠嚭锛� + int nextNum = Integer.parseInt(lastSuffix) + 1; + serialSuffix = String.format("%04d", nextNum > 9999 ? 1 : nextNum); // 瓒呰繃9999鍒欓噸缃负0001 + } else { + serialSuffix = "0001"; // 褰撳勾鏃犺褰曞垯鍒濆鍖� + } + + // 鑾峰彇鍗曚綅缂栫爜 + String unitCode = sysDictService.queryDictTextByKey("unit_code", code); + + // 鎷兼帴瀹屾暣缂栧彿 + return yearSuffix + unitCode + user.getUsername() + serialSuffix; + } +} diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java index 33580e8..db7ebac 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java @@ -9,6 +9,7 @@ import org.apache.commons.collections4.ListUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.ComponentInfoMapper; @@ -83,7 +84,7 @@ ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE); partsInfo.setPartsStatus(1); boolean b = super.save(partsInfo); - List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1"); + List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1"); if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { List<PartsDepartment> partsDepartmentList = new ArrayList<>(); List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); @@ -95,7 +96,7 @@ PermissionStreamNew perm = new PermissionStreamNew(); perm.setDepartId(item.getDepartId()); perm.setBusinessId(partsInfo.getPartsId()); - perm.setBusinessType("3"); + perm.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString()); permissionStreamList.add(perm); }); if(!partsDepartmentList.isEmpty()) { @@ -111,18 +112,18 @@ } if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = productPermissionService.add(partsInfo.getPartsId(), userId,"3"); + b = productPermissionService.add(partsInfo.getPartsId(), userId,DocAttributionTypeEnum.PARTS.getCode().toString()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } //娣诲姞缁撴瀯鏍� ProductMix productMix = new ProductMix(Long.parseLong(partsInfo.getPartsId()),Long.parseLong(partsInfo.getComponentId()) - ,partsInfo.getPartsName(),partsInfo.getPartsCode(),3,new Date()); + ,partsInfo.getPartsName(),partsInfo.getPartsCode(),DocAttributionTypeEnum.PARTS.getCode(),new Date()); productMixService.save(productMix); //娣诲姞鐢ㄦ埛鏉冮檺 PermissionStreamNew stream = new PermissionStreamNew(); stream.setBusinessId(partsInfo.getPartsId()); - stream.setBusinessType("3"); + stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString()); stream.setUserId(userId); return permissionStreamNewService.addPermissionStreamNew(stream); } @@ -160,11 +161,11 @@ if(!b) return false; } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId( id, userId,"3"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId( id, userId,DocAttributionTypeEnum.PARTS.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setBusinessId(id); - stream.setBusinessType("3"); + stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString()); stream.setUserId(userId); return permissionStreamNewService.save(stream); } @@ -222,10 +223,10 @@ b = partsDepartmentService.deleteByPartsId(item.getPartsId()); if(!b) ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),"3","0"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),DocAttributionTypeEnum.PARTS.getCode().toString(),"0"); if(!b) ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),"3","1"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(item.getPartsId(),DocAttributionTypeEnum.PARTS.getCode().toString(),"1"); if(!b) ExceptionCast.cast(PartsInfoCode.PARTS_DELETE_ERROR); b = super.removeById(item.getPartsId()); @@ -248,7 +249,7 @@ ExceptionCast.cast(PartsInfoCode.PARTS_PROCESS_EXIST); boolean b = partsPermissionService.deleteByPartsId(partsInfo.getPartsId()); //楠岃瘉鏄惁瀛樺湪鏂囨。 - List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","3").eq("attribution_id",partsId)); + List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.PARTS.getCode().toString()).eq("attribution_id",partsId)); if (!docRelativeList.isEmpty()){ ExceptionCast.cast(PartsInfoCode.PARTS_DOC_EXIST); } @@ -257,10 +258,10 @@ b = partsDepartmentService.deleteByPartsId(partsInfo.getPartsId()); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,"3","0"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,DocAttributionTypeEnum.PARTS.getCode().toString(),"0"); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,"3","1"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(partsId,DocAttributionTypeEnum.PARTS.getCode().toString(),"1"); if(!b) ExceptionCast.cast(CommonCode.FAIL); b = productMixService.removeById(partsId); @@ -284,12 +285,12 @@ en.setPartsId(partsInfo.getPartsId()); permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),"3"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setUserId(item.getId()); stream.setBusinessId(partsInfo.getPartsId()); - stream.setBusinessType("3"); + stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString()); permissionStreamList.add(stream); } }); @@ -320,7 +321,7 @@ if(en != null) { permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),"3"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -356,12 +357,12 @@ en.setPartsId(partsInfo.getPartsId()); partsDepartments.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),"3"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); stream.setBusinessId(partsInfo.getPartsId()); - stream.setBusinessType("3"); + stream.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString()); permissionStreamList.add(stream); } }); @@ -392,7 +393,7 @@ if(en != null) { partsDepartments.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),"3"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(partsInfo.getPartsId(), item.getId(),DocAttributionTypeEnum.PARTS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -458,7 +459,7 @@ if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { queryWrapper.in(PartsInfo::getComponentId, treeInfoRequest.getComponentIds()); } - if (treeInfoRequest.getAttributionType()==3){ + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PARTS.getCode())){ queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),PartsInfo::getPartsId,treeInfoRequest.getAttributionId()); } queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),PartsInfo::getPartsCode, treeInfoRequest.getTreeCode()); @@ -473,12 +474,12 @@ BeanUtil.copyProperties(treeInfoRequest,docQuery); docQuery.setAttributionIds(ids); docQuery.setDocClassCode("OTHER"); - docQuery.setAttributionType(3); + docQuery.setAttributionType(DocAttributionTypeEnum.PARTS.getCode()); docInfos=docInfoService.findListByDocQuery(docQuery); } - if (treeInfoRequest.getAttributionType()==3){ + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PARTS.getCode())){ List<String> id =new ArrayList<>(); - id.add(treeInfoRequest.getAttributionIds()); + id.add(treeInfoRequest.getAttributionId()); treeInfoRequest.setPartsIds(id); List<DocInfo> processSpecVersions = processSpecVersionService.getByProcessSpecVersion(treeInfoRequest); docInfos.addAll(processSpecVersions); diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java index cd089c4..be15740 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessSpecVersionServiceImpl.java @@ -8,6 +8,7 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.ComponentInfoMapper; @@ -35,7 +36,7 @@ @Autowired private ComponentInfoMapper componentInfoMapper; @Autowired - private PartsInfoMapper processSpecVersionMapper; + private PartsInfoMapper partsInfoMapper; @Autowired private IPermissionStreamNewService permissionStreamNewService; @Autowired @@ -90,56 +91,65 @@ /** * 鏂板宸ヨ壓瑙勭▼鐗堟湰琛ㄤ俊鎭� - * @param ProcessSpecVersion + * @param processSpecVersion * @return */ @Override - public boolean addProcessSpecVersion(ProcessSpecVersion ProcessSpecVersion){ - if(ProcessSpecVersion == null) + public boolean addProcessSpecVersion(ProcessSpecVersion processSpecVersion){ + if(processSpecVersion == null) ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(!ValidateUtil.validateString(ProcessSpecVersion.getProcessSpecVersionName())) + if(!ValidateUtil.validateString(processSpecVersion.getProcessSpecVersionName())) ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NONE); - if(!ValidateUtil.validateString(ProcessSpecVersion.getProductId())) + if(!ValidateUtil.validateString(processSpecVersion.getProductId())) ExceptionCast.cast(PartsInfoCode.PARTS_PRODUCT_NONE); - if(!ValidateUtil.validateString(ProcessSpecVersion.getComponentId())) + if(!ValidateUtil.validateString(processSpecVersion.getComponentId())) ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE); - if(!ValidateUtil.validateString(ProcessSpecVersion.getPartsId())) + if(!ValidateUtil.validateString(processSpecVersion.getPartsId())) ExceptionCast.cast(ProcessInfoCode.PROCESS_PARTS_NONE); - if(!ValidateUtil.validateString(ProcessSpecVersion.getProcessSpecVersionCode())) + if(!ValidateUtil.validateString(processSpecVersion.getProcessSpecVersionCode())) ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_CODE_NONE); - ProcessSpecVersion en = getByCode(ProcessSpecVersion.getPartsId(),ProcessSpecVersion.getProcessSpecVersionCode()); + ProcessSpecVersion en = getByCode(processSpecVersion.getPartsId(),processSpecVersion.getProcessSpecVersionCode()); if(en != null) ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_IS_EXIST); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String userId = user.getId(); if(!ValidateUtil.validateString(userId)) ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - ProductInfo productInfo = productInfoMapper.selectById(ProcessSpecVersion.getProductId()); + ProductInfo productInfo = productInfoMapper.selectById(processSpecVersion.getProductId()); if(productInfo == null) ExceptionCast.cast(PartsInfoCode.PARTS_PRODUCT_NONE); - ComponentInfo componentInfo = componentInfoMapper.selectById(ProcessSpecVersion.getComponentId()); + ComponentInfo componentInfo = componentInfoMapper.selectById(processSpecVersion.getComponentId()); if(componentInfo == null) ExceptionCast.cast(PartsInfoCode.PARTS_COMPONENT_NONE); - PartsInfo processSpecVersion = processSpecVersionMapper.selectById(ProcessSpecVersion.getPartsId()); - if(processSpecVersion == null) + PartsInfo partsInfo = partsInfoMapper.selectById(processSpecVersion.getPartsId()); + if(partsInfo == null) ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); - boolean b = super.save(ProcessSpecVersion); + //鐩稿悓闆朵欢鍙蜂笅闈㈢増鏈彿涓嶈兘閲嶅 + List<ProcessSpecVersion> list = super.list(new LambdaQueryWrapper<ProcessSpecVersion>().eq(ProcessSpecVersion::getPartsId,partsInfo.getPartsId())); + if (list != null && list.size() > 0) { + list.forEach(processSpecVersion1 -> { + if (processSpecVersion1.getProcessSpecVersionCode().equals(processSpecVersion.getProcessSpecVersionCode())) { + ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_IS_EXIST); + } + }); + } + boolean b = super.save(processSpecVersion); if(!b) ExceptionCast.cast(CommonCode.FAIL); //娣诲姞閮ㄩ棬鏉冮檺 - List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(ProcessSpecVersion.getPartsId(),"3","1"); + List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(processSpecVersion.getPartsId(), DocAttributionTypeEnum.PARTS.getCode().toString(),"1"); if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { List<ProcessSpecVersionDepartment> processSpecVersionDepartmentList = new ArrayList<>(); List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); oldDepartPermList.forEach(item -> { ProcessSpecVersionDepartment pd = new ProcessSpecVersionDepartment(); pd.setDepartId(item.getDepartId()); - pd.setPsvId(ProcessSpecVersion.getId()); + pd.setPsvId(processSpecVersion.getId()); processSpecVersionDepartmentList.add(pd); PermissionStreamNew perm = new PermissionStreamNew(); perm.setDepartId(item.getDepartId()); - perm.setBusinessId(ProcessSpecVersion.getId()); - perm.setBusinessType("4"); + perm.setBusinessId(processSpecVersion.getId()); + perm.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString()); permissionStreamList.add(perm); }); if(!processSpecVersionDepartmentList.isEmpty()) { @@ -154,19 +164,19 @@ } } //娣诲姞鐢ㄦ埛鏉冮檺 - b = productPermissionService.add(ProcessSpecVersion.getId(), userId,"4"); + b = productPermissionService.add(processSpecVersion.getId(), userId,DocAttributionTypeEnum.OPERATION.getCode().toString()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } //娣诲姞缁撴瀯鏍� - ProductMix productMix = new ProductMix(Long.parseLong(ProcessSpecVersion.getId()),Long.parseLong(ProcessSpecVersion.getPartsId()) - ,ProcessSpecVersion.getProcessSpecVersionName(), - ProcessSpecVersion.getProcessSpecVersionCode(),4,new Date()); + ProductMix productMix = new ProductMix(Long.parseLong(processSpecVersion.getId()),Long.parseLong(processSpecVersion.getPartsId()) + ,processSpecVersion.getProcessSpecVersionName(), + processSpecVersion.getProcessSpecVersionCode(),DocAttributionTypeEnum.OPERATION.getCode(),new Date()); productMixService.save(productMix); //娣诲姞鐢ㄦ埛鏉冮檺 PermissionStreamNew stream = new PermissionStreamNew(); - stream.setBusinessId(ProcessSpecVersion.getId()); - stream.setBusinessType("4"); + stream.setBusinessId(processSpecVersion.getId()); + stream.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString()); stream.setUserId(userId); return permissionStreamNewService.addPermissionStreamNew(stream); } @@ -207,7 +217,7 @@ if(!b) return false; } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,"4"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId,DocAttributionTypeEnum.OPERATION.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setBusinessId(id); @@ -238,10 +248,10 @@ b = processSpecVersionDepartmentService.deleteByPsvId(processSpecVersion.getId()); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(processSpecVersion.getId(),"4","0"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(processSpecVersion.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString(),"0"); if(!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(processSpecVersion.getId(),"4","1"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(processSpecVersion.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString(),"1"); if(!b) ExceptionCast.cast(CommonCode.FAIL); b = productMixService.removeById(processSpecVersion.getId()); @@ -311,12 +321,12 @@ en.setPsvId(processSpecVersion.getId()); permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(), item.getId(),"4"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(), item.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setUserId(item.getId()); stream.setBusinessId(processSpecVersion.getId()); - stream.setBusinessType("4"); + stream.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString()); permissionStreamList.add(stream); } }); @@ -353,7 +363,7 @@ if(en != null) { permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(), item.getId(),"4"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(), item.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -393,12 +403,12 @@ en.setPsvId(processSpecVersion.getId()); partsDepartments.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processSpecVersion.getId(), item.getId(),"4"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processSpecVersion.getId(), item.getId(),DocAttributionTypeEnum.OPERATION.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); stream.setBusinessId(processSpecVersion.getId()); - stream.setBusinessType("4"); + stream.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString()); permissionStreamList.add(stream); } }); @@ -483,13 +493,14 @@ if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) { queryWrapper.in(ProcessSpecVersion::getPartsId, treeInfoRequest.getPartsIds()); } - if (treeInfoRequest.getAttributionType()==4){ + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.OPERATION.getCode())){ queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ProcessSpecVersion::getId,treeInfoRequest.getAttributionId()); } queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ProcessSpecVersion::getProcessSpecVersionName, treeInfoRequest.getTreeName()); queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ProcessSpecVersion::getProcessSpecVersionCode, treeInfoRequest.getTreeName()); queryWrapper.orderByDesc(ProcessSpecVersion::getCreateTime); List<ProcessSpecVersion> list = super.list(queryWrapper); + List<DocInfo> docInfos; if (list == null || list.isEmpty() || StrUtil.isNotBlank(treeInfoRequest.getStructureType())){ return new ArrayList<>(); }else { @@ -498,8 +509,16 @@ BeanUtil.copyProperties(treeInfoRequest,docQuery); docQuery.setAttributionIds(ids); docQuery.setDocClassCode("OTHER"); - docQuery.setAttributionType(4); - return docInfoService.findListByDocQuery(docQuery); + docQuery.setAttributionType(DocAttributionTypeEnum.OPERATION.getCode()); + docInfos=docInfoService.findListByDocQuery(docQuery); + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.OPERATION.getCode())){ + List<String> id =new ArrayList<>(); + id.add(treeInfoRequest.getAttributionId()); + treeInfoRequest.setPsvIds(id); + List<DocInfo> processSpecVersions = processStreamService.getByProcessStreamOtherFile(treeInfoRequest); + docInfos.addAll(processSpecVersions); + } } + return docInfos; } } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java index b5e0bb4..bb050d9 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProcessStreamServiceImpl.java @@ -1,5 +1,7 @@ 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.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -7,10 +9,13 @@ 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.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.ProcessStreamMapper; +import org.jeecg.modules.dnc.request.DocInfoQueryRequest; import org.jeecg.modules.dnc.request.ProcessStreamRequest; +import org.jeecg.modules.dnc.request.TreeInfoRequest; import org.jeecg.modules.dnc.response.*; import org.jeecg.modules.dnc.service.*; import org.jeecg.modules.dnc.utils.ValidateUtil; @@ -22,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; @Service public class ProcessStreamServiceImpl extends ServiceImpl<ProcessStreamMapper, ProcessStream> implements IProcessStreamService { @@ -49,6 +55,11 @@ private IProductMixService productMixService; @Autowired private IProductPermissionService productPermissionService; + @Autowired + @Lazy + private IDocInfoService docInfoService; + @Autowired + private IDeviceTypeService deviceTypeService; @Override @Transactional(rollbackFor = {Exception.class}) @@ -80,7 +91,7 @@ if(en != null) { ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); } - oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(psv.getId(),"4","1"); + oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(psv.getId(), DocAttributionTypeEnum.OPERATION.getCode().toString(),"1"); }else { ComponentInfo componentInfo = componentInfoService.getById(stream.getComponentId()); if(componentInfo == null) @@ -92,7 +103,7 @@ if(en != null) { ExceptionCast.cast(ProcessInfoCode.PROCESS_IS_EXIST); } - oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),"2","1"); + oldDepartPermList=permissionStreamNewService.loadPermissionStreamNewByBusinessId(componentInfo.getComponentId(),DocAttributionTypeEnum.COMPONENT.getCode().toString(),"1"); } boolean b = super.save(stream); if(!b) @@ -109,7 +120,7 @@ PermissionStreamNew perm = new PermissionStreamNew(); perm.setDepartId(item.getDepartId()); perm.setBusinessId(stream.getProcessId()); - perm.setBusinessType("5"); + perm.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(perm); }); if(!processionDepartmentList.isEmpty()) { @@ -124,7 +135,7 @@ } } //娣诲姞鐢ㄦ埛鏉冮檺 - b = productPermissionService.add(stream.getProcessId(), userId,"5"); + b = productPermissionService.add(stream.getProcessId(), userId,DocAttributionTypeEnum.PROCESS.getCode().toString()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } @@ -132,17 +143,17 @@ ProductMix productMix; if (stream.getPsvId() != null) { productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getPsvId()) - ,stream.getProcessName(),stream.getProcessCode(),5,new Date()); + ,stream.getProcessName(),stream.getProcessCode(),DocAttributionTypeEnum.PROCESS.getCode(),new Date()); }else { productMix = new ProductMix(Long.parseLong(stream.getProcessId()),Long.parseLong(stream.getComponentId()) - ,stream.getProcessName(),stream.getProcessCode(),5,new Date()); + ,stream.getProcessName(),stream.getProcessCode(),DocAttributionTypeEnum.PROCESS.getCode(),new Date()); } productMixService.save(productMix); //娣诲姞鏉冮檺楠岃瘉 PermissionStreamNew permissionStream = new PermissionStreamNew(); permissionStream.setUserId(userId); permissionStream.setBusinessId(stream.getProcessId()); - permissionStream.setBusinessType("5"); + permissionStream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); return permissionStreamNewService.addPermissionStreamNew(permissionStream); } @@ -190,7 +201,7 @@ ExceptionCast.cast(ProcessInfoCode.WORKSTEP_HAS_DATA); } //楠岃瘉鏄惁瀛樺湪鏂囨。 - List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","5").eq("attribution_id",id)); + List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.PROCESS.getCode().toString()).eq("attribution_id",id)); if (!docRelativeList.isEmpty()){ ExceptionCast.cast(ProcessInfoCode.PROCESS_HAS_DOC); } @@ -305,12 +316,12 @@ en.setProcessId(processStream.getProcessId()); processionDepartmentList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),"5"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); stream.setBusinessId(processStream.getProcessId()); - stream.setBusinessType("5"); + stream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(stream); } }); @@ -352,7 +363,7 @@ if(en != null) { processionDepartmentList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),"5"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(processStream.getProcessId(),item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -387,12 +398,12 @@ en.setProcessId(processStream.getProcessId()); permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),"5"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setUserId(item.getId()); stream.setBusinessId(processStream.getProcessId()); - stream.setBusinessType("5"); + stream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permissionStreamList.add(stream); } }); @@ -423,7 +434,7 @@ if(en != null) { permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),"5"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), item.getId(),DocAttributionTypeEnum.PROCESS.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -444,4 +455,109 @@ return true; } + /** + * 閫氳繃宸ュ簭鍙枫�佸伐搴忓悕绉扮瓑鏌ヨ瀵瑰簲鐢靛瓙鏍锋澘 + * 鐢靛瓙鏍锋澘鐩存帴鎸傚湪宸ュ簭涓� + * @param treeInfoRequest + * @return + */ + @Override + public List<DocInfo> getByProcessStreamOtherFile(TreeInfoRequest treeInfoRequest){ + LambdaQueryWrapper<ProcessStream> queryWrapper = new LambdaQueryWrapper<>(); + if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { + queryWrapper.in(ProcessStream::getProductId, treeInfoRequest.getProductIds()); + } + if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { + queryWrapper.in(ProcessStream::getComponentId, treeInfoRequest.getComponentIds()); + } + if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) { + queryWrapper.in(ProcessStream::getPartsId, treeInfoRequest.getPartsIds()); + } + if (treeInfoRequest.getPsvIds() != null && !treeInfoRequest.getPsvIds().isEmpty()) { + queryWrapper.in(ProcessStream::getPsvId, treeInfoRequest.getPsvIds()); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ + queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ProcessStream::getProcessId,treeInfoRequest.getAttributionId()); + } + queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ProcessStream::getProcessName, treeInfoRequest.getTreeName()); + queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ProcessStream::getProcessCode, treeInfoRequest.getTreeName()); + queryWrapper.orderByDesc(ProcessStream::getCreateTime); + List<ProcessStream> list = super.list(queryWrapper); + List<DocInfo> docInfos; + if (list == null || list.isEmpty() || StrUtil.isNotBlank(treeInfoRequest.getStructureType())){ + return new ArrayList<>(); + }else { + String ids=list.stream().map(ProcessStream::getProcessId).collect(Collectors.joining(",")); + DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); + BeanUtil.copyProperties(treeInfoRequest,docQuery); + docQuery.setAttributionIds(ids); + docQuery.setDocClassCode("OTHER"); + docQuery.setAttributionType(DocAttributionTypeEnum.PROCESS.getCode()); + docInfos=docInfoService.findListByDocQuery(docQuery); + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ + List<String> id =new ArrayList<>(); + id.add(treeInfoRequest.getAttributionId()); + treeInfoRequest.setProcessIds(id); + List<DocInfo> processSpecVersions = workStepService.getByWorkStepOtherFile(treeInfoRequest); + docInfos.addAll(processSpecVersions); + } + } + return docInfos; + } + + /** + * 閫氳繃宸ュ簭鍙枫�佸伐搴忓悕绉扮瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * NC鏂囦欢瀛樺湪璁惧绫讳笅闈� + * @param treeInfoRequest + * @return + */ + @Override + public List<DocInfo> getByProcessStreamNCFile(TreeInfoRequest treeInfoRequest){ + LambdaQueryWrapper<ProcessStream> queryWrapper = new LambdaQueryWrapper<>(); + if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { + queryWrapper.in(ProcessStream::getProductId, treeInfoRequest.getProductIds()); + } + if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { + queryWrapper.in(ProcessStream::getComponentId, treeInfoRequest.getComponentIds()); + } + if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) { + queryWrapper.in(ProcessStream::getPartsId, treeInfoRequest.getPartsIds()); + } + if (treeInfoRequest.getPsvIds() != null && !treeInfoRequest.getPsvIds().isEmpty()) { + queryWrapper.in(ProcessStream::getPsvId, treeInfoRequest.getPsvIds()); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ + queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ProcessStream::getProcessId,treeInfoRequest.getAttributionId()); + } + queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ProcessStream::getProcessName, treeInfoRequest.getTreeName()); + queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ProcessStream::getProcessCode, treeInfoRequest.getTreeName()); + queryWrapper.orderByDesc(ProcessStream::getCreateTime); + List<ProcessStream> list = super.list(queryWrapper); + List<DocInfo> docInfos = new ArrayList<>(); + //NC鏂囦欢瀛樺湪瀵瑰簲鐨勮澶囩被涓嬶紝鎵�浠ラ渶瑕佽繃婊� + if (!list.isEmpty()) { + List<String> processIds = list.stream().map(ProcessStream::getProcessId).collect(Collectors.toList()); + List<DeviceType> deviceTypeList = deviceTypeService.getDeviceTypeByAttribution(processIds, + DocAttributionTypeEnum.PROCESS.getCode(),treeInfoRequest.getDeviceManagementName(),treeInfoRequest.getDeviceManagementCode()); + if (deviceTypeList != null && !deviceTypeList.isEmpty()) { + List<String> deviceManagementIds=deviceTypeList.stream().map(DeviceType::getId).collect(Collectors.toList()); + DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); + BeanUtil.copyProperties(treeInfoRequest,docQuery); + docQuery.setAttributionIds(String.join(",",deviceManagementIds)); + docQuery.setDocClassCode("NC"); + docQuery.setAttributionType(DocAttributionTypeEnum.PROCESS.getCode()); + docInfos=docInfoService.findListByDocQuery(docQuery); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PROCESS.getCode())){ + List<String> id =new ArrayList<>(); + id.add(treeInfoRequest.getAttributionId()); + treeInfoRequest.setProcessIds(id); + List<DocInfo> docInfoList = workStepService.getByWorkStepNCFile(treeInfoRequest); + docInfos.addAll(docInfoList); + } + return docInfos; + } + return null; + } + } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java index d289e58..0e11f39 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java @@ -11,6 +11,7 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.dto.ComponentExt; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.exception.ExceptionCast; @@ -87,6 +88,10 @@ @Autowired @Lazy private IDocInfoService docInfoService; + @Autowired + private IDeviceTypeService deviceTypeService; + @Autowired + private IDeviceManagementService deviceManagementService; @Override @Transactional(rollbackFor = {Exception.class}) @@ -130,7 +135,7 @@ PermissionStreamNew stream = new PermissionStreamNew(); stream.setBusinessId(productInfo.getProductId()); stream.setDepartId(departId); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); permissionStreamNewService.save(stream); } } @@ -138,7 +143,7 @@ PermissionStreamNew stream = new PermissionStreamNew(); stream.setBusinessId(productInfo.getProductId()); stream.setUserId(userId); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); return permissionStreamNewService.addPermissionStreamNew(stream); } @@ -174,12 +179,12 @@ return false; } } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId, "1"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(id, userId, DocAttributionTypeEnum.PRODUCT.getCode().toString()); if (stream == null) { stream = new PermissionStreamNew(); stream.setBusinessId(productInfo.getProductId()); stream.setUserId(userId); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); return permissionStreamNewService.save(stream); } return b; @@ -258,7 +263,7 @@ ExceptionCast.cast(ProductInfoCode.PRODUCT_PROCESS_EXIST); boolean b = productPermissionService.deleteByProductId(id); //楠岃瘉鏄惁瀛樺湪鏂囨。 - List<DocRelative> docRelativeList = iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type", "1").eq("attribution_id", id)); + List<DocRelative> docRelativeList = iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type", DocAttributionTypeEnum.PRODUCT.getCode() ).eq("attribution_id", id)); if (!docRelativeList.isEmpty()) { ExceptionCast.cast(ProductInfoCode.PRODUCT_DOC_EXIST); } @@ -267,10 +272,10 @@ b = productDepartmentService.deleteByProductId(id); if (!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","0"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, DocAttributionTypeEnum.PRODUCT.getCode().toString(),"0"); if (!b) ExceptionCast.cast(CommonCode.FAIL); - b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, "1","1"); + b = permissionStreamNewService.deletePermissionStreamNewByBusinessId(id, DocAttributionTypeEnum.PRODUCT.getCode().toString(),"1"); if (!b) ExceptionCast.cast(CommonCode.FAIL); b = productMixService.removeById(id); @@ -287,37 +292,37 @@ String userId = user.getId(); if (!ValidateUtil.validateString(userId)) ExceptionCast.cast(UcenterCode.UCENTER_ACCOUNT_NOT_EXIST); - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { ProductInfo productInfo = super.getById(paramId); if (productInfo == null) ExceptionCast.cast(ProductInfoCode.PRODUCT_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(paramId, userId,"1"); return permission != null; - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())) { ComponentInfo componentInfo = componentInfoService.getById(paramId); if (componentInfo == null) ExceptionCast.cast(ComponentInfoCode.COMPONENT_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(componentInfo.getComponentId(), userId,"2"); return permission != null; - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { PartsInfo partsInfo = partsInfoService.getById(paramId); if (partsInfo == null) ExceptionCast.cast(PartsInfoCode.PARTS_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(partsInfo.getPartsId(), userId, "3"); return permission != null; - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { ProcessSpecVersion processSpecVersion = processSpecVersionService.getById(paramId); if (processSpecVersion == null) ExceptionCast.cast(PartsInfoCode.PROCESSSPECVERSION_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processSpecVersion.getId(),userId,"4"); return permission != null; - } else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { ProcessStream processStream = processStreamService.getById(paramId); if (processStream == null) ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); PermissionStreamNew permission = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(processStream.getProcessId(), userId,"5"); return permission != null; - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { WorkStep workStep = workStepService.getById(paramId); if (workStep == null) ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST); @@ -331,17 +336,17 @@ public List<UserDepartExt> getUserPermsList(Integer nodeType, String paramId) { if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { return productPermissionService.getUserPermsByProductId(paramId); - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())) { return componentPermissionService.getUserPermsByComponentId(paramId); - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { return partsPermissionService.getUserPermsByProductId(paramId); - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { return processSpecVersionPermissionService.getUserPermsByProductId(paramId); - } else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { return iProcessStreamPermissionService.getUserPermsByProductId(paramId); - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { return iWorkStepPermissionService.getUserPermsByProductId(paramId); } else { return null; @@ -352,17 +357,17 @@ public List<SysUser> getUserNonPermsList(Integer nodeType, String paramId) { if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { return productPermissionService.getUserNonPermsByProductId(paramId); - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())){ return componentPermissionService.getUserNonPermsByComponentId(paramId); - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { return partsPermissionService.getUserNonPermsByProductId(paramId); - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { return processSpecVersionPermissionService.getUserNonPermsByProductId(paramId); - } else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { return iProcessStreamPermissionService.getUserNonPermsByProductId(paramId); - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { return iWorkStepPermissionService.getUserNonPermsByProductId(paramId); } else { return null; @@ -373,17 +378,17 @@ public List<MdcProduction> getDepartPermsList(Integer nodeType, String paramId) { if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { return productDepartmentService.getDepartPermsByProductId(paramId); - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())){ return componentDepartmentService.getDepartPermsByComponentId(paramId); - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { return partsDepartmentService.getDepartPermsByPartsId(paramId); - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { return processSpecVersionDepartmentService.getDepartPermsByPsvId(paramId); - }else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { return processionDepartmentService.getDepartPermsByProcessId(paramId); - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { return workStepDepartmentService.getDepartPermsByStepId(paramId); } else { @@ -395,17 +400,17 @@ public List<MdcProduction> getDepartNonPermsList(Integer nodeType, String paramId) { if (!ValidateUtil.validateInteger(nodeType) || !ValidateUtil.validateString(paramId)) return null; - if (nodeType == 1) { + if (nodeType.equals(DocAttributionTypeEnum.PRODUCT.getCode())) { return productDepartmentService.getDepartNonPermsByProductId(paramId); - } else if (nodeType == 2) { + } else if (nodeType.equals(DocAttributionTypeEnum.COMPONENT.getCode())){ return componentDepartmentService.getDepartNonPermsByComponentId(paramId); - } else if (nodeType == 3) { + } else if (nodeType.equals(DocAttributionTypeEnum.PARTS.getCode())) { return partsDepartmentService.getDepartNonPermsByProductId(paramId); - } else if (nodeType == 4) { + } else if (nodeType.equals(DocAttributionTypeEnum.OPERATION.getCode())) { return processionDepartmentService.getDepartNonPermsByProcessId(paramId); - } else if (nodeType == 5) { + } else if (nodeType.equals(DocAttributionTypeEnum.PROCESS.getCode())) { return processionDepartmentService.getDepartNonPermsByProcessId(paramId); - } else if (nodeType == 6) { + } else if (nodeType.equals(DocAttributionTypeEnum.WORKSITE.getCode())) { return workStepDepartmentService.getDepartNonPermsByStepId(paramId); } else { return null; @@ -570,7 +575,7 @@ stream = new PermissionStreamNew(); stream.setUserId(item.getId()); stream.setBusinessId(productInfo.getProductId()); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); permissionStreamList.add(stream); } }); @@ -645,7 +650,7 @@ stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); stream.setBusinessId(productInfo.getProductId()); - stream.setBusinessType("1"); + stream.setBusinessType(DocAttributionTypeEnum.PRODUCT.getCode().toString()); permissionStreamList.add(stream); } }); @@ -700,7 +705,7 @@ public List<String> getDepartIdsByParams(Integer nodeType, String paramId) { List<String> departIds = new ArrayList<>(); //5-宸ュ簭 - if (nodeType == 5) { + if (Objects.equals(nodeType, DocAttributionTypeEnum.PROCESS.getCode())) { ProcessStream processStream = processStreamService.getById(paramId); if (processStream == null) return null; @@ -711,7 +716,7 @@ departIds.add(item.getDepartId()); }); //6-宸ユ - } else if (nodeType == 6) { + } else if (Objects.equals(nodeType, DocAttributionTypeEnum.WORKSITE.getCode())) { WorkStep workStep = workStepService.getById(paramId); if (workStep == null) return null; @@ -755,7 +760,7 @@ @Override public List<CommonGenericTree> loadTree(String userId, Integer nodeType, String paramId) { - if (nodeType == 1) { + if (Objects.equals(nodeType, DocAttributionTypeEnum.PRODUCT.getCode())) { List<ComponentInfo> componentInfoList = componentInfoService.getByProductIdAndUserId(paramId, userId); if (componentInfoList == null || componentInfoList.isEmpty()) return Collections.emptyList(); @@ -768,13 +773,13 @@ node.setLabel(c.getComponentName()); node.setParentId(c.getProductId()); node.setIconClass(""); - node.setType(2); + node.setType(DocAttributionTypeEnum.COMPONENT.getCode()); node.setRField(c.getProductId()); node.setEntity(c); list.add(node); } return list; - } else if (nodeType == 2) { + } else if (Objects.equals(nodeType, DocAttributionTypeEnum.COMPONENT.getCode())) { List<ComponentInfo> componentInfoList = componentInfoService.getByParentIdAndUserId(paramId, userId); List<CommonGenericTree> list = new ArrayList<>(); CommonGenericTree<ComponentInfo> componentNode; @@ -786,7 +791,7 @@ componentNode.setLabel(c.getComponentName()); componentNode.setParentId(c.getParentId()); componentNode.setIconClass(""); - componentNode.setType(2); + componentNode.setType(DocAttributionTypeEnum.COMPONENT.getCode()); componentNode.setRField(c.getProductId()); componentNode.setEntity(c); list.add(componentNode); @@ -803,7 +808,7 @@ partNode.setLabel(part.getPartsName()); partNode.setParentId(part.getComponentId()); partNode.setIconClass(""); - partNode.setType(3); + partNode.setType(DocAttributionTypeEnum.PARTS.getCode()); partNode.setRField(part.getComponentId()); partNode.setEntity(part); partNode.setLeaf(true); @@ -1071,6 +1076,98 @@ return getByTreeOtherFileInfo(partsInfoService.getByPartsInfo(treeInfoRequest)); case 4: return getByTreeOtherFileInfo(processSpecVersionService.getByProcessSpecVersion(treeInfoRequest)); + case 5: + return getByTreeOtherFileInfo(processStreamService.getByProcessStreamOtherFile(treeInfoRequest)); + case 6: + return getByTreeOtherFileInfo(workStepService.getByWorkStepOtherFile(treeInfoRequest)); + } + return new ArrayList<>(); + } + + /** + * 閫氳繃浠e彿銆佸悕绉般�佹潗璐ㄧ瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * @param treeInfoRequest + * @return + */ + @Override + public List<DocInfo> getByTreeNcFileInfo(TreeInfoRequest treeInfoRequest){ + //浜у搧銆侀儴浠躲�侀浂浠躲�佸伐鑹鸿绋嬬増鏈兘娌℃湁瀵瑰簲鐨凬C鏂囦欢锛岀洿鎺ユ煡璇㈠瓙缁撴瀯 + switch (treeInfoRequest.getAttributionType()){ + case 1: + LambdaQueryWrapper<ProductInfo> queryWrapper = new LambdaQueryWrapper<>(); + // 鏄庣‘鏉′欢锛氫粎褰揳ttributionType涓�1涓攁ttributionId闈炵┖鏃舵坊鍔犳潯浠� + if (StrUtil.isNotBlank(treeInfoRequest.getAttributionId())) { + queryWrapper.eq(ProductInfo::getProductId, treeInfoRequest.getAttributionId()); + } + // 绠�鍖栨潯浠跺垽鏂� + queryWrapper.like(StrUtil.isNotBlank(treeInfoRequest.getTreeCode()), ProductInfo::getProductNo, treeInfoRequest.getTreeCode()) + .like(StrUtil.isNotBlank(treeInfoRequest.getTreeName()), ProductInfo::getProductName, treeInfoRequest.getTreeName()); + List<ProductInfo> productInfoList = super.list(queryWrapper); + if (CollectionUtil.isNotEmpty(productInfoList)) { + treeInfoRequest.setProductIds(productInfoList.stream().map(ProductInfo::getProductId).collect(Collectors.toList())); + } + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 2: + LambdaQueryWrapper<ComponentInfo> componentInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); + // 鏄庣‘鏉′欢锛氫粎褰揳ttributionType涓�1涓攁ttributionId闈炵┖鏃舵坊鍔犳潯浠� + if (StrUtil.isNotBlank(treeInfoRequest.getAttributionId())) { + componentInfoLambdaQueryWrapper.eq(ComponentInfo::getComponentId, treeInfoRequest.getAttributionId()); + } + componentInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ComponentInfo::getComponentCode, treeInfoRequest.getTreeCode()); + componentInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ComponentInfo::getComponentName, treeInfoRequest.getTreeName()); + componentInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getStructureType()),ComponentInfo::getStructureType, treeInfoRequest.getStructureType()); + componentInfoLambdaQueryWrapper.orderByDesc(ComponentInfo::getCreateTime); + List<ComponentInfo> componentInfoList = componentInfoService.list(componentInfoLambdaQueryWrapper); + if (CollectionUtil.isNotEmpty(componentInfoList)) { + treeInfoRequest.setComponentIds(componentInfoList.stream().map(ComponentInfo::getComponentId).collect(Collectors.toList())); + } + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 3: + LambdaQueryWrapper<PartsInfo> partsInfoLambdaQueryWrapper = new LambdaQueryWrapper<>(); + if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { + partsInfoLambdaQueryWrapper.in(PartsInfo::getProductId, treeInfoRequest.getProductIds()); + } + if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { + partsInfoLambdaQueryWrapper.in(PartsInfo::getComponentId, treeInfoRequest.getComponentIds()); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.PARTS.getCode())){ + partsInfoLambdaQueryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),PartsInfo::getPartsId,treeInfoRequest.getAttributionId()); + } + partsInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),PartsInfo::getPartsCode, treeInfoRequest.getTreeCode()); + partsInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),PartsInfo::getPartsName, treeInfoRequest.getTreeName()); + partsInfoLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getStructureType()),PartsInfo::getStructureType, treeInfoRequest.getStructureType()); + partsInfoLambdaQueryWrapper.orderByDesc(PartsInfo::getCreateTime); + List<PartsInfo> list = partsInfoService.list(partsInfoLambdaQueryWrapper); + if (CollectionUtil.isNotEmpty(list)) { + treeInfoRequest.setPartsIds(list.stream().map(PartsInfo::getPartsId).collect(Collectors.toList())); + } + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 4: + LambdaQueryWrapper<ProcessSpecVersion> processSpecVersionLambdaQueryWrapper = new LambdaQueryWrapper<>(); + if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { + processSpecVersionLambdaQueryWrapper.in(ProcessSpecVersion::getProductId, treeInfoRequest.getProductIds()); + } + if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { + processSpecVersionLambdaQueryWrapper.in(ProcessSpecVersion::getComponentId, treeInfoRequest.getComponentIds()); + } + if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) { + processSpecVersionLambdaQueryWrapper.in(ProcessSpecVersion::getPartsId, treeInfoRequest.getPartsIds()); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.OPERATION.getCode())){ + processSpecVersionLambdaQueryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),ProcessSpecVersion::getId,treeInfoRequest.getAttributionId()); + } + processSpecVersionLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),ProcessSpecVersion::getProcessSpecVersionName, treeInfoRequest.getTreeName()); + processSpecVersionLambdaQueryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),ProcessSpecVersion::getProcessSpecVersionCode, treeInfoRequest.getTreeName()); + processSpecVersionLambdaQueryWrapper.orderByDesc(ProcessSpecVersion::getCreateTime); + List<ProcessSpecVersion> processSpecVersions = processSpecVersionService.list(processSpecVersionLambdaQueryWrapper); + if (CollectionUtil.isNotEmpty(processSpecVersions)) { + treeInfoRequest.setPsvIds(processSpecVersions.stream().map(ProcessSpecVersion::getId).collect(Collectors.toList())); + } + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 5: + return getByTreeNcFileInfo(processStreamService.getByProcessStreamNCFile(treeInfoRequest)); + case 6: + return getByTreeNcFileInfo(workStepService.getByWorkStepNCFile(treeInfoRequest)); } return new ArrayList<>(); } @@ -1099,6 +1196,42 @@ ProcessSpecVersion processSpecVersion=processSpecVersionService.getById(docInfo.getAttributionId()); docInfo.setNodeName(processSpecVersion.getProcessSpecVersionName()); docInfo.setNodeCode(processSpecVersion.getProcessSpecVersionCode()); + break; + case 5: + ProcessStream processStream=processStreamService.getById(docInfo.getAttributionId()); + docInfo.setNodeName(processStream.getProcessName()); + docInfo.setNodeCode(processStream.getProcessCode()); + break; + case 6: + WorkStep workStep=workStepService.getById(docInfo.getAttributionId()); + docInfo.setNodeName(workStep.getStepName()); + docInfo.setNodeCode(workStep.getStepName()); + break; + } + }); + } + return docInfos; + } + + private List<DocInfo> getByTreeNcFileInfo(List<DocInfo> docInfos){ + //瀵规墍灞瀒d杩涜缈昏瘧 + if (docInfos != null && !docInfos.isEmpty()) { + docInfos.forEach(docInfo -> { + //NC鏂囦欢瀛樺湪璁惧绫讳笅 + DeviceType deviceType=deviceTypeService.getById(docInfo.getAttributionId()); + DeviceManagement deviceManagement= deviceManagementService.getById(deviceType.getDeviceManagementId()); + docInfo.setDeviceName(deviceManagement.getDeviceManagementName()); + docInfo.setDeviceCode(deviceManagement.getDeviceManagementCode()); + if (deviceType.getAttributionType().equals(DocAttributionTypeEnum.PROCESS.getCode())){ + //宸ュ簭涓嬬殑璁惧绫� + ProcessStream processStream=processStreamService.getById(deviceType.getAttributionId()); + docInfo.setNodeName(processStream.getProcessName()); + docInfo.setNodeCode(processStream.getProcessCode()); + }else { + //宸ユ涓嬬殑璁惧绫� + WorkStep workStep=workStepService.getById(deviceType.getAttributionId()); + docInfo.setNodeName(workStep.getStepName()); + docInfo.setNodeCode(workStep.getStepName()); } }); } @@ -1256,7 +1389,7 @@ ComponentInfo cpInfo = componentInfoMap.get(cp.getComponentId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(cpInfo.getComponentId()); - s.setBusinessType("2"); + s.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); s.setUserId(cp.getUserId()); permissionStreamList.add(s); } @@ -1287,7 +1420,7 @@ PartsInfo ptInfo = partsInfoMap.get(pp.getPartsId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(ptInfo.getPartsId()); - s.setBusinessType("3"); + s.setBusinessType(DocAttributionTypeEnum.PARTS.getCode().toString()); s.setUserId(pp.getUserId()); permissionStreamList.add(s); } @@ -1318,7 +1451,7 @@ ProcessSpecVersion processSpecVersion = processStreamMap.get(pp.getPsvId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(processSpecVersion.getId()); - s.setBusinessType("4"); + s.setBusinessType(DocAttributionTypeEnum.OPERATION.getCode().toString()); s.setUserId(pp.getUserId()); permissionStreamList.add(s); } @@ -1349,7 +1482,7 @@ ProcessStream processStream = processStreamMap.get(pp.getProcessId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(processStream.getProcessId()); - s.setBusinessType("5"); + s.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); s.setUserId(pp.getUserId()); permissionStreamList.add(s); } @@ -1380,7 +1513,7 @@ WorkStep workStep = workStepHashMap.get(ws.getStepId()); PermissionStreamNew s = new PermissionStreamNew(); s.setBusinessId(workStep.getId()); - s.setBusinessType("6"); + s.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString()); s.setUserId(ws.getUserId()); permissionStreamList.add(s); } @@ -1608,7 +1741,7 @@ WorkStep workStep = workStepMap.get(wsDep.getStepId()); PermissionStreamNew permStream = new PermissionStreamNew(); permStream.setBusinessId(workStep.getId()); - permStream.setBusinessType("6"); + permStream.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString()); permStream.setDepartId(wsDep.getDepartId()); newPermissionStreams.add(permStream); } @@ -1679,7 +1812,7 @@ ProcessStream processStream = processStreamMap.get(procDep.getProcessId()); PermissionStreamNew permStream = new PermissionStreamNew(); permStream.setBusinessId(processStream.getProcessId()); - permStream.setBusinessType("5"); + permStream.setBusinessType(DocAttributionTypeEnum.PROCESS.getCode().toString()); permStream.setDepartId(procDep.getDepartId()); newPermissionStreams.add(permStream); } @@ -1752,7 +1885,7 @@ ComponentInfo componentInfo = componentInfoMap.get(compDep.getComponentId()); PermissionStreamNew permStream = new PermissionStreamNew(); permStream.setBusinessId(componentInfo.getComponentId()); - permStream.setBusinessType("2"); + permStream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); permStream.setDepartId(compDep.getDepartId()); newPermissionStreams.add(permStream); } @@ -1826,7 +1959,7 @@ childComponent = componentInfoMap.get(compDep.getComponentId()); PermissionStreamNew permStream = new PermissionStreamNew(); permStream.setBusinessId(childComponent.getComponentId()); - permStream.setBusinessType("2"); + permStream.setBusinessType(DocAttributionTypeEnum.COMPONENT.getCode().toString()); permStream.setDepartId(compDep.getDepartId()); newPermissionStreams.add(permStream); } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java index 90a1463..af81a36 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/WorkStepServiceImpl.java @@ -1,5 +1,7 @@ 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.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -7,9 +9,12 @@ import org.apache.commons.collections4.ListUtils; import org.apache.shiro.SecurityUtils; import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.dnc.constant.DocAttributionTypeEnum; import org.jeecg.modules.dnc.entity.*; import org.jeecg.modules.dnc.exception.ExceptionCast; import org.jeecg.modules.dnc.mapper.WorkStepMapper; +import org.jeecg.modules.dnc.request.DocInfoQueryRequest; +import org.jeecg.modules.dnc.request.TreeInfoRequest; import org.jeecg.modules.dnc.response.CommonCode; import org.jeecg.modules.dnc.response.ProcessInfoCode; import org.jeecg.modules.dnc.response.ProductInfoCode; @@ -19,10 +24,12 @@ import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.entity.SysUser; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.*; +import java.util.stream.Collectors; /** * @Description: TODO @@ -50,6 +57,12 @@ @Autowired private IProductMixService productMixService; + + @Autowired + @Lazy + private IDocInfoService docInfoService; + @Autowired + private IDeviceTypeService deviceTypeService; @Override public List<WorkStep> getByUserPerms(String userId) { @@ -109,7 +122,7 @@ if(!b) ExceptionCast.cast(CommonCode.FAIL); //娣诲姞閮ㄩ棬鏉冮檺 - List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(workStep.getProcessId(),"5","1"); + List<PermissionStreamNew> oldDepartPermList = permissionStreamNewService.loadPermissionStreamNewByBusinessId(workStep.getProcessId(), DocAttributionTypeEnum.PROCESS.getCode().toString(),"1"); if(oldDepartPermList != null && !oldDepartPermList.isEmpty()) { List<WorkStepDepartment> workStepDepartmentList = new ArrayList<>(); List<PermissionStreamNew> permissionStreamList = new ArrayList<>(); @@ -121,7 +134,7 @@ PermissionStreamNew perm = new PermissionStreamNew(); perm.setDepartId(item.getDepartId()); perm.setBusinessId(workStep.getId()); - perm.setBusinessType("6"); + perm.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString()); permissionStreamList.add(perm); }); if(!workStepDepartmentList.isEmpty()) { @@ -136,19 +149,19 @@ } } //娣诲姞鐢ㄦ埛鏉冮檺 - b = productPermissionService.add(workStep.getId(), userId,"6"); + b = productPermissionService.add(workStep.getId(), userId,DocAttributionTypeEnum.WORKSITE.getCode().toString()); if (!b) { ExceptionCast.cast(ProductInfoCode.PRODUCT_SAVE_ERROR); } //娣诲姞缁撴瀯鏍� ProductMix productMix = new ProductMix(Long.parseLong(workStep.getId()),Long.parseLong(workStep.getProcessId()) - ,workStep.getStepName(),workStep.getStepCode(),6,new Date()); + ,workStep.getStepName(),workStep.getStepCode(),DocAttributionTypeEnum.WORKSITE.getCode(),new Date()); productMixService.save(productMix); //娣诲姞鏉冮檺楠岃瘉 PermissionStreamNew permissionStream = new PermissionStreamNew(); permissionStream.setUserId(userId); permissionStream.setBusinessId(workStep.getId()); - permissionStream.setBusinessType("6"); + permissionStream.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString()); return permissionStreamNewService.addPermissionStreamNew(permissionStream); } @@ -202,12 +215,12 @@ en.setStepId(workStep.getId()); workStepDepartmentList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(workStep.getId(),item.getId(),"6"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(workStep.getId(),item.getId(),DocAttributionTypeEnum.WORKSITE.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setDepartId(item.getId()); stream.setBusinessId(workStep.getId()); - stream.setBusinessType("6"); + stream.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString()); permissionStreamList.add(stream); } }); @@ -264,7 +277,7 @@ if(en != null) { workStepDepartmentList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(workStep.getId(),item.getId(),"6"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndDepartId(workStep.getId(),item.getId(),DocAttributionTypeEnum.WORKSITE.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -296,7 +309,7 @@ if(en == null) ExceptionCast.cast(ProcessInfoCode.PROCESS_NOT_EXIST); //楠岃瘉鏄惁瀛樺湪鏂囨。 - List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type","6").eq("attribution_id",id)); + List<DocRelative> docRelativeList=iDocRelativeService.list(new QueryWrapper<DocRelative>().eq("attribution_type",DocAttributionTypeEnum.WORKSITE.getCode().toString()).eq("attribution_id",id)); if (!docRelativeList.isEmpty()){ ExceptionCast.cast(ProcessInfoCode.WORKSTEP_HAS_DOC); } @@ -322,12 +335,12 @@ en.setStepId(workStep.getId()); permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),item.getId(),"6"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),item.getId(),DocAttributionTypeEnum.WORKSITE.getCode().toString()); if(stream == null) { stream = new PermissionStreamNew(); stream.setUserId(item.getId()); stream.setBusinessId(workStep.getId()); - stream.setBusinessType("6"); + stream.setBusinessType(DocAttributionTypeEnum.WORKSITE.getCode().toString()); permissionStreamList.add(stream); } }); @@ -358,7 +371,7 @@ if(en != null) { permissionList.add(en); } - PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),item.getId(),"6"); + PermissionStreamNew stream = permissionStreamNewService.loadPermissionStreamNewByBusinessIdAndUserId(workStep.getId(),item.getId(),DocAttributionTypeEnum.WORKSITE.getCode().toString()); if(stream != null) { permissionStreamList.add(stream); } @@ -379,4 +392,101 @@ return true; } + /** + * 閫氳繃宸ユ鍙枫�佸伐姝ュ悕绉扮瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * NC鏂囦欢瀛樺湪璁惧绫讳笅闈� + * @param treeInfoRequest + * @return + */ + @Override + public List<DocInfo> getByWorkStepOtherFile(TreeInfoRequest treeInfoRequest){ + LambdaQueryWrapper<WorkStep> queryWrapper = new LambdaQueryWrapper<>(); + if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { + queryWrapper.in(WorkStep::getProductId, treeInfoRequest.getProductIds()); + } + if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { + queryWrapper.in(WorkStep::getComponentId, treeInfoRequest.getComponentIds()); + } + if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) { + queryWrapper.in(WorkStep::getPartsId, treeInfoRequest.getPartsIds()); + } + if (treeInfoRequest.getPsvIds() != null && !treeInfoRequest.getPsvIds().isEmpty()) { + queryWrapper.in(WorkStep::getPsvId, treeInfoRequest.getPsvIds()); + } + if (treeInfoRequest.getProcessIds() != null && !treeInfoRequest.getProcessIds().isEmpty()) { + queryWrapper.in(WorkStep::getProcessId, treeInfoRequest.getProcessIds()); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())){ + queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),WorkStep::getId,treeInfoRequest.getAttributionId()); + } + queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),WorkStep::getStepName, treeInfoRequest.getTreeName()); + queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),WorkStep::getStepCode, treeInfoRequest.getTreeName()); + queryWrapper.orderByDesc(WorkStep::getCreateTime); + List<WorkStep> list = super.list(queryWrapper); + List<DocInfo> docInfos; + if (list == null || list.isEmpty() || StrUtil.isNotBlank(treeInfoRequest.getStructureType())){ + return new ArrayList<>(); + }else { + String ids=list.stream().map(WorkStep::getId).collect(Collectors.joining(",")); + DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); + BeanUtil.copyProperties(treeInfoRequest,docQuery); + docQuery.setAttributionIds(ids); + docQuery.setDocClassCode("OTHER"); + docQuery.setAttributionType(DocAttributionTypeEnum.WORKSITE.getCode()); + docInfos=docInfoService.findListByDocQuery(docQuery); + } + return docInfos; + } + + /** + * 閫氳繃宸ユ鍙枫�佸伐姝ュ悕绉扮瓑鏌ヨ瀵瑰簲NC鏂囦欢 + * NC鏂囦欢瀛樺湪璁惧绫讳笅闈� + * @param treeInfoRequest + * @return + */ + @Override + public List<DocInfo> getByWorkStepNCFile(TreeInfoRequest treeInfoRequest){ + LambdaQueryWrapper<WorkStep> queryWrapper = new LambdaQueryWrapper<>(); + if (treeInfoRequest.getProductIds() != null && !treeInfoRequest.getProductIds().isEmpty()) { + queryWrapper.in(WorkStep::getProductId, treeInfoRequest.getProductIds()); + } + if (treeInfoRequest.getComponentIds() != null && !treeInfoRequest.getComponentIds().isEmpty()) { + queryWrapper.in(WorkStep::getComponentId, treeInfoRequest.getComponentIds()); + } + if (treeInfoRequest.getPartsIds() != null && !treeInfoRequest.getPartsIds().isEmpty()) { + queryWrapper.in(WorkStep::getPartsId, treeInfoRequest.getPartsIds()); + } + if (treeInfoRequest.getPsvIds() != null && !treeInfoRequest.getPsvIds().isEmpty()) { + queryWrapper.in(WorkStep::getPsvId, treeInfoRequest.getPsvIds()); + } + if (treeInfoRequest.getProcessIds() != null && !treeInfoRequest.getProcessIds().isEmpty()) { + queryWrapper.in(WorkStep::getProcessId, treeInfoRequest.getProcessIds()); + } + if (Objects.equals(treeInfoRequest.getAttributionType(), DocAttributionTypeEnum.WORKSITE.getCode())){ + queryWrapper.eq(StrUtil.isNotEmpty(treeInfoRequest.getAttributionId()),WorkStep::getProcessId,treeInfoRequest.getAttributionId()); + } + queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeName()),WorkStep::getStepName, treeInfoRequest.getTreeName()); + queryWrapper.like(StrUtil.isNotEmpty(treeInfoRequest.getTreeCode()),WorkStep::getStepCode, treeInfoRequest.getTreeName()); + queryWrapper.orderByDesc(WorkStep::getCreateTime); + List<WorkStep> list = super.list(queryWrapper); + List<DocInfo> docInfos = new ArrayList<>(); + //NC鏂囦欢瀛樺湪瀵瑰簲鐨勮澶囩被涓嬶紝鎵�浠ラ渶瑕佽繃婊� + if (!list.isEmpty()) { + List<String> workStepIds = list.stream().map(WorkStep::getId).collect(Collectors.toList()); + List<DeviceType> deviceTypeList = deviceTypeService.getDeviceTypeByAttribution(workStepIds, + DocAttributionTypeEnum.WORKSITE.getCode(),treeInfoRequest.getDeviceManagementName(),treeInfoRequest.getDeviceManagementCode()); + if (deviceTypeList != null && !deviceTypeList.isEmpty()) { + List<String> deviceManagementIds=deviceTypeList.stream().map(DeviceType::getDeviceManagementId).collect(Collectors.toList()); + DocInfoQueryRequest docQuery = new DocInfoQueryRequest(); + BeanUtil.copyProperties(treeInfoRequest,docQuery); + docQuery.setAttributionIds(String.join(",",deviceManagementIds)); + docQuery.setDocClassCode("NC"); + docQuery.setAttributionType(DocAttributionTypeEnum.WORKSITE.getCode()); + docInfos=docInfoService.findListByDocQuery(docQuery); + } + return docInfos; + } + return new ArrayList<>(); + } + } diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/DispatchFileController.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/DispatchFileController.java index 43926c7..35234c4 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/DispatchFileController.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/controller/DispatchFileController.java @@ -49,7 +49,6 @@ * @param req * @return */ - //@AutoLog(value = "nc绋嬪簭涓庣數瀛愬浘鐗堢娲�-鍒嗛〉鍒楄〃鏌ヨ") @ApiOperation(value="nc绋嬪簭涓庣數瀛愬浘鐗堢娲�-鍒嗛〉鍒楄〃鏌ヨ", notes="nc绋嬪簭涓庣數瀛愬浘鐗堢娲�-鍒嗛〉鍒楄〃鏌ヨ") @GetMapping(value = "/list") public Result<IPage<DispatchFile>> queryPageList(DispatchFile dispatchFile, @@ -63,6 +62,20 @@ } /** + * 鏂囦欢鏌ヨ瀹$娴佺▼ + * @param attributionId,attributionType,docId + * @return + */ + @AutoLog(value = "nc绋嬪簭涓庣數瀛愬浘鐗堢娲�-鏂囦欢鏌ヨ瀹$娴佺▼") + @ApiOperation(value="nc绋嬪簭涓庣數瀛愬浘鐗堢娲�-鏂囦欢鏌ヨ瀹$娴佺▼", notes="nc绋嬪簭涓庣數瀛愬浘鐗堢娲�-鏂囦欢鏌ヨ瀹$娴佺▼") + @GetMapping(value = "/queryDispatchDocFile") + public Result<?> queryDispatchDocFile(@RequestParam(name="attributionId") String attributionId, + @RequestParam(name="attributionType") String attributionType, + @RequestParam(name="docId") String docId){ + return dispatchFileService.queryDispatchDocFile(attributionId,attributionType,docId); + } + + /** * 閲嶆柊鍚姩 * @param dispatchFileFlowTaskVo * @return diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/IDispatchFileService.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/IDispatchFileService.java index 0068598..7246401 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/IDispatchFileService.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/IDispatchFileService.java @@ -23,6 +23,13 @@ Result<?> saveDispatchFile(DispatchFile dispatchFile); /** + * 鏂囦欢鏌ヨ瀹$娴佺▼ + * @param attributionId,attributionType,docId + * @return + */ + Result<?> queryDispatchDocFile(String attributionId, String attributionType, String docId); + + /** * 閲嶆柊鍚姩 * @param dispatchFileFlowTaskVo */ diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java index f72e491..0314c77 100644 --- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java +++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dncFlow/service/impl/DispatchFileServiceImpl.java @@ -2,6 +2,7 @@ import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import org.apache.commons.beanutils.BeanUtils; @@ -30,8 +31,10 @@ import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; import org.jeecg.modules.flowable.apithird.service.FlowCommonService; +import org.jeecg.modules.flowable.domain.vo.FlowHistoricalVo; import org.jeecg.modules.flowable.service.IFlowDefinitionService; import org.jeecg.modules.flowable.service.IFlowTaskService; +import org.jeecg.modules.flowable.service.IHisWorkTaskService; import org.jeecg.modules.system.service.ISysUserRoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; @@ -70,6 +73,8 @@ private ISysUserRoleService sysUserRoleService; @Autowired private PermissionService permissionService; + @Autowired + private IHisWorkTaskService hisWorkTaskService; /** * 娴佺▼鍚姩,淇濆瓨瀵瑰簲鐨勬暟鎹� * @param dispatchFile @@ -109,6 +114,29 @@ } /** + * 鏂囦欢鏌ヨ瀹$娴佺▼ + * @param attributionId,attributionType,docId + * @return + */ + @Override + public Result<?> queryDispatchDocFile(String attributionId, String attributionType, String docId){ + DispatchFile dispatchFile=super.getOne(new LambdaQueryWrapper<DispatchFile>() + .eq(DispatchFile::getAttributionId, attributionId).eq(DispatchFile::getAttributionType, attributionType) + .eq(DispatchFile::getDocId, docId)); + if (dispatchFile==null){ + return Result.error("鏈壘鍒板搴斿绛炬枃浠�"); + }else { + FlowMyBusiness flowMyBusiness=flowMyBusinessService.selectByDataId(dispatchFile.getId()); + if (flowMyBusiness==null){ + return Result.error("鏈壘鍒板搴斿绛炬祦绋�"); + }else { + List<FlowHistoricalVo> queryHisTaskByProcInstId=hisWorkTaskService.queryHisTaskByProcInstId(flowMyBusiness.getProcessInstanceId()); + return Result.ok(queryHisTaskByProcInstId); + } + } + } + + /** * 閲嶆柊鍚姩 * @param dispatchFileFlowTaskVo */ diff --git a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java index 78a241f..fb5e489 100644 --- a/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java +++ b/lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/service/impl/FlowTaskServiceImpl.java @@ -1155,19 +1155,21 @@ HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery() .processInstanceId(flowTaskDto.getProcInsId()) .singleResult(); - SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId()); - 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) { - flowTaskDto.setTodoUsers(""); - } else { - //鍘婚櫎[] - flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\\[", "").replaceAll("\\]", "")); - flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\"", "")); + if (historicProcessInstance != null) { + SysUser startUser = iFlowThirdService.getUserByUsername(historicProcessInstance.getStartUserId()); + 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) { + flowTaskDto.setTodoUsers(""); + } else { + //鍘婚櫎[] + flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\\[", "").replaceAll("\\]", "")); + flowTaskDto.setTodoUsers(flowTaskDto.getTodoUsers().replaceAll("\"", "")); + } } }); IPage<FlowTaskDto> flowTaskDtoIPage = new Page<>(); diff --git a/lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/IMsiWebapiJsonService.java b/lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/IMsiWebapiJsonService.java index f49f041..75e8b17 100644 --- a/lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/IMsiWebapiJsonService.java +++ b/lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/IMsiWebapiJsonService.java @@ -11,7 +11,7 @@ /** * 瑙f瀽鍗曟潯鏁版嵁淇濆瓨鍒板崟琛� - * @param machineInfo + * @param data * @return */ boolean saveTableAutomationOne(List<MachineEquipentInfo> data); diff --git a/lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/impl/MsiWebapiJsonServiceImpl.java b/lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/impl/MsiWebapiJsonServiceImpl.java index 72e2db6..5847936 100644 --- a/lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/impl/MsiWebapiJsonServiceImpl.java +++ b/lxzn-module-msi/src/main/java/org/jeecg/modules/msi/webapi/service/impl/MsiWebapiJsonServiceImpl.java @@ -1,7 +1,8 @@ package org.jeecg.modules.msi.webapi.service.impl; -import cn.hutool.core.date.DateUtil; +import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import liquibase.util.JdbcUtils; import org.apache.commons.lang3.StringUtils; import org.jeecg.common.util.DateUtils; import org.jeecg.modules.msi.webapi.entity.MsiWebapiJsonEntity; @@ -9,8 +10,15 @@ import org.jeecg.modules.msi.webapi.service.IMsiWebapiJsonService; import org.jeecg.modules.msi.webapi.vo.DetailedListVo; import org.jeecg.modules.msi.webapi.vo.MachineEquipentInfo; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.DataSourceUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.interceptor.TransactionAspectSupport; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -19,7 +27,14 @@ @Service public class MsiWebapiJsonServiceImpl extends ServiceImpl<MsiWebapiJsonMapper, MsiWebapiJsonEntity> implements IMsiWebapiJsonService { + @Autowired + private JdbcTemplate jdbcTemplate; + /** + * 瑙f瀽鍗曟潯鏁版嵁淇濆瓨鍒板崟琛� + * @param data + * @return + */ @Override public boolean saveTableAutomationOne(List<MachineEquipentInfo> data) { if (data ==null || data.isEmpty()) { @@ -38,9 +53,51 @@ listParameter.add(parameter); } } - //鐘舵�佹暟鎹� + // 鎵ц鐘舵�佹暟鎹甋QL + try { + executeBatchSql(listStatus); + executeBatchSql(listParameter); + return true; + } catch (Exception e) { + log.error("鎵цSQL鎵归噺鎻掑叆澶辫触", e); + TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); + return false; + } + } - return false; + /** + * 鎵归噺鎵цSQL璇彞 + * @param sqlList SQL璇彞鍒楄〃 + * @throws SQLException + */ + private void executeBatchSql(List<String> sqlList) throws SQLException { + if (CollectionUtils.isEmpty(sqlList)) { + return; + } + + Connection connection = null; + Statement statement = null; + + try { + connection = DataSourceUtils.getConnection(jdbcTemplate.getDataSource()); + connection.setAutoCommit(false); + statement = connection.createStatement(); + + for (String sql : sqlList) { + statement.addBatch(sql); + } + + statement.executeBatch(); + connection.commit(); + } catch (SQLException e) { + if (connection != null) { + connection.rollback(); + } + throw e; + } finally { + JdbcUtils.closeStatement(statement); + DataSourceUtils.releaseConnection(connection, jdbcTemplate.getDataSource()); + } } -- Gitblit v1.9.3