87 changed files with 3652 additions and 3388 deletions
-
3072cereshop-admin/logs/sys-error.log
-
18cereshop-admin/logs/sys-info.log
-
30cereshop-admin/src/main/java/com/shop/cereshop/admin/timing/ShopInitializationRunnable.java
-
46cereshop-app/src/main/java/com/shop/cereshop/app/controller/buyer/BuyerUserController.java
-
67cereshop-app/src/main/java/com/shop/cereshop/app/controller/extend/HuaxunController.java
-
2cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerUserDAO.java
-
2cereshop-app/src/main/java/com/shop/cereshop/app/dao/order/CereShopOrderDAO.java
-
12cereshop-app/src/main/java/com/shop/cereshop/app/param/buyer/UserParam.java
-
10cereshop-app/src/main/java/com/shop/cereshop/app/pay/PayService.java
-
8cereshop-app/src/main/java/com/shop/cereshop/app/pay/alipay/service/impl/AliPayServiceImpl.java
-
6cereshop-app/src/main/java/com/shop/cereshop/app/pay/alipay/service/impl/HuabeiPayServiceImpl.java
-
6cereshop-app/src/main/java/com/shop/cereshop/app/pay/weixin/service/impl/WxPayServiceImpl.java
-
24cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/domain/XsCallBackRequestVo.java
-
25cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/domain/XsRequestBo.java
-
22cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java
-
207cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java
-
11cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/utils/CommonUtils.java
-
4cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerUserService.java
-
18cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerUserServiceImpl.java
-
60cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/HuaxunService.java
-
145cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/impl/HuaxunServiceImpl.java
-
18cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java
-
5cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/JoinPlaceOrder.java
-
4cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/LaunchPlaceOrder.java
-
5cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/NormalPlaceOrder.java
-
12cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java
-
4cereshop-app/src/main/java/com/shop/cereshop/app/utils/WechatUtil.java
-
5cereshop-app/src/main/resources/application-app-dev.yml
-
2cereshop-app/src/main/resources/application-security.yml
-
4cereshop-app/src/main/resources/application.yml
-
12cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml
-
9cereshop-app/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
-
120cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopCrossDetailController.java
-
120cereshop-business/src/main/java/com/shop/cereshop/business/controller/StorehouseController.java
-
15cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopCrossDetailDAO.java
-
16cereshop-business/src/main/java/com/shop/cereshop/business/dao/storehouse/CereShopStorehouseDAO.java
-
133cereshop-business/src/main/java/com/shop/cereshop/business/page/shop/ShopCrossDetail.java
-
85cereshop-business/src/main/java/com/shop/cereshop/business/page/storehouse/Storehouse.java
-
12cereshop-business/src/main/java/com/shop/cereshop/business/param/product/SkuParam.java
-
35cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseGetAllParam.java
-
28cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseGetByIdParam.java
-
86cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseSaveParam.java
-
86cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseUpdateParam.java
-
3cereshop-business/src/main/java/com/shop/cereshop/business/pay/PayFactory.java
-
2cereshop-business/src/main/java/com/shop/cereshop/business/pay/PayService.java
-
2cereshop-business/src/main/java/com/shop/cereshop/business/pay/alipay/service/impl/AliPayServiceImpl.java
-
2cereshop-business/src/main/java/com/shop/cereshop/business/pay/alipay/service/impl/HuabeiPayServiceImpl.java
-
2cereshop-business/src/main/java/com/shop/cereshop/business/pay/weixin/service/impl/WxPayServiceImpl.java
-
24cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/domain/XsCallBackRequestVo.java
-
24cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/domain/XsRequestBo.java
-
27cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/XsPayService.java
-
368cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/impl/XsPayServiceImpl.java
-
141cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/utils/CommonUtils.java
-
60cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/utils/HttpUtils.java
-
291cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/utils/RSAUtils.java
-
2cereshop-business/src/main/java/com/shop/cereshop/business/service/log/CerePlatformLogService.java
-
6cereshop-business/src/main/java/com/shop/cereshop/business/service/log/impl/CerePlatformLogServiceImpl.java
-
3cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereShopOrderServiceImpl.java
-
2cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java
-
57cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/CereShopCrossDetailService.java
-
98cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopCrossDetailServiceImpl.java
-
57cereshop-business/src/main/java/com/shop/cereshop/business/service/storehouse/CereShopStorehouseService.java
-
99cereshop-business/src/main/java/com/shop/cereshop/business/service/storehouse/impl/CereShopStorehouseServiceImpl.java
-
7cereshop-business/src/main/resources/application-business-dev.yml
-
12cereshop-business/src/main/resources/application.yml
-
0cereshop-business/src/main/resources/mybatis/mapper/log/HuaxunService.xml
-
8cereshop-business/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml
-
23cereshop-business/src/main/resources/mybatis/mapper/storehouse/CereShopStorehouseDAO.xml
-
20cereshop-commons/src/main/java/com/shop/cereshop/commons/config/HuaxunConfig.java
-
35cereshop-commons/src/main/java/com/shop/cereshop/commons/config/XspayConfig.java
-
51cereshop-commons/src/main/java/com/shop/cereshop/commons/constant/XsPayEnum.java
-
13cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/buyer/CereBuyerUser.java
-
50cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/ExpressListVo.java
-
36cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/GoodListVo.java
-
18cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunExpressRequestBo.java
-
22cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunOrderRequestBo.java
-
22cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunPayBaoGuanRequestBo.java
-
22cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunPayBaoGuanResponseBo.java
-
27cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunRequestBo.java
-
85cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/OrderListVo.java
-
12cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/product/CereProductSku.java
-
156cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopCrossDetail.java
-
106cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/storehouse/CereShopStorehouse.java
-
4cereshop-commons/src/main/java/com/shop/cereshop/commons/utils/KdniaoTrackQueryAPI.java
-
2cereshop-commons/src/main/java/com/shop/cereshop/commons/utils/MD5Utils.java
3072
cereshop-admin/logs/sys-error.log
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1,18 +0,0 @@ |
|||
15:05:19.400 [main] INFO com.shop.cereshop.admin.PlatformActivityTest - [logStarting,50] - Starting PlatformActivityTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:19.404 [main] INFO com.shop.cereshop.admin.PlatformActivityTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:24.815 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-1,dataSource} inited |
|||
15:05:24.944 [main] INFO com.shop.cereshop.admin.PlatformDiscountTest - [logStarting,50] - Starting PlatformDiscountTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:24.944 [main] INFO com.shop.cereshop.admin.PlatformDiscountTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:26.290 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-2,dataSource} inited |
|||
15:05:26.383 [main] INFO com.shop.cereshop.admin.PlatformMemberLevelTest - [logStarting,50] - Starting PlatformMemberLevelTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:26.384 [main] INFO com.shop.cereshop.admin.PlatformMemberLevelTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:27.957 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-3,dataSource} inited |
|||
15:05:28.032 [main] INFO com.shop.cereshop.admin.PlatformMemberShipTest - [logStarting,50] - Starting PlatformMemberShipTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:28.032 [main] INFO com.shop.cereshop.admin.PlatformMemberShipTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:29.173 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-4,dataSource} inited |
|||
15:05:29.235 [main] INFO com.shop.cereshop.admin.PlatformPoliteTest - [logStarting,50] - Starting PlatformPoliteTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:29.235 [main] INFO com.shop.cereshop.admin.PlatformPoliteTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:30.235 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-5,dataSource} inited |
|||
15:05:30.294 [main] INFO com.shop.cereshop.admin.PlatformSeckillTest - [logStarting,50] - Starting PlatformSeckillTest on SC-202004110930 with PID 190384 (started by Administrator in E:\MyWorkSpace\chengmei\ceres\cereshop-v2.0\cereshop-admin) |
|||
15:05:30.294 [main] INFO com.shop.cereshop.admin.PlatformSeckillTest - [logStartupProfileInfo,651] - The following profiles are active: admin-dev,security |
|||
15:05:31.230 [main] INFO com.alibaba.druid.pool.DruidDataSource - [init,930] - {dataSource-6,dataSource} inited |
@ -0,0 +1,67 @@ |
|||
package com.shop.cereshop.app.controller.extend; |
|||
|
|||
import com.google.gson.Gson; |
|||
import com.shop.cereshop.app.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"; |
|||
} |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.shop.cereshop.app.pay.xs.domain; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@ApiModel(value = "XsCallBackRequestVo", description = "新生对外接口入参") |
|||
public class XsCallBackRequestVo implements Serializable { |
|||
/** |
|||
* 回调头 |
|||
*/ |
|||
@ApiModelProperty(value = "回调头") |
|||
private JSONObject head ; |
|||
|
|||
/** |
|||
* 回调内容 |
|||
*/ |
|||
@ApiModelProperty(value = "回调内容") |
|||
private JSONObject content; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.shop.cereshop.app.pay.xs.domain; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Map; |
|||
|
|||
@Data |
|||
@ApiModel(value = "XsRequestBo", description = "新生接口出参") |
|||
public class XsRequestBo implements Serializable { |
|||
/** |
|||
* 请求头 |
|||
*/ |
|||
@ApiModelProperty(value = "请求头") |
|||
private Map<String, String> head ; |
|||
|
|||
/** |
|||
* 请求内容 |
|||
*/ |
|||
@ApiModelProperty(value = "请求内容") |
|||
private Map<String, Object> content; |
|||
} |
@ -1,6 +1,28 @@ |
|||
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 java.math.BigDecimal; |
|||
|
|||
public interface XsPayService extends PayService { |
|||
|
|||
/** |
|||
* 解析新生支付的回调接口 |
|||
* @param msg |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
XsCallBackRequestVo parseCallBackRequestVo(String msg) throws Exception; |
|||
|
|||
/** |
|||
* 获取请求支付的请求明文串 |
|||
* @param orderFormid |
|||
* @param money |
|||
* @param tradeType |
|||
* @param payType |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
String getPayRequestBodyJson(String orderFormid, BigDecimal money, String tradeType, String payType) throws Exception; |
|||
} |
@ -0,0 +1,60 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.app.service.extend; |
|||
|
|||
|
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.common.PageParam; |
|||
import com.shop.cereshop.commons.domain.credit.CereCreditRecord; |
|||
import com.shop.cereshop.commons.domain.huaxun.HuaxunExpressRequestBo; |
|||
import com.shop.cereshop.commons.domain.huaxun.HuaxunOrderRequestBo; |
|||
import com.shop.cereshop.commons.domain.huaxun.HuaxunRequestBo; |
|||
import com.shop.cereshop.commons.domain.huaxun.OrderListVo; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
|
|||
import java.io.UnsupportedEncodingException; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* <p> |
|||
* 华讯清关业务接口 |
|||
* </p> |
|||
* |
|||
* @author pxh |
|||
* @date 2023-03-10 |
|||
*/ |
|||
public interface HuaxunService { |
|||
|
|||
|
|||
/** |
|||
* 华讯查询订单 |
|||
* @param bo |
|||
* @return |
|||
*/ |
|||
List<OrderListVo> queryOrder(HuaxunOrderRequestBo bo) throws UnsupportedEncodingException, CoBusinessException; |
|||
|
|||
/** |
|||
* 物料消息接收 |
|||
* @param bo |
|||
* @return |
|||
*/ |
|||
boolean notifyExpress(HuaxunExpressRequestBo bo) throws UnsupportedEncodingException, CoBusinessException; |
|||
|
|||
/** |
|||
* 发送报关请求 |
|||
* @param request |
|||
* @return |
|||
*/ |
|||
boolean pushBaoguanRequest(String request); |
|||
|
|||
|
|||
/** |
|||
* 发送报关回调 |
|||
* @param response |
|||
* @return |
|||
*/ |
|||
boolean pushBaoguanRespone(String response); |
|||
} |
@ -0,0 +1,145 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
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.extend.HuaxunService; |
|||
import com.shop.cereshop.app.service.order.CereOrderProductService; |
|||
import com.shop.cereshop.commons.config.HuaxunConfig; |
|||
import com.shop.cereshop.commons.domain.express.HttpResult; |
|||
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.HttpUtils; |
|||
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; |
|||
|
|||
/** |
|||
* <p> |
|||
* 华讯清关业务接口业务实现 |
|||
* </p> |
|||
* |
|||
* @author pxh |
|||
* @date 2023-03-10 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
public class HuaxunServiceImpl implements HuaxunService { |
|||
|
|||
|
|||
@Autowired |
|||
private CereShopOrderDAO cereShopOrderDAO; |
|||
|
|||
@Autowired |
|||
private CereOrderProductService cereOrderProductService; |
|||
|
|||
@Override |
|||
public boolean pushBaoguanRequest(String request){ |
|||
HuaxunPayBaoGuanRequestBo bo = new HuaxunPayBaoGuanRequestBo(); |
|||
bo.setChannel("xinsheng"); |
|||
bo.setRequest(request); |
|||
HttpResult httpResult = HttpUtils.doPost(HuaxunConfig.PAY_URL, bo); |
|||
if (httpResult.getStatus() == 200 && StringUtils.equals("success", httpResult.getBody())){ |
|||
//报关成功 |
|||
log.info("报关发送支付请求成功"); |
|||
}else { |
|||
log.info("报关发送支付请求失败:" + httpResult.getBody()); |
|||
log.info("报关发送支付请求参数:" + request); |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public boolean pushBaoguanRespone(String response) { |
|||
HuaxunPayBaoGuanResponseBo bo = new HuaxunPayBaoGuanResponseBo(); |
|||
bo.setChannel("xinsheng"); |
|||
bo.setResponse(response); |
|||
HttpResult httpResult = HttpUtils.doPost(HuaxunConfig.PAYBACK_URL, bo); |
|||
if (httpResult.getStatus() == 200 && StringUtils.equals("success", httpResult.getBody())){ |
|||
//报关成功 |
|||
log.info("报关发送支付回调成功"); |
|||
}else { |
|||
log.info("报关发送支付回调失败:" + httpResult.getBody()); |
|||
log.info("报关发送支付回调参数:" + response); |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
@Override |
|||
public List<OrderListVo> queryOrder(HuaxunOrderRequestBo bo) throws UnsupportedEncodingException, CoBusinessException { |
|||
ValidationSign(bo); |
|||
log.info("华讯查询订单:" + new Gson().toJson(bo)); |
|||
List<OrderListVo> orderListVos = new ArrayList<>(); |
|||
LambdaQueryWrapper<CereShopOrder> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(CereShopOrder::getPaymentState, 1) |
|||
.eq(CereShopOrder::getState, 2) |
|||
.ge(CereShopOrder::getPaymentTime, bo.getPayStartTime()) |
|||
.lt(CereShopOrder::getPaymentTime, bo.getPayEndTime()); |
|||
List<CereShopOrder> shopOrderList = cereShopOrderDAO.selectList(wrapper); |
|||
if(shopOrderList != null && !shopOrderList.isEmpty()){ |
|||
List<CereOrderProduct> opList = cereOrderProductService.findByOrderIds(shopOrderList.stream().map(CereShopOrder::getOrderId).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()); |
|||
orderListVo.setConsignee_name(shopOrder.getReceiveName()); |
|||
orderListVo.setConsignee_mobile(shopOrder.getReceivePhone()); |
|||
orderListVo.setConsignee_address(shopOrder.getReceiveAdress() + shopOrder.getAddress()); |
|||
|
|||
List<GoodListVo> goods = new ArrayList<>(); |
|||
List<CereOrderProduct> 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)); |
|||
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","验签校验失败"); |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,120 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.controller; |
|||
|
|||
import com.shop.cereshop.business.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.business.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.business.page.shop.ShopCrossDetail; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailGetAllParam; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailGetByIdParam; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailSaveParam; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailUpdateParam; |
|||
import com.shop.cereshop.business.service.shop.CereShopCrossDetailService; |
|||
import com.shop.cereshop.business.utils.ContextUtil; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 跨境拓展信息 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("shopcrossdetail") |
|||
@Slf4j(topic = "ShopCrossDetailController") |
|||
@Api(value = "跨境拓展信息", tags = "跨境拓展信息") |
|||
public class ShopCrossDetailController { |
|||
|
|||
@Autowired |
|||
private CereShopCrossDetailService cereShopCrossDetailService; |
|||
|
|||
/** |
|||
* 跨境拓展查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "跨境拓展查询") |
|||
public Result<ShopCrossDetail> getById(@RequestBody ShopCrossDetailGetByIdParam param) throws CoBusinessException{ |
|||
ShopCrossDetail shopCrossDetail=cereShopCrossDetailService.getById(param.getCrossDetailId()); |
|||
return new Result(shopCrossDetail); |
|||
} |
|||
|
|||
/** |
|||
* 仓库管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "跨境拓展查询") |
|||
public Result<Page<ShopCrossDetail>> getAll(@RequestBody ShopCrossDetailGetAllParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
param.setShopId(ContextUtil.getShopId()); |
|||
return new Result(cereShopCrossDetailService.getAll(param)); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 新增跨境拓展 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "新增跨境拓展") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated ShopCrossDetailSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusiness user = (CerePlatformBusiness) request.getAttribute("user"); |
|||
param.setShopId(ContextUtil.getShopId()); |
|||
cereShopCrossDetailService.insert(param,user); |
|||
return new Result(user.getUsername(),"新增跨境拓展信息", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 更新跨境拓展 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "更新跨境拓展") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody ShopCrossDetailUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusiness user = (CerePlatformBusiness) request.getAttribute("user"); |
|||
param.setShopId(ContextUtil.getShopId()); |
|||
cereShopCrossDetailService.update(param,user); |
|||
return new Result(user.getUsername(),"更新跨境拓展信息", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除跨境拓展 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除跨境拓展") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody ShopCrossDetailGetByIdParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusiness user = (CerePlatformBusiness) request.getAttribute("user"); |
|||
cereShopCrossDetailService.deleteById(param.getCrossDetailId(),user); |
|||
return new Result(user.getUsername(),"删除跨境拓展信息", GsonUtil.objectToGson(param)); |
|||
} |
|||
} |
@ -0,0 +1,120 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.controller; |
|||
|
|||
import com.shop.cereshop.business.annotation.NoRepeatSubmit; |
|||
import com.shop.cereshop.business.annotation.NoRepeatWebLog; |
|||
import com.shop.cereshop.business.page.storehouse.Storehouse; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseGetAllParam; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseGetByIdParam; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseSaveParam; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseUpdateParam; |
|||
import com.shop.cereshop.business.service.storehouse.CereShopStorehouseService; |
|||
import com.shop.cereshop.business.utils.ContextUtil; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.result.Result; |
|||
import com.shop.cereshop.commons.utils.GsonUtil; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.servlet.http.HttpServletRequest; |
|||
|
|||
/** |
|||
* 仓库 |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("storehouse") |
|||
@Slf4j(topic = "StorehouseController") |
|||
@Api(value = "仓库", tags = "仓库") |
|||
public class StorehouseController { |
|||
|
|||
@Autowired |
|||
private CereShopStorehouseService cereShopStorehouseService; |
|||
|
|||
/** |
|||
* 物流方案修改查询 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getById") |
|||
@ApiOperation(value = "仓库查询") |
|||
public Result<Storehouse> getById(@RequestBody ShopStorehouseGetByIdParam param) throws CoBusinessException{ |
|||
Storehouse storehouse=cereShopStorehouseService.getById(param.getStorehouseId()); |
|||
return new Result(storehouse); |
|||
} |
|||
|
|||
/** |
|||
* 仓库管理查询 |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "getAll") |
|||
@ApiOperation(value = "仓库管理查询") |
|||
public Result<Page<Storehouse>> getAll(@RequestBody ShopStorehouseGetAllParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
param.setShopId(ContextUtil.getShopId()); |
|||
return new Result(cereShopStorehouseService.getAll(param)); |
|||
} |
|||
|
|||
|
|||
|
|||
/** |
|||
* 新增仓库 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "save") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "新增仓库") |
|||
@NoRepeatWebLog |
|||
public Result save(@RequestBody @Validated ShopStorehouseSaveParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusiness user = (CerePlatformBusiness) request.getAttribute("user"); |
|||
param.setShopId(ContextUtil.getShopId()); |
|||
cereShopStorehouseService.insert(param,user); |
|||
return new Result(user.getUsername(),"新增仓库", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 更新仓库 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "update") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "更新仓库") |
|||
@NoRepeatWebLog |
|||
public Result update(@RequestBody ShopStorehouseUpdateParam param, HttpServletRequest request) throws CoBusinessException{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusiness user = (CerePlatformBusiness) request.getAttribute("user"); |
|||
param.setShopId(ContextUtil.getShopId()); |
|||
cereShopStorehouseService.update(param,user); |
|||
return new Result(user.getUsername(),"更新仓库", GsonUtil.objectToGson(param)); |
|||
} |
|||
|
|||
/** |
|||
* 删除仓库 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
@PostMapping(value = "delete") |
|||
@NoRepeatSubmit |
|||
@ApiOperation(value = "删除仓库") |
|||
@NoRepeatWebLog |
|||
public Result delete(@RequestBody ShopStorehouseGetByIdParam param, HttpServletRequest request) throws CoBusinessException,Exception{ |
|||
//获取当前登录账户 |
|||
CerePlatformBusiness user = (CerePlatformBusiness) request.getAttribute("user"); |
|||
cereShopStorehouseService.deleteById(param.getStorehouseId(),user); |
|||
return new Result(user.getUsername(),"删除仓库", GsonUtil.objectToGson(param)); |
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.dao.shop; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.shop.cereshop.commons.domain.shop.CereShopCrossDetail; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface CereShopCrossDetailDAO extends BaseMapper<CereShopCrossDetail> { |
|||
|
|||
} |
@ -0,0 +1,16 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.dao.storehouse; |
|||
|
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.shop.cereshop.commons.domain.storehouse.CereShopStorehouse; |
|||
import com.shop.cereshop.commons.domain.user.CerePrivacyVerifySetting; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
|
|||
@Mapper |
|||
public interface CereShopStorehouseDAO extends BaseMapper<CereShopStorehouse> { |
|||
|
|||
} |
@ -0,0 +1,133 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.page.shop; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* 仓库返回数据实体类 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "Storehouse", description = "仓库返回数据实体类") |
|||
public class ShopCrossDetail { |
|||
/** |
|||
* 拓展信息Id |
|||
*/ |
|||
@ApiModelProperty(value = "拓展信息Id") |
|||
private Long crossDetailId; |
|||
|
|||
/** |
|||
* 关联店铺id |
|||
*/ |
|||
@ApiModelProperty(value = "关联店铺id") |
|||
private Long shopId; |
|||
|
|||
/** |
|||
* 电商平台名称 |
|||
*/ |
|||
@ApiModelProperty(value = "电商平台名称") |
|||
private String ebpname; |
|||
|
|||
/** |
|||
* 电商平台代码 |
|||
*/ |
|||
@ApiModelProperty(value = "电商平台代码") |
|||
private String ebpcode; |
|||
|
|||
/** |
|||
* 电商企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "电商企业名称") |
|||
private String ebpcname; |
|||
|
|||
/** |
|||
* 电商企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "电商企业代码") |
|||
private String ebpccode; |
|||
/** |
|||
* 申报企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "申报企业名称") |
|||
private String agentName; |
|||
|
|||
/** |
|||
* 申报企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "申报企业代码") |
|||
private String agentCode; |
|||
/** |
|||
* 区内企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "区内企业名称") |
|||
private String areaName; |
|||
|
|||
/** |
|||
* 区内企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "区内企业代码") |
|||
private String areaCode; |
|||
/** |
|||
* 担保企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "担保企业名称") |
|||
private String assureName; |
|||
|
|||
/** |
|||
* 担保企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "担保企业代码") |
|||
private String assureCode; |
|||
/** |
|||
* 账册编号 |
|||
*/ |
|||
@ApiModelProperty(value = "账册编号") |
|||
private String zcCode; |
|||
|
|||
/** |
|||
* 申报海关代码 |
|||
*/ |
|||
@ApiModelProperty(value = "申报海关代码") |
|||
private String sbhgCode; |
|||
|
|||
/** |
|||
* 口岸海关代码 |
|||
*/ |
|||
@ApiModelProperty(value = "口岸海关代码") |
|||
private String kahgCode; |
|||
|
|||
/** |
|||
* 订单传输企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "订单传输企业名称") |
|||
private String copName; |
|||
|
|||
/** |
|||
* 订单传输企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "订单传输企业代码") |
|||
private String copCode; |
|||
|
|||
/** |
|||
* 清单传输企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "清单传输企业名称") |
|||
private String copName1; |
|||
|
|||
/** |
|||
* 清单传输企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "清单传输企业代码") |
|||
private String copCode1; |
|||
|
|||
/** |
|||
* 公司对公银行账户 |
|||
*/ |
|||
@ApiModelProperty(value = "公司对公银行账户") |
|||
private String bankCode; |
|||
} |
@ -0,0 +1,85 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.page.storehouse; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* 仓库返回数据实体类 |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "Storehouse", description = "仓库返回数据实体类") |
|||
public class Storehouse { |
|||
|
|||
/** |
|||
* 仓库id |
|||
*/ |
|||
@ApiModelProperty(value = "仓库id") |
|||
private Long storehouseId; |
|||
/** |
|||
* 关联店铺id |
|||
*/ |
|||
@ApiModelProperty(value = "店铺id") |
|||
private Long shopId; |
|||
|
|||
/** |
|||
* 仓库名称 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库名称") |
|||
private String storehouseName; |
|||
|
|||
/** |
|||
* 仓库类型 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库类型") |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 仓库种类 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库种类") |
|||
private Integer kind; |
|||
|
|||
/** |
|||
* 是否收银台 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否收银台") |
|||
private Integer ifCashier; |
|||
|
|||
/** |
|||
* 单商品订单限额 |
|||
*/ |
|||
@ApiModelProperty(value = "单商品订单限额") |
|||
private BigDecimal oneProductOrderPriceLimit; |
|||
|
|||
/** |
|||
* 多商品订单限额 |
|||
*/ |
|||
@ApiModelProperty(value = "多商品订单限额") |
|||
private BigDecimal moreProductOrderPriceLimit; |
|||
|
|||
/** |
|||
* 单商品数量限制 |
|||
*/ |
|||
@ApiModelProperty(value = "单商品数量限制") |
|||
private Integer oneProductNumLimit; |
|||
|
|||
/** |
|||
* 总商品数量限制 |
|||
*/ |
|||
@ApiModelProperty(value = "总商品数量限制") |
|||
private Integer moreProductNumLimit; |
|||
|
|||
/** |
|||
* 订单次数限制 |
|||
*/ |
|||
@ApiModelProperty(value = "订单次数限制") |
|||
private Integer orderNumberLimit; |
|||
} |
@ -0,0 +1,35 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.storehouse; |
|||
|
|||
import com.shop.cereshop.commons.domain.common.PageParam; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* cere_shop_storehouse 获取店铺仓库列表 |
|||
* @author |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "ShopStorehouseGetAllParam", description = "获取店铺仓库列表请求") |
|||
public class ShopStorehouseGetAllParam extends PageParam implements Serializable { |
|||
/** |
|||
* 店铺id |
|||
*/ |
|||
@ApiModelProperty(value = "店铺id") |
|||
private Long shopId; |
|||
|
|||
/** |
|||
* 店铺名称 |
|||
*/ |
|||
@ApiModelProperty(value = "店铺名称") |
|||
private String storehouseName; |
|||
|
|||
|
|||
} |
@ -0,0 +1,28 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.storehouse; |
|||
|
|||
import com.shop.cereshop.commons.domain.common.PageParam; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* cere_shop_seckill 获取仓库详情请求 |
|||
* @author |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "ShopStorehouseGetByIdParam", description = "获取仓库详情请求") |
|||
public class ShopStorehouseGetByIdParam extends PageParam implements Serializable { |
|||
/** |
|||
* 店铺秒杀活动id |
|||
*/ |
|||
@ApiModelProperty(value = "仓库id") |
|||
private Long storehouseId; |
|||
|
|||
} |
@ -0,0 +1,86 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.storehouse; |
|||
|
|||
import com.shop.cereshop.commons.domain.tool.CereShopDiscountDetail; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import javax.validation.Valid; |
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* cere_shop_storehouse 仓库 |
|||
* @author |
|||
*/ |
|||
@Data |
|||
public class ShopStorehouseSaveParam implements Serializable { |
|||
/** |
|||
* 关联店铺id |
|||
*/ |
|||
@ApiModelProperty(value = "店铺id") |
|||
private Long shopId; |
|||
|
|||
/** |
|||
* 仓库名称 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库名称") |
|||
private String storehouseName; |
|||
|
|||
/** |
|||
* 仓库类型 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库类型") |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 仓库种类 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库种类") |
|||
private Integer kind; |
|||
|
|||
/** |
|||
* 是否收银台 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否收银台") |
|||
private Integer ifCashier; |
|||
|
|||
/** |
|||
* 单商品订单限额 |
|||
*/ |
|||
@ApiModelProperty(value = "单商品订单限额") |
|||
private BigDecimal oneProductOrderPriceLimit; |
|||
|
|||
/** |
|||
* 多商品订单限额 |
|||
*/ |
|||
@ApiModelProperty(value = "多商品订单限额") |
|||
private BigDecimal moreProductOrderPriceLimit; |
|||
|
|||
/** |
|||
* 单商品数量限制 |
|||
*/ |
|||
@ApiModelProperty(value = "单商品数量限制") |
|||
private Integer oneProductNumLimit; |
|||
|
|||
/** |
|||
* 总商品数量限制 |
|||
*/ |
|||
@ApiModelProperty(value = "总商品数量限制") |
|||
private Integer moreProductNumLimit; |
|||
|
|||
/** |
|||
* 订单次数限制 |
|||
*/ |
|||
@ApiModelProperty(value = "订单次数限制") |
|||
private Integer orderNumberLimit; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
@ -0,0 +1,86 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.param.storehouse; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* cere_shop_storehouse 仓库 |
|||
* @author |
|||
*/ |
|||
@Data |
|||
public class ShopStorehouseUpdateParam implements Serializable { |
|||
/** |
|||
* 仓库id |
|||
*/ |
|||
@ApiModelProperty(value = "仓库id") |
|||
private Long storehouseId; |
|||
/** |
|||
* 关联店铺id |
|||
*/ |
|||
@ApiModelProperty(value = "店铺id") |
|||
private Long shopId; |
|||
|
|||
/** |
|||
* 仓库名称 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库名称") |
|||
private String storehouseName; |
|||
|
|||
/** |
|||
* 仓库类型 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库类型") |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 仓库种类 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库种类") |
|||
private Integer kind; |
|||
|
|||
/** |
|||
* 是否收银台 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否收银台") |
|||
private Integer ifCashier; |
|||
|
|||
/** |
|||
* 单商品订单限额 |
|||
*/ |
|||
@ApiModelProperty(value = "单商品订单限额") |
|||
private BigDecimal oneProductOrderPriceLimit; |
|||
|
|||
/** |
|||
* 多商品订单限额 |
|||
*/ |
|||
@ApiModelProperty(value = "多商品订单限额") |
|||
private BigDecimal moreProductOrderPriceLimit; |
|||
|
|||
/** |
|||
* 单商品数量限制 |
|||
*/ |
|||
@ApiModelProperty(value = "单商品数量限制") |
|||
private Integer oneProductNumLimit; |
|||
|
|||
/** |
|||
* 总商品数量限制 |
|||
*/ |
|||
@ApiModelProperty(value = "总商品数量限制") |
|||
private Integer moreProductNumLimit; |
|||
|
|||
/** |
|||
* 订单次数限制 |
|||
*/ |
|||
@ApiModelProperty(value = "订单次数限制") |
|||
private Integer orderNumberLimit; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.shop.cereshop.business.pay.xs.domain; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@ApiModel(value = "XsCallBackRequestVo", description = "新生对外接口入参") |
|||
public class XsCallBackRequestVo implements Serializable { |
|||
/** |
|||
* 回调头 |
|||
*/ |
|||
@ApiModelProperty(value = "回调头") |
|||
private JSONObject head ; |
|||
|
|||
/** |
|||
* 回调内容 |
|||
*/ |
|||
@ApiModelProperty(value = "回调内容") |
|||
private JSONObject content; |
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.shop.cereshop.business.pay.xs.domain; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Map; |
|||
|
|||
@Data |
|||
@ApiModel(value = "XsRequestBo", description = "新生接口出参") |
|||
public class XsRequestBo implements Serializable { |
|||
/** |
|||
* 请求头 |
|||
*/ |
|||
@ApiModelProperty(value = "请求头") |
|||
private Map<String, String> head ; |
|||
|
|||
/** |
|||
* 请求内容 |
|||
*/ |
|||
@ApiModelProperty(value = "请求内容") |
|||
private Map<String, Object> content; |
|||
} |
@ -1,4 +1,29 @@ |
|||
package com.shop.cereshop.business.pay.xs.service; |
|||
|
|||
public class XsPayService { |
|||
|
|||
import com.shop.cereshop.business.pay.PayService; |
|||
import com.shop.cereshop.business.pay.xs.domain.XsCallBackRequestVo; |
|||
|
|||
import java.math.BigDecimal; |
|||
|
|||
public interface XsPayService extends PayService { |
|||
|
|||
/** |
|||
* 解析新生支付的回调接口 |
|||
* @param msg |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
XsCallBackRequestVo parseCallBackRequestVo(String msg) throws Exception; |
|||
|
|||
/** |
|||
* 获取请求支付的请求明文串 |
|||
* @param orderFormid |
|||
* @param money |
|||
* @param tradeType |
|||
* @param payType |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
String getPayRequestBodyJson(String orderFormid, BigDecimal money, String tradeType, String payType) throws Exception; |
|||
} |
@ -0,0 +1,368 @@ |
|||
package com.shop.cereshop.business.pay.xs.service.impl; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.alibaba.fastjson.TypeReference; |
|||
import com.alibaba.fastjson.parser.Feature; |
|||
import com.alibaba.fastjson.serializer.SerializerFeature; |
|||
import com.shop.cereshop.business.pay.xs.domain.XsCallBackRequestVo; |
|||
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.commons.config.XspayConfig; |
|||
import com.shop.cereshop.commons.constant.XsPayEnum; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.apache.http.client.utils.URIBuilder; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.math.BigDecimal; |
|||
import java.util.Base64; |
|||
import java.util.LinkedHashMap; |
|||
import java.util.Map; |
|||
|
|||
@Service(value = "xsPayService") |
|||
@Slf4j |
|||
public class XsPayServiceImpl implements XsPayService { |
|||
|
|||
//支付申请服务代码 serCode |
|||
private static final String PAY_SER_CODE = "101005"; |
|||
//退款申请服务代码 serCode |
|||
private static final String REFUND_SER_CODE = "101006"; |
|||
|
|||
@Override |
|||
public Map<String, String> refund(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund, Long afterId) throws Exception { |
|||
//构建请求参数 |
|||
Map<String, String> headMap = CommonUtils.buildHeadMap(REFUND_SER_CODE); |
|||
|
|||
Map<String, Object> contentMap = buildOrderRefundContentMap(outTradeNo, transactionId, total, |
|||
XspayConfig.APP_NOTICE_URL); |
|||
//head+content做md5并根据加签方式加密 |
|||
String msg = CommonUtils.getRequestMsg(headMap, contentMap); |
|||
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(REFUND_SER_CODE,respMsg); |
|||
// LinkedHashMap<String,String> responseMap = JSONObject.parseObject(respMsg,new TypeReference<LinkedHashMap<String,String>>(){}, 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","获取支付二维码出错"); |
|||
// } |
|||
// } |
|||
return null; |
|||
} |
|||
|
|||
//订单退款 |
|||
@Override |
|||
public Map<String, String> orderRefund(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception { |
|||
//构建请求参数 |
|||
Map<String, String> headMap = CommonUtils.buildHeadMap(REFUND_SER_CODE); |
|||
|
|||
Map<String, Object> contentMap = buildOrderRefundContentMap(outTradeNo, transactionId, total, |
|||
XspayConfig.APP_NOTICE_URL); |
|||
//head+content做md5并根据加签方式加密 |
|||
String msg = CommonUtils.getRequestMsg(headMap, contentMap); |
|||
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(REFUND_SER_CODE,respMsg); |
|||
// LinkedHashMap<String,String> responseMap = JSONObject.parseObject(respMsg,new TypeReference<LinkedHashMap<String,String>>(){}, 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","获取支付二维码出错"); |
|||
// } |
|||
// } |
|||
return null; |
|||
} |
|||
|
|||
//获取保证金二维码 |
|||
@Override |
|||
public String getCollectionCode(String orderFormid, BigDecimal money, String ip, String tradeType) throws CoBusinessException, Exception { |
|||
//构建请求参数 |
|||
Map<String, String> headMap = CommonUtils.buildHeadMap(PAY_SER_CODE); |
|||
|
|||
Map<String, Object> contentMap = buildPayContentMap(orderFormid, money, tradeType, XsPayEnum.PAY_TYPE_QRCODE.getCode(), XspayConfig.BUSINESS_RETURN_URL, |
|||
XspayConfig.BUSINESS_NOTICE_URL); |
|||
//head+content做md5并根据加签方式加密 |
|||
String msg = CommonUtils.getRequestMsg(headMap, contentMap); |
|||
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<String,String> responseMap = JSONObject.parseObject(respMsg,new TypeReference<LinkedHashMap<String,String>>(){}, 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","获取支付二维码出错"); |
|||
} |
|||
} |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public String getPayRequestBodyJson(String orderFormid, BigDecimal money, String tradeType, String payType) throws Exception { |
|||
XsRequestBo xsRequestBo = getPayRequestBody(orderFormid, 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 { |
|||
//构建请求参数 |
|||
Map<String, String> headMap = CommonUtils.buildHeadMap(PAY_SER_CODE); |
|||
|
|||
Map<String, Object> contentMap = buildPayContentMap(orderFormid, money, tradeType, payType, XspayConfig.APP_RETURN_URL, |
|||
XspayConfig.APP_NOTICE_URL); |
|||
|
|||
XsRequestBo xsRequestBo = new XsRequestBo(); |
|||
xsRequestBo.setHead(headMap); |
|||
xsRequestBo.setContent(contentMap); |
|||
return xsRequestBo; |
|||
} |
|||
|
|||
/** |
|||
* 构建content请求参数 |
|||
* @return |
|||
*/ |
|||
private static Map<String,Object> buildOrderRefundContentMap(String orderFormid, String dealId, BigDecimal money, String noticeUrl){ |
|||
Map<String, Object> 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("currency", "CNY"); |
|||
contentMap.put("noticeUrl", noticeUrl); |
|||
return contentMap; |
|||
} |
|||
|
|||
/** |
|||
* 构建content请求参数 |
|||
* @return |
|||
*/ |
|||
private static Map<String,Object> buildPayContentMap(String orderFormid, BigDecimal money, String tradeType, |
|||
String payType, String returnUrl, String noticeUrl){ |
|||
// 设置请求正文 contentMap有序,顺序按照文档从上到下,为空字段可不传该字段 |
|||
Map<String, Object> 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", 1);//money.multiply(new BigDecimal(100)).intValue()); |
|||
//订单币种 CNY:人民币 |
|||
contentMap.put("orderCurrencyCode", "CNY"); |
|||
//贸易类型 0004-货物贸易 |
|||
contentMap.put("tradeType", tradeType); |
|||
//支付方式 |
|||
contentMap.put("payType", payType); |
|||
//机构代码 |
|||
contentMap.put("orgCode", "WECHATPAY"); |
|||
//payerAccount |
|||
// contentMap.put("payerAccount", "omCqSs9K_z2sgvgGeIzEi5gjyL6k"); |
|||
//交易币种 CNY:人民币 |
|||
contentMap.put("payCurrencyCode", "CNY"); |
|||
//结算币种 CNY:人民币 |
|||
contentMap.put("settleCurrencyCode", "CNY"); |
|||
//分账标识 0:不分账 1:实时分账 2:延时分账 |
|||
contentMap.put("shareFlag", "0"); |
|||
//分账订单信息 shangFlag=1时必填 |
|||
JSONArray jsonArray = buildSubMerchantOrderDetails(); |
|||
contentMap.put("subMerchantOrderDetails", JSONArray.toJSONString(jsonArray)); |
|||
|
|||
//回调地址--支付成功后的前端回调地址,先写死首页 |
|||
contentMap.put("returnUrl", returnUrl); |
|||
//通知地址 |
|||
contentMap.put("noticeUrl", noticeUrl); |
|||
|
|||
//平台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或对应备案号 |
|||
contentMap.put("reserve2", ""); |
|||
//预下单标识 |
|||
contentMap.put("preOrderFlag", ""); |
|||
return contentMap; |
|||
} |
|||
|
|||
/** |
|||
* 构建分账明细 |
|||
* @return |
|||
*/ |
|||
private static JSONArray buildSubMerchantOrderDetails(){ |
|||
JSONArray jsonArray = new JSONArray(); |
|||
// //子订单1 |
|||
// JSONObject subOrder1 = new JSONObject(); |
|||
// subOrder1.put("subOrderId","sub20201001"); |
|||
// subOrder1.put("subOrderAmount",50); |
|||
// //子订单1 明细1 |
|||
// JSONArray detailArray1 = new JSONArray(); |
|||
// JSONObject detail1 = new JSONObject(); |
|||
// detail1.put("shareDetailId","sub20201001sd00001"); |
|||
// detail1.put("shareParId","1000000037901581"); |
|||
// detail1.put("shareAmount",20); |
|||
// detail1.put("settleCurCode","CNY"); |
|||
// detailArray1.add(detail1); |
|||
// //子订单1 明细2 |
|||
// JSONObject detail2 = new JSONObject(); |
|||
// detail2.put("shareDetailId","sub20201001sd00002"); |
|||
// detail2.put("shareParId","1000000037901520"); |
|||
// detail2.put("shareAmount",30); |
|||
// detail2.put("settleCurCode","CNY"); |
|||
// detailArray1.add(detail2); |
|||
// subOrder1.put("shareDetail",detailArray1); |
|||
// jsonArray.add(subOrder1); |
|||
// |
|||
// //子订单2 |
|||
// JSONObject subOrder2 = new JSONObject(); |
|||
// subOrder2.put("subOrderId","sub20201002"); |
|||
// subOrder2.put("subOrderAmount",50); |
|||
// //子订单2 明细1 |
|||
// JSONArray detailArray2 = new JSONArray(); |
|||
// JSONObject detail3 = new JSONObject(); |
|||
// detail3.put("shareDetailId","sub20201002sd00001"); |
|||
// detail3.put("shareParId","1000000037901485"); |
|||
// detail3.put("shareAmount",20); |
|||
// detail3.put("settleCurCode","CNY"); |
|||
// detailArray2.add(detail3); |
|||
// //子订单2 明细2 |
|||
// JSONObject detail4 = new JSONObject(); |
|||
// detail4.put("shareDetailId","sub20201002sd00002"); |
|||
// detail4.put("shareParId","1000000037901484"); |
|||
// detail4.put("shareAmount",30); |
|||
// detail4.put("settleCurCode","CNY"); |
|||
// detailArray2.add(detail4); |
|||
// subOrder2.put("shareDetail",detailArray2); |
|||
// |
|||
// jsonArray.add(subOrder2); |
|||
|
|||
return jsonArray; |
|||
} |
|||
|
|||
/** |
|||
* 支付通知回调 |
|||
* @throws Exception |
|||
*/ |
|||
@Override |
|||
public XsCallBackRequestVo parseCallBackRequestVo(String msg) throws Exception { |
|||
//base64 decode |
|||
String msgStr = new String(Base64.getDecoder().decode(msg)); |
|||
|
|||
//LinkedHashMap json字符串转map时保持字段顺序不变 |
|||
JSONObject headContentMap = JSONObject.parseObject(msgStr); |
|||
|
|||
String resSign = headContentMap.getString("sign"); |
|||
headContentMap.remove("sign"); |
|||
|
|||
//headContentMap 转为json字符串时保留字段值为null的字段 |
|||
SerializerFeature[] serializerFeatures = new SerializerFeature[]{SerializerFeature.WriteMapNullValue}; |
|||
String headContentJson = JSONObject.toJSONString(headContentMap,serializerFeatures); |
|||
CommonUtils.verifySignature(headContentJson, resSign); |
|||
|
|||
JSONObject head = headContentMap.getJSONObject("head"); |
|||
JSONObject content = headContentMap.getJSONObject("content"); |
|||
|
|||
String responseCode = content.getString("responseCode"); |
|||
if(StrUtil.isNotBlank(responseCode) && StrUtil.isNotBlank(responseCode) && !StrUtil.equals(responseCode, "0") |
|||
&& !StrUtil.equals(responseCode, "0000") && !StrUtil.equals(responseCode, "0001")){ |
|||
String errorMsg = content.getString("responseDesc"); |
|||
throw new CoBusinessException(responseCode, errorMsg); |
|||
} |
|||
XsCallBackRequestVo xsCallBackRequestVo = new XsCallBackRequestVo(); |
|||
xsCallBackRequestVo.setHead(head); |
|||
xsCallBackRequestVo.setContent(content); |
|||
return xsCallBackRequestVo; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,141 @@ |
|||
package com.shop.cereshop.business.pay.xs.utils; |
|||
|
|||
import cn.hutool.core.util.StrUtil; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.alibaba.fastjson.parser.Feature; |
|||
import com.alibaba.fastjson.serializer.SerializerFeature; |
|||
import com.shop.cereshop.commons.config.XspayConfig; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.utils.MD5Utils; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Base64; |
|||
import java.util.Date; |
|||
import java.util.LinkedHashMap; |
|||
import java.util.Map; |
|||
|
|||
/** |
|||
* 商户号密钥等信息自行替换 |
|||
*/ |
|||
public class CommonUtils { |
|||
|
|||
public static final SimpleDateFormat formatDate = new SimpleDateFormat("yyyyMMdd"); |
|||
public static final SimpleDateFormat formatTime = new SimpleDateFormat("HHmmss"); |
|||
|
|||
|
|||
/** |
|||
* 构建head请求参数 |
|||
* @return |
|||
*/ |
|||
public static Map<String,String> buildHeadMap(String serCode){ |
|||
Map<String, String> headMap = new LinkedHashMap<>(); |
|||
headMap.put("serCode", serCode); |
|||
headMap.put("merCode", XspayConfig.MER_CODE); |
|||
//orderId每次请求不可重复,为请求序列号 |
|||
headMap.put("orderId", System.currentTimeMillis() + ""); |
|||
headMap.put("merDate", CommonUtils.formatDate.format(new Date())); |
|||
headMap.put("merTime", CommonUtils.formatTime.format(new Date())); |
|||
headMap.put("versionNo", "2.0"); |
|||
headMap.put("signType", XspayConfig.SIGN_TYPE); |
|||
return headMap; |
|||
} |
|||
|
|||
/** |
|||
* 构建请求参数msg |
|||
* @param headMap |
|||
* @param contentMap |
|||
* @return |
|||
*/ |
|||
public static String getRequestMsg(Map<String, String> headMap, Map<String, Object> contentMap) throws Exception { |
|||
//生成加签源串 空值不参与加签 |
|||
Map<String, Object> signMap = new LinkedHashMap<>(); |
|||
signMap.put("head", headMap); |
|||
signMap.put("content", contentMap); |
|||
//json字符串 |
|||
String jsonString = JSONObject.toJSONString(signMap); |
|||
System.out.println("【" + headMap.get("serCode") + "】接口-请求报文-JSON源串:"+jsonString); |
|||
//对json字符串md5得到加签源串 |
|||
String signData = MD5Utils.md5Hex(jsonString,XspayConfig.DEFAULT_CHARSET); |
|||
System.out.println("【" + headMap.get("serCode") + "】接口-请求报文-JSON源串MD5:"+signData); |
|||
String signMsg = null; |
|||
//加签 |
|||
if (StrUtil.equals(XspayConfig.SIGN_TYPE,"1")) {//RSA |
|||
signMsg = RSAUtils.encryptByPrivateKey(signData, XspayConfig.RSA_PRIVATE_KEY); |
|||
} else if (StrUtil.equals(XspayConfig.SIGN_TYPE,"2")) {//MD5 |
|||
signMsg = MD5Utils.md5Hex(signData + XspayConfig.RSA_PRIVATE_KEY,XspayConfig.DEFAULT_CHARSET); |
|||
} |
|||
signMap.put("sign",signMsg); |
|||
String postJsonStr = JSONObject.toJSONString(signMap); |
|||
//base64得到msg |
|||
String msg = new String(Base64.getEncoder().encode(postJsonStr.getBytes(XspayConfig.DEFAULT_CHARSET))); |
|||
return msg; |
|||
} |
|||
|
|||
/** |
|||
* 响应报文 |
|||
*/ |
|||
public static void verifySignRespMsg(String serCode, String respMsg) throws Exception { |
|||
Map<String,String> responseMap = JSONObject.parseObject(respMsg,Map.class); |
|||
String error = responseMap.get("error"); |
|||
String errorMsg = responseMap.get("errMsg"); |
|||
if(StrUtil.isNotBlank(error) && StrUtil.isNotBlank(errorMsg) && !StrUtil.equals(error, "0") && !StrUtil.equals(error, "0000") && !StrUtil.equals(error, "0001")){ |
|||
throw new CoBusinessException(error, errorMsg); |
|||
} |
|||
//得到响应msg |
|||
String resMsg = responseMap.get("msg"); |
|||
System.out.println("【" + serCode + "】接口-响应报文-msg:" + new String(Base64.getDecoder().decode(resMsg))); |
|||
if(StrUtil.isNotBlank(resMsg)){ |
|||
//解析响应msg并验签 |
|||
boolean verifyFlag = verifySignature(resMsg); |
|||
if(verifyFlag){ |
|||
System.out.println("【" + serCode + "】接口-响应报文-验签结果:"+verifyFlag); |
|||
}else { |
|||
throw new CoBusinessException("10000","支付接口验签失败"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* 响应msg报文验签 |
|||
* @param msg |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
private static boolean verifySignature(String msg) throws Exception { |
|||
//base64 decode |
|||
String msgStr = new String(Base64.getDecoder().decode(msg)); |
|||
//LinkedHashMap json字符串转map时保持字段顺序不变 |
|||
LinkedHashMap<String,String> headContentMap = JSONObject.parseObject(msgStr,LinkedHashMap.class, Feature.OrderedField); |
|||
|
|||
String resSign = headContentMap.get("sign"); |
|||
headContentMap.remove("sign"); |
|||
|
|||
//headContentMap 转为json字符串时保留字段值为null的字段 |
|||
SerializerFeature[] serializerFeatures = new SerializerFeature[]{SerializerFeature.WriteMapNullValue}; |
|||
String headContentJson = JSONObject.toJSONString(headContentMap,serializerFeatures); |
|||
|
|||
return verifySignature(headContentJson, resSign); |
|||
} |
|||
|
|||
public static boolean verifySignature(String headContentJson, String resSign) throws Exception { |
|||
|
|||
//获取json字符串 不包含sign字段 |
|||
System.out.println("json:" + headContentJson); |
|||
//json字符串md5得到加签源串 |
|||
String md5Hex = MD5Utils.md5Hex(headContentJson,"UTF-8"); |
|||
|
|||
//响应结果验签 |
|||
boolean verifyFlag = false; |
|||
if (StrUtil.equals(XspayConfig.SIGN_TYPE,"1")) {//RSA |
|||
if(md5Hex.equals(RSAUtils.decryptByPublicKey(resSign,XspayConfig.NEWPAY_PUBLIC_KEY))){ |
|||
verifyFlag = true; |
|||
} |
|||
} else if (StrUtil.equals(XspayConfig.SIGN_TYPE,"2")) {//MD5 |
|||
String mac = MD5Utils.md5Hex(md5Hex + XspayConfig.NEWPAY_PUBLIC_KEY,"UTF-8"); |
|||
if(mac.equals(resSign)){ |
|||
verifyFlag = true; |
|||
} |
|||
} |
|||
return verifyFlag; |
|||
} |
|||
} |
@ -0,0 +1,60 @@ |
|||
package com.shop.cereshop.business.pay.xs.utils; |
|||
|
|||
import org.apache.http.HttpEntity; |
|||
import org.apache.http.NameValuePair; |
|||
import org.apache.http.client.entity.UrlEncodedFormEntity; |
|||
import org.apache.http.client.methods.CloseableHttpResponse; |
|||
import org.apache.http.client.methods.HttpPost; |
|||
import org.apache.http.entity.ContentType; |
|||
import org.apache.http.entity.mime.HttpMultipartMode; |
|||
import org.apache.http.entity.mime.MultipartEntityBuilder; |
|||
import org.apache.http.impl.client.CloseableHttpClient; |
|||
import org.apache.http.impl.client.HttpClients; |
|||
import org.apache.http.message.BasicNameValuePair; |
|||
import org.apache.http.util.EntityUtils; |
|||
|
|||
import java.io.File; |
|||
import java.io.FileInputStream; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
public class HttpUtils { |
|||
|
|||
public static String httpPost(String url,String msg) throws Exception { |
|||
//发送请求 |
|||
CloseableHttpClient httpclient = HttpClients.createDefault(); |
|||
HttpPost httpPost = new HttpPost(url); |
|||
//此处设值防止新生将该次请求当成手机端请求 |
|||
httpPost.setHeader("User-Agent","Mozilla/5.0(Windows NT 6.1;Win64; x64; rv:50.0) Gecko/20100101 Firefox/50.0"); |
|||
List<NameValuePair> params=new ArrayList<NameValuePair>(); |
|||
params.add(new BasicNameValuePair("msg",msg)); |
|||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(params,"UTF-8"); |
|||
httpPost.setEntity(entity); |
|||
CloseableHttpResponse response = httpclient.execute(httpPost); |
|||
HttpEntity responseEntity = response.getEntity(); |
|||
String responseStr = EntityUtils.toString(responseEntity, "UTF-8"); |
|||
return responseStr; |
|||
} |
|||
|
|||
|
|||
public static String httpPostFile(String url,String msg,File attachedFile) throws Exception { |
|||
//发送请求 |
|||
CloseableHttpClient httpclient = HttpClients.createDefault(); |
|||
HttpPost httpPost = new HttpPost(url); |
|||
//设置请求参数 |
|||
MultipartEntityBuilder builder = MultipartEntityBuilder.create().setMode(HttpMultipartMode.RFC6532); |
|||
builder.addTextBody("msg", msg, ContentType.TEXT_PLAIN); |
|||
//把文件加到HTTP的post请求中 |
|||
if(attachedFile != null) { |
|||
builder.addBinaryBody("attachedFile", new FileInputStream(attachedFile), ContentType.APPLICATION_OCTET_STREAM, attachedFile.getName()); |
|||
} |
|||
HttpEntity multipart = builder.build(); |
|||
|
|||
httpPost.setEntity(multipart); |
|||
CloseableHttpResponse response = httpclient.execute(httpPost); |
|||
HttpEntity responseEntity = response.getEntity(); |
|||
String responseStr = EntityUtils.toString(responseEntity, "UTF-8"); |
|||
return responseStr; |
|||
} |
|||
|
|||
} |
@ -0,0 +1,291 @@ |
|||
package com.shop.cereshop.business.pay.xs.utils; |
|||
|
|||
import javax.crypto.Cipher; |
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.IOException; |
|||
import java.math.BigInteger; |
|||
import java.security.*; |
|||
import java.security.spec.PKCS8EncodedKeySpec; |
|||
import java.security.spec.X509EncodedKeySpec; |
|||
import java.util.Base64; |
|||
|
|||
public class RSAUtils { |
|||
|
|||
public static final String ALGORITHM = "RSA"; |
|||
|
|||
public static final String SIGN_ALGORITHMS = "SHA1WithRSA"; |
|||
|
|||
/** |
|||
* RSA最大加密明文大小 |
|||
*/ |
|||
private static final int MAX_ENCRYPT_BLOCK = 117; |
|||
|
|||
/** |
|||
* RSA最大解密密文大小 |
|||
*/ |
|||
private static final int MAX_DECRYPT_BLOCK = 128; |
|||
|
|||
|
|||
|
|||
/** |
|||
* <p> |
|||
* 公钥解密 |
|||
* </p> |
|||
* |
|||
* @param encryptedData |
|||
* 已加密数据 |
|||
* @param publicKey |
|||
* 公钥(十六进制编码) |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public static byte[] decryptByPublicKey(byte[] encryptedData, String publicKey) throws Exception { |
|||
// byte[] keyBytes = HexUtil.toByteArray(privateKey); |
|||
byte[] keyBytes = Base64.getDecoder().decode(publicKey);// 修改base64编码 |
|||
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); |
|||
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM); |
|||
Key publicK = keyFactory.generatePublic(x509KeySpec); |
|||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); |
|||
cipher.init(Cipher.DECRYPT_MODE, publicK); |
|||
int inputLen = encryptedData.length; |
|||
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|||
int offSet = 0; |
|||
byte[] cache; |
|||
int i = 0; |
|||
// 对数据分段解密 |
|||
while (inputLen - offSet > 0) { |
|||
if (inputLen - offSet > MAX_DECRYPT_BLOCK) { |
|||
cache = cipher.doFinal(encryptedData, offSet, MAX_DECRYPT_BLOCK); |
|||
} else { |
|||
cache = cipher.doFinal(encryptedData, offSet, inputLen - offSet); |
|||
} |
|||
out.write(cache, 0, cache.length); |
|||
i++; |
|||
offSet = i * MAX_DECRYPT_BLOCK; |
|||
} |
|||
byte[] decryptedData = out.toByteArray(); |
|||
out.close(); |
|||
return decryptedData; |
|||
} |
|||
|
|||
/** |
|||
* <p> |
|||
* 公钥加密 |
|||
* </p> |
|||
* |
|||
* @param data |
|||
* 源数据 |
|||
* @param publicKey |
|||
* 公钥(十六进制编码) |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public static byte[] encryptByPublicKey(byte[] data, String publicKey) throws Exception { |
|||
// byte[] keyBytes = HexUtil.toByteArray(privateKey); |
|||
byte[] keyBytes = Base64.getDecoder().decode(publicKey);// 修改base64编码 |
|||
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); |
|||
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM); |
|||
Key publicK = keyFactory.generatePublic(x509KeySpec); |
|||
// 对数据加密 |
|||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); |
|||
cipher.init(Cipher.ENCRYPT_MODE, publicK); |
|||
int inputLen = data.length; |
|||
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|||
int offSet = 0; |
|||
byte[] cache; |
|||
int i = 0; |
|||
// 对数据分段加密 |
|||
while (inputLen - offSet > 0) { |
|||
if (inputLen - offSet > MAX_ENCRYPT_BLOCK) { |
|||
cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK); |
|||
} else { |
|||
cache = cipher.doFinal(data, offSet, inputLen - offSet); |
|||
} |
|||
out.write(cache, 0, cache.length); |
|||
i++; |
|||
offSet = i * MAX_ENCRYPT_BLOCK; |
|||
} |
|||
byte[] encryptedData = out.toByteArray(); |
|||
out.close(); |
|||
return encryptedData; |
|||
} |
|||
|
|||
/** |
|||
* <p> |
|||
* 私钥加密 |
|||
* </p> |
|||
* |
|||
* @param data |
|||
* 源数据 |
|||
* @param privateKey |
|||
* 私钥(十六进制编码) |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public static byte[] encryptByPrivateKey(byte[] data, String privateKey) throws Exception { |
|||
byte[] keyBytes = Base64.getDecoder().decode(privateKey);// 修改base64编码 |
|||
|
|||
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); |
|||
KeyFactory keyFactory = KeyFactory.getInstance(ALGORITHM); |
|||
Key privateK = keyFactory.generatePrivate(pkcs8KeySpec); |
|||
Cipher cipher = Cipher.getInstance(keyFactory.getAlgorithm()); |
|||
cipher.init(Cipher.ENCRYPT_MODE, privateK); |
|||
int inputLen = data.length; |
|||
ByteArrayOutputStream out = new ByteArrayOutputStream(); |
|||
int offSet = 0; |
|||
byte[] cache; |
|||
int i = 0; |
|||
// 对数据分段加密 |
|||
while (inputLen - offSet > 0) { |
|||
if (inputLen - offSet > MAX_ENCRYPT_BLOCK) { |
|||
cache = cipher.doFinal(data, offSet, MAX_ENCRYPT_BLOCK); |
|||
} else { |
|||
cache = cipher.doFinal(data, offSet, inputLen - offSet); |
|||
} |
|||
out.write(cache, 0, cache.length); |
|||
i++; |
|||
offSet = i * MAX_ENCRYPT_BLOCK; |
|||
} |
|||
byte[] encryptedData = out.toByteArray(); |
|||
out.close(); |
|||
return encryptedData; |
|||
} |
|||
|
|||
/** |
|||
* <p> |
|||
* 公钥解密 |
|||
* </p> |
|||
* |
|||
* @param encryptedData |
|||
* 已加密数据 |
|||
* @param publicKey |
|||
* 公钥 |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public static String decryptByPublicKey(String encryptedData, String publicKey) throws Exception { |
|||
return new String(decryptByPublicKey(Base64.getDecoder().decode(encryptedData), publicKey)); |
|||
} |
|||
|
|||
/** |
|||
* <p> |
|||
* 公钥加密,返回十六进制编码的密文 |
|||
* </p> |
|||
* |
|||
* @param data |
|||
* 源数据 |
|||
* @param publicKey |
|||
* 公钥(十六进制编码) |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public static String encryptByPublicKey(String data, String publicKey) throws Exception { |
|||
return new String(Base64.getEncoder().encode(encryptByPublicKey(data.getBytes(), publicKey))); |
|||
} |
|||
|
|||
/** |
|||
* <p> |
|||
* 私钥加密,返回十六进制编码的密文 |
|||
* </p> |
|||
* |
|||
* @param data |
|||
* 源数据 |
|||
* @param privateKey |
|||
* 私钥(十六进制编码) |
|||
* @return |
|||
* @throws Exception |
|||
*/ |
|||
public static String encryptByPrivateKey(String data, String privateKey) throws Exception { |
|||
return new String(Base64.getEncoder().encode(encryptByPrivateKey(data.getBytes(), privateKey))); |
|||
} |
|||
|
|||
public static String signByPrivate(String content, PrivateKey privateKey, String input_charset) throws Exception { |
|||
if (privateKey == null) { |
|||
throw new Exception("加密私钥为空, 请设置"); |
|||
} |
|||
Signature signature = Signature.getInstance(SIGN_ALGORITHMS); |
|||
signature.initSign(privateKey); |
|||
signature.update(content.getBytes(input_charset)); |
|||
return new String(Base64.getEncoder().encode(signature.sign())); |
|||
} |
|||
|
|||
public static String signByPrivate(String content, String privateKey, String input_charset) throws Exception { |
|||
if (privateKey == null) { |
|||
throw new Exception("加密私钥为空, 请设置"); |
|||
} |
|||
PrivateKey privateKeyInfo = getPrivateKey(privateKey); |
|||
return signByPrivate(content, privateKeyInfo, input_charset); |
|||
} |
|||
|
|||
/** |
|||
* RSA验签名检查 |
|||
* |
|||
* @param content |
|||
* 待签名数据 |
|||
* @param sign |
|||
* 签名值 |
|||
* @param publicKey |
|||
* 支付宝公钥 |
|||
* @param input_charset |
|||
* 编码格式 |
|||
* @return 布尔值 |
|||
*/ |
|||
public static boolean verify(String content, String sign, String publicKey, String input_charset) { |
|||
try { |
|||
KeyFactory keyFactory = KeyFactory.getInstance("RSA"); |
|||
byte[] encodedKey = Base64.getDecoder().decode(publicKey); |
|||
PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); |
|||
return verify(content, sign, pubKey, input_charset); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return false; |
|||
|
|||
} |
|||
|
|||
public static boolean verify(String content, String sign, PublicKey publicKey, String inputCharset) { |
|||
try { |
|||
Signature signature = Signature.getInstance(SIGN_ALGORITHMS); |
|||
signature.initVerify(publicKey); |
|||
signature.update(content.getBytes(inputCharset)); |
|||
boolean bverify = signature.verify(Base64.getDecoder().decode(sign)); |
|||
return bverify; |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
return false; |
|||
} |
|||
|
|||
/** |
|||
* 得到私钥 |
|||
* |
|||
* @param key |
|||
* 密钥字符串(经过base64编码) |
|||
* @throws Exception |
|||
*/ |
|||
public static PrivateKey getPrivateKey(String key) throws Exception { |
|||
byte[] keyBytes = buildPKCS8Key(key); |
|||
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); |
|||
KeyFactory keyFactory = KeyFactory.getInstance("RSA"); |
|||
PrivateKey privateKey = keyFactory.generatePrivate(keySpec); |
|||
return privateKey; |
|||
|
|||
} |
|||
|
|||
private static byte[] buildPKCS8Key(String privateKey) throws IOException { |
|||
if (privateKey.contains("-----BEGIN PRIVATE KEY-----")) { |
|||
return Base64.getDecoder().decode(privateKey.replaceAll("-----\\w+ PRIVATE KEY-----", "")); |
|||
} else if (privateKey.contains("-----BEGIN RSA PRIVATE KEY-----")) { |
|||
final byte[] innerKey = Base64.getDecoder().decode(privateKey.replaceAll("-----\\w+ RSA PRIVATE KEY-----", "")); |
|||
final byte[] result = new byte[innerKey.length + 26]; |
|||
System.arraycopy(Base64.getDecoder().decode("MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKY="), 0, result, 0, 26); |
|||
System.arraycopy(BigInteger.valueOf(result.length - 4).toByteArray(), 0, result, 2, 2); |
|||
System.arraycopy(BigInteger.valueOf(innerKey.length).toByteArray(), 0, result, 24, 2); |
|||
System.arraycopy(innerKey, 0, result, 26, innerKey.length); |
|||
return result; |
|||
} else { |
|||
return Base64.getDecoder().decode(privateKey); |
|||
} |
|||
} |
|||
|
|||
} |
@ -0,0 +1,57 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.service.shop; |
|||
|
|||
import com.shop.cereshop.business.page.shop.ShopCrossDetail; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailGetAllParam; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailSaveParam; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailUpdateParam; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
|
|||
public interface CereShopCrossDetailService { |
|||
|
|||
/** |
|||
* 查询详情 |
|||
* @return |
|||
*/ |
|||
ShopCrossDetail getById(Long crossDetailId); |
|||
|
|||
/** |
|||
* 查询列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
Page<ShopCrossDetail> getAll(ShopCrossDetailGetAllParam param); |
|||
|
|||
/** |
|||
* 更新仓库 |
|||
* @param shopCrossDetailUpdateParam |
|||
* @param user |
|||
* @return |
|||
* @throws CoBusinessException |
|||
*/ |
|||
int update(ShopCrossDetailUpdateParam shopCrossDetailUpdateParam, CerePlatformBusiness user) throws CoBusinessException; |
|||
|
|||
/** |
|||
* 插入仓库 |
|||
* @param shopCrossDetailSaveParam |
|||
* @param user |
|||
* @return |
|||
* @throws CoBusinessException |
|||
*/ |
|||
int insert(ShopCrossDetailSaveParam shopCrossDetailSaveParam, CerePlatformBusiness user) throws CoBusinessException; |
|||
|
|||
/** |
|||
* 删除仓库 |
|||
* @param storehouseId |
|||
* @param user |
|||
* @return |
|||
* @throws CoBusinessException |
|||
*/ |
|||
int deleteById(Long storehouseId, CerePlatformBusiness user) throws CoBusinessException; |
|||
} |
@ -0,0 +1,98 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.service.shop.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import com.shop.cereshop.business.dao.shop.CereShopCrossDetailDAO; |
|||
import com.shop.cereshop.business.page.shop.ShopCrossDetail; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailGetAllParam; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailSaveParam; |
|||
import com.shop.cereshop.business.param.shop.ShopCrossDetailUpdateParam; |
|||
import com.shop.cereshop.business.service.log.CerePlatformLogService; |
|||
import com.shop.cereshop.business.service.shop.CereShopCrossDetailService; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.shop.CereShopCrossDetail; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Isolation; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
public class CereShopCrossDetailServiceImpl implements CereShopCrossDetailService { |
|||
|
|||
@Autowired |
|||
private CereShopCrossDetailDAO cereShopCrossDetailDAO; |
|||
|
|||
@Autowired |
|||
private CerePlatformLogService cerePlatformLogService; |
|||
|
|||
@Override |
|||
public ShopCrossDetail getById(Long crossDetailId) { |
|||
ShopCrossDetail shopCrossDetail = new ShopCrossDetail(); |
|||
CereShopCrossDetail cereShopCrossDetail = cereShopCrossDetailDAO.selectById(crossDetailId); |
|||
BeanUtils.copyProperties(cereShopCrossDetail, shopCrossDetail); |
|||
return shopCrossDetail; |
|||
} |
|||
|
|||
@Override |
|||
public Page<ShopCrossDetail> getAll(ShopCrossDetailGetAllParam param) { |
|||
LambdaQueryWrapper<CereShopCrossDetail> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(CereShopCrossDetail::getShopId, param.getShopId()); |
|||
// wrapper.like(StringUtils.isNotBlank(param.getStorehouseName()), CereShopStorehouse::getStorehouseName, param.getStorehouseName()); |
|||
|
|||
PageHelper.startPage(param.getPage(),param.getPageSize()); |
|||
List<CereShopCrossDetail> list= cereShopCrossDetailDAO.selectList(wrapper); |
|||
List<ShopCrossDetail> shopCrossDetailList= list.stream().map(item -> { |
|||
ShopCrossDetail shopCrossDetail = new ShopCrossDetail(); |
|||
BeanUtils.copyProperties(item, shopCrossDetail); |
|||
return shopCrossDetail; |
|||
}).collect(Collectors.toList()); |
|||
PageInfo<ShopCrossDetail> pageInfo=new PageInfo<>(shopCrossDetailList); |
|||
return new Page<>(pageInfo.getList(), pageInfo.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) |
|||
public int update(ShopCrossDetailUpdateParam shopCrossDetailUpdateParam, CerePlatformBusiness user) throws CoBusinessException { |
|||
CereShopCrossDetail cereShopCrossDetail = new CereShopCrossDetail(); |
|||
BeanUtils.copyProperties(shopCrossDetailUpdateParam, cereShopCrossDetail); |
|||
int result = cereShopCrossDetailDAO.updateById(cereShopCrossDetail); |
|||
//新增日志 |
|||
cerePlatformLogService.addLog(user,"店铺管理","商户端操作","更新跨境信息",cereShopCrossDetail.getCrossDetailId()); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) |
|||
public int insert(ShopCrossDetailSaveParam shopCrossDetailSaveParam, CerePlatformBusiness user) throws CoBusinessException { |
|||
CereShopCrossDetail cereShopCrossDetail = new CereShopCrossDetail(); |
|||
BeanUtils.copyProperties(shopCrossDetailSaveParam, cereShopCrossDetail); |
|||
int result = cereShopCrossDetailDAO.insert(cereShopCrossDetail); |
|||
//新增日志 |
|||
cerePlatformLogService.addLog(user,"店铺管理","商户端操作","新增跨境信息",cereShopCrossDetail.getCrossDetailId()); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) |
|||
public int deleteById(Long crossDetailId, CerePlatformBusiness user) throws CoBusinessException { |
|||
CereShopCrossDetail cereShopCrossDetail=new CereShopCrossDetail(); |
|||
cereShopCrossDetail.setCrossDetailId(crossDetailId); |
|||
int result = cereShopCrossDetailDAO.deleteById(cereShopCrossDetail); |
|||
//新增日志 |
|||
cerePlatformLogService.addLog(user,"店铺管理","商户端操作","删除跨境信息",cereShopCrossDetail.getCrossDetailId()); |
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,57 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.service.storehouse; |
|||
|
|||
import com.shop.cereshop.business.page.storehouse.Storehouse; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseGetAllParam; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseSaveParam; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseUpdateParam; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
|
|||
public interface CereShopStorehouseService { |
|||
|
|||
/** |
|||
* 查询详情 |
|||
* @return |
|||
*/ |
|||
Storehouse getById(Long storehouseId); |
|||
|
|||
/** |
|||
* 查询列表 |
|||
* @param param |
|||
* @return |
|||
*/ |
|||
Page<Storehouse> getAll(ShopStorehouseGetAllParam param); |
|||
|
|||
/** |
|||
* 更新仓库 |
|||
* @param shopStorehouseUpdateParam |
|||
* @param user |
|||
* @return |
|||
* @throws CoBusinessException |
|||
*/ |
|||
int update(ShopStorehouseUpdateParam shopStorehouseUpdateParam, CerePlatformBusiness user) throws CoBusinessException; |
|||
|
|||
/** |
|||
* 插入仓库 |
|||
* @param shopStorehouseSaveParam |
|||
* @param user |
|||
* @return |
|||
* @throws CoBusinessException |
|||
*/ |
|||
int insert(ShopStorehouseSaveParam shopStorehouseSaveParam, CerePlatformBusiness user) throws CoBusinessException; |
|||
|
|||
/** |
|||
* 删除仓库 |
|||
* @param storehouseId |
|||
* @param user |
|||
* @return |
|||
* @throws CoBusinessException |
|||
*/ |
|||
int deleteById(Long storehouseId, CerePlatformBusiness user) throws CoBusinessException; |
|||
} |
@ -0,0 +1,99 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.business.service.storehouse.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.github.pagehelper.PageHelper; |
|||
import com.github.pagehelper.PageInfo; |
|||
import com.shop.cereshop.business.dao.storehouse.CereShopStorehouseDAO; |
|||
import com.shop.cereshop.business.page.storehouse.Storehouse; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseGetAllParam; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseSaveParam; |
|||
import com.shop.cereshop.business.param.storehouse.ShopStorehouseUpdateParam; |
|||
import com.shop.cereshop.business.service.log.CerePlatformLogService; |
|||
import com.shop.cereshop.business.service.storehouse.CereShopStorehouseService; |
|||
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness; |
|||
import com.shop.cereshop.commons.domain.common.Page; |
|||
import com.shop.cereshop.commons.domain.storehouse.CereShopStorehouse; |
|||
import com.shop.cereshop.commons.exception.CoBusinessException; |
|||
import com.shop.cereshop.commons.utils.StringUtils; |
|||
import org.springframework.beans.BeanUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Isolation; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
public class CereShopStorehouseServiceImpl implements CereShopStorehouseService { |
|||
|
|||
@Autowired |
|||
private CereShopStorehouseDAO cereShopStorehouseDAO; |
|||
|
|||
@Autowired |
|||
private CerePlatformLogService cerePlatformLogService; |
|||
|
|||
@Override |
|||
public Storehouse getById(Long storehouseId) { |
|||
Storehouse storehouse = new Storehouse(); |
|||
CereShopStorehouse cereShopStorehouse = cereShopStorehouseDAO.selectById(storehouseId); |
|||
BeanUtils.copyProperties(cereShopStorehouse, storehouse); |
|||
return storehouse; |
|||
} |
|||
|
|||
@Override |
|||
public Page<Storehouse> getAll(ShopStorehouseGetAllParam param) { |
|||
LambdaQueryWrapper<CereShopStorehouse> wrapper = new LambdaQueryWrapper<>(); |
|||
wrapper.eq(CereShopStorehouse::getShopId, param.getShopId()); |
|||
wrapper.like(StringUtils.isNotBlank(param.getStorehouseName()), CereShopStorehouse::getStorehouseName, param.getStorehouseName()); |
|||
|
|||
PageHelper.startPage(param.getPage(),param.getPageSize()); |
|||
List<CereShopStorehouse> list= cereShopStorehouseDAO.selectList(wrapper); |
|||
List<Storehouse> storehouseList= list.stream().map(item -> { |
|||
Storehouse storehouse = new Storehouse(); |
|||
BeanUtils.copyProperties(item, storehouse); |
|||
return storehouse; |
|||
}).collect(Collectors.toList()); |
|||
PageInfo<Storehouse> pageInfo=new PageInfo<>(storehouseList); |
|||
return new Page<>(pageInfo.getList(), pageInfo.getTotal()); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) |
|||
public int update(ShopStorehouseUpdateParam shopStorehouseUpdateParam, CerePlatformBusiness user) throws CoBusinessException { |
|||
CereShopStorehouse cereShopStorehouse = new CereShopStorehouse(); |
|||
BeanUtils.copyProperties(shopStorehouseUpdateParam, cereShopStorehouse); |
|||
int result = cereShopStorehouseDAO.updateById(cereShopStorehouse); |
|||
//新增日志 |
|||
cerePlatformLogService.addLog(user,"仓库管理","商户端操作","更新仓库",cereShopStorehouse.getStorehouseId()); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) |
|||
public int insert(ShopStorehouseSaveParam shopStorehouseSaveParam, CerePlatformBusiness user) throws CoBusinessException { |
|||
CereShopStorehouse cereShopStorehouse = new CereShopStorehouse(); |
|||
BeanUtils.copyProperties(shopStorehouseSaveParam, cereShopStorehouse); |
|||
int result = cereShopStorehouseDAO.insert(cereShopStorehouse); |
|||
//新增日志 |
|||
cerePlatformLogService.addLog(user,"仓库管理","商户端操作","新增仓库",cereShopStorehouse.getStorehouseId()); |
|||
return result; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class}) |
|||
public int deleteById(Long storehouseId, CerePlatformBusiness user) throws CoBusinessException { |
|||
CereShopStorehouse cereShopStorehouse=new CereShopStorehouse(); |
|||
cereShopStorehouse.setStorehouseId(storehouseId); |
|||
int result = cereShopStorehouseDAO.deleteById(cereShopStorehouse); |
|||
//新增日志 |
|||
cerePlatformLogService.addLog(user,"仓库管理","商户端操作","删除仓库",cereShopStorehouse.getStorehouseId()); |
|||
return result; |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|||
<mapper namespace="com.shop.cereshop.business.dao.storehouse.CereShopStorehouseDAO"> |
|||
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.storehouse.CereShopStorehouse"> |
|||
<id column="storehouse_id" jdbcType="BIGINT" property="storehouseId" /> |
|||
<result column="shop_id" jdbcType="BIGINT" property="shopId" /> |
|||
<result column="storehouse_name" jdbcType="VARCHAR" property="storehouseName" /> |
|||
<result column="type" jdbcType="INTEGER" property="type" /> |
|||
<result column="kind" jdbcType="INTEGER" property="kind" /> |
|||
<result column="if_cashier" jdbcType="BIT" property="ifCashier" /> |
|||
<result column="one_product_order_price_limit" jdbcType="DECIMAL" property="oneProductOrderPriceLimit" /> |
|||
<result column="more_product_order_price_limit" jdbcType="DECIMAL" property="moreProductOrderPriceLimit" /> |
|||
<result column="one_product_num_limit" jdbcType="INTEGER" property="oneProductNumLimit" /> |
|||
<result column="more_product_num_limit" jdbcType="INTEGER" property="moreProductNumLimit" /> |
|||
<result column="order_number_limit" jdbcType="INTEGER" property="orderNumberLimit" /> |
|||
<result column="create_time" jdbcType="VARCHAR" property="createTime" /> |
|||
<result column="update_time" jdbcType="VARCHAR" property="updateTime" /> |
|||
</resultMap> |
|||
<sql id="Base_Column_List"> |
|||
storehouse_id, shop_id, storehouse_name, type, kind, if_cashier, one_product_order_price_limit, more_product_order_price_limit,one_product_num_limit,more_product_num_limit, order_number_limit,create_time,update_time |
|||
</sql> |
|||
|
|||
</mapper> |
@ -0,0 +1,20 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.commons.config; |
|||
|
|||
import org.springframework.stereotype.Component; |
|||
|
|||
@Component |
|||
public class HuaxunConfig { |
|||
|
|||
// 加密key |
|||
public static String KEY = "alexyu01"; |
|||
|
|||
// PAY_URL |
|||
public static String PAY_URL = "https://bg.qdhuaxun.cn/index.php?r=paybaoguan.api.pay&appid=8bd29f557af22ec4062774"; |
|||
// PAYBACK_URL |
|||
public static String PAYBACK_URL = "https://bg.qdhuaxun.cn/index.php?r=paybaoguan.api.payback&appid=8bd29f557af22ec4062774"; |
|||
} |
@ -0,0 +1,51 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.commons.constant; |
|||
|
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import lombok.Getter; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
@JsonFormat(shape = JsonFormat.Shape.OBJECT) |
|||
@Getter |
|||
public enum XsPayEnum { |
|||
|
|||
TRADE_TYPE_IMMEDIATE_PAYMENT("即时付款","0002", ""), |
|||
TRADE_TYPE_CROSS_BOARD_PAYMENT("跨境支付","0004", ""), |
|||
PAY_TYPE_QRCODE("QRCODE","4", "扫码支付,商户被扫"), |
|||
PAY_TYPE_JS("JS","5", "公众号,小程序/服务窗支付"), |
|||
PAY_TYPE_PAYCODE("PAYCODE","6", "刷卡支付,商户主扫"), |
|||
PAY_TYPE_APP("APP","74", "APP 支付"), |
|||
PAY_TYPE_H5("H5","7", "H5直连"); |
|||
|
|||
String name; |
|||
String code; |
|||
String desc; |
|||
|
|||
private static Map<String, XsPayEnum> valueMap = new HashMap<>(); |
|||
|
|||
static { |
|||
for(XsPayEnum gender : XsPayEnum.values()) { |
|||
valueMap.put(gender.name, gender); |
|||
} |
|||
} |
|||
|
|||
XsPayEnum(String name, String code, String desc) { |
|||
this.code = code; |
|||
this.name=name; |
|||
this.desc=desc; |
|||
} |
|||
|
|||
public static String getByName(String name) { |
|||
XsPayEnum result = valueMap.get(name); |
|||
if(result == null) { |
|||
throw new IllegalArgumentException("No element matches " + name); |
|||
} |
|||
return result.code; |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
package com.shop.cereshop.commons.domain.huaxun; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@ApiModel(value = "ExpressListVo", description = "华讯物流接口入参") |
|||
public class ExpressListVo implements Serializable { |
|||
/** |
|||
* 订单编号 |
|||
*/ |
|||
@ApiModelProperty(value = "订单编号") |
|||
private String order_no; |
|||
|
|||
/** |
|||
* 快递单号 |
|||
*/ |
|||
@ApiModelProperty(value = "快递单号") |
|||
private String express_no; |
|||
|
|||
/** |
|||
* 快递公司编码 |
|||
* yuantong:圆通,zhongtong:中通,shentong:申通,yunda:韵达,shunfeng:顺丰,ems:邮政EMS,jd:京东, |
|||
*/ |
|||
@ApiModelProperty(value = "快递公司编码") |
|||
private String express_code; |
|||
|
|||
/** |
|||
* 快递公司名称 |
|||
* 圆通,中通,申通,韵达,顺丰,邮政EMS,京东, |
|||
*/ |
|||
@ApiModelProperty(value = "快递公司名称") |
|||
private String express_name; |
|||
|
|||
/** |
|||
* 状态 |
|||
* OK:已发货,FAIL:清关失败 |
|||
*/ |
|||
@ApiModelProperty(value = "状态") |
|||
private String status; |
|||
|
|||
/** |
|||
* 清关失败信息 |
|||
*/ |
|||
@ApiModelProperty(value = "信息") |
|||
private String info; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.shop.cereshop.commons.domain.huaxun; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@ApiModel(value = "GoodListVo", description = "商品信息") |
|||
public class GoodListVo implements Serializable { |
|||
/** |
|||
* 商品名称 |
|||
*/ |
|||
@ApiModelProperty(value = "商品名称") |
|||
private String goods_title; |
|||
|
|||
/** |
|||
* 商品规格SKU |
|||
*/ |
|||
@ApiModelProperty(value = "商品规格SKU") |
|||
private String model; |
|||
|
|||
/** |
|||
* 商品销售数量 |
|||
*/ |
|||
@ApiModelProperty(value = "商品销售数量") |
|||
private int number; |
|||
|
|||
/** |
|||
* 商品销售单价 单位:元 |
|||
*/ |
|||
@ApiModelProperty(value = "商品销售单价\t单位:元") |
|||
private double price; |
|||
|
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.shop.cereshop.commons.domain.huaxun; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@ApiModel(value = "HuaxunExpressRequestBo", description = "华讯对外物流接口入参") |
|||
public class HuaxunExpressRequestBo extends HuaxunRequestBo { |
|||
/** |
|||
* 接口入参json |
|||
*/ |
|||
@ApiModelProperty(value = "接口入参json") |
|||
private String data; |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.shop.cereshop.commons.domain.huaxun; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
@ApiModel(value = "HuaxunOrderRequestBo", description = "华讯对外物流接口入参") |
|||
public class HuaxunOrderRequestBo extends HuaxunRequestBo { |
|||
/** |
|||
* 开始时间 |
|||
*/ |
|||
@ApiModelProperty(value = "开始时间") |
|||
private String payStartTime; |
|||
|
|||
/** |
|||
* 结束时间 |
|||
*/ |
|||
@ApiModelProperty(value = "结束时间") |
|||
private String payEndTime; |
|||
|
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.shop.cereshop.commons.domain.huaxun; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@ApiModel(value = "HuaxunPayBaoGuanRequestBo", description = "华讯报关入参") |
|||
public class HuaxunPayBaoGuanRequestBo implements Serializable { |
|||
/** |
|||
* 支付通道 |
|||
*/ |
|||
@ApiModelProperty(value = "支付通道") |
|||
private String channel; |
|||
/** |
|||
* 请求内容 |
|||
*/ |
|||
@ApiModelProperty(value = "请求内容") |
|||
private String request; |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.shop.cereshop.commons.domain.huaxun; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@ApiModel(value = "HuaxunPayBaoGuanResponseBo", description = "华讯报关入参") |
|||
public class HuaxunPayBaoGuanResponseBo implements Serializable { |
|||
/** |
|||
* 支付通道 |
|||
*/ |
|||
@ApiModelProperty(value = "支付通道") |
|||
private String channel; |
|||
/** |
|||
* 支付响应内容 |
|||
*/ |
|||
@ApiModelProperty(value = "支付响应内容") |
|||
private String response; |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.shop.cereshop.commons.domain.huaxun; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
@Data |
|||
@ApiModel(value = "HuaxunRequestBo", description = "华讯对外接口入参") |
|||
public class HuaxunRequestBo implements Serializable { |
|||
|
|||
/** |
|||
* 请求时间,unix时间戳:1623896991 |
|||
*/ |
|||
@ApiModelProperty(value = "请求时间") |
|||
private Long timestamp; |
|||
|
|||
/** |
|||
* 签名串 |
|||
* md5(timestamp+key) |
|||
* 如果timestamp = 1623896991, key = abc |
|||
* 则 sign = md5(1623896991abc) = ec80c53475337996893df1c3118ea3e7 |
|||
*/ |
|||
@ApiModelProperty(value = "签名串") |
|||
private String sign; |
|||
} |
@ -0,0 +1,85 @@ |
|||
package com.shop.cereshop.commons.domain.huaxun; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.List; |
|||
|
|||
@Data |
|||
@ApiModel(value = "OrderListVo", description = "订单信息") |
|||
public class OrderListVo implements Serializable { |
|||
/** |
|||
* 订单编号 |
|||
* 报关用的,与支付订单号一致 |
|||
*/ |
|||
@ApiModelProperty(value = "订单编号") |
|||
private String order_no; |
|||
/** |
|||
* 实际支付总金额 |
|||
* 单位元 |
|||
*/ |
|||
@ApiModelProperty(value = "实际支付总金额") |
|||
private String pay_amount; |
|||
/** |
|||
* 订购人姓名 |
|||
*/ |
|||
@ApiModelProperty(value = "订购人姓名") |
|||
private String buyer_name; |
|||
/** |
|||
* 订购人身份证号码 |
|||
*/ |
|||
@ApiModelProperty(value = "订购人身份证号码") |
|||
private String buyer_idcard; |
|||
/** |
|||
* 订购人手机号 |
|||
* 如果不传,则取收货人手机号 |
|||
*/ |
|||
@ApiModelProperty(value = "订购人手机号") |
|||
private String buyer_mobile; |
|||
/** |
|||
* 收货人姓名 |
|||
*/ |
|||
@ApiModelProperty(value = "收货人姓名") |
|||
private String consignee_name; |
|||
/** |
|||
* 收货人手机号码 |
|||
*/ |
|||
@ApiModelProperty(value = "收货人手机号码") |
|||
private String consignee_mobile; |
|||
/** |
|||
* 详细的收货地址 |
|||
* 需包含省市区等详细地址信息 |
|||
*/ |
|||
@ApiModelProperty(value = "详细的收货地址") |
|||
private String consignee_address; |
|||
|
|||
/** |
|||
* 商品信息 |
|||
*/ |
|||
@ApiModelProperty(value = "商品信息") |
|||
private List<GoodListVo> goods; |
|||
|
|||
// /** |
|||
// * 平台订单号 |
|||
// * 扩展字段,支付单号与订单编号不一致的可以填此字段 |
|||
// */ |
|||
// @ApiModelProperty(value = "平台订单号") |
|||
// private String plat_order_no; |
|||
// /** |
|||
// * 物流服务商 |
|||
// * 扩展字段,指定物流服务商,取值:圆通,中通,申通,韵达,顺丰,邮政EMS,京东 |
|||
// */ |
|||
// @ApiModelProperty(value = "物流服务商") |
|||
// private String logistics_name; |
|||
// |
|||
// /** |
|||
// * 快递单号 |
|||
// * 扩展字段,自己发货的可填此字段 |
|||
// */ |
|||
// @ApiModelProperty(value = "快递单号") |
|||
// private String logistics_no; |
|||
|
|||
|
|||
} |
@ -0,0 +1,156 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.commons.domain.shop; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* cere_shop_cross_detail 店铺跨境拓展信息表 |
|||
* @author pxh |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "CereShopCrossDetail", description = "店铺跨境拓展信息表") |
|||
public class CereShopCrossDetail implements Serializable { |
|||
|
|||
/** |
|||
* 拓展信息Id |
|||
*/ |
|||
@TableId(type = IdType.AUTO) |
|||
@ApiModelProperty(value = "拓展信息Id") |
|||
private Long crossDetailId; |
|||
|
|||
/** |
|||
* 关联店铺id |
|||
*/ |
|||
@ApiModelProperty(value = "关联店铺id") |
|||
private Long shopId; |
|||
|
|||
/** |
|||
* 电商平台名称 |
|||
*/ |
|||
@ApiModelProperty(value = "电商平台名称") |
|||
private String ebpname; |
|||
|
|||
/** |
|||
* 电商平台代码 |
|||
*/ |
|||
@ApiModelProperty(value = "电商平台代码") |
|||
private String ebpcode; |
|||
|
|||
/** |
|||
* 电商企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "电商企业名称") |
|||
private String ebpcname; |
|||
|
|||
/** |
|||
* 电商企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "电商企业代码") |
|||
private String ebpccode; |
|||
/** |
|||
* 申报企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "申报企业名称") |
|||
private String agentName; |
|||
|
|||
/** |
|||
* 申报企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "申报企业代码") |
|||
private String agentCode; |
|||
/** |
|||
* 区内企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "区内企业名称") |
|||
private String areaName; |
|||
|
|||
/** |
|||
* 区内企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "区内企业代码") |
|||
private String areaCode; |
|||
/** |
|||
* 担保企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "担保企业名称") |
|||
private String assureName; |
|||
|
|||
/** |
|||
* 担保企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "担保企业代码") |
|||
private String assureCode; |
|||
/** |
|||
* 账册编号 |
|||
*/ |
|||
@ApiModelProperty(value = "账册编号") |
|||
private String zcCode; |
|||
|
|||
/** |
|||
* 申报海关代码 |
|||
*/ |
|||
@ApiModelProperty(value = "申报海关代码") |
|||
private String sbhgCode; |
|||
|
|||
/** |
|||
* 口岸海关代码 |
|||
*/ |
|||
@ApiModelProperty(value = "口岸海关代码") |
|||
private String kahgCode; |
|||
|
|||
/** |
|||
* 订单传输企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "订单传输企业名称") |
|||
private String copName; |
|||
|
|||
/** |
|||
* 订单传输企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "订单传输企业代码") |
|||
private String copCode; |
|||
|
|||
/** |
|||
* 清单传输企业名称 |
|||
*/ |
|||
@ApiModelProperty(value = "清单传输企业名称") |
|||
private String copName1; |
|||
|
|||
/** |
|||
* 清单传输企业代码 |
|||
*/ |
|||
@ApiModelProperty(value = "清单传输企业代码") |
|||
private String copCode1; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 公司对公银行账户 |
|||
*/ |
|||
@ApiModelProperty(value = "公司对公银行账户") |
|||
private String bankCode; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@ApiModelProperty(value = "创建时间") |
|||
private String createTime; |
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@ApiModelProperty(value = "更新时间") |
|||
private String updateTime; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
} |
@ -0,0 +1,106 @@ |
|||
/* |
|||
* Copyright (C) 2017-2021 |
|||
* All rights reserved, Designed By 深圳中科鑫智科技有限公司 |
|||
* Copyright authorization contact 18814114118 |
|||
*/ |
|||
package com.shop.cereshop.commons.domain.storehouse; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.IdType; |
|||
import com.baomidou.mybatisplus.annotation.TableId; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.math.BigDecimal; |
|||
|
|||
/** |
|||
* cere_shop_storehouse 仓库实体类 |
|||
* @author |
|||
*/ |
|||
@Data |
|||
@ApiModel(value = "CereShopStorehouse", description = "仓库实体类") |
|||
public class CereShopStorehouse implements Serializable { |
|||
|
|||
/** |
|||
* 仓库id |
|||
*/ |
|||
@TableId(type = IdType.AUTO) |
|||
@ApiModelProperty(value = "仓库id") |
|||
private Long storehouseId; |
|||
/** |
|||
* 关联店铺id |
|||
*/ |
|||
@ApiModelProperty(value = "店铺id") |
|||
private Long shopId; |
|||
|
|||
/** |
|||
* 仓库名称 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库名称") |
|||
private String storehouseName; |
|||
|
|||
/** |
|||
* 仓库类型 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库类型") |
|||
private Integer type; |
|||
|
|||
/** |
|||
* 仓库种类 |
|||
*/ |
|||
@ApiModelProperty(value = "仓库种类") |
|||
private Integer kind; |
|||
|
|||
/** |
|||
* 是否收银台 1-是 0-否 |
|||
*/ |
|||
@ApiModelProperty(value = "是否收银台") |
|||
private Integer ifCashier; |
|||
|
|||
/** |
|||
* 单商品订单限额 |
|||
*/ |
|||
@ApiModelProperty(value = "单商品订单限额") |
|||
private BigDecimal oneProductOrderPriceLimit; |
|||
|
|||
/** |
|||
* 多商品订单限额 |
|||
*/ |
|||
@ApiModelProperty(value = "多商品订单限额") |
|||
private BigDecimal moreProductOrderPriceLimit; |
|||
|
|||
/** |
|||
* 单商品数量限制 |
|||
*/ |
|||
@ApiModelProperty(value = "单商品数量限制") |
|||
private Integer oneProductNumLimit; |
|||
|
|||
/** |
|||
* 总商品数量限制 |
|||
*/ |
|||
@ApiModelProperty(value = "总商品数量限制") |
|||
private Integer moreProductNumLimit; |
|||
|
|||
/** |
|||
* 订单次数限制 |
|||
*/ |
|||
@ApiModelProperty(value = "订单次数限制") |
|||
private Integer orderNumberLimit; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
@ApiModelProperty(value = "创建时间") |
|||
private String createTime; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
@ApiModelProperty(value = "更新时间") |
|||
private String updateTime; |
|||
|
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
} |
@ -1,4 +1,4 @@ |
|||
package com.shop.cereshop.app.pay.xs.utils; |
|||
package com.shop.cereshop.commons.utils; |
|||
|
|||
import java.io.UnsupportedEncodingException; |
|||
import java.security.MessageDigest; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue