feat(REQ-2106): 版本更新记录personId不能为空
This commit is contained in:
parent
e1847e5fe5
commit
d547a76cc3
@ -23,6 +23,8 @@ import java.util.Date;
|
||||
@AllArgsConstructor
|
||||
public class PageApplicationVersionResp {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 版本号
|
||||
*/
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package cn.axzo.nanopart.server.controller;
|
||||
|
||||
import cn.axzo.framework.domain.ServiceException;
|
||||
import cn.axzo.framework.domain.web.result.ApiPageResult;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.nanopart.api.ApplicationVersionApi;
|
||||
@ -15,6 +16,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author chenwenjian
|
||||
* @version 1.0
|
||||
@ -52,6 +55,9 @@ public class ApplicationVersionController implements ApplicationVersionApi {
|
||||
|
||||
@Override
|
||||
public ApiResult<GetVersionUpdateRemindContentResp> getVersionUpdateRemindContent(GetVersionUpdateRemindContentReq req) {
|
||||
if (Objects.isNull(req.getPersonId()) || req.getPersonId() == 0){
|
||||
throw new ServiceException("personId不能为空");
|
||||
}
|
||||
return ApiResult.ok(applicationVersionService.getVersionUpdateRemindContent(req));
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,5 +12,5 @@ public interface ApplicationVersionReadLogService {
|
||||
|
||||
Long create(CreateApplicationVersionReadLogReq req);
|
||||
|
||||
ApplicationVersionReadLog getById(Long id);
|
||||
ApplicationVersionReadLog getByIdWithPersonId(Long personId, Long id);
|
||||
}
|
||||
|
||||
@ -28,10 +28,12 @@ public class ApplicationVersionReadLogServiceImpl extends ServiceImpl<Applicatio
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationVersionReadLog getById(Long id) {
|
||||
public ApplicationVersionReadLog getByIdWithPersonId(Long personId, Long id) {
|
||||
return lambdaQuery()
|
||||
.eq(ApplicationVersionReadLog::getIsDelete, 0)
|
||||
.eq(ApplicationVersionReadLog::getId, id)
|
||||
.eq(ApplicationVersionReadLog::getPersonId, personId)
|
||||
.eq(ApplicationVersionReadLog::getVersionId, id)
|
||||
.last("limit 1")
|
||||
.one();
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@ -107,6 +108,7 @@ public class ApplicationVersionServiceImpl extends ServiceImpl<ApplicationVersio
|
||||
* @param req {@link GetVersionUpdateRemindContentReq}
|
||||
* @return 对应端的版本更新记录信息 {@link GetVersionUpdateRemindContentResp}
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public GetVersionUpdateRemindContentResp getVersionUpdateRemindContent(GetVersionUpdateRemindContentReq req) {
|
||||
// 获取对应平台配置的版本信息
|
||||
@ -117,13 +119,13 @@ public class ApplicationVersionServiceImpl extends ServiceImpl<ApplicationVersio
|
||||
.eq(StringUtils.isNotBlank(req.getVersion()), ApplicationVersion::getVersion, req.getVersion())
|
||||
.orderByDesc(ApplicationVersion::getVersion)
|
||||
.orderByDesc(ApplicationVersion::getReleaseTime)
|
||||
.apply("limit 1")
|
||||
.last("limit 1")
|
||||
.one();
|
||||
if (Objects.isNull(version) || version.getRemind() == 0) {
|
||||
return null;
|
||||
}
|
||||
// 校验该用户是否已经提示
|
||||
ApplicationVersionReadLog versionReadLog = applicationVersionReadLogService.getById(version.getId());
|
||||
ApplicationVersionReadLog versionReadLog = applicationVersionReadLogService.getByIdWithPersonId(req.getPersonId(),version.getId());
|
||||
if (Objects.isNull(versionReadLog)) {
|
||||
// 该用户未提示
|
||||
applicationVersionReadLogService.create(CreateApplicationVersionReadLogReq.builder()
|
||||
@ -190,7 +192,8 @@ public class ApplicationVersionServiceImpl extends ServiceImpl<ApplicationVersio
|
||||
.eq(Objects.nonNull(req.getPlatform()), ApplicationVersion::getPlatform, req.getPlatform())
|
||||
.eq(Objects.nonNull(req.getOpSystem()), ApplicationVersion::getOpSystem, req.getOpSystem())
|
||||
.eq(StringUtils.isNotBlank(req.getVersion()), ApplicationVersion::getVersion, req.getVersion())
|
||||
.orderByDesc(ApplicationVersion::getVersion);
|
||||
.orderByDesc(ApplicationVersion::getVersion)
|
||||
.orderByDesc(ApplicationVersion::getReleaseTime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user