Browse Source

重构国际化,系统模块设备模型机设备开发相关接口

master
caojianbin 8 months ago
parent
commit
025a96dbf4
  1. 146
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/aspect/DeleteImeiLog.java
  2. 91
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/config/AutoGenerateConfig.java
  3. 91
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/ChannelController.java
  4. 127
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/CheckVersionController.java
  5. 77
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/Channel.java
  6. 71
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/CheckVersion.java
  7. 31
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DelDeviceAlarmDto.java
  8. 32
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DelDeviceDisable.java
  9. 32
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/CheckVersionDto.java
  10. 16
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/ChannelMapper.java
  11. 17
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/CheckVersionMapper.java
  12. 26
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/ChannelService.java
  13. 25
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/CheckVersionService.java
  14. 42
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/ChannelServiceImpl.java
  15. 39
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/CheckVersionServiceImpl.java
  16. 193
      ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/utils/DateUtil.java
  17. 24
      ecell-internationalize/ecell-internationalize-system/src/main/resources/bootstrap.yml
  18. 22
      ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/ChannelMapper.xml
  19. 27
      ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/CheckVersionMapper.xml

146
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/aspect/DeleteImeiLog.java

@ -0,0 +1,146 @@ @@ -0,0 +1,146 @@
package com.ecell.internationalize.system.aspect;
import com.ecell.internationalize.common.core.domain.UserLogin;
import com.ecell.internationalize.common.core.utils.StringUtils;
import com.ecell.internationalize.common.core.utils.ip.IpUtils;
import com.ecell.internationalize.common.core.utils.poi.ExcelUtil;
import com.ecell.internationalize.common.core.utils.uuid.UUID;
import com.ecell.internationalize.common.security.utils.SecurityUtils;
import com.ecell.internationalize.system.annotation.DelImeiLog;
import com.ecell.internationalize.system.constant.DeviceModelConstants;
import com.ecell.internationalize.system.entity.DelimeiLogInfo;
import com.ecell.internationalize.system.entity.dto.DeviceDTO;
import com.ecell.internationalize.system.service.impl.DelimeiLogInfoServiceImpl;
import com.ecell.internationalize.system.utils.HttpServletUtil;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import java.util.*;
@Aspect
@Component
public class DeleteImeiLog {
private static final Logger logg = LoggerFactory.getLogger(DeleteImeiLog.class);
@Autowired
private DelimeiLogInfoServiceImpl delimeiLogInfoService;
/**
* 处理完请求后执行
*
* @param joinPoint 切点
*/
@AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult")
public void doAfterReturning(JoinPoint joinPoint, DelImeiLog controllerLog, Object jsonResult)
{
handleLog(joinPoint, controllerLog, null, jsonResult);
}
protected void handleLog(final JoinPoint joinPoint, DelImeiLog controllerLog, final Exception e, Object jsonResult)
{
try
{
// *========数据库日志=========*//
DelimeiLogInfo info =new DelimeiLogInfo();
info.setImeiDelId(UUID.fastUUID().toString(true));
info.setCreateTime(new Date());
// 请求的地址
String ip = IpUtils.getIpAddr(HttpServletUtil.getRequest());
info.setIp(ip);
String username = SecurityUtils.getUsername();
UserLogin userLogin = SecurityUtils.getUserLogin();
if (StringUtils.isNotEmpty(userLogin.getRoles()) && userLogin.getRoles().size()>0){
info.setUserRole(Arrays.toString(userLogin.getRoles().toArray(new String[0])));
}else {
info.setUserRole("");
}
if (StringUtils.isNotBlank(username))
{
info.setLoginAccount(username);
}
// 处理设置注解上的参数
getControllerMethodDescription(joinPoint, controllerLog, info, jsonResult);
// 保存数据库
//imeiLogInfoService.save(info);
delimeiLogInfoService.saveDelImeiLog(info);
}
catch (Exception exp)
{
// 记录本地异常日志
logg.error("==通知异常==");
logg.error("异常信息:{}", exp.getMessage());
exp.printStackTrace();
}
}
private void getControllerMethodDescription(JoinPoint joinPoint, DelImeiLog controllerLog, DelimeiLogInfo info, Object jsonResult) {
//根据id批量删除
if (DeviceModelConstants.ZERO.equals(controllerLog.delType())){
info.setUnbinding(DeviceModelConstants.DELLETE_MODE_ZERO);
argsArrayToString(joinPoint.getArgs(),info);
}else {
info.setUnbinding(DeviceModelConstants.DELLETE_MODE_ONE);
//根据导入的imei进行删除
argsArrayTwoToString(joinPoint.getArgs(),info,jsonResult);
}
}
private void argsArrayToString(Object[] paramsArray, DelimeiLogInfo info) {
StringBuilder builder =new StringBuilder();
List<String> list =new ArrayList<>();
if (paramsArray != null && paramsArray.length > 0){
if (paramsArray[0] instanceof String ){
list= Arrays.asList((String) paramsArray[0]);
}else {
list =(List<String>) paramsArray[0];
}
if (StringUtils.isNotEmpty(list) && list.size()>0){
builder.append("共有:"+list.size()+"条:");
for (String s : list) {
builder.append("<br/>"+s+"<br/>").append(",");
}
}
}
info.setOperationDescribe(builder.toString());
}
private void argsArrayTwoToString(Object[] paramsArray, DelimeiLogInfo info, Object jsonResult) {
List<DeviceDTO> userList = Collections.emptyList();
StringBuilder builder =new StringBuilder();
if (paramsArray != null && paramsArray.length > 0) {
try {
MultipartFile file = (MultipartFile) paramsArray[0];
if (StringUtils.isNotNull(file)) {
ExcelUtil<DeviceDTO> util = new ExcelUtil<DeviceDTO>(DeviceDTO.class);
userList = util.importExcel(file.getInputStream());
if (StringUtils.isNotEmpty(userList) && userList.size()>0){
for (DeviceDTO deviceDTO : userList) {
builder.append("<br/>"+deviceDTO.getImei()+"<br/>").append(",");
}
}
}
} catch (Exception e) {
logg.info("参数异常:{}", e.getMessage());
}
}
info.setOperationDescribe(builder.toString());
}
}

91
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/config/AutoGenerateConfig.java

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
package com.ecell.internationalize.system.config;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
import com.baomidou.mybatisplus.generator.config.GlobalConfig;
import com.baomidou.mybatisplus.generator.config.PackageConfig;
import com.baomidou.mybatisplus.generator.config.StrategyConfig;
import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
/**
* 自动生成 实体DAOservice配置
* @Title: AutoGenerateConfig
* @Author: liy
* @Date: 2022/7/6 10:55
* @Version:1.0
*/
public class AutoGenerateConfig {
public static void autoGenerate() {
// Step1:代码生成器
AutoGenerator mpg = new AutoGenerator();
// Step2:全局配置
GlobalConfig gc = new GlobalConfig();
// 填写代码生成的目录(需要修改)
// String projectPath = "F:\\dev\\yisai-Cloud\\yisai-modules\\yisai-system";
String projectPath= "F:\\dev\\yisai-Cloud\\yisai-modules\\yisai-app";
// 拼接出代码最终输出的目录
gc.setOutputDir(projectPath + "/src/main/java");
//实体属性 Swagger2 注解
gc.setSwagger2(true);
// 配置开发者信息(可选)(需要修改)
// gc.setAuthor("liy");
// 配置是否打开目录,false 为不打开(可选)
gc.setOpen(false);
// 默认生成的 service 会有 I 前缀,这样就没有
gc.setServiceName("%sService");
mpg.setGlobalConfig(gc);
// Step3:数据源配置(需要修改)
DataSourceConfig dsc = new DataSourceConfig();
// 配置数据库 url 地址
dsc.setUrl("jdbc:mysql://192.168.0.106:3306/ys-business?useUnicode=true&characterEncoding=utf8");
// 配置数据库驱动
dsc.setDriverName("com.mysql.cj.jdbc.Driver");
// 配置数据库连接用户名
dsc.setUsername("root");
// 配置数据库连接密码
dsc.setPassword("123456");
mpg.setDataSource(dsc);
// Step:4:包配置
PackageConfig pc = new PackageConfig();
// 配置父包名(需要修改)
pc.setParent("com.yisai.app");
// pc.setParent("com.yisai.system");
// 配置模块名(需要修改)
// pc.setModuleName("");
// 配置 entity 包名
pc.setEntity("entity");
// 配置 mapper 包名
pc.setMapper("mapper");
// 配置 service 包名
pc.setService("service");
// 配置 controller 包名
pc.setController("controller");
mpg.setPackageInfo(pc);
// Step5:策略配置(数据库表配置)
StrategyConfig strategy = new StrategyConfig();
// 指定表名(可以同时操作多个表,使用 , 隔开)(需要修改)
strategy.setInclude("app_unbind_log");
// 配置数据表与实体类名之间映射的策略
strategy.setNaming(NamingStrategy.underline_to_camel);
// 配置数据表的字段与实体类的属性名之间映射的策略
strategy.setColumnNaming(NamingStrategy.underline_to_camel);
// 配置 lombok 模式
strategy.setEntityLombokModel(true);
// 配置 rest 风格的控制器(@RestController)
strategy.setRestControllerStyle(true);
// 配置驼峰转连字符
strategy.setControllerMappingHyphenStyle(true);
// 配置表前缀,生成实体时去除表前缀
// 此处的表名为 test_mybatis_plus_user,模块名为 test_mybatis_plus,去除前缀后剩下为 user。
strategy.setTablePrefix(pc.getModuleName() + "_");
mpg.setStrategy(strategy);
// Step6:执行代码生成操作
mpg.execute();
}
public static void main(String[] args) {
autoGenerate();
}
}

91
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/ChannelController.java

@ -0,0 +1,91 @@ @@ -0,0 +1,91 @@
package com.ecell.internationalize.system.controller;
import com.ecell.internationalize.common.core.utils.locale.LocaleUtil;
import com.ecell.internationalize.common.core.utils.uuid.UUID;
import com.ecell.internationalize.common.core.web.domain.AjaxResult;
import com.ecell.internationalize.common.security.utils.SecurityUtils;
import com.ecell.internationalize.common.system.annotation.SystemLog;
import com.ecell.internationalize.common.system.constant.FieldConstant;
import com.ecell.internationalize.system.entity.Channel;
import com.ecell.internationalize.system.service.ChannelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
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;
import javax.validation.Valid;
import java.util.Map;
/**
* <p>
* 渠道管理 前端控制器
* </p>
*
* @author liy
* @since 2022-07-14
*/
@Api(value="渠道管理",tags={"渠道管理接口"})
@RestController
@RequestMapping("/channel")
public class ChannelController {
@Autowired
private ChannelService channelService;
/**
* 渠道管理分页查询
* @Author liy
* @Date 2022/7/15 16:38
* @param map 分页条件查询体
* @Return AjaxResult
*/
@ApiOperation("条件分页查询渠道管理信息")
@PostMapping("manage/list")
public AjaxResult queryAllByPage(@RequestBody Map<String,Object> map){
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),channelService.findAllByPage(map));
}
/**
* 渠道管理删除
* @Author liy
* @Date 2022/7/15 16:38
* @param channel 实体类
* @Return AjaxResult
*/
@ApiOperation("渠道管理删除")
@SystemLog(msg =FieldConstant.CHANNEL_MANAGE,operation = FieldConstant.DELETE_OPERATOR)
@PostMapping("manage/del")
public AjaxResult changeStatusOrDelUser(@RequestBody @ApiParam(value="传整个对象,修改其中delFlag字段,(0:删除,1:正常)",required=true) Channel channel){
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),channelService.updateById(channel));
}
/**
* 渠道管理新增
* @Author liy
* @Date 2022/7/15 17:38
* @param channel 类别实体
* @Return AjaxResult
*/
@ApiOperation("渠道管理新增")
@SystemLog(msg =FieldConstant.CHANNEL_MANAGE,operation = FieldConstant.SAVE_OPERATOR)
@PostMapping("manage/save")
public AjaxResult save(@RequestBody @Valid Channel channel){
String id= UUID.randomUUID().toString(true);
channel.setId(id);
channel.setCreateUser(SecurityUtils.getUsername());
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),channelService.save(channel));
}
/**
* 渠道管理修改
* @Author liy
* @Date 2022/7/15 17:38
* @param channel 类别实体
* @Return AjaxResult
*/
@ApiOperation("渠道管理修改")
@SystemLog(msg =FieldConstant.CHANNEL_MANAGE,operation = FieldConstant.UPDATE_OPERATOR)
@PostMapping("manage/update")
public AjaxResult update(@RequestBody @Valid Channel channel){
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),channelService.updateById(channel));
}
}

127
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/CheckVersionController.java

@ -0,0 +1,127 @@ @@ -0,0 +1,127 @@
package com.ecell.internationalize.system.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ecell.internationalize.common.core.utils.locale.LocaleUtil;
import com.ecell.internationalize.common.core.utils.uuid.UUID;
import com.ecell.internationalize.common.core.web.domain.AjaxResult;
import com.ecell.internationalize.common.security.utils.SecurityUtils;
import com.ecell.internationalize.common.system.annotation.SystemLog;
import com.ecell.internationalize.common.system.constant.FieldConstant;
import com.ecell.internationalize.common.system.entity.CheckVersionUpload;
import com.ecell.internationalize.common.system.utlis.UploadUtil;
import com.ecell.internationalize.system.entity.CheckVersion;
import com.ecell.internationalize.system.entity.dto.CheckVersionDto;
import com.ecell.internationalize.system.service.CheckVersionService;
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.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.Date;
import java.util.List;
/**
* <p>
* 检查版本更新表 前端控制器
* </p>
*
* @author ${author}
* @since 2022-10-27
*/
@Api(value="检查版本更新",tags={"检查版本更新接口"})
@RestController
@RequestMapping("/check_version")
public class CheckVersionController {
@Autowired
private CheckVersionService checkVersionService;
@ApiOperation("条件分页查询版本更新信息")
@PostMapping("version/list")
public Rest<IPage<CheckVersion>> queryAllVersion(@RequestBody CheckVersionDto checkVersionDto){
return Rest.ok(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),checkVersionService.findAllByPage(checkVersionDto));
}
/**
* 版本更新新增
* @Author liy
* @Date 2022/7/14 16:38
* @Return AjaxResult
*/
@ApiOperation("版本更新新增")
@SystemLog(msg =FieldConstant.VERSION_UPDATE,operation = FieldConstant.SAVE_OPERATOR)
@PostMapping("version/save")
public Rest versionSave(@RequestBody CheckVersion checkVersion){
LambdaQueryWrapper<CheckVersion> lambdaQueryWrapper=new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CheckVersion::getStatus,checkVersion.getStatus());
lambdaQueryWrapper.eq(CheckVersion::getAppPackage,checkVersion.getAppPackage());
lambdaQueryWrapper.eq(CheckVersion::getVersionNum,checkVersion.getVersionNum());
CheckVersion version = checkVersionService.getBaseMapper().selectOne(lambdaQueryWrapper);
if (null!=version){
return Rest.fail(LocaleUtil.getMessage(FieldConstant.VERSION_HAS_EXIT));
}
String id= UUID.randomUUID().toString(true);
checkVersion.setId(id);
checkVersion.setCreateUser(SecurityUtils.getUsername());
checkVersion.setCreateTime(new Date());
checkVersionService.save(checkVersion);
return Rest.ok(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS));
}
/**
* 版本更新修改
* @Author liy
* @Date 2022/7/14 16:38
* @Return AjaxResult
*/
@ApiOperation("版本更新修改")
@SystemLog(msg =FieldConstant.VERSION_UPDATE,operation = FieldConstant.UPDATE_OPERATOR)
@PostMapping("version/update")
public Rest versionUpdate(@RequestBody CheckVersion checkVersion) {
LambdaQueryWrapper<CheckVersion> lambdaQueryWrapper=new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(CheckVersion::getStatus,checkVersion.getStatus());
lambdaQueryWrapper.eq(CheckVersion::getAppPackage,checkVersion.getAppPackage());
lambdaQueryWrapper.eq(CheckVersion::getVersionNum,checkVersion.getVersionNum());
CheckVersion version = checkVersionService.getBaseMapper().selectOne(lambdaQueryWrapper);
if (null!=version && !version.getId().equals(checkVersion.getId())){
return Rest.fail(LocaleUtil.getMessage(FieldConstant.VERSION_HAS_EXIT));
}
checkVersion.setUpdateTime(new Date());
checkVersion.setUpdateUser(SecurityUtils.getUsername());
checkVersionService.updateById(checkVersion);
return Rest.ok(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS));
}
/**
* 版本更新删除
* @Author liy
* @Date 2022/7/15 16:38
* @Return AjaxResult
*/
@ApiOperation("版本更新删除")
@SystemLog(msg =FieldConstant.VERSION_UPDATE,operation = FieldConstant.DELETE_OPERATOR)
@PostMapping("version/del")
public Rest versionDel(@RequestBody List<String> ids){
checkVersionService.getBaseMapper().deleteBatchIds(ids);
return Rest.ok(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS));
}
/**
* APK文件上传
* @Author liy
* @Date 2022/7/14 16:38
* @Return AjaxResult
*/
@ApiOperation("APK文件上传返回AppUrl和APK名称")
@PostMapping("version/upload")
public AjaxResult versionUpload(@RequestParam(value = "file") MultipartFile file) throws IOException {
CheckVersionUpload checkVersionUpload = UploadUtil.versionUpload(file);
if (!"apk".equals(checkVersionUpload.getGetSuffix())){
return AjaxResult.error(LocaleUtil.getMessage(FieldConstant.VERSION_APK_UPLOAD));
}
return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS),checkVersionUpload);
}
}

77
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/Channel.java

@ -0,0 +1,77 @@ @@ -0,0 +1,77 @@
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 javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
* 渠道管理
* </p>
*
* @author liy
* @since 2022-07-14
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("channel")
public class Channel implements Serializable {
private static final long serialVersionUID=1L;
/**
* 主键Id
*/
@TableId("id")
private String id;
/**
* 删除标识0已删除1正常
*/
private String delFlag;
/**
* 创建人
*/
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;
/**
* 渠道商
*/
@NotBlank(message = "渠道商名称不能为空")
private String channelFirm;
/**
* APP渠道标识
*/
@NotBlank(message = "APP渠道标识不能为空")
private String channelIdentify;
}

71
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/CheckVersion.java

@ -0,0 +1,71 @@ @@ -0,0 +1,71 @@
package com.ecell.internationalize.system.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
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-10-27
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="CheckVersion对象", description="检查版本更新表")
public class CheckVersion implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(example = "主键Id")
private String id;
@ApiModelProperty(example = "创建人")
private String createUser;
@ApiModelProperty(example = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime;
@ApiModelProperty(example = "修改人")
private String updateUser;
@ApiModelProperty(example = "修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date updateTime;
@ApiModelProperty(example = "状态(0:禁用,1正常)")
private String status;
@ApiModelProperty(example = "APP包名称")
private String appPackage;
@ApiModelProperty(example = "APP url")
private String appUrl;
@ApiModelProperty(example = "apk名称")
private String apkName;
@ApiModelProperty(example = "是否强制更新(0:否,1:是)")
private String forceUpdate;
@ApiModelProperty(example = "版本号")
private String versionNum;
@ApiModelProperty(example = "版本说明")
private String versionExplain;
@ApiModelProperty(example = "备注")
private String remark;
}

31
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DelDeviceAlarmDto.java

@ -0,0 +1,31 @@ @@ -0,0 +1,31 @@
package com.ecell.internationalize.system.entity.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* 闹钟设置表
* </p>
*
* @author liy
* @since 2022-09-07
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class DelDeviceAlarmDto implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(example = "主键Id")
private String id;
@ApiModelProperty(example = "设备imei")
private String imei;
}

32
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/dto/DelDeviceDisable.java

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
package com.ecell.internationalize.system.entity.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* 上课禁用(免打扰设置)
* </p>
*
* @author ${author}
* @since 2022-09-13
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class DelDeviceDisable implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(example = "主键Id")
private String id;
@ApiModelProperty(example = "设备imei")
private String imei;
}

32
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/dto/CheckVersionDto.java

@ -0,0 +1,32 @@ @@ -0,0 +1,32 @@
package com.ecell.internationalize.system.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 检查版本更新表
* </p>
*
* @author ${author}
* @since 2022-10-27
*/
@Data
public class CheckVersionDto implements Serializable {
private static final long serialVersionUID=1L;
@ApiModelProperty(example = "当前页")
private Integer current;
@ApiModelProperty(example = "每页显示多少条")
private Integer pageSize;
@ApiModelProperty(example = "APP包名称")
private String appPackage;
@ApiModelProperty(example = "apk名称")
private String apkName;
}

16
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/ChannelMapper.java

@ -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.Channel;
/**
* <p>
* 渠道管理 Mapper 接口
* </p>
*
* @author liy
* @since 2022-07-14
*/
public interface ChannelMapper extends BaseMapper<Channel> {
}

17
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/CheckVersionMapper.java

@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
package com.ecell.internationalize.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ecell.internationalize.system.entity.CheckVersion;
/**
* <p>
* 检查版本更新表 Mapper 接口
* </p>
*
* @author ${author}
* @since 2022-10-27
*/
public interface CheckVersionMapper extends BaseMapper<CheckVersion> {
}

26
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/ChannelService.java

@ -0,0 +1,26 @@ @@ -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.Channel;
import java.util.Map;
/**
* <p>
* 渠道管理 服务类
* </p>
*
* @author liy
* @since 2022-07-14
*/
public interface ChannelService extends IService<Channel> {
/**
* 渠道管理分页查询
* @Author liy
* @Date 2022/7/15 16:42
* @param map 分页查询体
* @return IPage
*/
IPage<Channel> findAllByPage(Map<String,Object> map);
}

25
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/CheckVersionService.java

@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
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.CheckVersion;
import com.ecell.internationalize.system.entity.dto.CheckVersionDto;
/**
* <p>
* 检查版本更新表 服务类
* </p>
*
* @author ${author}
* @since 2022-10-27
*/
public interface CheckVersionService extends IService<CheckVersion> {
/**
* 检查版本更新表r分页查询
* @Author liy
* @Date 2022/7/14 16:42
* @param checkVersionDto 分页查询体
* @return IPage
*/
IPage<CheckVersion> findAllByPage(CheckVersionDto checkVersionDto);
}

42
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/ChannelServiceImpl.java

@ -0,0 +1,42 @@ @@ -0,0 +1,42 @@
package com.ecell.internationalize.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.Channel;
import com.ecell.internationalize.system.mapper.ChannelMapper;
import com.ecell.internationalize.system.service.ChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* <p>
* 渠道管理 服务实现类
* </p>
*
* @author liy
* @since 2022-07-14
*/
@Service
public class ChannelServiceImpl extends ServiceImpl<ChannelMapper, Channel> implements ChannelService {
@Autowired
private ChannelMapper channelMapper;
/**
* 渠道管理分页查询
* @Author liy
* @Date 2022/7/15 16:42
* @param map 分页查询体
* @return IPage
*/
@Override
public IPage<Channel> findAllByPage(Map<String, Object> map) {
Page<Channel> page=new Page<>(Integer.parseInt(map.get(FieldConstant.CURRENT).toString()),Integer.parseInt(map.get(FieldConstant.SIZE).toString()));
LambdaQueryWrapper<Channel> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Channel::getDelFlag, FieldConstant.MATH_ONE);
return channelMapper.selectPage(page,queryWrapper);
}
}

39
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/CheckVersionServiceImpl.java

@ -0,0 +1,39 @@ @@ -0,0 +1,39 @@
package com.ecell.internationalize.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.system.entity.CheckVersion;
import com.ecell.internationalize.system.entity.dto.CheckVersionDto;
import com.ecell.internationalize.system.mapper.CheckVersionMapper;
import com.ecell.internationalize.system.service.CheckVersionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
* 检查版本更新表 服务实现类
* </p>
*
* @author ${author}
* @since 2022-10-27
*/
@Service
public class CheckVersionServiceImpl extends ServiceImpl<CheckVersionMapper, CheckVersion> implements CheckVersionService {
@Autowired
private CheckVersionMapper checkVersionMapper;
@Override
public IPage<CheckVersion> findAllByPage(CheckVersionDto checkVersionDto) {
Page<CheckVersion> page=new Page<>(checkVersionDto.getCurrent(),checkVersionDto.getPageSize());
LambdaQueryWrapper<CheckVersion> lambdaQueryWrapper = new LambdaQueryWrapper<>();
if (null!=checkVersionDto.getAppPackage() && !"".equals(checkVersionDto.getAppPackage())){
lambdaQueryWrapper.eq(CheckVersion::getAppPackage,checkVersionDto.getAppPackage());
}
if (null!=checkVersionDto.getApkName() && !"".equals(checkVersionDto.getApkName())){
lambdaQueryWrapper.eq(CheckVersion::getApkName,checkVersionDto.getApkName());
}
lambdaQueryWrapper.orderByDesc(CheckVersion::getCreateTime);
return checkVersionMapper.selectPage(page,lambdaQueryWrapper);
}
}

193
ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/utils/DateUtil.java

@ -0,0 +1,193 @@ @@ -0,0 +1,193 @@
package com.ecell.internationalize.system.utils;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.lang.management.ManagementFactory;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.*;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
* @author borui
*/
public class DateUtil extends org.apache.commons.lang3.time.DateUtils {
public static String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM";
public static String YYYY_MM_DD = "yyyy-MM-dd";
public static String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
/**
* 获取当前Date型日期
*
* @return Date() 当前日期
*/
public static Date getNowDate()
{
return new Date();
}
/**
* 获取当前日期, 默认格式为yyyy-MM-dd
*
* @return String
*/
public static String getDate()
{
return dateTimeNow(YYYY_MM_DD);
}
public static final String getTime()
{
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
}
public static final String dateTimeNow()
{
return dateTimeNow(YYYYMMDDHHMMSS);
}
public static final String dateTimeNow(final String format)
{
return parseDateToStr(format, new Date());
}
public static final String dateTime(final Date date)
{
return parseDateToStr(YYYY_MM_DD, date);
}
public static final String parseDateToStr(final String format, final Date date)
{
return new SimpleDateFormat(format).format(date);
}
public static final Date dateTime(final String format, final String ts)
{
try
{
return new SimpleDateFormat(format).parse(ts);
}
catch (ParseException e)
{
throw new RuntimeException(e);
}
}
/**
* 日期路径 即年// 如2018/08/08
*/
public static final String datePath()
{
Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd");
}
/**
* 日期路径 即年// 如20180808
*/
public static final String dateTime()
{
Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd");
}
/**
* 日期型字符串转化为日期 格式
*/
public static Date parseDate(Object str)
{
if (str == null)
{
return null;
}
try
{
return parseDate(str.toString(), parsePatterns);
}
catch (ParseException e)
{
return null;
}
}
/**
* 获取服务器启动时间
*/
public static Date getServerStartDate()
{
long time = ManagementFactory.getRuntimeMXBean().getStartTime();
return new Date(time);
}
/**
* 计算两个时间差
*/
public static String getDatePoor(Date endDate, Date nowDate)
{
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day + "天" + hour + "小时" + min + "分钟";
}
/**
* 增加 LocalDateTime ==> Date
*/
public static Date toDate(LocalDateTime temporalAccessor)
{
ZonedDateTime zdt = temporalAccessor.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
/**
* 增加 LocalDate ==> Date
*/
public static Date toDate(LocalDate temporalAccessor)
{
LocalDateTime localDateTime = LocalDateTime.of(temporalAccessor, LocalTime.of(0, 0, 0));
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
public static Date getDayBegin() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
}
public static Date getDayEnd() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
return cal.getTime();
}
}

24
ecell-internationalize/ecell-internationalize-system/src/main/resources/bootstrap.yml

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
# Tomcat
server:
port: 9765
# Spring
spring:
application:
# 应用名称
name: ecell-internationalize-system
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 127.0.0.1:8848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

22
ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/ChannelMapper.xml

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
<?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.ChannelMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.ecell.internationalize.system.entity.Channel">
<id column="id" property="id" />
<result column="del_flag" property="delFlag" />
<result column="create_user" property="createUser" />
<result column="create_time" property="createTime" />
<result column="update_user" property="updateUser" />
<result column="update_time" property="updateTime" />
<result column="channel_firm" property="channelFirm" />
<result column="channel_identify" property="channelIdentify" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, del_flag, create_user, create_time, update_user, update_time, channel_firm, channel_identify
</sql>
</mapper>

27
ecell-internationalize/ecell-internationalize-system/src/main/resources/com/ecell/internationalize/system/mapper/CheckVersionMapper.xml

@ -0,0 +1,27 @@ @@ -0,0 +1,27 @@
<?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.CheckVersionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.ecell.internationalize.system.entity.CheckVersion">
<id column="id" property="id" />
<result column="create_user" property="createUser" />
<result column="create_time" property="createTime" />
<result column="update_user" property="updateUser" />
<result column="update_time" property="updateTime" />
<result column="status" property="status" />
<result column="app_package" property="appPackage" />
<result column="app_url" property="appUrl" />
<result column="apk_name" property="apkName" />
<result column="force_update" property="forceUpdate" />
<result column="version_num" property="versionNum" />
<result column="version_explain" property="versionExplain" />
<result column="remark" property="remark" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, create_user, create_time, update_user, update_time, status, app_package, app_url, apk_name, force_update, version_num, version_explain, remark
</sql>
</mapper>
Loading…
Cancel
Save