package com.xzx.gc.system.controller;
|
|
import cn.hutool.core.convert.Convert;
|
import com.xzx.gc.common.Result;
|
import com.xzx.gc.common.annotations.PassToken;
|
import com.xzx.gc.common.constant.Constants;
|
import com.xzx.gc.common.constant.SysConfigConstant;
|
import com.xzx.gc.common.request.BaseController;
|
import com.xzx.gc.entity.VersionInfo;
|
import com.xzx.gc.system.mapper.VersionInfoMapper;
|
import com.xzx.gc.system.service.ConfigService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.validation.annotation.Validated;
|
import org.springframework.web.bind.annotation.*;
|
|
/**
|
* @author :zz
|
*/
|
@RestController
|
@Api(tags = {"版本管理"})
|
@Validated
|
public class VersionController extends BaseController {
|
|
|
@Autowired
|
private VersionInfoMapper versionInfoMapper;
|
|
@Autowired
|
private ConfigService configService;
|
|
|
@PostMapping("/version/list")
|
@ApiOperation(value = "查询更新")
|
@PassToken
|
public Result<VersionInfo> version(){
|
/**
|
* 根据是否有特殊需求可指定某个版本必须强制更新,如currentVersion == XXX,则forceUpdate = true;
|
* 如果currentVersion < newVersion,则isUpdate = true;
|
* 如果currentVersion < minVersion,则forceUpdate = true;
|
* 如果currentVersion >= minVersion,则forceUpdate = false;
|
* 如果currentVersion == newVersion,则isUpdate = false.
|
*/
|
Result result=new Result();
|
// Validator.validateNotEmpty(commonDto.getExtra(),"当前版本号不能为空");
|
// Double currentVersion=Convert.toDouble(commonDto.getExtra());
|
// if(currentVersion==null){
|
// return Result.error(-1,"版本号不正确");
|
// }
|
|
|
VersionInfo versionInfo=new VersionInfo();
|
versionInfo.setDelFlag(Convert.toShort(Constants.DEL_NOT_FLAG));
|
VersionInfo versionInfo1 = versionInfoMapper.selectOne(versionInfo);
|
// Double newVersion = versionInfo1.getNewVersion();
|
// Double minVersion = versionInfo1.getMinVersion();
|
//
|
// if(NumberUtil.compare(currentVersion,newVersion)<0){
|
// versionInfo1.setUpdateFlag(Convert.toShort(Constants.RESULT_SUCCESS));
|
// }
|
// if(NumberUtil.compare(currentVersion,minVersion)<0) {
|
// versionInfo1.setForceUpdateFlag(Convert.toShort(Constants.RESULT_SUCCESS));
|
// }
|
result.setData(versionInfo1);
|
return result;
|
}
|
|
|
@PostMapping("/version/audit")
|
@ApiOperation(value = "版本审核状态查询")
|
@PassToken
|
public Result<String> audit(){
|
return Result.success(configService.findByCode(SysConfigConstant.IOSAPP_AUDIT_STATUS).getConfigValue());
|
}
|
}
|