1.治理App版本信息添加
2.准实时数据接口调整 3.设备登记调整 4.设备接入调整
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
package com.njcn.cssystem.controller.baseinfo;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.cssystem.pojo.param.AppVersionParam;
|
||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||
import com.njcn.cssystem.service.IAppVersionService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-11-21
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/appVersion")
|
||||
@Api(tags = "app版本信息")
|
||||
@AllArgsConstructor
|
||||
public class AppVersionController extends BaseController {
|
||||
|
||||
private final IAppVersionService appVersionService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增app版本信息")
|
||||
@ApiImplicitParam(name = "param", value = "app版本信息", required = true)
|
||||
public HttpResult<String> add(@RequestBody @Validated AppVersionParam param){
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
boolean result = appVersionService.add(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "新增成功", methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "新增失败", methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLastData")
|
||||
@ApiOperation("查询app最新版本信息")
|
||||
public HttpResult<AppVersionVo> getLastData(){
|
||||
String methodDescribe = getMethodDescribe("getLastData");
|
||||
AppVersionVo vo = appVersionService.getLastData();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cssystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-11-21
|
||||
*/
|
||||
public interface AppVersionMapper extends BaseMapper<AppVersion> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.cssystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cssystem.pojo.param.AppVersionParam;
|
||||
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-11-21
|
||||
*/
|
||||
public interface IAppVersionService extends IService<AppVersion> {
|
||||
|
||||
boolean add(AppVersionParam param);
|
||||
|
||||
AppVersionVo getLastData();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.cssystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cssystem.mapper.AppVersionMapper;
|
||||
import com.njcn.cssystem.pojo.param.AppVersionParam;
|
||||
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||
import com.njcn.cssystem.service.IAppVersionService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-11-21
|
||||
*/
|
||||
@Service
|
||||
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements IAppVersionService {
|
||||
|
||||
@Override
|
||||
public boolean add(AppVersionParam param) {
|
||||
AppVersion appVersion = new AppVersion();
|
||||
appVersion.setVersionName(param.getAppVersion());
|
||||
appVersion.setPublishTime(LocalDateTime.now());
|
||||
appVersion.setSev(param.getSev());
|
||||
appVersion.setContent(param.getContent());
|
||||
return this.save(appVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppVersionVo getLastData() {
|
||||
AppVersionVo vo = new AppVersionVo();
|
||||
LambdaQueryWrapper<AppVersion> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.orderByDesc(AppVersion::getPublishTime).last("limit 1");
|
||||
AppVersion appVersion = this.getOne(queryWrapper);
|
||||
if (Objects.nonNull(appVersion)) {
|
||||
BeanUtils.copyProperties(appVersion, vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user