|
@@ -9,6 +9,8 @@ import com.yonge.toolset.base.page.PageInfo;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -37,10 +39,22 @@ public class AppVersionInfoController extends BaseController {
|
|
|
@ApiOperation("根据app客户端查询对象")
|
|
|
@ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path")
|
|
|
@GetMapping(value = "/queryByPlatform")
|
|
|
- public HttpResponseResult<AppVersionInfo> queryByPlatform(String platform) {
|
|
|
+ public HttpResponseResult<AppVersionInfo> queryByPlatform(String platform,String localVersion) {
|
|
|
List<AppVersionInfo> list = appVersionInfoService.queryNewestByPlatform(platform);
|
|
|
- if (list.size() > 0) {
|
|
|
- return succeed(list.get(0));
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ AppVersionInfo appVersionInfo = list.get(0);
|
|
|
+ //如果应用版本跨多个版本时若其中任何一个版本有强制更新,返回字段标记为强制更新
|
|
|
+ if(!appVersionInfo.getIsForceUpdate() && StringUtils.isNotEmpty(localVersion)){
|
|
|
+ //是否需要强制更新
|
|
|
+ AppVersionInfo forceUpdate = appVersionInfoService.checkForceUpdate(platform,localVersion);
|
|
|
+ if(forceUpdate != null){
|
|
|
+ appVersionInfo.setIsForceUpdate(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isEmpty(localVersion)) {
|
|
|
+ appVersionInfo.setIsForceUpdate(true);
|
|
|
+ }
|
|
|
+ return succeed(appVersionInfo);
|
|
|
}
|
|
|
return failed();
|
|
|
}
|