From 4f02723956607fec235b7af776130d1042600481 Mon Sep 17 00:00:00 2001 From: xh-pan1 Date: Tue, 16 May 2023 17:17:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A1=B5=E9=9D=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-admin-dev.yml | 6 +- .../src/main/resources/application-admin-prod.yml | 10 +- .../mybatis/mapper/order/CereShopOrderDAO.xml | 2 +- .../mybatis/mapper/product/CereProductSkuDAO.xml | 30 +- .../app/controller/extend/XsPayController.java | 49 +++- .../cereshop/app/dao/buyer/CereBuyerUserDAO.java | 3 + .../cereshop/app/pay/xs/service/XsPayService.java | 13 +- .../app/pay/xs/service/impl/XsPayServiceImpl.java | 306 ++++++++++++++------- .../cereshop/app/redis/listener/RedisListener.java | 3 + .../app/service/buyer/CereBuyerUserService.java | 4 + .../buyer/impl/CereBuyerUserServiceImpl.java | 13 + .../cereshop/app/service/extend/HuaxunService.java | 2 +- .../app/service/extend/impl/HuaxunServiceImpl.java | 19 +- .../order/impl/CereShopOrderServiceImpl.java | 9 +- .../order/placeOrderTemplate/LaunchPlaceOrder.java | 2 +- .../order/placeOrderTemplate/NormalPlaceOrder.java | 3 +- .../placeOrderTemplate/PlaceOrderTemplate.java | 4 +- .../app/service/stock/CrossStockService.java | 4 +- .../service/stock/impl/CrossStockServiceImpl.java | 150 ++++++---- .../src/main/resources/application-app-dev.yml | 14 +- .../src/main/resources/application-app-prod.yml | 4 +- cereshop-app/src/main/resources/application.yml | 12 +- .../mybatis/mapper/buyer/CereBuyerUserDAO.xml | 29 +- .../mybatis/mapper/order/CereOrderProductDAO.xml | 25 +- .../mybatis/mapper/order/CereShopOrderDAO.xml | 8 +- .../business/controller/HuaxunController.java | 67 +++++ .../business/controller/XsPayController.java | 111 ++++++++ .../business/dao/buyer/CereBuyerUserDAO.java | 2 + .../business/dao/order/CereOrderProductDAO.java | 4 + .../business/dao/order/CereShopOrderDAO.java | 4 +- .../cereshop/business/param/product/SkuParam.java | 6 + .../pay/xs/service/impl/XsPayServiceImpl.java | 227 ++++++++------- .../service/buyer/CereBuyerUserService.java | 5 + .../buyer/impl/CereBuyerUserServiceImpl.java | 15 + .../business/service/extend/HuaxunService.java | 41 +++ .../service/extend/impl/HuaxunServiceImpl.java | 172 ++++++++++++ .../service/order/CereOrderDileverService.java | 8 + .../service/order/CereOrderProductService.java | 6 + .../order/impl/CereOrderDileverServiceImpl.java | 54 ++++ .../order/impl/CereOrderProductServiceImpl.java | 15 + .../main/resources/application-business-dev.yml | 15 +- .../main/resources/application-business-prod.yml | 6 +- .../main/resources/application-business-test.yml | 2 +- .../src/main/resources/application.yml | 12 +- .../mybatis/mapper/buyer/CereBuyerUserDAO.xml | 35 ++- .../mybatis/mapper/order/CereOrderProductDAO.xml | 10 + .../mybatis/mapper/order/CereShopOrderDAO.xml | 10 +- .../mybatis/mapper/product/CereProductSkuDAO.xml | 32 ++- .../shop/cereshop/commons/config/XspayConfig.java | 70 ++--- .../commons/domain/order/CereOrderProduct.java | 6 + .../commons/domain/product/CereProductSku.java | 6 + 51 files changed, 1325 insertions(+), 340 deletions(-) create mode 100644 cereshop-business/src/main/java/com/shop/cereshop/business/controller/HuaxunController.java create mode 100644 cereshop-business/src/main/java/com/shop/cereshop/business/controller/XsPayController.java create mode 100644 cereshop-business/src/main/java/com/shop/cereshop/business/service/extend/HuaxunService.java create mode 100644 cereshop-business/src/main/java/com/shop/cereshop/business/service/extend/impl/HuaxunServiceImpl.java diff --git a/cereshop-admin/src/main/resources/application-admin-dev.yml b/cereshop-admin/src/main/resources/application-admin-dev.yml index b4ac01d..d6c98b5 100644 --- a/cereshop-admin/src/main/resources/application-admin-dev.yml +++ b/cereshop-admin/src/main/resources/application-admin-dev.yml @@ -63,7 +63,7 @@ spring: max-idle: 400 min-idle: 0 #网站域名 - domain: https://ceres.zkthink.com + domain: http://122.9.152.120 #阿里云短信 aliyun: @@ -97,8 +97,8 @@ miaoxinyun: upload: type: LOCAL # 当前支持 ALI LOCAL 两种 - storage-path: /Users/yongzonghuang/Documents/uploadfile/file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) - uriPrefix: ${spring.domain}/local/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 + storage-path: /home/ceres/cereshop-file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) + uriPrefix: ${spring.domain}/ceres-local-file/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 alioss: file: diff --git a/cereshop-admin/src/main/resources/application-admin-prod.yml b/cereshop-admin/src/main/resources/application-admin-prod.yml index 0025321..e9bf173 100644 --- a/cereshop-admin/src/main/resources/application-admin-prod.yml +++ b/cereshop-admin/src/main/resources/application-admin-prod.yml @@ -20,9 +20,9 @@ spring: type: com.alibaba.druid.pool.DruidDataSource # url: jdbc:oracle:thin:@192.168.1.98:1521:orcl # 本地环境 - url: jdbc:mysql://localhost:3306/cereshop1.6?useUnicode=true&allowMultiQueries=true&serverTimezone=UTC&characterEncoding=UTF-8 + url: jdbc:mysql://localhost:3306/cereshop?useUnicode=true&allowMultiQueries=true&serverTimezone=UTC&characterEncoding=UTF-8 username: root - password: 123456 + password: chenmeiceres druid: driver-class-name: com.mysql.jdbc.Driver # driver-class-name: oracle.jdbc.driver.OracleDriver @@ -53,7 +53,7 @@ spring: redis: host: 127.0.0.1 port: 6379 - password: + password: chengmei database: 0 timeout: 10000 jedis: @@ -97,8 +97,8 @@ miaoxinyun: upload: type: LOCAL # 当前支持 ALI LOCAL 两种 - storage-path: /Users/yongzonghuang/Documents/uploadfile/file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) - uriPrefix: ${spring.domain}/local/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 + storage-path: /home/ceres/cereshop-file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) + uriPrefix: ${spring.domain}/ceres-local-file/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 alioss: file: diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml index 39fe13d..6f285b0 100644 --- a/cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml +++ b/cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml @@ -610,7 +610,7 @@ select sku_id, sum(number) as sales_volume from cere_shop_order a join cere_order_product b on b.order_id = a.order_id and a.payment_state = 1 and b.sku_id in - + #{skuId} group by b.sku_id diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml index bb51cdf..569e269 100644 --- a/cereshop-admin/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml +++ b/cereshop-admin/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml @@ -10,16 +10,18 @@ + + - sku_id, product_id,SKU, price, original_price, rate, storehouse_id, stock_number,total, weight, - sku_image, `style`, create_time, update_time + sku_id, product_id,SKU, price, original_price, rate, storehouse_id, stock_number, is_cross, total, weight, + sku_image, sku_code, `style`, create_time, update_time SELECT cps.product_id, cps.sku_id, - cps.price, cps.original_price, cps.rate, cps.storehouse_id, css.storehouse_name, cps.stock_number, cps.total, - cps.weight, cps.sku_image, cps.`style`, cps.SKU + cps.price, cps.original_price, cps.rate, cps.storehouse_id, css.storehouse_name, cps.stock_number, cps.is_cross, cps.total, + cps.weight, cps.sku_image, cps.`style`, cps.SKU, cps.sku_code FROM cere_product_sku cps LEFT JOIN cere_shop_storehouse css ON css.storehouse_id = cps.storehouse_id where cps.product_id=#{productId} diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/controller/extend/XsPayController.java b/cereshop-app/src/main/java/com/shop/cereshop/app/controller/extend/XsPayController.java index 90a20f8..2208f57 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/controller/extend/XsPayController.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/controller/extend/XsPayController.java @@ -1,10 +1,13 @@ package com.shop.cereshop.app.controller.extend; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; import com.shop.cereshop.app.pay.xs.domain.XsCallBackRequestVo; import com.shop.cereshop.app.pay.xs.service.XsPayService; import com.shop.cereshop.app.service.extend.HuaxunService; import com.shop.cereshop.app.service.order.CereShopOrderService; +import com.shop.cereshop.app.service.stock.CrossStockService; import com.shop.cereshop.commons.config.XspayConfig; import com.shop.cereshop.commons.constant.XsPayEnum; import com.shop.cereshop.commons.utils.EmptyUtils; @@ -39,6 +42,9 @@ public class XsPayController { @Autowired private CereShopOrderService cereShopOrderService; + + @Autowired + private CrossStockService crossStockService; /** * 支付通知回调 * @throws Exception @@ -55,12 +61,13 @@ public class XsPayController { JSONObject content = xsCallBackRequestVo.getContent(); String merOrderId = content.getString("merOrderId"); String[] split = merOrderId.split("-"); + String dealId = ""; if(!EmptyUtils.isEmpty(split)){ String orderFormId=split[0]; if(!EmptyUtils.isEmpty(orderFormId)){ //支付有礼 cereShopOrderService.payGift(orderFormId); - String dealId = content.getString("dealId"); + dealId = content.getString("dealId"); //处理支付成功后的其他逻辑 cereShopOrderService.handleWxLog(orderFormId, dealId, merOrderId); } @@ -68,12 +75,42 @@ public class XsPayController { } //TODO 如果不是跨境支付应该不调用改接口------pxh if(StringUtils.equals(XspayConfig.DEFUALT_TRADE_TYPE, XsPayEnum.TRADE_TYPE_CROSS_BOARD_PAYMENT.getCode())){ - String payRequestBodyJson = xsPayService.getPayRequestBodyJson(merOrderId, new BigDecimal(Integer.parseInt(content.getString("orderAmount")) * 1.0f / 100), - XsPayEnum.TRADE_TYPE_CROSS_BOARD_PAYMENT.getCode(), content.getString("payType")); - huaxunService.pushBaoguanRequest(payRequestBodyJson); +// String payRequestBodyJson = xsPayService.getPayRequestBodyJson(merOrderId, new BigDecimal(Integer.parseInt(content.getString("orderAmount")) * 1.0f / 100), +// XsPayEnum.TRADE_TYPE_CROSS_BOARD_PAYMENT.getCode(), content.getString("payType")); +// huaxunService.pushBaoguanRequest(payRequestBodyJson); +// +// String msgStr = new String(Base64.getDecoder().decode(msg)); +// huaxunService.pushBaoguanRespone(msgStr); + //新生报关 + xsPayService.requestBaoGuan(merOrderId, dealId); + //仓储报关 +// crossStockService.ibOrder(merOrderId); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } - String msgStr = new String(Base64.getDecoder().decode(msg)); - huaxunService.pushBaoguanRespone(msgStr); + /** + * 支付通知回调 + * @throws Exception + */ + @PostMapping("pay/baoguannotify") + public void payBaoGuanNotify(@RequestParam(name = "msg") String msg) throws Exception { + try { + XsCallBackRequestVo xsCallBackRequestVo = xsPayService.parseCallBackRequestVo(msg); + log.info(new Gson().toJson(xsCallBackRequestVo)); + String resultCode = xsCallBackRequestVo.getContent().getString("resultCode"); + //2成功 3失败 + if(StringUtils.equals(resultCode, "2")){ + log.info("新生支付回调成功"); + //截取订单编号 + JSONObject content = xsCallBackRequestVo.getContent(); + if(content.containsKey("subOrderNo")) { + crossStockService.ibOrder(content.getString("subOrderNo"), content.getString("payTransactionNo")); + }else { + crossStockService.ibOrder(content.getString("merOrderId"), content.getString("payTransactionNo")); } } } catch (Exception e) { diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerUserDAO.java b/cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerUserDAO.java index ae8980a..44537c3 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerUserDAO.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerUserDAO.java @@ -13,6 +13,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + @Mapper public interface CereBuyerUserDAO extends BaseMapper { int deleteByPrimaryKey(@Param("buyerUserId") Long buyerUserId); @@ -21,6 +23,7 @@ public interface CereBuyerUserDAO extends BaseMapper { CereBuyerUser selectByPrimaryKey(Long buyerUserId); + List selectByPrimaryKeyList(List buyerUserIdList); int updateByPrimaryKeySelective(CereBuyerUser record); diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java b/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java index 472895c..1f95144 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java @@ -2,6 +2,7 @@ package com.shop.cereshop.app.pay.xs.service; import com.shop.cereshop.app.pay.PayService; import com.shop.cereshop.app.pay.xs.domain.XsCallBackRequestVo; +import com.shop.cereshop.commons.exception.CoBusinessException; import java.math.BigDecimal; @@ -24,5 +25,15 @@ public interface XsPayService extends PayService { * @return * @throws Exception */ - String getPayRequestBodyJson(String orderFormid, BigDecimal money, String tradeType, String payType) throws Exception; + String getPayRequestBodyJson(String orderFormid, String payerAccount, BigDecimal money, String tradeType, String payType) throws Exception; + + /** + * 支付报关 + * @param orderFormid + * @param dealId + * @return + * @throws CoBusinessException + * @throws Exception + */ + void requestBaoGuan(String orderFormid, String dealId) throws CoBusinessException, Exception; } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java index d378bb8..e4f61ac 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java @@ -6,8 +6,11 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.parser.Feature; import com.alibaba.fastjson.serializer.SerializerFeature; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.google.gson.Gson; import com.shop.cereshop.app.dao.order.CereOrderProductDAO; import com.shop.cereshop.app.dao.order.CereShopOrderDAO; +import com.shop.cereshop.app.dao.shop.CereShopCrossDetailDAO; import com.shop.cereshop.app.pay.xs.domain.XsCallBackRequestVo; import com.shop.cereshop.app.pay.xs.domain.XsRequestBo; import com.shop.cereshop.app.pay.xs.service.XsPayService; @@ -20,6 +23,7 @@ import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; import com.shop.cereshop.commons.domain.order.CereOrderParent; import com.shop.cereshop.commons.domain.order.CereOrderProduct; import com.shop.cereshop.commons.domain.order.CereShopOrder; +import com.shop.cereshop.commons.domain.shop.CereShopCrossDetail; import com.shop.cereshop.commons.exception.CoBusinessException; import com.shop.cereshop.commons.utils.EmptyUtils; import com.shop.cereshop.commons.utils.StringUtils; @@ -48,13 +52,51 @@ public class XsPayServiceImpl implements XsPayService { @Autowired private CereOrderProductDAO cereOrderProductDAO; + @Autowired + private CereShopCrossDetailDAO cereShopCrossDetailDAO; + //支付申请服务代码 serCode private static final String PAY_SER_CODE = "101005"; //退款申请服务代码 serCode private static final String REFUND_SER_CODE = "101006"; + + private static final String BAOGUAN_SER_CODE = "101017"; @Override public Map gotoPay(String orderFormid, BigDecimal money, String openid, String ip, Integer type, Integer huabeiPeriod) throws CoBusinessException, Exception { + XsRequestBo xsRequestBo = getPayRequestBody(orderFormid, openid, money, XspayConfig.DEFUALT_TRADE_TYPE, + XsPayEnum.PAY_TYPE_JS.getCode()); + //head+content做md5并根据加签方式加密 + String msg = CommonUtils.getRequestMsg(xsRequestBo.getHead(),xsRequestBo.getContent()); + log.info("请求地址:url="+XspayConfig.URL); + log.info("【" + PAY_SER_CODE + "】接口-请求报文:msg="+msg); + + String respMsg = HttpUtils.httpPost(XspayConfig.URL,msg); + //若响应respMsg为空时联系新生工作人员,此处因时收银台模式,前端页面提交方式,当时错误时,错误信息会重定向到其他页面展示 + log.info("【" + PAY_SER_CODE + "】接口-响应报文:" + respMsg); + + if(StrUtil.isNotBlank(respMsg)){ + try { + //解析响应报文并验签 + CommonUtils.verifySignRespMsg(PAY_SER_CODE,respMsg); + LinkedHashMap responseMap = JSONObject.parseObject(respMsg,new TypeReference>(){}, Feature.OrderedField ); + String resMsg = responseMap.get("msg"); + String responeMsg = new String(Base64.getDecoder().decode(resMsg)); + JSONObject jsonObject = JSONObject.parseObject(responeMsg); + JSONObject payInfoObject = jsonObject.getJSONObject("content").getJSONObject("payInfo"); + return JSONObject.parseObject(payInfoObject.toJSONString(),LinkedHashMap.class, Feature.OrderedField); + } catch (CoBusinessException e) { + throw e; + } catch (Exception e) { + //支付方式为B2C、B2B、H5,成功响应时respMsg为html页面代码 + if(respMsg.contains("toNativePayIndexForm")){ + log.info("【" + PAY_SER_CODE + "】接口-响应报文-HTML代码无需验签"); + }else{ + e.printStackTrace(); + } + throw new CoBusinessException("10000","获取支付二维码出错"); + } + } return null; } @@ -69,7 +111,7 @@ public class XsPayServiceImpl implements XsPayService { //构建请求参数 Map headMap = CommonUtils.buildHeadMap(REFUND_SER_CODE); - Map contentMap = buildOrderRefundContentMap(outTradeNo, transactionId, total, XspayConfig.APP_NOTICE_URL); + Map contentMap = build06ContentMap(outTradeNo, transactionId, refund, XspayConfig.APP_NOTICE_URL); //head+content做md5并根据加签方式加密 String msg = CommonUtils.getRequestMsg(headMap, contentMap); log.info("【" + PAY_SER_CODE + "】接口-请求报文:msg="+msg); @@ -154,9 +196,10 @@ public class XsPayServiceImpl implements XsPayService { //获取订单二维码 @Override public String getOrderCollectionCode(String orderFormid, BigDecimal money, String ip, String tradeType) throws CoBusinessException, Exception { - XsRequestBo xsRequestBo = getPayRequestBody(orderFormid, money, tradeType, XsPayEnum.PAY_TYPE_QRCODE.getCode()); + XsRequestBo xsRequestBo = getPayRequestBody(orderFormid, "", money, tradeType, XsPayEnum.PAY_TYPE_QRCODE.getCode()); //head+content做md5并根据加签方式加密 String msg = CommonUtils.getRequestMsg(xsRequestBo.getHead(),xsRequestBo.getContent()); + log.info("请求地址:url="+XspayConfig.URL); log.info("【" + PAY_SER_CODE + "】接口-请求报文:msg="+msg); String respMsg = HttpUtils.httpPost(XspayConfig.URL,msg); @@ -190,14 +233,14 @@ public class XsPayServiceImpl implements XsPayService { } @Override - public String getPayRequestBodyJson(String outTradeNo, BigDecimal money, String tradeType, String payType) throws Exception { - XsRequestBo xsRequestBo = getPayRequestBody(outTradeNo, money, tradeType, payType); + public String getPayRequestBodyJson(String outTradeNo, String payerAccount,BigDecimal money, String tradeType, String payType) throws Exception { + XsRequestBo xsRequestBo = getPayRequestBody(outTradeNo, payerAccount, money, tradeType, payType); //json字符串 String jsonString = JSONObject.toJSONString(xsRequestBo); return jsonString; } - public XsRequestBo getPayRequestBody(String orderFormId, BigDecimal money, String tradeType, String payType) throws CoBusinessException, Exception { + public XsRequestBo getPayRequestBody(String orderFormId, String payerAccount, BigDecimal money, String tradeType, String payType) throws CoBusinessException, Exception { List orderList = null; String cereOrderFormId = orderFormId; @@ -220,14 +263,16 @@ public class XsPayServiceImpl implements XsPayService { throw new CoBusinessException("10000","订单查找出错"); } - CereBuyerUser user = cereBuyerUserService.selectByBuyerUserId(orderList.get(0).getBuyerUserId()); + log.info("orderList:" + new Gson().toJson(orderList)); - List cereOrderProductList = cereOrderProductDAO.findByOrderIds(orderList.stream().map(CereShopOrder::getId).collect(Collectors.toList())); + CereBuyerUser user = cereBuyerUserService.selectByBuyerUserId(orderList.get(0).getBuyerUserId()); + List cereOrderProductList = cereOrderProductDAO.findByOrderIds(orderList.stream().map(CereShopOrder::getOrderId).collect(Collectors.toList())); + log.info("cereOrderProductList:" + new Gson().toJson(cereOrderProductList)); //构建请求参数 Map headMap = CommonUtils.buildHeadMap(PAY_SER_CODE); - Map contentMap = buildPayContentMap(orderFormId, user, orderList, cereOrderProductList, + Map contentMap = build05ContentMap(orderFormId, payerAccount, user, orderList, cereOrderProductList, money, tradeType, payType, XspayConfig.APP_RETURN_URL, XspayConfig.APP_NOTICE_URL); @@ -238,45 +283,41 @@ public class XsPayServiceImpl implements XsPayService { } /** - * 构建content请求参数 + * 构建退款content请求参数 * @return */ - private static Map buildOrderRefundContentMap(String orderFormid, String dealId, BigDecimal money, String noticeUrl){ + private static Map build06ContentMap(String orderFormid, String dealId, BigDecimal money, String noticeUrl){ Map contentMap = new LinkedHashMap<>(); contentMap.put("merOrderId", System.currentTimeMillis()+""); //oldMerOrderId 对应 101004、101005接口中merOrderId contentMap.put("oldMerOrderId", orderFormid); //oldDealId 对应 101004、101005接口响应参数中dealId - contentMap.put("oldDealId", dealId); - contentMap.put("amount", 1);//money.multiply(new BigDecimal(100)).intValue()); +// contentMap.put("oldDealId", dealId); + contentMap.put("amount", money.multiply(new BigDecimal(100)).intValue()); contentMap.put("currency", "CNY"); contentMap.put("noticeUrl", noticeUrl); return contentMap; } - /** - * 构建content请求参数 - * @return - */ - private static Map buildPayContentMap(String orderFormid, CereBuyerUser user, List orderList, - List cereOrderProductList, BigDecimal money, String tradeType, - String payType, String returnUrl, String noticeUrl){ + /** + * 构建支付content请求参数 + * @return + */ + private static Map build05ContentMap(String orderFormid, String payerAccount, CereBuyerUser user, List orderList, + List cereOrderProductList, BigDecimal money, String tradeType, + String payType, String returnUrl, String noticeUrl){ // 设置请求正文 contentMap有序,顺序按照文档从上到下,为空字段可不传该字段 Map contentMap = new LinkedHashMap<>(); //商户订单号 contentMap.put("merOrderId", orderFormid); - //商户名称 请根据实际情况替换 contentMap.put("displayName", "成美国际"); - - //TODO 商品名称 - //商品名称 请根据实际情况替换 + //商品名称 请根据实际情况替换--有子订单了,这个商品名称就随便了吧 contentMap.put("goodsName", "商品名称"); //商品数量 请根据实际情况替换 contentMap.put("goodsCount", 1); //商品类别 请根据实际情况替换 contentMap.put("goodsType", "01"); - //订单金额单位分 contentMap.put("orderAmount", money.multiply(new BigDecimal(100)).intValue()); //订单币种 CNY:人民币 @@ -288,7 +329,7 @@ public class XsPayServiceImpl implements XsPayService { //机构代码 contentMap.put("orgCode", "WECHATPAY"); //payerAccount -// contentMap.put("payerAccount", "omCqSs9K_z2sgvgGeIzEi5gjyL6k"); + contentMap.put("payerAccount", payerAccount); //交易币种 CNY:人民币 contentMap.put("payCurrencyCode", "CNY"); //结算币种 CNY:人民币 @@ -297,17 +338,16 @@ public class XsPayServiceImpl implements XsPayService { contentMap.put("shareFlag", "0"); //分账订单信息 shangFlag=1时必填 JSONArray jsonArray = buildSubMerchantOrderDetails(orderList, cereOrderProductList); - contentMap.put("subMerchantOrderDetails", JSONArray.toJSONString(jsonArray)); - + if(jsonArray != null) { + contentMap.put("subMerchantOrderDetails", JSONArray.toJSONString(jsonArray)); + } //回调地址--支付成功后的前端回调地址,先写死首页 contentMap.put("returnUrl", returnUrl); //通知地址 contentMap.put("noticeUrl", noticeUrl); - //平台ID-平台型支付的时候使用 contentMap.put("platformId",""); - - //商户用户号 请根据实际情况选择填写 TODO 这个先写死,但是应该要根据订单的支付人来传值 + //商户用户号 请根据实际情况选择填写 contentMap.put("customerId", user.getBuyerUserId() + ""); //商户用户类型 请根据实际情况选择填写 contentMap.put("customerType", "1"); @@ -317,24 +357,23 @@ public class XsPayServiceImpl implements XsPayService { contentMap.put("customerIdNo", user.getIdCard()); //商户用户手机号 请根据实际情况选择填写 contentMap.put("customerTel", user.getPhone()); - //以下信息在支付类型为快捷支付的时候必填 - //商户用户银行卡号 - contentMap.put("bankCardNo", ""); - //商户用户银行卡类型 - contentMap.put("bankCardType", ""); - //有效期 - contentMap.put("expireData", ""); - //信用卡安全码 - contentMap.put("cvn", ""); - //备注 - contentMap.put("remark", ""); - //保留字段1 - contentMap.put("reserve1", ""); +// //商户用户银行卡号 +// contentMap.put("bankCardNo", ""); +// //商户用户银行卡类型 +// contentMap.put("bankCardType", ""); +// //有效期 +// contentMap.put("expireData", ""); +// //信用卡安全码 +// contentMap.put("cvn", ""); +// //备注 +// contentMap.put("remark", ""); +// //保留字段1 +// contentMap.put("reserve1", ""); //保留字段2 若要指定使用某条公众号/小程序appid时,可填写appid或对应备案号 - contentMap.put("reserve2", ""); - //预下单标识 - contentMap.put("preOrderFlag", ""); + contentMap.put("reserve2", XspayConfig.wxAppid); +// //预下单标识 +// contentMap.put("preOrderFlag", ""); return contentMap; } @@ -344,10 +383,13 @@ public class XsPayServiceImpl implements XsPayService { */ private static JSONArray buildSubMerchantOrderDetails(List orderList, List cereOrderProductList){ + if(cereOrderProductList.isEmpty()){ + return null; + } JSONArray jsonArray = new JSONArray(); for (CereShopOrder cereShopOrder : orderList) { JSONObject subOrder1 = new JSONObject(); - subOrder1.put("subOrderId",cereShopOrder.getOrderId()); + subOrder1.put("subOrderId",cereShopOrder.getOrderFormid()); subOrder1.put("subOrderAmount", cereShopOrder.getPrice()); List orderProductList = cereOrderProductList.stream().filter(item -> item.getOrderId().equals(cereShopOrder.getOrderId())).collect(Collectors.toList()); @@ -361,7 +403,7 @@ public class XsPayServiceImpl implements XsPayService { detail1.put("settleCurCode","CNY"); detailArray1.add(detail1); } - + jsonArray.add(subOrder1); } return jsonArray; @@ -404,80 +446,149 @@ public class XsPayServiceImpl implements XsPayService { //推单接口 - public String aaa(String orderFormid, BigDecimal money, String ip, String tradeType) throws CoBusinessException, Exception { - XsRequestBo xsRequestBo = getPayRequestBody(orderFormid, money, tradeType, XsPayEnum.PAY_TYPE_QRCODE.getCode()); + @Override + public void requestBaoGuan(String orderFormid, String dealId) throws CoBusinessException, Exception { + + List orderList = null; + + String cereOrderFormId = orderFormid; + String[] split = orderFormid.split("-"); + if(!EmptyUtils.isEmpty(split)) { + cereOrderFormId = split[0]; + } + log.info("orderFormid:" + orderFormid); + log.info("cereOrderFormId:" + cereOrderFormId); + + //查询是否为父订单编号 + CereOrderParent parent = cereShopOrderDAO.findByParentFormid(cereOrderFormId); + if (parent != null) { + //查询所有子订单数据 + orderList = cereShopOrderDAO.findByParentId(parent.getParentId()); + + } else { + //子订单支付回调 + orderList = cereShopOrderDAO.findByFormid(cereOrderFormId); + } + + if(orderList.isEmpty()){ + throw new CoBusinessException("10000","订单查找出错"); + } + + if(orderList.stream().noneMatch(item -> item.getIsCross() != null && item.getIsCross() == 1)){ + return; + } + + //只报关跨境订单 + orderList = orderList.stream().filter(item -> item.getIsCross() != null && item.getIsCross() == 1).collect(Collectors.toList()); + + CereBuyerUser user = cereBuyerUserService.selectByBuyerUserId(orderList.get(0).getBuyerUserId()); + + List cereOrderProductList = cereOrderProductDAO.findByOrderIds(orderList.stream().map(CereShopOrder::getOrderId).collect(Collectors.toList())); + + CereShopCrossDetail cereShopCrossDetail = cereShopCrossDetailDAO.selectOne(Wrappers.lambdaQuery() + .eq(CereShopCrossDetail::getShopId, orderList.get(0).getShopId())); + + if(cereShopCrossDetail == null){ + throw new CoBusinessException("10000","商家没有开通跨境电商服务,请联系商家"); + } + + + Map headMap = CommonUtils.buildHeadMap(BAOGUAN_SER_CODE); + + Map contentMap = build17ContentMap(orderFormid, dealId, user, orderList, cereOrderProductList, cereShopCrossDetail); //head+content做md5并根据加签方式加密 - String msg = CommonUtils.getRequestMsg(xsRequestBo.getHead(),xsRequestBo.getContent()); - log.info("【" + PAY_SER_CODE + "】接口-请求报文:msg="+msg); + String msg = CommonUtils.getRequestMsg(headMap, contentMap); + log.info("【" + BAOGUAN_SER_CODE + "】接口-请求报文:msg="+msg); String respMsg = HttpUtils.httpPost(XspayConfig.URL,msg); //若响应respMsg为空时联系新生工作人员,此处因时收银台模式,前端页面提交方式,当时错误时,错误信息会重定向到其他页面展示 - log.info("【" + PAY_SER_CODE + "】接口-响应报文:" + respMsg); + log.info("【" + BAOGUAN_SER_CODE + "】接口-响应报文:" + respMsg); if(StrUtil.isNotBlank(respMsg)){ try { //解析响应报文并验签 - CommonUtils.verifySignRespMsg(PAY_SER_CODE,respMsg); - LinkedHashMap responseMap = JSONObject.parseObject(respMsg,new TypeReference>(){}, Feature.OrderedField ); - String resMsg = responseMap.get("msg"); - String responeMsg = new String(Base64.getDecoder().decode(resMsg)); - JSONObject jsonObject = JSONObject.parseObject(responeMsg); - String qrCodeUrl = jsonObject.getJSONObject("content").getJSONObject("payInfo").getString("qrCodeUrl"); - qrCodeUrl = new URIBuilder(qrCodeUrl).getQueryParams().get(0).getValue(); - return qrCodeUrl; + CommonUtils.verifySignRespMsg(BAOGUAN_SER_CODE,respMsg); +// LinkedHashMap responseMap = JSONObject.parseObject(respMsg,new TypeReference>(){}, Feature.OrderedField ); +// String resMsg = responseMap.get("msg"); +// String responeMsg = new String(Base64.getDecoder().decode(resMsg)); +// JSONObject jsonObject = JSONObject.parseObject(responeMsg); +// String qrCodeUrl = jsonObject.getJSONObject("content").getJSONObject("payInfo").getString("qrCodeUrl"); +// qrCodeUrl = new URIBuilder(qrCodeUrl).getQueryParams().get(0).getValue(); } catch (CoBusinessException e) { throw e; } catch (Exception e) { //支付方式为B2C、B2B、H5,成功响应时respMsg为html页面代码 if(respMsg.contains("toNativePayIndexForm")){ - log.info("【" + PAY_SER_CODE + "】接口-响应报文-HTML代码无需验签"); + log.info("【" + BAOGUAN_SER_CODE + "】接口-响应报文-HTML代码无需验签"); }else{ e.printStackTrace(); } - throw new CoBusinessException("10000","获取支付二维码出错"); + throw new CoBusinessException("10000","支付单报关出错"); } } - return null; } /** - * 构建content请求参数 + * 构建报关content请求参数 * @return */ - private static Map build17ContentMap(){ + private Map build17ContentMap(String merOrderId, String dealId, CereBuyerUser user, List orderList, + List cereOrderProductList, CereShopCrossDetail cereShopCrossDetail) throws CoBusinessException { + + // 设置请求正文 contentMap有序,顺序按照文档从上到下,为空字段可不传该字段 Map contentMap = new LinkedHashMap<>(); contentMap.put("eportCode", "00"); //商户订单号(对应101004、101005接口中merOrderId,主订单推送时,该订单号推送至海关) - contentMap.put("merOrderId", System.currentTimeMillis()+""); + contentMap.put("merOrderId", merOrderId); //订单币种 contentMap.put("currencyCode", "CNY"); + //电商平台备案号 备案号需登录新生商户后台配置 - contentMap.put("eCompanyCode", "2102960L0U"); //电商平台备案名称 备案名称需登录新生商户后台配置 - contentMap.put("eCompanyName", "大连小洋伞国际贸易有限公司"); + + //电商平台备案号 备案号需登录新生商户后台配置 +// contentMap.put("eCompanyCode", "46016601J4"); +// //电商平台备案名称 备案名称需登录新生商户后台配置 +// contentMap.put("eCompanyName", "得壹(海南)科技有限公司"); + //电商平台备案号 备案号需登录新生商户后台配置 + if(StringUtils.isEmpty(XspayConfig.DEFAULT_COMPANY_CODE)){ + contentMap.put("eCompanyCode", cereShopCrossDetail.getEbpcode()); + }else { + contentMap.put("eCompanyCode", XspayConfig.DEFAULT_COMPANY_CODE); + } + if(StringUtils.isEmpty(XspayConfig.DEFAULT_COMPANY_NAME)){ + contentMap.put("eCompanyName", cereShopCrossDetail.getEbpname()); + }else { + //电商平台备案名称 备案名称需登录新生商户后台配置 + contentMap.put("eCompanyName", XspayConfig.DEFAULT_COMPANY_NAME); + } //海关关区代码 - contentMap.put("customsCode", "5165"); +// contentMap.put("customsCode", "6409"); //进口类型 contentMap.put("intype", "1"); //支付交易号 对应101004、101005接口响应dealId字段 - contentMap.put("payTransactionNo", "1022204040009067712"); + contentMap.put("payTransactionNo", dealId); //操作类型 1-新增 contentMap.put("actionType", "1"); //支付人姓名 支付人信息需与101004、101005接口中付款人信息一致 - contentMap.put("payerName", "廖文聪"); + contentMap.put("payerName", user.getRealName()); //支付人证件类型 01-身份证 contentMap.put("payerType", "01"); //支付人证件号码 支付人信息需与101004、101005接口中付款人信息一致 - contentMap.put("payerId", "441324198806092351"); + contentMap.put("payerId", user.getIdCard()); //支付人手机号 - contentMap.put("payerPhoneNumber", "13413034683"); + contentMap.put("payerPhoneNumber", user.getPhone()); + log.info("orderList:" + new Gson().toJson(orderList)); + log.info("cereOrderProductList:" + new Gson().toJson(cereOrderProductList)); //订单明细 拆单报关时使用该字段 - JSONArray jsonArray = buildOrderDetails(); - contentMap.put("orderDetails", JSONArray.toJSONString(jsonArray)); + JSONArray jsonArray = build17OrderDetails(orderList, cereOrderProductList); + if(jsonArray != null) { + contentMap.put("orderDetails", JSONArray.toJSONString(jsonArray)); + } //通知地址 - contentMap.put("noticeUrl", "http://lcoalhost:8080/gatewayTest/notify"); + contentMap.put("noticeUrl", XspayConfig.APP_BAOGUAN_NOTICE_URL); return contentMap; } @@ -485,22 +596,33 @@ public class XsPayServiceImpl implements XsPayService { * 构建子订单明细 * @return */ - private static JSONArray buildOrderDetails(){ + private static JSONArray build17OrderDetails(List orderList, List cereOrderProductList){ + if(cereOrderProductList.isEmpty()){ + return null; + } JSONArray jsonArray = new JSONArray(); - //子订单1 - JSONObject detail1 = new JSONObject(); - detail1.put("subOrderNo",System.currentTimeMillis()+"");//商户子订单号(拆单报关时,该订单号推送至海关) - detail1.put("payAmount",100);//单位为分,与订单币种一致币种 - detail1.put("goodsName","商品名称");//商品名称 - detail1.put("goodsCount","1");//商品数量 - jsonArray.add(detail1); - //子订单2 - JSONObject detail2 = new JSONObject(); - detail2.put("subOrderNo",System.currentTimeMillis()+"1");//商户子订单号(拆单报关时,该订单号推送至海关) - detail2.put("payAmount",200);//单位为分,与订单币种一致币种 - detail2.put("goodsName","商品名称");//商品名称 - detail2.put("goodsCount","1");//商品数量 - jsonArray.add(detail2); + for (CereShopOrder cereShopOrder : orderList) { + JSONObject subOrder1 = new JSONObject(); + subOrder1.put("subOrderNo",cereShopOrder.getOrderFormid()); + subOrder1.put("payAmount", cereShopOrder.getPrice().multiply(new BigDecimal(100)).intValue()); + + List orderProductList = cereOrderProductList.stream().filter(item -> item.getOrderId().equals(cereShopOrder.getOrderId())).collect(Collectors.toList()); +// JSONArray detailArray1 = new JSONArray(); +// for (CereOrderProduct cereOrderProduct : orderProductList) { +// //子订单1 明细1 +// JSONObject detail1 = new JSONObject(); +//// detail1.put("shareDetailId","" + cereOrderProduct.getOrderId() + cereOrderProduct.getOrderProductId()); +//// detail1.put("shareParId",cereShopOrder.getShopId() + ""); +//// detail1.put("shareAmount",cereOrderProduct.getActualPrice()); +//// detail1.put("settleCurCode","CNY"); +// detail1.put("goodsName", cereOrderProduct.getProductName()); +// detail1.put("goodsCount", cereOrderProduct.getNumber()); +// detailArray1.add(detail1); +// } + subOrder1.put("goodsName", orderProductList.get(0).getProductName()); + subOrder1.put("goodsCount", orderProductList.stream().map(CereOrderProduct::getNumber).reduce((x, y) -> x += y)); + jsonArray.add(subOrder1); + } return jsonArray; } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/redis/listener/RedisListener.java b/cereshop-app/src/main/java/com/shop/cereshop/app/redis/listener/RedisListener.java index 6291b63..7b30011 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/redis/listener/RedisListener.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/redis/listener/RedisListener.java @@ -251,6 +251,9 @@ public class RedisListener extends KeyExpirationEventMessageListener { Long orderId=Long.parseLong(id); //更新订单状态为已关闭 CereShopOrder order=cereShopOrderService.findById(orderId); + if(order == null){ + return; + } if (IntegerEnum.ORDER_STOP.getCode().equals(order.getState())) { return; } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerUserService.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerUserService.java index ecd8dcc..85d06a6 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerUserService.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerUserService.java @@ -19,12 +19,16 @@ import com.shop.cereshop.commons.domain.common.Page; import com.shop.cereshop.commons.domain.common.PageParam; import com.shop.cereshop.commons.exception.CoBusinessException; +import java.util.List; + public interface CereBuyerUserService { CereBuyerUser findByToken(String token); CereBuyerUser selectByBuyerUserId(Long buyerUserId); + List selectByBuyerUserIdList(List buyerUserIdList); + BuyerUser wxLogin(LoginParam param) throws CoBusinessException; BuyerUser alipayLogin(LoginParam param) throws CoBusinessException; diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerUserServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerUserServiceImpl.java index cddf5a3..9ca96b5 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerUserServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerUserServiceImpl.java @@ -200,6 +200,19 @@ public class CereBuyerUserServiceImpl implements CereBuyerUserService { } @Override + public List selectByBuyerUserIdList(List buyerUserIdList) { + List cereBuyerUserList = cereBuyerUserDAO.selectByPrimaryKeyList(buyerUserIdList); + if(cereBuyerUserList != null){ + for (CereBuyerUser cereBuyerUser : cereBuyerUserList) { + if (cereBuyerUser != null && cereBuyerUser.getWechatName() == null) { + cereBuyerUser.setWechatName(cereBuyerUser.getName()); + } + } + } + return cereBuyerUserList; + } + + @Override @Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) public BuyerUser wxLogin(LoginParam param) throws CoBusinessException { BuyerUser user=null; diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/HuaxunService.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/HuaxunService.java index 67fc3bc..461ab71 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/HuaxunService.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/HuaxunService.java @@ -37,7 +37,7 @@ public interface HuaxunService { List queryOrder(HuaxunOrderRequestBo bo) throws UnsupportedEncodingException, CoBusinessException; /** - * 物料消息接收 + * 物流消息接收 * @param bo * @return */ diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/impl/HuaxunServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/impl/HuaxunServiceImpl.java index 67a8f25..517aac9 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/impl/HuaxunServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/impl/HuaxunServiceImpl.java @@ -8,9 +8,11 @@ package com.shop.cereshop.app.service.extend.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.google.gson.Gson; import com.shop.cereshop.app.dao.order.CereShopOrderDAO; +import com.shop.cereshop.app.service.buyer.CereBuyerUserService; import com.shop.cereshop.app.service.extend.HuaxunService; import com.shop.cereshop.app.service.order.CereOrderProductService; import com.shop.cereshop.commons.config.HuaxunConfig; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; import com.shop.cereshop.commons.domain.express.HttpResult; import com.shop.cereshop.commons.domain.huaxun.*; import com.shop.cereshop.commons.domain.order.CereOrderProduct; @@ -47,6 +49,9 @@ public class HuaxunServiceImpl implements HuaxunService { @Autowired private CereOrderProductService cereOrderProductService; + @Autowired + private CereBuyerUserService cereBuyerUserService; + @Override public boolean pushBaoguanRequest(String request){ HuaxunPayBaoGuanRequestBo bo = new HuaxunPayBaoGuanRequestBo(); @@ -89,20 +94,26 @@ public class HuaxunServiceImpl implements HuaxunService { LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); wrapper.eq(CereShopOrder::getPaymentState, 1) .eq(CereShopOrder::getState, 2) + .eq(CereShopOrder::getIsCross, 1) .ge(CereShopOrder::getPaymentTime, bo.getPayStartTime()) .lt(CereShopOrder::getPaymentTime, bo.getPayEndTime()); List shopOrderList = cereShopOrderDAO.selectList(wrapper); if(shopOrderList != null && !shopOrderList.isEmpty()){ List opList = cereOrderProductService.findByOrderIds(shopOrderList.stream().map(CereShopOrder::getOrderId).collect(Collectors.toList())); + List buyerUserList = cereBuyerUserService.selectByBuyerUserIdList(shopOrderList.stream().map(CereShopOrder::getBuyerUserId).collect(Collectors.toList())); orderListVos.addAll(shopOrderList.stream().map(shopOrder -> { OrderListVo orderListVo = new OrderListVo(); orderListVo.setOrder_no(shopOrder.getOrderFormid()); orderListVo.setPay_amount(shopOrder.getOrderPrice().toPlainString()); - orderListVo.setBuyer_name(shopOrder.getCustomerName()); - //TODO 需要补充订购人的身份证号码------pxh - orderListVo.setBuyer_idcard("460004198911216054"); - orderListVo.setBuyer_mobile(shopOrder.getCustomerPhone()); + CereBuyerUser buyerUser = buyerUserList.stream().filter(item -> item.getBuyerUserId().equals(shopOrder.getBuyerUserId())).findFirst().orElse(null); + if(buyerUser != null){ + orderListVo.setBuyer_name(buyerUser.getRealName()); + orderListVo.setBuyer_idcard(buyerUser.getIdCard()); + orderListVo.setBuyer_mobile(buyerUser.getPhone()); + }else { + log.info("华讯查询订单:查询不到对应的购买人"); + } orderListVo.setConsignee_name(shopOrder.getReceiveName()); orderListVo.setConsignee_mobile(shopOrder.getReceivePhone()); orderListVo.setConsignee_address(shopOrder.getReceiveAdress() + shopOrder.getAddress()); diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java index d47e7dd..cea829f 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java @@ -506,12 +506,15 @@ public class CereShopOrderServiceImpl implements CereShopOrderService { shopIds = cereShopOrderDAO.findShopId(param.getOrderId()); } System.out.println("支付订单号为:" + orderFormId); + int paymentMode = param.getPaymentMode(); //调用支付接口 - PayService payService = PayFactory.getPayService(param.getPaymentMode()); + if(PayConfig.paymentMode == IntegerEnum.ORDER_PAY_XS.getCode()){ + paymentMode = IntegerEnum.ORDER_PAY_XS.getCode(); + } + PayService payService = PayFactory.getPayService(paymentMode); String openId = user.getWechatOpenId(); - if (Arrays.asList(IntegerEnum.ORDER_PAY_ALI.getCode(), - IntegerEnum.ORDER_PAY_HUABEI.getCode()).contains(param.getPaymentMode())) { + if (Arrays.asList(IntegerEnum.ORDER_PAY_ALI.getCode(), IntegerEnum.ORDER_PAY_HUABEI.getCode()).contains(param.getPaymentMode())) { openId = user.getAliUserId(); } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/LaunchPlaceOrder.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/LaunchPlaceOrder.java index 6a17593..82e1747 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/LaunchPlaceOrder.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/LaunchPlaceOrder.java @@ -281,7 +281,7 @@ public class LaunchPlaceOrder extends PlaceOrderTemplate { //插入订单数据 cereShopOrderDAO.insert(order); //新增订单商品数据 - addOrderProduct(skus, order.getOrderId(), shop.getShopId(), map, attributes); + addOrderProduct(skus, order.getOrderId(), shop.getShopId(), shop.getUniqueId(), map, attributes); Long collageId = param.getCollageId(); if (EmptyUtils.isEmpty(param.getCollageId())) { //生成拼单数据 diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/NormalPlaceOrder.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/NormalPlaceOrder.java index 09f63fb..01e8e2b 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/NormalPlaceOrder.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/NormalPlaceOrder.java @@ -571,8 +571,9 @@ public class NormalPlaceOrder extends PlaceOrderTemplate { order.setBuyerUserId(user.getBuyerUserId()); //插入订单数据 cereShopOrderDAO.insert(order); + log.info("addOrderProduct"); //新增订单商品数据 - addOrderProduct(skus, order.getOrderId(), shop.getShopId(), map, attributes); + addOrderProduct(skus, order.getOrderId(), shop.getShopId(), shop.getUniqueId(), map, attributes); //设置30分钟延时自动取消订单,并且释放库存 stringRedisService.set(StringEnum.ORDER_AUTOMATIC_CANCEL.getCode() + "-" + order.getOrderId(), 1, 30 * 60 * 1000); //新增延时任务记录 diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java index 9646778..e72ee2c 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java @@ -730,11 +730,11 @@ public abstract class PlaceOrderTemplate { * @param attributes * @throws CoBusinessException */ - protected void addOrderProduct(List skus, Long orderId, Long shopId, + protected void addOrderProduct(List skus, Long orderId, Long shopId,Long uniqueId, Map map, List attributes) throws CoBusinessException { if (!EmptyUtils.isEmpty(skus)) { for (CartSku sku : skus) { - if (sku.getShopId().equals(shopId)) { + if (sku.getUniqueId().equals(uniqueId)) { CereOrderProduct orderProduct = new CereOrderProduct(); BeanUtils.copyProperties(sku, orderProduct); diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/stock/CrossStockService.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/stock/CrossStockService.java index 74212b3..a0e9e5f 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/stock/CrossStockService.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/stock/CrossStockService.java @@ -13,7 +13,7 @@ public interface CrossStockService { /** * 仓储推关 - * @param orderFormId + * @param orderNo */ - void ibOrder(String orderFormId) throws CoBusinessException; + void ibOrder(String orderNo, String payTransactionNo) throws CoBusinessException; } diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/stock/impl/CrossStockServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/stock/impl/CrossStockServiceImpl.java index a9f4d3e..d251ade 100644 --- a/cereshop-app/src/main/java/com/shop/cereshop/app/service/stock/impl/CrossStockServiceImpl.java +++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/stock/impl/CrossStockServiceImpl.java @@ -5,30 +5,31 @@ */ package com.shop.cereshop.app.service.stock.impl; -import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; import com.shop.cereshop.app.dao.order.CereOrderProductDAO; import com.shop.cereshop.app.dao.order.CereShopOrderDAO; import com.shop.cereshop.app.dao.shop.CereShopCrossDetailDAO; import com.shop.cereshop.app.dao.storehouse.CereShopStorehouseDAO; +import com.shop.cereshop.app.domain.stock.IbOrderItemRequestBo; import com.shop.cereshop.app.domain.stock.NewIbOrderRequestBo; -import com.shop.cereshop.app.page.cart.CartSku; import com.shop.cereshop.app.service.buyer.CereBuyerUserService; import com.shop.cereshop.app.service.order.CereOrderProductService; import com.shop.cereshop.app.service.stock.CrossStockService; import com.shop.cereshop.commons.config.CrossStockConfig; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; import com.shop.cereshop.commons.domain.express.HttpResult; -import com.shop.cereshop.commons.domain.order.CereOrderParent; +import com.shop.cereshop.commons.domain.order.CereOrderProduct; import com.shop.cereshop.commons.domain.order.CereShopOrder; -import com.shop.cereshop.commons.domain.shop.CereShopCrossDetail; -import com.shop.cereshop.commons.domain.storehouse.CereShopStorehouse; import com.shop.cereshop.commons.exception.CoBusinessException; -import com.shop.cereshop.commons.utils.EmptyUtils; import com.shop.cereshop.commons.utils.HttpUtils; import com.shop.cereshop.commons.utils.StringUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; @@ -58,56 +59,111 @@ public class CrossStockServiceImpl implements CrossStockService{ @Override - public void ibOrder(String orderFormId) throws CoBusinessException { - List orderList = null; - String cereOrderFormId = orderFormId; - String[] split = orderFormId.split("-"); - if(!EmptyUtils.isEmpty(split)) { - cereOrderFormId = split[0]; - } - //查询是否为父订单编号 - CereOrderParent parent = cereShopOrderDAO.findByParentFormid(cereOrderFormId); - if (parent != null) { - //查询所有子订单数据 - orderList = cereShopOrderDAO.findByParentId(parent.getParentId()); - } else { - //子订单支付回调 - orderList = cereShopOrderDAO.findByFormid(cereOrderFormId); - } - if(orderList.isEmpty()){ - throw new CoBusinessException("10000","订单查找出错"); - } - - orderList = orderList.stream().filter(item -> item.getIsCross() == 1).collect(Collectors.toList()); - - if(orderList.isEmpty()){ - //这个是纯国内订单,不需要处理 - return; - } - - //查找商家--第一个跨境订单 - CereShopOrder firstOrder = orderList.get(0); + public void ibOrder(String orderFromId, String payTransactionNo) throws CoBusinessException { + List cereShopOrderList = cereShopOrderDAO.findByFormid(orderFromId); + CereShopOrder cereShopOrder = cereShopOrderList.get(0); //商家详细信息 - CereShopCrossDetail cereShopCrossDetail = cereShopCrossDetailDAO.selectOne(Wrappers.lambdaQuery().eq(CereShopCrossDetail::getShopId, firstOrder.getShopId())); - if(cereShopCrossDetail == null){ - throw new CoBusinessException("10000","商家未设置跨境信息"); - } +// CereShopCrossDetail cereShopCrossDetail = cereShopCrossDetailDAO.selectOne(Wrappers.lambdaQuery().eq(CereShopCrossDetail::getShopId, cereShopOrder.getShopId())); +// if(cereShopCrossDetail == null){ +// throw new CoBusinessException("10000","商家未设置跨境信息"); +// } + + log.info("firstOrder:" + new Gson().toJson(cereShopOrder)); //获取SKU详情 - List skus = cereOrderProductService.findOrderProductSku(firstOrder.getOrderId()); + List cereOrderProductList = cereOrderProductService.findByOrderIds(cereShopOrderList.stream().map(CereShopOrder::getOrderId).collect(Collectors.toList())); + //查询仓库--因为一个订单内所有商品都是同一个仓库的,所以直接获取即可 - CereShopStorehouse cereShopStorehouse = cereShopStorehouseDAO.selectOne(Wrappers.lambdaQuery().eq(CereShopStorehouse::getStorehouseId, firstOrder.getShopId())); +// CereShopStorehouse cereShopStorehouse = cereShopStorehouseDAO.selectOne(Wrappers.lambdaQuery().eq(CereShopStorehouse::getStorehouseId, firstOrder.getShopId())); - //组装请求参数 + //获取买家信息 + CereBuyerUser user = cereBuyerUserService.selectByBuyerUserId(cereShopOrder.getBuyerUserId()); NewIbOrderRequestBo bo = new NewIbOrderRequestBo(); - HttpResult httpResult = HttpUtils.doPost(CrossStockConfig.getApiUrl("ibOrder"), bo); - if (httpResult.getStatus() == 200 && StringUtils.equals("success", httpResult.getBody())){ - //报关成功 - log.info("报关发送支付请求成功"); + bo.setActuralpaid(cereShopOrder.getPrice()); +// @ApiModelProperty(value = "订单批次号") +// private String batchnumbers; + bo.setBuyeridnumber(user.getIdCard()); + bo.setBuyername(user.getRealName()); + bo.setPurchasertelephone(user.getPhone());; +// @ApiModelProperty(value = "订购人注册号") +// private String buyerregno; + bo.setChildid("211021172149000001"); + bo.setConsignee(cereShopOrder.getReceiveName()); + + String[] addressArray = cereShopOrder.getReceiveAdress().split("-"); + bo.setConsigneeprovince(addressArray.length > 0 ? addressArray[0] : ""); + bo.setConsigneecity(addressArray.length > 1 ? addressArray[0] + addressArray[1] : ""); + bo.setConsigneestreet(addressArray.length > 2 ? addressArray[2] : ""); + bo.setConsigneeaddress(cereShopOrder.getReceiveAdress() + cereShopOrder.getAddress()); + +// @ApiModelProperty(value = "收货人公司") +// private String consigneecompany; +// @ApiModelProperty(value = "收件人邮箱") +// private String consigneeemail; +// @ApiModelProperty(value = "收件人身份证") +// private String consigneeidcard; + bo.setConsigneetelephone(cereShopOrder.getReceivePhone()); + +// bo.setEbpcode(cereShopCrossDetail.getEbpcode()); +// bo.setEbpname(cereShopCrossDetail.getEbpname()); + + bo.setEbpcode("46016601J4"); + bo.setEbpname("得壹(海南)科技有限公司"); + + bo.setDiscount(cereShopOrder.getDiscountPrice()); + bo.setFreight(cereShopOrder.getLogisticsPrice()); + + //默认顺丰 + bo.setExpressid("SF"); + + List items = new ArrayList<>(); + BigDecimal taxtotal = BigDecimal.ZERO; + List curOrderCereOrderProductList = cereOrderProductList.stream().filter(item -> item.getOrderId().equals(cereShopOrder.getOrderId())).collect(Collectors.toList()); + for (CereOrderProduct cereOrderProduct : curOrderCereOrderProductList) { + IbOrderItemRequestBo item = new IbOrderItemRequestBo(); + item.setPrice(cereOrderProduct.getProductPrice()); + item.setQty(new BigDecimal(cereOrderProduct.getNumber())); + item.setSku(cereOrderProduct.getSKU()); + items.add(item); + + taxtotal = taxtotal.add(cereOrderProduct.getProductPrice() + .multiply(new BigDecimal(cereOrderProduct.getNumber())) + .multiply(cereOrderProduct.getRate().divide(BigDecimal.valueOf(100f),2,BigDecimal.ROUND_HALF_UP))); + } + bo.setItems(items); + +// @ApiModelProperty(value = "企业备注") +// private String note; + + bo.setOrderno(cereShopOrder.getOrderFormid()); +// + bo.setPaycode("460116287K"); + bo.setPayname("新生支付有限公司"); + + bo.setPaytransactionid(payTransactionNo); + bo.setStoreid("DY"); + + bo.setTaxtotal(taxtotal); + + log.info("ibOrder:" + new Gson().toJson(bo)); + + HttpResult httpResult = HttpUtils.doPostJson(CrossStockConfig.getApiUrl("ibOrder"), new Gson().toJson(bo)); + + if (httpResult.getStatus() == 200){ + JSONObject respone = JSONObject.parseObject(httpResult.getBody()); + String result = respone.getString("result"); + String desc = respone.getString("desc"); + if(StringUtils.equals(result, "00")){ + //报关成功 + log.info("报关发送请求成功"); + }else { + log.info("报关发送请求失败:" + respone.toJSONString()); + } + }else { - log.info("报关发送支付请求失败:" + httpResult.getBody()); + log.info("报关发送请求失败:" + httpResult.getBody()); // log.info("报关发送支付请求参数:" + request); } } diff --git a/cereshop-app/src/main/resources/application-app-dev.yml b/cereshop-app/src/main/resources/application-app-dev.yml index 0f492fa..8f3a525 100644 --- a/cereshop-app/src/main/resources/application-app-dev.yml +++ b/cereshop-app/src/main/resources/application-app-dev.yml @@ -67,7 +67,7 @@ spring: max-idle: 400 min-idle: 0 #网站域名 - domain: https://ceres.zkthink.com + domain: http://122.9.152.120 #阿里云短信 aliyun: @@ -101,8 +101,8 @@ miaoxinyun: upload: type: LOCAL # 当前支持 ALI LOCAL 两种 - storage-path: /Users/root/Documents/uploadfile/file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) - uriPrefix: ${spring.domain}/local/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 + storage-path: /home/ceres/cereshop-file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) + uriPrefix: ${spring.domain}/ceres-local-file/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 alioss: file: @@ -225,8 +225,14 @@ pay: xspay: url: https://uwebgatetest.hnapay.com/webgate/unifiedAPI.htm + mer_code: 10000000381 app_return_url: xx app_notice_url: http://122.9.152.120/ceres-app-api/extend/xsPay/pay/notify + app_baoguan_notice_url: http://122.9.152.120/ceres-app-api/extend/xsPay/pay/baoguannotify business_return_url: xx business_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/pay/notify - + business_return_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/refund/notify + rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANMGXGvYX9yqb5qauZgc2mXk4R+2op9KLhCuqO0mt5aTyAFfGXty2RHAinwQif6AUyfFZK7p0/9xz2yX4VHltA4qFNsgQmi2Qtry8MTbBrPtVgukWdLmcK7NqR9C8reXO7e/Np3SPNLle5MsEkwM25cMK56JEc3WMRe+KIRZ69d1AgMBAAECgYBTSW1suyeKplIKCQs7OBgSozUfGSwyBksMFoNhpihLa+RCdlBOYtO9p+qAcN6l7evkBIpqZqtfZIHjcEZj1m8reIHHBnuv/sKGXWPvMBKqckenwNnqUzlj4X8hvFtkbcqXLGdyYoicW+P5+P8zHmYRom+izd5FO9281zXa4UK6gQJBAOquqD84B1VnNq2xopaaJvxaL4c5IOinkfRWShttANCpt1D0t1cs+7WPq9sdFZ4cyHYomxuC4knqJh1E/WzCVqUCQQDmMZH8+6sgqOrgsECw6w0KdUci/XgzT/DRS/3MFMeRv7ygEtdlyvyxRirEArsjQgDg3IBLo9TxBUdygPhgXnSRAkEAtp95r9By7IOoKhw8cMO+qMuphqnvMP0NeD0Z6CO36ajYTXhRn9YSfiQyUQ1eAC9X05MfuJXucCR0ynwgVd0ZPQJAdYaRdow3TrFvWdAi9zDKs7A05ZRrrib+WJ1nsq5ZRfySnVeBSaNdaFTeuLx8NwAX2rY5emTm7zc2xys5pFoVQQJAUPrxmTbELDTF1by6POX/IT3iSeClzOx+M05Yd4sgXtALPjYt0VMLtnsfmt9qMEjhk0Q95wgdmeHsBHxno5qGfQ== + newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmVh2/xldLXhVU/mNT57m95uw0Hr0Pdl4pUyM2xV509LqLYTbLduCqqnuMTJUq7Irv8SsKfVqB7zKggxFyjmIfeeyTbhMDJkWZ20xRhv+rSw3ZBQD/Hbn+cxhi4FZ3gc+jUSI1pIsPrlvRK7E5DyWLa/RvZYiQfW/XYI4c1Mb29QIDAQAB + default_company_code: 460116287K + default_company_name: 新生支付有限公司 diff --git a/cereshop-app/src/main/resources/application-app-prod.yml b/cereshop-app/src/main/resources/application-app-prod.yml index b0746ec..cfbf451 100644 --- a/cereshop-app/src/main/resources/application-app-prod.yml +++ b/cereshop-app/src/main/resources/application-app-prod.yml @@ -101,8 +101,8 @@ miaoxinyun: upload: type: LOCAL # 当前支持 ALI LOCAL 两种 - storage-path: /Users/root/Documents/uploadfile/file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) - uriPrefix: ${spring.domain}/local/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 + storage-path: /home/ceres/cereshop-file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) + uriPrefix: ${spring.domain}/ceres-local-file/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 alioss: file: diff --git a/cereshop-app/src/main/resources/application.yml b/cereshop-app/src/main/resources/application.yml index 9dcd28e..071261d 100644 --- a/cereshop-app/src/main/resources/application.yml +++ b/cereshop-app/src/main/resources/application.yml @@ -78,13 +78,15 @@ pay: xspay: url: https://uwebgate.hnapay.com/webgate/unifiedAPI.htm app_return_url: xx - app_notice_url: xx + app_notice_url: http://14.22.116.132:81/ceres-app-api/extend/xsPay/pay/notify + app_baoguan_notice_url: http://14.22.116.132:81/ceres-app-api/extend/xsPay/pay/baoguannotify business_return_url: xx - business_notice_url: xx - mer_code: 10000000381 + business_notice_url: http://14.22.116.132:81/ceres-business-api/extend/xsPay/pay/notify + business_return_notice_url: http://14.22.116.132:81/ceres-business-api/extend/xsPay/refund/notify + mer_code: 5001626421847836001 sign_type: 1 - rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANMGXGvYX9yqb5qauZgc2mXk4R+2op9KLhCuqO0mt5aTyAFfGXty2RHAinwQif6AUyfFZK7p0/9xz2yX4VHltA4qFNsgQmi2Qtry8MTbBrPtVgukWdLmcK7NqR9C8reXO7e/Np3SPNLle5MsEkwM25cMK56JEc3WMRe+KIRZ69d1AgMBAAECgYBTSW1suyeKplIKCQs7OBgSozUfGSwyBksMFoNhpihLa+RCdlBOYtO9p+qAcN6l7evkBIpqZqtfZIHjcEZj1m8reIHHBnuv/sKGXWPvMBKqckenwNnqUzlj4X8hvFtkbcqXLGdyYoicW+P5+P8zHmYRom+izd5FO9281zXa4UK6gQJBAOquqD84B1VnNq2xopaaJvxaL4c5IOinkfRWShttANCpt1D0t1cs+7WPq9sdFZ4cyHYomxuC4knqJh1E/WzCVqUCQQDmMZH8+6sgqOrgsECw6w0KdUci/XgzT/DRS/3MFMeRv7ygEtdlyvyxRirEArsjQgDg3IBLo9TxBUdygPhgXnSRAkEAtp95r9By7IOoKhw8cMO+qMuphqnvMP0NeD0Z6CO36ajYTXhRn9YSfiQyUQ1eAC9X05MfuJXucCR0ynwgVd0ZPQJAdYaRdow3TrFvWdAi9zDKs7A05ZRrrib+WJ1nsq5ZRfySnVeBSaNdaFTeuLx8NwAX2rY5emTm7zc2xys5pFoVQQJAUPrxmTbELDTF1by6POX/IT3iSeClzOx+M05Yd4sgXtALPjYt0VMLtnsfmt9qMEjhk0Q95wgdmeHsBHxno5qGfQ== - newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmVh2/xldLXhVU/mNT57m95uw0Hr0Pdl4pUyM2xV509LqLYTbLduCqqnuMTJUq7Irv8SsKfVqB7zKggxFyjmIfeeyTbhMDJkWZ20xRhv+rSw3ZBQD/Hbn+cxhi4FZ3gc+jUSI1pIsPrlvRK7E5DyWLa/RvZYiQfW/XYI4c1Mb29QIDAQAB + rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIsNcvBCDUYCkEyHcuzYyGL9TOHV0kQWcAUJmQqgIIcn7devK2fCSgZs5N42tVm59m07VyUmYXfXrFzx80qwp0Db3bUrqAZqMDB1YnxjiM+Rrrm0pPAPGvGUR4XunPIEbqidezUe1pZCMavejql+TkouXrtHQhZVJJHOQwhTvO03AgMBAAECgYBaFKRZMPEYYaDJcxXoiaeHOUENLE/C/CYlnUofsAxigmN6Tmh4F02NTA4YRqjFL8uMh9y0nGCYGof2zmcmA7rVPSOaQwqwqmc+lHWq/Jy5Z6cAxlod1UeA+BEF9gc/d6YNJx+1UoywMJgr4o/59K9MCZofFLUPGhxoMTQzTB34wQJBAL49KvP5EktoEbloVrqoMNXalgXmGeETrUGkc29uTegT/K/29FllcY5mlSJhnL/uoW8aMuU2V8h7fv7RoJBX/DUCQQC7HqNbl0tmj4ffBUsggoTyuKQby2bNLqPJ6wHcQB5OAZhP2E4q+KC9MpS3eT0ljC27/6T+y4Qvry+THmiU1jk7AkB4bWJWhZKmN6AYvctBaB1aE4CrBUnWqM0h48fLf4lD4/svLWbrfINRQPEhjadb/OUm3u/fF/KkEEGJcAxzs68NAkAIqCo2mpFKdWl7z+rh3if4csJk5swiwf2h4dV8Mxsz0K8TQpabNlV5a1WmB13k1s9m2zTu9MtwyVISJF4CRMbxAkEAi88aKBXP1TO9AFZwyNE2Z9dVcSk2xruj9yLgfKvpcZF5eGm3/S9wGz9k+753rxe/KMkWfWd0eIK3VK0iYJ9K+Q== + newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCSsyBgvE huaxun: url: https://bg.qdhuaxun.cn/index.php diff --git a/cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml b/cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml index f87491e..bb22047 100644 --- a/cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml +++ b/cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml @@ -12,6 +12,8 @@ + + @@ -25,8 +27,8 @@ - buyer_user_id, `name`, sex, birthday, wechat_open_id, wechat_union_id, wechat_name, - wechat_number, ali_user_id, phone, `password`, head_image, `state`,if_black, remark, + buyer_user_id, `name`, sex, birthday, real_name, id_card, wechat_open_id, wechat_union_id, wechat_name, + wechat_number, ali_user_id, phone, real_name, id_card, `password`, head_image, `state`,if_black, remark, token, member_level_id, growth, credit, create_time, update_time + delete from cere_buyer_user where buyer_user_id = #{buyerUserId,jdbcType=BIGINT} @@ -69,6 +80,12 @@ phone, + + real_name, + + + id_card, + `password`, @@ -131,6 +148,12 @@ #{phone,jdbcType=VARCHAR}, + + #{realName,jdbcType=VARCHAR}, + + + #{idCard,jdbcType=VARCHAR}, + #{password,jdbcType=VARCHAR}, @@ -249,6 +272,8 @@ wechat_number = #{wechatNumber,jdbcType=VARCHAR}, ali_user_id = #{aliUserId,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR}, + real_name = #{realName,jdbcType=VARCHAR}, + id_card = #{idCard,jdbcType=VARCHAR}, `password` = #{password,jdbcType=VARCHAR}, head_image = #{headImage,jdbcType=VARCHAR}, `state` = #{state,jdbcType=BIT}, diff --git a/cereshop-app/src/main/resources/mybatis/mapper/order/CereOrderProductDAO.xml b/cereshop-app/src/main/resources/mybatis/mapper/order/CereOrderProductDAO.xml index fd892d0..3a8c7d6 100644 --- a/cereshop-app/src/main/resources/mybatis/mapper/order/CereOrderProductDAO.xml +++ b/cereshop-app/src/main/resources/mybatis/mapper/order/CereOrderProductDAO.xml @@ -16,6 +16,8 @@ + + SELECT order_id, buyer_user_id, customer_phone, shop_id, price, order_formid, customer_name, shop_group_work_id, - shop_seckill_id, shop_discount_id, payment_mode, coupon_id + shop_seckill_id, shop_discount_id, payment_mode, coupon_id, is_cross FROM cere_shop_order where parent_id=#{parentId} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/HuaxunController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/HuaxunController.java new file mode 100644 index 0000000..897e8fe --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/HuaxunController.java @@ -0,0 +1,67 @@ +package com.shop.cereshop.business.controller; + +import com.google.gson.Gson; +import com.shop.cereshop.business.service.extend.HuaxunService; +import com.shop.cereshop.commons.domain.huaxun.HuaxunExpressRequestBo; +import com.shop.cereshop.commons.domain.huaxun.HuaxunOrderRequestBo; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * 华讯模块 + */ +@RestController +@RequestMapping("extend/huaxun") +@Slf4j(topic = "huaxunController") +@Api(value = "华讯模块", tags = "华讯模块") +public class HuaxunController { + + @Autowired + private HuaxunService huaxunService; + + /** + * 查询订单接口 + * @throws Exception + */ + @PostMapping("order/queryOrder") + public String queryOrder(@RequestParam(name = "pay_start_time") String payStartTime, + @RequestParam(name = "pay_end_time") String payEndTime, + @RequestParam(name = "timestamp") Long timestamp, @RequestParam(name = "sign") String sign) throws Exception { + try { + HuaxunOrderRequestBo bo = new HuaxunOrderRequestBo(); + bo.setPayStartTime(payStartTime); + bo.setPayEndTime(payEndTime); + bo.setTimestamp(timestamp); + bo.setSign(sign); + return new Gson().toJson(huaxunService.queryOrder(bo)); + } catch (Exception e) { + e.printStackTrace(); + } + return "[]"; + } + + /** + * 物流状态通知 + * @throws Exception + */ + @PostMapping("express/notifyExpress") + public String notifyExpress(@RequestParam(name = "data") String data, @RequestParam(name = "timestamp") Long timestamp, @RequestParam(name = "sign") String sign) throws Exception { + try { + HuaxunExpressRequestBo bo = new HuaxunExpressRequestBo(); + bo.setData(data); + bo.setTimestamp(timestamp); + bo.setSign(sign); + if(huaxunService.notifyExpress(bo)){ + return "success"; + } + } catch (Exception e) { + e.printStackTrace(); + } + return "false"; + } +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/XsPayController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/XsPayController.java new file mode 100644 index 0000000..7cae9bc --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/XsPayController.java @@ -0,0 +1,111 @@ +package com.shop.cereshop.business.controller; + +import com.alibaba.fastjson.JSONObject; +import com.google.gson.Gson; +import com.shop.cereshop.business.pay.xs.domain.XsCallBackRequestVo; +import com.shop.cereshop.business.pay.xs.service.XsPayService; +import com.shop.cereshop.business.service.order.CereShopOrderService; +import com.shop.cereshop.commons.utils.EmptyUtils; +import com.shop.cereshop.commons.utils.StringUtils; +import io.swagger.annotations.Api; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +/** + * 新生支付模块 + */ +@RestController +@RequestMapping("extend/xsPay") +@Slf4j(topic = "xsPayController") +@Api(value = "新生支付模块", tags = "新生支付模块") +public class XsPayController { + + @Autowired + private XsPayService xsPayService; +// +// +// @Autowired +// private HuaxunService huaxunService; +// +// + @Autowired + private CereShopOrderService cereShopOrderService; +// /** +// * 支付通知回调 +// * @throws Exception +// */ +// @PostMapping("pay/notify") +// public void payNotify(@RequestParam(name = "msg") String msg) throws Exception { +// try { +// XsCallBackRequestVo xsCallBackRequestVo = xsPayService.parseCallBackRequestVo(msg); +// String status = xsCallBackRequestVo.getContent().getString("status"); +// //0进行中 1成功 2失败 +// if(StringUtils.equals(status, "1")){ +// log.info("新生支付回调成功"); +// //截取订单编号 +// JSONObject content = xsCallBackRequestVo.getContent(); +// String merOrderId = content.getString("merOrderId"); +// String[] split = merOrderId.split("-"); +// if(!EmptyUtils.isEmpty(split)){ +// String orderFormId=split[0]; +// if(!EmptyUtils.isEmpty(orderFormId)){ +// //支付有礼 +// cereShopOrderService.payGift(orderFormId); +// String dealId = content.getString("dealId"); +// //处理支付成功后的其他逻辑 +// cereShopOrderService.handleWxLog(orderFormId, dealId, merOrderId); +// } +// +// } +// //TODO 如果不是跨境支付应该不调用改接口------pxh +// if(StringUtils.equals(XspayConfig.DEFUALT_TRADE_TYPE, XsPayEnum.TRADE_TYPE_CROSS_BOARD_PAYMENT.getCode())){ +// String payRequestBodyJson = xsPayService.getPayRequestBodyJson(merOrderId, new BigDecimal(Integer.parseInt(content.getString("orderAmount")) * 1.0f / 100), +// XsPayEnum.TRADE_TYPE_CROSS_BOARD_PAYMENT.getCode(), content.getString("payType")); +// huaxunService.pushBaoguanRequest(payRequestBodyJson); +// +// String msgStr = new String(Base64.getDecoder().decode(msg)); +// huaxunService.pushBaoguanRespone(msgStr); +// } +// } +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } +// + /** + * 退款通知回调 + * @throws Exception + */ + @PostMapping("refund/notify") + public void refundNotify(@RequestParam(name = "msg") String msg) throws Exception { + log.info("refundNotify msg:" + msg); + try { + XsCallBackRequestVo xsCallBackRequestVo = xsPayService.parseCallBackRequestVo(msg); + log.info(new Gson().toJson(xsCallBackRequestVo)); + String status = xsCallBackRequestVo.getContent().getString("status"); + //2成功 3失败 + if(StringUtils.equals(status, "0")){ + log.info("退款回调成功"); + //截取订单编号 + JSONObject content = xsCallBackRequestVo.getContent(); + String merOrderId = content.getString("merOrderId"); + String[] split = merOrderId.split("-"); + if(!EmptyUtils.isEmpty(split)){ + String orderFormId=split[0]; + if(!EmptyUtils.isEmpty(orderFormId)){ + String dealId = content.getString("refundOrderNo"); + //处理支付成功后的其他逻辑 + cereShopOrderService.handleRefundWxLog(orderFormId, dealId, merOrderId); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } +// + } +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java index edfcf3e..f8eacf1 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/buyer/CereBuyerUserDAO.java @@ -24,6 +24,8 @@ public interface CereBuyerUserDAO extends BaseMapper { CereBuyerUser selectByPrimaryKey(Long buyerUserId); + List selectByPrimaryKeyList(List buyerUserIdList); + int updateByPrimaryKeySelective(CereBuyerUser record); int updateByPrimaryKey(CereBuyerUser record); diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereOrderProductDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereOrderProductDAO.java index e9a30a8..d63099a 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereOrderProductDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereOrderProductDAO.java @@ -9,8 +9,12 @@ import com.shop.cereshop.commons.domain.order.CereOrderProduct; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + @Mapper public interface CereOrderProductDAO extends BaseMapper { int insertSelective(CereOrderProduct record); + + List findByOrderIds(List orderIdList); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java index 3537995..c110327 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java @@ -106,5 +106,7 @@ public interface CereShopOrderDAO extends BaseMapper { @Param("startTime") String startTime, @Param("endTime") String endTime); - List> selectSalesVolumeBySkuIdList(List skuIdList); + List> selectSalesVolumeBySkuIdList(@Param("skuIdList") List skuIdList); + + List findByFormid(@Param("orderFormId") String orderFormId); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/product/SkuParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/product/SkuParam.java index 216be88..9c28759 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/param/product/SkuParam.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/product/SkuParam.java @@ -92,6 +92,12 @@ public class SkuParam { private String skuImage; /** + * 国际条码 + */ + @ApiModelProperty(value = "国际条码") + private String skuCode; + + /** * 款式 0-单款式 1-多款式 */ @ApiModelProperty(value = "款式 0-单款式 1-多款式") diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/impl/XsPayServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/impl/XsPayServiceImpl.java index 95b6081..34af32c 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/impl/XsPayServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/impl/XsPayServiceImpl.java @@ -11,11 +11,15 @@ import com.shop.cereshop.business.pay.xs.domain.XsRequestBo; import com.shop.cereshop.business.pay.xs.service.XsPayService; import com.shop.cereshop.business.pay.xs.utils.CommonUtils; import com.shop.cereshop.business.pay.xs.utils.HttpUtils; +import com.shop.cereshop.business.service.order.CereShopOrderService; import com.shop.cereshop.commons.config.XspayConfig; import com.shop.cereshop.commons.constant.XsPayEnum; import com.shop.cereshop.commons.exception.CoBusinessException; +import com.shop.cereshop.commons.utils.EmptyUtils; +import com.shop.cereshop.commons.utils.StringUtils; import lombok.extern.slf4j.Slf4j; import org.apache.http.client.utils.URIBuilder; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; @@ -32,44 +36,66 @@ public class XsPayServiceImpl implements XsPayService { //退款申请服务代码 serCode private static final String REFUND_SER_CODE = "101006"; + @Autowired + private CereShopOrderService cereShopOrderService; + @Override public Map refund(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund, Long afterId) throws Exception { //构建请求参数 Map headMap = CommonUtils.buildHeadMap(REFUND_SER_CODE); - Map contentMap = buildOrderRefundContentMap(outTradeNo, transactionId, total, - XspayConfig.APP_NOTICE_URL); + Map contentMap = build06ContentMap(outTradeNo, transactionId, refund, + XspayConfig.BUSINESS_RETURN_NOTICE_URL); //head+content做md5并根据加签方式加密 String msg = CommonUtils.getRequestMsg(headMap, contentMap); - log.info("【" + PAY_SER_CODE + "】接口-请求报文:msg="+msg); + log.info("【" + REFUND_SER_CODE + "】接口-请求报文:msg="+msg); String respMsg = HttpUtils.httpPost(XspayConfig.URL,msg); //若响应respMsg为空时联系新生工作人员,此处因时收银台模式,前端页面提交方式,当时错误时,错误信息会重定向到其他页面展示 - log.info("【" + PAY_SER_CODE + "】接口-响应报文:" + respMsg); + log.info("【" + REFUND_SER_CODE + "】接口-响应报文:" + respMsg); -// if(StrUtil.isNotBlank(respMsg)){ -// try { -// //解析响应报文并验签 -// CommonUtils.verifySignRespMsg(REFUND_SER_CODE,respMsg); -// LinkedHashMap responseMap = JSONObject.parseObject(respMsg,new TypeReference>(){}, Feature.OrderedField ); -// String resMsg = responseMap.get("msg"); -// String responeMsg = new String(Base64.getDecoder().decode(resMsg)); -// JSONObject jsonObject = JSONObject.parseObject(responeMsg); -// String qrCodeUrl = jsonObject.getJSONObject("content").getJSONObject("payInfo").getString("qrCodeUrl"); -// qrCodeUrl = new URIBuilder(qrCodeUrl).getQueryParams().get(0).getValue(); -// return qrCodeUrl; -// } catch (CoBusinessException e) { -// throw e; -// } catch (Exception e) { -// //支付方式为B2C、B2B、H5,成功响应时respMsg为html页面代码 -// if(respMsg.contains("toNativePayIndexForm")){ -// log.info("【" + PAY_SER_CODE + "】接口-响应报文-HTML代码无需验签"); -// }else{ -// e.printStackTrace(); -// } -// throw new CoBusinessException("10000","获取支付二维码出错"); -// } -// } + if(StrUtil.isNotBlank(respMsg)){ + try { + //解析响应报文并验签 + CommonUtils.verifySignRespMsg(REFUND_SER_CODE,respMsg); + + LinkedHashMap responseMap = JSONObject.parseObject(respMsg,new TypeReference>(){}, Feature.OrderedField ); + String resMsg = responseMap.get("msg"); + String responeMsg = new String(Base64.getDecoder().decode(resMsg)); + JSONObject jsonObject = JSONObject.parseObject(responeMsg); + JSONObject content = jsonObject.getJSONObject("content"); + String status = content.getString("status"); + //2成功 3失败 + if(StringUtils.equals(status, "0")) { + String merOrderId = content.getString("merOrderId"); + String oldMmerOrderId = content.getString("oldMerOrderId"); + String dealId = content.getString("refundOrderNo"); + + String[] split = oldMmerOrderId.split("-"); + if (!EmptyUtils.isEmpty(split)) { + String orderFormId = split[0]; + if (!EmptyUtils.isEmpty(orderFormId)) { + //处理支付成功后的其他逻辑 + cereShopOrderService.handleRefundWxLog(orderFormId, dealId, merOrderId); + } + } + } + } catch (CoBusinessException e) { + if(StringUtils.equals(e.getCode(), "0005")){ + throw new CoBusinessException("10000","支付系统正在处理,请支付5分钟后再申请退款"); + }else { + throw e; + } + } catch (Exception e) { + //支付方式为B2C、B2B、H5,成功响应时respMsg为html页面代码 + if(respMsg.contains("toNativePayIndexForm")){ + log.info("【" + PAY_SER_CODE + "】接口-响应报文-HTML代码无需验签"); + }else{ + e.printStackTrace(); + } + throw new CoBusinessException("10000","退款出错"); + } + } return null; } @@ -79,39 +105,52 @@ public class XsPayServiceImpl implements XsPayService { //构建请求参数 Map headMap = CommonUtils.buildHeadMap(REFUND_SER_CODE); - Map contentMap = buildOrderRefundContentMap(outTradeNo, transactionId, total, - XspayConfig.APP_NOTICE_URL); + Map contentMap = build06ContentMap(outTradeNo, transactionId, refund, XspayConfig.APP_NOTICE_URL); //head+content做md5并根据加签方式加密 String msg = CommonUtils.getRequestMsg(headMap, contentMap); - log.info("【" + PAY_SER_CODE + "】接口-请求报文:msg="+msg); + log.info("【" + REFUND_SER_CODE + "】接口-请求报文:msg="+msg); String respMsg = HttpUtils.httpPost(XspayConfig.URL,msg); //若响应respMsg为空时联系新生工作人员,此处因时收银台模式,前端页面提交方式,当时错误时,错误信息会重定向到其他页面展示 - log.info("【" + PAY_SER_CODE + "】接口-响应报文:" + respMsg); + log.info("【" + REFUND_SER_CODE + "】接口-响应报文:" + respMsg); -// if(StrUtil.isNotBlank(respMsg)){ -// try { -// //解析响应报文并验签 -// CommonUtils.verifySignRespMsg(REFUND_SER_CODE,respMsg); -// LinkedHashMap responseMap = JSONObject.parseObject(respMsg,new TypeReference>(){}, Feature.OrderedField ); -// String resMsg = responseMap.get("msg"); -// String responeMsg = new String(Base64.getDecoder().decode(resMsg)); -// JSONObject jsonObject = JSONObject.parseObject(responeMsg); -// String qrCodeUrl = jsonObject.getJSONObject("content").getJSONObject("payInfo").getString("qrCodeUrl"); -// qrCodeUrl = new URIBuilder(qrCodeUrl).getQueryParams().get(0).getValue(); -// return qrCodeUrl; -// } catch (CoBusinessException e) { -// throw e; -// } catch (Exception e) { -// //支付方式为B2C、B2B、H5,成功响应时respMsg为html页面代码 -// if(respMsg.contains("toNativePayIndexForm")){ -// log.info("【" + PAY_SER_CODE + "】接口-响应报文-HTML代码无需验签"); -// }else{ -// e.printStackTrace(); -// } -// throw new CoBusinessException("10000","获取支付二维码出错"); -// } -// } + if(StrUtil.isNotBlank(respMsg)){ + try { + //解析响应报文并验签 + CommonUtils.verifySignRespMsg(REFUND_SER_CODE,respMsg); + + LinkedHashMap responseMap = JSONObject.parseObject(respMsg,new TypeReference>(){}, Feature.OrderedField ); + String resMsg = responseMap.get("msg"); + String responeMsg = new String(Base64.getDecoder().decode(resMsg)); + JSONObject jsonObject = JSONObject.parseObject(responeMsg); + JSONObject content = jsonObject.getJSONObject("content"); + String status = content.getString("status"); + //2成功 3失败 + if(StringUtils.equals(status, "0")) { + String merOrderId = content.getString("merOrderId"); + String[] split = merOrderId.split("-"); + if (!EmptyUtils.isEmpty(split)) { + String orderFormId = split[0]; + if (!EmptyUtils.isEmpty(orderFormId)) { + String dealId = content.getString("refundOrderNo"); + //处理支付成功后的其他逻辑 + cereShopOrderService.handleRefundWxLog(orderFormId, dealId, merOrderId); + } + } + } + + } catch (CoBusinessException e) { + throw e; + } catch (Exception e) { + //支付方式为B2C、B2B、H5,成功响应时respMsg为html页面代码 + if(respMsg.contains("toNativePayIndexForm")){ + log.info("【" + REFUND_SER_CODE + "】接口-响应报文-HTML代码无需验签"); + }else{ + e.printStackTrace(); + } + throw new CoBusinessException("10000","退款出错"); + } + } return null; } @@ -182,23 +221,24 @@ public class XsPayServiceImpl implements XsPayService { * 构建content请求参数 * @return */ - private static Map buildOrderRefundContentMap(String orderFormid, String dealId, BigDecimal money, String noticeUrl){ + private static Map build06ContentMap(String orderFormid, String dealId, BigDecimal money, String noticeUrl){ Map contentMap = new LinkedHashMap<>(); + log.info("orderFormid:" + orderFormid); contentMap.put("merOrderId", System.currentTimeMillis()+""); //oldMerOrderId 对应 101004、101005接口中merOrderId contentMap.put("oldMerOrderId", orderFormid); //oldDealId 对应 101004、101005接口响应参数中dealId - contentMap.put("oldDealId", dealId); - contentMap.put("amount", 1);//money.multiply(new BigDecimal(100)).intValue()); +// contentMap.put("oldDealId", dealId); + contentMap.put("amount", money.multiply(new BigDecimal(100)).intValue()); contentMap.put("currency", "CNY"); contentMap.put("noticeUrl", noticeUrl); return contentMap; } - /** - * 构建content请求参数 - * @return - */ + /** + * 构建content请求参数——商家端的支付保证金,属于国内支付,不需要一些强制信息 + * @return + */ private static Map buildPayContentMap(String orderFormid, BigDecimal money, String tradeType, String payType, String returnUrl, String noticeUrl){ // 设置请求正文 contentMap有序,顺序按照文档从上到下,为空字段可不传该字段 @@ -207,17 +247,15 @@ public class XsPayServiceImpl implements XsPayService { contentMap.put("merOrderId", orderFormid); //商户名称 请根据实际情况替换 contentMap.put("displayName", "成美国际"); - - //TODO 商品名称 //商品名称 请根据实际情况替换 - contentMap.put("goodsName", "商品名称"); + contentMap.put("goodsName", "商家保证金"); //商品数量 请根据实际情况替换 contentMap.put("goodsCount", 1); //商品类别 请根据实际情况替换 contentMap.put("goodsType", "01"); //订单金额单位分 - contentMap.put("orderAmount", 1);//money.multiply(new BigDecimal(100)).intValue()); + contentMap.put("orderAmount", money.multiply(new BigDecimal(100)).intValue()); //订单币种 CNY:人民币 contentMap.put("orderCurrencyCode", "CNY"); //贸易类型 0004-货物贸易 @@ -234,9 +272,9 @@ public class XsPayServiceImpl implements XsPayService { contentMap.put("settleCurrencyCode", "CNY"); //分账标识 0:不分账 1:实时分账 2:延时分账 contentMap.put("shareFlag", "0"); - //分账订单信息 shangFlag=1时必填 - JSONArray jsonArray = buildSubMerchantOrderDetails(); - contentMap.put("subMerchantOrderDetails", JSONArray.toJSONString(jsonArray)); + //分账订单信息 shangFlag=1时必填--商家保证金付款不需要分账和子订单 +// JSONArray jsonArray = buildSubMerchantOrderDetails(); +// contentMap.put("subMerchantOrderDetails", JSONArray.toJSONString(jsonArray)); //回调地址--支付成功后的前端回调地址,先写死首页 contentMap.put("returnUrl", returnUrl); @@ -246,33 +284,34 @@ public class XsPayServiceImpl implements XsPayService { //平台ID-平台型支付的时候使用 contentMap.put("platformId",""); - //商户用户号 请根据实际情况选择填写 TODO 这个先写死,但是应该要根据订单的支付人来传值 - contentMap.put("customerId", "U00001"); - //商户用户类型 请根据实际情况选择填写 - contentMap.put("customerType", "1"); - //商户用户姓名 请根据实际情况选择填写 - contentMap.put("customerName", "潘孝河"); - //商户用户证件号 请根据实际情况选择填写 - contentMap.put("customerIdNo", "460004198911216054"); - //商户用户手机号 请根据实际情况选择填写 - contentMap.put("customerTel", "13700418358"); - //以下信息在支付类型为快捷支付的时候必填 - //商户用户银行卡号 - contentMap.put("bankCardNo", ""); - //商户用户银行卡类型 - contentMap.put("bankCardType", ""); - //有效期 - contentMap.put("expireData", ""); - //信用卡安全码 - contentMap.put("cvn", ""); - //备注 - contentMap.put("remark", ""); - //保留字段1 - contentMap.put("reserve1", ""); - //保留字段2 若要指定使用某条公众号/小程序appid时,可填写appid或对应备案号 +// //商户用户号 请根据实际情况选择填写 TODO 这个先写死,但是应该要根据订单的支付人来传值 +// contentMap.put("customerId", "U00001"); +// //商户用户类型 请根据实际情况选择填写 +// contentMap.put("customerType", "1"); +// //商户用户姓名 请根据实际情况选择填写 +// contentMap.put("customerName", "潘孝河"); +// //商户用户证件号 请根据实际情况选择填写 +// contentMap.put("customerIdNo", "460004198911216054"); +// //商户用户手机号 请根据实际情况选择填写 +// contentMap.put("customerTel", "13700418358"); +// //以下信息在支付类型为快捷支付的时候必填 +// //商户用户银行卡号 +// contentMap.put("bankCardNo", ""); +// //商户用户银行卡类型 +// contentMap.put("bankCardType", ""); +// //有效期 +// contentMap.put("expireData", ""); +// //信用卡安全码 +// contentMap.put("cvn", ""); +// //备注 +// contentMap.put("remark", ""); +// //保留字段1 +// contentMap.put("reserve1", ""); +// //保留字段2 若要指定使用某条公众号/小程序appid时,可填写appid或对应备案号 contentMap.put("reserve2", ""); - //预下单标识 - contentMap.put("preOrderFlag", ""); +// //预下单标识 +// contentMap.put("preOrderFlag", ""); +// declareCheck return contentMap; } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/CereBuyerUserService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/CereBuyerUserService.java index 4e50719..54e1c0d 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/CereBuyerUserService.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/CereBuyerUserService.java @@ -11,9 +11,12 @@ import com.shop.cereshop.business.param.buyer.BuyerUserGetAllParam; import com.shop.cereshop.business.param.buyer.UserSaveParam; import com.shop.cereshop.business.param.buyer.UserUpdateParam; import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; import com.shop.cereshop.commons.domain.common.Page; import com.shop.cereshop.commons.exception.CoBusinessException; +import java.util.List; + public interface CereBuyerUserService { Page getAll(BuyerUserGetAllParam param) throws CoBusinessException; @@ -26,4 +29,6 @@ public interface CereBuyerUserService { void initBusinessBuyerUser(); void updateGrowth(Long buyerUserId, int growth); + + List selectByBuyerUserIdList(List buyerUserIdList); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java index 111df9b..740dbe6 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/buyer/impl/CereBuyerUserServiceImpl.java @@ -217,4 +217,19 @@ public class CereBuyerUserServiceImpl implements CereBuyerUserService { public void updateGrowth(Long buyerUserId, int growth) { cereBuyerUserDAO.updateGrowth(buyerUserId, growth); } + + + @Override + public List selectByBuyerUserIdList(List buyerUserIdList) { + List cereBuyerUserList = cereBuyerUserDAO.selectByPrimaryKeyList(buyerUserIdList); + if(cereBuyerUserList != null){ + for (CereBuyerUser cereBuyerUser : cereBuyerUserList) { + if (cereBuyerUser != null && cereBuyerUser.getWechatName() == null) { + cereBuyerUser.setWechatName(cereBuyerUser.getName()); + } + } + } + return cereBuyerUserList; + } + } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/extend/HuaxunService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/extend/HuaxunService.java new file mode 100644 index 0000000..962254f --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/extend/HuaxunService.java @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.service.extend; + + +import com.shop.cereshop.commons.domain.huaxun.HuaxunExpressRequestBo; +import com.shop.cereshop.commons.domain.huaxun.HuaxunOrderRequestBo; +import com.shop.cereshop.commons.domain.huaxun.OrderListVo; +import com.shop.cereshop.commons.exception.CoBusinessException; + +import java.io.UnsupportedEncodingException; +import java.util.List; + +/** + *

+ * 华讯清关业务接口 + *

+ * + * @author pxh + * @date 2023-03-10 + */ +public interface HuaxunService { + + + /** + * 华讯查询订单 + * @param bo + * @return + */ + List queryOrder(HuaxunOrderRequestBo bo) throws UnsupportedEncodingException, CoBusinessException; + + /** + * 物流消息接收 + * @param bo + * @return + */ + boolean notifyExpress(HuaxunExpressRequestBo bo) throws UnsupportedEncodingException, CoBusinessException; +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/extend/impl/HuaxunServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/extend/impl/HuaxunServiceImpl.java new file mode 100644 index 0000000..b46731a --- /dev/null +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/extend/impl/HuaxunServiceImpl.java @@ -0,0 +1,172 @@ +/* + * Copyright (C) 2017-2021 + * All rights reserved, Designed By 深圳中科鑫智科技有限公司 + * Copyright authorization contact 18814114118 + */ +package com.shop.cereshop.business.service.extend.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.google.gson.Gson; +import com.shop.cereshop.business.dao.order.CereShopOrderDAO; +import com.shop.cereshop.business.param.order.OrderDileveryParam; +import com.shop.cereshop.business.service.buyer.CereBuyerUserService; +import com.shop.cereshop.business.service.extend.HuaxunService; +import com.shop.cereshop.business.service.order.CereOrderDileverService; +import com.shop.cereshop.business.service.order.CereOrderProductService; +import com.shop.cereshop.commons.config.HuaxunConfig; +import com.shop.cereshop.commons.domain.buyer.CereBuyerUser; +import com.shop.cereshop.commons.domain.huaxun.*; +import com.shop.cereshop.commons.domain.order.CereOrderProduct; +import com.shop.cereshop.commons.domain.order.CereShopOrder; +import com.shop.cereshop.commons.exception.CoBusinessException; +import com.shop.cereshop.commons.utils.EmptyUtils; +import com.shop.cereshop.commons.utils.MD5Utils; +import com.shop.cereshop.commons.utils.StringUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.UnsupportedEncodingException; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + *

+ * 华讯清关业务接口业务实现 + *

+ * + * @author pxh + * @date 2023-03-10 + */ +@Slf4j +@Service +public class HuaxunServiceImpl implements HuaxunService { + + + @Autowired + private CereShopOrderDAO cereShopOrderDAO; + + @Autowired + private CereOrderProductService cereOrderProductService; + + @Autowired + private CereBuyerUserService cereBuyerUserService; + + @Autowired + private CereOrderDileverService cereOrderDileverService; + + @Override + public List queryOrder(HuaxunOrderRequestBo bo) throws UnsupportedEncodingException, CoBusinessException { + ValidationSign(bo); + log.info("华讯查询订单:" + new Gson().toJson(bo)); + List orderListVos = new ArrayList<>(); + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(CereShopOrder::getPaymentState, 1) + .eq(CereShopOrder::getState, 2) + .eq(CereShopOrder::getIsCross, 1) + .ge(CereShopOrder::getPaymentTime, bo.getPayStartTime()) + .lt(CereShopOrder::getPaymentTime, bo.getPayEndTime()); + List shopOrderList = cereShopOrderDAO.selectList(wrapper); + if(shopOrderList != null && !shopOrderList.isEmpty()){ + List opList = cereOrderProductService.findByOrderIds(shopOrderList.stream().map(CereShopOrder::getOrderId).collect(Collectors.toList())); + List buyerUserList = cereBuyerUserService.selectByBuyerUserIdList(shopOrderList.stream().map(CereShopOrder::getBuyerUserId).collect(Collectors.toList())); + + orderListVos.addAll(shopOrderList.stream().map(shopOrder -> { + OrderListVo orderListVo = new OrderListVo(); + orderListVo.setOrder_no(shopOrder.getOrderFormid()); + orderListVo.setPay_amount(shopOrder.getOrderPrice().toPlainString()); + CereBuyerUser buyerUser = buyerUserList.stream().filter(item -> item.getBuyerUserId().equals(shopOrder.getBuyerUserId())).findFirst().orElse(null); + if(buyerUser != null){ + orderListVo.setBuyer_name(buyerUser.getRealName()); + orderListVo.setBuyer_idcard(buyerUser.getIdCard()); + orderListVo.setBuyer_mobile(buyerUser.getPhone()); + }else { + log.info("华讯查询订单:查询不到对应的购买人"); + } + orderListVo.setConsignee_name(shopOrder.getReceiveName()); + orderListVo.setConsignee_mobile(shopOrder.getReceivePhone()); + orderListVo.setConsignee_address(shopOrder.getReceiveAdress() + shopOrder.getAddress()); + + List goods = new ArrayList<>(); + List orderOpList = opList.stream().filter(op -> op.getOrderId().equals(shopOrder.getId())).collect(Collectors.toList()); + if(!orderOpList.isEmpty()){ + goods.addAll(orderOpList.stream().map(orderOp -> { + GoodListVo good = new GoodListVo(); + good.setGoods_title(orderOp.getProductName()); + good.setModel(orderOp.getSKU()); + good.setNumber(orderOp.getNumber()); + good.setPrice(orderOp.getProductPrice().doubleValue()); + return good; + }).collect(Collectors.toList()) + ); + } + orderListVo.setGoods(goods); + return orderListVo; + }).collect(Collectors.toList())); + } + return orderListVos; + } + + @Override + public boolean notifyExpress(HuaxunExpressRequestBo bo) throws UnsupportedEncodingException, CoBusinessException { + ValidationSign(bo); + log.info("华讯物流状态通知:" + new Gson().toJson(bo)); + ExpressListVo expressListVo = new Gson().fromJson(bo.getData(), ExpressListVo.class); + OrderDileveryParam orderDileveryParam = new OrderDileveryParam(); + + String orderFormId = expressListVo.getOrder_no(); + String cereOrderFormId = orderFormId; + String[] split = orderFormId.split("-"); + if(!EmptyUtils.isEmpty(split)) { + cereOrderFormId = split[0]; + } + List orderList = cereShopOrderDAO.findByFormid(cereOrderFormId); + if(orderList == null || orderList.isEmpty()){ + log.info("查找不到对应的订单"); + return false; + } + + orderDileveryParam.setOrderId(orderList.get(0).getOrderId()); + + if(StringUtils.equals("yuantong", expressListVo.getExpress_code())){ + //圆通 + orderDileveryParam.setExpress(136L); + }else if(StringUtils.equals("zhongtong", expressListVo.getExpress_code())){ + //中通 + orderDileveryParam.setExpress(119L); + }else if(StringUtils.equals("shentong", expressListVo.getExpress_code())){ + //申通 + orderDileveryParam.setExpress(122L); + }else if(StringUtils.equals("yunda", expressListVo.getExpress_code())){ + //韵达 + orderDileveryParam.setExpress(117L); + }else if(StringUtils.equals("shunfeng", expressListVo.getExpress_code())){ + //顺丰 + orderDileveryParam.setExpress(118L); + }else if(StringUtils.equals("ems", expressListVo.getExpress_code())){ + //邮政EMS + orderDileveryParam.setExpress(124L); + }else if(StringUtils.equals("jd", expressListVo.getExpress_code())){ + //京东 + orderDileveryParam.setExpress(123L); + } + orderDileveryParam.setDeliverFormid(expressListVo.getExpress_no()); + try { + cereOrderDileverService.dileveryByCross(orderDileveryParam); + } catch (Exception e) { + e.printStackTrace(); + return false; + } + return true; + } + + private void ValidationSign(HuaxunRequestBo bo) throws UnsupportedEncodingException, CoBusinessException { + String checkSign = bo.getTimestamp()+ HuaxunConfig.KEY; + String checkSignMd5 = MD5Utils.md5Hex(checkSign, "utf-8"); + if(!StringUtils.endsWithIgnoreCase(checkSignMd5, bo.getSign())){ + log.info("华讯接口验签失败:" + new Gson().toJson(bo)); + throw new CoBusinessException("-1","验签校验失败"); + } + } +} diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereOrderDileverService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereOrderDileverService.java index 81d5745..93ffe68 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereOrderDileverService.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereOrderDileverService.java @@ -13,5 +13,13 @@ import com.shop.cereshop.commons.exception.CoBusinessException; public interface CereOrderDileverService { void dilevery(OrderDileveryParam param, CerePlatformBusiness user) throws CoBusinessException,Exception; + /** + * 跨境发货 + * @param param + * @throws CoBusinessException + * @throws Exception + */ + void dileveryByCross(OrderDileveryParam param) throws CoBusinessException,Exception; + void refundDilevery(AfterIdParam param, CerePlatformBusiness user) throws CoBusinessException,Exception; } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereOrderProductService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereOrderProductService.java index 956719e..8c14431 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereOrderProductService.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereOrderProductService.java @@ -5,5 +5,11 @@ */ package com.shop.cereshop.business.service.order; +import com.shop.cereshop.commons.domain.order.CereOrderProduct; + +import java.util.List; + public interface CereOrderProductService { + + List findByOrderIds(List orderIdList); } diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereOrderDileverServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereOrderDileverServiceImpl.java index 673ceba..1140bf8 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereOrderDileverServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereOrderDileverServiceImpl.java @@ -131,6 +131,60 @@ public class CereOrderDileverServiceImpl implements CereOrderDileverService { @Override @Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) + public void dileveryByCross(OrderDileveryParam param) throws CoBusinessException,Exception { + String time = TimeUtils.yyMMddHHmmss(); + CereOrderDilever cereOrderDilever=new CereOrderDilever(); + cereOrderDilever.setOrderId(param.getOrderId()); + cereOrderDilever.setExpress(param.getExpress()); + cereOrderDilever.setDeliverFormid(param.getDeliverFormid()); + cereOrderDilever.setCreateTime(time); + cereOrderDileverDAO.insert(cereOrderDilever); + //更新订单状态为待收货 + CereShopOrder cereShopOrder=cereShopOrderService.findById(param.getOrderId()); + cereShopOrder.setOrderId(param.getOrderId()); + cereShopOrder.setState(IntegerEnum.ORDER_HAVE_DILEVERY.getCode()); + cereShopOrderService.updateState(cereShopOrder); + + //新增自动15天确认收货定时任务 + //stringRedisService.set(StringEnum.ORDER_CONFIRM_DILEVERY.getCode()+"-"+param.getOrderId(),1,15*24*60*60*1000); + //cereRedisKeyServcice.add(StringEnum.ORDER_CONFIRM_DILEVERY.getCode()+"-"+param.getOrderId(),TimeUtils.getMoreDayAfter(time,15)); + + long deliveryTime = 7 * 24 * 3600 * 1000L; + if (autoDeliveryTime != null) { + deliveryTime = autoDeliveryTime; + } + Date endTime = new Date(TimeUtils.parseDate(time).getTime() + deliveryTime); + //如果订单申请了退款或者退货,并且在流程中,则不做自动确认收货 + List afterStateList = cereOrderAfterService.selectAfterStateList(param.getOrderId()); + boolean containAllStateFree = IntegerEnum.CONFIRM_DELIVERY_AFTER_STATE_LIST.containsAll(afterStateList); + if (CollectionUtils.isEmpty(afterStateList) || containAllStateFree) { + stringRedisService.set(StringEnum.ORDER_CONFIRM_DILEVERY.getCode()+"-"+param.getOrderId(), 1, deliveryTime); + cereRedisKeyServcice.add(StringEnum.ORDER_CONFIRM_DILEVERY.getCode()+"-"+param.getOrderId(), Tools.date2Str(endTime)); + log.info("add ORDER_CONFIRM_DILEVERY Redis Message key = {}", StringEnum.ORDER_CONFIRM_DILEVERY.getCode()+"-"+param.getOrderId()); + } + + //新增订单已完成消息 + CereNotice cereNotice=new CereNotice(); + cereNotice.setNoticeType(IntegerEnum.NOTICE_TYPE_SYSTEM.getCode()); + cereNotice.setJump(IntegerEnum.NOTICE_JUMP_ORDER.getCode()); + cereNotice.setBuyerUserId(cereShopOrder.getBuyerUserId()); + cereNotice.setShopId(cereShopOrder.getShopId()); + cereNotice.setReceive(3); + cereNotice.setNoticeTitle(StringEnum.NOTICE_TITLE_ORDER_DELIVERY.getCode()); + cereNotice.setNoticeContent("您购买的"+cereShopOrder.getOrderFormid()+"商家已发货,点击查看物流详情"); + cereNotice.setOnly(cereShopOrder.getOrderId()); + cereNotice.setCreateTime(time); + cereNotice.setIfRead(IntegerEnum.NO.getCode()); + cereNoticeService.insert(cereNotice); + + //发送短信 + if (StringUtils.isNotBlank(cereShopOrder.getCustomerPhone()) && cereShopOrder.getCustomerPhone().equals("15986612770")) { + miaoxinMessageService.sendContent(cereShopOrder.getCustomerPhone(), "您订购的商品已发货,宝贝快马加鞭的奔向您,请注意查收!海觅海淘竭诚为您服务!【海觅SeaMee】"); + } + } + + @Override + @Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) public void refundDilevery(AfterIdParam param, CerePlatformBusiness user) throws CoBusinessException,Exception { String time= TimeUtils.yyMMddHHmmss(); CereAfterDilever cereAfterDilever=new CereAfterDilever(); diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereOrderProductServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereOrderProductServiceImpl.java index e9e0df9..392b220 100644 --- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereOrderProductServiceImpl.java +++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereOrderProductServiceImpl.java @@ -5,9 +5,24 @@ */ package com.shop.cereshop.business.service.order.impl; +import com.shop.cereshop.business.dao.order.CereOrderProductDAO; import com.shop.cereshop.business.service.order.CereOrderProductService; +import com.shop.cereshop.commons.domain.order.CereOrderProduct; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + @Service public class CereOrderProductServiceImpl implements CereOrderProductService { + + @Autowired + private CereOrderProductDAO cereOrderProductDAO; + + + @Override + public List findByOrderIds(List orderIdList) { + return cereOrderProductDAO.findByOrderIds(orderIdList); + } } + diff --git a/cereshop-business/src/main/resources/application-business-dev.yml b/cereshop-business/src/main/resources/application-business-dev.yml index bc7dac3..ec27463 100644 --- a/cereshop-business/src/main/resources/application-business-dev.yml +++ b/cereshop-business/src/main/resources/application-business-dev.yml @@ -63,7 +63,7 @@ spring: max-idle: 400 min-idle: 0 #网站域名 - domain: https://ceres.zkthink.com + domain: http://122.9.152.120 #阿里云短信 aliyun: @@ -96,9 +96,9 @@ miaoxinyun: template: 您好,您的验证码为:{0},请妥善保管,5分钟后失效 upload: - type: ALI # 当前支持 ALI LOCAL 两种 - storage-path: /Users/root/Documents/uploadfile/file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) - uriPrefix: ${spring.domain}/local/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 + type: LOCAL # 当前支持 ALI LOCAL 两种 + storage-path: /home/ceres/cereshop-file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) + uriPrefix: ${spring.domain}/ceres-local-file/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 alioss: file: @@ -200,7 +200,14 @@ channelCouponActivityUrl: ${spring.domain}/h5/#/pages_category_page2/channelCoup xspay: url: https://uwebgatetest.hnapay.com/webgate/unifiedAPI.htm + mer_code: 10000000381 app_return_url: xx app_notice_url: http://122.9.152.120/ceres-app-api/extend/xsPay/pay/notify + app_baoguan_notice_url: http://122.9.152.120/ceres-app-api/extend/xsPay/pay/baoguannotify business_return_url: xx business_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/pay/notify + business_return_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/refund/notify + rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANMGXGvYX9yqb5qauZgc2mXk4R+2op9KLhCuqO0mt5aTyAFfGXty2RHAinwQif6AUyfFZK7p0/9xz2yX4VHltA4qFNsgQmi2Qtry8MTbBrPtVgukWdLmcK7NqR9C8reXO7e/Np3SPNLle5MsEkwM25cMK56JEc3WMRe+KIRZ69d1AgMBAAECgYBTSW1suyeKplIKCQs7OBgSozUfGSwyBksMFoNhpihLa+RCdlBOYtO9p+qAcN6l7evkBIpqZqtfZIHjcEZj1m8reIHHBnuv/sKGXWPvMBKqckenwNnqUzlj4X8hvFtkbcqXLGdyYoicW+P5+P8zHmYRom+izd5FO9281zXa4UK6gQJBAOquqD84B1VnNq2xopaaJvxaL4c5IOinkfRWShttANCpt1D0t1cs+7WPq9sdFZ4cyHYomxuC4knqJh1E/WzCVqUCQQDmMZH8+6sgqOrgsECw6w0KdUci/XgzT/DRS/3MFMeRv7ygEtdlyvyxRirEArsjQgDg3IBLo9TxBUdygPhgXnSRAkEAtp95r9By7IOoKhw8cMO+qMuphqnvMP0NeD0Z6CO36ajYTXhRn9YSfiQyUQ1eAC9X05MfuJXucCR0ynwgVd0ZPQJAdYaRdow3TrFvWdAi9zDKs7A05ZRrrib+WJ1nsq5ZRfySnVeBSaNdaFTeuLx8NwAX2rY5emTm7zc2xys5pFoVQQJAUPrxmTbELDTF1by6POX/IT3iSeClzOx+M05Yd4sgXtALPjYt0VMLtnsfmt9qMEjhk0Q95wgdmeHsBHxno5qGfQ== + newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmVh2/xldLXhVU/mNT57m95uw0Hr0Pdl4pUyM2xV509LqLYTbLduCqqnuMTJUq7Irv8SsKfVqB7zKggxFyjmIfeeyTbhMDJkWZ20xRhv+rSw3ZBQD/Hbn+cxhi4FZ3gc+jUSI1pIsPrlvRK7E5DyWLa/RvZYiQfW/XYI4c1Mb29QIDAQAB + default_company_code: 460116287K + default_company_name: 新生支付有限公司 diff --git a/cereshop-business/src/main/resources/application-business-prod.yml b/cereshop-business/src/main/resources/application-business-prod.yml index cb00514..74320c7 100644 --- a/cereshop-business/src/main/resources/application-business-prod.yml +++ b/cereshop-business/src/main/resources/application-business-prod.yml @@ -96,9 +96,9 @@ miaoxinyun: template: 您好,您的验证码为:{0},请妥善保管,5分钟后失效 upload: - type: ALI # 当前支持 ALI LOCAL 两种 - storage-path: /Users/root/Documents/uploadfile/file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) - uriPrefix: ${spring.domain}/local/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 + type: LOCAL # 当前支持 ALI LOCAL 两种 + storage-path: /home/ceres/cereshop-file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) + uriPrefix: ${spring.domain}/ceres-local-file/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 alioss: file: diff --git a/cereshop-business/src/main/resources/application-business-test.yml b/cereshop-business/src/main/resources/application-business-test.yml index cb00514..9838ff4 100644 --- a/cereshop-business/src/main/resources/application-business-test.yml +++ b/cereshop-business/src/main/resources/application-business-test.yml @@ -96,7 +96,7 @@ miaoxinyun: template: 您好,您的验证码为:{0},请妥善保管,5分钟后失效 upload: - type: ALI # 当前支持 ALI LOCAL 两种 + type: LOCAL # 当前支持 ALI LOCAL 两种 storage-path: /Users/root/Documents/uploadfile/file/ # 这个路径在 type = LOCAL的时候才需要配置 文件存储路径 ( 某些版本的 window 需要改成 D:\\data\\projects\\uploadfile\\file\\ ) uriPrefix: ${spring.domain}/local/ # 这个路径在 type = LOCAL的时候才需要配置 域名后面的/local/ 需要配置nginx 映射到服务器上 的 storerage-path 对应的目录 diff --git a/cereshop-business/src/main/resources/application.yml b/cereshop-business/src/main/resources/application.yml index bcc0f1f..4cca10e 100644 --- a/cereshop-business/src/main/resources/application.yml +++ b/cereshop-business/src/main/resources/application.yml @@ -67,11 +67,13 @@ autoDeliveryTime: 604800000 xspay: url: https://uwebgate.hnapay.com/webgate/unifiedAPI.htm app_return_url: xx - app_notice_url: xx + app_notice_url: http://14.22.116.132:81/ceres-app-api/extend/xsPay/pay/notify + app_baoguan_notice_url: http://14.22.116.132:81/ceres-app-api/extend/xsPay/pay/baoguannotify business_return_url: xx - business_notice_url: xx - mer_code: 10000000381 + business_notice_url: http://14.22.116.132:81/ceres-business-api/extend/xsPay/pay/notify + business_return_notice_url: http://14.22.116.132:81/ceres-business-api/extend/xsPay/refund/notify + mer_code: 5001626421847836001 sign_type: 1 - rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANMGXGvYX9yqb5qauZgc2mXk4R+2op9KLhCuqO0mt5aTyAFfGXty2RHAinwQif6AUyfFZK7p0/9xz2yX4VHltA4qFNsgQmi2Qtry8MTbBrPtVgukWdLmcK7NqR9C8reXO7e/Np3SPNLle5MsEkwM25cMK56JEc3WMRe+KIRZ69d1AgMBAAECgYBTSW1suyeKplIKCQs7OBgSozUfGSwyBksMFoNhpihLa+RCdlBOYtO9p+qAcN6l7evkBIpqZqtfZIHjcEZj1m8reIHHBnuv/sKGXWPvMBKqckenwNnqUzlj4X8hvFtkbcqXLGdyYoicW+P5+P8zHmYRom+izd5FO9281zXa4UK6gQJBAOquqD84B1VnNq2xopaaJvxaL4c5IOinkfRWShttANCpt1D0t1cs+7WPq9sdFZ4cyHYomxuC4knqJh1E/WzCVqUCQQDmMZH8+6sgqOrgsECw6w0KdUci/XgzT/DRS/3MFMeRv7ygEtdlyvyxRirEArsjQgDg3IBLo9TxBUdygPhgXnSRAkEAtp95r9By7IOoKhw8cMO+qMuphqnvMP0NeD0Z6CO36ajYTXhRn9YSfiQyUQ1eAC9X05MfuJXucCR0ynwgVd0ZPQJAdYaRdow3TrFvWdAi9zDKs7A05ZRrrib+WJ1nsq5ZRfySnVeBSaNdaFTeuLx8NwAX2rY5emTm7zc2xys5pFoVQQJAUPrxmTbELDTF1by6POX/IT3iSeClzOx+M05Yd4sgXtALPjYt0VMLtnsfmt9qMEjhk0Q95wgdmeHsBHxno5qGfQ== - newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmVh2/xldLXhVU/mNT57m95uw0Hr0Pdl4pUyM2xV509LqLYTbLduCqqnuMTJUq7Irv8SsKfVqB7zKggxFyjmIfeeyTbhMDJkWZ20xRhv+rSw3ZBQD/Hbn+cxhi4FZ3gc+jUSI1pIsPrlvRK7E5DyWLa/RvZYiQfW/XYI4c1Mb29QIDAQAB + rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIsNcvBCDUYCkEyHcuzYyGL9TOHV0kQWcAUJmQqgIIcn7devK2fCSgZs5N42tVm59m07VyUmYXfXrFzx80qwp0Db3bUrqAZqMDB1YnxjiM+Rrrm0pPAPGvGUR4XunPIEbqidezUe1pZCMavejql+TkouXrtHQhZVJJHOQwhTvO03AgMBAAECgYBaFKRZMPEYYaDJcxXoiaeHOUENLE/C/CYlnUofsAxigmN6Tmh4F02NTA4YRqjFL8uMh9y0nGCYGof2zmcmA7rVPSOaQwqwqmc+lHWq/Jy5Z6cAxlod1UeA+BEF9gc/d6YNJx+1UoywMJgr4o/59K9MCZofFLUPGhxoMTQzTB34wQJBAL49KvP5EktoEbloVrqoMNXalgXmGeETrUGkc29uTegT/K/29FllcY5mlSJhnL/uoW8aMuU2V8h7fv7RoJBX/DUCQQC7HqNbl0tmj4ffBUsggoTyuKQby2bNLqPJ6wHcQB5OAZhP2E4q+KC9MpS3eT0ljC27/6T+y4Qvry+THmiU1jk7AkB4bWJWhZKmN6AYvctBaB1aE4CrBUnWqM0h48fLf4lD4/svLWbrfINRQPEhjadb/OUm3u/fF/KkEEGJcAxzs68NAkAIqCo2mpFKdWl7z+rh3if4csJk5swiwf2h4dV8Mxsz0K8TQpabNlV5a1WmB13k1s9m2zTu9MtwyVISJF4CRMbxAkEAi88aKBXP1TO9AFZwyNE2Z9dVcSk2xruj9yLgfKvpcZF5eGm3/S9wGz9k+753rxe/KMkWfWd0eIK3VK0iYJ9K+Q== + newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCSsyBgvE diff --git a/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml index eda246a..0554400 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml @@ -11,6 +11,8 @@ + + @@ -21,7 +23,7 @@ buyer_user_id, `name`, sex, birthday, wechat_open_id, wechat_union_id, wechat_name, - wechat_number, phone, `password`, head_image, `state`, remark, token, create_time, + wechat_number, phone, real_name, id_card, `password`, head_image, `state`, remark, token, create_time, update_time + + + delete from cere_buyer_user where buyer_user_id = #{buyerUserId,jdbcType=BIGINT} @@ -61,6 +74,12 @@ phone, + + real_name, + + + id_card, + `password`, @@ -108,6 +127,12 @@ #{phone,jdbcType=VARCHAR}, + + #{realName,jdbcType=VARCHAR}, + + + #{idCard,jdbcType=VARCHAR}, + #{password,jdbcType=VARCHAR}, @@ -158,6 +183,12 @@ phone = #{phone,jdbcType=VARCHAR}, + + real_name = #{realName,jdbcType=VARCHAR}, + + + id_card = #{idCard,jdbcType=VARCHAR}, + `password` = #{password,jdbcType=VARCHAR}, @@ -192,6 +223,8 @@ wechat_name = #{wechatName,jdbcType=VARCHAR}, wechat_number = #{wechatNumber,jdbcType=VARCHAR}, phone = #{phone,jdbcType=VARCHAR}, + real_name = #{realName,jdbcType=VARCHAR}, + id_card = #{idCard,jdbcType=VARCHAR}, `password` = #{password,jdbcType=VARCHAR}, head_image = #{headImage,jdbcType=VARCHAR}, `state` = #{state,jdbcType=BIT}, diff --git a/cereshop-business/src/main/resources/mybatis/mapper/order/CereOrderProductDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/order/CereOrderProductDAO.xml index 2628887..fda253f 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/order/CereOrderProductDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/order/CereOrderProductDAO.xml @@ -74,4 +74,14 @@ + + diff --git a/cereshop-business/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml index 80bee19..f9ca7b6 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml @@ -498,7 +498,7 @@ SELECT a.* FROM cere_shop_order a LEFT JOIN cere_pay_log b ON a.order_formid = b.order_formid - where b.out_trade_no LIKE CONCAT('%', #{orderFormid}, '%') + where b.out_trade_no LIKE CONCAT('%', #{orderFormId}, '%') and b.state = '支付' @@ -560,9 +560,15 @@ select sku_id, sum(number) as sales_volume from cere_shop_order a join cere_order_product b on b.order_id = a.order_id and a.payment_state = 1 and b.sku_id in - + #{skuId} group by b.sku_id + + diff --git a/cereshop-business/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml index 810f371..11de568 100644 --- a/cereshop-business/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml +++ b/cereshop-business/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml @@ -10,17 +10,19 @@ + + sku_id - , product_id,SKU, price, original_price, rate, storehouse_id, stock_number,total, weight, - sku_image, `style`, create_time, update_time + , product_id,SKU, price, original_price, rate, storehouse_id, stock_number,is_cross, total, weight, + sku_image, sku_code, `style`, create_time, update_time diff --git a/cereshop-commons/src/main/java/com/shop/cereshop/commons/config/XspayConfig.java b/cereshop-commons/src/main/java/com/shop/cereshop/commons/config/XspayConfig.java index 35d5433..f89f9bf 100644 --- a/cereshop-commons/src/main/java/com/shop/cereshop/commons/config/XspayConfig.java +++ b/cereshop-commons/src/main/java/com/shop/cereshop/commons/config/XspayConfig.java @@ -23,11 +23,17 @@ public class XspayConfig { // 支付结果通知地址 public static String APP_NOTICE_URL = "http://122.9.152.120/ceres-app-api/extend/xsPay/pay/notify"; + // 报关结果通知地址 + public static String APP_BAOGUAN_NOTICE_URL = "http://122.9.152.120/ceres-app-api/extend/xsPay/pay/boguannotify"; + // 支付回调地址 public static String BUSINESS_RETURN_URL = "xx"; // 支付结果通知地址 - public static String BUSINESS_NOTICE_URL = "http://122.9.152.120/ceres-app-api/extend/xsPay/pay/notify"; + public static String BUSINESS_NOTICE_URL = "http://122.9.152.120/ceres-business-api/extend/xsPay/pay/notify"; + + // 退款结果通知地址 + public static String BUSINESS_RETURN_NOTICE_URL = "http://122.9.152.120/ceres-business-api/extend/xsPay/refund/notify"; /** * 商户会员号 merCode @@ -58,18 +64,17 @@ public class XspayConfig { */ public static final String DEFAULT_CHARSET = "UTF-8"; + /** + * 默认报关商家电商平台代码 + */ + public static String DEFAULT_COMPANY_CODE = ""; + + /** + * 默认报关商家电商平台名称 + */ + public static String DEFAULT_COMPANY_NAME = ""; -// // 页面跳转同步通知页面路径 需http://或者https://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问 商户可以自定义同步跳转地址 -// public static String REDIRECT_URL; -// -// // 退款回调地址 -// public static String REFUND_NOTIFY_URL; -// -// // 支付成功后端回调地址 -// public static String APP_NOTIFY_URL; -// -// // 平台活动保证金支付成功回调地址 -// public static String BOND_NOTIFY_URL; + public static String wxAppid = ""; @Value("${xspay.url:}") public void setUrl(String url) { @@ -86,6 +91,11 @@ public class XspayConfig { this.APP_NOTICE_URL = url; } + @Value("${xspay.app_baoguan_notice_url:}") + public void setAppBaoGuanNoticeUrl(String url) { + this.APP_BAOGUAN_NOTICE_URL = url; + } + @Value("${xspay.business_return_url:}") public void setBusinessReturnUrl(String url) { this.BUSINESS_RETURN_URL = url; @@ -96,6 +106,11 @@ public class XspayConfig { this.BUSINESS_NOTICE_URL = url; } + @Value("${xspay.business_return_notice_url:}") + public void setBusinessReturnNoticeUrl(String url) { + this.BUSINESS_RETURN_NOTICE_URL = url; + } + @Value("${xspay.mer_code:}") public void setMerCode(String merCode) { this.MER_CODE = merCode; @@ -116,24 +131,17 @@ public class XspayConfig { this.NEWPAY_PUBLIC_KEY = newpayPublicKey; } -// @Value("${alipay.redirect_url}") -// public void setRedirectUrl(String redirectUrl) { -// this.REDIRECT_URL = redirectUrl; -// } -// -// @Value("${alipay.refund_notifyurl}") -// public void setRefundNotifyUrl(String refundNotifyUrl) { -// this.REFUND_NOTIFY_URL = refundNotifyUrl; -// } -// -// @Value("${alipay.app_notifyurl}") -// public void setAppNotifyUrl(String appNotifyUrl) { -// this.APP_NOTIFY_URL = appNotifyUrl; -// } -// -// @Value("${alipay.bond_notifyurl}") -// public void setBondNotifyUrl(String bondNotifyUrl) { -// this.BOND_NOTIFY_URL = bondNotifyUrl; -// } + @Value("${xspay.default_company_code:}") + public void setCompanyCode(String defaultCompanyCode) { + this.DEFAULT_COMPANY_CODE = defaultCompanyCode; + } + @Value("${xspay.default_company_name:}") + public void setCompanyName(String defaultCompanyName) { + this.DEFAULT_COMPANY_NAME = defaultCompanyName; + } + @Value("${weixin.appid:}") + public void setWxAppid(String appId) { + this.wxAppid = appId; + } } diff --git a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/order/CereOrderProduct.java b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/order/CereOrderProduct.java index 1f75335..9a678c0 100644 --- a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/order/CereOrderProduct.java +++ b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/order/CereOrderProduct.java @@ -102,6 +102,12 @@ public class CereOrderProduct implements Serializable { */ private BigDecimal logisticsPrice; + /** + * 税率 + */ + @TableField(exist = false) + private BigDecimal rate; + private static final long serialVersionUID = 1L; } diff --git a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/product/CereProductSku.java b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/product/CereProductSku.java index edc2372..81d31a6 100644 --- a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/product/CereProductSku.java +++ b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/product/CereProductSku.java @@ -98,6 +98,12 @@ public class CereProductSku implements Serializable { private String skuImage; /** + * 国际条码 + */ + @ApiModelProperty(value = "国际条码") + private String skuCode; + + /** * 款式 0-单款式 1-多款式 */ @ApiModelProperty(value = "款式 0-单款式 1-多款式")