Commit ef425347 by 吕明尚

门店增加门店管理人员

parent cbb2cf93
...@@ -6,8 +6,9 @@ public enum PositionEnum { ...@@ -6,8 +6,9 @@ public enum PositionEnum {
CLEANER(1, "保洁人员"), CLEANER(1, "保洁人员"),
ADMIN(2, "管理员"), ADMIN(2, "管理员"),
//客服 //客服
CUSTOMER_SERVICE(3, "客服"); CUSTOMER_SERVICE(3, "客服"),
; //门店管理
MANAGE(4, "门店管理");
private Integer code; private Integer code;
private String name; private String name;
......
...@@ -81,6 +81,12 @@ public class SStoreController extends BaseController ...@@ -81,6 +81,12 @@ public class SStoreController extends BaseController
return success(sStoreService.storeList()); return success(sStoreService.storeList());
} }
//用户管理的门店
@GetMapping("/manageList")
@ApiOperation(value = "门店管理负责的门店")
public AjaxResult manageList() {
return success(sStoreService.manageList());
}
@PostMapping("/queryByStoreIds") @PostMapping("/queryByStoreIds")
public R<List<SStoreVo>> queryByStoreIds(@RequestBody SStoreDto dto) { public R<List<SStoreVo>> queryByStoreIds(@RequestBody SStoreDto dto) {
return R.ok(sStoreService.queryByStoreIds(dto)); return R.ok(sStoreService.queryByStoreIds(dto));
......
...@@ -20,6 +20,8 @@ public class SConsumerVo extends SConsumer { ...@@ -20,6 +20,8 @@ public class SConsumerVo extends SConsumer {
private Boolean isCleaner; private Boolean isCleaner;
private Boolean isManage;
private Boolean isAdmin; private Boolean isAdmin;
private Long consumerId; private Long consumerId;
......
...@@ -115,4 +115,6 @@ public interface ISStoreService extends IService<SStore> ...@@ -115,4 +115,6 @@ public interface ISStoreService extends IService<SStore>
List<SStore> storeNameByIds(List<Long> ids); List<SStore> storeNameByIds(List<Long> ids);
List<SStore> manageList();
} }
...@@ -246,6 +246,12 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer ...@@ -246,6 +246,12 @@ public class SConsumerServiceImpl extends ServiceImpl<SConsumerMapper, SConsumer
} else { } else {
vo.setIsAdmin(true); vo.setIsAdmin(true);
} }
List<Long> managerList = storeConsumerMapper.selectByConsumerId(currentUser.getId(), PositionEnum.MANAGE.getCode());
if (CollectionUtils.isEmpty(managerList)) {
vo.setIsManage(false);
} else {
vo.setIsManage(true);
}
if (ObjectUtil.isNull(currentUser)) { if (ObjectUtil.isNull(currentUser)) {
throw new BaseException("您的登录已过期,请先登录"); throw new BaseException("您的登录已过期,请先登录");
......
...@@ -2906,13 +2906,24 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2906,13 +2906,24 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override @Override
public OrderStatisticsResponse statistics(OrderStatisticsRequest request) { public OrderStatisticsResponse statistics(OrderStatisticsRequest request) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new RuntimeException("当前用户不是店员");
}
List<Long> longs = storeConsumerMapper.selectByConsumerId(user.getId(), PositionEnum.MANAGE.getCode());
if (CollectionUtils.isEmpty(longs)) {
throw new RuntimeException("当前用户不是门店管理人员");
}
//判断longs是否包含request.getStoreId()
if (!longs.contains(request.getStoreId())) {
throw new RuntimeException("当前用户不是该门店管理人员");
}
List<Recharge> rechargeList = rechargeService.list(new LambdaQueryWrapper<Recharge>() List<Recharge> rechargeList = rechargeService.list(new LambdaQueryWrapper<Recharge>()
.ge(Recharge::getCreateTime, request.getStartTime()) .ge(Recharge::getCreateTime, request.getStartTime())
.le(Recharge::getCreateTime, request.getEndTime()) .le(Recharge::getCreateTime, request.getEndTime())
.eq(Recharge::getStatus, YesNoEnum.yes.getIndex()) .eq(Recharge::getStatus, YesNoEnum.yes.getIndex())
); );
Map<Long, SCoupon> sCouponMap = sCouponService.list().stream().collect(Collectors.toMap(SCoupon::getId, Function.identity())); Map<Long, SCoupon> sCouponMap = sCouponService.list().stream().collect(Collectors.toMap(SCoupon::getId, Function.identity()));
//获取rechargeList中的所有rechargeAmount的和
BigDecimal rechargeAmount = rechargeList.stream().map(Recharge::getRechargeAmount).reduce(BigDecimal.ZERO, BigDecimal::add); BigDecimal rechargeAmount = rechargeList.stream().map(Recharge::getRechargeAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
OrderStatisticsResponse statisticsResponse = new OrderStatisticsResponse(); OrderStatisticsResponse statisticsResponse = new OrderStatisticsResponse();
Map<Long, SConsumerCoupon> map = new HashMap<>(); Map<Long, SConsumerCoupon> map = new HashMap<>();
...@@ -2945,7 +2956,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2945,7 +2956,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SCoupon sCoupon = sCouponMap.get(sConsumerCoupon.getCouponId()); SCoupon sCoupon = sCouponMap.get(sConsumerCoupon.getCouponId());
statisticsResponse.setMeituanRefundFee(statisticsResponse.getMeituanRefundFee().add(sCoupon.getCouponPayPrice())); statisticsResponse.setMeituanRefundFee(statisticsResponse.getMeituanRefundFee().add(sCoupon.getCouponPayPrice()));
} }
} else if (sConsumerCoupon.getPlatformType().equals(PlatformTypeEnum.TIKTOK.getCode())) { } else if (sConsumerCoupon.getPlatformType().equals(PlatformTypeEnum.TIKTOK.getCode())) {
if (ObjectUtil.isNotEmpty(sConsumerCoupon.getCouponPayPrice())) { if (ObjectUtil.isNotEmpty(sConsumerCoupon.getCouponPayPrice())) {
statisticsResponse.setDouyinRefundFee(statisticsResponse.getDouyinRefundFee().add(sConsumerCoupon.getCouponPayPrice())); statisticsResponse.setDouyinRefundFee(statisticsResponse.getDouyinRefundFee().add(sConsumerCoupon.getCouponPayPrice()));
...@@ -2953,7 +2963,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2953,7 +2963,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SCoupon sCoupon = sCouponMap.get(sConsumerCoupon.getCouponId()); SCoupon sCoupon = sCouponMap.get(sConsumerCoupon.getCouponId());
statisticsResponse.setDouyinRefundFee(statisticsResponse.getDouyinRefundFee().add(sCoupon.getCouponPayPrice())); statisticsResponse.setDouyinRefundFee(statisticsResponse.getDouyinRefundFee().add(sCoupon.getCouponPayPrice()));
} }
// statisticsResponse.setDouyinRefundFee(statisticsResponse.getDouyinRefundFee().add(sConsumerCoupon.getCouponPayPrice()));
} }
} }
} }
...@@ -2973,11 +2982,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2973,11 +2982,7 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
} else { } else {
SCoupon sCoupon = sCouponMap.get(sConsumerCoupon.getCouponId()); SCoupon sCoupon = sCouponMap.get(sConsumerCoupon.getCouponId());
statisticsResponse.setMeituanFee(statisticsResponse.getMeituanFee().add(sCoupon.getCouponPayPrice())); statisticsResponse.setMeituanFee(statisticsResponse.getMeituanFee().add(sCoupon.getCouponPayPrice()));
// statisticsResponse.setMeituanRefundFee(statisticsResponse.getMeituanRefundFee().add(sCoupon.getCouponPayPrice()));
} }
// statisticsResponse.setMeituanFee(statisticsResponse.getMeituanFee().add(sConsumerCoupon.getCouponPayPrice()));
} else if (sConsumerCoupon.getPlatformType().equals(PlatformTypeEnum.TIKTOK.getCode())) { } else if (sConsumerCoupon.getPlatformType().equals(PlatformTypeEnum.TIKTOK.getCode())) {
if (ObjectUtil.isNotEmpty(sConsumerCoupon.getCouponPayPrice())) { if (ObjectUtil.isNotEmpty(sConsumerCoupon.getCouponPayPrice())) {
statisticsResponse.setDouyinFee(statisticsResponse.getDouyinFee().add(sConsumerCoupon.getCouponPayPrice())); statisticsResponse.setDouyinFee(statisticsResponse.getDouyinFee().add(sConsumerCoupon.getCouponPayPrice()));
...@@ -2985,7 +2990,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -2985,7 +2990,6 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
SCoupon sCoupon = sCouponMap.get(sConsumerCoupon.getCouponId()); SCoupon sCoupon = sCouponMap.get(sConsumerCoupon.getCouponId());
statisticsResponse.setDouyinFee(statisticsResponse.getDouyinFee().add(sCoupon.getCouponPayPrice())); statisticsResponse.setDouyinFee(statisticsResponse.getDouyinFee().add(sCoupon.getCouponPayPrice()));
} }
// statisticsResponse.setDouyinFee(statisticsResponse.getDouyinFee().add(sConsumerCoupon.getCouponPayPrice()));
} }
} }
} }
......
...@@ -376,6 +376,19 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme ...@@ -376,6 +376,19 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
return this.list(queryWrapper); return this.list(queryWrapper);
} }
@Override
public List<SStore> manageList() {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new BaseException("当前用户不是店员!");
}
List<Long> storeIdList = storeConsumerMapper.selectByConsumerId(user.getId(), PositionEnum.MANAGE.getCode());
if (CollectionUtils.isEmpty(storeIdList)) {
throw new RuntimeException("当前用户不是门店管理人员");
}
return baseMapper.selectList(new LambdaQueryWrapper<SStore>().in(SStore::getId, storeIdList));
}
/** /**
* 门店DO集合转换VO集合,按距离排序 * 门店DO集合转换VO集合,按距离排序
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment