fix: 修改license限制
This commit is contained in:
@@ -20,6 +20,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode LICENSE_SN_DUPLICATE = new ErrorCode(1_100_003_002, "License SN`{}`已存在");
|
||||
ErrorCode LICENSE_IMPORT_LIST_IS_EMPTY = new ErrorCode(1_100_003_003, "导入License数据不能为空!");
|
||||
ErrorCode LICENSE_DOWNLOAD_FAILED = new ErrorCode(1_100_003_004, "下载失败!");
|
||||
ErrorCode LICENSE_UPDATE_FAILED = new ErrorCode(1_100_003_004, "License已生成,不允许修改!");
|
||||
|
||||
ErrorCode COMMENT_NOT_EXISTS = new ErrorCode(1_100_004_001, "评论不存在");
|
||||
ErrorCode COMMENT_EXITS_CHILDREN = new ErrorCode(1_100_004_002, "存在子评论,无法删除");
|
||||
|
||||
@@ -70,6 +70,7 @@ import static org.agt.module.license.enums.ErrorCodeConstants.LICENSE_DOWNLOAD_F
|
||||
import static org.agt.module.license.enums.ErrorCodeConstants.LICENSE_IMPORT_LIST_IS_EMPTY;
|
||||
import static org.agt.module.license.enums.ErrorCodeConstants.LICENSE_NOT_EXISTS;
|
||||
import static org.agt.module.license.enums.ErrorCodeConstants.LICENSE_SN_DUPLICATE;
|
||||
import static org.agt.module.license.enums.ErrorCodeConstants.LICENSE_UPDATE_FAILED;
|
||||
|
||||
/**
|
||||
* License Service 实现类
|
||||
@@ -159,6 +160,12 @@ public class LicenseServiceImpl implements LicenseService {
|
||||
if (updateReqVO.getExpiryDate() != null) {
|
||||
updateReqVO.setExpiryDate(LocalDateTime.of(updateReqVO.getExpiryDate().toLocalDate(), LocalTime.of(23, 59, 59)));
|
||||
}
|
||||
LicenseDO licenseDO = licenseMapper.selectById(updateReqVO.getId());
|
||||
if (!(LicenseStatusEnum.IN_APPLICATION.getCode().equals(licenseDO.getStatus())
|
||||
|| LicenseStatusEnum.REAPPLYING.getCode().equals(licenseDO.getStatus()) || licenseDO.getDataType() == 1)) {
|
||||
throw exception(LICENSE_UPDATE_FAILED);
|
||||
}
|
||||
|
||||
// 更新
|
||||
LicenseDO updateObj = BeanUtils.toBean(updateReqVO, LicenseDO.class);
|
||||
licenseMapper.updateById(updateObj);
|
||||
|
||||
Reference in New Issue
Block a user