caojianbin
8 months ago
10 changed files with 319 additions and 0 deletions
@ -0,0 +1,16 @@
@@ -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; |
||||
} |
@ -0,0 +1,17 @@
@@ -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(); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,39 @@
@@ -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; |
||||
|
||||
/** |
||||
* <p> |
||||
* 前端控制器 |
||||
* </p> |
||||
* |
||||
* @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)); |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,56 @@
@@ -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; |
||||
|
||||
/** |
||||
* <p> |
||||
* |
||||
* </p> |
||||
* |
||||
* @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; |
||||
|
||||
|
||||
} |
@ -0,0 +1,59 @@
@@ -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; |
||||
|
||||
/** |
||||
* <p> |
||||
* 定时开关机 |
||||
* </p> |
||||
* |
||||
* @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; |
||||
|
||||
|
||||
} |
@ -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.FactoryLogInfo; |
||||
|
||||
|
||||
/** |
||||
* <p> |
||||
* Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-11-03 |
||||
*/ |
||||
public interface FactoryLogInfoMapper extends BaseMapper<FactoryLogInfo> { |
||||
|
||||
} |
@ -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.DeviceTimeSwitchApp; |
||||
|
||||
/** |
||||
* <p> |
||||
* 定时开关机 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-09-21 |
||||
*/ |
||||
public interface DeviceTimeSwitchAppMapper extends BaseMapper<DeviceTimeSwitchApp> { |
||||
|
||||
} |
@ -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.FactoryLogInfo; |
||||
import com.ecell.internationalize.system.entity.dto.ImeiLogPageDTO; |
||||
|
||||
/** |
||||
* <p> |
||||
* 服务类 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-11-03 |
||||
*/ |
||||
public interface FactoryLogInfoService extends IService<FactoryLogInfo> { |
||||
|
||||
IPage queryByPageList(ImeiLogPageDTO 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.DeviceTimeSwitchApp; |
||||
|
||||
/** |
||||
* <p> |
||||
* 定时开关机 服务类 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-09-21 |
||||
*/ |
||||
public interface DeviceTimeSwitchAppService extends IService<DeviceTimeSwitchApp> { |
||||
|
||||
void sendToKafka(DeviceTimeSwitchApp deviceTimeSwitchApp); |
||||
} |
@ -0,0 +1,61 @@
@@ -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; |
||||
|
||||
/** |
||||
* <p> |
||||
* 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author ${author} |
||||
* @since 2022-11-03 |
||||
*/ |
||||
@Service |
||||
public class FactoryLogInfoServiceImpl extends ServiceImpl<FactoryLogInfoMapper, FactoryLogInfo> 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); |
||||
|
||||
} |
||||
} |
Loading…
Reference in new issue