服务包订单
This commit is contained in:
parent
aaa740a2d1
commit
687d76095b
|
@ -10,7 +10,7 @@ import java.io.Serializable;
|
|||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description massage_package
|
||||
* @description bl_massage_package_detail
|
||||
* @author caolei
|
||||
* @date 2024-6-5
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package com.sqx.modules.bl.order.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.order.entity.UserPackageDetail;
|
||||
import com.sqx.modules.bl.order.service.UserPackageDetailService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/user/package/detail")
|
||||
@Api(value = "用户服务包详情管理", tags = {"用户服务包详情"})
|
||||
public class UserPackageDetailController {
|
||||
|
||||
@Autowired
|
||||
private UserPackageDetailService service;
|
||||
|
||||
@GetMapping("/findDetailUsedQuantity")
|
||||
@ApiOperation("查询服务包详情使用数量")
|
||||
public Result findDetailUsedQuantity(UserPackageDetail userPackageDetail){
|
||||
return service.findDetailUsedQuantity(userPackageDetail);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package com.sqx.modules.bl.order.controller;
|
||||
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.order.entity.UserPackageOrder;
|
||||
import com.sqx.modules.bl.order.service.UserPackageOrderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/user/package/order")
|
||||
@Api(value = "用户服务包订单管理", tags = {"用户服务包订单"})
|
||||
public class UserPackageOrderController {
|
||||
|
||||
@Autowired
|
||||
private UserPackageOrderService service;
|
||||
|
||||
@GetMapping("/findPage")
|
||||
@ApiOperation("查询服务包订单(分页)")
|
||||
public Result findPage(UserPackageOrder userPackageOrder){
|
||||
return service.findPage(userPackageOrder);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/findCoupon")
|
||||
@ApiOperation("查询代金券")
|
||||
public Result findCoupon(UserPackageOrder userPackageOrder){
|
||||
return service.findCoupon(userPackageOrder);
|
||||
}
|
||||
|
||||
@PostMapping("/refund")
|
||||
@ApiOperation("退款")
|
||||
public Result refund(UserPackageOrder userPackageOrder){
|
||||
service.refund(userPackageOrder);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.sqx.modules.bl.order.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.sqx.modules.bl.order.entity.UserPackageDetail;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface UserPackageDetailDao extends BaseMapper<UserPackageDetail> {
|
||||
|
||||
List<UserPackageDetail> findDetailUsedQuantity(UserPackageDetail userPackageDetail);
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.sqx.modules.bl.order.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.modules.bl.order.entity.UserPackageOrder;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface UserPackageOrderDao extends BaseMapper<UserPackageOrder> {
|
||||
|
||||
IPage<UserPackageOrder> findPage(Page<UserPackageOrder> page, @Param("params") UserPackageOrder userPackageOrder);
|
||||
|
||||
List<UserPackageOrder> findCoupon(UserPackageOrder userPackageOrder);
|
||||
|
||||
int refund(UserPackageOrder userPackageOrder);
|
||||
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package com.sqx.modules.bl.order.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description bl_user_package
|
||||
* @author caolei
|
||||
* @date 2024-6-8
|
||||
*/
|
||||
@Data
|
||||
@TableName("bl_user_package")
|
||||
public class UserPackage implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 服务包id
|
||||
*/
|
||||
private Long packageId;
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long ordersId;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String ordersNo;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 原价
|
||||
*/
|
||||
private BigDecimal oldPrice;
|
||||
|
||||
/**
|
||||
* 现价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String packageImg;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 详细内容
|
||||
*/
|
||||
private String contentImg;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private String labels;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer page;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer limit;
|
||||
|
||||
public UserPackage() {}
|
||||
}
|
|
@ -0,0 +1,161 @@
|
|||
package com.sqx.modules.bl.order.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description bl_user_package_order
|
||||
* @author caolei
|
||||
* @date 2024-6-8
|
||||
*/
|
||||
@Data
|
||||
@TableName("bl_user_package_detail")
|
||||
public class UserPackageDetail implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 主表id
|
||||
*/
|
||||
private Long mainId;
|
||||
|
||||
/**
|
||||
* 服务包明细id
|
||||
*/
|
||||
private Long packageDetailId;
|
||||
|
||||
/**
|
||||
* 按摩类型id
|
||||
*/
|
||||
private Long massageTypeId;
|
||||
|
||||
/**
|
||||
* 状态 1上 2下
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 服务优惠价格
|
||||
*/
|
||||
private BigDecimal packagePrice;
|
||||
|
||||
/**
|
||||
* 间隔天数
|
||||
*/
|
||||
private String intervalDays;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String massageImg;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 原价
|
||||
*/
|
||||
private BigDecimal oldPrice;
|
||||
|
||||
/**
|
||||
* 现价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 时长
|
||||
*/
|
||||
private Integer duration;
|
||||
|
||||
/**
|
||||
* 是否限制性别 0不限制 1男 2女
|
||||
*/
|
||||
private Integer isSex;
|
||||
|
||||
/**
|
||||
* 城市
|
||||
*/
|
||||
private String city;
|
||||
|
||||
/**
|
||||
* 详细图片
|
||||
*/
|
||||
private String contentImg;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
private String labels;
|
||||
|
||||
/**
|
||||
* 下级id加钟项目
|
||||
*/
|
||||
private Integer parentId;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private Integer classifyId;
|
||||
|
||||
/**
|
||||
* 适用人群
|
||||
*/
|
||||
private String applyPeople;
|
||||
|
||||
/**
|
||||
* 简介
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String jianjie;
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Long ordersId;
|
||||
|
||||
/**
|
||||
* 已使用数量
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer usedQuantity;
|
||||
|
||||
/**
|
||||
* 未使用数量
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer unUsedQuantity;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer page;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer limit;
|
||||
|
||||
public UserPackageDetail() {}
|
||||
}
|
|
@ -0,0 +1,143 @@
|
|||
package com.sqx.modules.bl.order.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @description bl_user_package_order
|
||||
* @author caolei
|
||||
* @date 2024-6-8
|
||||
*/
|
||||
@Data
|
||||
@TableName("bl_user_package_order")
|
||||
public class UserPackageOrder implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long ordersId;
|
||||
|
||||
/**
|
||||
* 订单号
|
||||
*/
|
||||
private String ordersNo;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 姓名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 服务包id
|
||||
*/
|
||||
private Long packageId;
|
||||
|
||||
/**
|
||||
* 服务包名称
|
||||
*/
|
||||
private String packageName;
|
||||
|
||||
/**
|
||||
* 服务包类型
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 会员优惠比例
|
||||
*/
|
||||
private BigDecimal vipRate;
|
||||
|
||||
/**
|
||||
* 单价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
|
||||
/**
|
||||
* 原总金额
|
||||
*/
|
||||
private BigDecimal oldSumMoney;
|
||||
|
||||
/**
|
||||
* 应付总金额
|
||||
*/
|
||||
private BigDecimal sumMoney;
|
||||
|
||||
/**
|
||||
* 实际支付金额
|
||||
*/
|
||||
private BigDecimal payMoney;
|
||||
|
||||
/**
|
||||
* 支付时间
|
||||
*/
|
||||
private String payTime;
|
||||
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
private Integer payWay;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 优惠券id,逗号拼接字符串
|
||||
*/
|
||||
private String couponId;
|
||||
|
||||
/**
|
||||
* 代金券数量
|
||||
*/
|
||||
private Integer couponCount;
|
||||
|
||||
/**
|
||||
* 代金券总金额
|
||||
*/
|
||||
private BigDecimal couponMoney;
|
||||
|
||||
/**
|
||||
* 退款时间
|
||||
*/
|
||||
private String refundTime;
|
||||
|
||||
/**
|
||||
* 退款金额
|
||||
*/
|
||||
private BigDecimal refundMoney;
|
||||
|
||||
/**
|
||||
* 代金券名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String couponName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer page;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer limit;
|
||||
|
||||
public UserPackageOrder() {}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.sqx.modules.bl.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.order.entity.UserPackageDetail;
|
||||
|
||||
public interface UserPackageDetailService extends IService<UserPackageDetail> {
|
||||
Result findDetailUsedQuantity(UserPackageDetail userPackageDetail);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.sqx.modules.bl.order.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.order.entity.UserPackageOrder;
|
||||
|
||||
public interface UserPackageOrderService extends IService<UserPackageOrder> {
|
||||
Result findPage(UserPackageOrder userPackageOrder);
|
||||
Result findCoupon(UserPackageOrder userPackageOrder);
|
||||
int refund(UserPackageOrder userPackageOrder);
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.sqx.modules.bl.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.order.dao.UserPackageDetailDao;
|
||||
import com.sqx.modules.bl.order.entity.UserPackageDetail;
|
||||
import com.sqx.modules.bl.order.service.UserPackageDetailService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class UserPackageDetailServiceImpl extends ServiceImpl<UserPackageDetailDao, UserPackageDetail> implements UserPackageDetailService {
|
||||
|
||||
@Override
|
||||
public Result findDetailUsedQuantity(UserPackageDetail userPackageDetail){
|
||||
return Result.success().put("data",baseMapper.findDetailUsedQuantity(userPackageDetail));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.sqx.modules.bl.order.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sqx.common.utils.PageUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.bl.order.dao.UserPackageOrderDao;
|
||||
import com.sqx.modules.bl.order.entity.UserPackageOrder;
|
||||
import com.sqx.modules.bl.order.service.UserPackageOrderService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
public class UserPackageOrderServiceImpl extends ServiceImpl<UserPackageOrderDao, UserPackageOrder> implements UserPackageOrderService {
|
||||
|
||||
@Override
|
||||
public Result findPage(UserPackageOrder userPackageOrder){
|
||||
Page<UserPackageOrder> pages=new Page<>(userPackageOrder.getPage(),userPackageOrder.getLimit());
|
||||
return Result.success().put("data",new PageUtils(baseMapper.findPage(pages,userPackageOrder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result findCoupon(UserPackageOrder userPackageOrder){
|
||||
return Result.success().put("data",baseMapper.findCoupon(userPackageOrder));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int refund(UserPackageOrder userPackageOrder){
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
userPackageOrder.setRefundTime(sdf.format(new Date()));
|
||||
return baseMapper.refund(userPackageOrder);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<?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.sqx.modules.bl.order.dao.UserPackageDetailDao">
|
||||
|
||||
<select id="findDetailUsedQuantity" resultType="com.sqx.modules.bl.order.entity.UserPackageDetail">
|
||||
select
|
||||
a.massage_type_id,
|
||||
a.title,
|
||||
a.massage_img,
|
||||
a.package_price,
|
||||
a.price,
|
||||
(case a.status when 1 then 1 else 0 end) as usedQuantity,
|
||||
(case a.status when 0 then 1 else 0 end) as unUsedQuantity
|
||||
from bl_user_package_detail a inner join bl_user_package b on a.main_id = b.id
|
||||
where b.orders_id = #{ordersId}
|
||||
group by a.massage_type_id,a.title,a.massage_img,a.package_price,a.price
|
||||
order by a.massage_type_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,64 @@
|
|||
<?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.sqx.modules.bl.order.dao.UserPackageOrderDao">
|
||||
|
||||
<select id="findPage" resultType="com.sqx.modules.bl.order.entity.UserPackageOrder">
|
||||
select
|
||||
orders_id,
|
||||
orders_no,
|
||||
user_id,
|
||||
user_name,
|
||||
package_id,
|
||||
package_name,
|
||||
type,
|
||||
vip_rate,
|
||||
price,
|
||||
quantity,
|
||||
old_sum_money,
|
||||
sum_money,
|
||||
pay_money,
|
||||
pay_time,
|
||||
pay_way,
|
||||
status,
|
||||
coupon_id,
|
||||
coupon_count,
|
||||
coupon_money,
|
||||
refund_time,
|
||||
refund_money
|
||||
from bl_user_package_order
|
||||
where 1=1
|
||||
<if test="params.status!=null and params.status!=0">
|
||||
and status=#{params.status}
|
||||
</if>
|
||||
<if test="params.type!=null and params.type!=''">
|
||||
and type=#{params.type}
|
||||
</if>
|
||||
<if test="params.ordersNo!=null and params.ordersNo!=''">
|
||||
and orders_no like concat('%',#{params.ordersNo},'%')
|
||||
</if>
|
||||
<if test="params.packageName!=null and params.packageName!=''">
|
||||
and package_name like concat('%',#{params.packageName},'%')
|
||||
</if>
|
||||
order by orders_id desc
|
||||
</select>
|
||||
|
||||
<select id="findCoupon" resultType="com.sqx.modules.bl.order.entity.UserPackageOrder">
|
||||
select
|
||||
coupon_name,
|
||||
money as coupon_money
|
||||
from bl_user_package_order_coupon
|
||||
where orders_id = #{ordersId}
|
||||
order by coupon_id
|
||||
</select>
|
||||
|
||||
<update id="refund">
|
||||
update bl_user_package_order
|
||||
set
|
||||
refund_time = #{refundTime},
|
||||
refund_money = #{refundMoney},
|
||||
status = 2
|
||||
where orders_id = #{ordersId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue