|
@@ -0,0 +1,51 @@
|
|
|
+package com.fdkankan.openApi.controller.www;
|
|
|
+
|
|
|
+import cn.dev33.satoken.annotation.SaIgnore;
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.fdkankan.common.exception.BusinessException;
|
|
|
+import com.fdkankan.openApi.aop.ValidateApi;
|
|
|
+import com.fdkankan.openApi.entity.www.Trajectory;
|
|
|
+import com.fdkankan.openApi.service.www.ITrajectoryService;
|
|
|
+import com.fdkankan.openApi.vo.www.TrajectoryParamVO;
|
|
|
+import com.fdkankan.web.response.ResultData;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+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;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author Xiewj
|
|
|
+ * @date 2025/7/11
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/trajectory")
|
|
|
+public class TrajectoryController {
|
|
|
+ @Autowired
|
|
|
+ private ITrajectoryService trajectoryService;
|
|
|
+ /**
|
|
|
+ * 设备轨迹数据保存
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @SaIgnore
|
|
|
+ @PostMapping("/save")
|
|
|
+ @ValidateApi(method = "trajectory:save")
|
|
|
+ public ResultData save(@RequestBody @Valid TrajectoryParamVO param) throws IOException {
|
|
|
+ if(StrUtil.isNotEmpty(param.getContent())){
|
|
|
+ String[] split = param.getContent().split(",");
|
|
|
+ if (split.length!=4){
|
|
|
+ throw new BusinessException(-1,"数据长度不为4");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Trajectory trajectory = new Trajectory();
|
|
|
+ BeanUtil.copyProperties(param, trajectory);
|
|
|
+ trajectory.setCreateTime(new Date());
|
|
|
+ return ResultData.ok(trajectoryService.save(trajectory));
|
|
|
+ }
|
|
|
+}
|