|
@@ -1,7 +1,6 @@
|
|
package com.abi.qms.platform.service.impl;
|
|
package com.abi.qms.platform.service.impl;
|
|
|
|
|
|
import com.abi.qms.platform.dao.entity.QrFormat;
|
|
import com.abi.qms.platform.dao.entity.QrFormat;
|
|
-import com.abi.qms.platform.dao.enums.QrFormatUniqueStatusEunm;
|
|
|
|
import com.abi.qms.platform.dao.enums.QrFormatUseStatusEnum;
|
|
import com.abi.qms.platform.dao.enums.QrFormatUseStatusEnum;
|
|
import com.abi.qms.platform.dao.enums.QrFormatVerifyUniqueEnum;
|
|
import com.abi.qms.platform.dao.enums.QrFormatVerifyUniqueEnum;
|
|
import com.abi.qms.platform.dao.mapper.QrFormatMapper;
|
|
import com.abi.qms.platform.dao.mapper.QrFormatMapper;
|
|
@@ -12,7 +11,7 @@ import com.abi.qms.platform.dto.res.ListQrFormatRes;
|
|
import com.abi.qms.platform.infrastructure.task.VerifyUniqueTask;
|
|
import com.abi.qms.platform.infrastructure.task.VerifyUniqueTask;
|
|
import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
import com.abi.qms.platform.infrastructure.util.AssertUtil;
|
|
import com.abi.qms.platform.infrastructure.util.PageUtil;
|
|
import com.abi.qms.platform.infrastructure.util.PageUtil;
|
|
-import com.abi.qms.platform.service.BoxCodeFormatService;
|
|
|
|
|
|
+import com.abi.qms.platform.infrastructure.util.UserUtil;
|
|
import com.abi.qms.platform.service.QrFormatService;
|
|
import com.abi.qms.platform.service.QrFormatService;
|
|
import com.abi.task.common.api.exception.BusinessException;
|
|
import com.abi.task.common.api.exception.BusinessException;
|
|
import com.abi.task.common.utils.PojoConverterUtils;
|
|
import com.abi.task.common.utils.PojoConverterUtils;
|
|
@@ -40,14 +39,11 @@ public class QrFormatServiceImpl implements QrFormatService {
|
|
@Autowired
|
|
@Autowired
|
|
private ExecutorService executorService;
|
|
private ExecutorService executorService;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private BoxCodeFormatService boxCodeFormatService;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 保存码格式
|
|
* 保存码格式
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- @Transactional
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public void saveQrFormat(SaveQrFormatReq req) {
|
|
public void saveQrFormat(SaveQrFormatReq req) {
|
|
// 修改码格式时的条件限制
|
|
// 修改码格式时的条件限制
|
|
QrFormat qrFormat;
|
|
QrFormat qrFormat;
|
|
@@ -68,21 +64,20 @@ public class QrFormatServiceImpl implements QrFormatService {
|
|
qrFormatQw.ne("id", req.getId());
|
|
qrFormatQw.ne("id", req.getId());
|
|
}
|
|
}
|
|
Integer count = qrFormatMapper.selectCount(qrFormatQw);
|
|
Integer count = qrFormatMapper.selectCount(qrFormatQw);
|
|
- if (count.intValue() != 0) {
|
|
|
|
|
|
+ if (!count.equals(0)) {
|
|
throw new BusinessException("码格式名称已存在");
|
|
throw new BusinessException("码格式名称已存在");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // copy属性值
|
|
qrFormat = PojoConverterUtils.copy(req, QrFormat.class);
|
|
qrFormat = PojoConverterUtils.copy(req, QrFormat.class);
|
|
- PojoConverterUtils.copy(req, qrFormat);
|
|
|
|
- // 重复率状态 未验证
|
|
|
|
- qrFormat.setUniqueStatus(QrFormatUniqueStatusEunm.UN_VERIFY.getCode());
|
|
|
|
- // 使用状态 未使用
|
|
|
|
- qrFormat.setUseStatus(QrFormatUseStatusEnum.UN_USE.getCode());
|
|
|
|
|
|
|
|
- // 新增or修改 TODO 设置createBy和updateBy
|
|
|
|
|
|
+ // 新增or修改
|
|
|
|
+ Long userId = UserUtil.getUser().getId();
|
|
|
|
+ qrFormat.setUpdateBy(userId);
|
|
if (req.getId() != null) {
|
|
if (req.getId() != null) {
|
|
qrFormatMapper.updateById(qrFormat);
|
|
qrFormatMapper.updateById(qrFormat);
|
|
} else {
|
|
} else {
|
|
|
|
+ qrFormat.setCreateBy(userId);
|
|
qrFormatMapper.insert(qrFormat);
|
|
qrFormatMapper.insert(qrFormat);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -121,8 +116,7 @@ public class QrFormatServiceImpl implements QrFormatService {
|
|
QrFormat qrFormat = qrFormatMapper.selectById(req.getId());
|
|
QrFormat qrFormat = qrFormatMapper.selectById(req.getId());
|
|
AssertUtil.isNull(qrFormat, "码格式不存在");
|
|
AssertUtil.isNull(qrFormat, "码格式不存在");
|
|
|
|
|
|
- GetQrFormatDetailRes res = PojoConverterUtils.copy(qrFormat, GetQrFormatDetailRes.class);
|
|
|
|
- return res;
|
|
|
|
|
|
+ return PojoConverterUtils.copy(qrFormat, GetQrFormatDetailRes.class);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|