From d958f5d012db6891204665530859e7a29f037560 Mon Sep 17 00:00:00 2001 From: tangqian Date: Thu, 18 May 2023 09:45:29 +0800 Subject: [PATCH 1/9] =?UTF-8?q?feat:=20=E5=95=86=E5=9F=8E=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/request/order/OrderPayRequest.java | 2 + .../order/impl/OrderPayServiceImpl.java | 46 +++++++++++++++++-- 2 files changed, 43 insertions(+), 5 deletions(-) diff --git a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderPayRequest.java b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderPayRequest.java index e63c17514..82225c02a 100644 --- a/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderPayRequest.java +++ b/yudao-module-mall/yudao-module-shop-api/src/main/java/cn/iocoder/yudao/module/shop/request/order/OrderPayRequest.java @@ -46,4 +46,6 @@ public class OrderPayRequest { @Schema(description = "下单时小程序的场景值") private Integer scene; + @Schema(description = "openid") + private String openid; } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java index 57571ca00..d4dee7897 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java @@ -5,6 +5,9 @@ import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.enums.Constants; import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.util.date.DateUtils; +import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; +import cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration; +import cn.iocoder.yudao.framework.pay.properties.WxPayProperties; import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi; import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserBillDTO; @@ -22,12 +25,18 @@ import cn.iocoder.yudao.module.shop.service.product.StoreProductService; import cn.iocoder.yudao.module.shop.utils.OrderUtil; import cn.iocoder.yudao.module.shop.utils.RedisUtil; import cn.iocoder.yudao.module.shop.vo.order.WxPayJsResultVo; +import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderV3Request; +import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderV3Result; +import com.github.binarywang.wxpay.bean.result.enums.TradeTypeEnum; +import com.github.binarywang.wxpay.service.WxPayService; import lombok.Data; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.support.TransactionTemplate; +import org.springframework.util.Assert; import java.math.BigDecimal; import java.util.HashMap; @@ -86,6 +95,12 @@ public class OrderPayServiceImpl implements OrderPayService { @Autowired private ApiConfigApi apiConfigApi; + @Autowired + private WxPayOneAutoConfiguration wxPayOneAutoConfiguration; + + @Autowired + private WxPayProperties payProperties; + /** * 支付成功处理 @@ -104,7 +119,7 @@ public class OrderPayServiceImpl implements OrderPayService { // billList.add(userBill); // 更新用户下单数量 - // user.setPayCount(user.getPayCount() + 1); + // user.setPayCount(user.getPayCount() + 1); Boolean execute = transactionTemplate.execute(e -> { @@ -135,6 +150,7 @@ public class OrderPayServiceImpl implements OrderPayService { /** * 余额支付 + * * @param storeOrder 订单 * @return Boolean Boolean */ @@ -191,7 +207,7 @@ public class OrderPayServiceImpl implements OrderPayService { storeOrder.setIsChannel(3); } if (orderPayRequest.getPayType().equals(PayConstants.PAY_TYPE_WE_CHAT)) { - switch (orderPayRequest.getPayChannel()){ + switch (orderPayRequest.getPayChannel()) { case PayConstants.PAY_CHANNEL_WE_CHAT_H5:// H5 storeOrder.setIsChannel(2); break; @@ -229,7 +245,7 @@ public class OrderPayServiceImpl implements OrderPayService { // 微信支付,调用微信预下单,返回拉起微信支付需要的信息 if (storeOrder.getPayType().equals(PayConstants.PAY_TYPE_WE_CHAT)) { // 预下单 - Map unifiedorder = unifiedorder(storeOrder, ip); + Map unifiedorder = unifiedorder(storeOrder, ip, orderPayRequest.getOpenid()); response.setStatus(true); WxPayJsResultVo vo = new WxPayJsResultVo(); vo.setAppId(unifiedorder.get("appId")); @@ -266,11 +282,12 @@ public class OrderPayServiceImpl implements OrderPayService { /** * 预下单 + * * @param storeOrder 订单 - * @param ip ip + * @param ip ip * @return 预下单返回对象 */ - private Map unifiedorder(StoreOrder storeOrder, String ip) { + private Map unifiedorder(StoreOrder storeOrder, String ip,String openid) { // 获取用户openId // 根据订单支付类型来判断获取公众号openId还是小程序openId @@ -314,6 +331,25 @@ public class OrderPayServiceImpl implements OrderPayService { // if (storeOrder.getIsChannel() == 2) { // map.put("mweb_url", responseVo.getMWebUrl()); // } + + WxPayService wxPayService = wxPayOneAutoConfiguration.wxPayOneService(); + Assert.notNull(wxPayService, "获取微信支付配置失败!"); + WxPayUnifiedOrderV3Request wxPayRequest = new WxPayUnifiedOrderV3Request(); + int sum = storeOrder.getPayPrice().multiply(new BigDecimal("100")).intValue(); + wxPayRequest.setAmount(new WxPayUnifiedOrderV3Request.Amount().setTotal(sum)); + wxPayRequest.setDescription("会员充值"); + wxPayRequest.setOutTradeNo(storeOrder.getOrderId()); + wxPayRequest.setNotifyUrl(payProperties.getNotifyUrl()); + wxPayRequest.setPayer(new WxPayUnifiedOrderV3Request.Payer().setOpenid(openid)); + wxPayRequest.setSceneInfo(new WxPayUnifiedOrderV3Request.SceneInfo().setPayerClientIp(ip)); + wxPayRequest.setAppid(payProperties.getAppId()); + wxPayRequest.setMchid(payProperties.getMchId()); + try { + WxPayUnifiedOrderV3Result wxPayUnifiedOrderV3Result = wxPayService.unifiedOrderV3(TradeTypeEnum.JSAPI, wxPayRequest); + map.put("mweb_url",wxPayUnifiedOrderV3Result.getH5Url()); + } catch (Exception e) { + e.getMessage(); + } return map; } } From 32a452e86ca60ed608ee9db11f7d50654106b568 Mon Sep 17 00:00:00 2001 From: tangqian Date: Thu, 18 May 2023 09:48:41 +0800 Subject: [PATCH 2/9] =?UTF-8?q?feat:=20=E5=95=86=E5=9F=8E=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/service/order/impl/OrderPayServiceImpl.java | 2 -- .../shop/service/order/impl/StoreOrderServiceImpl.java | 2 -- .../yudao/module/shop/support/pay/WxPayStrategy.java | 7 ------- 3 files changed, 11 deletions(-) diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java index d4dee7897..09a5b7e22 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/OrderPayServiceImpl.java @@ -5,7 +5,6 @@ import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.enums.Constants; import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.util.date.DateUtils; -import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration; import cn.iocoder.yudao.framework.pay.properties.WxPayProperties; import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi; @@ -32,7 +31,6 @@ import com.github.binarywang.wxpay.service.WxPayService; import lombok.Data; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.support.TransactionTemplate; diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java index 0aece763b..c2e98567e 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java @@ -48,7 +48,6 @@ import com.alipay.api.internal.util.AlipaySignature; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; -import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyV3Result; @@ -69,7 +68,6 @@ import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/support/pay/WxPayStrategy.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/support/pay/WxPayStrategy.java index affdb4ee9..790a70c2a 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/support/pay/WxPayStrategy.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/support/pay/WxPayStrategy.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.module.shop.support.pay; import cn.hutool.json.JSONUtil; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.framework.pay.config.WxPayOneAutoConfiguration; import cn.iocoder.yudao.framework.pay.properties.WxPayProperties; @@ -61,12 +60,6 @@ public class WxPayStrategy implements IPayStrategy{ return response; } - public static void main(String[] args) { - String article="MEMBER_11111"; - - article=article.replace("MEMBER","TUIKUAN"); - System.out.println(article); - } @Override public void refund(RechargeOrderDO orderDO) { WxPayRefundV3Request wxPayRefundV3Request = new WxPayRefundV3Request(); From c4bdbb6904bfda13cca0c02bbb28f9d4a71e8525 Mon Sep 17 00:00:00 2001 From: tangqian Date: Thu, 18 May 2023 09:49:55 +0800 Subject: [PATCH 3/9] =?UTF-8?q?feat:=20=E5=95=86=E5=9F=8E=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E9=80=80=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/controller/admin/notify/AliPayNotifyController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/AliPayNotifyController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/AliPayNotifyController.java index c06b5a5cf..1f5b58e37 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/AliPayNotifyController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/notify/AliPayNotifyController.java @@ -21,7 +21,7 @@ import java.util.Map; * @version: V1.0.0 */ @Slf4j -@RequestMapping("notify/ali") +@RequestMapping("notify/ali/") @RestController @Tag(name = "支付宝支付回调 - 订单支付") public class AliPayNotifyController { From cbf8056b88e75505d3852ed2a3d8b12618d14791 Mon Sep 17 00:00:00 2001 From: js199000131 <2728757160@qq.com> Date: Thu, 18 May 2023 11:01:34 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E7=89=A9=E6=B5=81=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E5=92=8C=E9=85=8D=E7=BD=AE=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shop/dal/mysql/express/ExpressMapper.java | 10 +++ .../shop/service/express/ExpressService.java | 30 +++++++ .../express/impl/ExpressServiceImpl.java | 28 ++++++ .../order/impl/StoreOrderServiceImpl.java | 90 ++++++++++++++++--- .../src/main/resources/application.yaml | 2 + 5 files changed, 147 insertions(+), 13 deletions(-) create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/express/ExpressMapper.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ExpressService.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ExpressServiceImpl.java diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/express/ExpressMapper.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/express/ExpressMapper.java new file mode 100644 index 000000000..90979affb --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/express/ExpressMapper.java @@ -0,0 +1,10 @@ +package cn.iocoder.yudao.module.shop.dal.mysql.express; + +import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface ExpressMapper extends BaseMapper { + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ExpressService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ExpressService.java new file mode 100644 index 000000000..8e579b951 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/ExpressService.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.shop.service.express; + +import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +/** + * ExpressService 接口 + * +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- + */ +@Service +@Validated +public interface ExpressService { + + /** + * 查询快递公司 + * @param code 快递公司编号 + * @return ExpressDO + */ + ExpressDO getByCode(String code); + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ExpressServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ExpressServiceImpl.java new file mode 100644 index 000000000..4d71df0b3 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/express/impl/ExpressServiceImpl.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.shop.service.express.impl; + + +import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO; +import cn.iocoder.yudao.module.shop.dal.mysql.express.ExpressMapper; +import cn.iocoder.yudao.module.shop.service.express.ExpressService; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +public class ExpressServiceImpl implements ExpressService { + + @Resource + private ExpressMapper dao; + /** + * 查询快递公司 + * @param code 快递公司编号 + */ + @Override + public ExpressDO getByCode(String code) { + LambdaQueryWrapper lqw = new LambdaQueryWrapper<>(); + lqw.eq(ExpressDO::getCode, code); + ExpressDO expressDO = dao.selectOne(lqw); + return expressDO; + } +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java index c2e98567e..fa46ed6af 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java @@ -13,8 +13,10 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils; import cn.iocoder.yudao.framework.pay.properties.AliPayProperties; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.module.infra.api.config.ApiConfigApi; import cn.iocoder.yudao.module.member.api.user.MemberUserApi; import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; +import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO; import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.PhoneRecordDO; import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO; @@ -31,6 +33,8 @@ import cn.iocoder.yudao.module.shop.request.order.StoreOrderSendRequest; import cn.iocoder.yudao.module.shop.request.order.StoreOrderUpdatePriceRequest; import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse; import cn.iocoder.yudao.module.shop.response.order.*; +import cn.iocoder.yudao.module.shop.service.express.ExpressService; +import cn.iocoder.yudao.module.shop.service.onepass.OnePassService; import cn.iocoder.yudao.module.shop.service.order.StoreOrderInfoService; import cn.iocoder.yudao.module.shop.service.order.StoreOrderRefundService; import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; @@ -43,6 +47,7 @@ import cn.iocoder.yudao.module.shop.utils.RedisUtil; import cn.iocoder.yudao.module.shop.vo.order.LogisticsResultVo; import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram; import cn.iocoder.yudao.module.shop.vo.order.StoreOrderInfoOldVo; +import cn.iocoder.yudao.module.shop.vo.product.MyRecord; import com.alipay.api.AlipayApiException; import com.alipay.api.internal.util.AlipaySignature; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -124,6 +129,15 @@ public class StoreOrderServiceImpl extends ServiceImpl { updateById(storeOrder); @@ -1488,6 +1502,56 @@ public class StoreOrderServiceImpl extends ServiceImpl orderIdList = new ArrayList<>(); +// orderIdList.add(storeOrder.getId()); +// HashMap> orderInfoMap = StoreOrderInfoService.getMapInId(orderIdList); +// if (orderInfoMap.isEmpty() || !orderInfoMap.containsKey(storeOrder.getId())) { +// throw new ServiceException("没有找到购买的商品信息"); +// } +// List productNameList = new ArrayList<>(); +// for (StoreOrderInfoOldVo storeOrderInfoVo : orderInfoMap.get(storeOrder.getId())) { +// productNameList.add(storeOrderInfoVo.getInfo().getProductName()); +// } +// +// record.set("cargo", String.join(",", productNameList));// 物品名称 +// if (express.getPartnerId()) { +// record.set("partner_id", express.getAccount());// 电子面单月结账号(部分快递公司必选) +// } +// if (express.getPartnerKey()) { +// record.set("partner_key", express.getPassword());// 电子面单密码(部分快递公司必选) +// } +// if (express.getNet()) { +// record.set("net", express.getNetName());// 收件网点名称(部分快递公司必选) +// } +// +// MyRecord myRecord = onePassService.expressDump(record); +// storeOrder.setDeliveryId(myRecord.getStr("kuaidinum")); +// } /** * 校验快递发货参数 */ @@ -1498,7 +1562,7 @@ public class StoreOrderServiceImpl extends ServiceImpl Date: Thu, 18 May 2023 13:25:44 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/qrcode/QrCodeController.java | 76 ++++++++++++++++ .../shop/service/qrcode/QrCodeService.java | 41 +++++++++ .../service/qrcode/QrCodeServiceImpl.java | 88 +++++++++++++++++++ .../member/enums/ErrorCodeConstants.java | 2 + .../admin/promoter/vo/PromoterBaseVO.java | 2 +- .../admin/promoter/vo/PromoterExcelVO.java | 2 +- .../promoter/vo/PromoterExportReqVO.java | 2 +- .../admin/promoter/vo/PromoterPageReqVO.java | 22 ++++- .../app/user/AppUserController.java | 26 +++++- .../app/user/vo/UserSpreadBannerVO.java | 39 ++++++++ .../dal/dataobject/promoter/PromoterDO.java | 6 +- .../dal/mysql/promoter/PromoterMapper.java | 5 +- .../service/promoter/PromoterServiceImpl.java | 32 ++++++- .../mapper/promoter/PromoterMapper.xml | 18 +++- .../admin/dept/vo/dept/DeptSimpleRespVO.java | 10 +++ .../app/tenant/AppTenantController.java | 2 + yudao-server/Dockerfile | 2 +- .../src/main/resources/application.yaml | 2 - .../src/main/resources/logback-spring.xml | 2 +- yudao-ui-admin/.env.dev | 4 +- yudao-ui-admin/.env.prod | 2 +- .../src/views/member/promoter/index.vue | 14 +-- 22 files changed, 368 insertions(+), 31 deletions(-) create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/qrcode/QrCodeController.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeService.java create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeServiceImpl.java create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/UserSpreadBannerVO.java diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/qrcode/QrCodeController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/qrcode/QrCodeController.java new file mode 100644 index 000000000..305c667d5 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/app/qrcode/QrCodeController.java @@ -0,0 +1,76 @@ +package cn.iocoder.yudao.module.shop.controller.app.qrcode; + +import cn.iocoder.yudao.framework.common.enums.Constants; +import cn.iocoder.yudao.framework.common.exception.ServiceException; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.shop.service.qrcode.QrCodeService; +import com.alibaba.fastjson.JSONObject; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 验证码 + * +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- + */ + +@Slf4j +@RestController +@RequestMapping("/qrcode") +@Tag(name = "用户APP - 二维码服务") +public class QrCodeController { + + @Autowired + private QrCodeService qrCodeService; + /** + * 获取二维码 + * @return CommonResult + */ + @Operation(summary="获取二维码") + @RequestMapping(value = "/get", method = RequestMethod.POST) + public CommonResult> get(@RequestBody JSONObject data) { + return CommonResult.success(qrCodeService.get(data)); + } + + /** + * 远程图片转base64 + * @return CommonResult + */ + @Operation(summary="远程图片转base64") + @RequestMapping(value = "/base64", method = RequestMethod.POST) + public CommonResult> get(@RequestBody String url) { + return CommonResult.success(qrCodeService.base64(url)); + } + + /** + * 将字符串 转base64 + * @return CommonResult + */ + @Operation(summary="将字符串 转base64") + @RequestMapping(value = "/str2base64", method = RequestMethod.POST) + public CommonResult> getQrcodeByString( + @RequestParam String text, + @RequestParam int width, + @RequestParam int height) { + if((width < 50 || height < 50) && (width > 500 || height > 500) && text.length() >= 999){ + throw new ServiceException(Constants.RESULT_QRCODE_PRAMERROR); + } + return CommonResult.success(qrCodeService.base64String(text, width,height)); + } +} + + + diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeService.java new file mode 100644 index 000000000..d6b0608dd --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeService.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.shop.service.qrcode; + +import com.alibaba.fastjson.JSONObject; + +import java.util.Map; + +/** +* QrCodeService 接口 +* +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- +*/ +public interface QrCodeService { + + /** + * 获取二维码 + * @return CommonResult + */ + Map get(JSONObject data); + + /** + * 远程图片转base64 + * @param url 图片链接地址 + */ + Map base64(String url); + + /** + * 将字符串 转base64 + * @param text 字符串 + * @param width 宽 + * @param height 高 + */ + Map base64String(String text,int width, int height); + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeServiceImpl.java new file mode 100644 index 000000000..a02c91572 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/qrcode/QrCodeServiceImpl.java @@ -0,0 +1,88 @@ +package cn.iocoder.yudao.module.shop.service.qrcode; + +import cn.hutool.extra.qrcode.QrCodeUtil; +import cn.hutool.http.HttpUtil; +import cn.iocoder.yudao.framework.common.exception.ServiceException; +import com.alibaba.fastjson.JSONObject; +import org.springframework.stereotype.Service; +import org.springframework.util.Base64Utils; + +import java.util.HashMap; +import java.util.Map; + +/** +* QrCodeServiceImpl 接口实现 +* +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- +*/ +@Service +public class QrCodeServiceImpl implements QrCodeService { + + /** + * 二维码 + * @return Object + */ + @Override + public Map get(JSONObject data) { + Map map = new HashMap<>(); + StringBuilder scene = new StringBuilder(); + String page = ""; + try{ + if(null != data){ + Map dataMap = JSONObject.toJavaObject(data, Map.class); + + for (Map.Entry m : dataMap.entrySet()) { + if(m.getKey().equals("path")){ + //前端路由, 不需要拼参数 + page = m.getValue().toString(); + continue; + } + if (scene.length() > 0) { + scene.append(","); + } + scene.append(m.getKey()).append(":").append(m.getValue()); + } + } + }catch (Exception e){ + throw new ServiceException("url参数错误 " + e.getMessage()); + } + map.put("code", ""); + return map; + } + + @Override + public Map base64(String url) { + byte[] bytes = HttpUtil.downloadBytes(url); + String base64Image = Base64Utils.encodeToString(bytes); + Map map = new HashMap<>(); + map.put("code", base64Image); + return map; + } + + /** + * 讲字符串转为QRcode + * @param text 待转换字符串 + * @return QRcode base64格式 + */ + @Override + public Map base64String(String text,int width, int height) { + + String base64Image = null; + try { + base64Image = Base64Utils.encodeToString(QrCodeUtil.generatePng(text,width,height)); + }catch (Exception e){ + throw new ServiceException("生成二维码异常"); + } + Map map = new HashMap<>(); + map.put("code", base64Image); + return map; + } +} + diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java index 493dbb58f..504bf8cf7 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java @@ -23,6 +23,8 @@ public interface ErrorCodeConstants { ErrorCode AUTH_THIRD_LOGIN_NOT_BIND = new ErrorCode(1004003005, "未绑定账号,需要进行绑定"); ErrorCode AUTH_WEIXIN_MINI_APP_PHONE_CODE_ERROR = new ErrorCode(1004003006, "获得手机号失败"); + ErrorCode USER_PHONE_EXISTS = new ErrorCode(1004003007, "手机号已经存在"); + // ========== 用户收件地址 1004004000 ========== ErrorCode ADDRESS_NOT_EXISTS = new ErrorCode(1004004000, "用户收件地址不存在"); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterBaseVO.java index f9c1817f9..e273be81d 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterBaseVO.java @@ -16,7 +16,7 @@ public class PromoterBaseVO { @Schema(description = "组织id", required = true, example = "18443") @NotNull(message = "组织id不能为空") - private String orgId; + private String deptId; @Schema(description = "推广员名称", required = true, example = "5841") @NotEmpty(message = "推广员名称不能为空") diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExcelVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExcelVO.java index 57325dd0d..a837dbe7f 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExcelVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExcelVO.java @@ -18,7 +18,7 @@ public class PromoterExcelVO { private Long id; @ExcelProperty("组织id") - private String orgId; + private String deptId; @ExcelProperty("会员id") private Long userId; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExportReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExportReqVO.java index 3fc155d41..823d2c52c 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExportReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterExportReqVO.java @@ -10,7 +10,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; public class PromoterExportReqVO { @Schema(description = "组织id", example = "18443") - private String orgId; + private String deptId; @Schema(description = "会员id", example = "5841") private Long userId; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterPageReqVO.java index c7efb3d64..44939b62e 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/promoter/vo/PromoterPageReqVO.java @@ -1,10 +1,15 @@ package cn.iocoder.yudao.module.member.controller.admin.promoter.vo; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.validation.Mobile; import lombok.*; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + @Schema(description = "管理后台 - 推广员分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @@ -12,9 +17,20 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; public class PromoterPageReqVO extends PageParam { @Schema(description = "组织id", example = "18443") - private String orgId; + private String deptId; - @Schema(description = "会员id", example = "5841") - private Long userId; + @Schema(description = "推广员名称", example = "5841") + private String nickname; + + @Schema(description = "推广员手机号", example = "15601691300") + private String mobile; + + /** + * 帐号状态 + *

+ * 枚举 {@link CommonStatusEnum} + */ + @Schema(description = "帐号状态") + private Integer status; } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java index 354c0002f..1d193a120 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/AppUserController.java @@ -5,9 +5,11 @@ import cn.hutool.core.date.LocalDateTimeUtil; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; +import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoReqVO; import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserInfoRespVO; import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; +import cn.iocoder.yudao.module.member.controller.app.user.vo.UserSpreadBannerVO; import cn.iocoder.yudao.module.member.convert.user.UserConvert; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; import cn.iocoder.yudao.module.member.service.promoter.PromoterService; @@ -22,6 +24,9 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.ArrayList; +import java.util.List; + import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; @@ -32,6 +37,7 @@ import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.FILE_IS_EMP @RequestMapping("/member/user") @Validated @Slf4j + public class AppUserController { @Resource @@ -43,6 +49,7 @@ public class AppUserController { @PutMapping("/update-nickname") @Operation(summary = "修改用户昵称") @PreAuthenticated + @TenantIgnore public CommonResult updateUserNickname(@RequestParam("nickname") String nickname) { userService.updateUserNickname(getLoginUserId(), nickname); return success(true); @@ -51,6 +58,7 @@ public class AppUserController { @PostMapping("/update-avatar") @Operation(summary = "修改用户头像") @PreAuthenticated + @TenantIgnore public CommonResult updateUserAvatar(@RequestParam("avatarFile") MultipartFile file) throws Exception { if (file.isEmpty()) { throw exception(FILE_IS_EMPTY); @@ -62,6 +70,7 @@ public class AppUserController { @GetMapping("/get") @Operation(summary = "获得基本信息") @PreAuthenticated + @TenantIgnore public CommonResult getUserInfo() { MemberUserDO user = userService.getUser(getLoginUserId()); AppUserInfoRespVO appUserInfoRespVO = UserConvert.INSTANCE.convert(user); @@ -76,6 +85,7 @@ public class AppUserController { @PostMapping("/update-mobile") @Operation(summary = "修改用户手机") @PreAuthenticated + @TenantIgnore public CommonResult updateMobile(@RequestBody @Valid AppUserUpdateMobileReqVO reqVO) { userService.updateUserMobile(getLoginUserId(), reqVO); return success(true); @@ -83,6 +93,7 @@ public class AppUserController { @PostMapping("/update-user") @Operation(summary = "修改用户信息") @PreAuthenticated + @TenantIgnore public CommonResult updateMobile(@RequestBody @Validated AppUserInfoReqVO req) { req.setId(getLoginUserId()); MemberUserDO userDO = new MemberUserDO(); @@ -92,6 +103,19 @@ public class AppUserController { userService.updateById(userDO); return success(true); } - + /** + * 海报背景图 + */ + @Operation(summary = "推广海报图") + @RequestMapping(value = "/spread/banner", method = RequestMethod.GET) + public CommonResult> getSpreadBannerList() { + List list = new ArrayList<>(); + UserSpreadBannerVO userSpreadBannerVO = new UserSpreadBannerVO(); + userSpreadBannerVO.setId(1); + userSpreadBannerVO.setPic("http://192.168.1.147:48080/admin-api/infra/file/4/get/431efea27162d536d35f7b3c0b844ede98a6ba58f4fd72ac7181e7ee5ebae77a.jpg"); + userSpreadBannerVO.setTitle("推广背景图"); + list.add(userSpreadBannerVO); + return CommonResult.success(list); + } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/UserSpreadBannerVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/UserSpreadBannerVO.java new file mode 100644 index 000000000..ec4156680 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/user/vo/UserSpreadBannerVO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.member.controller.app.user.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 用户地址表 + * +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@Schema(description="用户推广海报") +public class UserSpreadBannerVO implements Serializable { + + private static final long serialVersionUID=1L; + + @Schema(description = "id") + private Integer id; + + @Schema(description = "名称") + private String title; + + @Schema(description = "背景图") + private String pic; + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/promoter/PromoterDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/promoter/PromoterDO.java index 01d631f2d..dc1b9868a 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/promoter/PromoterDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/promoter/PromoterDO.java @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.member.dal.dataobject.promoter; import lombok.*; import java.io.Serializable; +import java.time.LocalDateTime; + import com.baomidou.mybatisplus.annotation.*; /** @@ -32,10 +34,12 @@ public class PromoterDO implements Serializable { /** * 组织id */ - private Long orgId; + private Long deptId; /** * 会员id */ private Long userId; + private LocalDateTime createTime; + } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/promoter/PromoterMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/promoter/PromoterMapper.java index 3913dde16..394215498 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/promoter/PromoterMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/promoter/PromoterMapper.java @@ -21,14 +21,13 @@ public interface PromoterMapper extends BaseMapperX { default PageResult selectPage(PromoterPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(PromoterDO::getOrgId, reqVO.getOrgId()) - .eqIfPresent(PromoterDO::getUserId, reqVO.getUserId()) + .eqIfPresent(PromoterDO::getDeptId, reqVO.getDeptId()) .orderByDesc(PromoterDO::getId)); } IPage findListPage(IPage page, @Param("data") PromoterPageReqVO data); default List selectList(PromoterExportReqVO reqVO) { return selectList(new LambdaQueryWrapperX() - .eqIfPresent(PromoterDO::getOrgId, reqVO.getOrgId()) + .eqIfPresent(PromoterDO::getDeptId, reqVO.getDeptId()) .eqIfPresent(PromoterDO::getUserId, reqVO.getUserId()) .orderByDesc(PromoterDO::getId)); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java index 2776136c0..93c891c78 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java @@ -1,10 +1,12 @@ package cn.iocoder.yudao.module.member.service.promoter; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; +import cn.iocoder.yudao.module.member.enums.ErrorCodeConstants; import cn.iocoder.yudao.module.member.service.user.MemberUserService; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; @@ -17,8 +19,10 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import javax.validation.Validator; +import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; +import java.time.LocalDateTime; import java.util.*; import cn.iocoder.yudao.module.member.controller.admin.promoter.vo.*; import cn.iocoder.yudao.module.member.dal.dataobject.promoter.PromoterDO; @@ -75,18 +79,28 @@ public class PromoterServiceImpl implements PromoterService { throw new ServiceException(PROMOTER_EXISTS); } promoter.setUserId(memberUserDO.getId()); + promoter.setCreateTime(LocalDateTime.now()); promoterMapper.insert(promoter); // 返回 return promoter.getId(); } @Override + @Transactional(rollbackFor = Exception.class) public void updatePromoter(PromoterUpdateReqVO updateReqVO) { // 校验存在 - validatePromoterExists(updateReqVO.getId()); + PromoterDO promoterDO = validatePromoterExists(updateReqVO.getId()); // 更新 PromoterDO updateObj = PromoterConvert.INSTANCE.convert(updateReqVO); promoterMapper.updateById(updateObj); + MemberUserDO memberUserDO = memberUserService.getUserByMobile(updateReqVO.getMobile()); + if(memberUserDO!=null&&!promoterDO.getUserId().equals(memberUserDO.getId())){ + throw new ServiceException(ErrorCodeConstants.USER_PHONE_EXISTS); + }else { + memberUserDO.setMobile(updateReqVO.getMobile()); + memberUserDO.setNickname(updateReqVO.getNickname()); + memberUserService.updateById(memberUserDO); + } } @Override @@ -97,10 +111,12 @@ public class PromoterServiceImpl implements PromoterService { promoterMapper.deleteById(id); } - private void validatePromoterExists(Long id) { - if (promoterMapper.selectById(id) == null) { + private PromoterDO validatePromoterExists(Long id) { + PromoterDO promoterDO = promoterMapper.selectById(id); + if (promoterDO == null) { throw exception(PROMOTER_NOT_EXISTS); } + return promoterDO; } @Override @@ -127,6 +143,13 @@ public class PromoterServiceImpl implements PromoterService { @Override public PageResult getPromoterPage(PromoterPageReqVO pageReqVO) { Page page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()); + if(StrUtil.isNotBlank(pageReqVO.getDeptId())){ + DeptRespDTO deptRespDTO = deptApi.getDept(Long.parseLong(pageReqVO.getDeptId())); + if(deptRespDTO!=null){ + pageReqVO.setDeptId(deptRespDTO.getParentOrganizationIds()); + } + } + promoterMapper.findListPage(page,pageReqVO); return new PageResult<>(page.getRecords(), page.getTotal()); } @@ -174,6 +197,7 @@ public class PromoterServiceImpl implements PromoterService { PromoterDO promoter = new PromoterDO(); promoter.setTenantId(SecurityFrameworkUtils.getLoginUser().getTenantId()); promoter.setUserId(memberUserDO.getId()); + promoter.setCreateTime(LocalDateTime.now()); Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId,memberUserDO.getId())); if(count>0){ respVO.getFailureUsernames().put(importUser.getNickName(), "已经是推广员"); @@ -184,7 +208,7 @@ public class PromoterServiceImpl implements PromoterService { respVO.getFailureUsernames().put(importUser.getNickName(), "组织不存在"); return; } - promoter.setOrgId(deptRespDTO.getId()); + promoter.setDeptId(deptRespDTO.getId()); promoterMapper.insert(promoter); respVO.getCreateUsernames().add(importUser.getNickName()); return; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/resources/mapper/promoter/PromoterMapper.xml b/yudao-module-member/yudao-module-member-biz/src/main/resources/mapper/promoter/PromoterMapper.xml index 38b6dc70b..ab426817b 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/resources/mapper/promoter/PromoterMapper.xml +++ b/yudao-module-member/yudao-module-member-biz/src/main/resources/mapper/promoter/PromoterMapper.xml @@ -10,9 +10,23 @@ --> diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSimpleRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSimpleRespVO.java index 582eaae51..20ee1a558 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSimpleRespVO.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/dept/DeptSimpleRespVO.java @@ -19,5 +19,15 @@ public class DeptSimpleRespVO { @Schema(description = "父部门 ID", required = true, example = "1024") private Long parentId; + /** + * 父级组织链 + */ + private String parentOrganizationIds; + + /** + * 父级组织链名称 + */ + private String parentOrganizationName; + } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/tenant/AppTenantController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/tenant/AppTenantController.java index f52ff8bf4..be7873f92 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/tenant/AppTenantController.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/app/tenant/AppTenantController.java @@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import javax.annotation.security.PermitAll; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -30,6 +31,7 @@ public class AppTenantController { @GetMapping("/get") @Operation(summary = "获得租户") @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PermitAll public CommonResult getTenant(@RequestParam("id") Long id) { TenantDO tenant = tenantService.getTenant(id); return success(TenantConvert.INSTANCE.convert(tenant)); diff --git a/yudao-server/Dockerfile b/yudao-server/Dockerfile index 234081ad0..4dcd1e0d0 100644 --- a/yudao-server/Dockerfile +++ b/yudao-server/Dockerfile @@ -16,4 +16,4 @@ ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" EXPOSE 48080 ## 启动后端项目 -CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar -Dspring.profiles.active=dev app.jar diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index 2cfe63be7..4de32b44a 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -108,8 +108,6 @@ yudao: permit-all_urls: - /admin-api/mp/open/** # 微信公众号开放平台,微信回调接口,不需要登录 - /admin-api/notice/wxpay/** - - /app-api/tenant/get - - /admin-api/system/tenant/get-id-by-name websocket: enable: true # websocket的开关 path: /websocket/message # 路径 diff --git a/yudao-server/src/main/resources/logback-spring.xml b/yudao-server/src/main/resources/logback-spring.xml index b1b9f3faf..a92625500 100644 --- a/yudao-server/src/main/resources/logback-spring.xml +++ b/yudao-server/src/main/resources/logback-spring.xml @@ -66,7 +66,7 @@ - + diff --git a/yudao-ui-admin/.env.dev b/yudao-ui-admin/.env.dev index 4667a55eb..cd578096a 100644 --- a/yudao-ui-admin/.env.dev +++ b/yudao-ui-admin/.env.dev @@ -5,8 +5,8 @@ ENV = 'development' VUE_APP_TITLE = 创盈商户管理系统 # 芋道管理系统/开发环境 -#VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/admin-api' -VUE_APP_BASE_API = 'http://192.168.1.147:48080' +VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/cyywl-api' +#VUE_APP_BASE_API = 'http://192.168.1.147:48080' # 路由懒加载 VUE_CLI_BABEL_TRANSPILE_MODULES = true diff --git a/yudao-ui-admin/.env.prod b/yudao-ui-admin/.env.prod index d1ef847d9..82641e167 100644 --- a/yudao-ui-admin/.env.prod +++ b/yudao-ui-admin/.env.prod @@ -9,7 +9,7 @@ VUE_APP_BASE_API = 'https://cmx.bskies.cc:8000/admin-api' #VUE_APP_BASE_API = 'http://192.168.2.71' # 根据服务器或域名修改 -PUBLIC_PATH = 'https://cmx.bskies.cc:8000/cy-admin/' +PUBLIC_PATH = 'http://192.168.2.71/' # 二级部署路径 VUE_APP_APP_NAME ='/cy-admin/' diff --git a/yudao-ui-admin/src/views/member/promoter/index.vue b/yudao-ui-admin/src/views/member/promoter/index.vue index 3cfbc285e..7242908bb 100644 --- a/yudao-ui-admin/src/views/member/promoter/index.vue +++ b/yudao-ui-admin/src/views/member/promoter/index.vue @@ -3,8 +3,8 @@ - - + @@ -75,8 +75,8 @@ - - + @@ -213,14 +213,14 @@ export default { queryParams: { pageNo: 1, pageSize: 10, - orgId: null, + deptId: null, userId: null, }, // 表单参数 form: {}, // 表单校验 rules: { - orgId: [{ + deptId: [{ required: true, message: '请选择所属组织', trigger: 'blur' @@ -309,7 +309,7 @@ export default { reset() { this.form = { id: undefined, - orgId: undefined, + deptId: undefined, userId: undefined, }; this.resetForm('form'); From 6fc3ce15a1207399b219806b2e343e3d2e979a61 Mon Sep 17 00:00:00 2001 From: perry <292303709@qq.com> Date: Thu, 18 May 2023 13:32:52 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=BF=AB=E9=80=92=E5=85=AC=E5=8F=B8?= =?UTF-8?q?=E5=AE=9E=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dal/dataobject/express/ExpressDO.java | 70 +++++++++++++++++++ .../order/impl/StoreOrderServiceImpl.java | 1 - 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ExpressDO.java diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ExpressDO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ExpressDO.java new file mode 100644 index 000000000..4af9bbc38 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/dataobject/express/ExpressDO.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.shop.dal.dataobject.express; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * 快递公司表 + * +---------------------------------------------------------------------- + * | CRMEB [ CRMEB赋能开发者,助力企业发展 ] + * +---------------------------------------------------------------------- + * | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved. + * +---------------------------------------------------------------------- + * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权 + * +---------------------------------------------------------------------- + * | Author: CRMEB Team + * +---------------------------------------------------------------------- + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("eb_express") +@Schema( description="快递公司表") +public class ExpressDO implements Serializable { + + private static final long serialVersionUID=1L; + + @Schema( description= "快递公司id") + @TableId(value = "id", type = IdType.ASSIGN_ID) + private Integer id; + + @Schema( description= "快递公司简称") + private String code; + + @Schema( description= "快递公司全称") + private String name; + + @Schema( description= "是否需要月结账号") + private Boolean partnerId; + + @Schema( description= "是否需要月结密码") + private Boolean partnerKey; + + @Schema( description= "是否需要取件网店") + private Boolean net; + + @Schema( description= "账号") + private String account; + + @Schema( description= "密码") + private String password; + + @Schema( description= "网点名称") + private String netName; + + @Schema( description= "排序") + private Integer sort; + + @Schema( description= "是否显示") + private Boolean isShow; + + @Schema( description= "是否可用") + private Boolean status; +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java index fa46ed6af..6af19f45a 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java @@ -34,7 +34,6 @@ import cn.iocoder.yudao.module.shop.request.order.StoreOrderUpdatePriceRequest; import cn.iocoder.yudao.module.shop.response.member.InitOrderResponse; import cn.iocoder.yudao.module.shop.response.order.*; import cn.iocoder.yudao.module.shop.service.express.ExpressService; -import cn.iocoder.yudao.module.shop.service.onepass.OnePassService; import cn.iocoder.yudao.module.shop.service.order.StoreOrderInfoService; import cn.iocoder.yudao.module.shop.service.order.StoreOrderRefundService; import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; From 4524c475f149a3a09c0925eb925b5a4c4caa45af Mon Sep 17 00:00:00 2001 From: perry <292303709@qq.com> Date: Thu, 18 May 2023 13:46:41 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-server/src/main/resources/application-dev.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/yudao-server/src/main/resources/application-dev.yaml b/yudao-server/src/main/resources/application-dev.yaml index cc95bc1ea..e4cafd6a9 100644 --- a/yudao-server/src/main/resources/application-dev.yaml +++ b/yudao-server/src/main/resources/application-dev.yaml @@ -1,7 +1,5 @@ server: port: 48080 - servlet: - context-path: /cyyywl-api --- #################### 数据库相关配置 #################### From 58f6be010839af64218baf531df40f10645ecc0e Mon Sep 17 00:00:00 2001 From: perry <292303709@qq.com> Date: Thu, 18 May 2023 14:01:20 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=8E=92=E9=99=A4=E7=A7=9F=E6=88=B7?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-server/src/main/resources/application.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/yudao-server/src/main/resources/application.yaml b/yudao-server/src/main/resources/application.yaml index be8bb9442..aa7bc2751 100644 --- a/yudao-server/src/main/resources/application.yaml +++ b/yudao-server/src/main/resources/application.yaml @@ -178,6 +178,7 @@ yudao: - infra_job_log - infra_job_log - infra_data_source_config + - infra_api_access_log - jimu_dict - jimu_dict_item - jimu_report From e007c7f2f6bbaab1b0fb2f206cc756f409c836ee Mon Sep 17 00:00:00 2001 From: perry <292303709@qq.com> Date: Thu, 18 May 2023 14:47:40 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E6=89=93=E5=8C=85=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-server/Dockerfile | 2 +- yudao-server/src/main/resources/application-local.yaml | 2 ++ yudao-server/src/main/resources/application-test.yaml | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/yudao-server/Dockerfile b/yudao-server/Dockerfile index 4dcd1e0d0..234081ad0 100644 --- a/yudao-server/Dockerfile +++ b/yudao-server/Dockerfile @@ -16,4 +16,4 @@ ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m" EXPOSE 48080 ## 启动后端项目 -CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar -Dspring.profiles.active=dev app.jar +CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 813f7d87f..0bbb845fc 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -1,5 +1,7 @@ server: port: 48080 + servlet: + context-path: /cyywl-api --- #################### 数据库相关配置 #################### diff --git a/yudao-server/src/main/resources/application-test.yaml b/yudao-server/src/main/resources/application-test.yaml index 371a21538..1383eea5b 100644 --- a/yudao-server/src/main/resources/application-test.yaml +++ b/yudao-server/src/main/resources/application-test.yaml @@ -1,7 +1,7 @@ server: port: 48080 servlet: - context-path: /admin-api + context-path: / --- #################### 数据库相关配置 ####################