提交
This commit is contained in:
parent
486f192946
commit
46a8b4abbd
|
@ -203,4 +203,38 @@ public class CollectionUtils extends org.springframework.util.CollectionUtils {
|
|||
}
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将新旧列表转换为差异列表
|
||||
* @param newList 新列表
|
||||
* @param oldList 旧列表
|
||||
* @param primaryKeyFunc 唯一标识获取方法
|
||||
*/
|
||||
public static<N extends B, O extends B, B> DiffListVO<N, O> convertToDiffList(List<N> newList, List<O> oldList, Function<B, Object> primaryKeyFunc) {
|
||||
DiffListVO<N, O> result = new DiffListVO<>();
|
||||
// 全新增
|
||||
if (CollectionUtils.isEmptyElement(oldList)) {
|
||||
return result.setAdd(newList);
|
||||
}
|
||||
// 全删除
|
||||
if (CollectionUtils.isEmptyElement(newList)) {
|
||||
return result.setDel(oldList);
|
||||
}
|
||||
|
||||
Set<Object> newKeys = newList.stream().map(primaryKeyFunc).collect(Collectors.toSet());
|
||||
Set<Object> oldKeys = oldList.stream().map(primaryKeyFunc).collect(Collectors.toSet());
|
||||
|
||||
// 不在旧列表则为新增
|
||||
List<N> addList = newList.stream().filter(item -> !oldKeys.contains(primaryKeyFunc.apply(item))).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
result.setAdd(addList);
|
||||
// 不在新列表则为删除
|
||||
List<O> delList = oldList.stream().filter(item -> !newKeys.contains(primaryKeyFunc.apply(item))).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
result.setDel(delList);
|
||||
// 在新列表,又在旧列表,则为更新
|
||||
List<N> updateList = newList.stream().filter(item -> oldKeys.contains(primaryKeyFunc.apply(item))).filter(Objects::nonNull).collect(Collectors.toList());
|
||||
result.setUpdate(updateList);
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package com.ruoyi.common.utils.collection;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新旧差异列表
|
||||
* @author wjh
|
||||
* 2024/11/2
|
||||
*/
|
||||
@Data
|
||||
public class DiffListVO<N, O> {
|
||||
List<N> addList;
|
||||
List<N> updateList;
|
||||
List<O> delList;
|
||||
|
||||
public DiffListVO<N,O> setAdd(List<N> list) {
|
||||
this.addList = list;
|
||||
return this;
|
||||
}
|
||||
public DiffListVO<N,O> setUpdate(List<N> list) {
|
||||
this.updateList = list;
|
||||
return this;
|
||||
}
|
||||
public DiffListVO<N,O> setDel(List<O> list) {
|
||||
this.delList = list;
|
||||
return this;
|
||||
}
|
||||
public int getAddCount() {
|
||||
return CollectionUtils.isEmptyElement(addList) ? 0 : addList.size();
|
||||
}
|
||||
public int getUpdateCount() {
|
||||
return CollectionUtils.isEmptyElement(updateList) ? 0 : updateList.size();
|
||||
}
|
||||
public int getDelCount() {
|
||||
return CollectionUtils.isEmptyElement(delList) ? 0 : delList.size();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,9 @@
|
|||
package com.ruoyi.ss.vip.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.ss.store.domain.StoreVo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
@ -13,9 +17,6 @@ public class VipVO extends Vip{
|
|||
@ApiModelProperty("用户名称")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty("店铺名称")
|
||||
private String storeName;
|
||||
|
||||
@ApiModelProperty("VIP等级名称")
|
||||
private String vipLevelName;
|
||||
|
||||
|
@ -24,4 +25,7 @@ public class VipVO extends Vip{
|
|||
|
||||
@ApiModelProperty("VIP商户ID")
|
||||
private Long vipMchId;
|
||||
|
||||
@ApiModelProperty("店铺列表")
|
||||
private List<StoreVo> storeList;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ss.vip.mapper.VipMapper">
|
||||
|
||||
<resultMap type="VipVO" id="VipResult" autoMapping="true"/>
|
||||
<resultMap type="VipVO" id="VipResult" autoMapping="true">
|
||||
<result property="storeIds" column="store_ids" typeHandler="com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVipVo">
|
||||
select
|
||||
|
@ -15,7 +17,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sv.start_time,
|
||||
sv.end_time,
|
||||
sv.discount,
|
||||
sv.store_ids
|
||||
sv.store_ids,
|
||||
if(su.is_real, su.real_name, su.user_name) as user_name,
|
||||
svl.name as vip_level_name,
|
||||
svl.mch_id as vip_mch_id
|
||||
|
@ -33,7 +35,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="query.discount != null "> and sv.discount = #{query.discount}</if>
|
||||
<if test="query.storeIds != null and query.storeIds != ''"> and sv.store_ids = #{query.storeIds}</if>
|
||||
<if test="query.userName != null and query.userName != ''">and if(su.is_real, su.real_name, su.user_name) like concat('%',#{query.userName},'%')</if>
|
||||
<if test="query.storeName != null and query.storeName != ''">and ss.name like concat('%',#{query.storeName},'%')</if>
|
||||
<if test="query.vipLevelName != null and query.vipLevelName != ''">and svl.name like concat('%',#{query.vipLevelName},'%')</if>
|
||||
<if test="query.excludeId != null">and sv.id != #{query.excludeId}</if>
|
||||
<if test="query.vipLevelIds != null and query.vipLevelIds.size() > 0">
|
||||
|
@ -68,17 +69,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
insert into ss_vip
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="storeId != null">store_id,</if>
|
||||
<if test="levelId != null">level_id,</if>
|
||||
<if test="expireTime != null">expire_time,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="startTime != null">start_time,</if>
|
||||
<if test="endTime != null">end_time,</if>
|
||||
<if test="discount != null">discount,</if>
|
||||
<if test="storeIds != null and storeIds.size() > 0">store_ids,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="storeId != null">#{storeId},</if>
|
||||
<if test="levelId != null">#{levelId},</if>
|
||||
<if test="expireTime != null">#{expireTime},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="startTime != null">#{startTime},</if>
|
||||
<if test="endTime != null">#{endTime},</if>
|
||||
<if test="discount != null">#{discount},</if>
|
||||
<if test="storeIds != null and storeIds.size() > 0">#{storeIds, typeHandler=com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
@ -92,10 +97,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<sql id="updateColumns">
|
||||
<if test="data.userId != null">user_id = #{data.userId},</if>
|
||||
<if test="data.storeId != null">store_id = #{data.storeId},</if>
|
||||
<if test="data.levelId != null">level_id = #{data.levelId},</if>
|
||||
<if test="data.expireTime != null">expire_time = #{data.expireTime},</if>
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.startTime != null">start_time = #{data.startTime},</if>
|
||||
<if test="data.endTime != null">end_time = #{data.endTime},</if>
|
||||
<if test="data.discount != null">discount = #{data.discount},</if>
|
||||
<if test="data.storeIds != null and data.storeIds.size() > 0">store_ids = #{data.storeIds, typeHandler=com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteVipById" parameterType="Long">
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.ruoyi.ss.vip.service;
|
||||
|
||||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/16
|
||||
*/
|
||||
public interface VipAssembler {
|
||||
|
||||
// 拼接店铺信息
|
||||
void assembleStoreList(List<VipVO> list);
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package com.ruoyi.ss.vip.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.store.domain.StoreVo;
|
||||
import com.ruoyi.ss.store.service.StoreService;
|
||||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
import com.ruoyi.ss.vip.service.VipAssembler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class VipAssemblerImpl implements VipAssembler {
|
||||
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
|
||||
@Override
|
||||
public void assembleStoreList(List<VipVO> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Long> storeIds = list.stream().map(VipVO::getStoreIds).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
List<StoreVo> storeList = storeService.selectStoreByIds(storeIds);
|
||||
|
||||
for (VipVO vip : list) {
|
||||
List<StoreVo> vipStoreList = storeList.stream()
|
||||
.filter(store -> vip.getStoreIds().contains(store.getStoreId()))
|
||||
.collect(Collectors.toList());
|
||||
vip.setStoreList(vipStoreList);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,10 @@
|
|||
package com.ruoyi.ss.vip.service.impl;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.ss.store.service.StoreValidator;
|
||||
import com.ruoyi.ss.user.service.UserValidator;
|
||||
|
@ -8,10 +13,6 @@ import com.ruoyi.ss.vip.domain.VipQuery;
|
|||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
import com.ruoyi.ss.vip.service.VipService;
|
||||
import com.ruoyi.ss.vip.service.VipValidator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
|
@ -38,7 +39,6 @@ public class VipValidatorImpl implements VipValidator {
|
|||
public void beforeCheck(Vip data) {
|
||||
ServiceUtil.assertion(data == null, "参数错误");
|
||||
|
||||
this.checkRepeatUserStore(data.getId(), data.getUserId(), data.getStoreId());
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,7 +47,6 @@ public class VipValidatorImpl implements VipValidator {
|
|||
if (vo == null) {
|
||||
return;
|
||||
}
|
||||
this.checkRepeatUserStore(vo.getId(), vo.getUserId(), vo.getStoreId());
|
||||
|
||||
this.checkMch(vo.getStoreMchId(), vo.getVipMchId());
|
||||
}
|
||||
|
@ -67,13 +66,12 @@ public class VipValidatorImpl implements VipValidator {
|
|||
* @param userId 用户ID
|
||||
* @param storeId 店铺ID
|
||||
*/
|
||||
private void checkRepeatUserStore(Long id, Long userId, Long storeId) {
|
||||
if (userId == null || storeId == null) {
|
||||
private void checkRepeatUserStore(Long id, Long userId) {
|
||||
if (userId == null) {
|
||||
return;
|
||||
}
|
||||
VipQuery query = new VipQuery();
|
||||
query.setUserId(userId);
|
||||
query.setStoreId(storeId);
|
||||
query.setExcludeId(id);
|
||||
ServiceUtil.assertion(vipService.selectCount(query) > 0, "当前用户已经是店铺VIP,无法重复绑定");;
|
||||
}
|
||||
|
|
|
@ -49,18 +49,6 @@ public class VipLevel extends BaseEntity
|
|||
@Size(max = 1000, message = "描述文本长度不能超过1000个字符")
|
||||
private String description;
|
||||
|
||||
@Excel(name = "价格")
|
||||
@ApiModelProperty("价格")
|
||||
@NotNull(message = "价格不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||
@Min(value = 0, message = "价格不允许小于0")
|
||||
private BigDecimal price;
|
||||
|
||||
@Excel(name = "时长(天)")
|
||||
@ApiModelProperty("时长(天)")
|
||||
@NotNull(message = "时长不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||
@Min(value = 0, message = "时长不允许小于0天")
|
||||
private Long time;
|
||||
|
||||
@Excel(name = "可用店铺ID列表")
|
||||
@ApiModelProperty("可用店铺ID列表")
|
||||
@NotNull(message = "可用店铺ID列表不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
package com.ruoyi.ss.vipLevel.domain;
|
||||
|
||||
import com.ruoyi.ss.store.domain.StoreVo;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/12/9
|
||||
|
@ -13,4 +19,12 @@ public class VipLevelVO extends VipLevel{
|
|||
@ApiModelProperty("商户名称")
|
||||
private String mchName;
|
||||
|
||||
@ApiModelProperty("店铺列表")
|
||||
private List<StoreVo> storeList;
|
||||
|
||||
@ApiModelProperty("SKU列表")
|
||||
@Size(min = 1, message = "SKU列表不能为空")
|
||||
@Valid
|
||||
private List<VipLevelSkuVO> skuList;
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.ss.vipLevel.mapper.VipLevelMapper">
|
||||
|
||||
<resultMap type="VipLevelVO" id="VipLevelResult" autoMapping="true"/>
|
||||
<resultMap type="VipLevelVO" id="VipLevelResult" autoMapping="true">
|
||||
<result property="storeIds" column="store_ids" typeHandler="com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVipLevelVo">
|
||||
select
|
||||
|
@ -14,10 +16,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
svl.discount,
|
||||
svl.create_time,
|
||||
svl.description,
|
||||
svl.price,
|
||||
svl.time,
|
||||
svl.store_ids,
|
||||
svl.status
|
||||
svl.status,
|
||||
if (mch.is_real, mch.real_name, mch.user_name) as mch_name
|
||||
from ss_vip_level svl
|
||||
left join sm_user mch on mch.user_id = svl.mch_id
|
||||
|
@ -56,14 +56,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
insert into ss_vip_level
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="mchId != null">mch_id,</if>
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="name != null and name != ''">`name`,</if>
|
||||
<if test="discount != null">discount,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="description != null">description,</if>
|
||||
<if test="price != null">price,</if>
|
||||
<if test="time != null">time,</if>
|
||||
<if test="description != null">`description`,</if>
|
||||
<if test="storeIds != null">store_ids,</if>
|
||||
<if test="status != null and status != ''">status,</if>
|
||||
<if test="status != null and status != ''">`status`,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="mchId != null">#{mchId},</if>
|
||||
|
@ -71,9 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="discount != null">#{discount},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="price != null">#{price},</if>
|
||||
<if test="time != null">#{time},</if>
|
||||
<if test="storeIds != null">#{storeIds},</if>
|
||||
<if test="storeIds != null and storeIds.size() > 0">#{storeIds, typeHandler=com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
@ -88,14 +84,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<sql id="updateColumns">
|
||||
<if test="data.mchId != null">mch_id = #{data.mchId},</if>
|
||||
<if test="data.name != null and data.name != ''">name = #{data.name},</if>
|
||||
<if test="data.name != null and data.name != ''">`name` = #{data.name},</if>
|
||||
<if test="data.discount != null">discount = #{data.discount},</if>
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.description != null">description = #{data.description},</if>
|
||||
<if test="data.price != null">price = #{data.price},</if>
|
||||
<if test="data.time != null">time = #{data.time},</if>
|
||||
<if test="data.storeIds != null">store_ids = #{data.storeIds},</if>
|
||||
<if test="data.status != null and data.status != ''">status = #{data.status},</if>
|
||||
<if test="data.description != null">`description` = #{data.description},</if>
|
||||
<if test="data.storeIds != null and data.storeIds.size() > 0">store_ids = #{data.storeIds, typeHandler=com.ruoyi.system.mapper.typehandler.LongSplitListTypeHandler},</if>
|
||||
<if test="data.status != null and data.status != ''">`status` = #{data.status},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteVipLevelById" parameterType="Long">
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package com.ruoyi.ss.vipLevel.service;
|
||||
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface VipLevelAssembler {
|
||||
|
||||
void assembleStoreList(List<VipLevelVO> list);
|
||||
|
||||
void assembleSkuList(List<VipLevelVO> list);
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package com.ruoyi.ss.vipLevel.service;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/16
|
||||
*/
|
||||
public interface VipLevelConverter {
|
||||
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package com.ruoyi.ss.vipLevel.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevel;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelQuery;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员等级Service接口
|
||||
|
@ -35,7 +35,7 @@ public interface VipLevelService
|
|||
* @param vipLevel 会员等级
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertVipLevel(VipLevel vipLevel);
|
||||
public int insertVipLevel(VipLevelVO vipLevel);
|
||||
|
||||
/**
|
||||
* 修改会员等级
|
||||
|
@ -43,7 +43,7 @@ public interface VipLevelService
|
|||
* @param vipLevel 会员等级
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateVipLevel(VipLevel vipLevel);
|
||||
public int updateVipLevel(VipLevelVO vipLevel);
|
||||
|
||||
/**
|
||||
* 批量删除会员等级
|
||||
|
|
|
@ -0,0 +1,65 @@
|
|||
package com.ruoyi.ss.vipLevel.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.store.domain.StoreVo;
|
||||
import com.ruoyi.ss.store.service.StoreService;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelAssembler;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
import com.ruoyi.ss.vipLevelSku.service.VipLevelSkuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class VipLevelAssemblerImpl implements VipLevelAssembler {
|
||||
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
|
||||
@Autowired
|
||||
private VipLevelSkuService vipLevelSkuService;
|
||||
|
||||
@Override
|
||||
public void assembleStoreList(List<VipLevelVO> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Long> storeIds = list.stream().map(VipLevelVO::getStoreIds).flatMap(Collection::stream).collect(Collectors.toList());
|
||||
List<StoreVo> storeList = storeService.selectStoreByIds(storeIds);
|
||||
|
||||
for (VipLevelVO vipLevel : list) {
|
||||
List<StoreVo> vipLevelStoreList = storeList.stream()
|
||||
.filter(store -> vipLevel.getStoreIds().contains(store.getStoreId()))
|
||||
.collect(Collectors.toList());
|
||||
vipLevel.setStoreList(vipLevelStoreList);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assembleSkuList(List<VipLevelVO> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Long> levelIds = list.stream().map(VipLevelVO::getId).collect(Collectors.toList());
|
||||
|
||||
Map<Long, List<VipLevelSkuVO>> group = vipLevelSkuService.selectByLevelIds(levelIds)
|
||||
.stream().collect(Collectors.groupingBy(VipLevelSkuVO::getLevelId));
|
||||
|
||||
|
||||
for (VipLevelVO vipLevel : list) {
|
||||
List<VipLevelSkuVO> vipLevelSkuList = group.get(vipLevel.getId());
|
||||
if (vipLevelSkuList == null) {
|
||||
vipLevelSkuList = Collections.emptyList();
|
||||
}
|
||||
vipLevel.setSkuList(vipLevelSkuList);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.ruoyi.ss.vipLevel.service.impl;
|
||||
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelConverter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/16
|
||||
*/
|
||||
@Service
|
||||
public class VipLevelConverterImpl implements VipLevelConverter {
|
||||
}
|
|
@ -1,17 +1,21 @@
|
|||
package com.ruoyi.ss.vipLevel.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.common.utils.collection.DiffListVO;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelQuery;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevel.mapper.VipLevelMapper;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelService;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelValidator;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
import com.ruoyi.ss.vipLevelSku.service.VipLevelSkuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelValidator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.ss.vipLevel.mapper.VipLevelMapper;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevel;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelQuery;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelService;
|
||||
|
||||
/**
|
||||
* 会员等级Service业务层处理
|
||||
|
@ -28,6 +32,12 @@ public class VipLevelServiceImpl implements VipLevelService
|
|||
@Autowired
|
||||
private VipLevelValidator vipLevelValidator;
|
||||
|
||||
@Autowired
|
||||
private VipLevelSkuService vipLevelSkuService;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
/**
|
||||
* 查询会员等级
|
||||
*
|
||||
|
@ -59,10 +69,22 @@ public class VipLevelServiceImpl implements VipLevelService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertVipLevel(VipLevel vipLevel)
|
||||
{
|
||||
vipLevel.setCreateTime(DateUtils.getNowDate());
|
||||
return vipLevelMapper.insertVipLevel(vipLevel);
|
||||
public int insertVipLevel(VipLevelVO vipLevel) {
|
||||
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
// 主表
|
||||
vipLevel.setCreateTime(DateUtils.getNowDate());
|
||||
int insert = vipLevelMapper.insertVipLevel(vipLevel);
|
||||
|
||||
if (insert == 1) {
|
||||
// SKU表
|
||||
this.batchUpdateSku(vipLevel);
|
||||
}
|
||||
|
||||
return insert;
|
||||
});
|
||||
|
||||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,9 +94,48 @@ public class VipLevelServiceImpl implements VipLevelService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateVipLevel(VipLevel vipLevel)
|
||||
{
|
||||
return vipLevelMapper.updateVipLevel(vipLevel);
|
||||
public int updateVipLevel(VipLevelVO vipLevel) {
|
||||
Integer result = transactionTemplate.execute(status -> {
|
||||
// 主表
|
||||
int update = vipLevelMapper.updateVipLevel(vipLevel);
|
||||
|
||||
if (update == 1) {
|
||||
// SKU表
|
||||
this.batchUpdateSku(vipLevel);
|
||||
}
|
||||
|
||||
return update;
|
||||
});
|
||||
|
||||
return result == null ? 0 : result;
|
||||
}
|
||||
|
||||
private int batchUpdateSku(VipLevelVO level) {
|
||||
if (level == null) {
|
||||
return 0;
|
||||
}
|
||||
// 分离出新旧数据
|
||||
List<VipLevelSkuVO> newList = level.getSkuList();
|
||||
if (CollectionUtils.isNotEmptyElement(newList)) {
|
||||
for (VipLevelSkuVO sku : newList) {
|
||||
sku.setLevelId(level.getId());
|
||||
}
|
||||
}
|
||||
List<VipLevelSkuVO> oldList = vipLevelSkuService.selectByLevelId(level.getId());
|
||||
DiffListVO<VipLevelSkuVO, VipLevelSkuVO> diff = CollectionUtils.convertToDiffList(newList, oldList, VipLevelSkuVO::getId);
|
||||
|
||||
int result = 0;
|
||||
if (diff.getAddCount() > 0) {
|
||||
result += vipLevelSkuService.batchInsert(diff.getAddList());
|
||||
}
|
||||
if (diff.getUpdateCount() > 0) {
|
||||
result += vipLevelSkuService.batchUpdate(diff.getAddList());
|
||||
}
|
||||
if (diff.getDelCount() > 0) {
|
||||
result += vipLevelSkuService.deleteVipLevelSkuByIds(CollectionUtils.map(diff.getDelList(), VipLevelSkuVO::getId));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.ruoyi.ss.vipLevelSku.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* VIP等级定价对象 ss_vip_level_sku
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
@Data
|
||||
public class VipLevelSku extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "VIP等级ID")
|
||||
@ApiModelProperty("VIP等级ID")
|
||||
private Long levelId;
|
||||
|
||||
@Excel(name = "价格")
|
||||
@ApiModelProperty("价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@Excel(name = "时长(天)")
|
||||
@ApiModelProperty("时长(天)")
|
||||
private Integer time;
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package com.ruoyi.ss.vipLevelSku.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/16
|
||||
*/
|
||||
@Data
|
||||
public class VipLevelSkuQuery extends VipLevelSkuVO{
|
||||
|
||||
@ApiModelProperty("等级ID列表")
|
||||
private List<Long> levelIds;
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.ruoyi.ss.vipLevelSku.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/16
|
||||
*/
|
||||
@Data
|
||||
public class VipLevelSkuVO extends VipLevelSku {
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.ruoyi.ss.vipLevelSku.mapper;
|
||||
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSku;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuQuery;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* VIP等级定价Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
public interface VipLevelSkuMapper
|
||||
{
|
||||
/**
|
||||
* 查询VIP等级定价
|
||||
*
|
||||
* @param id VIP等级定价主键
|
||||
* @return VIP等级定价
|
||||
*/
|
||||
VipLevelSkuVO selectVipLevelSkuById(Long id);
|
||||
|
||||
/**
|
||||
* 查询VIP等级定价列表
|
||||
*
|
||||
* @param query VIP等级定价
|
||||
* @return VIP等级定价集合
|
||||
*/
|
||||
List<VipLevelSkuVO> selectVipLevelSkuList(@Param("query")VipLevelSkuQuery query);
|
||||
|
||||
/**
|
||||
* 新增VIP等级定价
|
||||
*
|
||||
* @param vipLevelSku VIP等级定价
|
||||
* @return 结果
|
||||
*/
|
||||
int insertVipLevelSku(VipLevelSku vipLevelSku);
|
||||
|
||||
/**
|
||||
* 修改VIP等级定价
|
||||
*
|
||||
* @param vipLevelSku VIP等级定价
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateVipLevelSku(@Param("data") VipLevelSku vipLevelSku);
|
||||
|
||||
/**
|
||||
* 删除VIP等级定价
|
||||
*
|
||||
* @param id VIP等级定价主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteVipLevelSkuById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除VIP等级定价
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteVipLevelSkuByIds(@Param("ids") List<Long> ids);
|
||||
|
||||
int batchInsert(@Param("list") List<? extends VipLevelSku> list);
|
||||
int batchUpdate(@Param("list") List<? extends VipLevelSku> list);
|
||||
}
|
|
@ -0,0 +1,176 @@
|
|||
<?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.ruoyi.ss.vipLevelSku.mapper.VipLevelSkuMapper">
|
||||
|
||||
<resultMap type="VipLevelSkuVO" id="VipLevelSkuResult" autoMapping="true"/>
|
||||
|
||||
<sql id="selectVipLevelSkuVo">
|
||||
select
|
||||
svls.id,
|
||||
svls.level_id,
|
||||
svls.price,
|
||||
svls.time,
|
||||
svls.create_time,
|
||||
svls.update_time
|
||||
from ss_vip_level_sku svls
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.id != null "> and svls.id = #{query.id}</if>
|
||||
<if test="query.levelId != null "> and svls.level_id = #{query.levelId}</if>
|
||||
<if test="query.levelIds != null and query.levelIds.size() > 0">
|
||||
and svls.level_id in
|
||||
<foreach collection="query.levelIds" item="item" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
${query.params.dataScope}
|
||||
</sql>
|
||||
|
||||
<select id="selectVipLevelSkuList" parameterType="VipLevelSkuQuery" resultMap="VipLevelSkuResult">
|
||||
<include refid="selectVipLevelSkuVo"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectVipLevelSkuById" parameterType="Long" resultMap="VipLevelSkuResult">
|
||||
<include refid="selectVipLevelSkuVo"/>
|
||||
where svls.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertVipLevelSku" parameterType="VipLevelSku">
|
||||
insert into ss_vip_level_sku
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="levelId != null">level_id,</if>
|
||||
<if test="price != null">price,</if>
|
||||
<if test="time != null">`time`,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="levelId != null">#{levelId},</if>
|
||||
<if test="price != null">#{price},</if>
|
||||
<if test="time != null">#{time},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="batchInsert" parameterType="VipLevelSku" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into ss_vip_level_sku
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
level_id,
|
||||
price,
|
||||
`time`,
|
||||
create_time,
|
||||
update_time,
|
||||
</trim>
|
||||
values
|
||||
<foreach collection="list" item="i" separator=",">
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="i.levelId != null ">#{i.levelId},</if>
|
||||
<if test="i.levelId == null ">default,</if>
|
||||
<if test="i.price != null ">#{i.price},</if>
|
||||
<if test="i.price == null ">default,</if>
|
||||
<if test="i.time != null ">#{i.time},</if>
|
||||
<if test="i.time == null ">default,</if>
|
||||
<if test="i.createTime != null ">#{i.createTime},</if>
|
||||
<if test="i.createTime == null ">default,</if>
|
||||
<if test="i.updateTime != null ">#{i.updateTime},</if>
|
||||
<if test="i.updateTime == null ">default,</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="batchUpdate" >
|
||||
update ss_vip_level_sku
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<foreach open="level_id = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.levelId != null ">
|
||||
WHEN #{item.id} THEN #{item.levelId}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `level_id`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="price = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.price != null ">
|
||||
WHEN #{item.id} THEN #{item.price}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `price`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="time = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.time != null ">
|
||||
WHEN #{item.id} THEN #{item.time}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `time`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="create_time = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.createTime != null ">
|
||||
WHEN #{item.id} THEN #{item.createTime}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `create_time`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
<foreach open="update_time = CASE id" collection="list" item="item" close="END,">
|
||||
<choose>
|
||||
<when test="item.updateTime != null ">
|
||||
WHEN #{item.id} THEN #{item.updateTime}
|
||||
</when>
|
||||
<otherwise>
|
||||
WHEN #{item.id} THEN `update_time`
|
||||
</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
</trim>
|
||||
where id in
|
||||
<foreach item="item" collection="list" open="(" separator="," close=")">
|
||||
#{item.id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<update id="updateVipLevelSku" parameterType="VipLevelSku">
|
||||
update ss_vip_level_sku
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<include refid="updateColumns"/>
|
||||
</trim>
|
||||
where id = #{data.id}
|
||||
</update>
|
||||
|
||||
<sql id="updateColumns">
|
||||
<if test="data.levelId != null">level_id = #{data.levelId},</if>
|
||||
<if test="data.price != null">price = #{data.price},</if>
|
||||
<if test="data.time != null">time = #{data.time},</if>
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
<if test="data.updateTime != null">update_time = #{data.updateTime},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteVipLevelSkuById" parameterType="Long">
|
||||
delete from ss_vip_level_sku where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteVipLevelSkuByIds" parameterType="String">
|
||||
delete from ss_vip_level_sku where id in
|
||||
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,82 @@
|
|||
package com.ruoyi.ss.vipLevelSku.service;
|
||||
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSku;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuQuery;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* VIP等级定价Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
public interface VipLevelSkuService
|
||||
{
|
||||
/**
|
||||
* 查询VIP等级定价
|
||||
*
|
||||
* @param id VIP等级定价主键
|
||||
* @return VIP等级定价
|
||||
*/
|
||||
public VipLevelSkuVO selectVipLevelSkuById(Long id);
|
||||
|
||||
/**
|
||||
* 查询VIP等级定价列表
|
||||
*
|
||||
* @param vipLevelSku VIP等级定价
|
||||
* @return VIP等级定价集合
|
||||
*/
|
||||
public List<VipLevelSkuVO> selectVipLevelSkuList(VipLevelSkuQuery vipLevelSku);
|
||||
|
||||
/**
|
||||
* 新增VIP等级定价
|
||||
*
|
||||
* @param vipLevelSku VIP等级定价
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertVipLevelSku(VipLevelSku vipLevelSku);
|
||||
|
||||
/**
|
||||
* 修改VIP等级定价
|
||||
*
|
||||
* @param vipLevelSku VIP等级定价
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateVipLevelSku(VipLevelSku vipLevelSku);
|
||||
|
||||
/**
|
||||
* 批量删除VIP等级定价
|
||||
*
|
||||
* @param ids 需要删除的VIP等级定价主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteVipLevelSkuByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 删除VIP等级定价信息
|
||||
*
|
||||
* @param id VIP等级定价主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteVipLevelSkuById(Long id);
|
||||
|
||||
/**
|
||||
* 根据等级id查询
|
||||
* @param levelId
|
||||
* @return
|
||||
*/
|
||||
List<VipLevelSkuVO> selectByLevelId(Long levelId);
|
||||
|
||||
int batchInsert(List<? extends VipLevelSku> list);
|
||||
|
||||
int batchUpdate(List<? extends VipLevelSku> list);
|
||||
|
||||
/**
|
||||
* 根据等级id查询
|
||||
* @param levelIds
|
||||
* @return
|
||||
*/
|
||||
List<VipLevelSkuVO> selectByLevelIds(List<Long> levelIds);
|
||||
}
|
|
@ -0,0 +1,146 @@
|
|||
package com.ruoyi.ss.vipLevelSku.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSku;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuQuery;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
import com.ruoyi.ss.vipLevelSku.mapper.VipLevelSkuMapper;
|
||||
import com.ruoyi.ss.vipLevelSku.service.VipLevelSkuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* VIP等级定价Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
@Service
|
||||
public class VipLevelSkuServiceImpl implements VipLevelSkuService
|
||||
{
|
||||
@Autowired
|
||||
private VipLevelSkuMapper vipLevelSkuMapper;
|
||||
|
||||
/**
|
||||
* 查询VIP等级定价
|
||||
*
|
||||
* @param id VIP等级定价主键
|
||||
* @return VIP等级定价
|
||||
*/
|
||||
@Override
|
||||
public VipLevelSkuVO selectVipLevelSkuById(Long id)
|
||||
{
|
||||
return vipLevelSkuMapper.selectVipLevelSkuById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询VIP等级定价列表
|
||||
*
|
||||
* @param vipLevelSku VIP等级定价
|
||||
* @return VIP等级定价
|
||||
*/
|
||||
@Override
|
||||
public List<VipLevelSkuVO> selectVipLevelSkuList(VipLevelSkuQuery vipLevelSku)
|
||||
{
|
||||
return vipLevelSkuMapper.selectVipLevelSkuList(vipLevelSku);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增VIP等级定价
|
||||
*
|
||||
* @param vipLevelSku VIP等级定价
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertVipLevelSku(VipLevelSku vipLevelSku)
|
||||
{
|
||||
vipLevelSku.setCreateTime(DateUtils.getNowDate());
|
||||
return vipLevelSkuMapper.insertVipLevelSku(vipLevelSku);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改VIP等级定价
|
||||
*
|
||||
* @param vipLevelSku VIP等级定价
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateVipLevelSku(VipLevelSku vipLevelSku)
|
||||
{
|
||||
vipLevelSku.setUpdateTime(DateUtils.getNowDate());
|
||||
return vipLevelSkuMapper.updateVipLevelSku(vipLevelSku);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除VIP等级定价
|
||||
*
|
||||
* @param ids 需要删除的VIP等级定价主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteVipLevelSkuByIds(List<Long> ids)
|
||||
{
|
||||
return vipLevelSkuMapper.deleteVipLevelSkuByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除VIP等级定价信息
|
||||
*
|
||||
* @param id VIP等级定价主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteVipLevelSkuById(Long id)
|
||||
{
|
||||
return vipLevelSkuMapper.deleteVipLevelSkuById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VipLevelSkuVO> selectByLevelId(Long levelId) {
|
||||
if (levelId == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
VipLevelSkuQuery query = new VipLevelSkuQuery();
|
||||
query.setLevelId(levelId);
|
||||
return vipLevelSkuMapper.selectVipLevelSkuList(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchInsert(List<? extends VipLevelSku> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return 0;
|
||||
}
|
||||
Date now = DateUtils.getNowDate();
|
||||
for (VipLevelSku sku : list) {
|
||||
sku.setCreateTime(now);
|
||||
}
|
||||
return vipLevelSkuMapper.batchInsert(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchUpdate(List<? extends VipLevelSku> list) {
|
||||
if (CollectionUtils.isEmptyElement(list)) {
|
||||
return 0;
|
||||
}
|
||||
Date now = DateUtils.getNowDate();
|
||||
for (VipLevelSku sku : list) {
|
||||
sku.setUpdateTime(now);
|
||||
}
|
||||
return vipLevelSkuMapper.batchUpdate(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VipLevelSkuVO> selectByLevelIds(List<Long> levelIds) {
|
||||
if (CollectionUtils.isEmptyElement(levelIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
VipLevelSkuQuery query = new VipLevelSkuQuery();
|
||||
query.setLevelIds(levelIds);
|
||||
return vipLevelSkuMapper.selectVipLevelSkuList(query);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package com.ruoyi.ss.vipOrder.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* 会员订单对象 ss_vip_order
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
@Data
|
||||
public class VipOrder extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Long id;
|
||||
|
||||
@Excel(name = "订单编号")
|
||||
@ApiModelProperty("订单编号")
|
||||
private String orderNo;
|
||||
|
||||
@Excel(name = "用户ID")
|
||||
@ApiModelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@Excel(name = "商户ID")
|
||||
@ApiModelProperty("商户ID")
|
||||
private Long mchId;
|
||||
|
||||
@Excel(name = "VIP等级ID")
|
||||
@ApiModelProperty("VIP等级ID")
|
||||
private Long levelId;
|
||||
|
||||
@Excel(name = "下单时的等级名称")
|
||||
@ApiModelProperty("下单时的等级名称")
|
||||
private String levelName;
|
||||
|
||||
@Excel(name = "下单时的折扣")
|
||||
@ApiModelProperty("下单时的折扣")
|
||||
private BigDecimal levelDiscount;
|
||||
|
||||
@Excel(name = "下单时的可用店铺列表")
|
||||
@ApiModelProperty("下单时的可用店铺列表")
|
||||
private String levelStoreIds;
|
||||
|
||||
@Excel(name = "VIP定价ID")
|
||||
@ApiModelProperty("VIP定价ID")
|
||||
private Long skuId;
|
||||
|
||||
@Excel(name = "下单时的购买时长(天)")
|
||||
@ApiModelProperty("下单时的购买时长(天)")
|
||||
private Long skuTime;
|
||||
|
||||
@Excel(name = "订单金额")
|
||||
@ApiModelProperty("订单金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "订单过期时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("订单过期时间")
|
||||
private LocalDateTime expireTime;
|
||||
|
||||
@Excel(name = "支付订单ID")
|
||||
@ApiModelProperty("支付订单ID")
|
||||
private Long payId;
|
||||
|
||||
@Excel(name = "订单状态", readConverterExp = "1=待支付,2=支付成功,3=已取消")
|
||||
@ApiModelProperty("订单状态")
|
||||
private String status;
|
||||
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "取消时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty("取消时间")
|
||||
private LocalDateTime cancelTime;
|
||||
|
||||
@Excel(name = "取消原因")
|
||||
@ApiModelProperty("取消原因")
|
||||
private String cancelReason;
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package com.ruoyi.ss.vipOrder.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/16
|
||||
*/
|
||||
@Data
|
||||
public class VipOrderQuery extends VipOrderVO{
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package com.ruoyi.ss.vipOrder.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2025/1/16
|
||||
*/
|
||||
@Data
|
||||
public class VipOrderVO extends VipOrder{
|
||||
|
||||
|
||||
@ApiModelProperty("支付渠道名称")
|
||||
private String channelName;
|
||||
|
||||
@ApiModelProperty("支付时间")
|
||||
private LocalDateTime payTime;
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package com.ruoyi.ss.vipOrder.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrder;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrderVO;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrderQuery;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 会员订单Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
public interface VipOrderMapper
|
||||
{
|
||||
/**
|
||||
* 查询会员订单
|
||||
*
|
||||
* @param id 会员订单主键
|
||||
* @return 会员订单
|
||||
*/
|
||||
VipOrderVO selectVipOrderById(Long id);
|
||||
|
||||
/**
|
||||
* 查询会员订单列表
|
||||
*
|
||||
* @param query 会员订单
|
||||
* @return 会员订单集合
|
||||
*/
|
||||
List<VipOrderVO> selectVipOrderList(@Param("query")VipOrderQuery query);
|
||||
|
||||
/**
|
||||
* 新增会员订单
|
||||
*
|
||||
* @param vipOrder 会员订单
|
||||
* @return 结果
|
||||
*/
|
||||
int insertVipOrder(VipOrder vipOrder);
|
||||
|
||||
/**
|
||||
* 修改会员订单
|
||||
*
|
||||
* @param vipOrder 会员订单
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateVipOrder(@Param("data") VipOrder vipOrder);
|
||||
|
||||
/**
|
||||
* 删除会员订单
|
||||
*
|
||||
* @param id 会员订单主键
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteVipOrderById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除会员订单
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteVipOrderByIds(Long[] ids);
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
<?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.ruoyi.ss.vipOrder.mapper.VipOrderMapper">
|
||||
|
||||
<resultMap type="VipOrderVO" id="VipOrderResult" autoMapping="true"/>
|
||||
|
||||
<sql id="selectVipOrderVo">
|
||||
select
|
||||
svo.id,
|
||||
svo.order_no,
|
||||
svo.user_id,
|
||||
svo.mch_id,
|
||||
svo.level_id,
|
||||
svo.level_name,
|
||||
svo.level_discount,
|
||||
svo.level_store_ids,
|
||||
svo.sku_id,
|
||||
svo.sku_time,
|
||||
svo.amount,
|
||||
svo.expire_time,
|
||||
svo.pay_id,
|
||||
svo.status,
|
||||
svo.cancel_time,
|
||||
svo.cancel_reason,
|
||||
svo.create_time,
|
||||
spb.pay_time as pay_time,
|
||||
sc.name as channel_name
|
||||
from ss_vip_order svo
|
||||
left join ss_pay_bill spb on spb.pay_id = svo.pay_id
|
||||
left join sm_channel sc on sc.channel_id = spb.channel_id
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
<if test="query.id != null "> and svo.id = #{query.id}</if>
|
||||
<if test="query.orderNo != null and query.orderNo != ''"> and svo.order_no like concat('%', #{query.orderNo}, '%')</if>
|
||||
<if test="query.userId != null "> and svo.user_id = #{query.userId}</if>
|
||||
<if test="query.mchId != null "> and svo.mch_id = #{query.mchId}</if>
|
||||
<if test="query.levelId != null "> and svo.level_id = #{query.levelId}</if>
|
||||
<if test="query.levelName != null and query.levelName != ''"> and svo.level_name like concat('%', #{query.levelName}, '%')</if>
|
||||
<if test="query.skuId != null "> and svo.sku_id = #{query.skuId}</if>
|
||||
<if test="query.payId != null"> and svo.pay_id = #{query.payId}</if>
|
||||
<if test="query.status != null and query.status != ''"> and svo.status = #{query.status}</if>
|
||||
<if test="query.cancelReason != null and query.cancelReason != ''"> and svo.cancel_reason like concat('%', #{query.cancelReason}, '%')</if>
|
||||
${query.params.dataScope}
|
||||
</sql>
|
||||
|
||||
<select id="selectVipOrderList" parameterType="VipOrderQuery" resultMap="VipOrderResult">
|
||||
<include refid="selectVipOrderVo"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectVipOrderById" parameterType="Long" resultMap="VipOrderResult">
|
||||
<include refid="selectVipOrderVo"/>
|
||||
where svo.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertVipOrder" parameterType="VipOrder" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ss_vip_order
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="orderNo != null and orderNo != ''">order_no,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="mchId != null">mch_id,</if>
|
||||
<if test="levelId != null">level_id,</if>
|
||||
<if test="levelName != null and levelName != ''">level_name,</if>
|
||||
<if test="levelDiscount != null">level_discount,</if>
|
||||
<if test="levelStoreIds != null and levelStoreIds != ''">level_store_ids,</if>
|
||||
<if test="skuId != null">sku_id,</if>
|
||||
<if test="skuTime != null">sku_time,</if>
|
||||
<if test="amount != null">amount,</if>
|
||||
<if test="expireTime != null">expire_time,</if>
|
||||
<if test="payId != null">pay_id,</if>
|
||||
<if test="status != null and status != ''">`status`,</if>
|
||||
<if test="cancelTime != null">cancel_time,</if>
|
||||
<if test="cancelReason != null">cancel_reason,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="mchId != null">#{mchId},</if>
|
||||
<if test="levelId != null">#{levelId},</if>
|
||||
<if test="levelName != null and levelName != ''">#{levelName},</if>
|
||||
<if test="levelDiscount != null">#{levelDiscount},</if>
|
||||
<if test="levelStoreIds != null and levelStoreIds != ''">#{levelStoreIds},</if>
|
||||
<if test="skuId != null">#{skuId},</if>
|
||||
<if test="skuTime != null">#{skuTime},</if>
|
||||
<if test="amount != null">#{amount},</if>
|
||||
<if test="expireTime != null">#{expireTime},</if>
|
||||
<if test="payId != null">#{payId},</if>
|
||||
<if test="status != null and status != ''">#{status},</if>
|
||||
<if test="cancelTime != null">#{cancelTime},</if>
|
||||
<if test="cancelReason != null">#{cancelReason},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateVipOrder" parameterType="VipOrder">
|
||||
update ss_vip_order
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<include refid="updateColumns"/>
|
||||
</trim>
|
||||
where id = #{data.id}
|
||||
</update>
|
||||
|
||||
<sql id="updateColumns">
|
||||
<if test="data.orderNo != null and data.orderNo != ''">order_no = #{data.orderNo},</if>
|
||||
<if test="data.userId != null">user_id = #{data.userId},</if>
|
||||
<if test="data.mchId != null">mch_id = #{data.mchId},</if>
|
||||
<if test="data.levelId != null">level_id = #{data.levelId},</if>
|
||||
<if test="data.levelName != null and data.levelName != ''">level_name = #{data.levelName},</if>
|
||||
<if test="data.levelDiscount != null">level_discount = #{data.levelDiscount},</if>
|
||||
<if test="data.levelStoreIds != null and data.levelStoreIds != ''">level_store_ids = #{data.levelStoreIds},</if>
|
||||
<if test="data.skuId != null">sku_id = #{data.skuId},</if>
|
||||
<if test="data.skuTime != null">sku_time = #{data.skuTime},</if>
|
||||
<if test="data.amount != null">amount = #{data.amount},</if>
|
||||
<if test="data.expireTime != null">expire_time = #{data.expireTime},</if>
|
||||
<if test="data.payId != null">pay_id = #{data.payId},</if>
|
||||
<if test="data.status != null and data.status != ''">`status` = #{data.status},</if>
|
||||
<if test="data.cancelTime != null">cancel_time = #{data.cancelTime},</if>
|
||||
<if test="data.cancelReason != null">cancel_reason = #{data.cancelReason},</if>
|
||||
<if test="data.createTime != null">create_time = #{data.createTime},</if>
|
||||
</sql>
|
||||
|
||||
<delete id="deleteVipOrderById" parameterType="Long">
|
||||
delete from ss_vip_order where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteVipOrderByIds" parameterType="String">
|
||||
delete from ss_vip_order where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -0,0 +1,63 @@
|
|||
package com.ruoyi.ss.vipOrder.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrder;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrderVO;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrderQuery;
|
||||
|
||||
/**
|
||||
* 会员订单Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
public interface VipOrderService
|
||||
{
|
||||
/**
|
||||
* 查询会员订单
|
||||
*
|
||||
* @param id 会员订单主键
|
||||
* @return 会员订单
|
||||
*/
|
||||
public VipOrderVO selectVipOrderById(Long id);
|
||||
|
||||
/**
|
||||
* 查询会员订单列表
|
||||
*
|
||||
* @param vipOrder 会员订单
|
||||
* @return 会员订单集合
|
||||
*/
|
||||
public List<VipOrderVO> selectVipOrderList(VipOrderQuery vipOrder);
|
||||
|
||||
/**
|
||||
* 新增会员订单
|
||||
*
|
||||
* @param vipOrder 会员订单
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertVipOrder(VipOrder vipOrder);
|
||||
|
||||
/**
|
||||
* 修改会员订单
|
||||
*
|
||||
* @param vipOrder 会员订单
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateVipOrder(VipOrder vipOrder);
|
||||
|
||||
/**
|
||||
* 批量删除会员订单
|
||||
*
|
||||
* @param ids 需要删除的会员订单主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteVipOrderByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除会员订单信息
|
||||
*
|
||||
* @param id 会员订单主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteVipOrderById(Long id);
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
package com.ruoyi.ss.vipOrder.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.ss.vipOrder.mapper.VipOrderMapper;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrder;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrderVO;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrderQuery;
|
||||
import com.ruoyi.ss.vipOrder.service.VipOrderService;
|
||||
|
||||
/**
|
||||
* 会员订单Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
@Service
|
||||
public class VipOrderServiceImpl implements VipOrderService
|
||||
{
|
||||
@Autowired
|
||||
private VipOrderMapper vipOrderMapper;
|
||||
|
||||
/**
|
||||
* 查询会员订单
|
||||
*
|
||||
* @param id 会员订单主键
|
||||
* @return 会员订单
|
||||
*/
|
||||
@Override
|
||||
public VipOrderVO selectVipOrderById(Long id)
|
||||
{
|
||||
return vipOrderMapper.selectVipOrderById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询会员订单列表
|
||||
*
|
||||
* @param vipOrder 会员订单
|
||||
* @return 会员订单
|
||||
*/
|
||||
@Override
|
||||
public List<VipOrderVO> selectVipOrderList(VipOrderQuery vipOrder)
|
||||
{
|
||||
return vipOrderMapper.selectVipOrderList(vipOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增会员订单
|
||||
*
|
||||
* @param vipOrder 会员订单
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertVipOrder(VipOrder vipOrder)
|
||||
{
|
||||
vipOrder.setCreateTime(DateUtils.getNowDate());
|
||||
return vipOrderMapper.insertVipOrder(vipOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改会员订单
|
||||
*
|
||||
* @param vipOrder 会员订单
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateVipOrder(VipOrder vipOrder)
|
||||
{
|
||||
return vipOrderMapper.updateVipOrder(vipOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除会员订单
|
||||
*
|
||||
* @param ids 需要删除的会员订单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteVipOrderByIds(Long[] ids)
|
||||
{
|
||||
return vipOrderMapper.deleteVipOrderByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员订单信息
|
||||
*
|
||||
* @param id 会员订单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteVipOrderById(Long id)
|
||||
{
|
||||
return vipOrderMapper.deleteVipOrderById(id);
|
||||
}
|
||||
}
|
|
@ -1,12 +1,9 @@
|
|||
package com.ruoyi.web.controller.mch;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevel;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelQuery;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelService;
|
||||
|
@ -54,14 +51,14 @@ public class MchVipLevelController extends BaseController {
|
|||
|
||||
@ApiModelProperty("新增VIP等级")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody @Validated(ValidGroup.FrontCreate.class) VipLevel data) {
|
||||
public AjaxResult add(@RequestBody @Validated(ValidGroup.FrontCreate.class) VipLevelVO data) {
|
||||
data.setMchId(getUserId());
|
||||
return toAjax(vipLevelService.insertVipLevel(data));
|
||||
}
|
||||
|
||||
@ApiModelProperty("修改VIP等级")
|
||||
@PutMapping
|
||||
public AjaxResult update(@RequestBody @Validated(ValidGroup.FrontUpdate.class) VipLevel data) {
|
||||
public AjaxResult update(@RequestBody @Validated(ValidGroup.FrontUpdate.class) VipLevelVO data) {
|
||||
if (!vipLevelValidator.canOpera(data.getId(), getUserId())) {
|
||||
return error("您无权操作该数据");
|
||||
}
|
||||
|
|
|
@ -1,27 +1,23 @@
|
|||
package com.ruoyi.web.controller.ss;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.ss.vip.domain.Vip;
|
||||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
import com.ruoyi.ss.vip.domain.VipQuery;
|
||||
import com.ruoyi.ss.vip.service.VipService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.ss.vip.domain.Vip;
|
||||
import com.ruoyi.ss.vip.domain.VipQuery;
|
||||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
import com.ruoyi.ss.vip.service.VipAssembler;
|
||||
import com.ruoyi.ss.vip.service.VipService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员Controller
|
||||
|
@ -36,6 +32,9 @@ public class VipController extends BaseController
|
|||
@Autowired
|
||||
private VipService vipService;
|
||||
|
||||
@Autowired
|
||||
private VipAssembler vipAssembler;
|
||||
|
||||
/**
|
||||
* 查询会员列表
|
||||
*/
|
||||
|
@ -46,6 +45,7 @@ public class VipController extends BaseController
|
|||
startPage();
|
||||
startOrderBy();
|
||||
List<VipVO> list = vipService.selectVipList(query);
|
||||
vipAssembler.assembleStoreList(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,10 @@ public class VipController extends BaseController
|
|||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(vipService.selectVipById(id));
|
||||
VipVO vip = vipService.selectVipById(id);
|
||||
List<VipVO> list = Collections.singletonList(vip);
|
||||
vipAssembler.assembleStoreList(list);
|
||||
return success(vip);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,30 +1,24 @@
|
|||
package com.ruoyi.web.controller.ss;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevel;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelQuery;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelQuery;
|
||||
import com.ruoyi.ss.vipLevel.domain.VipLevelVO;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelAssembler;
|
||||
import com.ruoyi.ss.vipLevel.service.VipLevelService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员等级Controller
|
||||
|
@ -39,6 +33,9 @@ public class VipLevelController extends BaseController
|
|||
@Autowired
|
||||
private VipLevelService vipLevelService;
|
||||
|
||||
@Autowired
|
||||
private VipLevelAssembler vipLevelAssembler;
|
||||
|
||||
/**
|
||||
* 查询会员等级列表
|
||||
*/
|
||||
|
@ -49,6 +46,7 @@ public class VipLevelController extends BaseController
|
|||
startPage();
|
||||
startOrderBy();
|
||||
List<VipLevelVO> list = vipLevelService.selectVipLevelList(query);
|
||||
vipLevelAssembler.assembleStoreList(list);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -85,7 +83,11 @@ public class VipLevelController extends BaseController
|
|||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(vipLevelService.selectVipLevelById(id));
|
||||
VipLevelVO level = vipLevelService.selectVipLevelById(id);
|
||||
List<VipLevelVO> list = Collections.singletonList(level);
|
||||
vipLevelAssembler.assembleStoreList(list);
|
||||
vipLevelAssembler.assembleSkuList(list);
|
||||
return success(level);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,7 +96,7 @@ public class VipLevelController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('ss:vipLevel:add')")
|
||||
@Log(title = "会员等级", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) VipLevel vipLevel)
|
||||
public AjaxResult add(@RequestBody @Validated(ValidGroup.Create.class) VipLevelVO vipLevel)
|
||||
{
|
||||
return toAjax(vipLevelService.insertVipLevel(vipLevel));
|
||||
}
|
||||
|
@ -105,7 +107,7 @@ public class VipLevelController extends BaseController
|
|||
@PreAuthorize("@ss.hasPermi('ss:vipLevel:edit')")
|
||||
@Log(title = "会员等级", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) VipLevel vipLevel)
|
||||
public AjaxResult edit(@RequestBody @Validated(ValidGroup.Update.class) VipLevelVO vipLevel)
|
||||
{
|
||||
return toAjax(vipLevelService.updateVipLevel(vipLevel));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,101 @@
|
|||
package com.ruoyi.web.controller.ss;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSku;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuQuery;
|
||||
import com.ruoyi.ss.vipLevelSku.domain.VipLevelSkuVO;
|
||||
import com.ruoyi.ss.vipLevelSku.service.VipLevelSkuService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* VIP等级定价Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ss/vipLevelSku")
|
||||
public class VipLevelSkuController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private VipLevelSkuService vipLevelSkuService;
|
||||
|
||||
/**
|
||||
* 查询VIP等级定价列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipLevelSku:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(VipLevelSkuQuery query)
|
||||
{
|
||||
startPage();
|
||||
startOrderBy();
|
||||
List<VipLevelSkuVO> list = vipLevelSkuService.selectVipLevelSkuList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出VIP等级定价列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipLevelSku:export')")
|
||||
@Log(title = "VIP等级定价", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, VipLevelSkuQuery query)
|
||||
{
|
||||
List<VipLevelSkuVO> list = vipLevelSkuService.selectVipLevelSkuList(query);
|
||||
ExcelUtil<VipLevelSkuVO> util = new ExcelUtil<VipLevelSkuVO>(VipLevelSkuVO.class);
|
||||
util.exportExcel(response, list, "VIP等级定价数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取VIP等级定价详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipLevelSku:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(vipLevelSkuService.selectVipLevelSkuById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增VIP等级定价
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipLevelSku:add')")
|
||||
@Log(title = "VIP等级定价", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody VipLevelSku vipLevelSku)
|
||||
{
|
||||
return toAjax(vipLevelSkuService.insertVipLevelSku(vipLevelSku));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改VIP等级定价
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipLevelSku:edit')")
|
||||
@Log(title = "VIP等级定价", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody VipLevelSku vipLevelSku)
|
||||
{
|
||||
return toAjax(vipLevelSkuService.updateVipLevelSku(vipLevelSku));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除VIP等级定价
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipLevelSku:remove')")
|
||||
@Log(title = "VIP等级定价", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable List<Long> ids)
|
||||
{
|
||||
return toAjax(vipLevelSkuService.deleteVipLevelSkuByIds(ids));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,107 @@
|
|||
package com.ruoyi.web.controller.ss;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrder;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrderVO;
|
||||
import com.ruoyi.ss.vipOrder.domain.VipOrderQuery;
|
||||
import com.ruoyi.ss.vipOrder.service.VipOrderService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 会员订单Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-01-16
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ss/vipOrder")
|
||||
public class VipOrderController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private VipOrderService vipOrderService;
|
||||
|
||||
/**
|
||||
* 查询会员订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipOrder:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(VipOrderQuery query)
|
||||
{
|
||||
startPage();
|
||||
startOrderBy();
|
||||
List<VipOrderVO> list = vipOrderService.selectVipOrderList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出会员订单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipOrder:export')")
|
||||
@Log(title = "会员订单", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, VipOrderQuery query)
|
||||
{
|
||||
List<VipOrderVO> list = vipOrderService.selectVipOrderList(query);
|
||||
ExcelUtil<VipOrderVO> util = new ExcelUtil<VipOrderVO>(VipOrderVO.class);
|
||||
util.exportExcel(response, list, "会员订单数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员订单详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipOrder:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(vipOrderService.selectVipOrderById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增会员订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipOrder:add')")
|
||||
@Log(title = "会员订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody VipOrder vipOrder)
|
||||
{
|
||||
return toAjax(vipOrderService.insertVipOrder(vipOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改会员订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipOrder:edit')")
|
||||
@Log(title = "会员订单", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody VipOrder vipOrder)
|
||||
{
|
||||
return toAjax(vipOrderService.updateVipOrder(vipOrder));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除会员订单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:vipOrder:remove')")
|
||||
@Log(title = "会员订单", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(vipOrderService.deleteVipOrderByIds(ids));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user