caojianbin
8 months ago
13 changed files with 469 additions and 0 deletions
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
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.DeviceFamilyPageDTO; |
||||
import com.ecell.internationalize.system.service.DeviceFamilyInfoService; |
||||
import io.swagger.annotations.Api; |
||||
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-15 |
||||
*/ |
||||
@Api(value = "设备家庭成员",tags = "设备家庭成员接口") |
||||
@RestController |
||||
@RequestMapping("/device-family-info") |
||||
public class DeviceFamilyInfoController { |
||||
@Autowired |
||||
private DeviceFamilyInfoService deviceFamilyInfoService; |
||||
|
||||
@GetMapping("/page/list") |
||||
public AjaxResult queryPageList(DeviceFamilyPageDTO dto){ |
||||
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS), deviceFamilyInfoService.queryPageList(dto)); |
||||
|
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
package com.ecell.internationalize.system.entity; |
||||
|
||||
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.time.LocalDateTime; |
||||
|
||||
/** |
||||
* <p> |
||||
* |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-07-15 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@Accessors(chain = true) |
||||
@ApiModel(value="DeviceFamilyInfo对象", description="") |
||||
public class DeviceFamilyInfo implements Serializable { |
||||
|
||||
private static final long serialVersionUID=1L; |
||||
|
||||
@ApiModelProperty(value = "id") |
||||
private String deviceFamilyId; |
||||
|
||||
@ApiModelProperty(value = "设备id") |
||||
private String deviceId; |
||||
|
||||
@ApiModelProperty(value = "设备imei") |
||||
private String imei; |
||||
|
||||
@ApiModelProperty(value = "设备手机号") |
||||
private String devicePhone; |
||||
|
||||
@ApiModelProperty(value = "管理员手机号码") |
||||
private String adminPhone; |
||||
|
||||
@ApiModelProperty(value = "管理员昵称") |
||||
private String adminName; |
||||
|
||||
@ApiModelProperty(value = "家庭成员(昵称+手机号,多个用逗号分割)") |
||||
private String familyMember; |
||||
|
||||
@ApiModelProperty(value = "设备使用中的用户id") |
||||
private String userId; |
||||
|
||||
@ApiModelProperty(value = "创建时间") |
||||
private LocalDateTime createTime; |
||||
|
||||
@ApiModelProperty(value = "修改时间") |
||||
private LocalDateTime updateTime; |
||||
|
||||
@ApiModelProperty(value = "创建人") |
||||
private String createUser; |
||||
|
||||
@ApiModelProperty(value = "修改人") |
||||
private String updateUser; |
||||
|
||||
|
||||
} |
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
package com.ecell.internationalize.system.entity.api; |
||||
|
||||
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-09-13 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@Accessors(chain = true) |
||||
@ApiModel(value="DeviceDisableApp对象", description="上课禁用(免打扰设置)表") |
||||
public class DeviceDisableApp implements Serializable { |
||||
|
||||
private static final long serialVersionUID=1L; |
||||
|
||||
@ApiModelProperty(example = "主键Id") |
||||
private String id; |
||||
|
||||
@ApiModelProperty(example = "开始响铃时间") |
||||
private String alarmStartTime; |
||||
|
||||
@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 = "结束响铃时间") |
||||
private String alarmEndTime; |
||||
|
||||
@ApiModelProperty(example = "创建时间",hidden = true) |
||||
private Date createTime; |
||||
|
||||
@ApiModelProperty(example = "修改时间",hidden = true) |
||||
private Date updateTime; |
||||
|
||||
} |
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
package com.ecell.internationalize.system.entity.api.dto; |
||||
|
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @Title: DeviceDisabledInnerAppDto |
||||
* @Author: liy |
||||
* @Date: 2022/9/13 14:28 |
||||
* @Description: |
||||
* @Version:1.0 |
||||
*/ |
||||
@Data |
||||
public class DeviceDisabledInnerAppDto { |
||||
private String end; |
||||
private String week; |
||||
private String start; |
||||
private Integer status; |
||||
} |
@ -0,0 +1,34 @@
@@ -0,0 +1,34 @@
|
||||
package com.ecell.internationalize.system.entity.api.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 上课禁用(免打扰设置)表 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-09-13 |
||||
*/ |
||||
@Data |
||||
public class DeviceDisableVo implements Serializable { |
||||
|
||||
private static final long serialVersionUID=1L; |
||||
|
||||
@ApiModelProperty(example = "开始响铃时间") |
||||
private String alarmStartTime; |
||||
|
||||
@ApiModelProperty(example = "重复星期数为'0', '1'组成的 7 位长度字符串, 表示周一至周日是否有效 eg: '0000011' 周六日有效, '1110000' 为周一二三有效") |
||||
private String alarmWeek; |
||||
|
||||
@ApiModelProperty(example = "是否开启 0关闭,1开启,默认1") |
||||
private String alarmStatus; |
||||
|
||||
@ApiModelProperty(example = "结束响铃时间") |
||||
private String alarmEndTime; |
||||
|
||||
|
||||
} |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
package com.ecell.internationalize.system.entity.dto; |
||||
import com.ecell.internationalize.common.core.annotation.Excel; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.AllArgsConstructor; |
||||
import lombok.Data; |
||||
import lombok.NoArgsConstructor; |
||||
|
||||
import javax.validation.constraints.NotEmpty; |
||||
|
||||
@ApiModel(value="DeviceDTO对象", description="设备录入对象") |
||||
@Data |
||||
@AllArgsConstructor |
||||
@NoArgsConstructor |
||||
public class DeviceDTO { |
||||
@Excel(name = "IMEI",type = Excel.Type.IMPORT) |
||||
@ApiModelProperty(value = "IMEI") |
||||
private String imei; |
||||
|
||||
@NotEmpty(message = "厂商id不能为空") |
||||
@ApiModelProperty(value = "厂商id") |
||||
private String firmId; |
||||
|
||||
@NotEmpty(message = "厂商名称不能为空") |
||||
@ApiModelProperty(value = "厂商名称") |
||||
private String firmName; |
||||
|
||||
@ApiModelProperty(value = "代理商id") |
||||
private String agentId; |
||||
|
||||
@ApiModelProperty(value = "代理商名称") |
||||
private String agentName; |
||||
|
||||
@NotEmpty(message = "设备型号id不能为空") |
||||
@ApiModelProperty(value = "设备型号id") |
||||
private String deviceModelId; |
||||
|
||||
@NotEmpty(message = "设备型号名称不能为空") |
||||
@ApiModelProperty(value = "设备型号名称") |
||||
private String deviceModelName; |
||||
} |
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
package com.ecell.internationalize.system.entity.vo; |
||||
|
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
/** |
||||
* @author borui |
||||
* 统计信息表 |
||||
*/ |
||||
@Data |
||||
public class DeviceCountInfo { |
||||
@ApiModelProperty(value = "设备总数") |
||||
private int deviceTotal; |
||||
@ApiModelProperty(value = "设备激活数") |
||||
private int deviceActivateNumber; |
||||
@ApiModelProperty(value = "设备未激活数") |
||||
private int deviceNotActivateNumber; |
||||
@ApiModelProperty(value = "设备在线数") |
||||
private int deviceOnlineNumber; |
||||
@ApiModelProperty(value = "设备离线数") |
||||
private int deviceOfflineNumber; |
||||
@ApiModelProperty(value = "今日新增数") |
||||
private int deviceTodayAddNumber; |
||||
} |
@ -0,0 +1,16 @@
@@ -0,0 +1,16 @@
|
||||
package com.ecell.internationalize.system.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ecell.internationalize.system.entity.DeviceFamilyInfo; |
||||
|
||||
/** |
||||
* <p> |
||||
* Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-07-15 |
||||
*/ |
||||
public interface DeviceFamilyInfoMapper extends BaseMapper<DeviceFamilyInfo> { |
||||
|
||||
} |
@ -0,0 +1,17 @@
@@ -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.DeviceDisableApp; |
||||
|
||||
/** |
||||
* <p> |
||||
* 上课禁用(免打扰设置)表 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-09-13 |
||||
*/ |
||||
public interface DeviceDisableAppMapper extends BaseMapper<DeviceDisableApp> { |
||||
|
||||
} |
@ -0,0 +1,19 @@
@@ -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.DeviceFamilyInfo; |
||||
import com.ecell.internationalize.system.entity.dto.DeviceFamilyPageDTO; |
||||
|
||||
/** |
||||
* <p> |
||||
* 服务类 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-07-15 |
||||
*/ |
||||
public interface DeviceFamilyInfoService extends IService<DeviceFamilyInfo> { |
||||
|
||||
IPage queryPageList(DeviceFamilyPageDTO dto); |
||||
} |
@ -0,0 +1,18 @@
@@ -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.DeviceDisableApp; |
||||
|
||||
/** |
||||
* <p> |
||||
* 上课禁用(免打扰设置)表 服务类 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-09-13 |
||||
*/ |
||||
public interface DeviceDisableAppService extends IService<DeviceDisableApp> { |
||||
void sendToKafka(DeviceDisableApp deviceDisableApp); |
||||
|
||||
} |
@ -0,0 +1,83 @@
@@ -0,0 +1,83 @@
|
||||
package com.ecell.internationalize.system.service.api.impl; |
||||
import com.alibaba.fastjson.JSONObject; |
||||
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.DeviceDisabledAppDto; |
||||
import com.ecell.internationalize.common.issue.entity.DeviceDisabledInnerAppDto; |
||||
import com.ecell.internationalize.common.issue.issue.IssueInstructions; |
||||
import com.ecell.internationalize.system.entity.api.DeviceDisableApp; |
||||
import com.ecell.internationalize.system.mapper.api.DeviceDisableAppMapper; |
||||
import com.ecell.internationalize.system.service.api.DeviceDisableAppService; |
||||
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-13 |
||||
*/ |
||||
@Service |
||||
@Slf4j |
||||
public class DeviceDisableAppServiceImpl extends ServiceImpl<DeviceDisableAppMapper, DeviceDisableApp> implements DeviceDisableAppService { |
||||
@Autowired |
||||
private DeviceDisableAppMapper deviceDisableAppMapper; |
||||
|
||||
/** |
||||
* 上课禁用封装数据下发指令 |
||||
* @Author: liy |
||||
* @Date: 2022/9/15 10:26 |
||||
* @Description: |
||||
* @Version:1.0 |
||||
*/ |
||||
@Override |
||||
public void sendToKafka(DeviceDisableApp deviceDisableApp) { |
||||
|
||||
Date date = new Date(System.currentTimeMillis()); |
||||
|
||||
DeviceDisabledAppDto deviceDisabledAppDto=new DeviceDisabledAppDto(); |
||||
deviceDisabledAppDto.setType("disturb"); |
||||
deviceDisabledAppDto.setIdent("66666"); |
||||
deviceDisabledAppDto.setVender("20000"); |
||||
deviceDisabledAppDto.setOpenid(SecurityContextHolder.getStringUserId()); |
||||
deviceDisabledAppDto.setImei(deviceDisableApp.getImei()); |
||||
deviceDisabledAppDto.setTime(date.getTime()); |
||||
|
||||
//根据imei查询所有闹钟信息,进行全量下发
|
||||
LambdaQueryWrapper<DeviceDisableApp> lambdaQueryWrapper=new LambdaQueryWrapper<>(); |
||||
lambdaQueryWrapper.eq(DeviceDisableApp::getImei,deviceDisableApp.getImei()); |
||||
List<DeviceDisableApp> deviceDisableAppList = deviceDisableAppMapper.selectList(lambdaQueryWrapper); |
||||
//下发指令集合
|
||||
List<DeviceDisabledInnerAppDto> list=new ArrayList<>(); |
||||
DeviceDisabledInnerAppDto deviceDisabledInnerAppDto; |
||||
if (!CollectionUtils.isEmpty(deviceDisableAppList)){ |
||||
for (DeviceDisableApp deviceDisableApp1:deviceDisableAppList){ |
||||
deviceDisabledInnerAppDto=new DeviceDisabledInnerAppDto(); |
||||
deviceDisabledInnerAppDto.setStatus(Integer.valueOf(deviceDisableApp1.getAlarmStatus())); |
||||
deviceDisabledInnerAppDto.setStart(deviceDisableApp1.getAlarmStartTime()); |
||||
deviceDisabledInnerAppDto.setEnd(deviceDisableApp1.getAlarmEndTime()); |
||||
deviceDisabledInnerAppDto.setWeek(deviceDisableApp1.getAlarmWeek()); |
||||
list.add(deviceDisabledInnerAppDto); |
||||
} |
||||
} |
||||
deviceDisabledAppDto.setDisturb(list); |
||||
String object = JSONObject.toJSONString(deviceDisabledAppDto); |
||||
log.info("转换的JSON数据为:{}",object); |
||||
IssueInstructions issueInstructions = SpringUtils.getBean(IssueInstructions.class); |
||||
//3.调用方法缓存入redis,开始指令下发
|
||||
issueInstructions.emitDeviceDemand("disturb",deviceDisableApp.getImei(),deviceDisabledAppDto); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,47 @@
@@ -0,0 +1,47 @@
|
||||
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.entity.DeviceFamilyInfo; |
||||
import com.ecell.internationalize.system.entity.dto.DeviceFamilyPageDTO; |
||||
import com.ecell.internationalize.system.mapper.DeviceFamilyInfoMapper; |
||||
import com.ecell.internationalize.system.service.DeviceFamilyInfoService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-07-15 |
||||
*/ |
||||
@Service |
||||
public class DeviceFamilyInfoServiceImpl extends ServiceImpl<DeviceFamilyInfoMapper, DeviceFamilyInfo> implements DeviceFamilyInfoService { |
||||
@Autowired |
||||
private DeviceFamilyInfoMapper mapper; |
||||
|
||||
@Override |
||||
public IPage queryPageList(DeviceFamilyPageDTO dto) { |
||||
Page page =new Page(dto.getCurrent(),dto.getPageSize()); |
||||
QueryWrapper wrapper =new QueryWrapper(); |
||||
if (StringUtils.isNotEmpty(dto.getImei())){ |
||||
wrapper.eq("imei",dto.getImei()); |
||||
} |
||||
if (StringUtils.isNotEmpty(dto.getPhone())){ |
||||
wrapper.eq("device_phone",dto.getPhone()); |
||||
} |
||||
|
||||
|
||||
return mapper.selectPage(page, wrapper); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} |
Loading…
Reference in new issue