|
|
@@ -1,11 +1,15 @@
|
|
|
package org.springblade.manager.controller;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.StringUtil;
|
|
|
+import org.springblade.manager.dto.QProfilerOffsetDTO;
|
|
|
+import org.springblade.manager.dto.QProfilerOffsetResultDTO;
|
|
|
import org.springblade.manager.entity.QProfilerOffset;
|
|
|
import org.springblade.manager.entity.profiler.ProfilerResult;
|
|
|
import org.springblade.manager.entity.profiler.ProfilerSaveDTO;
|
|
|
@@ -26,29 +30,65 @@ public class QProfilerController {
|
|
|
|
|
|
/**
|
|
|
* 新增接口
|
|
|
- * 第三方推送数据过来
|
|
|
+ * 第三方推送数据过来
|
|
|
*/
|
|
|
@PostMapping("/save")
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
@ApiOperation(value = "新增断面仪数据", notes = "")
|
|
|
public ProfilerResult add(ProfilerSaveDTO save,
|
|
|
@RequestParam(value = "file", required = false) MultipartFile file) {
|
|
|
- if(StringUtil.isBlank(save.getAppKey())){
|
|
|
+ if (StringUtil.isBlank(save.getAppKey())) {
|
|
|
return ProfilerResult.error("1001", "appKey不能为空", "");
|
|
|
}
|
|
|
- if(save.getTimestamp() == null){
|
|
|
+ if (save.getTimestamp() == null) {
|
|
|
return ProfilerResult.error("1002", "timestamp不能为空", "");
|
|
|
}
|
|
|
- if(StringUtil.isBlank(save.getSign())){
|
|
|
+ if (StringUtil.isBlank(save.getSign())) {
|
|
|
return ProfilerResult.error("1003", "sign不能为空", "");
|
|
|
}
|
|
|
- if(StringUtil.isBlank(save.getDeviceCode())){
|
|
|
+ if (StringUtil.isBlank(save.getDeviceCode())) {
|
|
|
return ProfilerResult.error("1004", "deviceCode不能为空", "");
|
|
|
}
|
|
|
- if(StringUtil.isBlank(save.getData())){
|
|
|
+ if (StringUtil.isBlank(save.getData())) {
|
|
|
return ProfilerResult.error("1005", "data不能为空", "");
|
|
|
}
|
|
|
return offsetService.save(save, file);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询接口
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "查询接口", notes = "")
|
|
|
+ @PostMapping("/page")
|
|
|
+ public R<Page<QProfilerOffset>> page(QProfilerOffsetDTO offset) {
|
|
|
+ QueryWrapper<QProfilerOffset> qProfilerOffsetQueryWrapper = new QueryWrapper<>();
|
|
|
+ qProfilerOffsetQueryWrapper.lambda()
|
|
|
+ .eq(StringUtil.isNotBlank(offset.getUserName()), QProfilerOffset::getUserName, offset.getUserName())
|
|
|
+ .ge(StringUtil.isNotBlank(offset.getStartTime()), QProfilerOffset::getDate, offset.getStartTime())
|
|
|
+ .le(StringUtil.isNotBlank(offset.getEndTime()), QProfilerOffset::getDate, offset.getEndTime());
|
|
|
+ return R.data(offsetService.page(new Page<>(offset.getCurrent(), offset.getSize())));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询详情接口
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 3)
|
|
|
+ @ApiOperation(value = "查询详情接口", notes = "")
|
|
|
+ @GetMapping("/getOne")
|
|
|
+ public R<QProfilerOffsetResultDTO> getOne(Long id) {
|
|
|
+ return R.data(offsetService.getOne(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑接口
|
|
|
+ */
|
|
|
+ @ApiOperationSupport(order = 4)
|
|
|
+ @ApiOperation(value = "修改接口", notes = "")
|
|
|
+ @PostMapping("/edit")
|
|
|
+ public R<Boolean> edit(@RequestBody QProfilerOffsetResultDTO offset) {
|
|
|
+ return R.status(offsetService.edit(offset));
|
|
|
+ }
|
|
|
+
|
|
|
}
|