ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/factory/AppUserClientFallbackFactory.java
@@ -109,6 +109,11 @@ public void demotionDetection() { R.fail("用户降级检测失败:" + cause.getMessage()); } @Override public R clearBindShop(Integer shopId) { return R.fail("清空绑定门店的用户门店数据失败:" + cause.getMessage()); } }; } } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserClient.java
@@ -97,4 +97,13 @@ */ @PostMapping("/app-user/demotionDetection") void demotionDetection(); /** * 清空绑定门店的用户门店数据 * @param shopId * @return */ @PostMapping("/app-user/clearBindShop") R clearBindShop(@RequestParam("shopId") Integer shopId); } ruoyi-api/ruoyi-api-account/src/main/java/com/ruoyi/account/api/feignClient/AppUserShopClient.java
@@ -5,10 +5,7 @@ import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.*; import java.util.List; ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/Order.java
@@ -51,6 +51,10 @@ @TableField("end_time") private LocalDateTime endTime; @ApiModelProperty(value = "核销人id") @TableField("canceller_app_user_id") private Long cancellerAppUserId; @ApiModelProperty(value = "售后截止日期") @TableField("after_sale_time") private LocalDateTime afterSaleTime; ruoyi-api/ruoyi-api-order/src/main/java/com/ruoyi/order/model/OrderGood.java
@@ -112,5 +112,21 @@ @TableField("type") private Integer type; @ApiModelProperty(value = "现金支付(0=否,1=是)") @TableField("cash_payment") private Integer cashPayment; @ApiModelProperty(value = "积分支付(0=否,1=是)") @TableField("point_payment") private Integer pointPayment; @ApiModelProperty(value = "基础售价") @TableField("selling_price") private BigDecimal sellingPrice; @ApiModelProperty(value = "基础积分") @TableField("integral") private Integer integral; } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/ReceiverBankChannel.java
New file @@ -0,0 +1,30 @@ package com.ruoyi.other.api.domain; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; /** * @author zhibing.pu * @date 2025/1/10 18:43 */ @Data @TableName("t_receiver_bank_channel") public class ReceiverBankChannel { /** * 主键 */ @TableField("id") private Long id; /** * 银行名称 */ @TableField("name") private String name; /** * 银行简称 */ @TableField("short") private String shortName; } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Share.java
@@ -75,7 +75,7 @@ @ApiModelProperty(value = "对象id") @TableField("object_id") private String objectId; private Long objectId; @TableField(exist = false) private String authName; @TableField(exist = false) ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/Shop.java
@@ -219,4 +219,8 @@ @TableField(exist = false) private Double score; @ApiModelProperty(value = "自己打分") @TableField(exist = false) private String myScore; } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/domain/TechnicianSubscribe.java
@@ -69,7 +69,7 @@ private LocalDateTime createTime; @TableField(exist = false) private String idStr; @TableField(exist = false) @TableField("order_id") private Long orderId; ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/ShopBalanceStatementClientFallbackFactory.java
@@ -6,6 +6,9 @@ import com.ruoyi.other.api.feignClient.ShopBalanceStatementClient; import org.springframework.cloud.openfeign.FallbackFactory; import java.util.Collection; import java.util.List; /** * @author zhibing.pu * @Date 2024/12/26 15:41 @@ -19,6 +22,11 @@ public void saveShopBalanceStatement(ShopBalanceStatement shopBalanceStatement) { R.fail("保存门店余额流水失败:" + cause.getMessage()); } @Override public R<List<ShopBalanceStatement>> getShopBalanceStatementList(Collection<Integer> types, Long objectId) { return R.fail("获取门店余额流水失败:" + cause.getMessage()); } }; } } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianClientFallbackFactory.java
@@ -6,6 +6,9 @@ import com.ruoyi.other.api.feignClient.TechnicianClient; import org.springframework.cloud.openfeign.FallbackFactory; import java.util.Collection; import java.util.List; public class TechnicianClientFallbackFactory implements FallbackFactory<TechnicianClient> { @Override public TechnicianClient create(Throwable cause) { @@ -19,6 +22,11 @@ public R<Void> updateStatus(Integer status, Long subscribeId) { return R.fail("跟新技师预约状态失败:" + cause.getMessage()); } @Override public R<List<Technician>> getTechnicianByIds(Collection<Integer> ids) { return R.fail("根据技师ids查询数据失败:" + cause.getMessage()); } }; } } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/factory/TechnicianSubscribeClientFallbackFactory.java
New file @@ -0,0 +1,24 @@ package com.ruoyi.other.api.factory; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.TechnicianSubscribe; import com.ruoyi.other.api.feignClient.TechnicianSubscribeClient; import org.springframework.cloud.openfeign.FallbackFactory; import java.util.List; /** * @author zhibing.pu * @date 2025/1/10 15:56 */ public class TechnicianSubscribeClientFallbackFactory implements FallbackFactory<TechnicianSubscribeClient>{ @Override public TechnicianSubscribeClient create(Throwable cause) { return new TechnicianSubscribeClient() { @Override public R<List<TechnicianSubscribe>> getTechnicianSubscribeList(Long orderId) { return R.fail("获取订单的预约服务列表失败:" + cause.getMessage()); } }; } } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/ShopBalanceStatementClient.java
@@ -1,11 +1,16 @@ package com.ruoyi.other.api.feignClient; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.ShopBalanceStatement; import com.ruoyi.other.api.factory.ShopBalanceStatementClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import java.util.Collection; import java.util.List; /** * @author zhibing.pu @@ -21,4 +26,13 @@ */ @PostMapping("/shop-balance-statement/saveShopBalanceStatement") void saveShopBalanceStatement(@RequestBody ShopBalanceStatement shopBalanceStatement); /** * 获取门店余额流水 * @param types * @return */ @PostMapping("/shop-balance-statement/getShopBalanceStatementList") R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestParam("types") Collection<Integer> types, @RequestParam("objectId") Long objectId); } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianClient.java
@@ -7,8 +7,12 @@ import com.ruoyi.other.api.factory.TechnicianClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.Collection; import java.util.List; @FeignClient(contextId = "TechnicianClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = TechnicianClientFallbackFactory.class) public interface TechnicianClient { @@ -18,4 +22,13 @@ @PutMapping("/technician-subscribe/updateStatus") R<Void> updateStatus(@RequestParam("status") Integer status, @RequestParam("subscribeId") Long subscribeId); /** * 根据技师ids查询数据 * @param ids * @return */ @PostMapping("/technician-subscribe/getTechnicianByIds") R<List<Technician>> getTechnicianByIds(@RequestParam("ids") Collection<Integer> ids); } ruoyi-api/ruoyi-api-other/src/main/java/com/ruoyi/other/api/feignClient/TechnicianSubscribeClient.java
New file @@ -0,0 +1,29 @@ package com.ruoyi.other.api.feignClient; import com.ruoyi.common.core.constant.ServiceNameConstants; import com.ruoyi.common.core.domain.R; import com.ruoyi.other.api.domain.TechnicianSubscribe; import com.ruoyi.other.api.factory.TechnicianSubscribeClientFallbackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import java.util.List; /** * @author zhibing.pu * @date 2025/1/10 15:55 */ @FeignClient(contextId = "TechnicianSubscribeClient", value = ServiceNameConstants.OTHER_SERVICE, fallbackFactory = TechnicianSubscribeClientFallbackFactory.class) public interface TechnicianSubscribeClient { /** * 获取订单的预约服务列表 * @param orderId * @return */ @PostMapping("/technician-subscribe/getTechnicianSubscribeList") R<List<TechnicianSubscribe>> getTechnicianSubscribeList(@RequestParam("orderId") Long orderId); } ruoyi-api/ruoyi-api-other/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
@@ -18,4 +18,5 @@ com.ruoyi.other.api.factory.VipSettingClientFallbackFactory com.ruoyi.other.api.factory.RegionClientFallbackFactory com.ruoyi.other.api.factory.ShopBalanceStatementClientFallbackFactory com.ruoyi.other.api.factory.ShopPointClientFallbackFactory com.ruoyi.other.api.factory.ShopPointClientFallbackFactory com.ruoyi.other.api.factory.TechnicianSubscribeClientFallbackFactory ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserController.java
@@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.account.api.model.UserCancellationLog; import com.ruoyi.account.api.model.UserCoupon; @@ -557,8 +558,10 @@ } //推广人 if (byId.getInviteUserId() != null) { AppUser byId1 = appUserService.getById(byId.getInviteUserId()); byId.setInviteUserName(byId1.getName()); AppUser appUser = appUserService.getById(byId.getInviteUserId()); if(null != appUser){ byId.setInviteUserName(appUser.getName()); } } //最后下单时间 R<Order> lastOrder = remoteOrderGoodsClient.getLastOrder(id); @@ -793,5 +796,17 @@ public void demotionDetection(){ appUserService.demotionDetection(); } /** * 清空绑定门店的用户门店数据 * @param shopId * @return */ @PostMapping("/clearBindShop") public R clearBindShop(@RequestParam("shopId") Integer shopId){ appUserService.update(new LambdaUpdateWrapper<AppUser>().eq(AppUser::getShopId, shopId).set(AppUser::getShopId, null)); return R.ok(); } } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/AppUserShopController.java
@@ -60,8 +60,6 @@ wrapper.eq(AppUserShop::getShopId, appUserShop.getShopId()); } appUserShopService.remove(wrapper); //删除用户绑定门店数据 appUserService.update(new LambdaUpdateWrapper<AppUser>().eq(AppUser::getShopId, appUserShop.getShopId()).set(AppUser::getShopId, null)); return R.ok(); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/mapper/AppUserMapper.java
@@ -32,6 +32,9 @@ List<NearbyReferrerVo> getNearbyReferrer(PageInfo<NearbyReferrerVo> pageInfo, @Param("cityCode") String cityCode, @Param("nearbyReferrer") NearbyReferrer nearbyReferrer); IPage<AppUser> getAppuserPage(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser, @Param("shopId") Integer shopId, @Param("userId") Set<Long> userIds); IPage<AppUser> getAppuserPage1(@Param("page") IPage<AppUser> page, @Param("appUser") AppUser appUser,@Param("objectId")Integer objectId,@Param("userIds")List<Long> userIds); UserStatistics getUserStatistics(@Param("shopId") Integer shopId, @Param("userId") Set<Long> userId); ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/service/impl/AppUserServiceImpl.java
@@ -842,7 +842,6 @@ } @Override public IPage<AppUser> getAppuserPage1(Integer pageNum, Integer pageSize, AppUser appUser,Integer objectId,List<Long> userIds) { return appUserMapper.getAppuserPage1(new Page<>(pageNum, pageSize), appUser,objectId,userIds); } ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/util/payment/PaymentUtil.java
@@ -31,6 +31,10 @@ */ private static final String merchantNo = "888122600004175"; /** * 平台-报备商户号 */ private static final String sysTradeMerchantNo = "777168500885852"; /** * 支付回调地址 */ private static final String callbackUrl = "http://221.182.45.100:9000"; @@ -78,7 +82,7 @@ //APPID body.put("q7_AppId", appId); //报备商户号 body.put("qa_TradeMerchantNo", StringUtils.isNotEmpty(tradeMerchantNo) ? tradeMerchantNo : "777168500885852"); body.put("qa_TradeMerchantNo", StringUtils.isNotEmpty(tradeMerchantNo) ? tradeMerchantNo : sysTradeMerchantNo); String sign = null; try { sign = sign(body); ruoyi-service/ruoyi-account/src/main/resources/mapper/account/AppUserMapper.xml
@@ -86,7 +86,7 @@ </select> <select id="getAppuserPage1" resultType="com.ruoyi.account.api.model.AppUser"> SELECT ta.id, ta.`name`, ta.vip_id, ta.shop_id 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 @@ -110,11 +110,10 @@ </if> and ( ta.id in ( <foreach collection="userIds" item="userId" open="(" separator="," close=")"> #{userId} </foreach> ) or ta.shop_id = #{objectId} ) or ta.shop_id = #{objectId} ) </where> </select> <select id="getUserStatistics" resultType="com.ruoyi.account.vo.UserStatistics"> ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/OrderController.java
@@ -424,7 +424,8 @@ */ @PostMapping("/getAppUserByShoppingShop") public R<Set<Long>> getAppUserByShoppingShop(@RequestParam("shopId") Integer shopId){ List<Order> list = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getShopId, shopId).eq(Order::getDelFlag, 0).eq(Order::getPayStatus, 2).in(Order::getOrderStatus, Arrays.asList(1, 2, 3, 4, 7, 8))); List<Order> list = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getShopId, shopId).eq(Order::getDelFlag, 0) .eq(Order::getPayStatus, 2).in(Order::getOrderStatus, Arrays.asList(1, 2, 3, 4, 7, 8))); Set<Long> collect = list.stream().map(Order::getAppUserId).collect(Collectors.toSet()); return R.ok(collect); } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/OrderServiceImpl.java
@@ -98,6 +98,10 @@ @Resource private RefundPassService refundPassService; @Resource private TechnicianSubscribeClient technicianSubscribeClient; @Resource private ShopBalanceStatementClient shopBalanceStatementClient; @@ -135,8 +139,8 @@ orderGoodsVO.setGoodsName(goods.getName()); orderGoodsVO.setType(goods.getType()); orderGoodsVO.setGoodsPic(goods.getHomePagePicture()); orderGoodsVO.setSellingPrice(goods.getSellingPrice()); orderGoodsVO.setIntegral(goods.getIntegral()); orderGoodsVO.setSellingPrice(orderGood.getSellingPrice()); orderGoodsVO.setIntegral(orderGood.getIntegral()); orderGoodsVO.setOriginalPrice(goods.getOriginalPrice()); goodsList.add(orderGoodsVO); } @@ -256,6 +260,7 @@ order.setIsCommission(0); order.setAfterSaleTime(LocalDateTime.now().plusDays(days)); order.setEndTime(LocalDateTime.now()); order.setCancellerAppUserId(loginUserApplet.getUserid()); orderMapper.updateById(order); } @@ -440,6 +445,46 @@ balanceChangeRecord.setDelFlag(0); balanceChangeRecord.setCreateTime(LocalDateTime.now()); balanceChangeRecordClient.saveBalanceChangeRecord(balanceChangeRecord); //退回获得的消费积分 //需要先检查会员等级时候回回退,使用回退后的会员等级查询配置 Integer lavePoint = appUser.getLavePoint(); UserPoint userPoint1 = new UserPoint(); userPoint1.setType(1); userPoint1.setAppUserId(appUser.getId()); userPoint1.setObjectId(order.getId()); UserPoint userPoint2 = userPointClient.getUserPointList(userPoint1).getData().get(0); JSONObject jsonObject = JSON.parseObject(userPoint2.getExtention()); Integer shopPoint = jsonObject.getInteger("shopPoint"); Integer availablePoint = jsonObject.getInteger("availablePoint"); Integer transferablePoint = jsonObject.getInteger("transferablePoint"); appUser.setShopPoint(appUser.getShopPoint() - shopPoint); appUser.setLavePoint(appUser.getLavePoint() - shopPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() - availablePoint); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() - availablePoint); if(null != transferablePoint){ appUser.setTransferablePoint(appUser.getTransferablePoint() - transferablePoint); } appUser.setTotalPoint(appUser.getTotalPoint() - shopPoint); boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); if(vipDemotion){ appUser.setVipId(appUser.getVipId() - 1); } //构建积分流水明细 UserPoint userPoint = new UserPoint(); userPoint.setType(1); userPoint.setHistoricalPoint(lavePoint); userPoint.setVariablePoint(shopPoint); userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(order.getAppUserId()); userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); appUserClient.editAppUserById(appUser); } if(3 == payMethod){ //开始运费退款,积分支付,运费是单独进行支付的,所以需要单独退款 @@ -504,39 +549,6 @@ userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); } //退回获得的消费积分 //需要先检查会员等级时候回回退,使用回退后的会员等级查询配置 Integer lavePoint = appUser.getLavePoint(); Integer getPoint = order.getGetPoint(); boolean vipDemotion = vipDemotion(appUser.getShopPoint() - getPoint, appUser.getVipId()); PointSetting pointSetting = pointSettingClient.getPointSetting(vipDemotion ? appUser.getVipId() - 1 : appUser.getVipId()).getData(); int earnPoint1 = 0; if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ earnPoint1 = new BigDecimal(getPoint).divide(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); } appUser.setShopPoint(appUser.getShopPoint() - getPoint); appUser.setLavePoint(appUser.getLavePoint() - getPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() - earnPoint1); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() - earnPoint1); if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ appUser.setTransferablePoint(appUser.getTransferablePoint() - earnPoint1); } appUser.setTotalPoint(appUser.getTotalPoint() - getPoint); if(vipDemotion){ appUser.setVipId(appUser.getVipId() - 1); } //构建积分流水明细 UserPoint userPoint = new UserPoint(); userPoint.setType(1); userPoint.setHistoricalPoint(lavePoint); userPoint.setVariablePoint(getPoint); userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(order.getAppUserId()); userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); appUserClient.editAppUserById(appUser); order.setRefundStatus(2); order.setRefundTime(LocalDateTime.now()); @@ -559,26 +571,29 @@ order.setRefundStatus(2); order.setRefundTime(LocalDateTime.now()); this.updateById(order); //退回获得的消费积分 //需要先检查会员等级时候回回退,使用回退后的会员等级查询配置 AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); Integer lavePoint = appUser.getLavePoint(); Integer getPoint = order.getGetPoint(); boolean vipDemotion = vipDemotion(appUser.getShopPoint() - getPoint, appUser.getVipId()); PointSetting pointSetting = pointSettingClient.getPointSetting(vipDemotion ? appUser.getVipId() - 1 : appUser.getVipId()).getData(); int earnPoint1 = 0; if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ earnPoint1 = new BigDecimal(getPoint).divide(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); UserPoint userPoint1 = new UserPoint(); userPoint1.setType(1); userPoint1.setAppUserId(appUser.getId()); userPoint1.setObjectId(order.getId()); UserPoint userPoint2 = userPointClient.getUserPointList(userPoint1).getData().get(0); JSONObject jsonObject = JSON.parseObject(userPoint2.getExtention()); Integer shopPoint = jsonObject.getInteger("shopPoint"); Integer availablePoint = jsonObject.getInteger("availablePoint"); Integer transferablePoint = jsonObject.getInteger("transferablePoint"); appUser.setShopPoint(appUser.getShopPoint() - shopPoint); appUser.setLavePoint(appUser.getLavePoint() - shopPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() - availablePoint); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() - availablePoint); if(null != transferablePoint){ appUser.setTransferablePoint(appUser.getTransferablePoint() - transferablePoint); } appUser.setShopPoint(appUser.getShopPoint() - getPoint); appUser.setLavePoint(appUser.getLavePoint() - getPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() - earnPoint1); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() - earnPoint1); if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ appUser.setTransferablePoint(appUser.getTransferablePoint() - earnPoint1); } appUser.setTotalPoint(appUser.getTotalPoint() - getPoint); appUser.setTotalPoint(appUser.getTotalPoint() - shopPoint); boolean vipDemotion = vipDemotion(appUser.getShopPoint(), appUser.getVipId()); if(vipDemotion){ appUser.setVipId(appUser.getVipId() - 1); } @@ -587,7 +602,7 @@ UserPoint userPoint = new UserPoint(); userPoint.setType(1); userPoint.setHistoricalPoint(lavePoint); userPoint.setVariablePoint(getPoint); userPoint.setVariablePoint(shopPoint); userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(order.getAppUserId()); @@ -641,43 +656,9 @@ userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); //退回获得的消费积分 //需要先检查会员等级时候回回退,使用回退后的会员等级查询配置 lavePoint = appUser.getLavePoint(); Integer getPoint = order.getGetPoint(); boolean vipDemotion = vipDemotion(appUser.getShopPoint() - getPoint, appUser.getVipId()); PointSetting pointSetting = pointSettingClient.getPointSetting(vipDemotion ? appUser.getVipId() - 1 : appUser.getVipId()).getData(); int earnPoint1 = 0; if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ earnPoint1 = new BigDecimal(getPoint).divide(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); } appUser.setShopPoint(appUser.getShopPoint() - getPoint); appUser.setLavePoint(appUser.getLavePoint() - getPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() - earnPoint1); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() - earnPoint1); if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ appUser.setTransferablePoint(appUser.getTransferablePoint() - earnPoint1); } appUser.setTotalPoint(appUser.getTotalPoint() - getPoint); if(vipDemotion){ appUser.setVipId(appUser.getVipId() - 1); } //构建积分流水明细 userPoint = new UserPoint(); userPoint.setType(1); userPoint.setHistoricalPoint(lavePoint); userPoint.setVariablePoint(getPoint); userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(order.getAppUserId()); userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); appUserClient.editAppUserById(appUser); order.setRefundStatus(2); order.setRefundTime(LocalDateTime.now()); return null; return R.ok(); } /** @@ -755,7 +736,7 @@ orderInfo.setDiscountAmount(order.getDiscountTotalAmount()); orderInfo.setExpressAmount(order.getExpressAmount()); orderInfo.setPaymentAmount(order.getPaymentAmount()); orderInfo.setPoint(order.getGetPoint()); orderInfo.setGetPoint(order.getGetPoint()); if(StringUtils.isNotEmpty(order.getAddressJson())){ UserAddress userAddress = JSON.parseObject(order.getAddressJson(), UserAddress.class); orderInfo.setRecipient(userAddress.getRecieveName() + "-" + userAddress.getRecievePhone()); @@ -781,6 +762,30 @@ goodsJson.add(map); } orderInfo.setGoodsJson(JSON.toJSONString(goodsJson)); orderInfo.setPoint(order.getPoint()); if(null != order.getAfterSaleTime()){ orderInfo.setAfterSaleTime(order.getAfterSaleTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); } if(StringUtils.isNotEmpty(order.getActivityJson())){ OrderActivityInfo activityInfo = JSON.parseObject(order.getActivityJson(), OrderActivityInfo.class); orderInfo.setActivityName(activityInfo.getActivityName()); } if(null != order.getEndTime()){ AppUser user = appUserClient.getAppUserById(order.getCancellerAppUserId()); orderInfo.setCanceller(user.getName()); orderInfo.setWriteOffTime(order.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); } if(order.getOrderType() == 1){ List<TechnicianSubscribe> technicianSubscribes = technicianSubscribeClient.getTechnicianSubscribeList(order.getId()).getData(); if(technicianSubscribes.size() > 0){ Set<Integer> collect = technicianSubscribes.stream().map(TechnicianSubscribe::getTechnicianId).collect(Collectors.toSet()); List<Technician> data = technicianClient.getTechnicianByIds(collect).getData(); orderInfo.setTechnicianName(data.stream().map(Technician::getName).collect(Collectors.joining(","))); } } List<ShopBalanceStatement> data = shopBalanceStatementClient.getShopBalanceStatementList(Arrays.asList(1, 2, 3), order.getId()).getData(); BigDecimal reduce = data.stream().map(ShopBalanceStatement::getVariableAmount).reduce(BigDecimal.ZERO, BigDecimal::add); orderInfo.setSubcommission(reduce); return orderInfo; } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/RefundPassServiceImpl.java
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.kuaidi100.sdk.contant.CompanyConstant; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.model.AppUser; import com.ruoyi.common.core.domain.R; @@ -233,6 +234,14 @@ refundPassInfo.setPics(refundPass.getPics()); refundPassInfo.setPassStatus(refundPass.getPassStatus()); refundPassInfo.setPassRemark(refundPass.getPassRemark()); refundPassInfo.setStatus(refundPass.getStatus()); String code = refundPass.getCode(); if(StringUtils.isNotEmpty(code)){ JSONObject jsonObject = JSON.parseObject(code); refundPassInfo.setExpressCode(jsonObject.getString("num")); String com = jsonObject.getString("com"); refundPassInfo.setExpressName(com); } return refundPassInfo; } } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ShoppingCartServiceImpl.java
@@ -410,6 +410,9 @@ //总优惠金额 BigDecimal activityAmount = BigDecimal.ZERO; BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData(); confirmOrderVo.setUseSimultaneously(JSON.parseObject(baseSetting.getContent()).getInteger("status") == 1); //减去优惠券优惠金额 CouponInfoVo couponInfoVo = null; if(null != confirmOrder.getCouponId() && 2 != confirmOrder.getPaymentType()){ @@ -480,7 +483,8 @@ //查询当前是否有订单活动 List<OrderActivityInfo> orderActivityInfo = orderActivityInfoClient.getNowOrderActivityInfo(appUser.getVipId()).getData(); //满XX才打折,只有现金才能优惠 if(null != orderActivityInfo && confirmOrder.getPaymentType() == 1){ if((confirmOrderVo.getUseSimultaneously() || (!confirmOrderVo.getUseSimultaneously() && activityAmount.equals(BigDecimal.ZERO))) && null != orderActivityInfo && confirmOrder.getPaymentType() == 1){ for (OrderActivityInfo activityInfo : orderActivityInfo) { if(activityInfo.getConditionAmount().compareTo(paymentMoney) <= 0){ confirmOrderVo.setActivityName(activityInfo.getActivityName()); @@ -496,8 +500,6 @@ } confirmOrderVo.setDiscountAmount(activityAmount); BaseSetting baseSetting = baseSettingClient.getBaseSetting(4).getData(); confirmOrderVo.setUseSimultaneously(JSON.parseObject(baseSetting.getContent()).getInteger("status") == 1); int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum(); confirmOrderVo.setEarnPoint(earnPoint); //支付金额,订单金额-订单优惠 @@ -1007,6 +1009,10 @@ orderGood.setBoundShopPoints(myShoppingCartVo.getBoundShopPoints()); orderGood.setBoundShopSuperiorsCharges(myShoppingCartVo.getBoundShopSuperiorsCharges()); orderGood.setBoundShopSuperiorsPoints(myShoppingCartVo.getBoundShopSuperiorsPoints()); orderGood.setCashPayment(myShoppingCartVo.getCashPayment() ? 1 : 0); orderGood.setPointPayment(myShoppingCartVo.getPointPayment() ? 1 : 0); orderGood.setSellingPrice(myShoppingCartVo.getCash()); orderGood.setIntegral(myShoppingCartVo.getPoint()); orderGoodService.save(orderGood); } @@ -1076,8 +1082,13 @@ appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + earnPoint1); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + earnPoint1); JSONObject jsonObject = new JSONObject(); jsonObject.put("shopPoint", earnPoint); jsonObject.put("availablePoint", earnPoint1); if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ appUser.setTransferablePoint(appUser.getTransferablePoint() + earnPoint1); jsonObject.put("transferablePoint", earnPoint1); } if(earnPoint > 0){ @@ -1089,6 +1100,7 @@ userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(appUser.getId()); userPoint.setObjectId(order.getId()); userPoint.setExtention(jsonObject.toJSONString()); userPointClient.saveUserPoint(userPoint); } } @@ -1164,38 +1176,13 @@ userPoint.setExtention((tra >= 0 ? orderPoint : transferablePoint) + ""); userPointClient.saveUserPoint(userPoint); lavePoint = appUser.getLavePoint(); PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); int earnPoint1 = 0; //计算可用积分比例 if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ earnPoint1 = new BigDecimal(earnPoint).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); } appUser.setShopPoint(appUser.getShopPoint() + earnPoint); appUser.setLavePoint(appUser.getLavePoint() + earnPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + earnPoint1); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + earnPoint1); if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ appUser.setTransferablePoint(appUser.getTransferablePoint() + earnPoint1); } appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); appUser.setLastShopTime(LocalDateTime.now()); appUserClient.editAppUserById(appUser); //变更等级 appUserClient.vipUpgrade(appUser.getId()); //构建积分流水记录 if(earnPoint > 0){ userPoint = new UserPoint(); userPoint.setType(1); userPoint.setHistoricalPoint(lavePoint); userPoint.setVariablePoint(earnPoint); userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(appUser.getId()); userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); } //积分支付不返佣 //如果有运费,需要先扣除账户积分,再进行支付。支付成功后修改订单状态,未支付成功则回退积分,删除的订单 if(expressFee.compareTo(BigDecimal.ZERO) > 0){ if(shoppingCartPayment.getFreightPaymentType() == 2){ @@ -1262,6 +1249,7 @@ this.removeBatchByIds(ids); } } //添加账户余额支付明细 if(redPacketAmount.compareTo(BigDecimal.ZERO) > 0 || distributionAmount.compareTo(BigDecimal.ZERO) > 0){ OrderBalancePayment orderBalancePayment = new OrderBalancePayment(); @@ -1296,31 +1284,39 @@ } Integer earnPoint = order.getGetPoint(); AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); Integer lavePoint = appUser.getLavePoint(); BigDecimal paymentMoney = order.getPaymentAmount(); //构建积分流水记录 if(earnPoint > 0){ PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); int earnPoint1 = earnPoint; int earnPoint1 = 0; if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ earnPoint1 = new BigDecimal(earnPoint1).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); earnPoint1 = new BigDecimal(earnPoint).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); } appUser.setShopPoint(appUser.getShopPoint() + earnPoint); appUser.setLavePoint(appUser.getLavePoint() + earnPoint); appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + earnPoint1); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + earnPoint1); if(earnPoint > 0){ UserPoint userPoint = new UserPoint(); userPoint.setType(1); userPoint.setHistoricalPoint(appUser.getLavePoint() - earnPoint); userPoint.setVariablePoint(earnPoint); userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(appUser.getId()); userPoint.setObjectId(order.getId()); userPointClient.saveUserPoint(userPoint); JSONObject jsonObject = new JSONObject(); jsonObject.put("shopPoint", earnPoint); jsonObject.put("availablePoint", earnPoint1); if(null != pointSetting && 1 == pointSetting.getBuyPointGift()){ appUser.setTransferablePoint(appUser.getTransferablePoint() + earnPoint1); jsonObject.put("transferablePoint", earnPoint1); } UserPoint userPoint = new UserPoint(); userPoint.setType(1); userPoint.setHistoricalPoint(lavePoint); userPoint.setVariablePoint(earnPoint); userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(appUser.getId()); userPoint.setObjectId(order.getId()); userPoint.setExtention(jsonObject.toJSONString()); userPointClient.saveUserPoint(userPoint); } appUser.setShopAmount(appUser.getShopAmount().add(paymentMoney).setScale(2, RoundingMode.HALF_EVEN)); appUser.setLastShopTime(LocalDateTime.now()); @@ -1356,36 +1352,42 @@ if(null == order || order.getPayStatus() == 2){ return R.ok(); } Integer earnPoint = order.getGetPoint(); Integer orderPoint = order.getPoint(); AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); Integer lavePoint = appUser.getLavePoint(); PointSetting pointSetting = pointSettingClient.getPointSetting(appUser.getVipId()).getData(); int earnPoint1 = 0; //计算可用积分比例 if(null != pointSetting && 1 == pointSetting.getBuyPointOpen()){ earnPoint1 = new BigDecimal(earnPoint).multiply(pointSetting.getBuyPoint().divide(new BigDecimal(100))).intValue(); //扣减订单支付积分 appUser.setLavePoint(appUser.getLavePoint() - orderPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() - orderPoint); //可转增积分 Integer transferablePoint = appUser.getTransferablePoint(); Integer tra = 0; if(transferablePoint > 0){ tra = transferablePoint - orderPoint; appUser.setTransferablePoint(tra >= 0 ? tra : 0); }else{ appUser.setTransferablePoint(appUser.getTransferablePoint() - orderPoint); } appUser.setShopPoint(appUser.getShopPoint() + earnPoint); appUser.setLavePoint(appUser.getLavePoint() + earnPoint); appUser.setAvailablePoint(appUser.getAvailablePoint() + earnPoint1); appUser.setTotalAvailablePoint(appUser.getTotalAvailablePoint() + earnPoint1); appUser.setTotalPoint(appUser.getTotalPoint() + earnPoint); appUser.setLastShopTime(LocalDateTime.now()); appUserClient.editAppUserById(appUser); //变更等级 appUserClient.vipUpgrade(appUser.getId()); //构建积分流水记录 UserPoint userPoint = new UserPoint(); userPoint.setType(1); userPoint.setType(11); userPoint.setHistoricalPoint(lavePoint); userPoint.setVariablePoint(earnPoint); userPoint.setVariablePoint(orderPoint); userPoint.setBalance(appUser.getLavePoint()); userPoint.setCreateTime(LocalDateTime.now()); userPoint.setAppUserId(appUser.getId()); userPoint.setObjectId(order.getId()); userPoint.setExtention((tra >= 0 ? orderPoint : transferablePoint) + ""); userPointClient.saveUserPoint(userPoint); //积分支付不反积分 appUser.setLastShopTime(LocalDateTime.now()); appUserClient.editAppUserById(appUser); //变更等级 appUserClient.vipUpgrade(appUser.getId()); //修改订支付状态 order.setPayStatus(2); //自提 ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/util/payment/PaymentUtil.java
@@ -28,6 +28,10 @@ */ private static final String merchantNo = "888122600004175"; /** * 平台-报备商户号 */ private static final String sysTradeMerchantNo = "777168500885852"; /** * 支付回调地址 */ private static final String callbackUrl = "http://221.182.45.100:9000"; @@ -75,7 +79,7 @@ //APPID body.put("q7_AppId", appId); //报备商户号 body.put("qa_TradeMerchantNo", StringUtils.isNotEmpty(tradeMerchantNo) ? tradeMerchantNo : "777168500885852"); body.put("qa_TradeMerchantNo", StringUtils.isNotEmpty(tradeMerchantNo) ? tradeMerchantNo : sysTradeMerchantNo); String sign = null; try { sign = sign(body); ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/OrderInfoVo.java
@@ -34,6 +34,8 @@ private Integer paymentMethod; @ApiModelProperty("订单总金额") private BigDecimal totalAmount; @ApiModelProperty("支付积分") private Integer point; @ApiModelProperty("优惠券") private String couponName; @ApiModelProperty("抵扣金额") @@ -43,7 +45,7 @@ @ApiModelProperty("支付金额") private BigDecimal paymentAmount; @ApiModelProperty("获得积分") private Integer point; private Integer getPoint; @ApiModelProperty("收件人") private String recipient; @ApiModelProperty("收件地址") @@ -58,7 +60,13 @@ private String writeOffTime; @ApiModelProperty("服务技师") private String technicianName; @ApiModelProperty("核销人") private String canceller; @ApiModelProperty("分佣金额") private BigDecimal subcommission; @ApiModelProperty("售后截止时间") private String afterSaleTime; @ApiModelProperty("活动名称") private String activityName; } ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/vo/RefundPassInfo.java
@@ -62,4 +62,12 @@ private String userRemark; @ApiModelProperty("申请图片") private String pics; @ApiModelProperty("活动名称") private String activityName; @ApiModelProperty("1待审核2已完成3已拒绝4待退货5待平台收货") private Integer status; @ApiModelProperty("快递单号") private String expressCode; @ApiModelProperty("快递公司名称") private String expressName; } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsController.java
@@ -14,6 +14,7 @@ import com.ruoyi.other.api.domain.VipSetting; import com.ruoyi.other.api.feignClient.VipSettingClient; import com.ruoyi.other.service.GoodsService; import com.ruoyi.other.service.VipSettingService; import com.ruoyi.other.vo.GoodsVO; import io.swagger.annotations.*; import org.springframework.web.bind.annotation.*; @@ -37,6 +38,8 @@ private GoodsService goodsService; @Resource private VipSettingClient settingClient; @Resource private VipSettingService vipSettingService; /** * 添加商品 @@ -123,6 +126,10 @@ @DeleteMapping("/manageGoodsDelete/{goodsId}") @ApiOperation(value = "商品删除", tags = {"管理后台-商品管理"}) public R<Void> manageGoodsDelete(@PathVariable("goodsId") Long goodsId){ long count = vipSettingService.count(new LambdaQueryWrapper<VipSetting>().last(" where FIND_IN_SET(" + goodsId + ", good_ids)")); if(0 < count){ return R.fail("商品已被会员配置使用,不能删除"); } goodsService.removeById(goodsId); return R.ok(); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/RedPackegeSetController.java
@@ -65,6 +65,21 @@ public R<Void> addRedPackegeSet(@RequestBody RedPackegeSetDto redPackegeSets){ redPackegeSetService.remove(null); List<RedPackegeSet> redPackegeSetList = redPackegeSets.getRedPackegeSets(); for (int i = 0; i < redPackegeSetList.size(); i++) { RedPackegeSet redPackegeSet = redPackegeSetList.get(i); LocalDateTime startTime = redPackegeSet.getStartTime(); LocalDateTime endTime = redPackegeSet.getEndTime(); for (int j = 0; j < redPackegeSetList.size(); j++) { RedPackegeSet redPackegeSet1 = redPackegeSetList.get(j); LocalDateTime startTime1 = redPackegeSet1.getStartTime(); LocalDateTime endTime1 = redPackegeSet1.getEndTime(); if(i != j && ((startTime.isAfter(startTime1) && endTime.isBefore(endTime1)) || (startTime.isBefore(startTime1) && endTime.isAfter(startTime1) && endTime.isBefore(endTime1)) || (startTime.isAfter(startTime1) && startTime.isBefore(endTime1) && endTime.isAfter(endTime1)))){ return R.fail("时间有重叠,请重新配置"); } } } redPackegeSetService.saveBatch(redPackegeSetList); return R.ok(); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/SeckillActivityInfoController.java
@@ -84,11 +84,11 @@ @PostMapping("/getSeckillActivityInfo") public R<GoodsSeckill> getSeckillActivityInfo(@RequestBody GetSeckillActivityInfo info){ SeckillActivityInfo one = seckillActivityInfoService.getOne(new LambdaQueryWrapper<SeckillActivityInfo>().eq(SeckillActivityInfo::getGoodId, info.getGoodsId()) .eq(SeckillActivityInfo::getDelFlag, 0).last(" and now() between start_time and end_time order by create_time limit 0,1")); .eq(SeckillActivityInfo::getDelFlag, 0).eq(SeckillActivityInfo::getIsShelves, 1).last(" and now() between start_time and end_time order by create_time limit 0,1")); if(null == one){ return R.ok(); } GoodsSeckill goodsSeckill = goodsSeckillService.getOne(new LambdaQueryWrapper<GoodsSeckill>().eq(GoodsSeckill::getSeckillActivityInfoId, one.getGoodId()).eq(GoodsSeckill::getVip, info.getVip())); GoodsSeckill goodsSeckill = goodsSeckillService.getOne(new LambdaQueryWrapper<GoodsSeckill>().eq(GoodsSeckill::getSeckillActivityInfoId, one.getId()).eq(GoodsSeckill::getVip, info.getVip())); if(null != goodsSeckill){ goodsSeckill.setEndTime(one.getEndTime().toEpochSecond(ZoneOffset.UTC) * 1000); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShareController.java
@@ -58,8 +58,9 @@ }) @GetMapping("/list") public R<List<Share>> list(@RequestParam Integer objectId) { return R.ok(shareService.list(new LambdaQueryWrapper<Share>() .eq(Share::getObjectId, objectId))); List<Share> list = shareService.list(new LambdaQueryWrapper<Share>() .eq(Share::getObjectId, objectId).eq(Share::getDelFlag, 0).or().eq(Share::getAddType, 1).eq(Share::getDelFlag, 0)); return R.ok(list); } @@ -83,7 +84,7 @@ share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); } else if (share.getAddType() == 2) { share.setAuditStatus(ShareAuditStatus.WAIT.getCode()); share.setObjectId(userid.toString()); share.setObjectId(userid); } share.setDelFlag(0); share.setAppletShare(1); @@ -132,7 +133,7 @@ share.setAppletShare(0); share.setAuditStatus(ShareAuditStatus.SUCCESS.getCode()); if(sysUser.getRoleType() == 2){ share.setObjectId(sysUser.getObjectId().toString()); share.setObjectId(sysUser.getObjectId().longValue()); } share.setAuditStatus(0); share.setDelFlag(0); @@ -161,11 +162,11 @@ Long userid = tokenService.getLoginUser().getUserid(); SysUser sysUser = sysUserClient.getSysUser(userid).getData(); if (sysUser.getRoleType()==1) { Page<Share> page = shareService.lambdaQuery().eq(Share::getAuditStatus, 1).like(name != null, Share::getName, name) Page<Share> page = shareService.lambdaQuery().eq(Share::getAuditStatus, 1).eq(Share::getDelFlag, 0).like(name != null, Share::getName, name) .eq(Share::getAddType, 1).page(Page.of(pageNum, pageSize)); return R.ok(page); }else { Page<Share> page = shareService.lambdaQuery().eq(Share::getAddType,3).eq(Share::getObjectId, sysUser.getObjectId()) Page<Share> page = shareService.lambdaQuery().eq(Share::getAddType,3).eq(Share::getDelFlag, 0).eq(Share::getObjectId, sysUser.getObjectId()) .like(name != null, Share::getName, name).page(Page.of(pageNum, pageSize)); return R.ok(page); } @@ -193,7 +194,8 @@ @ApiOperation(value = "广告管理-分享管理-审核列表", tags = {"管理后台"}) @GetMapping("/manage/auth/list") public R<Page<Share>> authmanagelist(String name, Integer addType, @RequestParam Integer pageNum, Integer pageSize) { Page<Share> page = shareService.lambdaQuery().ne(Share::getAuditStatus, 1).like(name != null, Share::getName, name).eq(addType != null, Share::getAddType, addType).orderByAsc(Share::getAuditStatus).page(Page.of(pageNum, pageSize)); Page<Share> page = shareService.lambdaQuery().ne(Share::getAuditStatus, 1).like(name != null, Share::getName, name) .eq(addType != null, Share::getAddType, addType).eq(Share::getDelFlag, 0).orderByAsc(Share::getAuditStatus).page(Page.of(pageNum, pageSize)); for (Share record : page.getRecords()) { if (record.getAddType() == 2) { AppUser appUserById = appUserClient.getAppUserById(Long.valueOf(record.getObjectId())); @@ -203,7 +205,7 @@ } } if (record.getAddType() == 3) { R<Shop> shopById = shopClient.getShopById(Integer.valueOf(record.getObjectId())); R<Shop> shopById = shopClient.getShopById(record.getObjectId().intValue()); if (shopById.getData() != null) { record.setAuthName(shopById.getData().getName()); } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopBalanceStatementController.java
@@ -1,7 +1,9 @@ package com.ruoyi.other.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.utils.poi.ExcelUtil; @@ -21,6 +23,7 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.util.Collection; import java.util.List; import java.util.List; @@ -148,5 +151,18 @@ shopBalanceStatementService.save(shopBalanceStatement); } /** * 获取门店流水数据 * @param types * @param objectId * @return */ @PostMapping("/getShopBalanceStatementList") public R<List<ShopBalanceStatement>> getShopBalanceStatementList(@RequestParam("types") Collection<Integer> types, @RequestParam("objectId") Long objectId){ List<ShopBalanceStatement> list = shopBalanceStatementService.list(new LambdaQueryWrapper<ShopBalanceStatement>().eq(ShopBalanceStatement::getObjectId, objectId) .in(ShopBalanceStatement::getType, types)); return R.ok(list); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/ShopController.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.ruoyi.account.api.feignClient.AppUserClient; import com.ruoyi.account.api.feignClient.AppUserShopClient; import com.ruoyi.account.api.model.AppUser; @@ -33,10 +34,13 @@ import io.swagger.annotations.ApiParam; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -79,6 +83,8 @@ private TechnicianSubscribeService technicianSubscribeService; @Resource private TechnicianService technicianService; @Resource private ReceiverBankChannelService receiverBankChannelService; @@ -184,18 +190,7 @@ Shop shop = shopService.getById(id); shop.setDelFlag(1); shopService.updateById(shop); // 查询有没有门店绑定了该门店为上级门店 List<Shop> shops = shopService.lambdaQuery() .eq(Shop::getPid, id).list(); if(!shops.isEmpty()){ for (Shop shop1 : shops) { shop1.setPid(0); } } AppUser appUserById = appUserClient.getAppUserById(shop.getAppUserId()); appUserById.setUserType(1); appUserClient.editAppUserById(appUserById); shopService.updateBatchById(shops); appUserClient.clearBindShop(shop.getId()); UserShop userShop = new UserShop(); userShop.setShopId(shop.getId()); List<UserShop> data = userShopClient.getUserShop(userShop).getData(); @@ -426,7 +421,7 @@ return R.ok(new ArrayList<>()); } List<Integer> shopIds = appUserShopList.stream().map(AppUserShop::getShopId).collect(Collectors.toList()); List<Shop> shopList = shopService.listByIds(shopIds); List<Shop> shopList = shopService.list(new LambdaQueryWrapper<Shop>().in(Shop::getId, shopIds).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); if(null != appUser.getShopId()){ Optional<Shop> first = shopList.stream().filter(s -> s.getId().equals(appUser.getShopId())).findFirst(); if(first.isPresent()){ @@ -444,8 +439,14 @@ Double wgs84 = GeodesyUtil.getDistance(longitude + "," + latitude, shop.getLongitude() + "," + shop.getLatitude()).get("WGS84"); shop.setDistance(wgs84); List<ShopScore> list = shopScoreService.list(new LambdaQueryWrapper<ShopScore>().eq(ShopScore::getShopId, shop.getId())); double v = list.stream().map(ShopScore::getScore).reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue(); double v = 5; if(list.size() > 0){ v = list.stream().map(ShopScore::getScore).reduce(BigDecimal.ZERO, BigDecimal::add) .divide(new BigDecimal(list.size()), new MathContext(2, RoundingMode.HALF_EVEN)).doubleValue(); } shop.setScore(v); ShopScore one = shopScoreService.getOne(new LambdaQueryWrapper<ShopScore>().eq(ShopScore::getAppUserId, userid).eq(ShopScore::getShopId, shop.getId()).last(" order by create_time desc limit 0, 1")); shop.setMyScore(null == one ? "0" : one.getScore().toString()); } return R.ok(shopList); } @@ -458,6 +459,13 @@ @GetMapping("/bindShop") @ApiOperation(value = "绑定门店", tags = {"小程序-个人中心"}) public R<Void> bindShop(@ApiParam("门店id") @RequestParam Integer shopId) { Shop shop = shopService.getById(shopId); if(null == shop || shop.getDelFlag() == 1){ return R.fail("绑定店铺不存在"); } if(2 == shop.getStatus()){ return R.fail("绑定店铺已被冻结"); } AppUser appUser = appUserClient.getAppUserById(SecurityUtils.getUserId()); appUser.setShopId(shopId); return appUserClient.editAppUserById(appUser); @@ -564,7 +572,7 @@ city = "510100"; } city = city.substring(0, 4) + "00"; LambdaQueryWrapper<Shop> wrapper = new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getCityCode, city); LambdaQueryWrapper<Shop> wrapper = new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1).eq(Shop::getCityCode, city); if(null != goodsId){ Goods goods = goodsService.getById(goodsId); if(1 == goods.getType() && 1 == goods.getAppointStore()){ @@ -607,7 +615,7 @@ userShop.setUserId(userid); List<UserShop> data = userShopClient.getUserShop(userShop).getData(); List<Integer> collect = data.stream().map(UserShop::getShopId).collect(Collectors.toList()); List<Shop> shops = shopService.listByIds(collect); List<Shop> shops = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getId, collect).eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); List<VerifiableShopVo> list = new ArrayList<>(); for (Shop shop : shops) { VerifiableShopVo vo = new VerifiableShopVo(); @@ -637,5 +645,30 @@ List<Shop> list = shopService.list(new LambdaQueryWrapper<Shop>().eq(Shop::getDelFlag, 0).eq(Shop::getStatus, 1)); return R.ok(list); } @ResponseBody @GetMapping("/verifyAccountConfiguration") @ApiOperation(value = "判断是否有提现账户", tags = {"门店后台-财务管理-提现明细"}) public R verifyAccountConfiguration(){ Long userid = tokenService.getLoginUser().getUserid(); SysUser sysUser = sysUserClient.getSysUser(userid).getData(); Shop shop = shopService.getById(sysUser.getObjectId()); if(StringUtils.hasLength(shop.getReceiverAccountNoEnc())){ return R.ok(); } return R.fail("请先配置收款账户"); } @ResponseBody @GetMapping("/getBankSerialNumber") @ApiOperation(value = "获取行联号", tags = {"门店后台-财务管理-提现明细"}) public R<List<ReceiverBankChannel>> getBankSerialNumber(String name){ List<ReceiverBankChannel> list = receiverBankChannelService.list(new LambdaQueryWrapper<ReceiverBankChannel>() .like(ReceiverBankChannel::getName, name)); return R.ok(list); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianController.java
@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Collection; import java.util.List; /** @@ -48,61 +49,6 @@ // @PostMapping("/shop/list") // @ApiOperation(value = "获取门店的技师列表", tags = {"小程序-门店详情-技师预约"}) // public R<Page<Technician>> shoplist(@RequestParam Integer shopId,@RequestParam Integer pageNum,@RequestParam Integer pageSize){ // //查出技师列表 // Page<Technician> page = technicianService.lambdaQuery().eq(Technician::getShopId, shopId).eq(Technician::getStatus, 2).page(Page.of(pageNum, pageSize)); // for (Technician technician : page.getRecords()) { // //查出技师订单 // R<List<Long>> orderIdsByTechId = orderClient.getOrderIdsByTechId(technician.getId()); // if (orderIdsByTechId.getData().isEmpty()){ // technician.setGrade(new BigDecimal(0)); // technician.setServeCount(0); // continue; // } // //查出技师评价 // List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().in(GoodsEvaluate::getOrderId, orderIdsByTechId.getData()).list(); // // //算出平均分并保留一位小数 // BigDecimal avg = list.stream().map(GoodsEvaluate::getGrade).reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(list.size()), 1, BigDecimal.ROUND_HALF_UP); // technician.setGrade(avg); // technician.setServeCount(orderIdsByTechId.getData().size()); // // } // return R.ok(page); // } // @PostMapping("/shop/detail") // @ApiOperation(value = "获取门店的技师详情", tags = {"小程序-门店详情-技师预约"}) // public R<Technician> shopdetail(@RequestParam Integer techId){ // //查出技师列表 // Technician technician = technicianService.getById(techId); // // //查出技师订单 // R<List<Long>> orderIdsByTechId = orderClient.getOrderIdsByTechId(technician.getId()); // if (orderIdsByTechId.getData().isEmpty()){ // technician.setGrade(new BigDecimal(0)); // technician.setServeCount(0); // return R.ok(technician); // } // //查出技师评价 // List<GoodsEvaluate> list = goodsEvaluateService.lambdaQuery().in(GoodsEvaluate::getOrderId, orderIdsByTechId.getData()).list(); // // //算出平均分并保留一位小数 // BigDecimal avg = list.stream().map(GoodsEvaluate::getGrade).reduce(BigDecimal.ZERO, BigDecimal::add).divide(new BigDecimal(list.size()), 1, BigDecimal.ROUND_HALF_UP); // technician.setGrade(avg); // technician.setServeCount(orderIdsByTechId.getData().size()); // return R.ok(technician); // } // @PostMapping("/shop/tech") // @ApiOperation(value = "预约操作", tags = {"小程序-门店详情-技师预约"}) // public R<Technician> shoptech(@RequestBody TechnicianSubscribe subscribe){ // Long userId = tokenService.getLoginUserApplet().getUserid(); // subscribe.setAppUserId(userId); // technicianSubscribeService.save(subscribe); // return R.ok(); // } /** @@ -226,5 +172,17 @@ technicianScoreService.save(technicianScore); return R.ok(); } /** * 根据技师ids查询数据 * @param ids * @return */ @PostMapping("/getTechnicianByIds") public R<List<Technician>> getTechnicianByIds(@RequestParam("ids") Collection<Integer> ids){ List<Technician> technicians = technicianService.listByIds(ids); return R.ok(technicians); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/TechnicianSubscribeController.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.controller.BaseController; @@ -20,6 +21,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Arrays; import java.util.List; /** @@ -126,5 +128,17 @@ return R.ok(technicianSubscribeService.getTechnicianSubscribeByUser(page, SecurityUtils.getUserId(), status)); } /** * 获取订单的预约服务列表 * @param orderId * @return */ @PostMapping("/getTechnicianSubscribeList") public R<List<TechnicianSubscribe>> getTechnicianSubscribeList(@RequestParam("orderId") Long orderId){ List<TechnicianSubscribe> list = technicianSubscribeService.list(new LambdaQueryWrapper<TechnicianSubscribe>().eq(TechnicianSubscribe::getOrderId, orderId) .eq(TechnicianSubscribe::getDelFlag, 0).in(TechnicianSubscribe::getStatus, Arrays.asList(0, 1))); return R.ok(list); } } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/mapper/ReceiverBankChannelMapper.java
New file @@ -0,0 +1,11 @@ package com.ruoyi.other.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.other.api.domain.ReceiverBankChannel; /** * @author zhibing.pu * @date 2025/1/10 18:45 */ public interface ReceiverBankChannelMapper extends BaseMapper<ReceiverBankChannel> { } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/ReceiverBankChannelService.java
New file @@ -0,0 +1,11 @@ package com.ruoyi.other.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.other.api.domain.ReceiverBankChannel; /** * @author zhibing.pu * @date 2025/1/10 18:46 */ public interface ReceiverBankChannelService extends IService<ReceiverBankChannel> { } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ReceiverBankChannelServicImpl.java
New file @@ -0,0 +1,15 @@ package com.ruoyi.other.service.impl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.other.api.domain.ReceiverBankChannel; import com.ruoyi.other.mapper.ReceiverBankChannelMapper; import com.ruoyi.other.service.ReceiverBankChannelService; import org.springframework.stereotype.Service; /** * @author zhibing.pu * @date 2025/1/10 18:46 */ @Service public class ReceiverBankChannelServicImpl extends ServiceImpl<ReceiverBankChannelMapper, ReceiverBankChannel> implements ReceiverBankChannelService { } ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -115,6 +115,7 @@ } Map<Long, List<ShopScore>> shopScoreMap = shopScores.stream().collect(Collectors.groupingBy(ShopScore::getShopId)); AppUser finalAppUser1 = appUser; nearbyShopVOS.forEach(nearbyShopVO -> { List<ShopScore> scores = shopScoreMap.get(nearbyShopVO.getId()); if (scores != null && !scores.isEmpty()){ @@ -123,6 +124,11 @@ .reduce(BigDecimal.ZERO, BigDecimal::add) .divide(new BigDecimal(scores.size()), 1, RoundingMode.HALF_UP); nearbyShopVO.setScore(score.toString()); nearbyShopVO.setMyScore("0"); if(null != finalAppUser1){ ShopScore one = shopScoreService.getOne(new LambdaQueryWrapper<ShopScore>().eq(ShopScore::getAppUserId, finalAppUser1.getId()).eq(ShopScore::getShopId, nearbyShopVO.getId()).last(" order by create_time desc limit 0, 1")); nearbyShopVO.setMyScore(null == one ? "0" : one.getScore().toString()); } } }); return nearbyShopVOS; @@ -137,7 +143,7 @@ throw new ServiceException("查询店铺不存在"); } ShopScore one = shopScoreService.getOne(new LambdaQueryWrapper<ShopScore>().eq(ShopScore::getAppUserId, userid).eq(ShopScore::getShopId, shopId).last(" order by create_time desc limit 0, 1")); shopDetailVO.setScore(null == one ? BigDecimal.ZERO : one.getScore()); shopDetailVO.setMyScore(null == one ? BigDecimal.ZERO : one.getScore()); // 计算距离 if (shopDetailVO.getLongitude() != null && shopDetailVO.getLatitude() != null){ String shopLocation = String.format("%s,%s", shopDetailVO.getLongitude(), shopDetailVO.getLatitude()); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/payment/PaymentUtil.java
@@ -31,6 +31,10 @@ */ private static final String merchantNo = "888122600004175"; /** * 平台-报备商户号 */ private static final String sysTradeMerchantNo = "777168500885852"; /** * 支付回调地址 */ private static final String callbackUrl = "http://221.182.45.100:9000"; @@ -78,7 +82,7 @@ //APPID body.put("q7_AppId", appId); //报备商户号 body.put("qa_TradeMerchantNo", StringUtils.isNotEmpty(tradeMerchantNo) ? tradeMerchantNo : "777168500885852"); body.put("qa_TradeMerchantNo", StringUtils.isNotEmpty(tradeMerchantNo) ? tradeMerchantNo : sysTradeMerchantNo); String sign = null; try { sign = sign(body); ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/NearbyShopVO.java
@@ -25,6 +25,9 @@ @ApiModelProperty(value = "评分") private String score; @ApiModelProperty(value = "自己打分") private String myScore; private String latitude; private String longitude; ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/vo/ShopDetailVO.java
@@ -51,6 +51,9 @@ @ApiModelProperty(value = "评分") private BigDecimal score; @ApiModelProperty(value = "自己打分") private BigDecimal myScore; /** * 地址 */ ruoyi-service/ruoyi-other/src/main/resources/mapper/other/SeckillActivityInfoMapper.xml
@@ -77,6 +77,9 @@ LEFT JOIN t_goods tg ON tsai.good_id = tg.id LEFT JOIN t_goods_category tgc ON tgc.id = tg.goods_category_id WHERE tsai.del_flag = 0 <if test="goods.id != null"> AND tsai.id = #{goods.id} </if> <if test="goods.name != null and goods.name != ''"> AND tg.`name` LIKE concat('%',#{goods.name},'%') </if> @@ -89,25 +92,21 @@ <if test="goods.showStatus != null"> AND tsai.is_shelves = #{goods.showStatus} </if> <if test="goods.type != null"> AND tg.type = #{goods.type} </if> <if test="goods.status != null and goods.status ==1"> AND tsai.start_time <![CDATA[>]]> NOW() </if> <if test="goods.status != null and goods.status ==2"> AND tsai.start_time <![CDATA[<=]]> NOW() AND tsai.end_time <![CDATA[>]]> NOW() </if> <if test="goods.status != null and goods.status ==3"> AND tsai.end_time <![CDATA[<]]> NOW() </if> <if test="goods.vipId != null"> AND find_in_set(#{goods.vipId},tgs.vip) > 0 </if> order by tsai.create_time desc </select> </mapper> ruoyi-service/ruoyi-other/src/main/resources/mapper/other/ShopMapper.xml
@@ -24,7 +24,8 @@ ts.end_time, ts.longitude, ts.latitude, ts.status ts.status, (select ROUND(AVG(score), 1) from t_shop_score where shop_id = ts.id) as score FROM t_shop ts WHERE ts.del_flag = 0 AND ts.`status` = 1 AND ts.id = #{shopId}