diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/annotation/FactoryLog.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/annotation/FactoryLog.java new file mode 100644 index 0000000..f082afc --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/annotation/FactoryLog.java @@ -0,0 +1,16 @@ +package com.ecell.internationalize.system.annotation; +import com.ecell.internationalize.system.constant.DeviceModelConstants; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author borui + */ +@Target({ ElementType.PARAMETER, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +public @interface FactoryLog { + String unBingType() default DeviceModelConstants.ZERO; +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/config/FeignConfiguration.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/config/FeignConfiguration.java new file mode 100644 index 0000000..5ec903d --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/config/FeignConfiguration.java @@ -0,0 +1,17 @@ +package com.ecell.internationalize.system.config; + +import com.ecell.internationalize.common.security.feign.FeignRequestInterceptor; +import feign.RequestInterceptor; +import org.springframework.context.annotation.Bean; + + +//@Configuration +public class FeignConfiguration { + @Bean("interceptor") + public RequestInterceptor requestInterceptor() + { + return new FeignRequestInterceptor(); + } + + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/FactoryLogInfoController.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/FactoryLogInfoController.java new file mode 100644 index 0000000..dbed34e --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/controller/FactoryLogInfoController.java @@ -0,0 +1,39 @@ +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.FactoryLogInfoService; +import io.swagger.annotations.Api; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + *

+ * 前端控制器 + *

+ * + * @author ${author} + * @since 2022-11-03 + */ +@Api(value="解绑日志记录",tags={"解绑日志记录接口"}) +@RestController +@RequestMapping("/factory-log-info") +public class FactoryLogInfoController { + @Autowired + private FactoryLogInfoService factoryLogInfoService; + /** + * 分页查询日志 + * @param dto + * @return + */ + @PostMapping("/page/list") + public AjaxResult queryPageList(@RequestBody ImeiLogPageDTO dto){ + return AjaxResult.success(LocaleUtil.getMessage(FieldConstant.MESSAGES_SUCCESS), factoryLogInfoService.queryByPageList(dto)); + } + +} + diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/FactoryLogInfo.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/FactoryLogInfo.java new file mode 100644 index 0000000..df98f0e --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/FactoryLogInfo.java @@ -0,0 +1,56 @@ +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.util.Date; + +/** + *

+ * + *

+ * + * @author ${author} + * @since 2022-11-03 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="FactoryLogInfo对象", description="") +public class FactoryLogInfo 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 = "创建时间") + private Date createTime; + + @ApiModelProperty(value = "解绑方式") + private String unbinding; + + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/DeviceTimeSwitchApp.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/DeviceTimeSwitchApp.java new file mode 100644 index 0000000..0c0d45c --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/entity/api/DeviceTimeSwitchApp.java @@ -0,0 +1,59 @@ +package com.ecell.internationalize.system.entity.api; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.util.Date; + +/** + *

+ * 定时开关机 + *

+ * + * @author ${author} + * @since 2022-09-21 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@ApiModel(value="DeviceTimeSwitchApp对象", description="定时开关机") +public class DeviceTimeSwitchApp implements Serializable { + +private static final long serialVersionUID=1L; + + @ApiModelProperty(example = "主键Id",hidden = true) + private String id; + + @ApiModelProperty(example = "设备imei") + private String imei; + + @ApiModelProperty(example = "开机时间") + private String startTime; + + @ApiModelProperty(example = "关机时间") + private String endTime; + + @ApiModelProperty(example = "功能是否启用 : 0:关闭, 1:打开") + private String status; + + @ApiModelProperty(example = "创建人",hidden = true) + private String createUser; + + @ApiModelProperty(example = "创建时间",hidden = true) + @TableField(value = "update_time",fill = FieldFill.INSERT) + private Date createTime; + + @ApiModelProperty(example = "修改人",hidden = true) + private String updateUser; + + @ApiModelProperty(example = "修改时间",hidden = true) + private Date updateTime; + + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/FactoryLogInfoMapper.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/FactoryLogInfoMapper.java new file mode 100644 index 0000000..6dc8f1d --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/FactoryLogInfoMapper.java @@ -0,0 +1,17 @@ +package com.ecell.internationalize.system.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.ecell.internationalize.system.entity.FactoryLogInfo; + + +/** + *

+ * Mapper 接口 + *

+ * + * @author ${author} + * @since 2022-11-03 + */ +public interface FactoryLogInfoMapper extends BaseMapper { + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceTimeSwitchAppMapper.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceTimeSwitchAppMapper.java new file mode 100644 index 0000000..2a8db51 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/mapper/api/DeviceTimeSwitchAppMapper.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.DeviceTimeSwitchApp; + +/** + *

+ * 定时开关机 Mapper 接口 + *

+ * + * @author ${author} + * @since 2022-09-21 + */ +public interface DeviceTimeSwitchAppMapper extends BaseMapper { + +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/FactoryLogInfoService.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/FactoryLogInfoService.java new file mode 100644 index 0000000..b7cf8e7 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/FactoryLogInfoService.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.FactoryLogInfo; +import com.ecell.internationalize.system.entity.dto.ImeiLogPageDTO; + +/** + *

+ * 服务类 + *

+ * + * @author ${author} + * @since 2022-11-03 + */ +public interface FactoryLogInfoService extends IService { + + IPage queryByPageList(ImeiLogPageDTO dto); +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceTimeSwitchAppService.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceTimeSwitchAppService.java new file mode 100644 index 0000000..7f7831d --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/api/DeviceTimeSwitchAppService.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.DeviceTimeSwitchApp; + +/** + *

+ * 定时开关机 服务类 + *

+ * + * @author ${author} + * @since 2022-09-21 + */ +public interface DeviceTimeSwitchAppService extends IService { + + void sendToKafka(DeviceTimeSwitchApp deviceTimeSwitchApp); +} diff --git a/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/FactoryLogInfoServiceImpl.java b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/FactoryLogInfoServiceImpl.java new file mode 100644 index 0000000..d726a11 --- /dev/null +++ b/ecell-internationalize/ecell-internationalize-system/src/main/java/com/ecell/internationalize/system/service/impl/FactoryLogInfoServiceImpl.java @@ -0,0 +1,61 @@ +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.FactoryLogInfo; +import com.ecell.internationalize.system.entity.dto.ImeiLogPageDTO; +import com.ecell.internationalize.system.mapper.FactoryLogInfoMapper; +import com.ecell.internationalize.system.service.FactoryLogInfoService; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; + +/** + *

+ * 服务实现类 + *

+ * + * @author ${author} + * @since 2022-11-03 + */ +@Service +public class FactoryLogInfoServiceImpl extends ServiceImpl implements FactoryLogInfoService { + + @Override + public IPage queryByPageList(ImeiLogPageDTO dto) { + Page page =new Page(dto.getCurrent(),dto.getPageSize()); + QueryWrapper wrapper = getQueryWrapper(dto); + return baseMapper.selectPage(page, wrapper); + + } + + /** + * 分页查询条件封装 + * @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); + return wrapper; + } + + + @Async("threadPoolTaskExecutor") + public void saveDelImeiLog(FactoryLogInfo info) { + save(info); + + } +}