店员价格
This commit is contained in:
@@ -61,15 +61,6 @@ public interface IPlayClerkUserInfoService extends IService<PlayClerkUserInfoEnt
|
||||
**/
|
||||
PlayClerkLevelInfoEntity queryLevelCommission(String clerkId);
|
||||
|
||||
/**
|
||||
* 根据账户ID查询店员
|
||||
*
|
||||
* @param id 店员ID
|
||||
* @return 店员
|
||||
*/
|
||||
PlayClerkUserInfoEntity queryByUserId(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 查询店员
|
||||
*
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -39,8 +39,6 @@ public class PlayClerkUserReviewInfoServiceImpl extends ServiceImpl<PlayClerkUse
|
||||
@Resource
|
||||
private IPlayClerkUserInfoService playClerkUserInfoService;
|
||||
@Resource
|
||||
private IPlayPersonnelGroupInfoService playClerkGroupInfoService;
|
||||
@Resource
|
||||
private IPlayClerkCommodityService clerkCommodityService;
|
||||
@Resource
|
||||
private WxCustomMpService wxCustomMpService;
|
||||
@@ -148,9 +146,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());
|
||||
|
||||
@@ -5,8 +5,6 @@ import com.starry.common.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 服务项目对象 play_commodity_info
|
||||
*
|
||||
@@ -48,11 +46,6 @@ public class PlayCommodityInfoEntity extends BaseEntity<PlayCommodityInfoEntity>
|
||||
*/
|
||||
private String serviceDuration;
|
||||
|
||||
/**
|
||||
* 服务单价
|
||||
*/
|
||||
private BigDecimal price;
|
||||
|
||||
/**
|
||||
* 启用状态(0:停用,1:启用)
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,7 @@ 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.PlayCommodityInfoEntity;
|
||||
@@ -67,9 +68,9 @@ 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);
|
||||
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"));
|
||||
}
|
||||
@@ -116,14 +117,6 @@ public class PlayCommodityInfoServiceImpl extends ServiceImpl<PlayCommodityInfoM
|
||||
return vo;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public PlayCommodityInfoVo queryCommodityInfo(String id) {
|
||||
// PlayCommodityInfoVo vo = this.baseMapper.queryCommodityInfo(id);
|
||||
// if (vo == null) {
|
||||
// throw new CustomException("服务项目不存在");
|
||||
// }
|
||||
// return vo;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 查询服务项目
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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<>();
|
||||
|
||||
@@ -15,6 +15,8 @@ import java.util.List;
|
||||
public class PlayCommodityReturnVo {
|
||||
|
||||
private String id;
|
||||
|
||||
private String pId;
|
||||
/**
|
||||
* 项目类型
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user