From 246fb9272dc44fea254ce4729819c4b2bc8ae034 Mon Sep 17 00:00:00 2001 From: caojianbin <1910336823> Date: Sat, 30 Mar 2024 15:14:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E5=9B=BD=E9=99=85=E5=8C=96,?= =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=A8=A1=E5=9D=97=E8=AE=BE=E5=A4=87=E6=88=90?= =?UTF-8?q?=E5=91=98=E4=BF=A1=E6=81=AF=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=BC=80=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/annotation/DelImeiLog.java | 12 ++++ .../controller/DelimeiLogInfoController.java | 38 ++++++++++ .../system/controller/DeviceAlarmController.java | 80 ++++++++++++++++++++++ .../system/entity/DelimeiLogInfo.java | 59 ++++++++++++++++ .../system/entity/DeviceAlarm.java | 80 ++++++++++++++++++++++ .../system/entity/api/dto/DeviceAlarmApp.java | 52 ++++++++++++++ .../system/entity/dto/DeviceActivaPageDTO.java | 43 ++++++++++++ .../system/entity/dto/DeviceAdminOwnerInfo.java | 20 ++++++ .../system/entity/vo/DeviceActivaVO.java | 44 ++++++++++++ .../system/mapper/DelimeiLogInfoMapper.java | 17 +++++ .../system/mapper/DeviceAlarmMapper.java | 28 ++++++++ .../system/mapper/api/DeviceAlarmAppMapper.java | 17 +++++ .../system/service/DelimeiLogInfoService.java | 19 +++++ .../system/service/DeviceAlarmService.java | 26 +++++++ .../system/service/api/DeviceAlarmAppService.java | 18 +++++ .../api/impl/DeviceAlarmAppServiceImpl.java | 70 +++++++++++++++++++ .../service/impl/DelimeiLogInfoServiceImpl.java | 73 ++++++++++++++++++++ .../service/impl/DeviceAlarmServiceImpl.java | 39 +++++++++++ .../system/mapper/DeviceAlarmMapper.xml | 38 ++++++++++ 19 files changed, 773 insertions(+) create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/annotation/DelImeiLog.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DelimeiLogInfoController.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DeviceAlarmController.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DelimeiLogInfo.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DeviceAlarm.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DeviceAlarmApp.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceActivaPageDTO.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceAdminOwnerInfo.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/vo/DeviceActivaVO.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DelimeiLogInfoMapper.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceAlarmAppMapper.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DelimeiLogInfoService.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DeviceAlarmService.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceAlarmAppService.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/DeviceAlarmAppServiceImpl.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DelimeiLogInfoServiceImpl.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DeviceAlarmServiceImpl.java create mode 100644 ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.xml diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/annotation/DelImeiLog.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/annotation/DelImeiLog.java new file mode 100644 index 0000000..82a6055 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/annotation/DelImeiLog.java @@ -0,0 +1,12 @@ +package com.ecell.internationalize.system.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ ElementType.PARAMETER, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface DelImeiLog { + String delType(); +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DelimeiLogInfoController.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DelimeiLogInfoController.java new file mode 100644 index 0000000..e3ddcb5 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DelimeiLogInfoController.java @@ -0,0 +1,38 @@ +package com.ecell.internationalize.system.controller; +import com.ecell.internationalize.common.core.utils.locale.LocaleUtil; +import com.ecell.internationalize.common.core.web.domain.AjaxResult; +import com.ecell.internationalize.common.system.constant.FieldConstant; +import com.ecell.internationalize.system.entity.dto.ImeiLogPageDTO; +import com.ecell.internationalize.system.service.DelimeiLogInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author ${author} + * @since 2022-07-19 + */ +@RestController +@RequestMapping("/delimei-log-info") +public class DelimeiLogInfoController { + + @Autowired + private DelimeiLogInfoService delimeiLogInfoService; + + /** + * 分页查询日志 + * @param dto + * @return + */ + @GetMapping("/page/list") + public AjaxResult queryPageList(ImeiLogPageDTO dto){ + return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS), delimeiLogInfoService.queryByPageList(dto)); + } + +} + diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DeviceAlarmController.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DeviceAlarmController.java new file mode 100644 index 0000000..e76cda4 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DeviceAlarmController.java @@ -0,0 +1,80 @@ +package com.ecell.internationalize.system.controller; + + +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.ecell.internationalize.common.core.utils.locale.LocaleUtil; +import com.ecell.internationalize.common.system.constant.FieldConstant; +import com.ecell.internationalize.system.entity.dto.ReminderMessageAppDto; +import com.ecell.internationalize.system.entity.dto.ReminderMessageQueryDto; +import com.ecell.internationalize.system.service.ReminderMessageAppService; +import com.ecell.internationalize.system.utils.Rest; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +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; + +/** + *

+ * 设备报警 前端控制器 + *

+ * + * @author liy + * @since 2022-07-11 + */ +@Api(value="设备报警",tags={"设备报警接口"}) +@RestController +@RequestMapping("/device_alarm") +public class DeviceAlarmController { + @Autowired + private ReminderMessageAppService reminderMessageAppService; + /** + * 设备报警条件分页查询 + * @Author liy + * @Date 2022/7/12 14:38 + * @Return AjaxResult + */ + @ApiOperation("条件分页查询设备报警信息") + @PostMapping("alarm/list") + public Rest> queryAll(@RequestBody ReminderMessageAppDto reminderMessageAppDto){ + IPage allByPage = reminderMessageAppService.findAllByPage(reminderMessageAppDto); + for (ReminderMessageQueryDto reminderMessageQueryDto:allByPage.getRecords()){ + if ("lowBattery".equals(reminderMessageQueryDto.getType())){ + JSONObject jsonObject = JSONObject.parseObject(reminderMessageQueryDto.getContext()); + String battery=jsonObject.get("battery").toString(); + reminderMessageQueryDto.setAlarmContent(battery+"%"); + + } + if ("sos".equals(reminderMessageQueryDto.getType())){ + JSONObject jsonObject = JSONObject.parseObject(reminderMessageQueryDto.getContext()); + String address=jsonObject.get("address").toString(); + reminderMessageQueryDto.setAlarmContent(address); + } + if ("rail".equals(reminderMessageQueryDto.getType())){ + JSONObject jsonObject = JSONObject.parseObject(reminderMessageQueryDto.getContext()); + String railName=jsonObject.get("railName").toString(); + String action=jsonObject.get("action").toString(); + if ("enter".equals(action)){ + reminderMessageQueryDto.setAlarmContent("进入"+railName); + }else { + reminderMessageQueryDto.setAlarmContent("离开"+railName); + } + } + if ("abnormalHeartRate".equals(reminderMessageQueryDto.getType())){ + JSONObject jsonObject = JSONObject.parseObject(reminderMessageQueryDto.getContext()); + String msgContent=jsonObject.get("msgContent").toString(); + reminderMessageQueryDto.setAlarmContent(msgContent); + } + if ("abnormalBodyTemperature".equals(reminderMessageQueryDto.getType())){ + JSONObject jsonObject = JSONObject.parseObject(reminderMessageQueryDto.getContext()); + String msgContent=jsonObject.get("msgContent").toString(); + reminderMessageQueryDto.setAlarmContent(msgContent); + } + } + return Rest.ok(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),allByPage); + } +} + diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DelimeiLogInfo.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DelimeiLogInfo.java new file mode 100644 index 0000000..347f4e3 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DelimeiLogInfo.java @@ -0,0 +1,59 @@ +package com.ecell.internationalize.system.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * + *

+ * + * @author ${author} + * @since 2022-07-19 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="DelimeiLogInfo对象", description="") +public class DelimeiLogInfo implements Serializable { + +private static final long serialVersionUID=1L; + + @ApiModelProperty(value = "id") + private String imeiDelId; + + @ApiModelProperty(value = "ip") + private String ip; + + @ApiModelProperty(value = "登录账号") + private String loginAccount; + + @ApiModelProperty(value = "用户角色") + private String userRole; + + @ApiModelProperty(value = "所属公司") + private String company; + + @ApiModelProperty(value = "操作描述") + private String operationDescribe; + + @ApiModelProperty(value = "是否删除(0.是,1.否 默认为1)") + private String delFlag; + + @ApiModelProperty(value = "创建时间") + @TableField(value = "create_time",fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(value = "解绑方式") + private String unbinding; + + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DeviceAlarm.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DeviceAlarm.java new file mode 100644 index 0000000..7bd6492 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DeviceAlarm.java @@ -0,0 +1,80 @@ +package com.ecell.internationalize.system.entity; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.util.Date; + +/** + *

+ * 设备报警 + *

+ * + * @author liy + * @since 2022-07-11 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("device_alarm") +public class DeviceAlarm { + +private static final long serialVersionUID=1L; + + /** + * 主键Id + */ + @TableId("id") + private String id; + + /** + * 设备iMei + */ + @TableField("i_mei") + private String mei; + + /** + * 报警类型(0:SOS报警,1:低电报警,2:体温异常,3:心率异常,4:远程拍照,5.电子围栏) + */ + private String alarmType; + + /** + * 姓名 + */ + @TableField(exist = false) + private String name; + + /** + * 报警 + */ + private String alarm; + + /** + * 创建人 + */ + private String createUser; + /** + * 创建时间 + */ + @TableField(value = "create_time",fill = FieldFill.INSERT) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createTime; + /** + * 修改人 + */ + private String updateUser; + /** + * 修改时间 + */ + @TableField(value = "update_time",fill = FieldFill.UPDATE) + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updateTime; + + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DeviceAlarmApp.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DeviceAlarmApp.java new file mode 100644 index 0000000..44481ad --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DeviceAlarmApp.java @@ -0,0 +1,52 @@ +package com.ecell.internationalize.system.entity.api.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 闹钟设置表 + *

+ * + * @author liy + * @since 2022-09-07 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="DeviceAlarmApp对象", description="闹钟设置表") +public class DeviceAlarmApp implements Serializable { + +private static final long serialVersionUID=1L; + + @ApiModelProperty(example = "主键Id") + private String id; + + @ApiModelProperty(example = "标签") + private String tag; + + @ApiModelProperty(example = "响铃时间") + private String alarmTime; + + @ApiModelProperty(example = "重复星期数为'0', '1'组成的7位长度字符串, 表示周一至周日是否有效,eg: '0000011'为周六日有效, '1110000'为周一二三有效") + private String alarmWeek; + + @ApiModelProperty(example = "是否开启 0关闭,1开启,默认1") + private String alarmStatus; + + @ApiModelProperty(example = "设备imei") + private String imei; + + + @ApiModelProperty(example = "新增的时间,后台处理,不用传",hidden = true) + private Date createTime; + @ApiModelProperty(example = "修改的时间,后台处理,不用传",hidden = true) + private Date updateTime; + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceActivaPageDTO.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceActivaPageDTO.java new file mode 100644 index 0000000..738f1a9 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceActivaPageDTO.java @@ -0,0 +1,43 @@ +package com.ecell.internationalize.system.entity.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +@ApiModel(value="DeviceActivaPageDTO对象", description="查询设备激活条件对象") +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DeviceActivaPageDTO { + + @ApiModelProperty(value = "生产批次") + private String inputBatch; + + @ApiModelProperty(value = "渠道商名称") + private String firmName; + + @ApiModelProperty(value = "渠道商id") + private String firmId; + + @ApiModelProperty(value = "代理商id") + private String agentId; + + @ApiModelProperty(value = "是否是电信版本") + private String dial; + + @ApiModelProperty(value = "开始时间") + private String startTime; + + @ApiModelProperty(value = "结束时间") + private String endTime; + + @ApiModelProperty(value = "每页展示的条数") + private Integer pageSize; + + @ApiModelProperty(value = "当前的页码") + private Integer current; + + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceAdminOwnerInfo.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceAdminOwnerInfo.java new file mode 100644 index 0000000..09851a1 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceAdminOwnerInfo.java @@ -0,0 +1,20 @@ +package com.ecell.internationalize.system.entity.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class DeviceAdminOwnerInfo { + //管理员id + private String userId; + //设备拥有者名称 + private String name; + //设备imei + private String imei; + //群组ID + private String groupId; + //用户id集合 + private List ids; + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/vo/DeviceActivaVO.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/vo/DeviceActivaVO.java new file mode 100644 index 0000000..ce74581 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/vo/DeviceActivaVO.java @@ -0,0 +1,44 @@ +package com.ecell.internationalize.system.entity.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.Date; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@ApiModel(value="DeviceActivaVO对象", description="设备激活情况返回信息对象") +public class DeviceActivaVO implements Serializable { + private static final long serialVersionUID=1L; + + @ApiModelProperty(value = "生产批次") + private String inputBatch; + + @ApiModelProperty(value = "渠道商") + private String firmName; + + @ApiModelProperty(value = "已录入设备数量") + private Integer inputDevice; + + @ApiModelProperty(value = "激活设备数量") + private Integer activateDevice; + + @ApiModelProperty(value = "已绑定设备数量") + private Integer whetherBinding; + + @ApiModelProperty(value = "激活比例") + private String activationRatio; + + @ApiModelProperty(value = "是否电信版(0,否 1.是)") + private String dial; + + @ApiModelProperty(value = "导入日期") + private Date importTime; + + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DelimeiLogInfoMapper.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DelimeiLogInfoMapper.java new file mode 100644 index 0000000..c40166b --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DelimeiLogInfoMapper.java @@ -0,0 +1,17 @@ +package com.ecell.internationalize.system.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ecell.internationalize.system.entity.DelimeiLogInfo; + +/** + *

+ * Mapper 接口 + *

+ * + * @author ${author} + * @since 2022-07-19 + */ +public interface DelimeiLogInfoMapper extends BaseMapper { + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.java new file mode 100644 index 0000000..17336ed --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.java @@ -0,0 +1,28 @@ +package com.ecell.internationalize.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ecell.internationalize.system.entity.DeviceAlarm; +import org.apache.ibatis.annotations.Param; + +import java.util.Map; + +/** + *

+ * 设备报警 Mapper 接口 + *

+ * + * @author liy + * @since 2022-07-11 + */ +public interface DeviceAlarmMapper extends BaseMapper { + /** + * 步数报警分页查询 + * @Author liy + * @Date 2022/7/12 15:42 + * @param page 分页 + * @param map 查询条件 + * @return Page + */ + Page getList(@Param("page") Page page, @Param("map") Map map); +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceAlarmAppMapper.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceAlarmAppMapper.java new file mode 100644 index 0000000..d660651 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceAlarmAppMapper.java @@ -0,0 +1,17 @@ +package com.ecell.internationalize.system.mapper.api; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ecell.internationalize.system.entity.api.dto.DeviceAlarmApp; + +/** + *

+ * 闹钟设置表 Mapper 接口 + *

+ * + * @author ${author} + * @since 2022-09-07 + */ +public interface DeviceAlarmAppMapper extends BaseMapper { + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DelimeiLogInfoService.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DelimeiLogInfoService.java new file mode 100644 index 0000000..dc92c33 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DelimeiLogInfoService.java @@ -0,0 +1,19 @@ +package com.ecell.internationalize.system.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ecell.internationalize.system.entity.DelimeiLogInfo; +import com.ecell.internationalize.system.entity.dto.ImeiLogPageDTO; + +/** + *

+ * 服务类 + *

+ * + * @author ${author} + * @since 2022-07-19 + */ +public interface DelimeiLogInfoService extends IService { + + IPage queryByPageList(ImeiLogPageDTO dto); +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DeviceAlarmService.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DeviceAlarmService.java new file mode 100644 index 0000000..f22ecc5 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DeviceAlarmService.java @@ -0,0 +1,26 @@ +package com.ecell.internationalize.system.service; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.service.IService; +import com.ecell.internationalize.system.entity.DeviceAlarm; + +import java.util.Map; + +/** + *

+ * 设备报警 服务类 + *

+ * + * @author liy + * @since 2022-07-11 + */ +public interface DeviceAlarmService extends IService { + /** + * 设备报警条件分页查询 + * @Author liy + * @Date 2022/7/12 10:42 + * @param map 分页查询体 + * @return IPage + */ + IPage findAllByPage(Map map); +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceAlarmAppService.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceAlarmAppService.java new file mode 100644 index 0000000..706e9ce --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceAlarmAppService.java @@ -0,0 +1,18 @@ +package com.ecell.internationalize.system.service.api; + + +import com.baomidou.mybatisplus.extension.service.IService; +import com.ecell.internationalize.system.entity.api.dto.DeviceAlarmApp; + +/** + *

+ * 闹钟设置表 服务类 + *

+ * + * @author ${author} + * @since 2022-09-07 + */ +public interface DeviceAlarmAppService extends IService { + + void sendToKafka(DeviceAlarmApp deviceAlarmApp); +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/DeviceAlarmAppServiceImpl.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/DeviceAlarmAppServiceImpl.java new file mode 100644 index 0000000..658ec93 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/DeviceAlarmAppServiceImpl.java @@ -0,0 +1,70 @@ +package com.ecell.internationalize.system.service.api.impl; + + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ecell.internationalize.common.core.context.SecurityContextHolder; +import com.ecell.internationalize.common.core.utils.SpringUtils; +import com.ecell.internationalize.common.issue.entity.AlarmClockDto; +import com.ecell.internationalize.common.issue.entity.AlarmClockSecond; +import com.ecell.internationalize.common.issue.issue.IssueInstructions; +import com.ecell.internationalize.system.entity.api.dto.DeviceAlarmApp; +import com.ecell.internationalize.system.mapper.api.DeviceAlarmAppMapper; +import com.ecell.internationalize.system.service.api.DeviceAlarmAppService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + *

+ * 闹钟设置表 服务实现类 + *

+ * + * @author ${author} + * @since 2022-09-07 + */ +@Slf4j +@Service +public class DeviceAlarmAppServiceImpl extends ServiceImpl implements DeviceAlarmAppService { + + @Autowired + private DeviceAlarmAppMapper deviceAlarmAppMapper; + + @Override + public void sendToKafka(DeviceAlarmApp deviceAlarmApp) { + Date date = new Date(System.currentTimeMillis()); + AlarmClockDto alarmClockDto=new AlarmClockDto(); + alarmClockDto.setType("alarm"); + alarmClockDto.setIdent("66666"); + alarmClockDto.setVender("20000"); + alarmClockDto.setOpenid(SecurityContextHolder.getStringUserId()); + alarmClockDto.setImei(deviceAlarmApp.getImei()); + alarmClockDto.setTime(date.getTime()); + //根据imei查询所有闹钟信息,进行全量下发 + LambdaQueryWrapper lambdaQueryWrapper=new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(DeviceAlarmApp::getImei,deviceAlarmApp.getImei()); + List deviceAlarmApps = deviceAlarmAppMapper.selectList(lambdaQueryWrapper); + //发送指令集合 + List list=new ArrayList<>(); + AlarmClockSecond alarmClockSecond; + if (!CollectionUtils.isEmpty(deviceAlarmApps)){ + for (DeviceAlarmApp deviceAlarmApp1:deviceAlarmApps){ + alarmClockSecond=new AlarmClockSecond(); + alarmClockSecond.setStatus(Integer.valueOf(deviceAlarmApp1.getAlarmStatus())); + alarmClockSecond.setStart(deviceAlarmApp1.getAlarmTime()); + alarmClockSecond.setText(deviceAlarmApp1.getTag()); + alarmClockSecond.setWeek(deviceAlarmApp1.getAlarmWeek()); + list.add(alarmClockSecond); + } + } + alarmClockDto.setAlarm(list); + //3.调用方法缓存入redis,开始指令下发 + IssueInstructions issueInstructions = SpringUtils.getBean(IssueInstructions.class); + issueInstructions.emitDeviceDemand("alarm",deviceAlarmApp.getImei(),alarmClockDto); + } +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DelimeiLogInfoServiceImpl.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DelimeiLogInfoServiceImpl.java new file mode 100644 index 0000000..efad883 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DelimeiLogInfoServiceImpl.java @@ -0,0 +1,73 @@ +package com.ecell.internationalize.system.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ecell.internationalize.common.core.utils.StringUtils; +import com.ecell.internationalize.system.constant.DeviceModelConstants; +import com.ecell.internationalize.system.entity.DelimeiLogInfo; +import com.ecell.internationalize.system.entity.dto.ImeiLogPageDTO; +import com.ecell.internationalize.system.mapper.DelimeiLogInfoMapper; +import com.ecell.internationalize.system.service.DelimeiLogInfoService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author ${author} + * @since 2022-07-19 + */ +@Service +public class DelimeiLogInfoServiceImpl extends ServiceImpl implements DelimeiLogInfoService { + + @Autowired + private DelimeiLogInfoMapper mapper; + + + @Override + public IPage queryByPageList(ImeiLogPageDTO dto) { + Page page =new Page(dto.getCurrent(),dto.getPageSize()); + QueryWrapper wrapper = getQueryWrapper(dto); + + return mapper.selectPage(page, wrapper); + + } + + + /** + * 日志异步新增 + * @param info + */ + @Async("threadPoolTaskExecutor") + public void saveDelImeiLog(DelimeiLogInfo info){ + save(info); + } + + + + /** + * 分页查询条件封装 + * @param dto + * @return + */ + private QueryWrapper getQueryWrapper(ImeiLogPageDTO dto) { + QueryWrapper wrapper=new QueryWrapper(); + if (StringUtils.isNotEmpty(dto.getIp())){ + wrapper.like("ip", dto.getIp()); + } + if (StringUtils.isNotEmpty(dto.getUserRole())){ + wrapper.eq("user_role", dto.getUserRole()); + } + if (StringUtils.isNotEmpty(dto.getLoginAccount())){ + wrapper.eq("login_account", dto.getLoginAccount()); + } + wrapper.eq("del_flag", DeviceModelConstants.ONE); + wrapper.orderByDesc("create_time"); + return wrapper; + } +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DeviceAlarmServiceImpl.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DeviceAlarmServiceImpl.java new file mode 100644 index 0000000..ea8416b --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DeviceAlarmServiceImpl.java @@ -0,0 +1,39 @@ +package com.ecell.internationalize.system.service.impl; + +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ecell.internationalize.common.system.constant.FieldConstant; +import com.ecell.internationalize.system.entity.DeviceAlarm; +import com.ecell.internationalize.system.mapper.DeviceAlarmMapper; +import com.ecell.internationalize.system.service.DeviceAlarmService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Map; + +/** + *

+ * 设备报警 服务实现类 + *

+ * + * @author liy + * @since 2022-07-11 + */ +@Service +public class DeviceAlarmServiceImpl extends ServiceImpl implements DeviceAlarmService { + @Autowired + private DeviceAlarmMapper deviceAlarmMapper; + /** + * 设备报警条件分页查询 + * @Author liy + * @Date 2022/7/12 10:42 + * @param map 分页查询体 + * @return IPage + */ + @Override + public IPage findAllByPage(Map map) { + Page page=new Page<>(Integer.parseInt(map.get(FieldConstant.CURRENT).toString()),Integer.parseInt(map.get(FieldConstant.SIZE).toString())); + return deviceAlarmMapper.getList(page,map); + } +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.xml b/ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.xml new file mode 100644 index 0000000..fccc8ee --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + +