From cc44920da3d40b8248b67560026e891afdd1a6ab Mon Sep 17 00:00:00 2001 From: lyh <925863403@qq.com> Date: 星期四, 08 五月 2025 17:57:14 +0800 Subject: [PATCH] 1.查询可以被引用的部件接口开发完成 2.借用部件(可批量) 开发完成 3.修改原有新增、修改部件接口 完成 4.修改原有删除文档与导入文档接口 完成 5.修改工作流问题 --- lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/CutterServiceImpl.java | 71 +++++++++++++++++++++-------------- 1 files changed, 42 insertions(+), 29 deletions(-) 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 d29c8c5..8422256 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 @@ -10,12 +10,12 @@ 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.response.ProcessInfoCode; import org.jeecg.modules.dnc.service.ICutterService; import org.jeecg.modules.dnc.utils.ValidateUtil; import org.springframework.stereotype.Service; import java.util.List; +import java.util.stream.Collectors; @Service public class CutterServiceImpl extends ServiceImpl<CutterMapper, Cutter> implements ICutterService { @@ -29,11 +29,12 @@ public Result<?> add(Cutter cutter){ if(cutter == null) ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(!ValidateUtil.validateString(cutter.getProcessStepId())) + if(!ValidateUtil.validateString(cutter.getAttributionId())) Result.error("鏃犳晥鐨勫垁鍏�"); - boolean b =this.checkCutterNo(cutter); - if(!b) + List<Cutter> cutterList =this.checkCutterNo(cutter); + if (cutterList != null && !cutterList.isEmpty()) { return Result.error("宸插瓨鍦ㄧ浉鍚岀殑鍒�鍏风紪鍙�"); + } boolean save = this.save(cutter); if(save){ return Result.OK("娣诲姞鍒�鍏锋垚鍔�"); @@ -48,21 +49,34 @@ */ @Override public Result<?> edit(Cutter cutter){ - if(cutter == null) - ExceptionCast.cast(CommonCode.INVALID_PARAM); - if(!ValidateUtil.validateString(cutter.getCutterName())) - ExceptionCast.cast(ProcessInfoCode.PROCESS_NAME_NONE); - Cutter en = super.getById(cutter.getId()); - if(en == null) - ExceptionCast.cast(ProcessInfoCode.WORKSTEP_NOT_EXIST); - boolean b =this.checkCutterNo(cutter); - if(!b) - return Result.error("宸插瓨鍦ㄧ浉鍚岀殑鍒�鍏风紪鍙�"); - boolean save = this.updateById(cutter); - if(save){ - return Result.OK("鍒�鍏蜂俊鎭紪杈戞垚鍔�"); + // 妫�鏌ヤ紶鍏ョ殑鍒�鍏峰璞℃槸鍚︿负绌� + if (cutter == null) { + return Result.OK("鍒�鍏峰璞′笉鑳戒负绌�"); } - return Result.OK("鍒�鍏蜂俊鎭紪杈戝け璐�"); + // 妫�鏌ュ垁鍏峰悕绉版槸鍚︽湁鏁� + if (!ValidateUtil.validateString(cutter.getCutterName())) { + return Result.OK("鍒�鍏峰悕绉版棤鏁�"); + } + // 鏍规嵁鍒�鍏� ID 鑾峰彇鍒�鍏蜂俊鎭� + Cutter existingCutter = super.getById(cutter.getId()); + if (existingCutter == null) { + return Result.OK("鍒�鍏蜂笉瀛樺湪"); + } + // 杩囨护鎺夊綋鍓嶈缂栬緫鐨勫垁鍏凤紝妫�鏌ユ槸鍚︽湁鍏朵粬鍒�鍏峰瓨鍦ㄧ浉鍚岀紪鍙� + List<Cutter> otherCuttersWithSameNo = this.checkCutterNo(cutter).stream() + .filter(cut -> !cut.getId().equals(cutter.getId())) + .collect(Collectors.toList()); + if (!otherCuttersWithSameNo.isEmpty()) { + // 濡傛灉瀛樺湪闄ゅ綋鍓嶅垁鍏峰鐨勫叾浠栧垁鍏风紪鍙烽噸澶� + return Result.error("宸插瓨鍦ㄧ浉鍚岀殑鍒�鍏风紪鍙�"); + } + // 灏濊瘯鏇存柊鍒�鍏蜂俊鎭� + boolean updated = this.updateById(cutter); + if (updated) { + return Result.OK("鍒�鍏蜂俊鎭紪杈戞垚鍔�"); + } else { + return Result.error("鍒�鍏蜂俊鎭紪杈戝け璐�"); + } } /** @@ -89,13 +103,12 @@ * @param cutter * @return */ - public boolean checkCutterNo(Cutter cutter){ + public List<Cutter> checkCutterNo(Cutter cutter){ QueryWrapper<Cutter> queryWrapper = new QueryWrapper<>(); - queryWrapper.eq(StrUtil.isNotEmpty(cutter.getProcessStepId()),"process_step_id",cutter.getProcessStepId()); - queryWrapper.eq("type",cutter.getType()); - queryWrapper.eq(StrUtil.isNotEmpty(cutter.getCutterCode()),"craft_code",cutter.getCutterCode()); - List<Cutter> list = baseMapper.selectList(queryWrapper); - return list.isEmpty(); + 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()); + return baseMapper.selectList(queryWrapper); } /** @@ -106,12 +119,12 @@ @Override public Result<?> query(Cutter cutter, Integer pageNo, Integer pageSize){ QueryWrapper<Cutter> queryWrapper = new QueryWrapper<>(); - queryWrapper.eq(StrUtil.isNotEmpty(cutter.getProcessStepId()),"process_step_id",cutter.getProcessStepId()); - if (cutter.getType() != null){ - queryWrapper.eq("type",cutter.getType()); + queryWrapper.eq(StrUtil.isNotEmpty(cutter.getAttributionId()),"attribution_id",cutter.getAttributionId()); + if (cutter.getAttributionType() != null){ + queryWrapper.eq("attribution_type",cutter.getAttributionType()); } - queryWrapper.like(StrUtil.isNotEmpty(cutter.getCutterName()),"craft_code",cutter.getCutterCode()); - queryWrapper.like(StrUtil.isNotEmpty(cutter.getCutterName()),"craft_name",cutter.getCutterName()); + queryWrapper.like(StrUtil.isNotEmpty(cutter.getCutterCode()),"cutter_code",cutter.getCutterCode()); + queryWrapper.like(StrUtil.isNotEmpty(cutter.getCutterName()),"cutter_name",cutter.getCutterName()); queryWrapper.orderByDesc("create_time"); Page<Cutter> page = new Page<>(pageNo,pageSize); IPage<Cutter> cutterIPage = baseMapper.selectPage(page, queryWrapper); -- Gitblit v1.9.3