fix: 修改license限制

This commit is contained in:
caiyuchao
2025-09-20 18:14:44 +08:00
parent 6d3cf58e33
commit 4d58bfd601
2 changed files with 8 additions and 0 deletions

View File

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