From 92b183ff39e44878d9a8508ee9561696339b1547 Mon Sep 17 00:00:00 2001
From: 张磊磊 <201175954@qq.com>
Date: 星期一, 16 十月 2023 16:57:11 +0800
Subject: [PATCH] 安全帽对接/接受PM2.5数据

---
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetMotion.java           |   63 ++
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/dto/ReportNumDto.java        |   13 
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java |  135 +++++
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java          |   43 +
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java    |   75 +++
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/scheduled/PictureScheduled.java     |  241 ++++++++++
 hd/pipe/materialsManage/src/main/resources/mapping/THelmetDeviceMapper.xml                                      |  552 +++++++++++++++++++++++
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetDevice.java           |   42 +
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetPicture.java          |   58 ++
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetTrajectory.java       |   47 +
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/mapper/HelmetMapper.java            |   49 ++
 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetReport.java           |   89 +++
 12 files changed, 1,407 insertions(+), 0 deletions(-)

diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java
new file mode 100644
index 0000000..28a3317
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/controller/HelmetController.java
@@ -0,0 +1,75 @@
+package com.thhy.materials.modules.biz.helmet.controller;
+
+import com.thhy.general.common.BasicResult;
+import com.thhy.materials.modules.biz.helmet.service.HelmetService;
+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.annotation.Resource;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/helmet")
+public class HelmetController {
+
+
+    @Resource
+    private HelmetService helmetService;
+
+    //安全帽设备 列表
+    @PostMapping("/helmetList")
+    public BasicResult helmetList(@RequestBody Map<String,Object> values){
+        return helmetService.helmetList(values);
+    }
+    //照片 列表
+    @PostMapping("/helmetPictureList")
+    public BasicResult helmetPictureList(@RequestBody Map<String,Object> values){
+        return helmetService.helmetPictureList(values);
+    }
+
+    //轨迹统计
+    @PostMapping("/helmetTrajectoryList")
+    public BasicResult helmetTrajectoryList(@RequestBody Map<String,Object> values){
+        return helmetService.helmetTrajectoryList(values);
+    }
+
+    //轨迹坐标
+    @PostMapping("/helmetMotionList")
+    public BasicResult helmetMotionList(@RequestBody Map<String,Object> values){
+        return helmetService.helmetMotionList(values);
+    }
+
+
+
+    //接数据
+    @PostMapping("/dataValueInsert")
+    public BasicResult dataValueInsert(@RequestBody Map<String,Object> values){
+        return helmetService.dataValueInsert(values);
+    }
+
+    /**
+     * 报警次数
+     * @param values
+     * @return
+     */
+    @PostMapping("/helmetReportTotal")
+    public BasicResult helmetReportTotal(@RequestBody Map<String,Object> values){
+        return helmetService.helmetReportTotal(values);
+
+
+
+    }
+    /**
+     * 报警用户详情
+     * @param values
+     * @returna
+     */
+    @PostMapping("/helmetReportUser")
+    public BasicResult helmetReportUser(@RequestBody Map<String,Object> values){
+        return helmetService.helmetReportUser(values);
+    }
+
+
+}
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetDevice.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetDevice.java
new file mode 100644
index 0000000..30f9704
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetDevice.java
@@ -0,0 +1,42 @@
+package com.thhy.materials.modules.biz.helmet.entity;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+@Data
+@Getter
+@Setter
+@ToString
+public class THelmetDevice implements Serializable {
+    /**
+     * 安全帽设备id
+     */
+    private String helmetDeviceId;
+
+    /**
+     * 设备编号
+     */
+    private String deviceNum;
+
+    /**
+     * 
+     */
+    private Integer userId;
+
+    /**
+     * 
+     */
+    private String userName;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table t_helmet_device
+     *
+     * @mbg.generated Tue Oct 10 10:55:08 CST 2023
+     */
+    private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetMotion.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetMotion.java
new file mode 100644
index 0000000..0ddea59
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetMotion.java
@@ -0,0 +1,63 @@
+package com.thhy.materials.modules.biz.helmet.entity;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+@Data
+@Getter
+@Setter
+@ToString
+public class THelmetMotion implements Serializable {
+    /**
+     * 
+     */
+    private Integer motionId;
+
+    /**
+     * 用户id
+     */
+    private Integer userId;
+
+    /**
+     * 纬度
+     */
+    private String xPoint;
+
+    /**
+     * 经度
+     */
+    private String yPoint;
+
+    /**
+     * 创建时间
+     */
+    private String times;
+
+    /**
+     * 角度
+     */
+    private String cAngle;
+
+    /**
+     * 速度
+     */
+    private String cSpeed;
+
+    /**
+     * 纠偏
+     */
+    private String cTrust;
+    private String smTime;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table t_helmet_motion
+     *
+     * @mbg.generated Wed Oct 11 14:49:58 CST 2023
+     */
+    private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetPicture.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetPicture.java
new file mode 100644
index 0000000..173304b
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetPicture.java
@@ -0,0 +1,58 @@
+package com.thhy.materials.modules.biz.helmet.entity;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+@Data
+@Getter
+@Setter
+@ToString
+public class THelmetPicture implements Serializable {
+    /**
+     * 
+     */
+    private Integer helmetPictureId;
+
+    /**
+     * 图片地址
+     */
+    private String imageUrl;
+
+    /**
+     * 用户人
+     */
+    private Integer userId;
+
+    /**
+     * 纬度
+     */
+    private String xPoint;
+
+    /**
+     * 经度
+     */
+    private String yPoint;
+
+    /**
+     * 创建时间
+     */
+    private String creTime;
+    private String smTime;
+
+    /**
+     * 外部平台id
+     */
+    private Integer iId;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table t_helmet_picture
+     *
+     * @mbg.generated Tue Oct 10 11:20:40 CST 2023
+     */
+    private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetReport.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetReport.java
new file mode 100644
index 0000000..5082b10
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetReport.java
@@ -0,0 +1,89 @@
+package com.thhy.materials.modules.biz.helmet.entity;
+
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+@Data
+@Getter
+@Setter
+@ToString
+public class THelmetReport implements Serializable {
+    /**
+     * id
+     */
+    private Integer reportId;
+
+    /**
+     * 外部平台id
+     */
+    private Integer sId;
+
+    /**
+     * 用户id
+     */
+    private Integer userId;
+
+    /**
+     * 用户名
+     */
+    private String userName;
+
+    /**
+     * 设备num
+     */
+    private String deviceId;
+
+    /**
+     * 纬度
+     */
+    private String xPoint;
+
+    /**
+     * 经度
+     */
+    private String yPoint;
+
+    /**
+     * 报警时间
+     */
+    private String cTime;
+
+    /**
+     * 报警类型
+     */
+    private String sosType;
+
+    /**
+     * 报警消息
+     */
+    private String msg;
+
+    /**
+     * 图片路径
+     */
+    private String imgurl;
+
+    /**
+     * 手机号码
+     */
+    private String mobile;
+
+
+    /**
+     * 报警时间
+     */
+    private String smTime;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table t_helmet_report
+     *
+     * @mbg.generated Tue Oct 10 15:27:36 CST 2023
+     */
+    private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetTrajectory.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetTrajectory.java
new file mode 100644
index 0000000..d665d2c
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/THelmetTrajectory.java
@@ -0,0 +1,47 @@
+package com.thhy.materials.modules.biz.helmet.entity;
+
+import lombok.Data;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+import java.io.Serializable;
+
+@Data
+@Getter
+@Setter
+@ToString
+public class THelmetTrajectory implements Serializable {
+    /**
+     * 
+     */
+    private Integer trajectoryId;
+
+    /**
+     * 生成时间
+     */
+    private String ctime;
+
+    /**
+     * 当天在线时间
+     */
+    private String ltime;
+
+    /**
+     * 当天在线时长(秒)
+     */
+    private String sec;
+
+    /**
+     * 用户
+     */
+    private Integer userId;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database table t_helmet_trajectory
+     *
+     * @mbg.generated Wed Oct 11 13:31:58 CST 2023
+     */
+    private static final long serialVersionUID = 1L;
+}
\ No newline at end of file
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/dto/ReportNumDto.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/dto/ReportNumDto.java
new file mode 100644
index 0000000..ec414be
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/entity/dto/ReportNumDto.java
@@ -0,0 +1,13 @@
+package com.thhy.materials.modules.biz.helmet.entity.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+@Data
+public class ReportNumDto implements Serializable {
+    //时间
+    private String smTime;
+    //报警数量
+    private Integer num;
+
+}
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/mapper/HelmetMapper.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/mapper/HelmetMapper.java
new file mode 100644
index 0000000..0fcdf46
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/mapper/HelmetMapper.java
@@ -0,0 +1,49 @@
+package com.thhy.materials.modules.biz.helmet.mapper;
+
+import com.thhy.materials.modules.biz.helmet.entity.*;
+import com.thhy.materials.modules.biz.helmet.entity.dto.ReportNumDto;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface HelmetMapper {
+
+    List<THelmetDevice> helmetServiceList();
+
+    Integer userIdIid(@Param("userId") Integer user_id);
+
+    void helmetPictureInsert(THelmetPicture tHelmetPicture);
+
+    Integer userIdReport(@Param("userId")Integer user_id);
+
+    void helmetReportInsert(THelmetReport tHelmetReport);
+
+    THelmetTrajectory trajectory(@Param("userId") Integer userId,@Param("ctime") String ctime);
+
+    void helmetTrajectoryInsert(THelmetTrajectory helmetTrajectory);
+
+    void helmetTrajectoryUpdate(THelmetTrajectory helmetTrajectory);
+
+    String helmetMotion(Integer userId);
+
+    void helmetMotionInsert(THelmetMotion tHelmetMotion);
+
+    List<THelmetDevice> helmetList(Map<String, Object> values);
+
+    List<THelmetPicture> helmetPictureList(Map<String, Object> values);
+
+    List<THelmetTrajectory> helmetTrajectoryList(Map<String, Object> values);
+
+    String helmetTrajectoryTime(Map<String, Object> values);
+
+    List<THelmetMotion> helmetMotionList(Map<String, Object> values);
+
+    void dataValueInsert(Map<String, Object> values);
+
+    List<ReportNumDto> helmetReportTotal(Map<String, Object> values);
+
+    List<THelmetReport> helmetReportUser(Map<String, Object> values);
+}
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/scheduled/PictureScheduled.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/scheduled/PictureScheduled.java
new file mode 100644
index 0000000..8b8a438
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/scheduled/PictureScheduled.java
@@ -0,0 +1,241 @@
+package com.thhy.materials.modules.biz.helmet.scheduled;
+
+import com.alibaba.fastjson.JSONObject;
+import com.github.pagehelper.util.StringUtil;
+import com.thhy.materials.modules.biz.helmet.entity.*;
+import com.thhy.materials.modules.biz.helmet.service.HelmetService;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.client.RestTemplate;
+
+import javax.annotation.Resource;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.logging.SimpleFormatter;
+import java.util.stream.Collectors;
+
+@Component
+public class PictureScheduled {
+
+
+    @Resource
+    private HelmetService helmetService;
+    //图片记录
+    @Scheduled(fixedRate = 2000000) // 每隔3秒执行一次任务
+    public void task() {
+        String token = token();
+        List<THelmetDevice> helmetDevices = helmetService.helmetServiceList();
+        System.out.println(helmetDevices);
+
+        for (THelmetDevice device : helmetDevices){
+            RestTemplate restTemplate = new RestTemplate();
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE));
+            HttpEntity<Map<String, Object>> mapHttpEntity = new HttpEntity<>(null, headers);
+            String s = restTemplate.postForObject("https://caps.runde.pro/api/index.php?ctl=report&act=get_user_image&user_id="+device.getUserId()+"&p=1"+"&token="+token, mapHttpEntity, String.class);
+            JSONObject jsonObject = JSONObject.parseObject(s);
+//            System.out.println("----------------------------------------------");
+//            System.out.println("----------------------------------------------");
+//            System.out.println("----------------------------------------------");
+//            System.out.println("----------------------------------------------");
+//            System.out.println("----------------------------------------------");
+//            System.out.println(jsonObject);
+            if(jsonObject.get("status").toString().equals("true")){
+                //图片值
+                List<Map<String,Object>> data = (List<Map<String, Object>>) jsonObject.get("data");
+//                System.out.println("----------map------------");
+//                System.out.println(data);
+
+                for (Integer i =data.size()-1;i!=0;i--){
+                    Integer iId = helmetService.userIdIid(Integer.valueOf(data.get(i).get("user_id").toString()));
+                    if((iId!=null && Integer.valueOf(data.get(i).get("i_id").toString())>iId)||iId==null){
+                        THelmetPicture tHelmetPicture = new THelmetPicture();
+                        tHelmetPicture.setUserId(Integer.valueOf(data.get(i).get("user_id").toString()));
+                        tHelmetPicture.setIId(Integer.valueOf(data.get(i).get("i_id").toString()));
+                        tHelmetPicture.setCreTime(data.get(i).get("time").toString());
+                        tHelmetPicture.setXPoint(data.get(i).get("x_point").toString());
+                        tHelmetPicture.setYPoint(data.get(i).get("y_point").toString());
+                        tHelmetPicture.setImageUrl(data.get(i).get("image_url").toString());
+                        Date date = new Date(Long.valueOf(data.get(i).get("time").toString()+"000"));
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                        tHelmetPicture.setSmTime(sdf.format(date));
+                        helmetService.helmetPictureInsert(tHelmetPicture);
+                    }
+                }
+            }
+        }
+    }
+
+
+    //报警记录
+    @Scheduled(fixedRate = 3000000) // 每隔3秒执行一次任务
+    public void taskReport() {
+        String token = token();
+       // System.out.println(token);
+        List<THelmetDevice> helmetDevices = helmetService.helmetServiceList();
+        for (THelmetDevice device : helmetDevices){
+            RestTemplate restTemplate = new RestTemplate();
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE));
+            HttpEntity<Map<String, Object>> mapHttpEntity = new HttpEntity<>(null, headers);
+            String s = restTemplate.postForObject("https://caps.runde.pro/api/index.php?ctl=task&act=get_sos_list&admin_id=8630&user_id="+device.getUserId()+"&p=1"+"&token="+token, mapHttpEntity, String.class);
+            JSONObject jsonObject = JSONObject.parseObject(s);
+//            System.out.println("-----------------------------------报警--------------------------");
+//            System.out.println(jsonObject);
+
+            List<Map<String,Object>> data = (List<Map<String, Object>>) jsonObject.get("data");
+            if(data.size()>0){
+                for(int i=data.size()-1;i>0;i--){
+                    Integer sId = helmetService.userIdReport(Integer.valueOf(data.get(i).get("user_id").toString()));
+                    if((sId!=null && Integer.valueOf(data.get(i).get("s_id").toString())>sId)||sId==null){
+                        THelmetReport tHelmetReport = new THelmetReport();
+                        tHelmetReport.setSId(Integer.valueOf(data.get(i).get("s_id").toString()));
+                        tHelmetReport.setUserId(Integer.valueOf(data.get(i).get("user_id").toString()));
+                        tHelmetReport.setUserName(data.get(i).get("user_name").toString());
+                        tHelmetReport.setDeviceId(data.get(i).get("device_id").toString());
+                        tHelmetReport.setXPoint(data.get(i).get("x_point").toString());
+                        tHelmetReport.setYPoint(data.get(i).get("y_point").toString());
+                        tHelmetReport.setCTime(data.get(i).get("c_time").toString());
+                        tHelmetReport.setSosType(data.get(i).get("sos_type").toString());
+                        tHelmetReport.setMsg(data.get(i).get("msg").toString());
+                        //tHelmetReport.setImgurl(data.get(i).get("msg").toString());
+                        tHelmetReport.setMobile(data.get(i).get("mobile").toString());
+                        Date date = new Date(Long.valueOf(data.get(i).get("c_time").toString()+"000"));
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                        tHelmetReport.setSmTime(sdf.format(date));
+                        helmetService.helmetReportInsert(tHelmetReport);
+                    }
+                }
+            }
+        }
+    }
+
+    //轨迹记录
+    @Scheduled(fixedRate = 3000000) // 每隔3秒执行一次任务
+    public void taskTrajectory() throws ParseException {
+        String token = token();
+        //System.out.println(token);
+        List<THelmetDevice> helmetDevices = helmetService.helmetServiceList();
+
+        Date date = new Date();
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
+        SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
+        String format = simpleDateFormat.format(date);
+        String format1 = simpleDateFormat1.format(date);
+        Date str = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(format);
+        Date end = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(format1);
+        long time = str.getTime();
+        long time1 = end.getTime();
+        System.out.println();
+        String strTime = String.valueOf(time).substring(0, 10);
+        String endTime = String.valueOf(time1).substring(0, 10);
+
+        for(THelmetDevice helmetDevice : helmetDevices){
+            RestTemplate restTemplate = new RestTemplate();
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE));
+            HttpEntity<Map<String, Object>> mapHttpEntity = new HttpEntity<>(null, headers);
+            String s = restTemplate.postForObject("https://caps.runde.pro/api/index.php?ctl=device&act=get_devices_online_time_days&admin_id=8630&user_id="+helmetDevice.getUserId()+"&stime="+strTime+"&etime="+endTime+"&token="+token, mapHttpEntity, String.class);
+            JSONObject jsonObject = JSONObject.parseObject(s);
+            //Object data = jsonObject.get("data");
+//            System.out.println("-----------轨迹回放--------------");
+//            System.out.println("-----------轨迹回放--------------");
+//            System.out.println("-----------轨迹回放--------------");
+//            System.out.println("-----------轨迹回放--------------");
+//            System.out.println("-----------轨迹回放--------------");
+//            System.out.println(jsonObject);
+            Object date1 = jsonObject.get("data");
+            JSONObject jsonObject1 = JSONObject.parseObject(date1.toString());
+            List<Map<String,Object>> list = (List<Map<String, Object>>) jsonObject1.get("list");
+            for (Map<String,Object> map : list){
+                THelmetTrajectory helmetTrajectory = helmetService.trajectory(helmetDevice.getUserId(),map.get("ctime").toString());
+                if(helmetTrajectory==null){
+                    THelmetTrajectory helmetTrajectory1 = new THelmetTrajectory();
+                    helmetTrajectory1.setCtime(map.get("ctime").toString());
+                    helmetTrajectory1.setUserId(helmetDevice.getUserId());
+                    helmetTrajectory1.setLtime(map.get("ltime").toString());
+                    helmetTrajectory1.setSec(map.get("sec").toString());
+                    helmetService.helmetTrajectoryInsert(helmetTrajectory1);
+                }else {
+                    helmetTrajectory.setLtime(map.get("ltime").toString());
+                    helmetTrajectory.setSec(map.get("sec").toString());
+                    helmetService.helmetTrajectoryUpdate(helmetTrajectory);
+                }
+            }
+
+
+            RestTemplate restTemplate1 = new RestTemplate();
+            HttpHeaders headers1 = new HttpHeaders();
+            headers1.setContentType(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE));
+            HttpEntity<Map<String, Object>> mapHttpEntity1 = new HttpEntity<>(null, headers1);
+            String s1 = restTemplate1.postForObject("https://caps.runde.pro/api/index.php?ctl=location&act=get_user_path_web&admin_id=8630&user_id="+helmetDevice.getUserId()+"&stime="+strTime+"&etime="+endTime+"&token="+token, mapHttpEntity1, String.class);
+            JSONObject jsonObject11 = JSONObject.parseObject(s1);
+            System.out.println("--------------------------轨迹 坐标点----------------------");
+            System.out.println("--------------------------轨迹 坐标点----------------------");
+            System.out.println("--------------------------轨迹 坐标点----------------------");
+            System.out.println("--------------------------轨迹 坐标点----------------------");
+            System.out.println("--------------------------轨迹 坐标点----------------------");
+            System.out.println("--------------------------轨迹 坐标点----------------------");
+            System.out.println(jsonObject11);
+            if(jsonObject11.get("status").toString().equals("true")){
+                List<Map<String,Object>> data = (List<Map<String, Object>>) jsonObject11.get("data");
+                if(data.size()>0){
+                    for (Map<String,Object> map :data){
+                        String times = helmetService.helmetMotion(helmetDevice.getUserId());
+                        if(StringUtil.isEmpty(times) || (!StringUtil.isEmpty(times)&& Integer.valueOf(map.get(time).toString())>Integer.valueOf(times))){
+                            THelmetMotion tHelmetMotion = new THelmetMotion();
+                            tHelmetMotion.setUserId(helmetDevice.getUserId());
+                            tHelmetMotion.setXPoint(map.get("x_point").toString());
+                            tHelmetMotion.setYPoint(map.get("y_point").toString());
+                            tHelmetMotion.setTimes(map.get("time").toString());
+                            tHelmetMotion.setCAngle(map.get("c_angle").toString());
+                            tHelmetMotion.setCSpeed(map.get("c_speed").toString());
+                            tHelmetMotion.setCTrust(map.get("c_trust").toString());
+                            Date date2 = new Date(Long.valueOf(map.get("time").toString()+"000"));
+                            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                            tHelmetMotion.setSmTime(sdf.format(date2));
+                            helmetService.helmetMotionInsert(tHelmetMotion);
+                        }
+                    }
+                }
+            }
+        }
+
+    }
+
+
+
+
+
+
+
+    public String token(){
+            //用户token
+            RestTemplate restTemplate = new RestTemplate();
+            HttpHeaders headers = new HttpHeaders();
+            headers.setContentType(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE));
+            HttpEntity<Map<String, Object>> mapHttpEntity = new HttpEntity<>(null, headers);
+            String s = restTemplate.postForObject("https://caps.runde.pro/api/index.php?ctl=tool&act=get_pkey&user_name=NJBBT8204&pwd=Bbt162534@", mapHttpEntity, String.class);
+            JSONObject jsonObject = JSONObject.parseObject(s);
+            Object data = jsonObject.get("data");
+
+            RestTemplate restTemplate1 = new RestTemplate();
+            HttpHeaders headers1 = new HttpHeaders();
+            headers1.setContentType(MediaType.valueOf(MediaType.APPLICATION_FORM_URLENCODED_VALUE));
+            HttpEntity<Map<String, Object>> mapHttpEntity1 = new HttpEntity<>(null, headers1);
+            String s1 = restTemplate1.postForObject("https://caps.runde.pro/api/index.php?ctl=tool&act=get_token&user_name=NJBBT8204&pkey="+data.toString(), mapHttpEntity1, String.class);
+            JSONObject jsonObject1 = JSONObject.parseObject(s1);
+            Object data1 = jsonObject1.get("token");
+            return  data1.toString();
+        }
+
+
+
+
+
+}
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java
new file mode 100644
index 0000000..30a5717
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/HelmetService.java
@@ -0,0 +1,43 @@
+package com.thhy.materials.modules.biz.helmet.service;
+
+import com.thhy.general.common.BasicResult;
+import com.thhy.materials.modules.biz.helmet.entity.*;
+
+import java.util.List;
+import java.util.Map;
+
+public interface HelmetService {
+    List<THelmetDevice> helmetServiceList();
+
+    Integer userIdIid(Integer user_id);
+
+    void helmetPictureInsert(THelmetPicture tHelmetPicture);
+
+    Integer userIdReport(Integer user_id);
+
+    void helmetReportInsert(THelmetReport tHelmetReport);
+
+    THelmetTrajectory trajectory(Integer userId, String ctime);
+
+    void helmetTrajectoryInsert(THelmetTrajectory helmetTrajectory);
+
+    void helmetTrajectoryUpdate(THelmetTrajectory helmetTrajectory);
+
+    String helmetMotion(Integer userId);
+
+    void helmetMotionInsert(THelmetMotion tHelmetMotion);
+
+    BasicResult helmetList(Map<String, Object> values);
+
+    BasicResult helmetPictureList(Map<String, Object> values);
+
+    BasicResult helmetTrajectoryList(Map<String, Object> values);
+
+    BasicResult helmetMotionList(Map<String, Object> values);
+
+    BasicResult dataValueInsert(Map<String, Object> values);
+
+    BasicResult helmetReportTotal(Map<String, Object> values);
+
+    BasicResult helmetReportUser(Map<String, Object> values);
+}
diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java
new file mode 100644
index 0000000..4309279
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/helmet/service/impl/HelmetServiceImpl.java
@@ -0,0 +1,135 @@
+package com.thhy.materials.modules.biz.helmet.service.impl;
+
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.thhy.general.common.BasicResult;
+import com.thhy.materials.modules.biz.helmet.entity.*;
+import com.thhy.materials.modules.biz.helmet.entity.dto.ReportNumDto;
+import com.thhy.materials.modules.biz.helmet.mapper.HelmetMapper;
+import com.thhy.materials.modules.biz.helmet.service.HelmetService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class HelmetServiceImpl implements HelmetService {
+
+    @Resource
+    private HelmetMapper helmetMapper;
+
+
+    @Override
+    public List<THelmetDevice> helmetServiceList() {
+        List<THelmetDevice> helmetDevices = helmetMapper.helmetServiceList();
+        return helmetDevices;
+    }
+
+    @Override
+    public Integer userIdIid(Integer user_id) {
+        Integer helmetDevices = helmetMapper.userIdIid(user_id);
+        return helmetDevices;
+    }
+
+    @Override
+    public void helmetPictureInsert(THelmetPicture tHelmetPicture) {
+        helmetMapper.helmetPictureInsert(tHelmetPicture);
+    }
+
+    @Override
+    public Integer userIdReport(Integer user_id) {
+        Integer helmetDevices = helmetMapper.userIdReport(user_id);
+        return helmetDevices;
+    }
+
+    @Override
+    public void helmetReportInsert(THelmetReport tHelmetReport) {
+        helmetMapper.helmetReportInsert(tHelmetReport);
+    }
+
+    @Override
+    public THelmetTrajectory trajectory(Integer userId, String ctime) {
+        return helmetMapper.trajectory(userId,ctime);
+    }
+
+    @Override
+    public void helmetTrajectoryInsert(THelmetTrajectory helmetTrajectory) {
+        helmetMapper.helmetTrajectoryInsert(helmetTrajectory);
+    }
+
+    @Override
+    public void helmetTrajectoryUpdate(THelmetTrajectory helmetTrajectory) {
+        helmetMapper.helmetTrajectoryUpdate(helmetTrajectory);
+    }
+
+    @Override
+    public String helmetMotion(Integer userId) {
+        return helmetMapper.helmetMotion(userId);
+    }
+
+    @Override
+    public void helmetMotionInsert(THelmetMotion tHelmetMotion) {
+        helmetMapper.helmetMotionInsert(tHelmetMotion);
+    }
+
+    @Override
+    public BasicResult helmetList(Map<String, Object> values) {
+        Integer pageNum = Integer.valueOf(values.get("pageNum").toString());
+        Integer pageSize = Integer.valueOf(values.get("pageSize").toString());
+        PageHelper.startPage(pageNum,pageSize);
+        List<THelmetDevice> helmetDevices = helmetMapper.helmetList(values);
+        PageInfo<THelmetDevice> tHelmetDevicePageInfo = new PageInfo<>(helmetDevices);
+        return BasicResult.success(tHelmetDevicePageInfo);
+    }
+
+    @Override
+    public BasicResult helmetPictureList(Map<String, Object> values) {
+        Integer pageNum = Integer.valueOf(values.get("pageNum").toString());
+        Integer pageSize = Integer.valueOf(values.get("pageSize").toString());
+        PageHelper.startPage(pageNum,pageSize);
+        List<THelmetPicture> helmetPictures = helmetMapper.helmetPictureList(values);
+        PageInfo<THelmetPicture> helmetPicturePageInfo = new PageInfo<>(helmetPictures);
+        return  BasicResult.success(helmetPicturePageInfo);
+    }
+
+    @Override
+    public BasicResult helmetTrajectoryList(Map<String, Object> values) {
+        List<THelmetTrajectory> tHelmetTrajectory = helmetMapper.helmetTrajectoryList(values);
+        String total = helmetMapper.helmetTrajectoryTime(values);
+        HashMap<String, Object> hashMap = new HashMap<>();
+        hashMap.put("tHelmetTrajectory",tHelmetTrajectory);
+        hashMap.put("total",total);
+        return BasicResult.success(hashMap);
+    }
+
+    @Override
+    public BasicResult helmetMotionList(Map<String, Object> values) {
+        List<THelmetMotion> helmetMotions = helmetMapper.helmetMotionList(values);
+        return BasicResult.success(helmetMotions);
+    }
+
+    @Override
+    public BasicResult dataValueInsert(Map<String, Object> values) {
+
+
+        helmetMapper.dataValueInsert(values);
+        return BasicResult.success();
+    }
+
+    @Override
+    public BasicResult helmetReportTotal(Map<String, Object> values) {
+        HashMap<String, Object> reportNum = new HashMap<>();
+        List<ReportNumDto> reportNumDtos = helmetMapper.helmetReportTotal(values);
+        reportNum.put("reportNumDtos",reportNumDtos);
+        reportNum.put("day",reportNumDtos.size());
+        return BasicResult.success(reportNum);
+    }
+
+    @Override
+    public BasicResult helmetReportUser(Map<String, Object> values) {
+        List<THelmetReport> helmetReports =  helmetMapper.helmetReportUser(values);
+        return BasicResult.success(helmetReports);
+    }
+}
diff --git a/hd/pipe/materialsManage/src/main/resources/mapping/THelmetDeviceMapper.xml b/hd/pipe/materialsManage/src/main/resources/mapping/THelmetDeviceMapper.xml
new file mode 100644
index 0000000..c8897d0
--- /dev/null
+++ b/hd/pipe/materialsManage/src/main/resources/mapping/THelmetDeviceMapper.xml
@@ -0,0 +1,552 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.thhy.materials.modules.biz.helmet.mapper.HelmetMapper">
+  <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.helmet.entity.THelmetDevice">
+    <!--
+      WARNING - @mbg.generated
+      This element is automatically generated by MyBatis Generator, do not modify.
+      This element was generated on Tue Oct 10 10:55:08 CST 2023.
+    -->
+    <id column="helmet_device_id" jdbcType="VARCHAR" property="helmetDeviceId" />
+    <result column="device_num" jdbcType="VARCHAR" property="deviceNum" />
+    <result column="user_id" jdbcType="INTEGER" property="userId" />
+    <result column="user_name" jdbcType="VARCHAR" property="userName" />
+  </resultMap>
+
+
+  <select id="helmetServiceList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetDevice">
+    select helmet_device_id as helmetDeviceId,
+    device_num as deviceNum,
+    user_id as userId,
+    user_name as userName
+     from  t_helmet_device
+  </select>
+  <select id="userIdIid" parameterType="java.lang.Integer" resultType="java.lang.Integer">
+    SELECT
+	i_id
+FROM
+	t_helmet_picture
+where user_id=#{userId}
+ORDER BY
+	i_id DESC
+	LIMIT 0,1
+  </select>
+  <select id="userIdReport" parameterType="java.lang.Integer" resultType="java.lang.Integer">
+    SELECT
+	s_id
+FROM
+	t_helmet_report
+where user_id=#{userId}
+ORDER BY
+	s_id DESC
+	LIMIT 0,1
+  </select>
+  <insert id="helmetPictureInsert" parameterType="com.thhy.materials.modules.biz.helmet.entity.THelmetPicture">
+    insert into t_helmet_picture
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="helmetPictureId != null">
+        helmet_picture_id,
+      </if>
+      <if test="imageUrl != null">
+        image_url,
+      </if>
+      <if test="userId != null">
+        user_id,
+      </if>
+      <if test="xPoint != null">
+        x_point,
+      </if>
+      <if test="yPoint != null">
+        y_point,
+      </if>
+      <if test="creTime != null">
+        cre_time,
+      </if>
+      <if test="iId != null">
+        i_id,
+      </if>
+      <if test="smTime != null">
+        sm_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="helmetPictureId != null">
+        #{helmetPictureId,jdbcType=INTEGER},
+      </if>
+      <if test="imageUrl != null">
+        #{imageUrl,jdbcType=VARCHAR},
+      </if>
+      <if test="userId != null">
+        #{userId,jdbcType=INTEGER},
+      </if>
+      <if test="xPoint != null">
+        #{xPoint,jdbcType=VARCHAR},
+      </if>
+      <if test="yPoint != null">
+        #{yPoint,jdbcType=VARCHAR},
+      </if>
+      <if test="creTime != null">
+        #{creTime,jdbcType=VARCHAR},
+      </if>
+      <if test="iId != null">
+        #{iId,jdbcType=INTEGER},
+      </if>
+      <if test="smTime != null">
+        #{smTime},
+      </if>
+    </trim>
+  </insert>
+  <insert id="helmetReportInsert" >
+    insert into t_helmet_report
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="reportId != null">
+        report_id,
+      </if>
+      <if test="sId != null">
+        s_id,
+      </if>
+      <if test="userId != null">
+        user_id,
+      </if>
+      <if test="userName != null">
+        user_name,
+      </if>
+      <if test="deviceId != null">
+        device_id,
+      </if>
+      <if test="xPoint != null">
+        x_point,
+      </if>
+      <if test="yPoint != null">
+        y_point,
+      </if>
+      <if test="cTime != null">
+        c_time,
+      </if>
+      <if test="sosType != null">
+        sos_type,
+      </if>
+      <if test="msg != null">
+        msg,
+      </if>
+      <if test="imgurl != null">
+        imgurl,
+      </if>
+      <if test="mobile != null">
+        mobile,
+      </if>
+      <if test="smTime != null">
+        sm_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="reportId != null">
+        #{reportId,jdbcType=INTEGER},
+      </if>
+      <if test="sId != null">
+        #{sId,jdbcType=INTEGER},
+      </if>
+      <if test="userId != null">
+        #{userId,jdbcType=INTEGER},
+      </if>
+      <if test="userName != null">
+        #{userName,jdbcType=VARCHAR},
+      </if>
+      <if test="deviceId != null">
+        #{deviceId,jdbcType=VARCHAR},
+      </if>
+      <if test="xPoint != null">
+        #{xPoint,jdbcType=VARCHAR},
+      </if>
+      <if test="yPoint != null">
+        #{yPoint,jdbcType=VARCHAR},
+      </if>
+      <if test="cTime != null">
+        #{cTime,jdbcType=VARCHAR},
+      </if>
+      <if test="sosType != null">
+        #{sosType,jdbcType=VARCHAR},
+      </if>
+      <if test="msg != null">
+        #{msg,jdbcType=VARCHAR},
+      </if>
+      <if test="imgurl != null">
+        #{imgurl,jdbcType=VARCHAR},
+      </if>
+      <if test="mobile != null">
+        #{mobile,jdbcType=VARCHAR},
+      </if>
+      <if test="smTime != null">
+        #{smTime,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <select id="trajectory"  resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetTrajectory">
+        SELECT
+	trajectory_id AS trajectoryId,
+	ctime,
+	ltime,
+	sec,
+	user_id AS userId
+FROM
+	t_helmet_trajectory
+WHERE
+	ctime = #{ctime} and user_id=#{userId}
+  </select>
+  <insert id="helmetTrajectoryInsert" >
+    insert into t_helmet_trajectory
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="trajectoryId != null">
+        trajectory_id,
+      </if>
+      <if test="ctime != null">
+        ctime,
+      </if>
+      <if test="ltime != null">
+        ltime,
+      </if>
+      <if test="sec != null">
+        sec,
+      </if>
+      <if test="userId != null">
+        user_id,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="trajectoryId != null">
+        #{trajectoryId,jdbcType=INTEGER},
+      </if>
+      <if test="ctime != null">
+        #{ctime,jdbcType=VARCHAR},
+      </if>
+      <if test="ltime != null">
+        #{ltime,jdbcType=VARCHAR},
+      </if>
+      <if test="sec != null">
+        #{sec,jdbcType=VARCHAR},
+      </if>
+      <if test="userId != null">
+        #{userId,jdbcType=INTEGER},
+      </if>
+    </trim>
+  </insert>
+
+  <update id="helmetTrajectoryUpdate">
+    update t_helmet_trajectory
+    <set>
+      <if test="ctime != null">
+        ctime = #{ctime,jdbcType=VARCHAR},
+      </if>
+      <if test="ltime != null">
+        ltime = #{ltime,jdbcType=VARCHAR},
+      </if>
+      <if test="sec != null">
+        sec = #{sec,jdbcType=VARCHAR},
+      </if>
+      <if test="userId != null">
+        user_id = #{userId,jdbcType=INTEGER},
+      </if>
+    </set>
+    where trajectory_id = #{trajectoryId,jdbcType=INTEGER}
+  </update>
+  <select id="helmetMotion" parameterType="java.lang.Integer" resultType="java.lang.String">
+    select times from  t_helmet_motion where  user_id=#{userId} order by times desc limit 0,1
+  </select>
+  <insert id="helmetMotionInsert">
+    insert into t_helmet_motion
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="motionId != null">
+        motion_id,
+      </if>
+      <if test="userId != null">
+        user_id,
+      </if>
+      <if test="xPoint != null">
+        x_point,
+      </if>
+      <if test="yPoint != null">
+        y_point,
+      </if>
+      <if test="times != null">
+        times,
+      </if>
+      <if test="cAngle != null">
+        c_angle,
+      </if>
+      <if test="cSpeed != null">
+        c_speed,
+      </if>
+      <if test="cTrust != null">
+        c_trust,
+      </if>
+      <if test="smTime != null">
+        sm_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="motionId != null">
+        #{motionId,jdbcType=INTEGER},
+      </if>
+      <if test="userId != null">
+        #{userId,jdbcType=INTEGER},
+      </if>
+      <if test="xPoint != null">
+        #{xPoint,jdbcType=VARCHAR},
+      </if>
+      <if test="yPoint != null">
+        #{yPoint,jdbcType=VARCHAR},
+      </if>
+      <if test="times != null">
+        #{times,jdbcType=VARCHAR},
+      </if>
+      <if test="cAngle != null">
+        #{cAngle,jdbcType=VARCHAR},
+      </if>
+      <if test="cSpeed != null">
+        #{cSpeed,jdbcType=VARCHAR},
+      </if>
+      <if test="cTrust != null">
+        #{cTrust,jdbcType=VARCHAR},
+      </if>
+      <if test="smTime != null">
+        #{smTime,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+
+  <select id="helmetList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetDevice">
+  select helmet_device_id as helmetDeviceId,
+      device_num as deviceNum,
+      user_id as userId,
+      user_name as userName
+       from  t_helmet_device
+       where 1=1
+       <if test="userName!=null and userName!='' ">
+            and user_name like concat('%',#{userName},'%')
+       </if>
+      <if test="deviceNum!=null and deviceNum!='' ">
+        and device_num like concat('%',#{deviceNum},'%')
+      </if>
+  </select>
+
+  <select id="helmetPictureList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetPicture">
+        select
+         thp.image_url as imageUrl,
+         thp.user_id as userId,
+         thp.x_point as xPoint,
+         thp.y_point as yPoint,
+         thp.cre_time as creTime,
+         thp.i_id as iId,
+         thp.sm_time as smTime
+         from t_helmet_picture thp
+        where 1=1
+        <if test="userId!=null and userId!='' ">
+            and thp.user_id=#{userId}
+        </if>
+        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
+          and thp.sm_time between #{strTime} and #{endTime}
+        </if>
+        order by thp.cre_time desc
+  </select>
+
+  <select id="helmetTrajectoryList"  resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetTrajectory">
+    select
+    trajectory_id as trajectoryId,
+    ctime,
+    ltime,
+    sec
+    from  t_helmet_trajectory where  1=1
+    <if test="userId!=null and userId!='' ">
+        and user_id=#{userId}
+    </if>
+    <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
+      and ctime between #{strTime} and #{endTime}
+    </if>
+  </select>
+
+  <select id="helmetTrajectoryTime" resultType="java.lang.String">
+        SELECT
+	SUM( ltime )
+FROM
+	t_helmet_trajectory
+WHERE
+    1=1
+    <if test="userId!=null and userId!='' ">
+      and user_id=#{userId}
+    </if>
+    <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
+      and ctime between #{strTime} and #{endTime}
+    </if>
+GROUP BY
+	user_id
+  </select>
+
+  <select id="helmetMotionList"  resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetMotion">
+    select
+    motion_id as motionId,
+    user_id as userId,
+    x_point as xPoint,
+    y_point as yPoint,
+    times,
+    c_angle as cAngle,
+    c_speed as cSpeed,
+    c_trust as cTrust,
+    sm_time as smTime
+     from t_helmet_motion
+    where
+    user_id=#{userId}
+    <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
+        and  sm_time between #{strTime} and #{endTime}
+    </if>
+    order by times asc
+  </select>
+
+  <insert id="dataValueInsert" >
+    insert into t_data_value
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="dataId != null">
+        data_id,
+      </if>
+      <if test="deviceId != null">
+        device_id,
+      </if>
+      <if test="deviceName != null">
+        device_name,
+      </if>
+      <if test="accountNumber != null">
+        account_number,
+      </if>
+      <if test="uploadTime != null">
+        upload_time,
+      </if>
+      <if test="pm25 != null">
+        pm25,
+      </if>
+      <if test="pm10 != null">
+        pm10,
+      </if>
+      <if test="tsp != null">
+        tsp,
+      </if>
+      <if test="temperature != null">
+        temperature,
+      </if>
+      <if test="humidity != null">
+        humidity,
+      </if>
+      <if test="data6 != null">
+        data6,
+      </if>
+      <if test="windSpeed != null">
+        wind_speed,
+      </if>
+      <if test="windDirection != null">
+        wind_direction,
+      </if>
+      <if test="tvoc != null">
+        tvoc,
+      </if>
+      <if test="no2 != null">
+        no2,
+      </if>
+      <if test="co != null">
+        co,
+      </if>
+      <if test="so2 != null">
+        so2,
+      </if>
+      <if test="o3 != null">
+        o3,
+      </if>
+      <if test="noise != null">
+        noise,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="dataId != null">
+        #{dataId,jdbcType=INTEGER},
+      </if>
+      <if test="deviceId != null">
+        #{deviceId,jdbcType=INTEGER},
+      </if>
+      <if test="deviceName != null">
+        #{deviceName,jdbcType=VARCHAR},
+      </if>
+      <if test="accountNumber != null">
+        #{accountNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="uploadTime != null">
+        #{uploadTime,jdbcType=VARCHAR},
+      </if>
+      <if test="pm25 != null">
+        #{pm25,jdbcType=VARCHAR},
+      </if>
+      <if test="pm10 != null">
+        #{pm10,jdbcType=VARCHAR},
+      </if>
+      <if test="tsp != null">
+        #{tsp,jdbcType=VARCHAR},
+      </if>
+      <if test="temperature != null">
+        #{temperature,jdbcType=VARCHAR},
+      </if>
+      <if test="humidity != null">
+        #{humidity,jdbcType=VARCHAR},
+      </if>
+      <if test="data6 != null">
+        #{data6,jdbcType=VARCHAR},
+      </if>
+      <if test="windSpeed != null">
+        #{windSpeed,jdbcType=VARCHAR},
+      </if>
+      <if test="windDirection != null">
+        #{windDirection,jdbcType=VARCHAR},
+      </if>
+      <if test="tvoc != null">
+        #{tvoc,jdbcType=VARCHAR},
+      </if>
+      <if test="no2 != null">
+        #{no2,jdbcType=VARCHAR},
+      </if>
+      <if test="co != null">
+        #{co,jdbcType=VARCHAR},
+      </if>
+      <if test="so2 != null">
+        #{so2,jdbcType=VARCHAR},
+      </if>
+      <if test="o3 != null">
+        #{o3,jdbcType=VARCHAR},
+      </if>
+      <if test="noise != null">
+        #{noise,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+
+  <select id="helmetReportTotal" resultType="com.thhy.materials.modules.biz.helmet.entity.dto.ReportNumDto">
+       SELECT
+      COUNT(sm_time) AS num,
+      DATE(sm_time) as smTime
+  FROM
+      t_helmet_report
+  WHERE
+      user_id = #{userId}
+      <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
+        and sm_time between #{strTime} and #{endTime}
+      </if>
+  GROUP BY
+      DATE( sm_time )
+  </select>
+
+  <select id="helmetReportUser" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetReport">
+        select user_id as userId,
+         user_name as userName,
+         sos_type as sosType,
+         x_point as xPoint,
+         y_point as yPoint,
+         sm_time as smTime
+         from t_helmet_report where
+        user_id=#{userId}
+        order by sm_time desc
+  </select>
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3