|
@@ -1,21 +1,21 @@
|
|
|
package com.abi.qms.platform.service.impl;
|
|
|
|
|
|
-import com.abi.qms.platform.dao.entity.BoxCodeFormat;
|
|
|
+import com.abi.qms.platform.dao.entity.QrBoxCodeFormat;
|
|
|
import com.abi.qms.platform.dao.enums.StateEnum;
|
|
|
-import com.abi.qms.platform.dao.mapper.BoxCodeFormatMapper;
|
|
|
-import com.abi.qms.platform.dao.vo.result.BoxCodeFormatVO;
|
|
|
-import com.abi.qms.platform.dto.req.BoxCodeFormatDetailReq;
|
|
|
+import com.abi.qms.platform.dao.mapper.QrBoxCodeFormatMapper;
|
|
|
+import com.abi.qms.platform.dao.vo.result.QrBoxCodeFormatVO;
|
|
|
+import com.abi.qms.platform.dto.req.QrBoxCodeFormatDetailReq;
|
|
|
import com.abi.qms.platform.dto.req.DeleteBoxCodeFormatreq;
|
|
|
import com.abi.qms.platform.dto.req.DisableBoxCodeFormatReq;
|
|
|
import com.abi.qms.platform.dto.req.EnableBoxCodeFormatReq;
|
|
|
import com.abi.qms.platform.dto.req.ListBoxCodeFormatReq;
|
|
|
import com.abi.qms.platform.dto.req.SaveBoxCodeFormatReq;
|
|
|
-import com.abi.qms.platform.dto.res.BoxCodeFormatDetailRes;
|
|
|
+import com.abi.qms.platform.dto.res.QrBoxCodeFormatDetailRes;
|
|
|
import com.abi.qms.platform.dto.res.ListBoxCodeFormatRes;
|
|
|
import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
|
import com.abi.qms.platform.infrastructure.util.PageUtil;
|
|
|
import com.abi.qms.platform.infrastructure.util.UserUtil;
|
|
|
-import com.abi.qms.platform.service.BoxCodeFormatService;
|
|
|
+import com.abi.qms.platform.service.QrBoxCodeFormatService;
|
|
|
import com.abi.task.common.api.exception.BusinessException;
|
|
|
import com.abi.task.common.api.exception.ErrorCodeEnum;
|
|
|
import com.abi.task.common.utils.PojoConverterUtils;
|
|
@@ -33,37 +33,37 @@ import java.util.List;
|
|
|
*/
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
-public class BoxCodeFormatImpl implements BoxCodeFormatService {
|
|
|
+public class QrBoxCodeFormatImpl implements QrBoxCodeFormatService {
|
|
|
|
|
|
@Autowired
|
|
|
- private BoxCodeFormatMapper boxCodeFormatMapper;
|
|
|
+ private QrBoxCodeFormatMapper qrBoxCodeFormatMapper;
|
|
|
|
|
|
@Override
|
|
|
public void saveBoxCodeFormat(SaveBoxCodeFormatReq req) {
|
|
|
|
|
|
//1-声明对象
|
|
|
- BoxCodeFormat boxCodeFormat = null;
|
|
|
+ QrBoxCodeFormat qrBoxCodeFormat = null;
|
|
|
if (req.getId() != null) {
|
|
|
- boxCodeFormat = boxCodeFormatMapper.selectById(req.getId());
|
|
|
- AssertUtil.isNull(boxCodeFormat, "箱码幅面ID不存在");
|
|
|
+ qrBoxCodeFormat = qrBoxCodeFormatMapper.selectById(req.getId());
|
|
|
+ AssertUtil.isNull(qrBoxCodeFormat, "箱码幅面ID不存在");
|
|
|
} else {
|
|
|
- boxCodeFormat = new BoxCodeFormat();
|
|
|
+ qrBoxCodeFormat = new QrBoxCodeFormat();
|
|
|
}
|
|
|
|
|
|
//2-放入数据
|
|
|
- boxCodeFormat.setQrRepertoryId(req.getQrRepertoryId());
|
|
|
+ qrBoxCodeFormat.setQrRepertoryId(req.getQrRepertoryId());
|
|
|
//若当前登录用户为包材厂用户,则该选项默认选择该用户所在的包材厂,不可修改
|
|
|
- boxCodeFormat.setFactoryId(UserUtil.getUser().getFactoryId() != null ? UserUtil.getUser().getFactoryId() : req.getFactoryId());
|
|
|
- boxCodeFormat.setName(req.getName());
|
|
|
- boxCodeFormat.setColorPerRollScalar(req.getColorPerRollScalar());
|
|
|
- boxCodeFormat.setFormatNumber(req.getFormatNumber());
|
|
|
- boxCodeFormat.setRemark(req.getRemark());
|
|
|
+ qrBoxCodeFormat.setFactoryId(UserUtil.getUser().getFactoryId() != null ? UserUtil.getUser().getFactoryId() : req.getFactoryId());
|
|
|
+ qrBoxCodeFormat.setName(req.getName());
|
|
|
+ qrBoxCodeFormat.setColorPerRollScalar(req.getColorPerRollScalar());
|
|
|
+ qrBoxCodeFormat.setFormatNumber(req.getFormatNumber());
|
|
|
+ qrBoxCodeFormat.setRemark(req.getRemark());
|
|
|
|
|
|
//3-新增or修改
|
|
|
if (req.getId() != null) {
|
|
|
- boxCodeFormatMapper.updateById(boxCodeFormat);
|
|
|
+ qrBoxCodeFormatMapper.updateById(qrBoxCodeFormat);
|
|
|
} else {
|
|
|
- boxCodeFormatMapper.insert(boxCodeFormat);
|
|
|
+ qrBoxCodeFormatMapper.insert(qrBoxCodeFormat);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -75,8 +75,8 @@ public class BoxCodeFormatImpl implements BoxCodeFormatService {
|
|
|
req.setFactoryId(UserUtil.getUser().getFactoryId());
|
|
|
}
|
|
|
//分页查询
|
|
|
- IPage<BoxCodeFormatVO> iPage = boxCodeFormatMapper.listBoxCodeFormat(PageUtil.createPage(req), req);
|
|
|
- List<BoxCodeFormatVO> formatList = iPage.getRecords();
|
|
|
+ IPage<QrBoxCodeFormatVO> iPage = qrBoxCodeFormatMapper.listBoxCodeFormat(PageUtil.createPage(req), req);
|
|
|
+ List<QrBoxCodeFormatVO> formatList = iPage.getRecords();
|
|
|
//封装出参
|
|
|
ListBoxCodeFormatRes res = new ListBoxCodeFormatRes();
|
|
|
//放入分页信息
|
|
@@ -89,14 +89,14 @@ public class BoxCodeFormatImpl implements BoxCodeFormatService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public BoxCodeFormatDetailRes getBoxCodeFormatDetail(BoxCodeFormatDetailReq req) {
|
|
|
+ public QrBoxCodeFormatDetailRes getBoxCodeFormatDetail(QrBoxCodeFormatDetailReq req) {
|
|
|
|
|
|
//查询箱码幅面详情
|
|
|
- BoxCodeFormatVO boxCodeFormatVO = boxCodeFormatMapper.selectBoxCodeFormatDetailById(req.getId());
|
|
|
- AssertUtil.isNull(boxCodeFormatVO, "箱码幅面详情不存在");
|
|
|
+ QrBoxCodeFormatVO qrBoxCodeFormatVO = qrBoxCodeFormatMapper.selectBoxCodeFormatDetailById(req.getId());
|
|
|
+ AssertUtil.isNull(qrBoxCodeFormatVO, "箱码幅面详情不存在");
|
|
|
|
|
|
//转化出参
|
|
|
- BoxCodeFormatDetailRes res = PojoConverterUtils.copy(boxCodeFormatVO, BoxCodeFormatDetailRes.class);
|
|
|
+ QrBoxCodeFormatDetailRes res = PojoConverterUtils.copy(qrBoxCodeFormatVO, QrBoxCodeFormatDetailRes.class);
|
|
|
|
|
|
return res;
|
|
|
}
|
|
@@ -109,15 +109,15 @@ public class BoxCodeFormatImpl implements BoxCodeFormatService {
|
|
|
//循环启用
|
|
|
for (Long id : ids) {
|
|
|
//1-查询活动对象
|
|
|
- BoxCodeFormat boxCodeFormat = boxCodeFormatMapper.selectById(id);
|
|
|
- AssertUtil.isNull(boxCodeFormat, "箱码幅面不存在");
|
|
|
- if (!StateEnum.DISABLE.is(boxCodeFormat.getState())) {
|
|
|
+ QrBoxCodeFormat qrBoxCodeFormat = qrBoxCodeFormatMapper.selectById(id);
|
|
|
+ AssertUtil.isNull(qrBoxCodeFormat, "箱码幅面不存在");
|
|
|
+ if (!StateEnum.DISABLE.is(qrBoxCodeFormat.getState())) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
//2-修改状态
|
|
|
- boxCodeFormat.setState(StateEnum.ENABLE.getCode());
|
|
|
- boxCodeFormatMapper.updateById(boxCodeFormat);
|
|
|
+ qrBoxCodeFormat.setState(StateEnum.ENABLE.getCode());
|
|
|
+ qrBoxCodeFormatMapper.updateById(qrBoxCodeFormat);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -129,15 +129,15 @@ public class BoxCodeFormatImpl implements BoxCodeFormatService {
|
|
|
//循环禁用
|
|
|
for (Long id : ids) {
|
|
|
//1-查询活动对象
|
|
|
- BoxCodeFormat boxCodeFormat = boxCodeFormatMapper.selectById(id);
|
|
|
- AssertUtil.isNull(boxCodeFormat, "箱码幅面不存在");
|
|
|
- if (!StateEnum.ENABLE.is(boxCodeFormat.getState())) {
|
|
|
+ QrBoxCodeFormat qrBoxCodeFormat = qrBoxCodeFormatMapper.selectById(id);
|
|
|
+ AssertUtil.isNull(qrBoxCodeFormat, "箱码幅面不存在");
|
|
|
+ if (!StateEnum.ENABLE.is(qrBoxCodeFormat.getState())) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
//2-修改状态
|
|
|
- boxCodeFormat.setState(StateEnum.DISABLE.getCode());
|
|
|
- boxCodeFormatMapper.updateById(boxCodeFormat);
|
|
|
+ qrBoxCodeFormat.setState(StateEnum.DISABLE.getCode());
|
|
|
+ qrBoxCodeFormatMapper.updateById(qrBoxCodeFormat);
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -146,17 +146,17 @@ public class BoxCodeFormatImpl implements BoxCodeFormatService {
|
|
|
public void deleteBoxCodeFormat(DeleteBoxCodeFormatreq req) {
|
|
|
|
|
|
//查询箱码幅面
|
|
|
- BoxCodeFormat boxCodeFormat = boxCodeFormatMapper.selectById(req.getId());
|
|
|
- if (boxCodeFormat == null) {
|
|
|
+ QrBoxCodeFormat qrBoxCodeFormat = qrBoxCodeFormatMapper.selectById(req.getId());
|
|
|
+ if (qrBoxCodeFormat == null) {
|
|
|
throw new BusinessException(ErrorCodeEnum.NO_EXISTS_DATA.getCode(), "箱码幅面不存在");
|
|
|
}
|
|
|
- if (boxCodeFormat.getState() == StateEnum.ENABLE.getCode()) {
|
|
|
+ if (qrBoxCodeFormat.getState() == StateEnum.ENABLE.getCode()) {
|
|
|
throw new BusinessException("该箱码幅面还在启用中,不能删除。");
|
|
|
}
|
|
|
|
|
|
//逻辑删除
|
|
|
- boxCodeFormat.setIsDelete(1);
|
|
|
- boxCodeFormatMapper.updateById(boxCodeFormat);
|
|
|
+ qrBoxCodeFormat.setIsDelete(1);
|
|
|
+ qrBoxCodeFormatMapper.updateById(qrBoxCodeFormat);
|
|
|
}
|
|
|
|
|
|
|