Browse Source

重构国际化,系统模块设备成员信息相关接口开发

master
caojianbin 8 months ago
parent
commit
246fb9272d
  1. 12
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/annotation/DelImeiLog.java
  2. 38
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DelimeiLogInfoController.java
  3. 80
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DeviceAlarmController.java
  4. 59
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DelimeiLogInfo.java
  5. 80
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DeviceAlarm.java
  6. 52
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DeviceAlarmApp.java
  7. 43
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceActivaPageDTO.java
  8. 20
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceAdminOwnerInfo.java
  9. 44
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/vo/DeviceActivaVO.java
  10. 17
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DelimeiLogInfoMapper.java
  11. 28
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.java
  12. 17
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceAlarmAppMapper.java
  13. 19
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DelimeiLogInfoService.java
  14. 26
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DeviceAlarmService.java
  15. 18
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceAlarmAppService.java
  16. 70
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/DeviceAlarmAppServiceImpl.java
  17. 73
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DelimeiLogInfoServiceImpl.java
  18. 39
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DeviceAlarmServiceImpl.java
  19. 38
      ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.xml

12
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();
}

38
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;
/**
* <p>
* 前端控制器
* </p>
*
* @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));
}
}

80
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;
/**
* <p>
* 设备报警 前端控制器
* </p>
*
* @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<IPage<ReminderMessageQueryDto>> queryAll(@RequestBody ReminderMessageAppDto reminderMessageAppDto){
IPage<ReminderMessageQueryDto> 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);
}
}

59
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;
/**
* <p>
*
* </p>
*
* @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;
}

80
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;
/**
* <p>
* 设备报警
* </p>
*
* @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;
/**
* 报警类型0SOS报警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;
}

52
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;
/**
* <p>
* 闹钟设置表
* </p>
*
* @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;
}

43
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;
}

20
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<String> ids;
}

44
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;
}

17
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;
/**
* <p>
* Mapper 接口
* </p>
*
* @author ${author}
* @since 2022-07-19
*/
public interface DelimeiLogInfoMapper extends BaseMapper<DelimeiLogInfo> {
}

28
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;
/**
* <p>
* 设备报警 Mapper 接口
* </p>
*
* @author liy
* @since 2022-07-11
*/
public interface DeviceAlarmMapper extends BaseMapper<DeviceAlarm> {
/**
* 步数报警分页查询
* @Author liy
* @Date 2022/7/12 15:42
* @param page 分页
* @param map 查询条件
* @return Page
*/
Page<DeviceAlarm> getList(@Param("page") Page<DeviceAlarm> page, @Param("map") Map<String, Object> map);
}

17
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;
/**
* <p>
* 闹钟设置表 Mapper 接口
* </p>
*
* @author ${author}
* @since 2022-09-07
*/
public interface DeviceAlarmAppMapper extends BaseMapper<DeviceAlarmApp> {
}

19
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;
/**
* <p>
* 服务类
* </p>
*
* @author ${author}
* @since 2022-07-19
*/
public interface DelimeiLogInfoService extends IService<DelimeiLogInfo> {
IPage queryByPageList(ImeiLogPageDTO dto);
}

26
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;
/**
* <p>
* 设备报警 服务类
* </p>
*
* @author liy
* @since 2022-07-11
*/
public interface DeviceAlarmService extends IService<DeviceAlarm> {
/**
* 设备报警条件分页查询
* @Author liy
* @Date 2022/7/12 10:42
* @param map 分页查询体
* @return IPage
*/
IPage<DeviceAlarm> findAllByPage(Map<String, Object> map);
}

18
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;
/**
* <p>
* 闹钟设置表 服务类
* </p>
*
* @author ${author}
* @since 2022-09-07
*/
public interface DeviceAlarmAppService extends IService<DeviceAlarmApp> {
void sendToKafka(DeviceAlarmApp deviceAlarmApp);
}

70
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;
/**
* <p>
* 闹钟设置表 服务实现类
* </p>
*
* @author ${author}
* @since 2022-09-07
*/
@Slf4j
@Service
public class DeviceAlarmAppServiceImpl extends ServiceImpl<DeviceAlarmAppMapper, DeviceAlarmApp> 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<DeviceAlarmApp> lambdaQueryWrapper=new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(DeviceAlarmApp::getImei,deviceAlarmApp.getImei());
List<DeviceAlarmApp> deviceAlarmApps = deviceAlarmAppMapper.selectList(lambdaQueryWrapper);
//发送指令集合
List<AlarmClockSecond> 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);
}
}

73
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;
/**
* <p>
* 服务实现类
* </p>
*
* @author ${author}
* @since 2022-07-19
*/
@Service
public class DelimeiLogInfoServiceImpl extends ServiceImpl<DelimeiLogInfoMapper, DelimeiLogInfo> 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;
}
}

39
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;
/**
* <p>
* 设备报警 服务实现类
* </p>
*
* @author liy
* @since 2022-07-11
*/
@Service
public class DeviceAlarmServiceImpl extends ServiceImpl<DeviceAlarmMapper, DeviceAlarm> implements DeviceAlarmService {
@Autowired
private DeviceAlarmMapper deviceAlarmMapper;
/**
* 设备报警条件分页查询
* @Author liy
* @Date 2022/7/12 10:42
* @param map 分页查询体
* @return IPage
*/
@Override
public IPage<DeviceAlarm> findAllByPage(Map<String, Object> map) {
Page<DeviceAlarm> page=new Page<>(Integer.parseInt(map.get(FieldConstant.CURRENT).toString()),Integer.parseInt(map.get(FieldConstant.SIZE).toString()));
return deviceAlarmMapper.getList(page,map);
}
}

38
ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/DeviceAlarmMapper.xml

@ -0,0 +1,38 @@
<?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.ecell.internationalize.system.mapper.DeviceAlarmMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.ecell.internationalize.system.entity.DeviceAlarm">
<id column="id" property="id" />
<result column="i_mei" property="mei" />
<result column="alarm_type" property="alarmType" />
<result column="name" property="name" />
<result column="alarm" property="alarm" />
<result column="create_user" property="createUser" />
<result column="create_time" property="createTime" />
<result column="update_user" property="updateUser" />
<result column="update_time" property="updateTime" />
</resultMap>
<select id="getList" resultMap="BaseResultMap">
select A.id,A.i_mei,A.alarm_type,A.alarm,A.create_user,A.create_time,A.update_user,A.update_time,B.name from
device_alarm A left join user B ON A.i_mei=B.i_mei
where 1=1
<if test="map.iMei!=null and map.iMei!=''">
and A.i_mei=#{map.iMei}
</if>
<if test="map.alarmType!=null and map.alarmType!=''">
and A.alarm_type=#{map.alarmType}
</if>
<if test="map.startTime!=null">
<![CDATA[and DATE_FORMAT(A.create_time,'%Y-%m-%d')>=DATE_FORMAT(#{map.startTime},'%Y-%m-%d')]]>
</if>
<if test="map.endTime!=null">
<![CDATA[and DATE_FORMAT(A.create_time,'%Y-%m-%d')<=DATE_FORMAT(#{map.endTime},'%Y-%m-%d')]]>
</if>
</select>
</mapper>
Loading…
Cancel
Save