37 changed files with 3746 additions and 34 deletions
@ -0,0 +1,121 @@ |
|||
package com.techsor.datacenter.business.controller; |
|||
|
|||
|
|||
import com.techsor.datacenter.business.common.response.PageInfo; |
|||
import com.techsor.datacenter.business.common.response.PageResponse; |
|||
import com.techsor.datacenter.business.common.response.ResponseCode; |
|||
import com.techsor.datacenter.business.common.response.SimpleDataResponse; |
|||
import com.techsor.datacenter.business.dto.apgateway.*; |
|||
import com.techsor.datacenter.business.model.ApGateway; |
|||
import com.techsor.datacenter.business.service.ApGatewayService; |
|||
import com.techsor.datacenter.business.vo.apgateway.ApGatewayHeartbeatHistoryResponseVO; |
|||
import io.swagger.v3.oas.annotations.Hidden; |
|||
import io.swagger.v3.oas.annotations.Operation; |
|||
import io.swagger.v3.oas.annotations.Parameter; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import io.swagger.v3.oas.annotations.tags.Tag; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
@RestController |
|||
//@AccessRequired
|
|||
@RequestMapping("/apgateway") |
|||
@Tag(name = "ApGatewayController",description = "Ap gateway control") |
|||
@Slf4j |
|||
public class ApGatewayController { |
|||
|
|||
@Autowired |
|||
private ApGatewayService apGatewayService; |
|||
|
|||
@Operation(summary = "Get Gateway clients list by param", description = "") |
|||
@PostMapping(path = "/getListPage") |
|||
public PageResponse<PageInfo<ApGateway>> getApGatewayListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type 0: Chinese 1: English 2: Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Offset between GMT and local time in minutes, e.g., -480 for GMT+8") @RequestHeader(required = true) Integer UTCOffset, |
|||
@RequestBody ApGatewayQueryParam param){ |
|||
PageResponse<PageInfo<ApGateway>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(apGatewayService.query(param, UserId, CompanyId, LanguageType)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
log.error("Error querying device list", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
@Operation(summary = "add", description = "") |
|||
@PostMapping(path = "/add") |
|||
public SimpleDataResponse add( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type 0: Chinese 1: English 2: Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Offset between GMT and local time in minutes, e.g., -480 for GMT+8") @RequestHeader(required = true) Integer UTCOffset, |
|||
@RequestBody ApGatewayAddParam param |
|||
){ |
|||
return apGatewayService.add(param, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@Operation(summary = "edit", description = "") |
|||
@PostMapping(path = "/edit") |
|||
public SimpleDataResponse edit( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type 0: Chinese 1: English 2: Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Offset between GMT and local time in minutes, e.g., -480 for GMT+8") @RequestHeader(required = true) Integer UTCOffset, |
|||
@RequestBody ApGatewayEditParam param |
|||
){ |
|||
return apGatewayService.edit(param, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
@Operation(summary = "Get built-in function list", description = "Retrieve the list of built-in functions") |
|||
@PostMapping(path = "/delete") |
|||
public SimpleDataResponse delete( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type 0: Chinese 1: English 2: Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Offset between GMT and local time in minutes, e.g., -480 for GMT+8") @RequestHeader(required = true) Integer UTCOffset, |
|||
@RequestBody ApGatewayDeleteParam param |
|||
){ |
|||
return apGatewayService.batchDelete(param, UserId, CompanyId, LanguageType); |
|||
} |
|||
|
|||
|
|||
@Hidden |
|||
@Operation(summary = "MQTT statistical history", description = "") |
|||
@PostMapping(path = "/heartbeat/getListPage") |
|||
public PageResponse<PageInfo<ApGatewayHeartbeatHistoryResponseVO>> getStatisticsListPage( |
|||
@Parameter(name = "LoginName", description = "Login name", required = true, schema = @Schema(defaultValue = "admin")) @RequestHeader(required = true) String LoginName, |
|||
@Parameter(name = "AccessToken", description = "Authentication token", required = true) @RequestHeader(required = true) String AccessToken, |
|||
@Parameter(name = "UserId", description = "User ID", required = true, schema = @Schema(defaultValue = "1")) @RequestHeader(required = true) Long UserId, |
|||
@Parameter(name = "CompanyId", description = "User's company ID", required = false, schema = @Schema(defaultValue = "1")) @RequestHeader(required = false) Long CompanyId, |
|||
@Parameter(name = "LanguageType", description = "Language type 0: Chinese 1: English 2: Japanese", required = true, schema = @Schema(defaultValue = "2")) @RequestHeader(required = true) Integer LanguageType, |
|||
@Parameter(name = "UTCOffset", description = "Offset between GMT and local time in minutes, e.g., -480 for GMT+8") @RequestHeader(required = true) Integer UTCOffset, |
|||
@RequestBody ApGatewayHeartbeatQueryParam param){ |
|||
PageResponse<PageInfo<ApGatewayHeartbeatHistoryResponseVO>> pageResponse = new PageResponse<>(); |
|||
try { |
|||
pageResponse.setData(apGatewayService.getApHeartbeatHistoryListPage(param, UserId, CompanyId, LanguageType)); |
|||
pageResponse.setCode(ResponseCode.SUCCESS); |
|||
pageResponse.setMsg("success"); |
|||
} catch (Exception e) { |
|||
log.error("Error heartbeat/getListPage", e); |
|||
pageResponse.setCode(ResponseCode.SERVER_ERROR); |
|||
pageResponse.setMsg("service error"); |
|||
} |
|||
return pageResponse; |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,21 @@ |
|||
CREATE TABLE `ap_gateway` ( |
|||
`ap_gateway_id` bigint NOT NULL AUTO_INCREMENT, |
|||
`model` varchar(45) DEFAULT NULL COMMENT '型号,目前有: L5, EV07', |
|||
`imei` varchar(45) NOT NULL, |
|||
`mac` varchar(45) DEFAULT NULL, |
|||
`create_ts` bigint DEFAULT NULL, |
|||
`update_ts` bigint DEFAULT NULL, |
|||
`address` varchar(500) DEFAULT NULL, |
|||
`gps` varchar(100) DEFAULT NULL, |
|||
`latest_heartbeat_ts` bigint DEFAULT NULL, |
|||
`online_status` int DEFAULT '0' COMMENT '在线标记,1:在线,0:离线', |
|||
`battery` decimal(5,2) DEFAULT '-1.00' COMMENT '电量百分比,-1为无数据或无电池', |
|||
`flag` int DEFAULT NULL, |
|||
`company_id` bigint DEFAULT NULL, |
|||
`offline_interval` int DEFAULT '10', |
|||
`ack_flag` int DEFAULT NULL COMMENT '是否是ack下行,1:是,0:否', |
|||
`downlink_id` varchar(45) DEFAULT NULL COMMENT '下行ID,在Eview中就是sequenceId', |
|||
`auth_user_id` varchar(255) DEFAULT NULL COMMENT '认证用户ID', |
|||
`auth_pwd` varchar(255) DEFAULT NULL COMMENT '认证密码', |
|||
PRIMARY KEY (`ap_gateway_id`) |
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='硬件网关管理表'; |
|||
@ -0,0 +1,3 @@ |
|||
|
|||
ALTER TABLE basic_building ADD `salesforce_primary_id` bigint COMMENT 'salesforce表的主键ID'; |
|||
|
|||
@ -0,0 +1,96 @@ |
|||
package com.techsor.datacenter.business.dao.auto; |
|||
|
|||
import com.techsor.datacenter.business.model.ApGateway; |
|||
import com.techsor.datacenter.business.model.ApGatewayExample; |
|||
import java.util.List; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
public interface ApGatewayMapper { |
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
long countByExample(ApGatewayExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByExample(ApGatewayExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int deleteByPrimaryKey(Long apGatewayId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insert(ApGateway record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int insertSelective(ApGateway record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
List<ApGateway> selectByExample(ApGatewayExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
ApGateway selectByPrimaryKey(Long apGatewayId); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExampleSelective(@Param("record") ApGateway record, @Param("example") ApGatewayExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByExample(@Param("record") ApGateway record, @Param("example") ApGatewayExample example); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKeySelective(ApGateway record); |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
int updateByPrimaryKey(ApGateway record); |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
package com.techsor.datacenter.business.dao.ex; |
|||
|
|||
import com.techsor.datacenter.business.dao.auto.ApGatewayMapper; |
|||
import com.techsor.datacenter.business.dto.apgateway.ApGatewayQueryParam; |
|||
import com.techsor.datacenter.business.model.ApGateway; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Mapper |
|||
public interface ApGatewayMapperExt extends ApGatewayMapper { |
|||
|
|||
List<ApGateway> getListPage(@Param("param") ApGatewayQueryParam param, @Param("companyId") Long companyId); |
|||
|
|||
} |
|||
@ -0,0 +1,477 @@ |
|||
<?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.techsor.datacenter.business.dao.auto.ApGatewayMapper"> |
|||
<resultMap id="BaseResultMap" type="com.techsor.datacenter.business.model.ApGateway"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
<id column="ap_gateway_id" jdbcType="BIGINT" property="apGatewayId" /> |
|||
<result column="model" jdbcType="VARCHAR" property="model" /> |
|||
<result column="imei" jdbcType="VARCHAR" property="imei" /> |
|||
<result column="mac" jdbcType="VARCHAR" property="mac" /> |
|||
<result column="create_ts" jdbcType="BIGINT" property="createTs" /> |
|||
<result column="update_ts" jdbcType="BIGINT" property="updateTs" /> |
|||
<result column="address" jdbcType="VARCHAR" property="address" /> |
|||
<result column="gps" jdbcType="VARCHAR" property="gps" /> |
|||
<result column="latest_heartbeat_ts" jdbcType="BIGINT" property="latestHeartbeatTs" /> |
|||
<result column="online_status" jdbcType="INTEGER" property="onlineStatus" /> |
|||
<result column="battery" jdbcType="DECIMAL" property="battery" /> |
|||
<result column="flag" jdbcType="INTEGER" property="flag" /> |
|||
<result column="company_id" jdbcType="BIGINT" property="companyId" /> |
|||
<result column="offline_interval" jdbcType="INTEGER" property="offlineInterval" /> |
|||
<result column="ack_flag" jdbcType="INTEGER" property="ackFlag" /> |
|||
<result column="downlink_id" jdbcType="VARCHAR" property="downlinkId" /> |
|||
<result column="auth_user_id" jdbcType="VARCHAR" property="authUserId" /> |
|||
<result column="auth_pwd" jdbcType="VARCHAR" property="authPwd" /> |
|||
</resultMap> |
|||
<sql id="Example_Where_Clause"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
<where> |
|||
<foreach collection="oredCriteria" item="criteria" separator="or"> |
|||
<if test="criteria.valid"> |
|||
<trim prefix="(" prefixOverrides="and" suffix=")"> |
|||
<foreach collection="criteria.criteria" item="criterion"> |
|||
<choose> |
|||
<when test="criterion.noValue"> |
|||
and ${criterion.condition} |
|||
</when> |
|||
<when test="criterion.singleValue"> |
|||
and ${criterion.condition} #{criterion.value} |
|||
</when> |
|||
<when test="criterion.betweenValue"> |
|||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
|||
</when> |
|||
<when test="criterion.listValue"> |
|||
and ${criterion.condition} |
|||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
|||
#{listItem} |
|||
</foreach> |
|||
</when> |
|||
</choose> |
|||
</foreach> |
|||
</trim> |
|||
</if> |
|||
</foreach> |
|||
</where> |
|||
</sql> |
|||
<sql id="Update_By_Example_Where_Clause"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
<where> |
|||
<foreach collection="example.oredCriteria" item="criteria" separator="or"> |
|||
<if test="criteria.valid"> |
|||
<trim prefix="(" prefixOverrides="and" suffix=")"> |
|||
<foreach collection="criteria.criteria" item="criterion"> |
|||
<choose> |
|||
<when test="criterion.noValue"> |
|||
and ${criterion.condition} |
|||
</when> |
|||
<when test="criterion.singleValue"> |
|||
and ${criterion.condition} #{criterion.value} |
|||
</when> |
|||
<when test="criterion.betweenValue"> |
|||
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} |
|||
</when> |
|||
<when test="criterion.listValue"> |
|||
and ${criterion.condition} |
|||
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
|||
#{listItem} |
|||
</foreach> |
|||
</when> |
|||
</choose> |
|||
</foreach> |
|||
</trim> |
|||
</if> |
|||
</foreach> |
|||
</where> |
|||
</sql> |
|||
<sql id="Base_Column_List"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
ap_gateway_id, model, imei, mac, create_ts, update_ts, address, gps, latest_heartbeat_ts, |
|||
online_status, battery, flag, company_id, offline_interval, ack_flag, downlink_id, |
|||
auth_user_id, auth_pwd |
|||
</sql> |
|||
<select id="selectByExample" parameterType="com.techsor.datacenter.business.model.ApGatewayExample" resultMap="BaseResultMap"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
select |
|||
<if test="distinct"> |
|||
distinct |
|||
</if> |
|||
'true' as QUERYID, |
|||
<include refid="Base_Column_List" /> |
|||
from ap_gateway |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
<if test="orderByClause != null"> |
|||
order by ${orderByClause} |
|||
</if> |
|||
</select> |
|||
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
select |
|||
<include refid="Base_Column_List" /> |
|||
from ap_gateway |
|||
where ap_gateway_id = #{apGatewayId,jdbcType=BIGINT} |
|||
</select> |
|||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
delete from ap_gateway |
|||
where ap_gateway_id = #{apGatewayId,jdbcType=BIGINT} |
|||
</delete> |
|||
<delete id="deleteByExample" parameterType="com.techsor.datacenter.business.model.ApGatewayExample"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
delete from ap_gateway |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
</delete> |
|||
<insert id="insert" parameterType="com.techsor.datacenter.business.model.ApGateway"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
<selectKey keyProperty="apGatewayId" order="AFTER" resultType="java.lang.Long"> |
|||
SELECT LAST_INSERT_ID() |
|||
</selectKey> |
|||
insert into ap_gateway (model, imei, mac, |
|||
create_ts, update_ts, address, |
|||
gps, latest_heartbeat_ts, online_status, |
|||
battery, flag, company_id, |
|||
offline_interval, ack_flag, downlink_id, |
|||
auth_user_id, auth_pwd) |
|||
values (#{model,jdbcType=VARCHAR}, #{imei,jdbcType=VARCHAR}, #{mac,jdbcType=VARCHAR}, |
|||
#{createTs,jdbcType=BIGINT}, #{updateTs,jdbcType=BIGINT}, #{address,jdbcType=VARCHAR}, |
|||
#{gps,jdbcType=VARCHAR}, #{latestHeartbeatTs,jdbcType=BIGINT}, #{onlineStatus,jdbcType=INTEGER}, |
|||
#{battery,jdbcType=DECIMAL}, #{flag,jdbcType=INTEGER}, #{companyId,jdbcType=BIGINT}, |
|||
#{offlineInterval,jdbcType=INTEGER}, #{ackFlag,jdbcType=INTEGER}, #{downlinkId,jdbcType=VARCHAR}, |
|||
#{authUserId,jdbcType=VARCHAR}, #{authPwd,jdbcType=VARCHAR}) |
|||
</insert> |
|||
<insert id="insertSelective" parameterType="com.techsor.datacenter.business.model.ApGateway"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
<selectKey keyProperty="apGatewayId" order="AFTER" resultType="java.lang.Long"> |
|||
SELECT LAST_INSERT_ID() |
|||
</selectKey> |
|||
insert into ap_gateway |
|||
<trim prefix="(" suffix=")" suffixOverrides=","> |
|||
<if test="model != null"> |
|||
model, |
|||
</if> |
|||
<if test="imei != null"> |
|||
imei, |
|||
</if> |
|||
<if test="mac != null"> |
|||
mac, |
|||
</if> |
|||
<if test="createTs != null"> |
|||
create_ts, |
|||
</if> |
|||
<if test="updateTs != null"> |
|||
update_ts, |
|||
</if> |
|||
<if test="address != null"> |
|||
address, |
|||
</if> |
|||
<if test="gps != null"> |
|||
gps, |
|||
</if> |
|||
<if test="latestHeartbeatTs != null"> |
|||
latest_heartbeat_ts, |
|||
</if> |
|||
<if test="onlineStatus != null"> |
|||
online_status, |
|||
</if> |
|||
<if test="battery != null"> |
|||
battery, |
|||
</if> |
|||
<if test="flag != null"> |
|||
flag, |
|||
</if> |
|||
<if test="companyId != null"> |
|||
company_id, |
|||
</if> |
|||
<if test="offlineInterval != null"> |
|||
offline_interval, |
|||
</if> |
|||
<if test="ackFlag != null"> |
|||
ack_flag, |
|||
</if> |
|||
<if test="downlinkId != null"> |
|||
downlink_id, |
|||
</if> |
|||
<if test="authUserId != null"> |
|||
auth_user_id, |
|||
</if> |
|||
<if test="authPwd != null"> |
|||
auth_pwd, |
|||
</if> |
|||
</trim> |
|||
<trim prefix="values (" suffix=")" suffixOverrides=","> |
|||
<if test="model != null"> |
|||
#{model,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="imei != null"> |
|||
#{imei,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="mac != null"> |
|||
#{mac,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="createTs != null"> |
|||
#{createTs,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="updateTs != null"> |
|||
#{updateTs,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="address != null"> |
|||
#{address,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="gps != null"> |
|||
#{gps,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="latestHeartbeatTs != null"> |
|||
#{latestHeartbeatTs,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="onlineStatus != null"> |
|||
#{onlineStatus,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="battery != null"> |
|||
#{battery,jdbcType=DECIMAL}, |
|||
</if> |
|||
<if test="flag != null"> |
|||
#{flag,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="companyId != null"> |
|||
#{companyId,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="offlineInterval != null"> |
|||
#{offlineInterval,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="ackFlag != null"> |
|||
#{ackFlag,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="downlinkId != null"> |
|||
#{downlinkId,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="authUserId != null"> |
|||
#{authUserId,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="authPwd != null"> |
|||
#{authPwd,jdbcType=VARCHAR}, |
|||
</if> |
|||
</trim> |
|||
</insert> |
|||
<select id="countByExample" parameterType="com.techsor.datacenter.business.model.ApGatewayExample" resultType="java.lang.Long"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
select count(*) from ap_gateway |
|||
<if test="_parameter != null"> |
|||
<include refid="Example_Where_Clause" /> |
|||
</if> |
|||
</select> |
|||
<update id="updateByExampleSelective" parameterType="map"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
update ap_gateway |
|||
<set> |
|||
<if test="record.apGatewayId != null"> |
|||
ap_gateway_id = #{record.apGatewayId,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="record.model != null"> |
|||
model = #{record.model,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.imei != null"> |
|||
imei = #{record.imei,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.mac != null"> |
|||
mac = #{record.mac,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.createTs != null"> |
|||
create_ts = #{record.createTs,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="record.updateTs != null"> |
|||
update_ts = #{record.updateTs,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="record.address != null"> |
|||
address = #{record.address,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.gps != null"> |
|||
gps = #{record.gps,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.latestHeartbeatTs != null"> |
|||
latest_heartbeat_ts = #{record.latestHeartbeatTs,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="record.onlineStatus != null"> |
|||
online_status = #{record.onlineStatus,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="record.battery != null"> |
|||
battery = #{record.battery,jdbcType=DECIMAL}, |
|||
</if> |
|||
<if test="record.flag != null"> |
|||
flag = #{record.flag,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="record.companyId != null"> |
|||
company_id = #{record.companyId,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="record.offlineInterval != null"> |
|||
offline_interval = #{record.offlineInterval,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="record.ackFlag != null"> |
|||
ack_flag = #{record.ackFlag,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="record.downlinkId != null"> |
|||
downlink_id = #{record.downlinkId,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.authUserId != null"> |
|||
auth_user_id = #{record.authUserId,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="record.authPwd != null"> |
|||
auth_pwd = #{record.authPwd,jdbcType=VARCHAR}, |
|||
</if> |
|||
</set> |
|||
<if test="_parameter != null"> |
|||
<include refid="Update_By_Example_Where_Clause" /> |
|||
</if> |
|||
</update> |
|||
<update id="updateByExample" parameterType="map"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
update ap_gateway |
|||
set ap_gateway_id = #{record.apGatewayId,jdbcType=BIGINT}, |
|||
model = #{record.model,jdbcType=VARCHAR}, |
|||
imei = #{record.imei,jdbcType=VARCHAR}, |
|||
mac = #{record.mac,jdbcType=VARCHAR}, |
|||
create_ts = #{record.createTs,jdbcType=BIGINT}, |
|||
update_ts = #{record.updateTs,jdbcType=BIGINT}, |
|||
address = #{record.address,jdbcType=VARCHAR}, |
|||
gps = #{record.gps,jdbcType=VARCHAR}, |
|||
latest_heartbeat_ts = #{record.latestHeartbeatTs,jdbcType=BIGINT}, |
|||
online_status = #{record.onlineStatus,jdbcType=INTEGER}, |
|||
battery = #{record.battery,jdbcType=DECIMAL}, |
|||
flag = #{record.flag,jdbcType=INTEGER}, |
|||
company_id = #{record.companyId,jdbcType=BIGINT}, |
|||
offline_interval = #{record.offlineInterval,jdbcType=INTEGER}, |
|||
ack_flag = #{record.ackFlag,jdbcType=INTEGER}, |
|||
downlink_id = #{record.downlinkId,jdbcType=VARCHAR}, |
|||
auth_user_id = #{record.authUserId,jdbcType=VARCHAR}, |
|||
auth_pwd = #{record.authPwd,jdbcType=VARCHAR} |
|||
<if test="_parameter != null"> |
|||
<include refid="Update_By_Example_Where_Clause" /> |
|||
</if> |
|||
</update> |
|||
<update id="updateByPrimaryKeySelective" parameterType="com.techsor.datacenter.business.model.ApGateway"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
update ap_gateway |
|||
<set> |
|||
<if test="model != null"> |
|||
model = #{model,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="imei != null"> |
|||
imei = #{imei,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="mac != null"> |
|||
mac = #{mac,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="createTs != null"> |
|||
create_ts = #{createTs,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="updateTs != null"> |
|||
update_ts = #{updateTs,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="address != null"> |
|||
address = #{address,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="gps != null"> |
|||
gps = #{gps,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="latestHeartbeatTs != null"> |
|||
latest_heartbeat_ts = #{latestHeartbeatTs,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="onlineStatus != null"> |
|||
online_status = #{onlineStatus,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="battery != null"> |
|||
battery = #{battery,jdbcType=DECIMAL}, |
|||
</if> |
|||
<if test="flag != null"> |
|||
flag = #{flag,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="companyId != null"> |
|||
company_id = #{companyId,jdbcType=BIGINT}, |
|||
</if> |
|||
<if test="offlineInterval != null"> |
|||
offline_interval = #{offlineInterval,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="ackFlag != null"> |
|||
ack_flag = #{ackFlag,jdbcType=INTEGER}, |
|||
</if> |
|||
<if test="downlinkId != null"> |
|||
downlink_id = #{downlinkId,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="authUserId != null"> |
|||
auth_user_id = #{authUserId,jdbcType=VARCHAR}, |
|||
</if> |
|||
<if test="authPwd != null"> |
|||
auth_pwd = #{authPwd,jdbcType=VARCHAR}, |
|||
</if> |
|||
</set> |
|||
where ap_gateway_id = #{apGatewayId,jdbcType=BIGINT} |
|||
</update> |
|||
<update id="updateByPrimaryKey" parameterType="com.techsor.datacenter.business.model.ApGateway"> |
|||
<!-- |
|||
WARNING - @mbg.generated |
|||
This element is automatically generated by MyBatis Generator, do not modify. |
|||
--> |
|||
update ap_gateway |
|||
set model = #{model,jdbcType=VARCHAR}, |
|||
imei = #{imei,jdbcType=VARCHAR}, |
|||
mac = #{mac,jdbcType=VARCHAR}, |
|||
create_ts = #{createTs,jdbcType=BIGINT}, |
|||
update_ts = #{updateTs,jdbcType=BIGINT}, |
|||
address = #{address,jdbcType=VARCHAR}, |
|||
gps = #{gps,jdbcType=VARCHAR}, |
|||
latest_heartbeat_ts = #{latestHeartbeatTs,jdbcType=BIGINT}, |
|||
online_status = #{onlineStatus,jdbcType=INTEGER}, |
|||
battery = #{battery,jdbcType=DECIMAL}, |
|||
flag = #{flag,jdbcType=INTEGER}, |
|||
company_id = #{companyId,jdbcType=BIGINT}, |
|||
offline_interval = #{offlineInterval,jdbcType=INTEGER}, |
|||
ack_flag = #{ackFlag,jdbcType=INTEGER}, |
|||
downlink_id = #{downlinkId,jdbcType=VARCHAR}, |
|||
auth_user_id = #{authUserId,jdbcType=VARCHAR}, |
|||
auth_pwd = #{authPwd,jdbcType=VARCHAR} |
|||
where ap_gateway_id = #{apGatewayId,jdbcType=BIGINT} |
|||
</update> |
|||
</mapper> |
|||
@ -0,0 +1,41 @@ |
|||
<?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.techsor.datacenter.business.dao.ex.ApGatewayMapperExt"> |
|||
|
|||
|
|||
<select id="getListPage" resultType="com.techsor.datacenter.business.model.ApGateway"> |
|||
select |
|||
ap_gateway_id as apGatewayId, |
|||
imei as imei, |
|||
mac as mac, |
|||
create_ts as createTs, |
|||
update_ts as updateTs, |
|||
address as address, |
|||
gps as gps, |
|||
latest_heartbeat_ts as latestHeartbeatTs, |
|||
online_status as onlineStatus, |
|||
battery as battery, |
|||
offline_interval as offlineInterval, |
|||
model as model, |
|||
ack_flag as ackFlag, |
|||
flag as flag, |
|||
auth_user_id, |
|||
auth_pwd |
|||
from |
|||
ap_gateway |
|||
<where> |
|||
<if test="param.imei != null and param.imei != ''"> |
|||
and ap_gateway.imei like CONCAT('%',#{param.imei},'%') |
|||
</if> |
|||
<if test="param.mac != null and param.mac != ''"> |
|||
and ap_gateway.mac like CONCAT('%',#{param.mac},'%') |
|||
</if> |
|||
<if test="param.onlineStstus != null"> |
|||
and ap_gateway.online_status = #{param.onlineStstus} |
|||
</if> |
|||
and ap_gateway.flag = 0 and ap_gateway.company_id = #{companyId} |
|||
</where> |
|||
|
|||
</select> |
|||
|
|||
</mapper> |
|||
@ -0,0 +1,50 @@ |
|||
package com.techsor.datacenter.business.dto.apgateway; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author zhc |
|||
* @time 2024年6月27日 |
|||
*/ |
|||
|
|||
//CREATE TABLE `ap_gateway` (
|
|||
// `ap_gateway_id` int NOT NULL AUTO_INCREMENT,
|
|||
// `imei` varchar(45) NOT NULL,
|
|||
// `mac` varchar(45) DEFAULT NULL,
|
|||
// `create_ts` bigint DEFAULT NULL,
|
|||
// `address` varchar(500) DEFAULT NULL,
|
|||
// `gps` varchar(100) DEFAULT NULL,
|
|||
// `latest_heartbeat_ts` bigint DEFAULT NULL,
|
|||
// `online_status` int DEFAULT '0' COMMENT '在线标记,1:在线,0:离线',
|
|||
// `flag` int DEFAULT NULL,
|
|||
//PRIMARY KEY (`ap_gateway_id`)
|
|||
//) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='硬件网关管理表';
|
|||
|
|||
@Data |
|||
public class ApGatewayAddParam { |
|||
|
|||
@Schema(description ="imei", example = "111") |
|||
private String imei; |
|||
@Schema(description ="mac", example = "111") |
|||
private String mac; |
|||
@Schema(description ="address", example = "111") |
|||
private String address; |
|||
@Schema(description ="offline interval", example = "111") |
|||
private Integer offlineInterval; |
|||
@Schema(description ="L5, Ev07, csdj, Other", example = "csdj") |
|||
private String model; |
|||
@Schema(description ="auth ID", example = "csdj") |
|||
private String authUserId; |
|||
@Schema(description ="auth password", example = "csdj") |
|||
private String authPwd; |
|||
// @Schema(description ="flag", example = "111")
|
|||
// private Integer flag;
|
|||
// @Schema(description ="online_status", example = "111")
|
|||
// private Integer online_status;
|
|||
// @Schema(description ="create_ts", example = "111")
|
|||
// private Long create_ts;
|
|||
// @Schema(description ="latest_heartbeat_ts", example = "111")
|
|||
// private Long latest_heartbeat_ts;
|
|||
|
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package com.techsor.datacenter.business.dto.apgateway; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author zhc |
|||
* @time 2024年6月27日 |
|||
*/ |
|||
|
|||
//CREATE TABLE `ap_gateway` (
|
|||
// `ap_gateway_id` int NOT NULL AUTO_INCREMENT,
|
|||
// `imei` varchar(45) NOT NULL,
|
|||
// `mac` varchar(45) DEFAULT NULL,
|
|||
// `create_ts` bigint DEFAULT NULL,
|
|||
// `update_ts` bigint DEFAULT NULL,
|
|||
// `address` varchar(500) DEFAULT NULL,
|
|||
// `gps` varchar(100) DEFAULT NULL,
|
|||
// `latest_heartbeat_ts` bigint DEFAULT NULL,
|
|||
// `online_status` int DEFAULT '0' COMMENT '在线标记,1:在线,0:离线',
|
|||
// `flag` int DEFAULT NULL,
|
|||
//PRIMARY KEY (`ap_gateway_id`)
|
|||
//) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='硬件网关管理表';
|
|||
|
|||
@Data |
|||
public class ApGatewayDeleteParam { |
|||
@Schema(description ="ap_gateway_id", example = "1,2,3") |
|||
private String apGatewayIds; |
|||
|
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
package com.techsor.datacenter.business.dto.apgateway; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author zhc |
|||
* @time 2024年6月27日 |
|||
*/ |
|||
|
|||
//CREATE TABLE `ap_gateway` (
|
|||
// `ap_gateway_id` int NOT NULL AUTO_INCREMENT,
|
|||
// `imei` varchar(45) NOT NULL,
|
|||
// `mac` varchar(45) DEFAULT NULL,
|
|||
// `create_ts` bigint DEFAULT NULL,
|
|||
// `update_ts` bigint DEFAULT NULL,
|
|||
// `address` varchar(500) DEFAULT NULL,
|
|||
// `gps` varchar(100) DEFAULT NULL,
|
|||
// `latest_heartbeat_ts` bigint DEFAULT NULL,
|
|||
// `online_status` int DEFAULT '0' COMMENT '在线标记,1:在线,0:离线',
|
|||
// `flag` int DEFAULT NULL,
|
|||
//PRIMARY KEY (`ap_gateway_id`)
|
|||
//) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='硬件网关管理表';
|
|||
|
|||
@Data |
|||
public class ApGatewayEditParam { |
|||
@Schema(description ="ap_gateway_id", example = "111") |
|||
private long apGatewayId; |
|||
@Schema(description ="imei", example = "111") |
|||
private String imei; |
|||
@Schema(description ="mac", example = "111") |
|||
private String mac; |
|||
@Schema(description ="address", example = "111") |
|||
private String address; |
|||
@Schema(description ="offline interval", example = "111") |
|||
private Integer offlineInterval; |
|||
@Schema(description ="L5, Ev07, Other", example = "111") |
|||
private String model; |
|||
@Schema(description ="L5, Ev07, csdj, Other", example = "csdj") |
|||
private String authUserId; |
|||
@Schema(description ="authUserId", example = "csdj") |
|||
private String authPwd; |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.techsor.datacenter.business.dto.apgateway; |
|||
|
|||
import com.techsor.datacenter.business.dto.BaseSearchParams; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author zhc |
|||
* @time 2024年6月27日 |
|||
*/ |
|||
@Data |
|||
public class ApGatewayHeartbeatQueryParam extends BaseSearchParams { |
|||
|
|||
@Schema(description ="ap gateway id", example = "123") |
|||
private Long apGatewayId; |
|||
|
|||
@Schema(description ="start time", example = "123123") |
|||
private String startTs; |
|||
|
|||
@Schema(description ="end time", example = "123123") |
|||
private String endTs; |
|||
} |
|||
@ -0,0 +1,22 @@ |
|||
package com.techsor.datacenter.business.dto.apgateway; |
|||
|
|||
import com.techsor.datacenter.business.dto.BaseSearchParams; |
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author zhc |
|||
* @time 2024年6月27日 |
|||
*/ |
|||
@Data |
|||
public class ApGatewayQueryParam extends BaseSearchParams { |
|||
|
|||
@Schema(description ="client name keywords", example = "loytech") |
|||
private String imei; |
|||
|
|||
@Schema(description ="client id keywords", example = "111") |
|||
private String mac; |
|||
|
|||
@Schema(description ="ap status , 0:offline,1:online", example = "0") |
|||
private Integer onlineStstus; |
|||
} |
|||
@ -0,0 +1,14 @@ |
|||
package com.techsor.datacenter.business.dto.apgateway; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class ApGatewayResponseEntity { |
|||
private String model; |
|||
private String imei; |
|||
private String mac; |
|||
private String address; |
|||
private String gps; |
|||
private Long latestHeartbeatTs; |
|||
private Integer onlineStatus; |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
package com.techsor.datacenter.business.entity.gateway; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class AuthInfo { |
|||
|
|||
String authUserId; |
|||
String authPwd; |
|||
} |
|||
@ -0,0 +1,643 @@ |
|||
package com.techsor.datacenter.business.model; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
public class ApGateway implements Serializable { |
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.ap_gateway_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private Long apGatewayId; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.model |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private String model; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.imei |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private String imei; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.mac |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private String mac; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.create_ts |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private Long createTs; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.update_ts |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private Long updateTs; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.address |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private String address; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.gps |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private String gps; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.latest_heartbeat_ts |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private Long latestHeartbeatTs; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.online_status |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private Integer onlineStatus; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.battery |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private BigDecimal battery; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.flag |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private Integer flag; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.company_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private Long companyId; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.offline_interval |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private Integer offlineInterval; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.ack_flag |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private Integer ackFlag; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.downlink_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private String downlinkId; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.auth_user_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private String authUserId; |
|||
|
|||
/** |
|||
* |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database column ap_gateway.auth_pwd |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private String authPwd; |
|||
|
|||
/** |
|||
* This field was generated by MyBatis Generator. |
|||
* This field corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.ap_gateway_id |
|||
* |
|||
* @return the value of ap_gateway.ap_gateway_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public Long getApGatewayId() { |
|||
return apGatewayId; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.ap_gateway_id |
|||
* |
|||
* @param apGatewayId the value for ap_gateway.ap_gateway_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setApGatewayId(Long apGatewayId) { |
|||
this.apGatewayId = apGatewayId; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.model |
|||
* |
|||
* @return the value of ap_gateway.model |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public String getModel() { |
|||
return model; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.model |
|||
* |
|||
* @param model the value for ap_gateway.model |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setModel(String model) { |
|||
this.model = model == null ? null : model.trim(); |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.imei |
|||
* |
|||
* @return the value of ap_gateway.imei |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public String getImei() { |
|||
return imei; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.imei |
|||
* |
|||
* @param imei the value for ap_gateway.imei |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setImei(String imei) { |
|||
this.imei = imei == null ? null : imei.trim(); |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.mac |
|||
* |
|||
* @return the value of ap_gateway.mac |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public String getMac() { |
|||
return mac; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.mac |
|||
* |
|||
* @param mac the value for ap_gateway.mac |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setMac(String mac) { |
|||
this.mac = mac == null ? null : mac.trim(); |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.create_ts |
|||
* |
|||
* @return the value of ap_gateway.create_ts |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public Long getCreateTs() { |
|||
return createTs; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.create_ts |
|||
* |
|||
* @param createTs the value for ap_gateway.create_ts |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setCreateTs(Long createTs) { |
|||
this.createTs = createTs; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.update_ts |
|||
* |
|||
* @return the value of ap_gateway.update_ts |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public Long getUpdateTs() { |
|||
return updateTs; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.update_ts |
|||
* |
|||
* @param updateTs the value for ap_gateway.update_ts |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setUpdateTs(Long updateTs) { |
|||
this.updateTs = updateTs; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.address |
|||
* |
|||
* @return the value of ap_gateway.address |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public String getAddress() { |
|||
return address; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.address |
|||
* |
|||
* @param address the value for ap_gateway.address |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setAddress(String address) { |
|||
this.address = address == null ? null : address.trim(); |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.gps |
|||
* |
|||
* @return the value of ap_gateway.gps |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public String getGps() { |
|||
return gps; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.gps |
|||
* |
|||
* @param gps the value for ap_gateway.gps |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setGps(String gps) { |
|||
this.gps = gps == null ? null : gps.trim(); |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.latest_heartbeat_ts |
|||
* |
|||
* @return the value of ap_gateway.latest_heartbeat_ts |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public Long getLatestHeartbeatTs() { |
|||
return latestHeartbeatTs; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.latest_heartbeat_ts |
|||
* |
|||
* @param latestHeartbeatTs the value for ap_gateway.latest_heartbeat_ts |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setLatestHeartbeatTs(Long latestHeartbeatTs) { |
|||
this.latestHeartbeatTs = latestHeartbeatTs; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.online_status |
|||
* |
|||
* @return the value of ap_gateway.online_status |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public Integer getOnlineStatus() { |
|||
return onlineStatus; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.online_status |
|||
* |
|||
* @param onlineStatus the value for ap_gateway.online_status |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setOnlineStatus(Integer onlineStatus) { |
|||
this.onlineStatus = onlineStatus; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.battery |
|||
* |
|||
* @return the value of ap_gateway.battery |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public BigDecimal getBattery() { |
|||
return battery; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.battery |
|||
* |
|||
* @param battery the value for ap_gateway.battery |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setBattery(BigDecimal battery) { |
|||
this.battery = battery; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.flag |
|||
* |
|||
* @return the value of ap_gateway.flag |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public Integer getFlag() { |
|||
return flag; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.flag |
|||
* |
|||
* @param flag the value for ap_gateway.flag |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setFlag(Integer flag) { |
|||
this.flag = flag; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.company_id |
|||
* |
|||
* @return the value of ap_gateway.company_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public Long getCompanyId() { |
|||
return companyId; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.company_id |
|||
* |
|||
* @param companyId the value for ap_gateway.company_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setCompanyId(Long companyId) { |
|||
this.companyId = companyId; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.offline_interval |
|||
* |
|||
* @return the value of ap_gateway.offline_interval |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public Integer getOfflineInterval() { |
|||
return offlineInterval; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.offline_interval |
|||
* |
|||
* @param offlineInterval the value for ap_gateway.offline_interval |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setOfflineInterval(Integer offlineInterval) { |
|||
this.offlineInterval = offlineInterval; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.ack_flag |
|||
* |
|||
* @return the value of ap_gateway.ack_flag |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public Integer getAckFlag() { |
|||
return ackFlag; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.ack_flag |
|||
* |
|||
* @param ackFlag the value for ap_gateway.ack_flag |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setAckFlag(Integer ackFlag) { |
|||
this.ackFlag = ackFlag; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.downlink_id |
|||
* |
|||
* @return the value of ap_gateway.downlink_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public String getDownlinkId() { |
|||
return downlinkId; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.downlink_id |
|||
* |
|||
* @param downlinkId the value for ap_gateway.downlink_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setDownlinkId(String downlinkId) { |
|||
this.downlinkId = downlinkId == null ? null : downlinkId.trim(); |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.auth_user_id |
|||
* |
|||
* @return the value of ap_gateway.auth_user_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public String getAuthUserId() { |
|||
return authUserId; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.auth_user_id |
|||
* |
|||
* @param authUserId the value for ap_gateway.auth_user_id |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setAuthUserId(String authUserId) { |
|||
this.authUserId = authUserId == null ? null : authUserId.trim(); |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method returns the value of the database column ap_gateway.auth_pwd |
|||
* |
|||
* @return the value of ap_gateway.auth_pwd |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public String getAuthPwd() { |
|||
return authPwd; |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method sets the value of the database column ap_gateway.auth_pwd |
|||
* |
|||
* @param authPwd the value for ap_gateway.auth_pwd |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
public void setAuthPwd(String authPwd) { |
|||
this.authPwd = authPwd == null ? null : authPwd.trim(); |
|||
} |
|||
|
|||
/** |
|||
* This method was generated by MyBatis Generator. |
|||
* This method corresponds to the database table ap_gateway |
|||
* |
|||
* @mbg.generated |
|||
*/ |
|||
@Override |
|||
public String toString() { |
|||
StringBuilder sb = new StringBuilder(); |
|||
sb.append(getClass().getSimpleName()); |
|||
sb.append(" ["); |
|||
sb.append("Hash = ").append(hashCode()); |
|||
sb.append(", apGatewayId=").append(apGatewayId); |
|||
sb.append(", model=").append(model); |
|||
sb.append(", imei=").append(imei); |
|||
sb.append(", mac=").append(mac); |
|||
sb.append(", createTs=").append(createTs); |
|||
sb.append(", updateTs=").append(updateTs); |
|||
sb.append(", address=").append(address); |
|||
sb.append(", gps=").append(gps); |
|||
sb.append(", latestHeartbeatTs=").append(latestHeartbeatTs); |
|||
sb.append(", onlineStatus=").append(onlineStatus); |
|||
sb.append(", battery=").append(battery); |
|||
sb.append(", flag=").append(flag); |
|||
sb.append(", companyId=").append(companyId); |
|||
sb.append(", offlineInterval=").append(offlineInterval); |
|||
sb.append(", ackFlag=").append(ackFlag); |
|||
sb.append(", downlinkId=").append(downlinkId); |
|||
sb.append(", authUserId=").append(authUserId); |
|||
sb.append(", authPwd=").append(authPwd); |
|||
sb.append(", serialVersionUID=").append(serialVersionUID); |
|||
sb.append("]"); |
|||
return sb.toString(); |
|||
} |
|||
} |
|||
File diff suppressed because it is too large
@ -0,0 +1,28 @@ |
|||
package com.techsor.datacenter.business.vo.apgateway; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author zhc |
|||
* @time 2024年6月27日 |
|||
*/ |
|||
@Data |
|||
public class ApGatewayHeartbeatHistoryResponseVO { |
|||
|
|||
@Schema(description ="imei", example = "111") |
|||
private String imei; |
|||
|
|||
@Schema(description ="mac", example = "111") |
|||
private String mac; |
|||
|
|||
@Schema(description ="battery", example = "11.11") |
|||
private String battery; |
|||
|
|||
@Schema(description ="心跳时间", example = "100") |
|||
private Long heartbeatTs; |
|||
|
|||
@Schema(description ="在线状态 1:在线,0:离线", example = "1") |
|||
private Long onlineStatus; |
|||
|
|||
} |
|||
@ -0,0 +1,31 @@ |
|||
package com.techsor.datacenter.business.vo.apgateway; |
|||
|
|||
import io.swagger.v3.oas.annotations.media.Schema; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author zhc |
|||
* @time 2024年6月27日 |
|||
*/ |
|||
@Data |
|||
public class ApGatewayHeartbeatHistoryVO { |
|||
|
|||
@Schema(description ="imei", example = "111") |
|||
private String imei; |
|||
|
|||
@Schema(description ="mac", example = "111") |
|||
private String mac; |
|||
|
|||
@Schema(description ="model", example = "L5") |
|||
private String model; |
|||
|
|||
@Schema(description ="rawData", example = "{}") |
|||
private String rawData; |
|||
|
|||
@Schema(description ="心跳时间", example = "100") |
|||
private Long heartbeatTs; |
|||
|
|||
@Schema(description ="在线状态 1:在线,0:离线", example = "1") |
|||
private Long onlineStatus; |
|||
|
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package com.techsor.datacenter.business.service; |
|||
|
|||
import com.techsor.datacenter.business.common.response.PageInfo; |
|||
import com.techsor.datacenter.business.common.response.SimpleDataResponse; |
|||
import com.techsor.datacenter.business.dto.apgateway.*; |
|||
import com.techsor.datacenter.business.model.ApGateway; |
|||
import com.techsor.datacenter.business.vo.apgateway.ApGatewayHeartbeatHistoryResponseVO; |
|||
|
|||
/** |
|||
* |
|||
* @author jwy-style |
|||
* |
|||
*/ |
|||
public interface ApGatewayService { |
|||
|
|||
PageInfo<ApGateway> query(ApGatewayQueryParam param, Long userId, Long companyId, Integer languageType); |
|||
|
|||
SimpleDataResponse add(ApGatewayAddParam param, Long userId, Long companyId, Integer languageType); |
|||
|
|||
SimpleDataResponse edit(ApGatewayEditParam param, Long userId, Long companyId, Integer languageType); |
|||
|
|||
SimpleDataResponse batchDelete(ApGatewayDeleteParam param, Long userId, Long companyId, Integer languageType); |
|||
|
|||
|
|||
PageInfo<ApGatewayHeartbeatHistoryResponseVO> getApHeartbeatHistoryListPage(ApGatewayHeartbeatQueryParam param, Long userId, |
|||
Long companyId, Integer languageType); |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,372 @@ |
|||
package com.techsor.datacenter.business.service.impl; |
|||
|
|||
import com.github.pagehelper.PageHelper; |
|||
import com.google.gson.*; |
|||
import com.techsor.datacenter.business.common.Constants; |
|||
import com.techsor.datacenter.business.common.language.msg.MsgLanguageChange; |
|||
import com.techsor.datacenter.business.common.response.PageInfo; |
|||
import com.techsor.datacenter.business.common.response.ResponseCode; |
|||
import com.techsor.datacenter.business.common.response.SimpleDataResponse; |
|||
import com.techsor.datacenter.business.dao.ex.ApGatewayMapperExt; |
|||
import com.techsor.datacenter.business.dao.ex.CompanyMapperExt; |
|||
import com.techsor.datacenter.business.dto.apgateway.*; |
|||
import com.techsor.datacenter.business.model.ApGateway; |
|||
import com.techsor.datacenter.business.model.ApGatewayExample; |
|||
import com.techsor.datacenter.business.service.ApGatewayService; |
|||
import com.techsor.datacenter.business.service.NotificationService; |
|||
import com.techsor.datacenter.business.service.UserOperationLogsService; |
|||
import com.techsor.datacenter.business.service.common.CommonOpt; |
|||
import com.techsor.datacenter.business.vo.apgateway.ApGatewayHeartbeatHistoryResponseVO; |
|||
import com.techsor.datacenter.business.vo.apgateway.ApGatewayHeartbeatHistoryVO; |
|||
import jakarta.annotation.Resource; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.commons.collections4.CollectionUtils; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.slf4j.Logger; |
|||
import org.slf4j.LoggerFactory; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
|||
import org.springframework.util.ObjectUtils; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Arrays; |
|||
import java.util.List; |
|||
import java.util.Objects; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* |
|||
* @author zhc |
|||
* |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class ApGatewayServiceImpl implements ApGatewayService { |
|||
|
|||
private static Logger logger = LoggerFactory.getLogger(ApGatewayServiceImpl.class); |
|||
@Autowired |
|||
private MsgLanguageChange msgLanguageChange; |
|||
|
|||
@Autowired |
|||
private CommonOpt commonOpt; |
|||
@Autowired |
|||
private CompanyMapperExt companyMapperExt; |
|||
@Resource |
|||
private ApGatewayMapperExt apGatewayMapperExt; |
|||
@Autowired |
|||
private UserOperationLogsService userOperationLogsService; |
|||
@Resource |
|||
private NotificationService notificationService; |
|||
|
|||
|
|||
@Override |
|||
public PageInfo<ApGateway> query(ApGatewayQueryParam param, Long userId, Long companyId, Integer languageType) { |
|||
PageHelper.startPage(param.getPageNum() == null ? 1 : param.getPageNum(), param.getPageSize() == null ? 20 : param.getPageSize()); |
|||
List<ApGateway> resultList = apGatewayMapperExt.getListPage(param,companyId); |
|||
|
|||
return new PageInfo<>(resultList); |
|||
} |
|||
|
|||
|
|||
@Transactional |
|||
@Override |
|||
public SimpleDataResponse add(ApGatewayAddParam param, Long userId, Long companyId, Integer languageType) { |
|||
try{ |
|||
//Validate
|
|||
if (ObjectUtils.isEmpty(param.getImei())){ |
|||
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "paramsFormatError")); |
|||
} |
|||
//Verify if exist
|
|||
ApGatewayExample apGatewayExample = new ApGatewayExample(); |
|||
apGatewayExample.createCriteria().andImeiEqualTo(param.getImei()).andFlagEqualTo(0); |
|||
long cnt = this.apGatewayMapperExt.countByExample(apGatewayExample); |
|||
if (cnt > 0) { |
|||
return new SimpleDataResponse(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "binded")); |
|||
} |
|||
//Process
|
|||
ApGateway insertObj = new ApGateway(); |
|||
insertObj.setImei(param.getImei()); |
|||
insertObj.setMac(param.getMac()); |
|||
insertObj.setCreateTs(System.currentTimeMillis()); |
|||
insertObj.setUpdateTs(System.currentTimeMillis()); |
|||
insertObj.setAddress(param.getAddress()); |
|||
insertObj.setModel(param.getModel()); |
|||
//offline_interval default 10 minutes
|
|||
if (param.getOfflineInterval()==null || param.getOfflineInterval()<=0){ |
|||
param.setOfflineInterval(10); |
|||
} |
|||
insertObj.setOfflineInterval(param.getOfflineInterval()); |
|||
// insertObj.setGps(param.getGps());
|
|||
// insertObj.setLatestHeartbeatTs(System.currentTimeMillis());
|
|||
insertObj.setOnlineStatus(0); |
|||
insertObj.setFlag(0); |
|||
insertObj.setCompanyId(companyId); |
|||
if(StringUtils.isBlank(param.getAuthUserId())){ |
|||
insertObj.setAuthUserId(""); |
|||
} else { |
|||
insertObj.setAuthUserId(param.getAuthUserId()); |
|||
} |
|||
if(StringUtils.isBlank(param.getAuthPwd())){ |
|||
insertObj.setAuthPwd(""); |
|||
} else { |
|||
insertObj.setAuthPwd(param.getAuthPwd()); |
|||
} |
|||
|
|||
this.apGatewayMapperExt.insert(insertObj); |
|||
|
|||
//Record log
|
|||
userOperationLogsService.recordLog(companyId,userId,"添加AP Gateway:"+insertObj.getImei(), |
|||
"Add AP Gateway:"+insertObj.getImei(), |
|||
"AP Gatewayを追加:"+insertObj.getImei(), |
|||
"Success", Constants.USER_OPERATION_LOG_TYPE_GATEWAY_LOG, |
|||
new Gson().toJson(insertObj)); |
|||
|
|||
this.notificationService.saveApGatewayAuthInfo(insertObj); |
|||
|
|||
//Return
|
|||
return SimpleDataResponse.success(); |
|||
}catch (Exception e){ |
|||
log.error("Error adding device information", e); |
|||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
|||
return new SimpleDataResponse(ResponseCode.SERVER_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "serviceError")); |
|||
} |
|||
} |
|||
|
|||
@Transactional |
|||
@Override |
|||
public SimpleDataResponse edit(ApGatewayEditParam param, Long userId, Long companyId, Integer languageType) { |
|||
try{ |
|||
//Validate
|
|||
if (ObjectUtils.isEmpty(param.getImei())){ |
|||
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "paramsFormatError")); |
|||
} |
|||
//Verify if exist
|
|||
ApGatewayExample apGatewayExample = new ApGatewayExample(); |
|||
apGatewayExample.createCriteria().andApGatewayIdEqualTo(param.getApGatewayId()).andFlagEqualTo(0); |
|||
long cnt = this.apGatewayMapperExt.countByExample(apGatewayExample); |
|||
if (cnt == 0) { |
|||
return new SimpleDataResponse(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "gatewayNotExist")); |
|||
} |
|||
//Process
|
|||
ApGateway insertObj = new ApGateway(); |
|||
insertObj.setApGatewayId(param.getApGatewayId()); |
|||
insertObj.setImei(param.getImei()); |
|||
insertObj.setAddress(param.getAddress()); |
|||
insertObj.setMac(param.getMac()); |
|||
insertObj.setUpdateTs(System.currentTimeMillis()); |
|||
insertObj.setModel(param.getModel()); |
|||
//offline_interval default 10 minutes
|
|||
if (param.getOfflineInterval()==null || param.getOfflineInterval()<=0){ |
|||
param.setOfflineInterval(10); |
|||
} |
|||
insertObj.setOfflineInterval(param.getOfflineInterval()); |
|||
if(StringUtils.isBlank(param.getAuthUserId())){ |
|||
insertObj.setAuthUserId(""); |
|||
} else { |
|||
insertObj.setAuthUserId(param.getAuthUserId()); |
|||
} |
|||
if(StringUtils.isBlank(param.getAuthPwd())){ |
|||
insertObj.setAuthPwd(""); |
|||
} else { |
|||
insertObj.setAuthPwd(param.getAuthPwd()); |
|||
} |
|||
|
|||
//Verify if the imei is dumplicate
|
|||
ApGatewayExample dumpCheckExample = new ApGatewayExample(); |
|||
dumpCheckExample.createCriteria().andImeiEqualTo(insertObj.getImei()).andFlagEqualTo(0).andApGatewayIdNotEqualTo(insertObj.getApGatewayId()); |
|||
long dumpCnt = this.apGatewayMapperExt.countByExample(dumpCheckExample); |
|||
if (dumpCnt >= 1) { |
|||
return new SimpleDataResponse(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "imeiHasExisted")); |
|||
} |
|||
//Process update
|
|||
this.apGatewayMapperExt.updateByPrimaryKeySelective(insertObj); |
|||
|
|||
//Record log
|
|||
userOperationLogsService.recordLog(companyId,userId,"编辑AP Gateway:"+insertObj.getImei(), |
|||
"Edit AP Gateway:"+insertObj.getImei(), |
|||
"AP Gatewayを編集:"+insertObj.getImei(), |
|||
"Success", Constants.USER_OPERATION_LOG_TYPE_GATEWAY_LOG, |
|||
new Gson().toJson(insertObj)); |
|||
|
|||
this.notificationService.saveApGatewayAuthInfo(insertObj); |
|||
|
|||
//Return
|
|||
return SimpleDataResponse.success(); |
|||
}catch (Exception e){ |
|||
log.error("Error adding device information", e); |
|||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
|||
return new SimpleDataResponse(ResponseCode.SERVER_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "serviceError")); |
|||
} |
|||
} |
|||
|
|||
@Transactional |
|||
@Override |
|||
public SimpleDataResponse batchDelete(ApGatewayDeleteParam param, Long userId, Long companyId, Integer languageType) { |
|||
try{ |
|||
//Validate
|
|||
if (ObjectUtils.isEmpty(param.getApGatewayIds())){ |
|||
return SimpleDataResponse.fail(ResponseCode.MSG_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "paramsFormatError")); |
|||
} |
|||
//Process
|
|||
List<Long> idList = Arrays.stream(param.getApGatewayIds().split(",")) |
|||
.map(String::trim) // 去除可能的空格
|
|||
.filter(s -> !s.isEmpty()) // 过滤空字符串
|
|||
.map(Long::parseLong) |
|||
.toList(); |
|||
for (Long id : idList) { |
|||
ApGateway insertObj = new ApGateway(); |
|||
insertObj.setApGatewayId(id); |
|||
insertObj.setUpdateTs(System.currentTimeMillis()); |
|||
insertObj.setFlag(1); |
|||
this.apGatewayMapperExt.updateByPrimaryKeySelective(insertObj); |
|||
} |
|||
|
|||
ApGatewayExample example = new ApGatewayExample(); |
|||
example.createCriteria().andApGatewayIdIn(idList); |
|||
List<ApGateway> records = apGatewayMapperExt.selectByExample(example); |
|||
if (CollectionUtils.isNotEmpty(records)){ |
|||
List<String> imeiList = records.stream() |
|||
.map(ApGateway::getImei) |
|||
.filter(Objects::nonNull) |
|||
.filter(imei -> !imei.isEmpty()) |
|||
.toList(); |
|||
notificationService.deleteApGatewayAuthInfo(imeiList); |
|||
} |
|||
|
|||
userOperationLogsService.recordLog(companyId,userId,"删除AP Gateway:"+param.getApGatewayIds(), |
|||
"Delete AP Gateway:"+param.getApGatewayIds(), |
|||
"AP Gatewayを削除:"+param.getApGatewayIds(), |
|||
"Success", Constants.USER_OPERATION_LOG_TYPE_GATEWAY_LOG, |
|||
""); |
|||
|
|||
//Return
|
|||
return SimpleDataResponse.success(); |
|||
}catch (Exception e){ |
|||
log.error("Error delete device information", e); |
|||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
|||
return new SimpleDataResponse(ResponseCode.SERVER_ERROR, msgLanguageChange.getParameterMapByCode(languageType, "serviceError")); |
|||
} |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public PageInfo<ApGatewayHeartbeatHistoryResponseVO> getApHeartbeatHistoryListPage(ApGatewayHeartbeatQueryParam param, Long userId, |
|||
Long companyId, Integer languageType) { |
|||
|
|||
// PageHelper.startPage(param.getPageNum() == null ? 1 : param.getPageNum(), param.getPageSize() == null ? 20 : param.getPageSize());
|
|||
// List<ApGatewayHeartbeatHistoryVO> resultList = apGatewayHeartbeatMapperExt.getListPage(param,companyId);
|
|||
// List<ApGatewayHeartbeatHistoryResponseVO> responseList = new ArrayList<>();
|
|||
// for (ApGatewayHeartbeatHistoryVO vo : resultList){
|
|||
// ApGatewayHeartbeatHistoryResponseVO responseItem = new ApGatewayHeartbeatHistoryResponseVO();
|
|||
// BeanUtils.copyProperties(vo,responseItem);
|
|||
// switch (vo.getModel()){
|
|||
// case "L5":
|
|||
// responseItem.setBattery(extractL5Batt(vo.getRawData()));
|
|||
// break;
|
|||
// case "EV07":
|
|||
// responseItem.setBattery(extractEV07Batt(vo.getRawData()));
|
|||
// break;
|
|||
// default:
|
|||
// responseItem.setBattery(null);
|
|||
// }
|
|||
// responseList.add(responseItem);
|
|||
// }
|
|||
//
|
|||
// //这里需要复制新的PageInfo,把分页参数复制进去,不然会出错
|
|||
// PageInfo<ApGatewayHeartbeatHistoryVO> pageInfo = new PageInfo<>(resultList);
|
|||
//
|
|||
// PageInfo<ApGatewayHeartbeatHistoryResponseVO> resultPageInfo = new PageInfo<>();
|
|||
// BeanUtils.copyProperties(pageInfo, resultPageInfo);
|
|||
//
|
|||
// resultPageInfo.setList(responseList);
|
|||
//
|
|||
// return resultPageInfo;
|
|||
|
|||
return null; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* 获取L5的电量 |
|||
* @param jsonStr |
|||
* @return |
|||
*/ |
|||
private String extractL5Batt(String jsonStr) { |
|||
if (jsonStr == null || jsonStr.isEmpty()) { |
|||
return null; |
|||
} |
|||
try { |
|||
JsonObject json = JsonParser.parseString(jsonStr).getAsJsonObject(); |
|||
if (json.has("batt")) { |
|||
int battRaw = json.get("batt").getAsInt(); |
|||
double voltage = battRaw / 1000.0; |
|||
double percentage; |
|||
if (voltage <= 3.3) { |
|||
percentage = 0; |
|||
} else if (voltage >= 4.0) { |
|||
percentage = 100; |
|||
} else { |
|||
percentage = (voltage - 3.3) / (4.0 - 3.3) * 100; |
|||
} |
|||
|
|||
int roundedPercentage = (int) Math.round(percentage); |
|||
return roundedPercentage + "%"; |
|||
} else { |
|||
return null; |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 获取EV07的电量 |
|||
* @param jsonStr |
|||
* @return |
|||
*/ |
|||
private String extractEV07Batt(String jsonStr) { |
|||
if (jsonStr == null || jsonStr.isEmpty()) { |
|||
return null; |
|||
} |
|||
try { |
|||
JsonObject root = JsonParser.parseString(jsonStr).getAsJsonObject(); |
|||
|
|||
// 1. 获取 body -> commandItems
|
|||
if (!root.has("body")) return null; |
|||
JsonObject body = root.getAsJsonObject("body"); |
|||
if (!body.has("commandItems")) return null; |
|||
|
|||
JsonArray commandItems = body.getAsJsonArray("commandItems"); |
|||
|
|||
// 2. 遍历数组,找到 codec.name == "status" 的项
|
|||
for (JsonElement item : commandItems) { |
|||
JsonObject commandItem = item.getAsJsonObject(); |
|||
|
|||
if (commandItem.has("codec") && commandItem.has("value")) { |
|||
JsonObject codec = commandItem.getAsJsonObject("codec"); |
|||
|
|||
// 定位到 status 节点
|
|||
if ("status".equals(codec.get("name").getAsString())) { |
|||
JsonObject statusValue = commandItem.getAsJsonObject("value"); |
|||
|
|||
// 3. 提取 battery 并拼接 %
|
|||
if (statusValue.has("battery")) { |
|||
// 使用 getAsString() 可兼容整数或字符串类型的 battery
|
|||
return statusValue.get("battery").getAsString() + "%"; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
return null; // 未找到 battery 字段
|
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
Loading…
Reference in new issue