服务包订单,查看服务包及详情

This commit is contained in:
曹磊 2024-06-13 15:21:04 +08:00
parent fbaf417de9
commit 540bc77b1a
15 changed files with 157 additions and 8 deletions

View File

@ -29,6 +29,18 @@ public class AppVipDetailsController {
return appVipDetailsService.selectVipDetails();
}
/**
* 获取会员的详情信息
*
* @return
*/
@Login
@ApiParam("获取会员的详情信息")
@GetMapping("/getVipDetailByUser")
public Result getVipDetailByUser(Long userId) {
return appVipDetailsService.getVipDetailByUser(userId);
}
/**
* 添加会员的详情信息
*

View File

@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import weixin.popular.bean.card.Discount;
import java.io.Serializable;
import java.math.BigDecimal;
@ -40,4 +39,10 @@ public class VipDetails implements Serializable {
private Integer vipType;
//优惠力度
private BigDecimal rate;
/**
* 用户ID
*/
@TableField(exist = false)
private Long userId;
}

View File

@ -13,6 +13,13 @@ public interface VipDetailsService extends IService<VipDetails> {
*/
Result selectVipDetails();
/**
* 获取会员的详情信息
*
* @return
*/
Result getVipDetailByUser(Long userId);
/**
* 添加会员的详情信息
*

View File

@ -1,5 +1,6 @@
package com.sqx.modules.app.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sqx.common.utils.Result;
import com.sqx.modules.app.dao.VipDetailsDao;
@ -7,12 +8,24 @@ import com.sqx.modules.app.entity.VipDetails;
import com.sqx.modules.app.service.VipDetailsService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class VipDetailsServiceImpl extends ServiceImpl<VipDetailsDao, VipDetails> implements VipDetailsService {
@Override
public Result selectVipDetails() {
return Result.success().put("data", baseMapper.selectList(null));
QueryWrapper queryWrapper = new QueryWrapper();
queryWrapper.eq("vip_type", 0);
queryWrapper.orderByAsc("id");
List<VipDetails> list = baseMapper.selectList(queryWrapper);
return Result.success().put("data", list);
}
@Override
public Result getVipDetailByUser(Long userId){
VipDetails vipDetails = baseMapper.getVipDetailByUser(userId);
return Result.success().put("data", vipDetails);
}
@Override

View File

@ -21,7 +21,7 @@ public class AppUserPackageOrderController {
@Autowired
private UserPackageOrderService service;
@Login
// @Login
@PostMapping("/insertOrders")
@ApiOperation("添加订单")
public Result insertOrders(@RequestBody UserPackageOrder userPackageOrder){
@ -29,7 +29,7 @@ public class AppUserPackageOrderController {
return service.insertOrders(userPackageOrder);
}
@Login
// @Login
@PostMapping("/payOrder")
@ApiOperation("钱包支付订单")
public Result payOrder(Long ordersId){

View File

@ -0,0 +1,28 @@
package com.sqx.modules.bl.order.controller;
import com.sqx.common.utils.Result;
import com.sqx.modules.bl.order.entity.UserPackage;
import com.sqx.modules.bl.order.service.UserPackageService;
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")
@Api(value = "用户服务包管理", tags = {"用户服务包"})
public class UserPackageController {
@Autowired
private UserPackageService service;
@GetMapping("/findList")
@ApiOperation("查询服务包")
public Result findList(UserPackage userPackage){
return service.findList(userPackage);
}
}

View File

@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/user/package/detail")
@ -25,5 +27,4 @@ public class UserPackageDetailController {
return service.findDetailUsedQuantity(userPackageDetail);
}
}

View File

@ -5,8 +5,14 @@ import com.sqx.modules.bl.massage.entity.MassagePackage;
import com.sqx.modules.bl.order.entity.UserPackage;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface UserPackageDao extends BaseMapper<UserPackage> {
List<UserPackage> findList(UserPackage userPackage);
List<UserPackage> findListByMapping(UserPackage userPackage);
int insert(UserPackage userPackage);
}

View File

@ -98,6 +98,12 @@ public class UserPackage implements Serializable {
*/
private String city;
/**
* 状态 0待支付
*/
@TableField(exist = false)
private Integer status;
@TableField(exist = false)
private Integer page;

View File

@ -1,9 +1,12 @@
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.UserPackage;
public interface UserPackageService extends IService<UserPackage> {
Result findList(UserPackage userPackage);
int insert(UserPackage userPackage);
}

View File

@ -1,6 +1,7 @@
package com.sqx.modules.bl.order.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.sqx.common.utils.Result;
import com.sqx.modules.bl.order.dao.UserPackageDetailDao;
import com.sqx.modules.bl.order.entity.UserPackageDetail;
@ -14,7 +15,13 @@ public class UserPackageDetailServiceImpl extends ServiceImpl<UserPackageDetailD
@Override
public Result findDetailUsedQuantity(UserPackageDetail userPackageDetail){
return Result.success().put("data",baseMapper.findDetailUsedQuantity(userPackageDetail));
List<UserPackageDetail> list = Lists.newArrayList();
if(userPackageDetail.getStatus() == 0){
list = baseMapper.findMassagePackageDetails(userPackageDetail);
}else{
list = baseMapper.findDetailUsedQuantity(userPackageDetail);
}
return Result.success().put("data",list);
}
@Override

View File

@ -1,14 +1,33 @@
package com.sqx.modules.bl.order.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.sqx.common.utils.Result;
import com.sqx.modules.bl.order.dao.UserPackageDao;
import com.sqx.modules.bl.order.entity.UserPackage;
import com.sqx.modules.bl.order.service.UserPackageService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class UserPackageServiceImpl extends ServiceImpl<UserPackageDao, UserPackage> implements UserPackageService {
@Override
public Result findList(UserPackage userPackage){
List<UserPackage> list = Lists.newArrayList();
if(userPackage.getStatus() == 0){
list = baseMapper.findListByMapping(userPackage);
}else{
list = baseMapper.findList(userPackage);
}
for(int i=0;i<list.size();i++){
UserPackage up = list.get(i);
up.setStatus(userPackage.getStatus());
}
return Result.success().put("data",list);
}
@Override
public int insert(UserPackage userPackage){
return baseMapper.insert(userPackage);

View File

@ -20,6 +20,9 @@
b.classify_id as type
from bl_massage_package_detail a inner join massage_type b on a.massage_type_id = b.massage_type_id
where a.main_id = #{params.mainId}
<if test="params.status!=null and params.status!=0">
and b.status=#{params.status}
</if>
order by a.id desc
</select>

View File

@ -3,6 +3,45 @@
<mapper namespace="com.sqx.modules.bl.order.dao.UserPackageDao">
<select id="findList" resultType="com.sqx.modules.bl.order.entity.UserPackage">
select
id,
user_id,
package_id,
orders_id,
orders_no,
create_time,
title,
type,
old_price,
price,
package_img,
content,
content_img,
labels,
city
from bl_user_package
where orders_id = #{ordersId}
order by id
</select>
<select id="findListByMapping" resultType="com.sqx.modules.bl.order.entity.UserPackage">
select
a.id,
a.title,
a.type,
a.old_price,
a.price,
a.package_img,
a.content,
a.content_img,
a.labels,
a.city
from bl_massage_package a inner join bl_user_package_order_mapping b on a.id = b.package_id
where b.orders_id = #{ordersId}
order by a.id
</select>
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="com.sqx.modules.bl.order.entity.UserPackageOrder">
insert into bl_user_package(
user_id,

View File

@ -12,8 +12,8 @@
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}
from bl_user_package_detail a
where a.main_id = #{mainId}
group by a.massage_type_id,a.title,a.massage_img,a.package_price,a.price
order by a.massage_type_id
</select>