diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DeviceFamilyInfoController.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DeviceFamilyInfoController.java new file mode 100644 index 0000000..7c4f813 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/DeviceFamilyInfoController.java @@ -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; + +/** + *

+ * 前端控制器 + *

+ * + * @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)); + + } + +} + diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DeviceFamilyInfo.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DeviceFamilyInfo.java new file mode 100644 index 0000000..bc65ca2 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/DeviceFamilyInfo.java @@ -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; + +/** + *

+ * + *

+ * + * @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; + + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/DeviceDisableApp.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/DeviceDisableApp.java new file mode 100644 index 0000000..e5d84d3 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/DeviceDisableApp.java @@ -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; + +/** + *

+ * 上课禁用(免打扰设置)表 + *

+ * + * @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; + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DeviceDisabledInnerAppDto.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DeviceDisabledInnerAppDto.java new file mode 100644 index 0000000..ac35952 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DeviceDisabledInnerAppDto.java @@ -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; +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/vo/DeviceDisableVo.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/vo/DeviceDisableVo.java new file mode 100644 index 0000000..ae9e359 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/vo/DeviceDisableVo.java @@ -0,0 +1,34 @@ +package com.ecell.internationalize.system.entity.api.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; + +/** + *

+ * 上课禁用(免打扰设置)表 + *

+ * + * @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; + + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceDTO.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceDTO.java new file mode 100644 index 0000000..cdf46a5 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/DeviceDTO.java @@ -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; +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/vo/DeviceCountInfo.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/vo/DeviceCountInfo.java new file mode 100644 index 0000000..fce80ce --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/vo/DeviceCountInfo.java @@ -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; +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DeviceFamilyInfoMapper.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DeviceFamilyInfoMapper.java new file mode 100644 index 0000000..d476d24 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/DeviceFamilyInfoMapper.java @@ -0,0 +1,16 @@ +package com.ecell.internationalize.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ecell.internationalize.system.entity.DeviceFamilyInfo; + +/** + *

+ * Mapper 接口 + *

+ * + * @author ${author} + * @since 2022-07-15 + */ +public interface DeviceFamilyInfoMapper extends BaseMapper { + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceDisableAppMapper.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceDisableAppMapper.java new file mode 100644 index 0000000..4159cbf --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceDisableAppMapper.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.DeviceDisableApp; + +/** + *

+ * 上课禁用(免打扰设置)表 Mapper 接口 + *

+ * + * @author ${author} + * @since 2022-09-13 + */ +public interface DeviceDisableAppMapper extends BaseMapper { + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DeviceFamilyInfoService.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DeviceFamilyInfoService.java new file mode 100644 index 0000000..14713a3 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/DeviceFamilyInfoService.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.DeviceFamilyInfo; +import com.ecell.internationalize.system.entity.dto.DeviceFamilyPageDTO; + +/** + *

+ * 服务类 + *

+ * + * @author ${author} + * @since 2022-07-15 + */ +public interface DeviceFamilyInfoService extends IService { + + IPage queryPageList(DeviceFamilyPageDTO dto); +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceDisableAppService.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceDisableAppService.java new file mode 100644 index 0000000..6c8c4ca --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceDisableAppService.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.DeviceDisableApp; + +/** + *

+ * 上课禁用(免打扰设置)表 服务类 + *

+ * + * @author ${author} + * @since 2022-09-13 + */ +public interface DeviceDisableAppService extends IService { + void sendToKafka(DeviceDisableApp deviceDisableApp); + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/DeviceDisableAppServiceImpl.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/DeviceDisableAppServiceImpl.java new file mode 100644 index 0000000..1cd1ce3 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/impl/DeviceDisableAppServiceImpl.java @@ -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; + + +/** + *

+ * 上课禁用(免打扰设置)表 服务实现类 + *

+ * + * @author ${author} + * @since 2022-09-13 + */ +@Service +@Slf4j +public class DeviceDisableAppServiceImpl extends ServiceImpl 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 lambdaQueryWrapper=new LambdaQueryWrapper<>(); + lambdaQueryWrapper.eq(DeviceDisableApp::getImei,deviceDisableApp.getImei()); + List deviceDisableAppList = deviceDisableAppMapper.selectList(lambdaQueryWrapper); + //下发指令集合 + List 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); + + } + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DeviceFamilyInfoServiceImpl.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DeviceFamilyInfoServiceImpl.java new file mode 100644 index 0000000..1eb5b3c --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/DeviceFamilyInfoServiceImpl.java @@ -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; + +/** + *

+ * 服务实现类 + *

+ * + * @author ${author} + * @since 2022-07-15 + */ +@Service +public class DeviceFamilyInfoServiceImpl extends ServiceImpl 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); + } + + + + + +}