From 307c8e5628e4c822db4d2a465cc65ede0b54cfc4 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 14 一月 2025 15:18:46 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/qijisheng --- ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java | 1 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java | 17 ++- ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/uuid/QRCodeGenerator.java | 44 +++++++++++ ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml | 5 ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java | 3 ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUserShop.java | 5 + ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java | 2 ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml | 2 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java | 20 ++++ ruoyi-common/pom.xml | 11 ++ ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java | 8 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java | 3 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java | 4 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java | 13 ++- ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java | 1 ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java | 3 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java | 15 +++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java | 5 + ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java | 25 ++++++ ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/WithQuery.java | 2 ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml | 3 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml | 4 ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml | 3 ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml | 2 24 files changed, 171 insertions(+), 30 deletions(-) diff --git a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUserShop.java b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUserShop.java index c43a629..4085997 100644 --- a/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUserShop.java +++ b/ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/model/AppUserShop.java @@ -28,4 +28,9 @@ */ @TableField("shop_id") private Integer shopId; + /** + * 角色(1=店长,2=店员,3=技师) + */ + @TableField("role_type") + private Integer roleType; } diff --git a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java index 833aa57..ad189f8 100644 --- a/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java +++ b/ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/vo/OrderDetailVO.java @@ -89,4 +89,7 @@ @ApiModelProperty(value = "预约单id") private String technicianSubscribeId; + @ApiModelProperty("核销码BASE64") + private String writeOffCode; + } diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index a6129f8..9d86df3 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -31,6 +31,17 @@ <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </dependency> + + <dependency> + <groupId>com.google.zxing</groupId> + <artifactId>core</artifactId> + <version>3.4.1</version> + </dependency> + <dependency> + <groupId>com.google.zxing</groupId> + <artifactId>javase</artifactId> + <version>3.4.1</version> + </dependency> </dependencies> </project> diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/uuid/QRCodeGenerator.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/uuid/QRCodeGenerator.java new file mode 100644 index 0000000..93bc31e --- /dev/null +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/uuid/QRCodeGenerator.java @@ -0,0 +1,44 @@ +package com.ruoyi.common.core.utils.uuid; + +import com.google.zxing.BarcodeFormat; +import com.google.zxing.WriterException; +import com.google.zxing.client.j2se.MatrixToImageWriter; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.QRCodeWriter; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Base64; + +public class QRCodeGenerator { + + /** + * 生成二维码图片的base64编码 + * @param text + * @param width + * @param height + * @return + * @throws WriterException + * @throws IOException + */ + public static String generateQRCodeBase64(String text, int width, int height) throws WriterException, IOException { + QRCodeWriter qrCodeWriter = new QRCodeWriter(); + BitMatrix bitMatrix = qrCodeWriter.encode(text, BarcodeFormat.QR_CODE, width, height); + + ByteArrayOutputStream pngOutputStream = new ByteArrayOutputStream(); + MatrixToImageWriter.writeToStream(bitMatrix, "PNG", pngOutputStream); + byte[] pngData = pngOutputStream.toByteArray(); + + return Base64.getEncoder().encodeToString(pngData); + } + + public static void main(String[] args) { + try { + String text = "Hello, World!"; + String base64QRCode = generateQRCodeBase64(text, 200, 200); + System.out.println("Base64 QR Code: " + base64QRCode); + } catch (WriterException | IOException e) { + e.printStackTrace(); + } + } +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java index 2f17c3a..e28674b 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java @@ -164,6 +164,7 @@ AppUserShop appUserShop = new AppUserShop(); appUserShop.setAppUserId(appUser.getId()); appUserShop.setShopId(sysUser1.getObjectId()); + appUserShop.setRoleType(2); appUserShopClient.saveAppUserShop(appUserShop); appUser.setUserType(2); appUserClient.editAppUserById(appUser); diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml index 9f57d1e..d1cd882 100644 --- a/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapping/system/SysUserMapper.xml @@ -207,6 +207,7 @@ <if test="roleType != null and roleType != ''">role_type,</if> <if test="remark != null and remark != ''">remark,</if> <if test="objectId != null and objectId != ''">objectId,</if> + <if test="appUserId != null and appUserId != ''">app_user_id,</if> create_time )values( <if test="userId != null and userId != ''">#{userId},</if> @@ -223,6 +224,7 @@ <if test="roleType != null and roleType != ''">#{roleType},</if> <if test="remark != null and remark != ''">#{remark},</if> <if test="objectId != null and objectId != ''">#{objectId},</if> + <if test="appUserId != null and appUserId != ''">#{appUserId},</if> sysdate() ) </insert> diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java index 1c89f22..806b875 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java @@ -137,6 +137,8 @@ @PostMapping("/editAppUserById") public R<Void> editAppUserById(@RequestBody AppUser appUser) { appUserService.updateById(appUser); + appUserService.update(new LambdaUpdateWrapper<AppUser>().eq(AppUser::getId, appUser.getId()) + .set(AppUser::getLastShopTime, appUser.getLastShopTime())); return R.ok(); } @@ -896,7 +898,8 @@ .limit(daysBetween + 1) .collect(Collectors.toList()); } - + + /** * 上传图片 diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java index ecc3f7e..d90e2db 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java @@ -59,6 +59,9 @@ if(null != appUserShop.getShopId()){ wrapper.eq(AppUserShop::getShopId, appUserShop.getShopId()); } + if(null != appUserShop.getRoleType()){ + wrapper.eq(AppUserShop::getRoleType, appUserShop.getRoleType()); + } appUserShopService.remove(wrapper); return R.ok(); } diff --git a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/WithQuery.java b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/WithQuery.java index 60acc1f..da3c1f7 100644 --- a/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/WithQuery.java +++ b/ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/dto/WithQuery.java @@ -11,7 +11,7 @@ private String userName; @ApiModelProperty("电话") - private String phone; + private String userPhone; private Integer pageNum; private Integer pageSize; diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml index 7eaf99d..48543ce 100644 --- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml @@ -43,7 +43,7 @@ longitude, latitude, phone - from t_app_user where city_code = #{cityCode} and del_flag = 0 and status = 1 and vip_id >= 4 + from t_app_user where ((city_code = #{cityCode} and vip_id >= 4) or id = 1) and del_flag = 0 and status = 1 <if test="null != nearbyReferrer.name and '' != nearbyReferrer.name"> and `name` like CONCAT('%', #{nearbyReferrer.name}, '%') </if> @@ -86,7 +86,7 @@ SELECT ta.id, ta.phone, ta.`name`, ta.vip_id, ta.shop_id, ta.status FROM t_app_user ta <where> - ta.del_flag = 0 + ta.del_flag = 0 and ta.status != 3 <if test="null != appUser.name and '' != appUser.name"> and ta.`name` like CONCAT('%',#{appUser.name},'%') </if> diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml index f1db46f..34cf6d5 100644 --- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/BalanceChangeRecordMapper.xml @@ -34,8 +34,9 @@ tbcr.after_amount FROM t_balance_change_record tbcr - LEFT JOIN t_app_user tau ON tbcr.app_user_id = tau.id + LEFT JOIN t_app_user tau ON tbcr.app_user_id = tau.id <where> + and tbcr.change_type = 4 <if test="changeRecord.userName != null and changeRecord.userName != ''"> and tau.name like concat('%',#{changeRecord.userName},'%') </if> diff --git a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml index 6991416..a33a8cd 100644 --- a/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml +++ b/ruoyi-service/ruoyi-account/src/main/resources/mapper/account/WithdrawalRequestsMapper.xml @@ -23,8 +23,9 @@ select t1.*,t2.name as userName,t2.phone as userPhone from t_withdrawal_requests t1 left join t_app_user t2 on t1.app_user_id = t2.id - <if test="withQuery.phone != null and withQuery.phone != ''"> - AND t2.phone LIKE concat('%',#{withQuery.phone},'%') + where 1 = 1 + <if test="withQuery.userPhone != null and withQuery.userPhone != ''"> + AND t2.phone LIKE concat('%',#{withQuery.userPhone},'%') </if> <if test="withQuery.userName != null and withQuery.userName != ''"> AND t2.name LIKE concat('%',#{withQuery.userName},'%') diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java index 6e38450..4ac605c 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java @@ -14,6 +14,7 @@ import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.exception.ServiceException; import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.core.utils.uuid.QRCodeGenerator; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.enums.OrderStatus; @@ -41,6 +42,7 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.io.IOException; import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDateTime; @@ -215,6 +217,14 @@ Long id = data.get(0).getId(); orderDetailVO.setTechnicianSubscribeId(id.toString()); } + } + // 生成核销码BASE64 + try { + String base64 = QRCodeGenerator.generateQRCodeBase64(order.getOrderNumber(), 124, 124); + orderDetailVO.setWriteOffCode(base64); + } catch (Exception e) { + e.printStackTrace(); + throw new ServiceException("生成核销码失败"); } return orderDetailVO; } @@ -439,11 +449,12 @@ appUser.setBalance(balance.add(paymentAmount).setScale(2, RoundingMode.HALF_EVEN)); appUser.setShopAmount(appUser.getShopAmount().subtract(paymentAmount).setScale(2, RoundingMode.HALF_EVEN)); //查询最后一次的消费订单 - Order order1 = this.getOne(new LambdaQueryWrapper<Order>().eq(Order::getAppUserId, order.getAppUserId()).eq(Order::getPayStatus, 2).eq(Order::getDelFlag, 0).in(Order::getOrderStatus, Arrays.asList(2, 3, 4, 8)).ne(Order::getId, order.getId()).last(" order by create_time desc limit 0, 1")); + Order order1 = this.getOne(new LambdaQueryWrapper<Order>().eq(Order::getAppUserId, order.getAppUserId()).eq(Order::getPayStatus, 2) + .eq(Order::getDelFlag, 0).in(Order::getOrderStatus, Arrays.asList(1, 2, 3, 4, 8)).ne(Order::getId, order.getId()).last(" order by create_time desc limit 0, 1")); if(null != order1){ appUser.setLastShopTime(order1.getCreateTime()); }else{ - appUser.setLastShopTime(LocalDateTime.MIN); + appUser.setLastShopTime(null); } //构建账户余额流水明细 diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java index 307c92a..b1e22d4 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java @@ -569,11 +569,11 @@ } }else{ //部分商品适用 - BigDecimal goodsMoney = BigDecimal.ZERO; + BigDecimal goodsMoney = BigDecimal.ZERO; for (MyShoppingCartVo myShoppingCartVo : goodsList) { Integer goodsId = myShoppingCartVo.getGoodsId(); BigDecimal cash = myShoppingCartVo.getCash(); - if(forGoodIds.contains(goodsId)){ + if(forGoodIds.contains(String.valueOf(goodsId))){ goodsMoney = goodsMoney.add(cash); } } diff --git a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java index 348da92..88aa5b8 100644 --- a/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java +++ b/ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java @@ -71,5 +71,7 @@ private String afterSaleTime; @ApiModelProperty("活动名称") private String activityName; + @ApiModelProperty("核销码BASE64") + private String writeOffCode; } diff --git a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml index 4d39cdd..cf7d0ff 100644 --- a/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml +++ b/ruoyi-service/ruoyi-order/src/main/resources/mapper/order/OrderMapper.xml @@ -93,7 +93,7 @@ SELECT count(*) as total, SUM( CASE WHEN tor.order_type = 1 THEN 1 ELSE 0 END ) as serviceTotal, - SUM( CASE WHEN tor.order_type = 2 THEN 1 ELSE 0 END ) as singleTotal, + SUM( CASE WHEN tor.order_type = 2 and distribution_mode = 1 THEN 1 ELSE 0 END ) as singleTotal, SUM( tor.total_amount ) as totalMoney, SUM( CASE WHEN tor.order_type = 1 THEN tor.total_amount ELSE 0 END ) as serviceTotalMoney, SUM( CASE WHEN tor.order_type = 2 THEN tor.total_amount ELSE 0 END ) as singleTotalMoney diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java index 7bde80d..5f6df24 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/CouponInfoController.java @@ -170,18 +170,21 @@ private void count(Long userid, List<CouponInfo> list1, List<CouponInfo> returnList) { for (CouponInfo couponInfo : list1) { Long count = appUserClient.getCouponCount(-1L, couponInfo.getId()).getData(); - if(couponInfo.getSendNum() <= count){ - couponInfo.setMaxNum(count.intValue() - couponInfo.getSendNum()); - for (int i = 0; i < couponInfo.getMaxNum(); i++) { - returnList.add(couponInfo); - } + if(count >= couponInfo.getSendNum()){ continue; } count = appUserClient.getCouponCount(userid, couponInfo.getId()).getData(); couponInfo.setMaxNum(couponInfo.getMaxNum() - count.intValue()); - for (int i = 0; i < couponInfo.getMaxNum(); i++) { - returnList.add(couponInfo); + if((couponInfo.getSendNum() - count) >= couponInfo.getMaxNum()){ + for (int i = 0; i < couponInfo.getMaxNum(); i++) { + returnList.add(couponInfo); + } + }else{ + for (int i = 0; i < (couponInfo.getSendNum() - count); i++) { + returnList.add(couponInfo); + } } + } } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java index e175199..bfcb218 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsCategoryController.java @@ -64,6 +64,7 @@ public R<Page<GoodsCategory>> list(@ApiParam("页码") @RequestParam Integer pageNum,@ApiParam("每一页数据大小") Integer pageSize, GoodsCategory goodsCategory){ Page<GoodsCategory> page = goodsCategoryService.lambdaQuery() .like(StringUtils.isNotEmpty(goodsCategory.getName()),GoodsCategory::getName, goodsCategory.getName()) + .eq(GoodsCategory::getDelFlag,0) .page(Page.of(pageNum, pageSize)); return R.ok(page); } diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java index 8572df7..9a6fa18 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsEvaluateController.java @@ -8,6 +8,7 @@ import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.StringUtils; +import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.order.feignClient.OrderClient; import com.ruoyi.order.model.Order; @@ -56,10 +57,12 @@ @GetMapping("/goodsList") @ApiOperation(value = "获取商品评价", tags = {"小程序-获取商品评价"}) - public R<List<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId){ - List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).eq(GoodsEvaluate::getDelFlag, 0) - .eq(GoodsEvaluate::getStatus, 2).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "").orderByDesc(GoodsEvaluate::getCreateTime).list(); - for (GoodsEvaluate goodsEvaluate : list) { + public R<PageInfo<GoodsEvaluate>> goodsList(@ApiParam("商品id") Integer goodsId, Integer pageNum, Integer pageSize){ + PageInfo<GoodsEvaluate> pageInfo = new PageInfo<>(pageNum, pageSize); + PageInfo<GoodsEvaluate> page = goodsEvaluateService.lambdaQuery().eq(GoodsEvaluate::getGoodsId, goodsId).eq(GoodsEvaluate::getDelFlag, 0) + .eq(GoodsEvaluate::getStatus, 2).isNotNull(GoodsEvaluate::getComment).ne(GoodsEvaluate::getComment, "") + .orderByDesc(GoodsEvaluate::getCreateTime).page(pageInfo); + for (GoodsEvaluate goodsEvaluate : page.getRecords()) { AppUser appUserById = appUserClient.getAppUserById(goodsEvaluate.getAppUserId()); if(null != appUserById){ goodsEvaluate.setUserName(appUserById.getName()); @@ -67,7 +70,7 @@ goodsEvaluate.setIdStr(String.valueOf(goodsEvaluate.getId())); } } - return R.ok(list); + return R.ok(page); } /** diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java index c9ca4e3..f86f1f1 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java @@ -124,6 +124,7 @@ AppUserShop appUserShop = new AppUserShop(); appUserShop.setAppUserId(appUser.getId()); appUserShop.setShopId(shopId); + appUserShop.setRoleType(1); R<Void> r = appUserClient.addAppUserShop(appUserShop); if (R.isError(r)){ throw new RuntimeException("添加失败"); @@ -176,7 +177,7 @@ userShop.setShopId(shopId); userShop.setRoleType(1); userShop.setRoleId(2L); - userShop.setNickName(sysUser.getNickName()); + userShop.setNickName(user.getNickName()); userShop.setCreateTime(LocalDateTime.now()); userShopClient.saveUserShop(userShop); } @@ -291,6 +292,7 @@ AppUserShop appUserShop = new AppUserShop(); appUserShop.setAppUserId(appUser.getId()); appUserShop.setShopId(shop.getId()); + appUserShop.setRoleType(1); appUserShopClient.delAppUserShop(appUserShop); //添加新管理员 @@ -298,7 +300,11 @@ appUserShop = new AppUserShop(); appUserShop.setAppUserId(appUser.getId()); appUserShop.setShopId(shop.getId()); + appUserShop.setRoleType(1); appUserClient.addAppUserShop(appUserShop); + appUser.setUserType(2); + appUserClient.editAppUserById(appUser); + //修改管理员 shop.setAppUserId(appUser.getId()); diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java index cac368d..32aafb7 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java @@ -50,7 +50,8 @@ private SysUserClient sysUserClient; @Resource private AppUserShopClient appUserShopClient; - + @Resource + private AppUserClient appUserClient; @@ -79,8 +80,7 @@ return R.ok(page); } - @Resource - private AppUserClient appUserClient; + @PostMapping("/manage/addorupdate") @ApiOperation(value = "添加编辑", tags = {"门店-技师列表"}) public R<Page<Technician>> add(@RequestBody Technician technician) { @@ -105,6 +105,7 @@ AppUserShop appUserShop = new AppUserShop(); appUserShop.setShopId(sysUser.getObjectId()); appUserShop.setAppUserId(appUser.getId()); + appUserShop.setRoleType(3); appUserShopClient.saveAppUserShop(appUserShop); }else { @@ -130,12 +131,21 @@ technicianService.saveOrUpdate(technician); return R.ok(); } + + + + @GetMapping("/manage/delete") @ApiOperation(value = "删除", tags = {"门店-技师列表"}) public R<Page<Technician>> delete(@RequestParam Integer id) { technicianService.removeById(id); return R.ok(); } + + + + + @GetMapping("/manage/changeStatus") @ApiOperation(value = "上下架", tags = {"门店-技师列表"}) public R<Page<Technician>> changeStatus(@RequestParam Integer id,@RequestParam@ApiParam("状态(1=下架,2=上架)") Integer status) { @@ -144,6 +154,10 @@ technicianService.updateById(byId); return R.ok(); } + + + + @GetMapping("/manage/changesubscri") @ApiOperation(value = "修改预约状态", tags = {"门店-技师列表"}) public R<Page<Technician>> changesubscri(@RequestParam Integer id,@RequestParam@ApiParam("预约状态(1=可预约,2=不可预约)") Integer subscribeStatus) { diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java index df9ff8c..03e72ce 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/TechnicianSubscribeMapper.java @@ -27,7 +27,8 @@ */ List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(PageInfo<TechnicianSubscribeVO> pageInfo, @Param("shopId") Long shopId, - @Param("status") Integer status); + @Param("status") Integer status, + @Param("technicianId") Integer technicianId); List<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop1(PageInfo<TechnicianSubscribeVO> pageInfo, @Param("shopId") Long shopId, @Param("status") Integer status, @Param("phone")String phone, diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java index 3bc5b95..0f8de83 100644 --- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java +++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TechnicianSubscribeServiceImpl.java @@ -5,14 +5,19 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.account.api.feignClient.AppUserClient; +import com.ruoyi.account.api.feignClient.AppUserShopClient; import com.ruoyi.account.api.model.AppUser; +import com.ruoyi.account.api.model.AppUserShop; import com.ruoyi.common.core.utils.StringUtils; import com.ruoyi.common.core.web.page.PageInfo; +import com.ruoyi.common.security.service.TokenService; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.order.feignClient.RemoteOrderGoodsClient; +import com.ruoyi.other.api.domain.Technician; import com.ruoyi.other.api.domain.TechnicianSubscribe; import com.ruoyi.other.enums.TechnicianStatus; import com.ruoyi.other.mapper.TechnicianSubscribeMapper; +import com.ruoyi.other.service.TechnicianService; import com.ruoyi.other.service.TechnicianSubscribeService; import com.ruoyi.other.vo.TechnicianSubscribeVO; import org.springframework.data.redis.connection.RedisZSetCommands; @@ -24,6 +29,7 @@ import java.time.ZoneId; import java.time.ZoneOffset; import java.util.List; +import java.util.Optional; import java.util.Set; /** @@ -45,6 +51,13 @@ @Resource private AppUserClient appUserClient; + @Resource + private TokenService tokenService; + @Resource + private AppUserShopClient appUserShopClient; + @Resource + private TechnicianService technicianService; + @@ -52,7 +65,17 @@ @Override public PageInfo<TechnicianSubscribeVO> getTechnicianSubscribeByUserAndShop(Long shopId, Integer status, Integer pageCurr, Integer pageSize) { PageInfo<TechnicianSubscribeVO> pageInfo = new PageInfo(pageCurr, pageSize); - List<TechnicianSubscribeVO> list = technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(pageInfo, shopId, status); + Long userid = tokenService.getLoginUserApplet().getUserid(); + List<AppUserShop> data = appUserShopClient.getAppUserShop(userid).getData(); + Optional<AppUserShop> first = data.stream().filter(s -> s.getShopId() == shopId.intValue() && s.getRoleType() == 3).findFirst(); + Integer technicianId = null; + if(first.isPresent()){ + AppUserShop appUserShop = first.get(); + Technician technician = technicianService.getOne(new LambdaQueryWrapper<Technician>().eq(Technician::getAppUserId, appUserShop.getAppUserId()) + .eq(Technician::getShopId, appUserShop.getShopId()).eq(Technician::getDelFlag, 0).eq(Technician::getStatus, 1)); + technicianId = technician.getId(); + } + List<TechnicianSubscribeVO> list = technicianSubscribeMapper.getTechnicianSubscribeByUserAndShop(pageInfo, shopId, status, technicianId); for (TechnicianSubscribeVO technicianSubscribeVO : list) { String id = technicianSubscribeVO.getId(); TechnicianSubscribe technicianSubscribe = this.getById(id); diff --git a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml index 32f51d2..d8da8e6 100644 --- a/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml +++ b/ruoyi-service/ruoyi-other/src/main/resources/mapper/other/TechnicianSubscribeMapper.xml @@ -24,6 +24,9 @@ <if test="status != null"> AND tts.status = #{status} </if> + <if test="technicianId != null"> + AND tts.technician_id = #{technicianId} + </if> ORDER BY tts.create_time DESC </select> <select id="getTechnicianSubscribeByUserAndShop1" resultType="com.ruoyi.other.vo.TechnicianSubscribeVO"> -- Gitblit v1.7.1