2021与蓝度共同重构项目,服务端
zhanzhiqin
2022-03-25 7ba0c94c61c69a81be03a256ab710c0599c2033c
灯杆倾斜警告处理
已修改4个文件
已添加6个文件
264 ■■■■■ 文件已修改
dao/src/main/java/com/sandu/ximon/dao/domain/LightPoleHeeling.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/domain/LightPoleHeelingProcessing.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/mapper/LightPoleHeelingProcessingMapper.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/LightPoleHeelingMapper.xml 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/resources/mapper/LightPoleHeelingProcessingMapper.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LightPoleHeelingController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LightPoleHeelingProcessingController.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/param/LightPoleHeelingProcessingParam.java 55 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightPoleHeelingProcessingServices.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightPoleHeelingService.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
dao/src/main/java/com/sandu/ximon/dao/domain/LightPoleHeeling.java
@@ -29,7 +29,7 @@
    /**
     * è­¦å‘Šç­‰çº§
     */
    private String warningLevel;
    private Integer warningLevel;
    /**
     * Xè½´
dao/src/main/java/com/sandu/ximon/dao/domain/LightPoleHeelingProcessing.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,66 @@
package com.sandu.ximon.dao.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.Data;
/**
 *
 * @TableName light_pole_heeling_processing
 */
@TableName(value ="light_pole_heeling_processing")
@Data
public class LightPoleHeelingProcessing implements Serializable {
    /**
     * å¤„理号
     */
    @TableId
    private Long processingNumber;
    /**
     * è­¦å‘Šå·
     */
    private Long warningNumber;
    /**
     * å¤„理后状态
     */
    private Integer processingState;
    /**
     * å¤„理意见
     */
    private String processingOpinion;
    /**
     * å¤„理人
     */
    private String processingPerson;
    /**
     *
     */
    private LocalDateTime createTime;
    /**
     * å¤„理后Xè½´
     */
    private Double theXAxis;
    /**
     * å¤„理后Yè½´
     */
    private Double theYAxis;
    /**
     * å¤„理后Zè½´
     */
    private Double theZAxis;
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}
dao/src/main/java/com/sandu/ximon/dao/mapper/LightPoleHeelingProcessingMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
package com.sandu.ximon.dao.mapper;
import com.sandu.ximon.dao.domain.LightPoleHeelingProcessing;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
 * @Entity com.sandu.ximon.dao.domain.LightPoleHeelingProcessing
 */
@Mapper
public interface LightPoleHeelingProcessingMapper extends BaseMapper<LightPoleHeelingProcessing> {
}
dao/src/main/resources/mapper/LightPoleHeelingMapper.xml
@@ -7,7 +7,7 @@
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightPoleHeeling">
        <id property="warningNumber" column="warning_number" jdbcType="BIGINT"/>
        <result property="mac" column="mac" jdbcType="VARCHAR"/>
        <result property="warningLevel" column="warning_level" jdbcType="VARCHAR"/>
        <result property="warningLevel" column="warning_level" jdbcType="INTEGER"/>
        <result property="theXAxis" column="the_x_axis" jdbcType="DOUBLE"/>
        <result property="theYAxis" column="the_y_axis" jdbcType="DOUBLE"/>
        <result property="theZAxis" column="the_z_axis" jdbcType="DOUBLE"/>
@@ -16,9 +16,9 @@
    </resultMap>
    <sql id="Base_Column_List">
        id,mac,warning_number,
        warning_level,the_x_axis,the_y_axis,
        the_z_axis,processing_state,create_time
        warning_number,mac,warning_level,
        the_x_axis,the_y_axis,the_z_axis,
        processing_state,create_time
    </sql>
    <select id="listLightPoleHeeling" resultType="com.sandu.ximon.dao.domain.LightPoleHeeling">
        SELECT *
dao/src/main/resources/mapper/LightPoleHeelingProcessingMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,24 @@
<?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.sandu.ximon.dao.mapper.LightPoleHeelingProcessingMapper">
    <resultMap id="BaseResultMap" type="com.sandu.ximon.dao.domain.LightPoleHeelingProcessing">
            <id property="processingNumber" column="processing_number" jdbcType="BIGINT"/>
            <result property="warningNumber" column="warning_number" jdbcType="BIGINT"/>
            <result property="processingState" column="processing_state" jdbcType="INTEGER"/>
            <result property="processingOpinion" column="processing_opinion" jdbcType="VARCHAR"/>
            <result property="processingPerson" column="processing_person" jdbcType="VARCHAR"/>
            <result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
            <result property="theXAxis" column="the_x_axis" jdbcType="DOUBLE"/>
            <result property="theYAxis" column="the_y_axis" jdbcType="DOUBLE"/>
            <result property="theZAxis" column="the_z_axis" jdbcType="DOUBLE"/>
    </resultMap>
    <sql id="Base_Column_List">
        processing_number,warning_number,processing_state,
        processing_opinion,processing_person,create_time,
        the_x_axis,the_y_axis,the_z_axis
    </sql>
</mapper>
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LightPoleHeelingController.java
@@ -15,7 +15,7 @@
import java.util.List;
/**
 * ç¯æ†å€¾æ–œ
 * ç¯æ†å€¾æ–œè­¦å‘Šåˆ—表
 */
@RestController
@AllArgsConstructor
ximon-admin/src/main/java/com/sandu/ximon/admin/controller/LightPoleHeelingProcessingController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
package com.sandu.ximon.admin.controller;
/**
 * @author ZZQ
 * @date 2022/3/25 11:45
 */
import com.sandu.common.domain.ResponseVO;
import com.sandu.common.util.ResponseUtil;
import com.sandu.ximon.admin.param.LightPoleHeelingProcessingParam;
import com.sandu.ximon.admin.service.LightPoleHeelingProcessingServices;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
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;
/**
 * ç¯æ†å€¾æ–œè­¦å‘Šå¤„理列表
 */
@RestController
@AllArgsConstructor
@RequestMapping("/v1/admin/LightPoleHeelingProcessing")
public class LightPoleHeelingProcessingController {
    private LightPoleHeelingProcessingServices lightPoleHeelingProcessingServices;
    /**
     * ç¯æ†å€¾æ–œè­¦å‘Šå¤„理
     *
     * @return
     */
    @PostMapping("/Processing")
    public ResponseVO<Object> ProcessingLightPoleHeeling(@RequestBody @Validated LightPoleHeelingProcessingParam param) {
        return ResponseUtil.success(lightPoleHeelingProcessingServices.ProcessingLightPoleHeeling(param));
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/param/LightPoleHeelingProcessingParam.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,55 @@
package com.sandu.ximon.admin.param;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
/**
 * ç¯æ†å€¾æ–œè­¦å‘Šå¤„理
 *
 * @author ZZQ
 * @date 2022/3/22 15:18
 */
@Data
public class LightPoleHeelingProcessingParam {
    @NotEmpty(message = "灯杆倾斜硬件地址不能为空")
    private String deviceName = "";
    /**
     * è­¦å‘Šå·
     */
    private Long warningNumber;
    /**
     * å¤„理后状态
     */
    private Integer processingState;
    /**
     * å¤„理意见
     */
    private String processingOpinion;
    /**
     * å¤„理人
     */
    private String processingPerson;
    /**
     * å¤„理后Xè½´
     */
    private Double theXAxis;
    /**
     * å¤„理后Yè½´
     */
    private Double theYAxis;
    /**
     * å¤„理后Zè½´
     */
    private Double theZAxis;
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightPoleHeelingProcessingServices.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package com.sandu.ximon.admin.service;
import com.sandu.common.service.impl.BaseServiceImpl;
import com.sandu.ximon.admin.param.LightPoleHeelingProcessingParam;
import com.sandu.ximon.dao.domain.LightPoleHeelingProcessing;
import com.sandu.ximon.dao.mapper.LightPoleHeelingProcessingMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
/**
 * @author ZZQ
 * @date 2022/3/25 11:41
 */
@Service
@AllArgsConstructor
public class LightPoleHeelingProcessingServices extends BaseServiceImpl<LightPoleHeelingProcessingMapper, LightPoleHeelingProcessing> {
    /**
     * ç¯æ†å€¾æ–œè­¦å‘Šå¤„理
     */
    public boolean ProcessingLightPoleHeeling(LightPoleHeelingProcessingParam param) {
        LightPoleHeelingProcessing lightPoleHeelingProcessing = new LightPoleHeelingProcessing();
        lightPoleHeelingProcessing.setProcessingPerson(param.getProcessingPerson());
        lightPoleHeelingProcessing.setProcessingState(param.getProcessingState());
        lightPoleHeelingProcessing.setTheXAxis(param.getTheXAxis());
        lightPoleHeelingProcessing.setTheYAxis(param.getTheYAxis());
        lightPoleHeelingProcessing.setTheZAxis(param.getTheZAxis());
        return save(lightPoleHeelingProcessing);
    }
}
ximon-admin/src/main/java/com/sandu/ximon/admin/service/LightPoleHeelingService.java
@@ -17,7 +17,6 @@
import com.sandu.ximon.dao.mapper.LightPoleHeelingMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -34,8 +33,18 @@
        if (lightPoleHeelingListParam == null) {
            lightPoleHeelingListParam = new LightPoleHeelingListParam();
        }
        List<LightPoleHeeling> lightPoleHeelings
                = lightPoleHeelingMapper.listLightPoleHeeling(lightPoleHeelingListParam.getKeyword().trim(), lightPoleHeelingListParam.getProcessingState());
//        List<LightPoleHeeling> lightPoleHeelings
//                = lightPoleHeelingMapper.listLightPoleHeeling(lightPoleHeelingListParam.getKeyword().trim(), lightPoleHeelingListParam.getProcessingState());
        LambdaQueryWrapper<LightPoleHeeling> wrapper = Wrappers.lambdaQuery(LightPoleHeeling.class);
        wrapper.like(LightPoleHeeling::getWarningNumber, lightPoleHeelingListParam.getKeyword().trim());
        if(lightPoleHeelingListParam.getProcessingState() != 2){
            wrapper.eq(LightPoleHeeling::getProcessingState, lightPoleHeelingListParam.getProcessingState());
        }
        wrapper.eq(LightPoleHeeling::getWarningLevel, 1).or(www -> www.eq(LightPoleHeeling::getWarningLevel, 2));
        List<LightPoleHeeling> lightPoleHeelings = list(wrapper);
        return lightPoleHeelings;
    }
@@ -185,12 +194,12 @@
        lightPoleHeeling.setTheYAxis(heartBeatDataPackage.getTheYAxis());
        lightPoleHeeling.setTheZAxis(heartBeatDataPackage.getTheZAxis());
        if (Math.abs(heartBeatDataPackage.getTheXAxis()) >= 10 || Math.abs(heartBeatDataPackage.getTheYAxis()) >= 10) {
            lightPoleHeeling.setWarningLevel("一级警告");
            lightPoleHeeling.setWarningLevel(1);//一级警告
        } else if ((Math.abs(heartBeatDataPackage.getTheXAxis()) >= 5 && Math.abs(heartBeatDataPackage.getTheXAxis()) < 10)
                || (Math.abs(heartBeatDataPackage.getTheYAxis()) >= 5 && Math.abs(heartBeatDataPackage.getTheYAxis()) < 10)) {
            lightPoleHeeling.setWarningLevel("二级警告");
            lightPoleHeeling.setWarningLevel(2);//二级警告
        } else {
            lightPoleHeeling.setWarningLevel("正常");
            lightPoleHeeling.setWarningLevel(0);//正常
        }
        return save(lightPoleHeeling);