顾挽-11-16

This commit is contained in:
ovo 2024-11-16 00:38:26 +08:00
parent cfeb4e967d
commit 1787fb6b79
15 changed files with 468 additions and 33 deletions

View File

@ -0,0 +1,57 @@
package net.shapelight.modules.mobile.controler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.shapelight.common.utils.R;
import net.shapelight.modules.mobile.dto.mobileDevice.MobileDeviceQueryDto;
import net.shapelight.modules.mobile.dto.mobilePackage.MobilePackageQueryDto;
import net.shapelight.modules.mobile.service.MobilePackageService;
import net.shapelight.modules.sys.controller.AbstractController;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("mobile/package/")
@RequiredArgsConstructor
@Api("公话套餐管理")
public class MobilePackageController extends AbstractController {
private final MobilePackageService mobilePackageService;
@GetMapping("list")
@ApiOperation("设备列表")
@ApiImplicitParams({
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "Long",required = true),
@ApiImplicitParam(name="size",value = "每页页数",paramType = "query",dataType = "Long",required = true),
@ApiImplicitParam(name = "packageName", value = "套餐名称", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "packageType", value = "套餐类型", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "packageModel", value = "套餐模式", paramType = "query", dataType = "Integer"),
@ApiImplicitParam(name = "status", value = "套餐状态", paramType = "query", dataType = "Integer")
})
public R list(@RequestParam(defaultValue = "1") Long page,
@RequestParam(defaultValue = "10") Long size,
@RequestParam(required = false) String packageName,
@RequestParam(required = false) Integer packageType,
@RequestParam(required = false) Integer packageModel,
@RequestParam(required = false) Integer status) {
MobilePackageQueryDto mobilePackageQueryDto = new MobilePackageQueryDto();
mobilePackageQueryDto.setCurrent(page);
mobilePackageQueryDto.setSize(size);
mobilePackageQueryDto.setPackageName(packageName);
mobilePackageQueryDto.setPackageType(packageType);
mobilePackageQueryDto.setPackageModel(packageModel);
mobilePackageQueryDto.setStatus(status);
return R.ok().put("data", mobilePackageService.list(mobilePackageQueryDto));
}
}

View File

@ -7,6 +7,8 @@ import com.guwan.excel.metadata.GlobalConfiguration;
import com.guwan.excel.metadata.data.WriteCellData;
import com.guwan.excel.metadata.property.ExcelContentProperty;
import java.util.Optional;
public class StatusConverter implements Converter<Object> {
@Override
@ -20,11 +22,34 @@ public class StatusConverter implements Converter<Object> {
}
@Override
public WriteCellData<?> convertToExcelData(Object value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
public WriteCellData<?> convertToExcelData(Object value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration)
throws Exception {
// 获取字段名或其他上下文信息
String fieldName = contentProperty.getField().getName();
// 根据字段名或者类型来判断如何处理 0 1
if ("status".equals(fieldName)) {
// 这里假设 "status" 字段的 0 代表 "未启用" "启用"
if (value.equals(0)) {
return new WriteCellData<>("未启用"); // 返回 "未启用"
return new WriteCellData<>("未启用");
} else if (value.equals(1)) {
return new WriteCellData<>("启用"); // 返回 "启用"
return new WriteCellData<>("启用");
}
} else if ("type".equals(fieldName)) {
// 假设 "type" 字段的 0 代表 "普通用户"1 代表 "管理员"
if (value.equals(0)) {
return new WriteCellData<>("普通用户");
} else if (value.equals(1)) {
return new WriteCellData<>("管理员");
}
} else if ("visibility".equals(fieldName)) {
// 假设 "visibility" 字段的 0 代表 "不可见"1 代表 "可见"
if (value.equals(0)) {
return new WriteCellData<>("不可见");
} else if (value.equals(1)) {
return new WriteCellData<>("可见");
}
}
return new WriteCellData<>(value.toString()); // 默认返回数字字符串
}

View File

@ -0,0 +1,31 @@
package net.shapelight.modules.mobile.dto.mobilePackage;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import net.shapelight.common.base.BasePageDTO;
import org.springframework.web.bind.annotation.RequestParam;
/**
*
*/
@Data
public class MobilePackageQueryDto extends BasePageDTO {
/**
* 套餐名称
*/
String packageName;
/**
* 套餐类型
*/
Integer packageType;
/**
* 套餐模式
*/
Integer packageModel;
/**
* 套餐状态
*/
Integer status;
}

View File

@ -27,7 +27,7 @@ public class MobileCallLogs implements Serializable {
@ApiModelProperty("id")
private Long id;
/**
* 设备ID
* 设备ID 查询公话名称
*/
@ApiModelProperty("设备ID")
private Long deviceId;

View File

@ -1,5 +1,8 @@
package net.shapelight.modules.mobile.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -34,60 +37,76 @@ public class MobilePackage implements Serializable {
@ApiModelProperty("套餐名称")
private String packageName;
/**
* 套餐类型
* 套餐类型视频/通话)(套餐包/临时包)
*/
@Size(max= 20,message="编码长度不能超过20")
@ApiModelProperty("套餐类型")
private String packageType;
private Integer packageType;
/**
* 套餐价格
* 套餐描述
*/
private String description;
/**
* 有效期
*/
private Integer validityPeriod;
/**
* 套餐价格(套餐单价)
*/
@ApiModelProperty("套餐价格")
private BigDecimal price;
/**
* 通话时长
* 消耗类型
*/
private Integer consumptionType;
/**
* 通话时长每月通话时长
*/
@ApiModelProperty("通话时长")
private Integer duration;
/**
* 通话次数临时包
* 通话次数
*/
@ApiModelProperty("通话次数(临时包)")
private Integer callCount;
/**
* 开始时间
* 套餐上架时间
*/
@ApiModelProperty("开始时间")
private Date startTime;
@ApiModelProperty("套餐上架时间")
private Date launchTime;
/**
* 结束时间
* 套餐下架时间
*/
@ApiModelProperty("结束时间")
private Date endTime;
@ApiModelProperty("套餐下架时间")
private Date downTime;
/**
* 生效类型0当月1下月
*/
@ApiModelProperty("生效类型0当月1下月")
private Integer effectType;
/**
* 套餐模式
* 套餐模式 正式套餐 试用套餐
*/
@ApiModelProperty("套餐模式")
private Integer packageModel;
/**
* 折扣
* 是否参与折扣
*/
@ApiModelProperty("折扣")
private BigDecimal discount;
private Integer isDiscount;
/**
* 折扣率
*/
@ApiModelProperty("折扣率")
private BigDecimal discountPercent;
/**
* 月底是否清零
*/
@ApiModelProperty("月底是否清零")
private Integer isClear;
private Integer isMouthClear;
/**
* 状态0未启用1启用
* 状态0未上架1已上架
*/
@ApiModelProperty("状态0未启用1启用")
@ApiModelProperty("状态0未上架1已上架")
private Integer status;
/**
* 创建时间
@ -105,5 +124,12 @@ public class MobilePackage implements Serializable {
@Size(max= 20,message="编码长度不能超过20")
@ApiModelProperty("创建人")
private String createBy;
/**
* 删除标记位
*/
@ApiModelProperty(name = "删除标志位")
@TableField(fill = FieldFill.INSERT)
@TableLogic
private Integer deleteFlag;
}

View File

@ -0,0 +1,34 @@
package net.shapelight.modules.mobile.enumData.MobilePackage;
public enum PackageModelEnum {
REGULARPACKAGE(0, "正式套餐"),
DISCOUNTPACKAGE(1, "折扣套餐"),
TRIALPACKAGE(2, "试用套餐");
private final int code; // 套餐类型的数字编码
private final String name;
PackageModelEnum(int code, String name) {
this.code = code;
this.name = name;
}
public int getCode() {
return code;
}
public String getName() {
return name;
}
public static PackageModelEnum fromCode(int code) {
for (PackageModelEnum type : PackageModelEnum.values()) {
if (type.getCode() == code) {
return type;
}
}
throw new IllegalArgumentException("Unexpected value: " + code);
}
}

View File

@ -0,0 +1,38 @@
package net.shapelight.modules.mobile.enumData.MobilePackage;
public enum PackageTypeEnum {
VOICEPACKAGE(0, "语音套餐包"),
VOICETEMP(1, "语音临时包"),
VIDEOPACKAGE(2, "视频套餐包"),
VIDEOTEMP(3, "视频临时包");
private final int code; // 套餐类型的数字编码
private final String name; // 套餐类型的名称
// 构造函数
PackageTypeEnum(int code, String name) {
this.code = code;
this.name = name;
}
// 获取套餐类型的数字编码
public int getCode() {
return code;
}
// 获取套餐类型的名称
public String getName() {
return name;
}
// 根据数字编码获取对应的套餐类型
public static PackageTypeEnum fromCode(int code) {
for (PackageTypeEnum type : PackageTypeEnum.values()) {
if (type.getCode() == code) {
return type;
}
}
throw new IllegalArgumentException("Unexpected value: " + code);
}
}

View File

@ -1,4 +1,4 @@
package net.shapelight.modules.mobile.mapstructMapper;
package net.shapelight.modules.mobile.mapstructMapper.MobileDevice;
import net.shapelight.modules.mobile.dto.mobileDevice.MobileDeviceAddDto;
import net.shapelight.modules.mobile.entity.MobileDevice;
@ -11,4 +11,5 @@ public interface MobileDeviceMapstructMapper {
MobileDevice mobileDeviceAddDtoToMobileDevice(MobileDeviceAddDto mobileDeviceAddDto);
}

View File

@ -0,0 +1,13 @@
package net.shapelight.modules.mobile.mapstructMapper.MobilePackage;
import net.shapelight.modules.mobile.entity.MobilePackage;
import net.shapelight.modules.mobile.vo.MobilePackage.MobilePackageVo;
import org.mapstruct.Mapper;
@Mapper(componentModel = "spring")
public interface MobilePackageMapstructMapper {
MobilePackageVo entityToVo(MobilePackage entity);
}

View File

@ -0,0 +1,25 @@
套餐编号
套餐名称
套餐类型(视频/通话)(套餐包/临时包)
套餐描述(介绍)
套餐价格
有效期(自购买后 /天 内有效)
消耗类型 (时长/次数)
通话时长
通话次数
套餐上架时间
套餐下架时间
生效类型0当月1下月
套餐模式 (正式套餐 试用套餐)
是否打折
折扣率
月底是否清零
状态0未上架1已上架
创建时间
更新时间
创建人
删除标志位

View File

@ -1,7 +1,11 @@
package net.shapelight.modules.mobile.service;
import com.baomidou.mybatisplus.extension.service.IService;
import net.shapelight.modules.mobile.dto.mobilePackage.MobilePackageQueryDto;
import net.shapelight.modules.mobile.entity.MobilePackage;
import net.shapelight.modules.mobile.vo.MobilePackage.MobilePackageVo;
import java.util.List;
/**
* @author zhangbo
@ -10,4 +14,5 @@ import net.shapelight.modules.mobile.entity.MobilePackage;
*/
public interface MobilePackageService extends IService<MobilePackage> {
List<MobilePackageVo> list(MobilePackageQueryDto mobilePackageQueryDto);
}

View File

@ -2,25 +2,19 @@ package net.shapelight.modules.mobile.service.impl;
import com.baomidou.mybatisplus.core.batch.MybatisBatch;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.Query;
import net.shapelight.common.utils.SnowflakeIdWorker;
import net.shapelight.modules.mobile.dto.mobileDevice.MobileDeviceAddDto;
import net.shapelight.modules.mobile.dto.mobileDevice.MobileDeviceQueryDto;
import net.shapelight.modules.mobile.entity.MobileDevice;
import net.shapelight.modules.mobile.mapstructMapper.MobileDeviceMapstructMapper;
import net.shapelight.modules.mobile.mapstructMapper.MobileDevice.MobileDeviceMapstructMapper;
import net.shapelight.modules.mobile.service.MobileDeviceService;
import net.shapelight.modules.mobile.mapper.MobileDeviceMapper;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**

View File

@ -1,20 +1,57 @@
package net.shapelight.modules.mobile.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import net.shapelight.common.utils.BeanUtils;
import net.shapelight.modules.mobile.dto.mobilePackage.MobilePackageQueryDto;
import net.shapelight.modules.mobile.entity.MobilePackage;
import net.shapelight.modules.mobile.service.MobilePackageService;
import net.shapelight.modules.mobile.mapper.MobilePackageMapper;
import net.shapelight.modules.mobile.vo.MobilePackage.MobilePackageVo;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
/**
* @author zhangbo
* @description 针对表mobile_package的数据库操作Service实现
* @createDate 2024-11-14 09:50:19
*/
@Service
@RequiredArgsConstructor
public class MobilePackageServiceImpl extends ServiceImpl<MobilePackageMapper, MobilePackage>
implements MobilePackageService{
private final MobilePackageMapper mobilePackageMapper;
@Override
public List<MobilePackageVo> list(MobilePackageQueryDto mobilePackageQueryDto) {
/* List<MobilePackage> mobilePackages = mobilePackageMapper.selectList(new LambdaQueryWrapper<MobilePackage>()
.like(Objects.nonNull(mobilePackageQueryDto.getPackageName()),
MobilePackage::getPackageName, mobilePackageQueryDto.getPackageName())
.eq(Objects.nonNull(mobilePackageQueryDto.getPackageType()),
MobilePackage::getPackageType, mobilePackageQueryDto.getPackageType())
.eq(Objects.nonNull(mobilePackageQueryDto.getPackageModel()),
MobilePackage::getPackageModel, mobilePackageQueryDto.getPackageModel())
.eq(Objects.nonNull(mobilePackageQueryDto.getStatus()),
MobilePackage::getStatus, mobilePackageQueryDto.getStatus()));*/
return BeanUtils.toBean(mobilePackageMapper.selectList(new LambdaQueryWrapper<MobilePackage>()
.like(Objects.nonNull(mobilePackageQueryDto.getPackageName()),
MobilePackage::getPackageName, mobilePackageQueryDto.getPackageName())
.eq(Objects.nonNull(mobilePackageQueryDto.getPackageType()),
MobilePackage::getPackageType, mobilePackageQueryDto.getPackageType())
.eq(Objects.nonNull(mobilePackageQueryDto.getPackageModel()),
MobilePackage::getPackageModel, mobilePackageQueryDto.getPackageModel())
.eq(Objects.nonNull(mobilePackageQueryDto.getStatus()),
MobilePackage::getStatus, mobilePackageQueryDto.getStatus())), MobilePackageVo.class);
}
}

View File

@ -0,0 +1,59 @@
package net.shapelight.modules.mobile.vo.MobileCallLogs;
import java.util.Date;
public class MobileCallLogsVo {
/**
* 用户名称
*/
private String personName;
/**
* 用户id
*/
private Long personId;
/**
* 公话名称
*/
private String deviceName;
/**
* 通话日期
*/
private Date callDate;
/**
* 接听人
*/
private String relationName;
/**
* 通话类型0语音1视频
*/
private Integer callType;
/**
* 接通类型 是否接通(0否1是
*/
private Integer isConnected;
/**
* 是否SOS
*/
private Integer isSos;
/**
* 接听操作状态
*/
private String callOperationStatus;
/**
* 接听电话
*/
private String phoneNumber;
/**
* 通话开始时间
*/
private Date callStartTime;
/**
* 通话结束时间
*/
private Date callEndTime;
/**
* 通话时长
*/
private Integer callDuration;
}

View File

@ -0,0 +1,90 @@
package net.shapelight.modules.mobile.vo.MobilePackage;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
@Data
public class MobilePackageVo {
/**
* 套餐ID
*/
private Long packageId;
/**
* 套餐名称
*/
private String packageName;
/**
* 套餐类型视频/通话)(套餐包/临时包)
*/
private String packageType;
/**
* 套餐描述
*/
private String description;
/**
* 有效期
*/
private Integer validityPeriod;
/**
* 套餐价格(套餐单价)
*/
private BigDecimal price;
/**
* 消耗类型
*/
private Integer consumptionType;
/**
* 通话时长每月通话时长
*/
private Integer duration;
/**
* 通话次数
*/
private Integer callCount;
/**
* 套餐上架时间
*/
private Date launchTime;
/**
* 套餐下架时间
*/
private Date downTime;
/**
* 生效类型0当月1下月
*/
private Integer effectType;
/**
* 套餐模式 正式套餐 试用套餐
*/
private Integer packageModel;
/**
* 是否参与折扣
*/
private Integer isDiscount;
/**
* 折扣率
*/
private BigDecimal discountPercent;
/**
* 月底是否清零
*/
private Integer isMouthClear;
/**
* 状态0未上架1已上架
*/
private Integer status;
}