| | |
| | | package com.ruoyi.account.api.factory; |
| | | |
| | | import com.ruoyi.account.api.feignClient.UserCouponClient; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import com.ruoyi.account.api.vo.PaymentUserCoupon; |
| | | import com.ruoyi.account.api.vo.PaymentUserCouponVo; |
| | |
| | | public R<Long> getCouponCount(Integer couponId) { |
| | | return R.fail("根据优惠券id获取优惠券数量失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R<UserCoupon> getUserCoupon(Long id) { |
| | | return R.fail("获取用户优惠券失败:" + cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R editUserCoupon(UserCoupon userCoupon) { |
| | | return R.fail("编辑用户优惠券失败:" + cause.getMessage()); |
| | | } |
| | | }; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.account.api.feignClient; |
| | | |
| | | import com.ruoyi.account.api.factory.UserCouponClientFallbackFactory; |
| | | import com.ruoyi.account.api.model.UserCoupon; |
| | | import com.ruoyi.account.api.vo.CouponInfoVo; |
| | | import com.ruoyi.account.api.vo.PaymentUserCoupon; |
| | | import com.ruoyi.account.api.vo.PaymentUserCouponVo; |
| | |
| | | |
| | | @GetMapping("/user-coupon/getCouponCount") |
| | | R<Long> getCouponCount(@RequestParam("couponId") Integer couponId); |
| | | |
| | | |
| | | /** |
| | | * 获取用户优惠券 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/user-coupon/getUserCoupon") |
| | | R<UserCoupon> getUserCoupon(@RequestParam("id") Long id); |
| | | |
| | | |
| | | /** |
| | | * 编辑用户优惠券 |
| | | * @param userCoupon |
| | | * @return |
| | | */ |
| | | @PostMapping("/user-coupon/editUserCoupon") |
| | | R editUserCoupon(@RequestBody UserCoupon userCoupon); |
| | | } |
| | |
| | | @TableField("good_amount") |
| | | private BigDecimal goodAmount; |
| | | |
| | | @ApiModelProperty(value = "用户优惠券id") |
| | | @TableField("user_coupon_id") |
| | | private Long userCouponId; |
| | | |
| | | @ApiModelProperty(value = "活动优惠金额") |
| | | @TableField("activity_amount") |
| | | private BigDecimal activityAmount; |
| | |
| | | userCouponService.updateById(userCoupon); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户优惠券详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping("/getUserCoupon") |
| | | public R<UserCoupon> getUserCoupon(@RequestParam("id") Long id){ |
| | | UserCoupon userCoupon = userCouponService.getById(id); |
| | | return R.ok(userCoupon); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑用户优惠券 |
| | | * @return |
| | | */ |
| | | @PostMapping("/editUserCoupon") |
| | | public R editUserCoupon(@RequestBody UserCoupon userCoupon){ |
| | | userCouponService.updateById(userCoupon); |
| | | return R.ok(); |
| | | } |
| | | } |
| | | |
| | |
| | | appUser = appUser1; |
| | | }else if(null == appUser){ |
| | | appUser = new AppUser(); |
| | | appUser.setAvatar(registerAccount.getAvatar()); |
| | | appUser.setName(registerAccount.getName()); |
| | | appUser.setPhone(registerAccount.getPhone()); |
| | | appUser.setWxOpenid(openid); |
| | |
| | | //商户编号 |
| | | body.put("userNo", merchantNo); |
| | | //报备商户号 |
| | | body.put("tradeMerchantNo", singlePay.getTradeMerchantNo()); |
| | | // body.put("tradeMerchantNo", singlePay.getTradeMerchantNo()); |
| | | //产品类型 |
| | | body.put("productCode", "BANK_PAY_DAILY_ORDER"); |
| | | //交易请求时间 |
| | |
| | | |
| | | |
| | | public static String sign(JSONObject body) { |
| | | //构建字段顺序必须按照文档签名顺序 |
| | | Set<Map.Entry<String, Object>> entries = body.entrySet(); |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | return (o1.getKey()).compareTo(o2.getKey()); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, Object> item : infoIds) { |
| | | for (Map.Entry<String, Object> item : entries) { |
| | | if (item.getKey() != null || item.getKey() != "") { |
| | | Object val = item.getValue(); |
| | | if (!(val == "" || val == null)) { |
| | |
| | | } |
| | | } |
| | | sb.append(key); |
| | | log.info("待签名串:{}", sb.toString()); |
| | | return MD5AndKL.MD5(sb.toString()); |
| | | } |
| | | |
| | |
| | | List<OrderGood> orderGoods = orderGoodService.list(new LambdaQueryWrapper<OrderGood>() |
| | | .eq(OrderGood::getOrderId, order.getId())); |
| | | AppUser appUser = appUserClient.getAppUserById(order.getAppUserId()); |
| | | if(null == appUser){ |
| | | return; |
| | | } |
| | | //直推上级分佣金额 |
| | | BigDecimal ztsj_price = BigDecimal.ZERO; |
| | | //直帮上级分佣金额 |
| | |
| | | } |
| | | } |
| | | |
| | | confirmOrderVo.setActivityName(activityInfo1.getActivityName()); |
| | | paymentMoney = paymentMoney.subtract(zyh); |
| | | activityAmount = activityAmount.add(zyh); |
| | | if(null != activityInfo1){ |
| | | confirmOrderVo.setActivityName(activityInfo1.getActivityName()); |
| | | paymentMoney = paymentMoney.subtract(zyh); |
| | | activityAmount = activityAmount.add(zyh); |
| | | } |
| | | } |
| | | confirmOrderVo.setDiscountAmount(activityAmount); |
| | | int earnPoint = goodsList.stream().mapToInt(MyShoppingCartVo::getEarnSpendingPoints).sum(); |
| | |
| | | } |
| | | } |
| | | |
| | | discount = orderActivityInfo1.getDiscount(); |
| | | paymentMoney = paymentMoney.subtract(zyh); |
| | | activityAmount = activityAmount.add(zyh); |
| | | } |
| | |
| | | } |
| | | if(3 != shoppingCartPayment.getPaymentType() && (fullReductionAmount.compareTo(BigDecimal.ZERO) > 0 ||moneyAmount.compareTo(BigDecimal.ZERO) > 0 || discountAmount.compareTo(BigDecimal.ZERO) > 0)){ |
| | | order.setCouponJson(JSON.toJSONString(couponInfoVo)); |
| | | order.setUserCouponId(shoppingCartPayment.getUserCouponId()); |
| | | } |
| | | if(null != orderActivityInfo1){ |
| | | order.setActivityJson(JSON.toJSONString(orderActivityInfo1)); |
| | |
| | | orderService.updateById(order); |
| | | //删除购物车数据 |
| | | this.removeBatchByIds(ids); |
| | | //处理优惠券 |
| | | if(null != order.getUserCouponId()){ |
| | | UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData(); |
| | | if(null != userCoupon && 1 == userCoupon.getStatus()){ |
| | | userCoupon.setStatus(2); |
| | | userCoupon.setUseTime(LocalDateTime.now()); |
| | | userCouponClient.editUserCoupon(userCoupon); |
| | | } |
| | | } |
| | | } |
| | | //积分支付 |
| | | if(3 == shoppingCartPayment.getPaymentType()){ |
| | |
| | | order.setOrderStatus(2); |
| | | } |
| | | orderService.updateById(order); |
| | | |
| | | //处理优惠券 |
| | | if(null != order.getUserCouponId()){ |
| | | UserCoupon userCoupon = userCouponClient.getUserCoupon(order.getUserCouponId()).getData(); |
| | | if(null != userCoupon && 1 == userCoupon.getStatus()){ |
| | | userCoupon.setStatus(2); |
| | | userCoupon.setUseTime(LocalDateTime.now()); |
| | | userCouponClient.editUserCoupon(userCoupon); |
| | | } |
| | | } |
| | | |
| | | //删除购物车数据 |
| | | Long userid = tokenService.getLoginUserApplet().getUserid(); |
| | | List<OrderGood> list = orderGoodService.list(new LambdaQueryWrapper<OrderGood>().eq(OrderGood::getOrderId, order.getId())); |
| | |
| | | * 商户号 |
| | | */ |
| | | private static final String merchantNo = "888122600004175"; |
| | | |
| | | /** |
| | | * 平台-报备商户号 |
| | | */ |
| | | public static final String sysTradeMerchantNo = "777168500885852"; |
| | | |
| | | private static final String format = "yyyy-MM-dd HH:mm:ss"; |
| | | |
| | | |
| | | /** |
| | | * 支付回调地址 |
| | | */ |
| | | private static final String callbackUrl = "http://221.182.45.100:9000"; |
| | | |
| | | |
| | | /** |
| | | * 单笔代付 |
| | | * @param singlePay |
| | |
| | | //商户编号 |
| | | body.put("userNo", merchantNo); |
| | | //报备商户号 |
| | | body.put("tradeMerchantNo", singlePay.getTradeMerchantNo()); |
| | | // body.put("tradeMerchantNo", singlePay.getTradeMerchantNo()); |
| | | //产品类型 |
| | | body.put("productCode", "BANK_PAY_DAILY_ORDER"); |
| | | //交易请求时间 |
| | |
| | | */ |
| | | body.put("paidUse", singlePay.getPaidUse()); |
| | | //商户通知地址 |
| | | body.put("callbackUrl", singlePay.getCallbackUrl()); |
| | | body.put("callbackUrl", callbackUrl + singlePay.getCallbackUrl()); |
| | | String sign = null; |
| | | try { |
| | | sign = sign(body); |
| | |
| | | SinglePayResult uniPayResult = jsonObject.getObject("data", SinglePayResult.class); |
| | | return uniPayResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 单笔代付查询接口 |
| | | * @param merchantOrderNo 订单号 |
| | |
| | | SinglePayQueryResult uniPayResult = jsonObject.getObject("data", SinglePayQueryResult.class); |
| | | return uniPayResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 可取余额查询 |
| | | * @return |
| | |
| | | AccountBalanceQueryResult uniPayResult = jsonObject.getObject("data", AccountBalanceQueryResult.class); |
| | | return uniPayResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public static String sign(JSONObject body) { |
| | | //构建字段顺序必须按照文档签名顺序 |
| | | Set<Map.Entry<String, Object>> entries = body.entrySet(); |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | return (o1.getKey()).compareTo(o2.getKey()); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, Object> item : infoIds) { |
| | | for (Map.Entry<String, Object> item : entries) { |
| | | if (item.getKey() != null || item.getKey() != "") { |
| | | Object val = item.getValue(); |
| | | if (!(val == "" || val == null)) { |
| | |
| | | } |
| | | } |
| | | sb.append(key); |
| | | log.info("待签名串:{}", sb.toString()); |
| | | return MD5AndKL.MD5(sb.toString()); |
| | | } |
| | | |
| | |
| | | @DeleteMapping("/deleteShop") |
| | | @ApiOperation(value = "删除门店", tags = {"管理后台-门店管理"}) |
| | | public R<Void> deleteShop(@ApiParam("门店id") @RequestParam("id") Integer id){ |
| | | List<Goods> list1 = goodsService.list(new LambdaQueryWrapper<Goods>().eq(Goods::getDelFlag, 0).eq(Goods::getAppointStore, 1).eq(Goods::getStatus, 2)); |
| | | if(list1.size() > 0){ |
| | | Set<Integer> collect1 = list1.stream().map(Goods::getId).collect(Collectors.toSet()); |
| | | long count = goodsShopService.count(new LambdaQueryWrapper<GoodsShop>().eq(GoodsShop::getShopId, id).in(GoodsShop::getGoodsId, collect1)); |
| | | if(0 < count){ |
| | | return R.fail("门店已被商品使用,不能删除"); |
| | | } |
| | | } |
| | | Shop shop = shopService.getById(id); |
| | | shop.setDelFlag(1); |
| | | shopService.updateById(shop); |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.other.api.domain.ShopPoint; |
| | | import com.ruoyi.other.api.enums.PointChangeType; |
| | | import com.ruoyi.other.mapper.ShopPointMapper; |
| | | import com.ruoyi.other.service.ShopPointService; |
| | | import com.ruoyi.other.vo.ShopPointStatistics; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | |
| | | @Service |
| | | public class ShopPointServiceImpl extends ServiceImpl<ShopPointMapper, ShopPoint> implements ShopPointService { |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private SysUserClient sysUserClient; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ShopPointStatistics statistics(IPage<ShopPoint> page, ShopPoint shopPoint) { |
| | | Long userid = tokenService.getLoginUser().getUserid(); |
| | | SysUser sysUser = sysUserClient.getSysUser(userid).getData(); |
| | | List<ShopPoint> shopPoints = this.baseMapper.selectShopPointList(shopPoint); |
| | | Map<Integer, Integer> shopPointMap = shopPoints.stream() |
| | | .collect(Collectors.groupingBy( |
| | |
| | | LocalDateTime endTime = shopPoint.getEndTime(); |
| | | if(null != startTime){ |
| | | List<ShopPoint> list = this.list(new LambdaUpdateWrapper<ShopPoint>() |
| | | // todo bug说应展示所有门店积分数据 |
| | | // .eq(ShopPoint::getShopId, shopPoint.getShopId()) |
| | | .eq(ShopPoint::getShopId, sysUser.getObjectId()) |
| | | .last(" and create_time between '" + startTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "' and '" + endTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) + "'")); |
| | | List<String> date = new ArrayList<>(); |
| | | List<Map<String, Integer>> data = new ArrayList<>(); |
| | |
| | | * 平台-报备商户号 |
| | | */ |
| | | public static final String sysTradeMerchantNo = "777168500885852"; |
| | | |
| | | |
| | | private static final String format = "yyyy-MM-dd HH:mm:ss"; |
| | | /** |
| | | * 支付回调地址 |
| | | */ |
| | | private static final String callbackUrl = "http://221.182.45.100:9000"; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 单笔代付 |
| | | * @param singlePay |
| | |
| | | //商户编号 |
| | | body.put("userNo", merchantNo); |
| | | //报备商户号 |
| | | body.put("tradeMerchantNo", singlePay.getTradeMerchantNo()); |
| | | // body.put("tradeMerchantNo", singlePay.getTradeMerchantNo()); |
| | | //产品类型 |
| | | body.put("productCode", "BANK_PAY_DAILY_ORDER"); |
| | | //交易请求时间 |
| | |
| | | SinglePayResult uniPayResult = jsonObject.getObject("data", SinglePayResult.class); |
| | | return uniPayResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 单笔代付查询接口 |
| | | * @param merchantOrderNo 订单号 |
| | |
| | | SinglePayQueryResult uniPayResult = jsonObject.getObject("data", SinglePayQueryResult.class); |
| | | return uniPayResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 可取余额查询 |
| | | * @return |
| | |
| | | AccountBalanceQueryResult uniPayResult = jsonObject.getObject("data", AccountBalanceQueryResult.class); |
| | | return uniPayResult; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | public static String sign(JSONObject body) { |
| | | //构建字段顺序必须按照文档签名顺序 |
| | | Set<Map.Entry<String, Object>> entries = body.entrySet(); |
| | | List<Map.Entry<String, Object>> infoIds = new ArrayList<Map.Entry<String, Object>>(entries); |
| | | // 对所有传入参数按照字段名的 ASCII 码从小到大排序(字典序) |
| | | Collections.sort(infoIds, new Comparator<Map.Entry<String, Object>>() { |
| | | public int compare(Map.Entry<String, Object> o1, Map.Entry<String, Object> o2) { |
| | | return (o1.getKey()).compareTo(o2.getKey()); |
| | | } |
| | | }); |
| | | // 构造签名键值对的格式 |
| | | StringBuilder sb = new StringBuilder(); |
| | | for (Map.Entry<String, Object> item : infoIds) { |
| | | for (Map.Entry<String, Object> item : entries) { |
| | | if (item.getKey() != null || item.getKey() != "") { |
| | | Object val = item.getValue(); |
| | | if (!(val == "" || val == null)) { |
| | |
| | | } |
| | | } |
| | | sb.append(key); |
| | | log.info("待签名串:{}", sb.toString()); |
| | | return MD5AndKL.MD5(sb.toString()); |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) { |
| | | TransferUtil.accountBalanceQuery(); |
| | | } |
| | | |
| | | } |