店员价格

This commit is contained in:
admin
2024-08-20 23:20:34 +08:00
parent 82e8f33c3f
commit d85f300f1b
8 changed files with 86 additions and 29 deletions

View File

@@ -61,15 +61,6 @@ public interface IPlayClerkUserInfoService extends IService<PlayClerkUserInfoEnt
**/
PlayClerkLevelInfoEntity queryLevelCommission(String clerkId);
/**
* 根据账户ID查询店员
*
* @param id 店员ID
* @return 店员
*/
PlayClerkUserInfoEntity queryByUserId(String id);
/**
* 查询店员
*

View File

@@ -114,13 +114,6 @@ public class PlayClerkUserInfoServiceImpl extends ServiceImpl<PlayClerkUserInfoM
}
@Override
public PlayClerkUserInfoEntity queryByUserId(String id) {
LambdaQueryWrapper<PlayClerkUserInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PlayClerkUserInfoEntity::getId, id);
return this.baseMapper.selectOne(lambdaQueryWrapper);
}
@Override
public PlayClerkUserInfoEntity selectByOpenid(String openId) {
LambdaQueryWrapper<PlayClerkUserInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();

View File

@@ -148,9 +148,8 @@ public class PlayClerkUserReviewInfoServiceImpl extends ServiceImpl<PlayClerkUse
@Override
public void updateDataReviewState(PlayClerkUserReviewStateEditVo vo) {
PlayClerkUserReviewInfoEntity entity = this.selectPlayClerkUserReviewInfoById(vo.getId());
PlayClerkUserInfoEntity userInfo = playClerkUserInfoService.queryByUserId(entity.getClerkId());
PlayClerkUserInfoEntity userInfo = playClerkUserInfoService.selectById(entity.getClerkId());
if ("1".equals(vo.getReviewState())) {
BeanUtils.copyProperties(entity, userInfo);
userInfo.setClerkState("1");
userInfo.setId(entity.getClerkId());

View File

@@ -48,11 +48,6 @@ public class PlayCommodityInfoEntity extends BaseEntity<PlayCommodityInfoEntity>
*/
private String serviceDuration;
/**
* 服务单价
*/
private BigDecimal price;
/**
* 启用状态(0:停用,1:启用)
*/

View File

@@ -5,8 +5,10 @@ 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.github.yulichang.wrapper.MPJLambdaWrapper;
import com.starry.admin.common.exception.CustomException;
import com.starry.admin.modules.shop.mapper.PlayCommodityInfoMapper;
import com.starry.admin.modules.shop.module.entity.PlayCommodityAndLevelInfoEntity;
import com.starry.admin.modules.shop.module.entity.PlayCommodityInfoEntity;
import com.starry.admin.modules.shop.module.vo.PlayCommodityInfoVo;
import com.starry.admin.modules.shop.service.IPlayCommodityInfoService;
@@ -67,9 +69,13 @@ public class PlayCommodityInfoServiceImpl extends ServiceImpl<PlayCommodityInfoM
@Override
public List<PlayCommodityReturnVo> selectTree() {
LambdaQueryWrapper<PlayCommodityInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.orderByAsc(PlayCommodityInfoEntity::getSort);
List<PlayCommodityInfoEntity> list = this.baseMapper.selectList(lambdaQueryWrapper);
MPJLambdaWrapper<PlayCommodityInfoEntity> lambdaQueryWrapper = new MPJLambdaWrapper<>();
lambdaQueryWrapper.selectAll(PlayCommodityInfoEntity.class);
// lambdaQueryWrapper.selectAs(PlayCommodityAndLevelInfoEntity::getPrice, "price");
// lambdaQueryWrapper.leftJoin(PlayCommodityAndLevelInfoEntity.class, PlayCommodityAndLevelInfoEntity::getCommodityId, PlayCommodityInfoEntity::getId);
// lambdaQueryWrapper.notIn(PlayCommodityAndLevelInfoEntity::getPrice, "null");
// lambdaQueryWrapper.orderByAsc(PlayCommodityInfoEntity::getSort);
List<PlayCommodityInfoEntity> list = this.baseMapper.selectJoinList(PlayCommodityInfoEntity.class, lambdaQueryWrapper);
Map<String, List<PlayCommodityInfoEntity>> collect = list.stream().filter(a -> a != null && a.getId() != null).collect(Collectors.groupingBy(PlayCommodityInfoEntity::getPId));
return this.assembleTree(collect, collect.get("00"));
}

View File

@@ -1,15 +1,23 @@
package com.starry.admin.modules.weichat.controller;
import com.starry.admin.common.aspect.ClerkUserLogin;
import com.starry.admin.common.conf.ThreadLocalRequestDetail;
import com.starry.admin.common.exception.CustomException;
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
import com.starry.admin.modules.clerk.service.IPlayClerkUserInfoService;
import com.starry.admin.modules.shop.module.entity.PlayCommodityAndLevelInfoEntity;
import com.starry.admin.modules.shop.service.IPlayCommodityAndLevelInfoService;
import com.starry.admin.modules.shop.service.IPlayCommodityInfoService;
import com.starry.admin.modules.weichat.entity.PlayCommodityReturnVo;
import com.starry.common.result.R;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Iterator;
import java.util.List;
/**
@@ -26,6 +34,25 @@ public class WxClerkCommodityController {
@Resource
private IPlayCommodityInfoService playCommodityInfoService;
@Resource
private IPlayCommodityAndLevelInfoService iPlayCommodityAndLevelInfoService;
@Resource
private IPlayClerkUserInfoService clerkUserInfoService;
@GetMapping("/custom/queryClerkAllCommodityByLevel")
public R queryClerkAllCommodityByLevel(@RequestParam("id") String levelId) {
List<PlayCommodityAndLevelInfoEntity> levelInfoEntities = iPlayCommodityAndLevelInfoService.selectAll();
List<PlayCommodityReturnVo> tree = playCommodityInfoService.selectTree();
if (levelId == null || levelId.isEmpty()) {
return R.ok(tree);
}
tree = formatPlayCommodityReturnVoTree(tree, levelInfoEntities, levelId);
tree = formatPlayCommodityReturnVoTree(tree);
return R.ok(tree);
}
/**
* 顾客查询所有店员所有服务项目
@@ -33,23 +60,67 @@ public class WxClerkCommodityController {
* @return 店员所有服务项目
*/
@GetMapping("/custom/queryClerkAllCommodity")
public R customQueryClerkAllCommodity() {
public R customQueryClerkAllCommodity(@RequestParam("id") String clerkId) {
if (clerkId == null || clerkId.isEmpty()) {
throw new CustomException("请求参数异常,id不能为空");
}
PlayClerkUserInfoEntity clerkUserInfo = clerkUserInfoService.selectById(clerkId);
List<PlayCommodityAndLevelInfoEntity> levelInfoEntities = iPlayCommodityAndLevelInfoService.selectAll();
List<PlayCommodityReturnVo> tree = playCommodityInfoService.selectTree();
tree = formatPlayCommodityReturnVoTree(tree, levelInfoEntities, clerkUserInfo.getLevelId());
tree = formatPlayCommodityReturnVoTree(tree);
return R.ok(tree);
}
/**
* 顾客查询所有店员所有服务项目
* 店员查询自己的服务项目
*
* @return 店员所有服务项目
*/
@ClerkUserLogin
@GetMapping("/clerk/queryAllCommodity")
public R clerkQueryAllCommodity() {
String levelId = ThreadLocalRequestDetail.getClerkUserInfo().getLevelId();
List<PlayCommodityAndLevelInfoEntity> levelInfoEntities = iPlayCommodityAndLevelInfoService.selectAll();
List<PlayCommodityReturnVo> tree = playCommodityInfoService.selectTree();
tree = formatPlayCommodityReturnVoTree(tree, levelInfoEntities, levelId);
tree = formatPlayCommodityReturnVoTree(tree);
return R.ok(tree);
}
public List<PlayCommodityReturnVo> formatPlayCommodityReturnVoTree(List<PlayCommodityReturnVo> tree, List<PlayCommodityAndLevelInfoEntity> levelInfoEntities, String levelId) {
Iterator<PlayCommodityReturnVo> it = tree.iterator();
while (it.hasNext()) {
PlayCommodityReturnVo item = it.next();
//查找当前服务项目对应的价格
for (PlayCommodityAndLevelInfoEntity levelInfoEntity : levelInfoEntities) {
if (item.getId().equals(levelInfoEntity.getCommodityId()) && levelId.equals(levelInfoEntity.getLevelId())) {
item.setPrice(levelInfoEntity.getPrice());
}
}
//如果未设置价格,删除元素
if (!"00".equals(item.getPId()) && item.getPrice() == null) {
it.remove();
}
formatPlayCommodityReturnVoTree(item.getChild(), levelInfoEntities, levelId);
}
return tree;
}
public List<PlayCommodityReturnVo> formatPlayCommodityReturnVoTree(List<PlayCommodityReturnVo> tree) {
Iterator<PlayCommodityReturnVo> it = tree.iterator();
while (it.hasNext()) {
PlayCommodityReturnVo item = it.next();
if ("00".equals(item.getPId()) && item.getChild().isEmpty()) {
it.remove();
}
formatPlayCommodityReturnVoTree(item.getChild());
}
return tree;
}
}

View File

@@ -108,7 +108,7 @@ public class WxCouponController {
@PostMapping("/custom/queryByOrder")
public R queryByOrder(@Validated @RequestBody WxCouponOrderQueryVo vo) {
List<PlayCouponDetailsReturnVo> list = couponDetailsService.selectByCustomId(ThreadLocalRequestDetail.getCustomUserInfo().getId());
PlayClerkUserInfoEntity clerkUserInfo = playClerkUserInfoService.queryByUserId(vo.getClerkId());
PlayClerkUserInfoEntity clerkUserInfo = playClerkUserInfoService.selectById(vo.getClerkId());
PlayCommodityInfoVo commodityInfo = playCommodityInfoService.queryCommodityInfo(vo.getCommodityId(),clerkUserInfo.getLevelId());
// 优惠券列表
List<WxCouponOrderReturnVo> couponReturnVos = new ArrayList<>();

View File

@@ -15,6 +15,8 @@ import java.util.List;
public class PlayCommodityReturnVo {
private String id;
private String pId;
/**
* 项目类型
*/