appVersion匿名接口
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package com.newyetai.config.controller;
|
||||
|
||||
import com.newyetai.common.AlitaResult;
|
||||
import com.newyetai.common.constant.CommonConstants;
|
||||
import com.newyetai.common.util.JsonUtils;
|
||||
import com.newyetai.common.util.UserContextHolder;
|
||||
import com.newyetai.config.dao.ConfigMapper;
|
||||
import com.newyetai.config.dto.*;
|
||||
import com.newyetai.config.service.ConfigService;
|
||||
import com.newyetai.tkmybatis.pojo.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 配置操作
|
||||
*
|
||||
* @author on 2019-11-05
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("anon/config")
|
||||
public class AnonConfigController {
|
||||
|
||||
@Autowired
|
||||
private ConfigService configService;
|
||||
|
||||
|
||||
@GetMapping("/appVersion")
|
||||
public AlitaResult<ConfigDTO> getAppVersion() {
|
||||
ConfigDTO configDto = configService.getConfigDto("APP_VERSION_CONFIG", CommonConstants.PLATFORM_ORG_ID, Boolean.TRUE);
|
||||
String configValue = configDto.getConfigValue();
|
||||
|
||||
if (StringUtils.isNotBlank(configValue)) {
|
||||
List<AppVersionConfigInfo> appVersionConfigInfos = JsonUtils.toList(configValue, AppVersionConfigInfo.class);
|
||||
if (CollectionUtils.isNotEmpty(appVersionConfigInfos)) {
|
||||
configDto.setConfigValue(JsonUtils.toJsonString(appVersionConfigInfos.get(0)));
|
||||
}
|
||||
}
|
||||
return AlitaResult.success(configDto);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.newyetai.config.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class AppVersionConfigInfo implements Serializable {
|
||||
|
||||
private String versionName;
|
||||
private String platform;
|
||||
private String autoUpdate;
|
||||
private String updateContent;
|
||||
private String updateTime;
|
||||
private String updateType;
|
||||
private String downloadUrl;
|
||||
}
|
||||
Reference in New Issue
Block a user