src/main/java/com/moral/controller/WebController.java
@@ -6,20 +6,16 @@
import com.moral.common.util.*;
import com.moral.common.webAnno.UserLoginToken;
import com.moral.entity.*;
import com.moral.mapper.MapPathMapper;
import com.moral.service.*;
import com.moral.util.DateUtil;
import com.moral.util.LatLngTransformation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.runtime.logging.Logger;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@@ -65,12 +61,17 @@
    SensorService sensorService;
    @Resource
    OrganizationSensorsService organizationSensorsService;
    @Resource
    MapPathService mapPathService;
    @UserLoginToken
    @GetMapping("test")
    public String add() {
        return "test success!";
    public ResultBean<List<WebProvince>> add(HttpServletRequest request) {
        String token =  request.getHeader("token");
        List<WebProvince> mapPath = mapPathService.getMapPath(token);
        if(ObjectUtils.isEmpty(mapPath))
            return new ResultBean<>("获取地图信息失败",ResultBean.FAIL);
        return new ResultBean<>(mapPath);
    }
    /**
@@ -87,7 +88,7 @@
            resultMap.put("msg", "用户名及密码不允许为空!");
            resultMap.put("accountId", -1);
        } else {
            resultMap = accountService.webLogin(parameters);
            resultMap = accountService.bsWebLogin(parameters);
            String accountId = String.valueOf(resultMap.get("accountId"));
            if (!accountId.equals("-1")) {
                redisHashUtil.deleteMapVal("webToken", accountId);
@@ -445,6 +446,17 @@
        return new ResultBean<Map<String, Object>>(sortDatas);
    }
    @GetMapping("mapPath")
    public ResultBean<List<WebProvince>> mapPath(HttpServletRequest request) {
        String token =  request.getHeader("token");
        List<WebProvince> mapPath = mapPathService.getMapPath(token);
        if(ObjectUtils.isEmpty(mapPath))
            return new ResultBean<>("获取地图信息失败",ResultBean.FAIL);
        return new ResultBean<>(mapPath);
    }
    /**
     * @Description: 返回结果添加设备经纬度以及state
@@ -453,7 +465,7 @@
     * @Author: 下雨听风
     * @Date: 2020/10/19
     */
    public List<Map<String, Object>> insertDeviceInfo(List<Map<String, Object>> datas, List<Device> devices) {
    private List<Map<String, Object>> insertDeviceInfo(List<Map<String, Object>> datas, List<Device> devices) {
        Map<String, Device> map = new HashMap<>();
        devices.forEach(p -> {
            map.put(p.getMac(), p);
@@ -512,7 +524,7 @@
     * @Author: 下雨听风
     * @Date: 2020/10/20
     */
    public String getFiveMinuteAgoTime(String time) {
    private String getFiveMinuteAgoTime(String time) {
        try {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Date date = sdf.parse(time);