This commit is contained in:
齐天大圣 2024-03-30 14:14:06 +08:00
parent efa9d6057f
commit 07d8762081
5 changed files with 34 additions and 4 deletions

View File

@ -217,7 +217,8 @@ export default {
status: "A",
menuIds: [],
menuCheckStrictly: true,
description: ''
description: '',
deptType: '3',
};
this.resetForm("form1");
},

View File

@ -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));
}

View File

@ -18,7 +18,7 @@ import java.util.List;
*/
public interface TagCodeRecordService extends IService<TagCodeRecord> {
boolean add(TagCodeRecordDTO tagCodeRecordDTO);
boolean add(TagCodeRecordDTO tagCodeRecordDTO) throws Exception;
IPage<TagCodeRecordVO> selectTagList(Page page, TagCodeRecord tagCodeRecord);

View File

@ -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<OilTagMapper, OilTag> impleme
oilTag.setTerminalNumber(number+"");
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilTag.setDeptId(Integer.parseInt(nowAccountInfo.getDeptId().toString()));
LambdaQueryWrapper<TagCode> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TagCode::getTagCodeSn, oilTag.getTagCodeSn());
TagCode tagCode = tagCodeService.getOne(queryWrapper);
LambdaQueryWrapper<OilTag> 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);

View File

@ -57,7 +57,7 @@ public class TagCodeRecordServiceImpl extends ServiceImpl<TagCodeRecordMapper, T
@Override
@Transactional
public boolean add(TagCodeRecordDTO tagCodeRecordDTO) {
public boolean add(TagCodeRecordDTO tagCodeRecordDTO) throws Exception {
boolean flag = false;
//绑定之前 先去查询
TagCodeRecord tagCodeRecord = new TagCodeRecord();
@ -68,6 +68,20 @@ public class TagCodeRecordServiceImpl extends ServiceImpl<TagCodeRecordMapper, T
OilTag byId = oilTagService.getById(integer);
//二维码id
Integer tagCodeId = byId.getTagCodeId();
//判断该二维码有没有绑定过码牌
/*if (ObjectUtils.isNotEmpty(byId) && ObjectUtils.isNotEmpty(byId.getSnCode())){
throw new Exception("该二维码已经绑定过码牌!");
}*/
if (ObjectUtils.isNotEmpty(byId)){
LambdaQueryWrapper<TagCodeRecord> 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();