OMS-GW-log
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
package com.mhd.oms.application.service.gwLog;
|
||||
|
||||
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
|
||||
import com.mhd.oms.domain.gwLog.repository.po.GwLogPO;
|
||||
import com.mhd.oms.interfaces.dto.gwLog.GwLogDTO;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class GwLogApplicationService {
|
||||
|
||||
|
||||
private final GwLogMapper gwLogMapper;
|
||||
|
||||
public GwLogApplicationService(GwLogMapper gwLogMapper) {
|
||||
this.gwLogMapper = gwLogMapper;
|
||||
}
|
||||
|
||||
public TableDataInfo queryList(GwLogDTO gwLogDTO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null){
|
||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
||||
if (topOrganizationId != null && topOrganizationId != 1){
|
||||
gwLogDTO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
List<GwLogPO> list = gwLogMapper.queryList(gwLogDTO);
|
||||
TableDataInfo tableDataInfo = new TableDataInfo();
|
||||
tableDataInfo.setData(list);
|
||||
tableDataInfo.setTotal(list.size());
|
||||
tableDataInfo.setCode(200);
|
||||
return tableDataInfo;
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,20 @@ package com.mhd.oms.domain.gwLog.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.mhd.oms.domain.gwLog.entity.GwLog;
|
||||
import com.mhd.oms.domain.gwLog.repository.po.GwLogPO;
|
||||
import com.mhd.oms.interfaces.dto.gwLog.GwLogDTO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface GwLogMapper extends BaseMapper<GwLog> {
|
||||
/**
|
||||
*
|
||||
* @param gwLogDTO
|
||||
* @return
|
||||
*/
|
||||
List<GwLogPO> queryList(GwLogDTO gwLogDTO);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mhd.oms.domain.gwLog.repository.po;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@Data
|
||||
public class GwLogPO {
|
||||
|
||||
@ApiModelProperty("日志id")
|
||||
private Long logId;
|
||||
|
||||
@ApiModelProperty("类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty("业务ID")
|
||||
private String businessId;
|
||||
|
||||
@ApiModelProperty("请求报文")
|
||||
private String requestBody;
|
||||
|
||||
@ApiModelProperty("响应报文")
|
||||
private String responseBody;
|
||||
|
||||
@ApiModelProperty("状态(1-初始,2-成功,3-失败)")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("错误信息")
|
||||
private String errorMsg;
|
||||
|
||||
@ApiModelProperty("推送时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date sendTime;
|
||||
|
||||
@ApiModelProperty("组织ID")
|
||||
private Long organizationId;
|
||||
|
||||
@ApiModelProperty("一级组织ID")
|
||||
private Long topOrganizationId;
|
||||
|
||||
@ApiModelProperty("组织名称")
|
||||
private String organizationName;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
private Long createBy;
|
||||
|
||||
@ApiModelProperty("创建时间")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("删除标记:1-正常,0-删除")
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mhd.oms.interfaces.dto.gwLog;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@Data
|
||||
public class GwLogDTO {
|
||||
|
||||
|
||||
@ApiModelProperty("日志类型")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty("业务Id")
|
||||
private Long businessId;
|
||||
|
||||
@ApiModelProperty("状态:1-初始 2-成功 3-失败")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty("组织id")
|
||||
private Long organizationId ;
|
||||
|
||||
@ApiModelProperty("推送时间起")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String sendTimeFrom;
|
||||
|
||||
@ApiModelProperty("推送时间止")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private String sendTimeTo;
|
||||
|
||||
@ApiModelProperty("一级组织id")
|
||||
private Long topOrganizationId ;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.mhd.oms.interfaces.facade.gwLog;
|
||||
|
||||
|
||||
import com.mhd.common.core.web.controller.BaseController;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.oms.application.service.gwLog.GwLogApplicationService;
|
||||
import com.mhd.oms.domain.gwLog.entity.GwLog;
|
||||
import com.mhd.oms.interfaces.dto.gwLog.GwLogDTO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@Api(tags = "GW日志管理")
|
||||
@RestController
|
||||
@RequestMapping("/gwLogApi")
|
||||
public class GwLogApi extends BaseController {
|
||||
|
||||
@Resource
|
||||
private GwLogApplicationService gwLogApplicationService;
|
||||
|
||||
|
||||
@ApiOperation("查询GW日志")
|
||||
@GetMapping("/queryList")
|
||||
public TableDataInfo queryList(GwLogDTO gwLogDTO){
|
||||
startPage();
|
||||
return gwLogApplicationService.queryList(gwLogDTO);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -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.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper">
|
||||
|
||||
<select id="queryList" resultType="com.mhd.oms.domain.gwLog.repository.po.GwLogPO">
|
||||
SELECT *
|
||||
FROM gw_log
|
||||
WHERE DEL_FLAG = 1
|
||||
<if test="status != null">
|
||||
AND STATUS = #{status}
|
||||
</if>
|
||||
<if test="sendTimeFrom != null and sendTimeFrom != ''">
|
||||
AND DATE_FORMAT(SEND_TIME, '%Y-%m-%d') >= #{sendTimeFrom}
|
||||
</if>
|
||||
<if test="sendTimeTo != null and sendTimeTo != ''">
|
||||
AND DATE_FORMAT(SEND_TIME, '%Y-%m-%d') <= #{sendTimeTo}
|
||||
</if>
|
||||
<if test="organizationId != null">
|
||||
AND ORGANIZATION_ID = #{organizationId}
|
||||
</if>
|
||||
ORDER BY CREATE_TIME DESC
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user