lizijie
2022-01-20 389745c23c0c279f9f79bd2aa028128beb18cd5c
热力图接口修改
10 files added
7 files modified
941 ■■■■■ changed files
screen-api/src/main/java/com/moral/api/controller/ChartController.java 100 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/entity/ServicesScope.java 79 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/entity/ServicesScopeDevice.java 64 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/ServicesScopeDeviceMapper.java 16 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/mapper/ServicesScopeMapper.java 16 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/HistoryDailyService.java 18 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/HistoryHourlyService.java 18 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/HistoryMonthlyService.java 17 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/ServicesScopeDeviceService.java 16 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/ServicesScopeService.java 16 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java 172 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/HistoryHourlyServiceImpl.java 169 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/HistoryMonthlyServiceImpl.java 167 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/ServicesScopeDeviceServiceImpl.java 20 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/ServicesScopeServiceImpl.java 20 ●●●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/ServicesScopeDeviceMapper.xml 15 ●●●●● patch | view | raw | blame | history
screen-api/src/main/resources/mapper/ServicesScopeMapper.xml 18 ●●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/controller/ChartController.java
@@ -1,11 +1,15 @@
package com.moral.api.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.moral.api.entity.Organization;
import com.moral.api.entity.ServicesScope;
import com.moral.api.mapper.OrganizationMapper;
import com.moral.api.service.HistoryDailyService;
import com.moral.api.service.HistoryHourlyService;
import com.moral.api.service.HistoryMonthlyService;
import com.moral.api.service.ServicesScopeService;
import com.moral.constant.Constants;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
import com.moral.util.DateUtils;
@@ -44,6 +48,9 @@
    @Resource
    private HistoryMonthlyService historyMonthlyService;
    @Resource
    private ServicesScopeService servicesScopeService;
    @RequestMapping(value = "getThermodynamicDiagramDataByCondition", method = RequestMethod.GET)
    @ResponseBody
@@ -135,6 +142,99 @@
        return ResultMessage.ok(resultMap);
    }
    @RequestMapping(value = "getThermodynamicDiagramDataByConditionV2", method = RequestMethod.GET)
    @ResponseBody
    public ResultMessage getThermodynamicDiagramDataByConditionV2(HttpServletRequest request) throws ParseException {
        Map<String, Object> parameters = WebUtils.getParametersStartingWith(request,null);
        Object servicesScopeId = parameters.get("servicesScopeId");
        Object sensorCode = parameters.get("sensor_code");
        Object type = parameters.get("type");
        if (ObjectUtils.isEmpty(servicesScopeId) || ObjectUtils.isEmpty(sensorCode) || ObjectUtils.isEmpty(type)){
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
        QueryWrapper<ServicesScope> servicesScopeQueryWrapper = new QueryWrapper<>();
        servicesScopeQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
        servicesScopeQueryWrapper.eq("id",servicesScopeId);
        ServicesScope servicesScope = servicesScopeService.getOne(servicesScopeQueryWrapper);
        if (ObjectUtils.isEmpty(servicesScope)){
            return ResultMessage.fail(ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getCode(), ResponseCodeEnum.ORGANIZATION_NOT_EXIST.getMsg());
        }
        Map<String, Object> resultMap = new HashMap<>();
        List<Map<String,Object>> resultList = new ArrayList<>();
        if (type.equals("hourly")){
            Object time = parameters.get("time");
            if (ObjectUtils.isEmpty(time)){
                return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
            }
            resultMap = historyHourlyService.getThermodynamicDiagramDataByOrgIdSensorCodeTimeV2(parameters);
            return ResultMessage.ok(resultMap);
        }
        if (type.equals("daily")){
            Object time = parameters.get("time");
            if (ObjectUtils.isEmpty(time)){
                return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
            }
            resultMap = historyDailyService.getThermodynamicDiagramDataByOrgIdSensorCodeTimeV2(parameters);
            return ResultMessage.ok(resultMap);
        }
        if (type.equals("monthly")){
            Object time = parameters.get("time");
            if (ObjectUtils.isEmpty(time)){
                return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
            }
            resultMap = historyMonthlyService.getThermodynamicDiagramDataByOrgIdSensorCodeTimeV2(parameters);
            return ResultMessage.ok(resultMap);
        }
        if (type.equals("custom")){
            String startTime = parameters.get("startTime").toString();
            String endTime = parameters.get("endTime").toString();
            if (ObjectUtils.isEmpty(startTime) || ObjectUtils.isEmpty(endTime)){
                return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
            }
            if (startTime.length() == 13){
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");//24小时制
                long newTime1 = simpleDateFormat.parse(startTime+":00:00").getTime();
                long newTime2 = simpleDateFormat.parse(endTime+":00:00").getTime();
                Long result = newTime2 - newTime1; //获取两时间相差的毫秒数
                long nd = 1000 * 24 * 60 * 60;
                long nh = 1000 * 60 * 60;
                long nm = 1000 * 60;
                long hour = result / nh; //获取相差的小时数
                if (hour+1>12){
                    return ResultMessage.fail(-1, "时间不能超过12小时");
                }
                if (hour<0){
                    return ResultMessage.fail(ResponseCodeEnum.TIME_FORMAT_INVALID.getCode(), ResponseCodeEnum.TIME_FORMAT_INVALID.getMsg());
                }
                parameters.put("hour",hour);
                resultList = historyHourlyService.getThermodynamicDiagramDataByOrgIdSensorCodeTimeslotV2(parameters);
                return ResultMessage.ok(resultList);
            }
            if (startTime.length() == 10){
                long days = DateUtils.getQuotByDays(startTime, endTime);
                if (days+1>12){
                    return ResultMessage.fail(-1, "时间不能超过12天");
                }
                parameters.put("days",days);
                resultList = historyDailyService.getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlotV2(parameters);
                return ResultMessage.ok(resultList);
            }
            if (startTime.length() == 7){
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM");
                Date satrtTimeDate = df.parse(startTime);
                Date endTimeDate = df.parse(endTime);
                long months = DateUtils.getMonth(satrtTimeDate,endTimeDate); //获取相差的小时数
                if (months+1>12){
                    return ResultMessage.fail(-1, "时间不能超过12月");
                }
                parameters.put("months",months);
                resultList = historyMonthlyService.getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlotV2(parameters);
                return ResultMessage.ok(resultList);
            }
        }
        return ResultMessage.ok(resultMap);
    }
    @RequestMapping(value = "returnDataTest", method = RequestMethod.GET)
    @ResponseBody
    public ResultMessage returnDataTest(HttpServletRequest request) throws ParseException {
screen-api/src/main/java/com/moral/api/entity/ServicesScope.java
New file
@@ -0,0 +1,79 @@
package com.moral.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * <p>
 *
 * </p>
 *
 * @author moral
 * @since 2022-01-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class ServicesScope extends Model<ServicesScope> {
    private static final long serialVersionUID = 1L;
    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 名称
     */
    private String name;
    /**
     * 组织id
     */
    private Integer organizationId;
    /**
     * 中心经度
     */
    private Double centerLongitude;
    /**
     * 中心纬度
     */
    private Double centerLatitude;
    /**
     * 边界
     */
    private String boundary;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;
    /**
     * 是否删除
     */
    private String isDelete;
    @Override
    protected Serializable pkVal() {
        return this.id;
    }
}
screen-api/src/main/java/com/moral/api/entity/ServicesScopeDevice.java
New file
@@ -0,0 +1,64 @@
package com.moral.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * <p>
 *
 * </p>
 *
 * @author moral
 * @since 2022-01-19
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class ServicesScopeDevice extends Model<ServicesScopeDevice> {
    private static final long serialVersionUID = 1L;
    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 服务范围id
     */
    private Integer servicesScopeId;
    /**
     * 设备id
     */
    private Integer deviceId;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;
    /**
     * 是否删除
     */
    private String isDelete;
    @Override
    protected Serializable pkVal() {
        return this.id;
    }
}
screen-api/src/main/java/com/moral/api/mapper/ServicesScopeDeviceMapper.java
New file
@@ -0,0 +1,16 @@
package com.moral.api.mapper;
import com.moral.api.entity.ServicesScopeDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author moral
 * @since 2022-01-19
 */
public interface ServicesScopeDeviceMapper extends BaseMapper<ServicesScopeDevice> {
}
screen-api/src/main/java/com/moral/api/mapper/ServicesScopeMapper.java
New file
@@ -0,0 +1,16 @@
package com.moral.api.mapper;
import com.moral.api.entity.ServicesScope;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author moral
 * @since 2022-01-19
 */
public interface ServicesScopeMapper extends BaseMapper<ServicesScope> {
}
screen-api/src/main/java/com/moral/api/service/HistoryDailyService.java
@@ -57,6 +57,15 @@
    Map<String, Object> getThermodynamicDiagramDataByOrgIdSensorCodeTime(Map<String, Object> map);
    /**
     *@Description: 通过组织id、因子编码和时间获取日数据
     *@Param: [map]
     *@return: java.util.Map<java.lang.String,java.lang.Object>
     *@Author: lizijie
     *@Date: 2022/01/20 15:16
     **/
    Map<String, Object> getThermodynamicDiagramDataByOrgIdSensorCodeTimeV2(Map<String, Object> map);
    /**
     *@Description: 通过组织id、因子编码和时间段获取日数据
     *@Param: [map]
     *@return: java.util.Map<java.lang.String,java.lang.Object>
@@ -66,6 +75,15 @@
    List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlot(Map<String, Object> map);
    /**
     *@Description: 通过组织id、因子编码和时间段获取日数据第二版
     *@Param: [map]
     *@return: java.util.Map<java.lang.String,java.lang.Object>
     *@Author: lizijie
     *@Date: 2022/01/20 15:16
     **/
    List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlotV2(Map<String, Object> parameters);
    /**
     * @description: 通过设备和时间获取天数据
     * @param macs List<String>
     * @param time String 例:2021-12
screen-api/src/main/java/com/moral/api/service/HistoryHourlyService.java
@@ -47,6 +47,15 @@
    Map<String, Object> getThermodynamicDiagramDataByOrgIdSensorCodeTime(Map<String, Object> map);
    /**
     * @Description: 通过组织id、因子编码和时间获取小时数据第二版
     * @Param: [map]
     * @return: java.util.Map<java.lang.String, java.lang.Object>
     * @Author: lizijie
     * @Date: 2022/01/19 16:29
     **/
    Map<String, Object> getThermodynamicDiagramDataByOrgIdSensorCodeTimeV2(Map<String, Object> map);
    /**
     * @Description: 通过组织id、因子编码和时间段获取小时数据
     * @Param: [map]
     * @return: java.util.Map<java.lang.String, java.lang.Object>
@@ -56,6 +65,15 @@
    List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeslot(Map<String, Object> map);
    /**
     * @Description: 通过组织id、因子编码和时间段获取小时数据
     * @Param: [map]
     * @return: java.util.Map<java.lang.String, java.lang.Object>
     * @Author: lizijie
     * @Date: 2022/01/20 15:16
     **/
    List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeslotV2(Map<String, Object> map);
    /**
     * @Description: 获取某一天小时完整数据
     * @Param: [map]
     * @return: java.util.List<java.util.Map < java.lang.String, java.lang.Object>>
screen-api/src/main/java/com/moral/api/service/HistoryMonthlyService.java
@@ -43,6 +43,14 @@
     *@Date: 2021/12/15 15:16
     **/
    Map<String, Object> getThermodynamicDiagramDataByOrgIdSensorCodeTime(Map<String, Object> map);
    /**
     *@Description: 通过组织id、因子编码和时间获取月数据第二版
     *@Param: [map]
     *@return: java.util.Map<java.lang.String,java.lang.Object>
     *@Author: lizijie
     *@Date: 2022/01/20 15:16
     **/
    Map<String, Object> getThermodynamicDiagramDataByOrgIdSensorCodeTimeV2(Map<String, Object> parameters);
    /**
     *@Description: 通过组织id、因子编码和时间段获取月数据
@@ -54,6 +62,15 @@
    List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlot(Map<String, Object> map);
    /**
     *@Description: 通过组织id、因子编码和时间段获取月数据
     *@Param: [map]
     *@return: java.util.Map<java.lang.String,java.lang.Object>
     *@Author: lizijie
     *@Date: 2021/12/16 15:16
     **/
    List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlotV2(Map<String, Object> parameters);
    /**
     * @description: 通过设备和时间获取月数据
     * @param macs List<String>
     * @param time String 例:2021
screen-api/src/main/java/com/moral/api/service/ServicesScopeDeviceService.java
New file
@@ -0,0 +1,16 @@
package com.moral.api.service;
import com.moral.api.entity.ServicesScopeDevice;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * <p>
 *  服务类
 * </p>
 *
 * @author moral
 * @since 2022-01-19
 */
public interface ServicesScopeDeviceService extends IService<ServicesScopeDevice> {
}
screen-api/src/main/java/com/moral/api/service/ServicesScopeService.java
New file
@@ -0,0 +1,16 @@
package com.moral.api.service;
import com.moral.api.entity.ServicesScope;
import com.baomidou.mybatisplus.extension.service.IService;
/**
 * <p>
 *  服务类
 * </p>
 *
 * @author moral
 * @since 2022-01-19
 */
public interface ServicesScopeService extends IService<ServicesScope> {
}
screen-api/src/main/java/com/moral/api/service/impl/HistoryDailyServiceImpl.java
@@ -1,5 +1,8 @@
package com.moral.api.service.impl;
import com.moral.api.entity.*;
import com.moral.api.mapper.ServicesScopeDeviceMapper;
import com.moral.api.mapper.ServicesScopeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@@ -22,10 +25,6 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moral.api.entity.Device;
import com.moral.api.entity.GeoCoordinate;
import com.moral.api.entity.HistoryDaily;
import com.moral.api.entity.Organization;
import com.moral.api.mapper.DeviceMapper;
import com.moral.api.mapper.HistoryDailyMapper;
import com.moral.api.service.HistoryDailyService;
@@ -54,6 +53,12 @@
    @Autowired
    private OrganizationService organizationService;
    @Autowired
    private ServicesScopeMapper servicesScopeMapper;
    @Autowired
    private ServicesScopeDeviceMapper servicesScopeDeviceMapper;
    @Override
    public Map<String, Object> getMonthAvg(Map<String, Object> params) {
@@ -212,6 +217,76 @@
    }
    @Override
    public Map<String, Object> getThermodynamicDiagramDataByOrgIdSensorCodeTimeV2(Map<String, Object> parameters) {
        Map<String, Object> resultMap = new HashMap<>();
        int servicesScopeId = Integer.parseInt(parameters.get("servicesScopeId").toString());
        QueryWrapper<ServicesScopeDevice> servicesScopeDeviceQueryWrapper = new QueryWrapper<>();
        servicesScopeDeviceQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
        servicesScopeDeviceQueryWrapper.eq("services_scope_id",servicesScopeId);
        List<ServicesScopeDevice> servicesScopeDevices = servicesScopeDeviceMapper.selectList(servicesScopeDeviceQueryWrapper);
        List<Integer> deviceIds = servicesScopeDevices.stream().map(p -> p.getDeviceId()).collect(Collectors.toList());
        //声明一个list,存放设备mac
        List<String> deviceMacList = new ArrayList<>();
        //声明一个map,Mac作为key,device作为value
        Map<String, Device> deviceMap = new HashMap<>();
        //根据id查询所属设备
        QueryWrapper<Device> wrapper_device = new QueryWrapper<>();
        wrapper_device.eq("is_delete", Constants.NOT_DELETE);
        wrapper_device.in("id",deviceIds);
        List<Device> devices = new ArrayList<>();
        devices = deviceMapper.selectList(wrapper_device);
        if (devices.size() > 0) {
            for (Device device : devices) {
                String mac = device.getMac();
                deviceMacList.add(mac);
                deviceMap.put(mac, device);
            }
        }
        //获取时间
        String time = parameters.get("time").toString().substring(0, 10) + " 00:00:00";
        resultMap.put("time", time);
        QueryWrapper<HistoryDaily> historyDailyQueryWrapper = new QueryWrapper<>();
        historyDailyQueryWrapper.eq("time", time);
        historyDailyQueryWrapper.in("mac", deviceMacList);
        List<HistoryDaily> historyDailies = historyDailyMapper.selectList(historyDailyQueryWrapper);
        List<Object> list = new ArrayList<>();
        for (HistoryDaily historyDailyData : historyDailies) {
            List<Object> list1 = new ArrayList<>();
            String mac = historyDailyData.getMac();
            Device device = deviceMap.get(mac);
            double longitude = device.getLongitude();
            double latitude = device.getLatitude();
            JSONObject value = JSONObject.parseObject(historyDailyData.getValue());
            double num = Double.parseDouble(value.get(parameters.get("sensor_code")).toString());
            int level = PollutantUtils.pollutantLevel(num, (parameters.get("sensor_code")).toString());
            list1.add(longitude);
            list1.add(latitude);
            list1.add(level);
            list.add(list1);
        }
        resultMap.put("list", list);
        ServicesScope servicesScope = servicesScopeMapper.selectById(servicesScopeId);
        String boundary = servicesScope.getBoundary();
        String[] boundary_points = boundary.split(";");
        List boundary_pointList = new ArrayList();
        List bound = new ArrayList();
        for (String boundary_point:boundary_points) {
            List boundary_point_one = new ArrayList();
            String[] boundary_point_one_array = boundary_point.split(",");
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[0]));
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[1]));
            boundary_pointList.add(boundary_point_one);
        }
        bound.add(boundary_pointList);
        resultMap.put("bound", bound);
        List centerPoint = new ArrayList();
        centerPoint.add(servicesScope.getCenterLongitude());
        centerPoint.add(servicesScope.getCenterLatitude());
        resultMap.put("centerPoint", centerPoint);
        return resultMap;
    }
    @Override
    public List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlot(Map<String, Object> parameters) {
        int orgId = Integer.parseInt(parameters.get("organization_id").toString());
        //定义一个集合,存放所有id
@@ -339,6 +414,95 @@
    }
    @Override
    public List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlotV2(Map<String, Object> parameters) {
        int servicesScopeId = Integer.parseInt(parameters.get("servicesScopeId").toString());
        QueryWrapper<ServicesScopeDevice> servicesScopeDeviceQueryWrapper = new QueryWrapper<>();
        servicesScopeDeviceQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
        servicesScopeDeviceQueryWrapper.eq("services_scope_id",servicesScopeId);
        List<ServicesScopeDevice> servicesScopeDevices = servicesScopeDeviceMapper.selectList(servicesScopeDeviceQueryWrapper);
        List<Integer> deviceIds = servicesScopeDevices.stream().map(p -> p.getDeviceId()).collect(Collectors.toList());
        //声明一个list,存放设备mac
        List<String> deviceMacList = new ArrayList<>();
        //声明一个map,Mac作为key,device作为value
        Map<String, Device> deviceMap = new HashMap<>();
        //根据id查询所属设备
        QueryWrapper<Device> wrapper_device = new QueryWrapper<>();
        wrapper_device.eq("is_delete", Constants.NOT_DELETE);
        wrapper_device.in("id",deviceIds);
        List<Device> devices = new ArrayList<>();
        devices = deviceMapper.selectList(wrapper_device);
        if (devices.size() > 0) {
            for (Device device : devices) {
                String mac = device.getMac();
                deviceMacList.add(mac);
                deviceMap.put(mac, device);
            }
        }
        ServicesScope servicesScope = servicesScopeMapper.selectById(servicesScopeId);
        String boundary = servicesScope.getBoundary();
        String[] boundary_points = boundary.split(";");
        List boundary_pointList = new ArrayList();
        List bound = new ArrayList();
        for (String boundary_point:boundary_points) {
            List boundary_point_one = new ArrayList();
            String[] boundary_point_one_array = boundary_point.split(",");
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[0]));
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[1]));
            boundary_pointList.add(boundary_point_one);
        }
        bound.add(boundary_pointList);
        List centerPoint = new ArrayList();
        centerPoint.add(servicesScope.getCenterLongitude());
        centerPoint.add(servicesScope.getCenterLatitude());
        List<Map<String, Object>> resultList = new ArrayList<>();
        //获取时间
        String endTime = parameters.get("endTime").toString().substring(0, 10) + " 00:00:00";
        //获取时间
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        int days = Integer.parseInt(parameters.get("days").toString());
        Date newEndTime = new Date();
        for (int i = days; i >= 0; i--) {
            Map<String, Object> resultMap = new HashMap<>();
            //先存放中心点和边界点
            resultMap.put("centerPoint", centerPoint);
            resultMap.put("bound", bound);
            Calendar calendar = Calendar.getInstance();
            try {
                newEndTime = df.parse(endTime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            calendar.setTime(newEndTime);
            calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH) - i);
            String time = df.format(calendar.getTime()) + " 00:00:00";
            //存放时间
            resultMap.put("time", time);
            QueryWrapper<HistoryDaily> historyDailyQueryWrapper = new QueryWrapper<>();
            historyDailyQueryWrapper.eq("time", time);
            historyDailyQueryWrapper.in("mac", deviceMacList);
            List<HistoryDaily> historyDailies = historyDailyMapper.selectList(historyDailyQueryWrapper);
            List<Object> list = new ArrayList<>();
            for (HistoryDaily historyDailyData : historyDailies) {
                List<Object> list1 = new ArrayList<>();
                String mac = historyDailyData.getMac();
                Device device = deviceMap.get(mac);
                double longitude = device.getLongitude();
                double latitude = device.getLatitude();
                JSONObject value = JSONObject.parseObject(historyDailyData.getValue());
                double num = Double.parseDouble(value.get(parameters.get("sensor_code")).toString());
                int level = PollutantUtils.pollutantLevel(num, (parameters.get("sensor_code")).toString());
                list1.add(longitude);
                list1.add(latitude);
                list1.add(level);
                list.add(list1);
            }
            resultMap.put("list", list);
            resultList.add(resultMap);
        }
        return resultList;
    }
    @Override
    public List<HistoryDaily> getValueByMacs(List<String> macs, String time) {
        QueryWrapper<HistoryDaily> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("time", "value")
screen-api/src/main/java/com/moral/api/service/impl/HistoryHourlyServiceImpl.java
@@ -1,5 +1,8 @@
package com.moral.api.service.impl;
import com.moral.api.entity.*;
import com.moral.api.mapper.ServicesScopeDeviceMapper;
import com.moral.api.mapper.ServicesScopeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@@ -22,10 +25,6 @@
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.moral.api.config.mybatis.MybatisPlusConfig;
import com.moral.api.entity.Device;
import com.moral.api.entity.GeoCoordinate;
import com.moral.api.entity.HistoryHourly;
import com.moral.api.entity.Organization;
import com.moral.api.mapper.DeviceMapper;
import com.moral.api.mapper.HistoryHourlyMapper;
import com.moral.api.service.HistoryHourlyService;
@@ -59,6 +58,12 @@
    @Autowired
    private OrganizationService organizationService;
    @Autowired
    private ServicesScopeMapper servicesScopeMapper;
    @Autowired
    private ServicesScopeDeviceMapper servicesScopeDeviceMapper;
    @Override
    public Map<String, Object> getHourlyAqiByMac(String mac) {
@@ -417,6 +422,75 @@
    }
    @Override
    public Map<String, Object> getThermodynamicDiagramDataByOrgIdSensorCodeTimeV2(Map<String, Object> parameters) {
        Map<String, Object> resultMap = new HashMap<>();
        int servicesScopeId = Integer.parseInt(parameters.get("servicesScopeId").toString());
        QueryWrapper<ServicesScopeDevice> servicesScopeDeviceQueryWrapper = new QueryWrapper<>();
        servicesScopeDeviceQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
        servicesScopeDeviceQueryWrapper.eq("services_scope_id",servicesScopeId);
        List<ServicesScopeDevice> servicesScopeDevices = servicesScopeDeviceMapper.selectList(servicesScopeDeviceQueryWrapper);
        List<Integer> deviceIds = servicesScopeDevices.stream().map(p -> p.getDeviceId()).collect(Collectors.toList());
        //声明一个list,存放设备mac
        List<String> deviceMacList = new ArrayList<>();
        //声明一个map,Mac作为key,device作为value
        Map<String, Device> deviceMap = new HashMap<>();
        //根据id查询所属设备
        QueryWrapper<Device> wrapper_device = new QueryWrapper<>();
        wrapper_device.eq("is_delete", Constants.NOT_DELETE);
        wrapper_device.in("id",deviceIds);
        List<Device> devices = new ArrayList<>();
        devices = deviceMapper.selectList(wrapper_device);
        if (devices.size() > 0) {
            for (Device device : devices) {
                String mac = device.getMac();
                deviceMacList.add(mac);
                deviceMap.put(mac, device);
            }
        }
        //获取时间
        String time = parameters.get("time").toString().substring(0, 13) + ":00:00";
        resultMap.put("time", time);
        String timeUnits = DateUtils.stringToDateString(time, DateUtils.yyyy_MM_dd_HH_mm_ss_EN, DateUtils.yyyyMM_EN);
        List<Map<String, Object>> historyHourlyDatas = new ArrayList<>();
        historyHourlyDatas = historyHourlyMapper.selectDataByMacsAndTime(timeUnits, deviceMacList, time);
        List<Object> list = new ArrayList<>();
        for (Map historyHourlyData : historyHourlyDatas) {
            List<Object> list1 = new ArrayList<>();
            String mac = historyHourlyData.get("mac").toString();
            Device device = deviceMap.get(mac);
            double longitude = device.getLongitude();
            double latitude = device.getLatitude();
            JSONObject value = JSONObject.parseObject(historyHourlyData.get("value").toString());
            double num = Double.parseDouble(value.get(parameters.get("sensor_code")).toString());
            int level = PollutantUtils.pollutantLevel(num, (parameters.get("sensor_code")).toString());
            list1.add(longitude);
            list1.add(latitude);
            list1.add(level);
            list.add(list1);
        }
        resultMap.put("list", list);
        ServicesScope servicesScope = servicesScopeMapper.selectById(servicesScopeId);
        String boundary = servicesScope.getBoundary();
        String[] boundary_points = boundary.split(";");
        List boundary_pointList = new ArrayList();
        List bound = new ArrayList();
        for (String boundary_point:boundary_points) {
            List boundary_point_one = new ArrayList();
            String[] boundary_point_one_array = boundary_point.split(",");
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[0]));
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[1]));
            boundary_pointList.add(boundary_point_one);
        }
        bound.add(boundary_pointList);
        resultMap.put("bound", bound);
        List centerPoint = new ArrayList();
        centerPoint.add(servicesScope.getCenterLongitude());
        centerPoint.add(servicesScope.getCenterLatitude());
        resultMap.put("centerPoint", centerPoint);
        return resultMap;
    }
    @Override
    public List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeslot(Map<String, Object> parameters) {
        int orgId = Integer.parseInt(parameters.get("organization_id").toString());
        //定义一个集合,存放所有id
@@ -542,6 +616,93 @@
    }
    @Override
    public List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeslotV2(Map<String, Object> parameters) {
        int servicesScopeId = Integer.parseInt(parameters.get("servicesScopeId").toString());
        QueryWrapper<ServicesScopeDevice> servicesScopeDeviceQueryWrapper = new QueryWrapper<>();
        servicesScopeDeviceQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
        servicesScopeDeviceQueryWrapper.eq("services_scope_id",servicesScopeId);
        List<ServicesScopeDevice> servicesScopeDevices = servicesScopeDeviceMapper.selectList(servicesScopeDeviceQueryWrapper);
        List<Integer> deviceIds = servicesScopeDevices.stream().map(p -> p.getDeviceId()).collect(Collectors.toList());
        //声明一个list,存放设备mac
        List<String> deviceMacList = new ArrayList<>();
        //声明一个map,Mac作为key,device作为value
        Map<String, Device> deviceMap = new HashMap<>();
        //根据id查询所属设备
        QueryWrapper<Device> wrapper_device = new QueryWrapper<>();
        wrapper_device.eq("is_delete", Constants.NOT_DELETE);
        wrapper_device.in("id",deviceIds);
        List<Device> devices = new ArrayList<>();
        devices = deviceMapper.selectList(wrapper_device);
        if (devices.size() > 0) {
            for (Device device : devices) {
                String mac = device.getMac();
                deviceMacList.add(mac);
                deviceMap.put(mac, device);
            }
        }
        ServicesScope servicesScope = servicesScopeMapper.selectById(servicesScopeId);
        String boundary = servicesScope.getBoundary();
        String[] boundary_points = boundary.split(";");
        List boundary_pointList = new ArrayList();
        List bound = new ArrayList();
        for (String boundary_point:boundary_points) {
            List boundary_point_one = new ArrayList();
            String[] boundary_point_one_array = boundary_point.split(",");
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[0]));
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[1]));
            boundary_pointList.add(boundary_point_one);
        }
        bound.add(boundary_pointList);
        List centerPoint = new ArrayList();
        centerPoint.add(servicesScope.getCenterLongitude());
        centerPoint.add(servicesScope.getCenterLatitude());
        List<Map<String, Object>> list = new ArrayList<>();
        //获取时间
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH");
        String endTime = parameters.get("endTime").toString();
        int hour = Integer.parseInt(parameters.get("hour").toString());
        Date newEndTime = new Date();
        for (int i = hour; i >= 0; i--) {
            Map<String, Object> resultMap = new HashMap<>();
            //先存放中心点和边界点
            resultMap.put("centerPoint", centerPoint);
            resultMap.put("bound", bound);
            Calendar calendar = Calendar.getInstance();
            try {
                newEndTime = df.parse(endTime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            calendar.setTime(newEndTime);
            calendar.set(Calendar.HOUR_OF_DAY, calendar.get(Calendar.HOUR_OF_DAY) - i);
            String time = df.format(calendar.getTime()) + ":00:00";
            //存放时间
            resultMap.put("time", time);
            String timeUnits = DateUtils.dateToDateString(calendar.getTime(), DateUtils.yyyyMM_EN);
            List<Map<String, Object>> historyHourlyDatas = new ArrayList<>();
            historyHourlyDatas = historyHourlyMapper.selectDataByMacsAndTime(timeUnits, deviceMacList, time);
            List<Object> oneHourlyList = new ArrayList<>();
            for (Map historyHourlyData : historyHourlyDatas) {
                List<Object> list1 = new ArrayList<>();
                String mac = historyHourlyData.get("mac").toString();
                Device device = deviceMap.get(mac);
                double longitude = device.getLongitude();
                double latitude = device.getLatitude();
                JSONObject value = JSONObject.parseObject(historyHourlyData.get("value").toString());
                double num = Double.parseDouble(value.get(parameters.get("sensor_code")).toString());
                int level = PollutantUtils.pollutantLevel(num, (parameters.get("sensor_code")).toString());
                list1.add(longitude);
                list1.add(latitude);
                list1.add(level);
                oneHourlyList.add(list1);
            }
            resultMap.put("list", oneHourlyList);
            list.add(resultMap);
        }
        return list;
    }
    @Override
    public List<Map<String, Object>> getHourCompleteDataByMacSensorCodeDate(Map<String, Object> map) {
        String mac = map.get("mac").toString();
        String sensorCode = map.get("sensor_code").toString();
screen-api/src/main/java/com/moral/api/service/impl/HistoryMonthlyServiceImpl.java
@@ -5,6 +5,8 @@
import com.moral.api.entity.*;
import com.moral.api.mapper.DeviceMapper;
import com.moral.api.mapper.HistoryMonthlyMapper;
import com.moral.api.mapper.ServicesScopeDeviceMapper;
import com.moral.api.mapper.ServicesScopeMapper;
import com.moral.api.service.HistoryMonthlyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.moral.api.service.OrganizationService;
@@ -43,6 +45,12 @@
    @Autowired
    private OrganizationService organizationService;
    @Autowired
    private ServicesScopeMapper servicesScopeMapper;
    @Autowired
    private ServicesScopeDeviceMapper servicesScopeDeviceMapper;
    @Override
    public HistoryMonthly getHistoryMonthlyByMacAndDate(String mac, Date date) {
@@ -177,6 +185,76 @@
    }
    @Override
    public Map<String, Object> getThermodynamicDiagramDataByOrgIdSensorCodeTimeV2(Map<String, Object> parameters) {
        Map<String, Object> resultMap = new HashMap<>();
        int servicesScopeId = Integer.parseInt(parameters.get("servicesScopeId").toString());
        QueryWrapper<ServicesScopeDevice> servicesScopeDeviceQueryWrapper = new QueryWrapper<>();
        servicesScopeDeviceQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
        servicesScopeDeviceQueryWrapper.eq("services_scope_id",servicesScopeId);
        List<ServicesScopeDevice> servicesScopeDevices = servicesScopeDeviceMapper.selectList(servicesScopeDeviceQueryWrapper);
        List<Integer> deviceIds = servicesScopeDevices.stream().map(p -> p.getDeviceId()).collect(Collectors.toList());
        //声明一个list,存放设备mac
        List<String> deviceMacList = new ArrayList<>();
        //声明一个map,Mac作为key,device作为value
        Map<String, Device> deviceMap = new HashMap<>();
        //根据id查询所属设备
        QueryWrapper<Device> wrapper_device = new QueryWrapper<>();
        wrapper_device.eq("is_delete", Constants.NOT_DELETE);
        wrapper_device.in("id",deviceIds);
        List<Device> devices = new ArrayList<>();
        devices = deviceMapper.selectList(wrapper_device);
        if (devices.size() > 0) {
            for (Device device : devices) {
                String mac = device.getMac();
                deviceMacList.add(mac);
                deviceMap.put(mac, device);
            }
        }
        //获取时间
        String time = parameters.get("time").toString().substring(0, 7) + "-01 00:00:00";
        resultMap.put("time", time);
        QueryWrapper<HistoryMonthly> historyMonthlyQueryWrapper = new QueryWrapper<>();
        historyMonthlyQueryWrapper.eq("time", time);
        historyMonthlyQueryWrapper.in("mac", deviceMacList);
        List<HistoryMonthly> historyDailies = historyMonthlyMapper.selectList(historyMonthlyQueryWrapper);
        List<Object> list = new ArrayList<>();
        for (HistoryMonthly historyDailyData : historyDailies) {
            List<Object> list1 = new ArrayList<>();
            String mac = historyDailyData.getMac();
            Device device = deviceMap.get(mac);
            double longitude = device.getLongitude();
            double latitude = device.getLatitude();
            JSONObject value = JSONObject.parseObject(historyDailyData.getValue());
            double num = Double.parseDouble(value.get(parameters.get("sensor_code")).toString());
            int level = PollutantUtils.pollutantLevel(num, (parameters.get("sensor_code")).toString());
            list1.add(longitude);
            list1.add(latitude);
            list1.add(level);
            list.add(list1);
        }
        resultMap.put("list", list);
        ServicesScope servicesScope = servicesScopeMapper.selectById(servicesScopeId);
        String boundary = servicesScope.getBoundary();
        String[] boundary_points = boundary.split(";");
        List boundary_pointList = new ArrayList();
        List bound = new ArrayList();
        for (String boundary_point:boundary_points) {
            List boundary_point_one = new ArrayList();
            String[] boundary_point_one_array = boundary_point.split(",");
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[0]));
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[1]));
            boundary_pointList.add(boundary_point_one);
        }
        bound.add(boundary_pointList);
        resultMap.put("bound", bound);
        List centerPoint = new ArrayList();
        centerPoint.add(servicesScope.getCenterLongitude());
        centerPoint.add(servicesScope.getCenterLatitude());
        resultMap.put("centerPoint", centerPoint);
        return resultMap;
    }
    @Override
    public List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlot(Map<String, Object> parameters) {
        int orgId = Integer.parseInt(parameters.get("organization_id").toString());
        //定义一个集合,存放所有id
@@ -304,6 +382,95 @@
    }
    @Override
    public List<Map<String, Object>> getThermodynamicDiagramDataByOrgIdSensorCodeTimeSlotV2(Map<String, Object> parameters) {
        int servicesScopeId = Integer.parseInt(parameters.get("servicesScopeId").toString());
        QueryWrapper<ServicesScopeDevice> servicesScopeDeviceQueryWrapper = new QueryWrapper<>();
        servicesScopeDeviceQueryWrapper.eq("is_delete",Constants.NOT_DELETE);
        servicesScopeDeviceQueryWrapper.eq("services_scope_id",servicesScopeId);
        List<ServicesScopeDevice> servicesScopeDevices = servicesScopeDeviceMapper.selectList(servicesScopeDeviceQueryWrapper);
        List<Integer> deviceIds = servicesScopeDevices.stream().map(p -> p.getDeviceId()).collect(Collectors.toList());
        //声明一个list,存放设备mac
        List<String> deviceMacList = new ArrayList<>();
        //声明一个map,Mac作为key,device作为value
        Map<String, Device> deviceMap = new HashMap<>();
        //根据id查询所属设备
        QueryWrapper<Device> wrapper_device = new QueryWrapper<>();
        wrapper_device.eq("is_delete", Constants.NOT_DELETE);
        wrapper_device.in("id",deviceIds);
        List<Device> devices = new ArrayList<>();
        devices = deviceMapper.selectList(wrapper_device);
        if (devices.size() > 0) {
            for (Device device : devices) {
                String mac = device.getMac();
                deviceMacList.add(mac);
                deviceMap.put(mac, device);
            }
        }
        ServicesScope servicesScope = servicesScopeMapper.selectById(servicesScopeId);
        String boundary = servicesScope.getBoundary();
        String[] boundary_points = boundary.split(";");
        List boundary_pointList = new ArrayList();
        List bound = new ArrayList();
        for (String boundary_point:boundary_points) {
            List boundary_point_one = new ArrayList();
            String[] boundary_point_one_array = boundary_point.split(",");
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[0]));
            boundary_point_one.add(Double.parseDouble(boundary_point_one_array[1]));
            boundary_pointList.add(boundary_point_one);
        }
        bound.add(boundary_pointList);
        List centerPoint = new ArrayList();
        centerPoint.add(servicesScope.getCenterLongitude());
        centerPoint.add(servicesScope.getCenterLatitude());
        List<Map<String, Object>> resultList = new ArrayList<>();
        //获取时间
        String endTime = parameters.get("endTime").toString().substring(0, 7) + "-01 00:00:00";
        //获取时间
        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM");
        int months = Integer.parseInt(parameters.get("months").toString());
        Date newEndTime = new Date();
        for (int i = months; i >= 0; i--) {
            Map<String, Object> resultMap = new HashMap<>();
            //先存放中心点和边界点
            resultMap.put("centerPoint", centerPoint);
            resultMap.put("bound", bound);
            Calendar calendar = Calendar.getInstance();
            try {
                newEndTime = df.parse(endTime);
            } catch (ParseException e) {
                e.printStackTrace();
            }
            calendar.setTime(newEndTime);
            calendar.set(Calendar.MONTH, calendar.get(Calendar.MONDAY) - i);
            String time = df.format(calendar.getTime()) + "-01 00:00:00";
            //存放时间
            resultMap.put("time", time);
            QueryWrapper<HistoryMonthly> historyMonthlyQueryWrapper = new QueryWrapper<>();
            historyMonthlyQueryWrapper.eq("time", time);
            historyMonthlyQueryWrapper.in("mac", deviceMacList);
            List<HistoryMonthly> historyDailies = historyMonthlyMapper.selectList(historyMonthlyQueryWrapper);
            List<Object> list = new ArrayList<>();
            for (HistoryMonthly historyMonthlyData : historyDailies) {
                List<Object> list1 = new ArrayList<>();
                String mac = historyMonthlyData.getMac();
                Device device = deviceMap.get(mac);
                double longitude = device.getLongitude();
                double latitude = device.getLatitude();
                JSONObject value = JSONObject.parseObject(historyMonthlyData.getValue());
                double num = Double.parseDouble(value.get(parameters.get("sensor_code")).toString());
                int level = PollutantUtils.pollutantLevel(num, (parameters.get("sensor_code")).toString());
                list1.add(longitude);
                list1.add(latitude);
                list1.add(level);
                list.add(list1);
            }
            resultMap.put("list", list);
            resultList.add(resultMap);
        }
        return resultList;
    }
    @Override
    public List<HistoryMonthly> getValueByMacs(List<String> macs, String time) {
        QueryWrapper<HistoryMonthly> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("time", "value")
screen-api/src/main/java/com/moral/api/service/impl/ServicesScopeDeviceServiceImpl.java
New file
@@ -0,0 +1,20 @@
package com.moral.api.service.impl;
import com.moral.api.entity.ServicesScopeDevice;
import com.moral.api.mapper.ServicesScopeDeviceMapper;
import com.moral.api.service.ServicesScopeDeviceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author moral
 * @since 2022-01-19
 */
@Service
public class ServicesScopeDeviceServiceImpl extends ServiceImpl<ServicesScopeDeviceMapper, ServicesScopeDevice> implements ServicesScopeDeviceService {
}
screen-api/src/main/java/com/moral/api/service/impl/ServicesScopeServiceImpl.java
New file
@@ -0,0 +1,20 @@
package com.moral.api.service.impl;
import com.moral.api.entity.ServicesScope;
import com.moral.api.mapper.ServicesScopeMapper;
import com.moral.api.service.ServicesScopeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author moral
 * @since 2022-01-19
 */
@Service
public class ServicesScopeServiceImpl extends ServiceImpl<ServicesScopeMapper, ServicesScope> implements ServicesScopeService {
}
screen-api/src/main/resources/mapper/ServicesScopeDeviceMapper.xml
New file
@@ -0,0 +1,15 @@
<?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.moral.api.mapper.ServicesScopeDeviceMapper">
        <!-- 通用查询映射结果 -->
        <resultMap id="BaseResultMap" type="com.moral.api.entity.ServicesScopeDevice">
                    <id column="id" property="id" />
                    <result column="services_scope_id" property="servicesScopeId" />
                    <result column="device_id" property="deviceId" />
                    <result column="create_time" property="createTime" />
                    <result column="update_time" property="updateTime" />
                    <result column="is_delete" property="isDelete" />
        </resultMap>
</mapper>
screen-api/src/main/resources/mapper/ServicesScopeMapper.xml
New file
@@ -0,0 +1,18 @@
<?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.moral.api.mapper.ServicesScopeMapper">
        <!-- 通用查询映射结果 -->
        <resultMap id="BaseResultMap" type="com.moral.api.entity.ServicesScope">
                    <id column="id" property="id" />
                    <result column="name" property="name" />
                    <result column="organization_id" property="organizationId" />
                    <result column="center_longitude" property="centerLongitude" />
                    <result column="center_latitude" property="centerLatitude" />
                    <result column="boundary" property="boundary" />
                    <result column="create_time" property="createTime" />
                    <result column="update_time" property="updateTime" />
                    <result column="is_delete" property="isDelete" />
        </resultMap>
</mapper>