From 07d8762081d838d6090e8ee8562409afeeb0ba79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BD=90=E5=A4=A9=E5=A4=A7=E5=9C=A3?= <17615834396@163.com> Date: Sat, 30 Mar 2024 14:14:06 +0800 Subject: [PATCH] bug --- fuintAdmin/src/views/duty/index.vue | 3 ++- .../tag/controller/TagCodeRecordController.java | 2 +- .../tag/service/TagCodeRecordService.java | 2 +- .../tag/service/impl/OilTagServiceImpl.java | 15 +++++++++++++++ .../service/impl/TagCodeRecordServiceImpl.java | 16 +++++++++++++++- 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/fuintAdmin/src/views/duty/index.vue b/fuintAdmin/src/views/duty/index.vue index 18a9727e3..491970370 100644 --- a/fuintAdmin/src/views/duty/index.vue +++ b/fuintAdmin/src/views/duty/index.vue @@ -217,7 +217,8 @@ export default { status: "A", menuIds: [], menuCheckStrictly: true, - description: '' + description: '', + deptType: '3', }; this.resetForm("form1"); }, diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeRecordController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeRecordController.java index fefaa2967..7fdcdd697 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeRecordController.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/controller/TagCodeRecordController.java @@ -80,7 +80,7 @@ public class TagCodeRecordController extends BaseController { * @return 新增结果 */ @PostMapping - public ResponseObject insert(@RequestBody TagCodeRecordDTO tagCodeRecordDTO) { + public ResponseObject insert(@RequestBody TagCodeRecordDTO tagCodeRecordDTO) throws Exception { return getSuccessResult(this.tagCodeRecordService.add(tagCodeRecordDTO)); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/TagCodeRecordService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/TagCodeRecordService.java index 5a4ba0e91..0b95779ca 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/TagCodeRecordService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/TagCodeRecordService.java @@ -18,7 +18,7 @@ import java.util.List; */ public interface TagCodeRecordService extends IService { - boolean add(TagCodeRecordDTO tagCodeRecordDTO); + boolean add(TagCodeRecordDTO tagCodeRecordDTO) throws Exception; IPage selectTagList(Page page, TagCodeRecord tagCodeRecord); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/OilTagServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/OilTagServiceImpl.java index aaa2c4fb1..3e9b81271 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/OilTagServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/OilTagServiceImpl.java @@ -12,6 +12,7 @@ import com.fuint.business.tag.service.TagCodeService; import com.fuint.common.dto.AccountInfo; import com.fuint.common.util.TokenUtil; import com.fuint.module.backendApi.controller.BackendFileController; +import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; @@ -43,9 +44,23 @@ public class OilTagServiceImpl extends ServiceImpl impleme oilTag.setTerminalNumber(number+""); AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); oilTag.setDeptId(Integer.parseInt(nowAccountInfo.getDeptId().toString())); + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(TagCode::getTagCodeSn, oilTag.getTagCodeSn()); TagCode tagCode = tagCodeService.getOne(queryWrapper); + + LambdaQueryWrapper queryWrapper1 = new LambdaQueryWrapper<>(); + queryWrapper1.eq(OilTag::getTagCodeSn, oilTag.getTagCodeSn()); + OilTag one = getOne(queryWrapper1); + if (ObjectUtils.isNotEmpty(one)){ + throw new Exception("该二维码已绑定过码牌"); + } + + queryWrapper1.eq(OilTag::getSnCode, oilTag.getSnCode()); + OilTag ones = getOne(queryWrapper1); + if (ObjectUtils.isNotEmpty(ones)){ + throw new Exception("该码牌已绑定过二维码"); + } //TagCode tagCode = tagCodeService.getById(oilTag.getTagCodeId()); oilTag.setTagCodeId(tagCode.getId()); return save(oilTag); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeRecordServiceImpl.java index 8a4762ad0..d5eca2dab 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/tag/service/impl/TagCodeRecordServiceImpl.java @@ -57,7 +57,7 @@ public class TagCodeRecordServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(TagCodeRecord::getOilTagId,byId.getId()); + TagCodeRecord one = getOne(queryWrapper); + if (ObjectUtils.isNotEmpty(one)){ + throw new Exception("该码牌已经绑定过油站!"); + } + } + //二维码 TagCode byId1 = tagCodeService.getById(tagCodeId); String collection = byId1.getCollection();