2
0

feat: 添加客户平台-账单管理接口

This commit is contained in:
caiyuchao
2025-01-03 16:26:35 +08:00
parent f2b9497a00
commit eea575213a
18 changed files with 380 additions and 8 deletions

View File

@@ -7,6 +7,7 @@ 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.bo.UCdrHistoryUserBo;
import org.wfc.system.domain.vo.UCdrHistoryUserVo;
import org.wfc.system.service.IUCdrService;
@@ -34,9 +35,9 @@ public class UCdrController extends BaseController {
*/
@Operation(summary = "CDR记录")
@GetMapping("/pageHistory")
public TableDataInfo getHistoryByUser() {
public TableDataInfo getHistoryByUser(UCdrHistoryUserBo item) {
startPage();
List<UCdrHistoryUserVo> result = uCdrService.getHistoryByUser(null);
List<UCdrHistoryUserVo> result = uCdrService.getHistoryByUser(item);
return getDataTable(result);
}

View File

@@ -0,0 +1,65 @@
package org.wfc.system.controller;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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.domain.AjaxResult;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.system.domain.UOrder;
import org.wfc.system.domain.UUser;
import org.wfc.system.service.IUOrderService;
import org.wfc.system.service.IUUserService;
import java.util.List;
/**
* <p>
* 用户平台-订单表 前端控制器
* </p>
*
* @author sys
* @since 2025-01-03
*/
@RestController
@RequestMapping("/order")
public class UOrderController extends BaseController {
@Autowired
private IUOrderService uOrderService;
@Autowired
private IUUserService uUserService;
@GetMapping("/page")
public TableDataInfo page(UOrder uOrder) {
startPage();
List<UOrder> list = uOrderService.list(Wrappers.<UOrder>lambdaQuery()
.like(StrUtil.isNotBlank(uOrder.getOrderNo()), UOrder::getOrderNo, uOrder.getOrderNo())
.eq(ObjectUtil.isNotNull(uOrder.getStatus()), UOrder::getStatus, uOrder.getStatus())
.eq(ObjectUtil.isNotNull(uOrder.getType()), UOrder::getType, uOrder.getType())
);
for (UOrder order : list) {
UUser uUser = uUserService.getById(order.getUserId());
order.setUserName(uUser.getUserName());
}
return getDataTable(list);
}
@GetMapping("/list")
public AjaxResult list(UOrder uOrder) {
List<UOrder> list = uOrderService.list();
return success(list);
}
@GetMapping(value = "/{id}")
public AjaxResult getById(@PathVariable("id") Long id) {
return success(uOrderService.getById(id));
}
}

View File

@@ -0,0 +1,19 @@
package org.wfc.system.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.web.controller.BaseController;
/**
* <p>
* 用户平台_用户信息表 前端控制器
* </p>
*
* @author sys
* @since 2025-01-03
*/
@RestController
@RequestMapping("/system/uUser")
public class UUserController extends BaseController {
}

View File

@@ -0,0 +1,52 @@
package org.wfc.system.domain;
import com.baomidou.mybatisplus.annotation.TableField;
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;
import java.math.BigDecimal;
/**
* <p>
* 用户平台-订单表
* </p>
*
* @author sys
* @since 2025-01-03
*/
@Getter
@Setter
@TableName("u_order")
@Schema(name = "UOrder", description = "用户平台-订单表")
public class UOrder extends BaseData {
private static final long serialVersionUID = 1L;
@Schema(description = "用户ID")
private Long userId;
@Schema(description = "套餐ID")
private Long packageId;
@Schema(description = "支付ID")
private Long paymentId;
@Schema(description = "订单编号")
private String orderNo;
@Schema(description = "订单类型0套餐 1充值")
private Integer type;
@Schema(description = "订单金额")
private BigDecimal orderAmount;
@Schema(description = "订单状态(0待支付 1已支付 2已取消)")
private Integer status;
@Schema(description = "用户名称")
@TableField(exist = false)
private String userName;
}

View File

@@ -0,0 +1,79 @@
package org.wfc.system.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* <p>
* 用户平台_用户信息表
* </p>
*
* @author sys
* @since 2025-01-03
*/
@Getter
@Setter
@TableName("u_user")
@Schema(name = "UUser", description = "用户平台_用户信息表")
public class UUser {
private static final long serialVersionUID = 1L;
@Schema(description = "用户ID")
@TableId(value = "user_id", type = IdType.AUTO)
private Long userId;
@Schema(description = "部门ID")
private Long deptId;
@Schema(description = "用户账号")
private String userName;
@Schema(description = "用户昵称")
private String nickName;
@Schema(description = "用户姓名")
private String fullName;
@Schema(description = "用户类型00系统用户")
private String userType;
@Schema(description = "用户邮箱")
private String email;
@Schema(description = "手机号码")
private String phonenumber;
@Schema(description = "用户性别0男 1女 2未知")
private Boolean sex;
@Schema(description = "头像地址")
private String avatar;
@Schema(description = "密码")
private String password;
@Schema(description = "年龄")
private Integer age;
@Schema(description = "地址")
private String address;
@Schema(description = "帐号状态0正常 1停用")
private Boolean status;
@Schema(description = "最后登录IP")
private String loginIp;
@Schema(description = "最后登录时间")
private Date loginDate;
@Schema(description = "备注")
private String remark;
}

View File

@@ -0,0 +1,20 @@
package org.wfc.system.domain.bo;
import lombok.Data;
/**
* @description: cdr历史bo
* @author: cyc
* @since: 2025-01-03
*/
@Data
public class UCdrHistoryUserBo {
private Long userId;
private String userName;
private String clientName;
private String clientMac;
private Long startTimeS;
private Long startTimeE;
private Long endTimeS;
private Long endTimeE;
}

View File

@@ -4,6 +4,7 @@ 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.bo.UCdrHistoryUserBo;
import org.wfc.system.domain.vo.UCdrHistoryUserVo;
import java.util.List;
@@ -19,6 +20,6 @@ import java.util.List;
@DS("user")
public interface UCdrMapper extends BaseMapper<UCdr> {
List<UCdrHistoryUserVo> getHistoryByUser(@Param("userId") Long userId);
List<UCdrHistoryUserVo> getHistoryByUser(@Param("item") UCdrHistoryUserBo item);
}

View File

@@ -0,0 +1,18 @@
package org.wfc.system.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.wfc.system.domain.UOrder;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 用户平台-订单表 Mapper 接口
* </p>
*
* @author sys
* @since 2025-01-03
*/
@DS("user")
public interface UOrderMapper extends BaseMapper<UOrder> {
}

View File

@@ -0,0 +1,18 @@
package org.wfc.system.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.wfc.system.domain.UUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* 用户平台_用户信息表 Mapper 接口
* </p>
*
* @author sys
* @since 2025-01-03
*/
@DS("user")
public interface UUserMapper extends BaseMapper<UUser> {
}

View File

@@ -2,6 +2,7 @@ package org.wfc.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.wfc.system.domain.UCdr;
import org.wfc.system.domain.bo.UCdrHistoryUserBo;
import org.wfc.system.domain.vo.UCdrHistoryUserVo;
import java.util.List;
@@ -16,5 +17,5 @@ import java.util.List;
*/
public interface IUCdrService extends IService<UCdr> {
List<UCdrHistoryUserVo> getHistoryByUser(Long userId);
List<UCdrHistoryUserVo> getHistoryByUser(UCdrHistoryUserBo item);
}

View File

@@ -0,0 +1,16 @@
package org.wfc.system.service;
import org.wfc.system.domain.UOrder;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 用户平台-订单表 服务类
* </p>
*
* @author sys
* @since 2025-01-03
*/
public interface IUOrderService extends IService<UOrder> {
}

View File

@@ -0,0 +1,16 @@
package org.wfc.system.service;
import org.wfc.system.domain.UUser;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 用户平台_用户信息表 服务类
* </p>
*
* @author sys
* @since 2025-01-03
*/
public interface IUUserService extends IService<UUser> {
}

View File

@@ -3,6 +3,7 @@ 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.bo.UCdrHistoryUserBo;
import org.wfc.system.domain.vo.UCdrHistoryUserVo;
import org.wfc.system.mapper.UCdrMapper;
import org.wfc.system.service.IUCdrService;
@@ -21,7 +22,7 @@ import java.util.List;
public class UCdrServiceImpl extends ServiceImpl<UCdrMapper, UCdr> implements IUCdrService {
@Override
public List<UCdrHistoryUserVo> getHistoryByUser(Long userId) {
return this.baseMapper.getHistoryByUser(userId);
public List<UCdrHistoryUserVo> getHistoryByUser(UCdrHistoryUserBo item) {
return this.baseMapper.getHistoryByUser(item);
}
}

View File

@@ -0,0 +1,20 @@
package org.wfc.system.service.impl;
import org.wfc.system.domain.UOrder;
import org.wfc.system.mapper.UOrderMapper;
import org.wfc.system.service.IUOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 用户平台-订单表 服务实现类
* </p>
*
* @author sys
* @since 2025-01-03
*/
@Service
public class UOrderServiceImpl extends ServiceImpl<UOrderMapper, UOrder> implements IUOrderService {
}

View File

@@ -0,0 +1,20 @@
package org.wfc.system.service.impl;
import org.wfc.system.domain.UUser;
import org.wfc.system.mapper.UUserMapper;
import org.wfc.system.service.IUUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 用户平台_用户信息表 服务实现类
* </p>
*
* @author sys
* @since 2025-01-03
*/
@Service
public class UUserServiceImpl extends ServiceImpl<UUserMapper, UUser> implements IUUserService {
}

View File

@@ -27,8 +27,23 @@
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 test="item.userId != null and item.userId != ''">
AND cdr.user_id = #{item.userId}
</if>
<if test="item.userName != null and item.userName != ''">
AND u.user_name like concat('%', #{item.userName}, '%')
</if>
<if test="item.clientName != null and item.clientName != ''">
AND c.client_name like concat('%', #{item.clientName}, '%')
</if>
<if test="item.clientMac != null and item.clientMac != ''">
AND c.client_mac like concat('%', #{item.clientMac}, '%')
</if>
<if test="item.startTimeS != null and item.startTimeE != null">
AND ch.start_time between #{item.startTimeS} and #{item.startTimeE}
</if>
<if test="item.endTimeS != null and item.endTimeE != null">
AND ch.end_time between #{item.endTimeS} and #{item.endTimeE}
</if>
ORDER BY
ch.start_time DESC

View File

@@ -0,0 +1,5 @@
<?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.UOrderMapper">
</mapper>

View File

@@ -0,0 +1,5 @@
<?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.UUserMapper">
</mapper>