新增顾客礼物图鉴接口

This commit is contained in:
admin
2024-06-05 18:25:29 +08:00
parent 883faf813f
commit 6d50bc1f0d
14 changed files with 504 additions and 6 deletions

View File

@@ -0,0 +1,77 @@
package com.starry.admin.modules.custom.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.starry.admin.modules.custom.module.entity.PlayCustomGiftInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomGiftInfoService;
import com.starry.common.annotation.Log;
import com.starry.common.enums.BusinessType;
import com.starry.common.result.R;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* 顾客和礼物关系Controller
*
* @author admin
* @since 2024-06-05
*/
@RestController
@RequestMapping("/custom/giff")
public class PlayCustomGiftInfoController {
@Resource
private IPlayCustomGiftInfoService playCustomGiftInfoService;
/**
* 查询顾客和礼物关系列表
*/
@GetMapping("/list")
public R list(PlayCustomGiftInfoEntity playCustomGiftInfo) {
IPage<PlayCustomGiftInfoEntity> list = playCustomGiftInfoService.selectPlayCustomGiftInfoByPage(playCustomGiftInfo);
return R.ok(list);
}
/**
* 获取顾客和礼物关系详细信息
*/
@GetMapping(value = "/{id}")
public R getInfo(@PathVariable("id") String id) {
return R.ok(playCustomGiftInfoService.selectPlayCustomGiftInfoById(id));
}
/**
* 新增顾客和礼物关系
*/
@Log(title = "顾客和礼物关系", businessType = BusinessType.INSERT)
@PostMapping("/create")
public R create(@RequestBody PlayCustomGiftInfoEntity playCustomGiftInfo) {
boolean success = playCustomGiftInfoService.create(playCustomGiftInfo);
if (success) {
return R.ok();
}
return R.error("添加失败");
}
/**
* 修改顾客和礼物关系
*/
@Log(title = "顾客和礼物关系", businessType = BusinessType.UPDATE)
@PostMapping(value = "/update/{id}")
public R update(@PathVariable String id, @RequestBody PlayCustomGiftInfoEntity playCustomGiftInfo) {
playCustomGiftInfo.setId(id);
boolean success = playCustomGiftInfoService.update(playCustomGiftInfo);
if (success) {
return R.ok();
}
return R.error("修改失败");
}
/**
* 删除顾客和礼物关系
*/
@Log(title = "顾客和礼物关系", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public R remove(@PathVariable String[] ids) {
return R.ok(playCustomGiftInfoService.deletePlayCustomGiftInfoByIds(ids));
}
}

View File

@@ -0,0 +1,16 @@
package com.starry.admin.modules.custom.mapper;
import com.github.yulichang.base.MPJBaseMapper;
import com.starry.admin.modules.custom.module.entity.PlayCustomGiftInfoEntity;
/**
* 顾客和礼物关系Mapper接口
*
* @author admin
* @since 2024-06-05
*/
public interface PlayCustomGiftInfoMapper extends MPJBaseMapper<PlayCustomGiftInfoEntity> {
}

View File

@@ -0,0 +1,45 @@
package com.starry.admin.modules.custom.module.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.starry.common.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 顾客和礼物关系对象 play_custom_gift_info
*
* @author admin
* @since 2024-06-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("play_custom_gift_info")
public class PlayCustomGiftInfoEntity extends BaseEntity<PlayCustomGiftInfoEntity> {
/**
* UUID
*/
private String id;
/**
* 租户ID
*/
private String tenantId;
/**
* 顾客ID
*/
private String customId;
/**
* 礼物ID
*/
private String giffId;
/**
* 礼物数量
*/
private Long giffNumber;
}

View File

@@ -0,0 +1,74 @@
package com.starry.admin.modules.custom.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.starry.admin.modules.custom.module.entity.PlayCustomGiftInfoEntity;
import java.util.List;
/**
* 顾客和礼物关系Service接口
*
* @author admin
* @since 2024-06-05
*/
public interface IPlayCustomGiftInfoService extends IService<PlayCustomGiftInfoEntity> {
/**
* 查询顾客已点亮礼物
*
* @param customId 顾客IF
* @return 顾客已点亮礼物列表
*/
List<PlayCustomGiftInfoEntity> selectBtyCustomId(String customId);
/**
* 查询顾客和礼物关系
*
* @param id 顾客和礼物关系主键
* @return 顾客和礼物关系
*/
PlayCustomGiftInfoEntity selectPlayCustomGiftInfoById(String id);
/**
* 查询顾客和礼物关系列表
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 顾客和礼物关系集合
*/
IPage<PlayCustomGiftInfoEntity> selectPlayCustomGiftInfoByPage(PlayCustomGiftInfoEntity playCustomGiftInfo);
/**
* 新增顾客和礼物关系
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 结果
*/
boolean create(PlayCustomGiftInfoEntity playCustomGiftInfo);
/**
* 修改顾客和礼物关系
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 结果
*/
boolean update(PlayCustomGiftInfoEntity playCustomGiftInfo);
/**
* 批量删除顾客和礼物关系
*
* @param ids 需要删除的顾客和礼物关系主键集合
* @return 结果
*/
int deletePlayCustomGiftInfoByIds(String[] ids);
/**
* 删除顾客和礼物关系信息
*
* @param id 顾客和礼物关系主键
* @return 结果
*/
int deletePlayCustomGiftInfoById(String id);
}

View File

@@ -0,0 +1,113 @@
package com.starry.admin.modules.custom.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.starry.admin.modules.custom.mapper.PlayCustomGiftInfoMapper;
import com.starry.admin.modules.custom.module.entity.PlayCustomGiftInfoEntity;
import com.starry.admin.modules.custom.service.IPlayCustomGiftInfoService;
import com.starry.common.utils.IdUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
/**
* 顾客和礼物关系Service业务层处理
*
* @author admin
* @since 2024-06-05
*/
@Service
public class PlayCustomGiftInfoServiceImpl extends ServiceImpl<PlayCustomGiftInfoMapper, PlayCustomGiftInfoEntity> implements IPlayCustomGiftInfoService {
@Resource
private PlayCustomGiftInfoMapper playCustomGiftInfoMapper;
/**
* 根据店员ID查询店员活动礼物列表
*
* @param customId 店员ID
* @return 店员活动礼物列表
*/
@Override
public List<PlayCustomGiftInfoEntity> selectBtyCustomId(String customId) {
LambdaQueryWrapper<PlayCustomGiftInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PlayCustomGiftInfoEntity::getCustomId, customId);
return this.baseMapper.selectList(lambdaQueryWrapper);
}
/**
* 查询顾客和礼物关系
*
* @param id 顾客和礼物关系主键
* @return 顾客和礼物关系
*/
@Override
public PlayCustomGiftInfoEntity selectPlayCustomGiftInfoById(String id) {
return this.baseMapper.selectById(id);
}
/**
* 查询顾客和礼物关系列表
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 顾客和礼物关系
*/
@Override
public IPage<PlayCustomGiftInfoEntity> selectPlayCustomGiftInfoByPage(PlayCustomGiftInfoEntity playCustomGiftInfo) {
Page<PlayCustomGiftInfoEntity> page = new Page<>(1, 10);
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayCustomGiftInfoEntity>());
}
/**
* 新增顾客和礼物关系
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 结果
*/
@Override
public boolean create(PlayCustomGiftInfoEntity playCustomGiftInfo) {
if (StrUtil.isBlankIfStr(playCustomGiftInfo.getId())) {
playCustomGiftInfo.setId(IdUtils.getUuid());
}
return save(playCustomGiftInfo);
}
/**
* 修改顾客和礼物关系
*
* @param playCustomGiftInfo 顾客和礼物关系
* @return 结果
*/
@Override
public boolean update(PlayCustomGiftInfoEntity playCustomGiftInfo) {
return updateById(playCustomGiftInfo);
}
/**
* 批量删除顾客和礼物关系
*
* @param ids 需要删除的顾客和礼物关系主键
* @return 结果
*/
@Override
public int deletePlayCustomGiftInfoByIds(String[] ids) {
return playCustomGiftInfoMapper.deleteBatchIds(Arrays.asList(ids));
}
/**
* 删除顾客和礼物关系信息
*
* @param id 顾客和礼物关系主键
* @return 结果
*/
@Override
public int deletePlayCustomGiftInfoById(String id) {
return playCustomGiftInfoMapper.deleteById(id);
}
}

View File

@@ -32,6 +32,12 @@ public class PlayGiftInfoEntity extends BaseEntity<PlayGiftInfoEntity> {
*/ */
private String tenantId; private String tenantId;
/**
* 是否是历史礼物(0:不是,1:是)
*/
private String history;
/** /**
* 礼物名称 * 礼物名称
*/ */

View File

@@ -44,6 +44,18 @@ public interface IPlayGiftInfoService extends IService<PlayGiftInfoEntity> {
**/ **/
List<PlayClerkGiftReturnVo> clerkListByAll(String clerkId, String obtained); List<PlayClerkGiftReturnVo> clerkListByAll(String clerkId, String obtained);
/**
* 店员查询所有礼物
*
* @param customId 顾客ID
* @param obtained 礼物状态,[0:未获得,1:已获得]
* @param history 是否是历史礼物(0:不是,1:是)
* @return List<com.starry.admin.modules.gift.module.entity.PlayGiftInfoEntity>
* @author admin
* @since 2024/4/25 15:56
**/
List<PlayClerkGiftReturnVo> customListByAll(String customId,String obtained,String history);
/** /**
* 查询礼物列表 * 查询礼物列表
* *

View File

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper; import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.starry.admin.common.exception.CustomException; import com.starry.admin.common.exception.CustomException;
import com.starry.admin.modules.custom.module.entity.PlayCustomGiftInfoEntity;
import com.starry.admin.modules.custom.service.impl.PlayCustomGiftInfoServiceImpl;
import com.starry.admin.modules.gift.mapper.PlayGiftInfoMapper; import com.starry.admin.modules.gift.mapper.PlayGiftInfoMapper;
import com.starry.admin.modules.gift.module.entity.PlayClerkGiftInfoEntity; import com.starry.admin.modules.gift.module.entity.PlayClerkGiftInfoEntity;
import com.starry.admin.modules.gift.module.entity.PlayGiftInfoEntity; import com.starry.admin.modules.gift.module.entity.PlayGiftInfoEntity;
@@ -35,6 +37,9 @@ public class PlayGiftInfoServiceImpl extends ServiceImpl<PlayGiftInfoMapper, Pla
@Resource @Resource
private PlayClerkGiftInfoServiceImpl clerkGiftInfoService; private PlayClerkGiftInfoServiceImpl clerkGiftInfoService;
@Resource
private PlayCustomGiftInfoServiceImpl customGiftInfoService;
/** /**
* 查询礼物 * 查询礼物
* *
@@ -51,6 +56,42 @@ public class PlayGiftInfoServiceImpl extends ServiceImpl<PlayGiftInfoMapper, Pla
} }
@Override
public List<PlayClerkGiftReturnVo> customListByAll(String customId, String obtained, String history) {
if ("0".equals(obtained)) {
//查询所有礼物,然后减去已获得礼物
MPJLambdaWrapper<PlayGiftInfoEntity> lambdaWrapper = new MPJLambdaWrapper<>();
lambdaWrapper.selectAll(PlayGiftInfoEntity.class);
lambdaWrapper.eq(PlayGiftInfoEntity::getHistory, history);
List<PlayClerkGiftReturnVo> list = this.baseMapper.selectJoinList(PlayClerkGiftReturnVo.class, lambdaWrapper);
List<PlayCustomGiftInfoEntity> giftInfoEntities = customGiftInfoService.selectBtyCustomId(customId);
// 使用迭代器安全地移除元素
Iterator<PlayClerkGiftReturnVo> iterator = list.iterator();
while (iterator.hasNext()) {
PlayClerkGiftReturnVo item = iterator.next();
for (PlayCustomGiftInfoEntity giftInfoEntity : giftInfoEntities) {
if (giftInfoEntity.getGiffId().equals(item.getId())) {
iterator.remove();
break;
}
}
}
return list;
}
if ("1".equals(obtained)) {
MPJLambdaWrapper<PlayGiftInfoEntity> lambdaWrapper = new MPJLambdaWrapper<>();
lambdaWrapper.selectAll(PlayGiftInfoEntity.class);
// 礼物活动表
lambdaWrapper.selectAs(PlayCustomGiftInfoEntity::getGiffNumber, "giffNumber");
lambdaWrapper.innerJoin(PlayCustomGiftInfoEntity.class, PlayCustomGiftInfoEntity::getGiffId, PlayGiftInfoEntity::getId);
lambdaWrapper.eq(PlayCustomGiftInfoEntity::getCustomId, customId);
return this.baseMapper.selectJoinList(PlayClerkGiftReturnVo.class, lambdaWrapper);
}
return new ArrayList<>();
}
@Override @Override
public List<PlayClerkGiftReturnVo> clerkListByAll(String clerkId, String obtained) { public List<PlayClerkGiftReturnVo> clerkListByAll(String clerkId, String obtained) {
if ("0".equals(obtained)) { if ("0".equals(obtained)) {
@@ -80,7 +121,6 @@ public class PlayGiftInfoServiceImpl extends ServiceImpl<PlayGiftInfoMapper, Pla
lambdaWrapper.selectAs(PlayClerkGiftInfoEntity::getGiffNumber, "giffNumber"); lambdaWrapper.selectAs(PlayClerkGiftInfoEntity::getGiffNumber, "giffNumber");
lambdaWrapper.innerJoin(PlayClerkGiftInfoEntity.class, PlayClerkGiftInfoEntity::getGiffId, PlayGiftInfoEntity::getId); lambdaWrapper.innerJoin(PlayClerkGiftInfoEntity.class, PlayClerkGiftInfoEntity::getGiffId, PlayGiftInfoEntity::getId);
lambdaWrapper.eq(PlayClerkGiftInfoEntity::getClerkId, clerkId); lambdaWrapper.eq(PlayClerkGiftInfoEntity::getClerkId, clerkId);
lambdaWrapper.eq(PlayClerkGiftInfoEntity::getClerkId, clerkId);
return this.baseMapper.selectJoinList(PlayClerkGiftReturnVo.class, lambdaWrapper); return this.baseMapper.selectJoinList(PlayClerkGiftReturnVo.class, lambdaWrapper);
} }
return new ArrayList<>(); return new ArrayList<>();
@@ -100,7 +140,7 @@ public class PlayGiftInfoServiceImpl extends ServiceImpl<PlayGiftInfoMapper, Pla
@Override @Override
public IPage<PlayGiftInfoEntity> selectPlayGiftInfoByPage(PlayGiftInfoEntity playGiftInfo) { public IPage<PlayGiftInfoEntity> selectPlayGiftInfoByPage(PlayGiftInfoEntity playGiftInfo) {
Page<PlayGiftInfoEntity> page = new Page<>(1, 10); Page<PlayGiftInfoEntity> page = new Page<>(1, 10);
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayGiftInfoEntity>()); return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
} }
/** /**

View File

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.starry.admin.modules.shop.module.entity.PlayShopCarouselInfoEntity; import com.starry.admin.modules.shop.module.entity.PlayShopCarouselInfoEntity;
import com.starry.admin.modules.shop.module.vo.PlayShopCarouselInfoQueryVo; import com.starry.admin.modules.shop.module.vo.PlayShopCarouselInfoQueryVo;
import java.util.List;
/** /**
* 店铺首页轮播Service接口 * 店铺首页轮播Service接口
* *
@@ -29,6 +31,14 @@ public interface IPlayShopCarouselInfoService extends IService<PlayShopCarouselI
*/ */
IPage<PlayShopCarouselInfoEntity> selectByPage(PlayShopCarouselInfoQueryVo vo); IPage<PlayShopCarouselInfoEntity> selectByPage(PlayShopCarouselInfoQueryVo vo);
/**
* 查询店铺首页轮播列表
*
* @return 店铺首页轮播集合
*/
List<PlayShopCarouselInfoEntity> selectHomeCarouselInfo();
/** /**
* 新增店铺首页轮播 * 新增店铺首页轮播
* *

View File

@@ -14,6 +14,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
/** /**
* 店铺首页轮播Service业务层处理 * 店铺首页轮播Service业务层处理
@@ -38,6 +39,14 @@ public class PlayShopCarouselInfoServiceImpl extends ServiceImpl<PlayShopCarouse
} }
@Override
public List<PlayShopCarouselInfoEntity> selectHomeCarouselInfo() {
LambdaQueryWrapper<PlayShopCarouselInfoEntity> lambdaWrapper = new LambdaQueryWrapper<>();
lambdaWrapper.eq(PlayShopCarouselInfoEntity::getCarouselIndex, "0");
lambdaWrapper.eq(PlayShopCarouselInfoEntity::getEnableState, "1");
return this.baseMapper.selectList(lambdaWrapper);
}
@Override @Override
public IPage<PlayShopCarouselInfoEntity> selectByPage(PlayShopCarouselInfoQueryVo vo) { public IPage<PlayShopCarouselInfoEntity> selectByPage(PlayShopCarouselInfoQueryVo vo) {
LambdaQueryWrapper<PlayShopCarouselInfoEntity> lambdaWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PlayShopCarouselInfoEntity> lambdaWrapper = new LambdaQueryWrapper<>();

View File

@@ -3,18 +3,18 @@ package com.starry.admin.modules.weichat.controller;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.starry.admin.common.aspect.ClerkUserLogin; import com.starry.admin.common.aspect.ClerkUserLogin;
import com.starry.admin.common.aspect.CustomUserLogin;
import com.starry.admin.common.conf.ThreadLocalRequestDetail; import com.starry.admin.common.conf.ThreadLocalRequestDetail;
import com.starry.admin.common.exception.CustomException; import com.starry.admin.common.exception.CustomException;
import com.starry.admin.modules.gift.service.IPlayGiftInfoService; import com.starry.admin.modules.gift.service.IPlayGiftInfoService;
import com.starry.admin.modules.weichat.entity.PlayGiftInfoDto; import com.starry.admin.modules.weichat.entity.PlayGiftInfoDto;
import com.starry.admin.modules.weichat.entity.gift.PlayClerkGiftReturnVo; import com.starry.admin.modules.weichat.entity.gift.PlayClerkGiftReturnVo;
import com.starry.admin.modules.weichat.entity.gift.PlayCustomGiftQueryVo;
import com.starry.common.result.R; import com.starry.common.result.R;
import com.starry.common.utils.ConvertUtil; import com.starry.common.utils.ConvertUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@@ -60,4 +60,18 @@ public class WxGiftController {
} }
/**
* 顾客获取礼物图鉴信息
*
* @param vo 顾客获得礼物查询对象
* @return 礼物列表
*/
@CustomUserLogin
@PostMapping("/custom/listByAll")
public R customListByAll(@Validated @RequestBody PlayCustomGiftQueryVo vo) {
List<PlayClerkGiftReturnVo> list = giftInfoService.customListByAll(ThreadLocalRequestDetail.getCustomUserInfo().getId(), vo.getObtained(), vo.getHistory());
return R.ok(list);
}
} }

View File

@@ -0,0 +1,39 @@
package com.starry.admin.modules.weichat.controller;
import com.starry.admin.modules.shop.module.entity.PlayShopCarouselInfoEntity;
import com.starry.admin.modules.shop.service.IPlayShopCarouselInfoService;
import com.starry.admin.modules.weichat.entity.shop.ShopHomeCarouseInfoReturnVo;
import com.starry.common.result.R;
import com.starry.common.utils.ConvertUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* 动态接口
*
* @author admin
* @since 2024/5/20 下午11:19
**/
@Slf4j
@RestController
@RequestMapping("/wx/shop")
public class WxShopController {
@Resource
private IPlayShopCarouselInfoService playShopCarouselInfoService;
@GetMapping(value = "custom/getShopHomeCarouseInfo")
public R getShopHomeCarouseInfo() {
List<PlayShopCarouselInfoEntity> entities = playShopCarouselInfoService.selectHomeCarouselInfo();
return R.ok(ConvertUtil.entityToVoList(entities, ShopHomeCarouseInfoReturnVo.class));
}
}

View File

@@ -0,0 +1,27 @@
package com.starry.admin.modules.weichat.entity.gift;
import lombok.Data;
/**
* 店员礼物查询对象
*
* @author admin
* @since 2024/5/26 上午12:20
**/
@Data
public class PlayCustomGiftQueryVo {
/**
* 是否已获得礼物0:已获取1:所有礼物)
*/
private String obtained;
/**
* 是否是历史礼物(0:不是,1:是)
*/
private String history;
}

View File

@@ -0,0 +1,16 @@
package com.starry.admin.modules.weichat.entity.shop;
import lombok.Data;
/**
* @author admin
* @since 2024/6/5 下午4:40
**/
@Data
public class ShopHomeCarouseInfoReturnVo {
/**
* 图片URL
*/
private String carouselUrl;
}