通讯日志
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
package com.mt.wms.basic.controller;
|
||||
|
||||
import com.mt.wms.basic.params.CommunicationQueryParam;
|
||||
import com.mt.wms.basic.service.CommunicationService;
|
||||
import com.mt.wms.basic.vo.CommunicationVo;
|
||||
import com.mt.wms.core.base.BaseController;
|
||||
import com.mt.wms.core.constants.CommonConstant;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.validator.groups.PageGroup;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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.groups.Default;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2021/11/18 10:34
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "communication")
|
||||
@Slf4j
|
||||
@Api(value = "通讯日志管理", tags = "通讯日志管理", hidden = false)
|
||||
public class CommunicationContrallor extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CommunicationService communicationService;
|
||||
|
||||
@PostMapping(value = "get")
|
||||
@ApiOperation(value = "获取报警基础信息")
|
||||
private R<CommunicationVo> get(@Validated @RequestBody IdParam idParam) {
|
||||
return communicationService.get(idParam);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "page")
|
||||
@ApiOperation(value = "获取分页报警基础信息")
|
||||
private R<PageVo<CommunicationVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody CommunicationQueryParam communicationQueryParam) {
|
||||
return communicationService.page(communicationQueryParam);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mt.wms.basic.params;
|
||||
|
||||
import com.mt.wms.core.params.BasePageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2021/11/18 10:13
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "通讯日志查询参数", description = "用于查询通讯日志")
|
||||
public class CommunicationQueryParam extends BasePageParam {
|
||||
/**
|
||||
* 主键,自增
|
||||
*/
|
||||
@ApiModelProperty(value = "主键",required = false, example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ApiModelProperty(value = "类型",required = false, example = "1")
|
||||
private Integer type;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mt.wms.basic.service;
|
||||
|
||||
import com.mt.wms.basic.params.CommunicationQueryParam;
|
||||
import com.mt.wms.basic.vo.CommunicationVo;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2021/11/18 10:16
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface CommunicationService {
|
||||
/**
|
||||
* 获取xx
|
||||
*
|
||||
* @param idParam 主键参数
|
||||
* @return xx
|
||||
*/
|
||||
R<CommunicationVo> get(IdParam idParam);
|
||||
|
||||
/**
|
||||
* 获取xx分页列表
|
||||
*
|
||||
* @param kilnInfoQueryParam xx查询参数
|
||||
* @return xx分页列表
|
||||
*/
|
||||
R<PageVo<CommunicationVo>> page(CommunicationQueryParam kilnInfoQueryParam);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.mt.wms.basic.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mt.wms.basic.params.CommunicationQueryParam;
|
||||
import com.mt.wms.basic.service.CommunicationService;
|
||||
import com.mt.wms.basic.vo.AlarmBaseVo;
|
||||
import com.mt.wms.basic.vo.CommunicationVo;
|
||||
import com.mt.wms.core.api.Assert;
|
||||
import com.mt.wms.core.base.BaseService;
|
||||
import com.mt.wms.core.dal.entity.CommunicationLog;
|
||||
import com.mt.wms.core.dal.service.CommunicationLogServiceBiz;
|
||||
import com.mt.wms.core.errorcode.ApiErrorCode;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.utils.StringUtils;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2021/11/18 10:18
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class CommunicationServiceImpl extends BaseService implements CommunicationService {
|
||||
@Resource
|
||||
private CommunicationLogServiceBiz communicationLogServiceBiz;
|
||||
@Override
|
||||
public R<CommunicationVo> get(IdParam idParam) {
|
||||
Assert.notNull(ApiErrorCode.INVALID_PARAMETER,idParam.getId());
|
||||
CommunicationLog communicationLog = communicationLogServiceBiz.getById(idParam.getId());
|
||||
CommunicationVo communicationVo = CommunicationVo.builder().build();
|
||||
BeanUtils.copyProperties(communicationLog,communicationVo);
|
||||
return successful(communicationVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<PageVo<CommunicationVo>> page(CommunicationQueryParam communicationQueryParam) {
|
||||
QueryWrapper<CommunicationLog> wrapper=new QueryWrapper<>();
|
||||
wrapper.eq(CommunicationLog.VALID,1);
|
||||
wrapper.eq(communicationQueryParam.getType()!=null,CommunicationLog.TYPE,communicationQueryParam.getType());
|
||||
Page<CommunicationLog> page = communicationLogServiceBiz.page(new Page<>(communicationQueryParam.getCurrent(), communicationQueryParam.getSize()), wrapper);
|
||||
return successful(new PageVo<>(page,CommunicationVo.class));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.mt.wms.basic.vo;
|
||||
|
||||
import com.mt.wms.core.base.BaseVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2021/11/18 8:55
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@ApiModel(value = "通讯日志视图对象", description = "用于查询通讯日志信息")
|
||||
public class CommunicationVo extends BaseVo implements PageVo.ConvertVo {
|
||||
/**
|
||||
* 主键,自增
|
||||
*/
|
||||
@ApiModelProperty(value = "主键,更新时需要填写", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@ApiModelProperty(value = "编码", example = "1")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 日志名称
|
||||
*/
|
||||
@ApiModelProperty(value = "日志名称", example = "1")
|
||||
private String logName;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
@ApiModelProperty(value = "日志名称", example = "1")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
@ApiModelProperty(value = "类型", example = "1")
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间", example = "1")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
Reference in New Issue
Block a user