feat: 添加客户平台-话单管理接口
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package org.wfc.system.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.wfc.common.core.web.controller.BaseController;
|
||||
import org.wfc.common.core.web.page.TableDataInfo;
|
||||
import org.wfc.system.domain.vo.UCdrHistoryUserVo;
|
||||
import org.wfc.system.service.IUCdrService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2025-01-03
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cdr")
|
||||
public class UCdrController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IUCdrService uCdrService;
|
||||
|
||||
/**
|
||||
* 根据用户查询cdr记录
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
@Operation(summary = "CDR记录")
|
||||
@GetMapping("/pageHistory")
|
||||
public TableDataInfo getHistoryByUser() {
|
||||
startPage();
|
||||
List<UCdrHistoryUserVo> result = uCdrService.getHistoryByUser(null);
|
||||
return getDataTable(result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package org.wfc.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.wfc.common.mybatis.domain.BaseData;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2025-01-03
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("u_cdr")
|
||||
@Schema(name = "UCdr", description = "用户平台_用户话单表")
|
||||
public class UCdr extends BaseData {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "User ID link to u_user")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "Client ID")
|
||||
private Long clientId;
|
||||
|
||||
@Schema(description = "Device ID")
|
||||
private Long deviceId;
|
||||
|
||||
@Schema(description = "Wireless SSID name ")
|
||||
private String ssid;
|
||||
|
||||
@Schema(description = "tx rate ")
|
||||
private Long rxRate;
|
||||
|
||||
@Schema(description = "tx rate")
|
||||
private Long txRate;
|
||||
|
||||
@Schema(description = "Number of downstream packets.")
|
||||
private Long downPacket;
|
||||
|
||||
@Schema(description = "Number of upstream packets. ")
|
||||
private Long upPacket;
|
||||
|
||||
@Schema(description = "Downstream traffic (Byte)")
|
||||
private Long trafficDown;
|
||||
|
||||
@Schema(description = "Upstream traffic (Byte)")
|
||||
private Long trafficUp;
|
||||
|
||||
@Schema(description = "Rate limit profile ID. ")
|
||||
private String rateLimitProfileId;
|
||||
|
||||
@Schema(description = "Up time (unit: s).")
|
||||
private Long upTime;
|
||||
|
||||
@Schema(description = "Last found time, timestamp (ms). ")
|
||||
private Long lastSeenTime;
|
||||
|
||||
@Schema(description = "Activity download speed (Bytes/s)")
|
||||
private Long activity;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package org.wfc.system.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description: cdr历史vo
|
||||
* @author: cyc
|
||||
* @since: 2024-12-17
|
||||
*/
|
||||
@Data
|
||||
public class UCdrHistoryUserVo {
|
||||
private Long id;
|
||||
private Long userId;
|
||||
private String userName;
|
||||
private String clientName;
|
||||
private String clientMac;
|
||||
private Long startTime;
|
||||
private Long endTime;
|
||||
private Long duration;
|
||||
private Long trafficDown;
|
||||
private Long trafficUp;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.wfc.system.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.wfc.system.domain.UCdr;
|
||||
import org.wfc.system.domain.vo.UCdrHistoryUserVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2025-01-03
|
||||
*/
|
||||
@DS("user")
|
||||
public interface UCdrMapper extends BaseMapper<UCdr> {
|
||||
|
||||
List<UCdrHistoryUserVo> getHistoryByUser(@Param("userId") Long userId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.wfc.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.wfc.system.domain.UCdr;
|
||||
import org.wfc.system.domain.vo.UCdrHistoryUserVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2025-01-03
|
||||
*/
|
||||
public interface IUCdrService extends IService<UCdr> {
|
||||
|
||||
List<UCdrHistoryUserVo> getHistoryByUser(Long userId);
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.wfc.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.wfc.system.domain.UCdr;
|
||||
import org.wfc.system.domain.vo.UCdrHistoryUserVo;
|
||||
import org.wfc.system.mapper.UCdrMapper;
|
||||
import org.wfc.system.service.IUCdrService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户平台_用户话单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author sys
|
||||
* @since 2025-01-03
|
||||
*/
|
||||
@Service
|
||||
public class UCdrServiceImpl extends ServiceImpl<UCdrMapper, UCdr> implements IUCdrService {
|
||||
|
||||
@Override
|
||||
public List<UCdrHistoryUserVo> getHistoryByUser(Long userId) {
|
||||
return this.baseMapper.getHistoryByUser(userId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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="org.wfc.system.mapper.UCdrMapper">
|
||||
|
||||
<select id="getHistoryByUser" resultType="org.wfc.system.domain.vo.UCdrHistoryUserVo">
|
||||
SELECT
|
||||
ch.id,
|
||||
u.user_id,
|
||||
u.user_name,
|
||||
c.client_name,
|
||||
c.client_mac,
|
||||
c.client_device_type,
|
||||
ch.start_time,
|
||||
ch.end_time,
|
||||
ifnull( ch.duration, 0 ) duration,
|
||||
ifnull( ch.traffic_down, 0 ) traffic_down,
|
||||
ifnull( ch.traffic_up, 0 ) traffic_up
|
||||
FROM
|
||||
u_cdr cdr
|
||||
LEFT JOIN u_cdr_history ch ON cdr.id = ch.cdr_id
|
||||
AND ch.del_flag = 0
|
||||
LEFT JOIN u_client c ON cdr.client_id = c.id
|
||||
AND c.del_flag = 0
|
||||
LEFT JOIN u_user u on cdr.user_id = u.user_id
|
||||
AND u.del_flag = 0
|
||||
WHERE
|
||||
cdr.del_flag = 0
|
||||
AND ch.id is not null
|
||||
AND cdr.user_id is not null
|
||||
<if test="userId != null and userId != ''">
|
||||
AND cdr.user_id = #{userId}
|
||||
</if>
|
||||
ORDER BY
|
||||
ch.start_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user