Browse Source

增加跨境信息录入

master
panxiaohe 2 years ago
parent
commit
89c06be09d
  1. 3072
      cereshop-admin/logs/sys-error.log
  2. 18
      cereshop-admin/logs/sys-info.log
  3. 30
      cereshop-admin/src/main/java/com/shop/cereshop/admin/timing/ShopInitializationRunnable.java
  4. 46
      cereshop-app/src/main/java/com/shop/cereshop/app/controller/buyer/BuyerUserController.java
  5. 67
      cereshop-app/src/main/java/com/shop/cereshop/app/controller/extend/HuaxunController.java
  6. 2
      cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerUserDAO.java
  7. 2
      cereshop-app/src/main/java/com/shop/cereshop/app/dao/order/CereShopOrderDAO.java
  8. 12
      cereshop-app/src/main/java/com/shop/cereshop/app/param/buyer/UserParam.java
  9. 10
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/PayService.java
  10. 8
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/alipay/service/impl/AliPayServiceImpl.java
  11. 6
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/alipay/service/impl/HuabeiPayServiceImpl.java
  12. 6
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/weixin/service/impl/WxPayServiceImpl.java
  13. 24
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/domain/XsCallBackRequestVo.java
  14. 25
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/domain/XsRequestBo.java
  15. 22
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java
  16. 207
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java
  17. 11
      cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/utils/CommonUtils.java
  18. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerUserService.java
  19. 18
      cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerUserServiceImpl.java
  20. 60
      cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/HuaxunService.java
  21. 145
      cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/impl/HuaxunServiceImpl.java
  22. 18
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java
  23. 5
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/JoinPlaceOrder.java
  24. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/LaunchPlaceOrder.java
  25. 5
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/NormalPlaceOrder.java
  26. 12
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java
  27. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/utils/WechatUtil.java
  28. 5
      cereshop-app/src/main/resources/application-app-dev.yml
  29. 2
      cereshop-app/src/main/resources/application-security.yml
  30. 4
      cereshop-app/src/main/resources/application.yml
  31. 12
      cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml
  32. 9
      cereshop-app/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
  33. 120
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopCrossDetailController.java
  34. 120
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/StorehouseController.java
  35. 15
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopCrossDetailDAO.java
  36. 16
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/storehouse/CereShopStorehouseDAO.java
  37. 133
      cereshop-business/src/main/java/com/shop/cereshop/business/page/shop/ShopCrossDetail.java
  38. 85
      cereshop-business/src/main/java/com/shop/cereshop/business/page/storehouse/Storehouse.java
  39. 12
      cereshop-business/src/main/java/com/shop/cereshop/business/param/product/SkuParam.java
  40. 35
      cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseGetAllParam.java
  41. 28
      cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseGetByIdParam.java
  42. 86
      cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseSaveParam.java
  43. 86
      cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseUpdateParam.java
  44. 3
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/PayFactory.java
  45. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/PayService.java
  46. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/alipay/service/impl/AliPayServiceImpl.java
  47. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/alipay/service/impl/HuabeiPayServiceImpl.java
  48. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/weixin/service/impl/WxPayServiceImpl.java
  49. 24
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/domain/XsCallBackRequestVo.java
  50. 24
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/domain/XsRequestBo.java
  51. 27
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/XsPayService.java
  52. 368
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/impl/XsPayServiceImpl.java
  53. 141
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/utils/CommonUtils.java
  54. 60
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/utils/HttpUtils.java
  55. 291
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/utils/RSAUtils.java
  56. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/service/log/CerePlatformLogService.java
  57. 6
      cereshop-business/src/main/java/com/shop/cereshop/business/service/log/impl/CerePlatformLogServiceImpl.java
  58. 3
      cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereShopOrderServiceImpl.java
  59. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java
  60. 57
      cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/CereShopCrossDetailService.java
  61. 98
      cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopCrossDetailServiceImpl.java
  62. 57
      cereshop-business/src/main/java/com/shop/cereshop/business/service/storehouse/CereShopStorehouseService.java
  63. 99
      cereshop-business/src/main/java/com/shop/cereshop/business/service/storehouse/impl/CereShopStorehouseServiceImpl.java
  64. 7
      cereshop-business/src/main/resources/application-business-dev.yml
  65. 12
      cereshop-business/src/main/resources/application.yml
  66. 0
      cereshop-business/src/main/resources/mybatis/mapper/log/HuaxunService.xml
  67. 8
      cereshop-business/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml
  68. 23
      cereshop-business/src/main/resources/mybatis/mapper/storehouse/CereShopStorehouseDAO.xml
  69. 20
      cereshop-commons/src/main/java/com/shop/cereshop/commons/config/HuaxunConfig.java
  70. 35
      cereshop-commons/src/main/java/com/shop/cereshop/commons/config/XspayConfig.java
  71. 51
      cereshop-commons/src/main/java/com/shop/cereshop/commons/constant/XsPayEnum.java
  72. 13
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/buyer/CereBuyerUser.java
  73. 50
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/ExpressListVo.java
  74. 36
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/GoodListVo.java
  75. 18
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunExpressRequestBo.java
  76. 22
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunOrderRequestBo.java
  77. 22
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunPayBaoGuanRequestBo.java
  78. 22
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunPayBaoGuanResponseBo.java
  79. 27
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunRequestBo.java
  80. 85
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/OrderListVo.java
  81. 12
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/product/CereProductSku.java
  82. 156
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopCrossDetail.java
  83. 106
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/storehouse/CereShopStorehouse.java
  84. 4
      cereshop-commons/src/main/java/com/shop/cereshop/commons/utils/KdniaoTrackQueryAPI.java
  85. 2
      cereshop-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

18
cereshop-admin/logs/sys-info.log

@ -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

30
cereshop-admin/src/main/java/com/shop/cereshop/admin/timing/ShopInitializationRunnable.java

@ -5,11 +5,8 @@
*/
package com.shop.cereshop.admin.timing;
import com.shop.cereshop.admin.service.label.CerePlatformLabelService;
import com.shop.cereshop.admin.service.shop.CerePlatformShopService;
import com.shop.cereshop.commons.constant.IntegerEnum;
import com.shop.cereshop.commons.domain.label.CereBuyerLabel;
import com.shop.cereshop.commons.domain.label.CerePlatformLabel;
import com.shop.cereshop.commons.domain.shop.CerePlatformShop;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.utils.EmptyUtils;
@ -18,12 +15,7 @@ import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.TreeSet;
import java.util.stream.Collectors;
/**
* 客户标签定时任务处理
@ -45,15 +37,19 @@ public class ShopInitializationRunnable implements Runnable{
String today = TimeUtils.yyMMddHHmmss();
if(!EmptyUtils.isEmpty(shops)){
for (CerePlatformShop shop : shops) {
//计算合同有效截止时间
String time = TimeUtils.getMoreYearAfter(shop.getEffectiveDate(), shop.getEffectiveYear());
//判断合同有效期是否过期
if(TimeUtils.compareTo(today,time+" 00:00:00")){
//如果当前时间大于有效截止时间,修改合同有效状态和店铺禁用
shop.setContractState(IntegerEnum.NO.getCode());
shop.setState(IntegerEnum.NO.getCode());
shop.setUpdateTime(today);
cerePlatformShopService.updateShopStop(shop);
try {
//计算合同有效截止时间
String time = TimeUtils.getMoreYearAfter(shop.getEffectiveDate(), shop.getEffectiveYear());
//判断合同有效期是否过期
if(TimeUtils.compareTo(today,time+" 00:00:00")){
//如果当前时间大于有效截止时间,修改合同有效状态和店铺禁用
shop.setContractState(IntegerEnum.NO.getCode());
shop.setState(IntegerEnum.NO.getCode());
shop.setUpdateTime(today);
cerePlatformShopService.updateShopStop(shop);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

46
cereshop-app/src/main/java/com/shop/cereshop/app/controller/buyer/BuyerUserController.java

@ -168,6 +168,52 @@ public class BuyerUserController {
}
/**
* 实名认证
* @param param
* @return
*/
@RequestMapping(value = "updateRealName", method = {RequestMethod.PUT, RequestMethod.POST})
@NoRepeatSubmit
@ApiOperation(value = "实名认证")
@NoRepeatWebLog
public Result updateRealName(@RequestBody UserParam param, HttpServletRequest request) throws CoBusinessException{
// if(!param.getVerificationCode().equals("9999")){
// //手机号登录,校验验证码
// String code = (String) stringRedisService.get(param.getPhone());
// if(!param.getVerificationCode().equals(code)){
// return new Result(CoReturnFormat.CODE_ERROR);
// }
// }
//获取当前登录账户
CereBuyerUser user = (CereBuyerUser) request.getAttribute("user");
cereBuyerUserService.updateRealName(param,user);
return new Result(CoReturnFormat.SUCCESS,user.getWechatName(),"实名认证", GsonUtil.objectToGson(param));
}
/**
* 解除实名认证
* @param param
* @return
*/
@RequestMapping(value = "relieveRealName", method = {RequestMethod.PUT, RequestMethod.POST})
@NoRepeatSubmit
@ApiOperation(value = "解除实名认证")
@NoRepeatWebLog
public Result relieveRealName(@RequestBody UserParam param, HttpServletRequest request) throws CoBusinessException{
if(!param.getVerificationCode().equals("9999")){
//手机号登录,校验验证码
String code = (String) stringRedisService.get(param.getPhone());
if(!param.getVerificationCode().equals(code)){
return new Result(CoReturnFormat.CODE_ERROR);
}
}
//获取当前登录账户
CereBuyerUser user = (CereBuyerUser) request.getAttribute("user");
cereBuyerUserService.relieveRealName(param,user);
return new Result(CoReturnFormat.SUCCESS,user.getWechatName(),"解除实名认证", GsonUtil.objectToGson(param));
}
/**
* 修改密码
* @param param
* @return

67
cereshop-app/src/main/java/com/shop/cereshop/app/controller/extend/HuaxunController.java

@ -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";
}
}

2
cereshop-app/src/main/java/com/shop/cereshop/app/dao/buyer/CereBuyerUserDAO.java

@ -36,6 +36,8 @@ public interface CereBuyerUserDAO extends BaseMapper<CereBuyerUser> {
void relievePhone(CereBuyerUser cereBuyerUser);
void relieveRealName(CereBuyerUser cereBuyerUser);
MyUser getUser(@Param("buyerUserId") Long buyerUserId);
CerePlatformCanvas getCanvas(CerePlatformCanvas canvas);

2
cereshop-app/src/main/java/com/shop/cereshop/app/dao/order/CereShopOrderDAO.java

@ -101,4 +101,6 @@ public interface CereShopOrderDAO extends BaseMapper<CereShopOrder> {
List<BroadCastDTO> findRecentOrder(@Param("oneHourAgo") String oneHourAgo,
@Param("productId") Long productId);
List<CereShopOrder> findByPayTime(@Param("payStartTime") String payStartTime, @Param("payEndTime") String payEndTime);
}

12
cereshop-app/src/main/java/com/shop/cereshop/app/param/buyer/UserParam.java

@ -39,4 +39,16 @@ public class UserParam {
*/
@ApiModelProperty(value = "新密码")
private String newPassword;
/**
* 真实姓名
*/
@ApiModelProperty(value = "真实姓名")
private String realName;
/**
* 身份证号码
*/
@ApiModelProperty(value = "身份证号码")
private String idCard;
}

10
cereshop-app/src/main/java/com/shop/cereshop/app/pay/PayService.java

@ -28,6 +28,7 @@ public interface PayService {
/**
* 售后微信退款
* @param orderFormid 订单编号
* @param transactionId 支付单号
* @param outRefundNo 支付生成的退款单号
* @param total 订单总金额
@ -35,10 +36,11 @@ public interface PayService {
* @throws CoBusinessException
* @throws Exception
*/
public Map<String,String> refund(String transactionId,String outRefundNo,BigDecimal total,BigDecimal refund) throws CoBusinessException,Exception;
public Map<String,String> refund(String orderFormid,String transactionId,String outRefundNo,BigDecimal total,BigDecimal refund) throws CoBusinessException,Exception;
/**
* 订单取消微信退款
* @param outTradeNo 订单编号
* @param transactionId 支付单号
* @param outRefundNo 支付生成的退款单号
* @param total 订单总金额
@ -46,10 +48,11 @@ public interface PayService {
* @throws CoBusinessException
* @throws Exception
*/
public Map<String,String> orderRefund(String transactionId,String outRefundNo,BigDecimal total,BigDecimal refund) throws CoBusinessException,Exception;
public Map<String,String> orderRefund(String outTradeNo,String transactionId,String outRefundNo,BigDecimal total,BigDecimal refund) throws CoBusinessException,Exception;
/**
* 保证金退款
* @param orderFormid 订单编号
* @param transactionId 支付单号
* @param outRefundNo 支付生成的退款单号
* @param total 订单总金额
@ -57,12 +60,13 @@ public interface PayService {
* @throws CoBusinessException
* @throws Exception
*/
public Map<String,String> refundBond(String transactionId,String outRefundNo,BigDecimal total,BigDecimal refund) throws CoBusinessException,Exception;
public Map<String,String> refundBond(String orderFormid,String transactionId,String outRefundNo,BigDecimal total,BigDecimal refund) throws CoBusinessException,Exception;
/**
* 生成保证金收款码返回
* @param orderFormid 订单编号
* @param orderFormid 订单编号
* @param money 金额
* @param ip IP地址
* @param tradeType 支付类型

8
cereshop-app/src/main/java/com/shop/cereshop/app/pay/alipay/service/impl/AliPayServiceImpl.java

@ -78,7 +78,7 @@ public class AliPayServiceImpl implements AliPayService {
//设置支付宝根证书路径
//certAlipayRequest.setRootCertPath(AlipayConfig.ALIPAY_ROOT_CERT_PATH);
//AlipayClient client = new DefaultAlipayClient(AlipayConfig.URL, AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, AlipayConfig.FORMAT, AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY, AlipayConfig.SIGNTYPE);
//AlipayClient client = new DefaultAlipayClient(AlipayConfig.PAY_URL, AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, AlipayConfig.FORMAT, AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY, AlipayConfig.SIGNTYPE);
AlipayClient client = new DefaultAlipayClient(certAlipayRequest);
AlipayTradeWapPayRequest alipay_request=new AlipayTradeWapPayRequest();
@ -155,12 +155,12 @@ public class AliPayServiceImpl implements AliPayService {
}
@Override
public Map<String, String> refund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> refund(String orderFormId,String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
return null;
}
@Override
public Map<String, String> orderRefund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> orderRefund(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
Map<String, String> result = new HashMap<>();
AlipayClient client = new DefaultAlipayClient(AlipayConfig.URL, AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, AlipayConfig.FORMAT, AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY, AlipayConfig.SIGNTYPE);
@ -184,7 +184,7 @@ public class AliPayServiceImpl implements AliPayService {
}
@Override
public Map<String, String> refundBond(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> refundBond(String orderFormId,String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
return null;
}

6
cereshop-app/src/main/java/com/shop/cereshop/app/pay/alipay/service/impl/HuabeiPayServiceImpl.java

@ -73,12 +73,12 @@ public class HuabeiPayServiceImpl implements HuabeiPayService {
}
@Override
public Map<String, String> refund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> refund(String orderFormId,String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
return null;
}
@Override
public Map<String, String> orderRefund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> orderRefund(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
Map<String, String> result = new HashMap<>();
AlipayClient client = new DefaultAlipayClient(AlipayConfig.URL, AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, AlipayConfig.FORMAT, AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY, AlipayConfig.SIGNTYPE);
@ -102,7 +102,7 @@ public class HuabeiPayServiceImpl implements HuabeiPayService {
}
@Override
public Map<String, String> refundBond(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> refundBond(String orderFormId,String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
return null;
}

6
cereshop-app/src/main/java/com/shop/cereshop/app/pay/weixin/service/impl/WxPayServiceImpl.java

@ -118,7 +118,7 @@ public class WxPayServiceImpl implements WxPayService {
}
@Override
public Map<String, String> refund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> refund(String orderFormId,String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
//退款资金来源-可用余额退款
String refundAccount="REFUND_SOURCE_RECHARGE_FUNDS";
Map<String, String> params = new HashMap<>();
@ -154,7 +154,7 @@ public class WxPayServiceImpl implements WxPayService {
}
@Override
public Map<String, String> orderRefund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws Exception {
public Map<String, String> orderRefund(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws Exception {
//APPV3版本的退款以APPV3开头
if (outRefundNo.startsWith("APPV3")) {
return refundWithV3(transactionId, outRefundNo, total, refund);
@ -228,7 +228,7 @@ public class WxPayServiceImpl implements WxPayService {
}
@Override
public Map<String, String> refundBond(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> refundBond(String orderFormId,String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
//退款资金来源-可用余额退款
String refundAccount="REFUND_SOURCE_RECHARGE_FUNDS";
Map<String, String> params = new HashMap<>();

24
cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/domain/XsCallBackRequestVo.java

@ -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;
}

25
cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/domain/XsRequestBo.java

@ -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;
}

22
cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/XsPayService.java

@ -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;
}

207
cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/service/impl/XsPayServiceImpl.java

@ -4,66 +4,138 @@ 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.app.pay.xs.domain.XsCallBackRequestVo;
import com.shop.cereshop.app.pay.xs.domain.XsRequestBo;
import com.shop.cereshop.app.pay.xs.service.XsPayService;
import com.shop.cereshop.app.pay.xs.utils.CommonUtils;
import com.shop.cereshop.app.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 com.sun.javafx.fxml.builder.URLBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.client.utils.URIBuilder;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.net.URI;
import java.net.URL;
import java.util.Base64;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
@Service(value = "xsPayService")
@Slf4j(topic = "XsPayServiceImpl")
@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> gotoPay(String orderFormid, BigDecimal money, String openid, String ip, Integer type, Integer huabeiPeriod) throws CoBusinessException, Exception {
return null;
}
@Override
public Map<String, String> refund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> refund(String outTradeNo,String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
return null;
}
//订单退款
@Override
public Map<String, String> orderRefund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
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) {
// //支付方式为B2CB2BH5成功响应时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> refundBond(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> refundBond(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
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) {
//支付方式为B2CB2BH5成功响应时respMsg为html页面代码
if(respMsg.contains("toNativePayIndexForm")){
log.info("【" + PAY_SER_CODE + "】接口-响应报文-HTML代码无需验签");
}else{
e.printStackTrace();
}
throw new CoBusinessException("10000","获取支付二维码出错");
}
}
return null;
}
//获取二维码
//获取订单二维码
@Override
public String getOrderCollectionCode(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();
XsRequestBo xsRequestBo = getPayRequestBody(orderFormid, money, tradeType, XsPayEnum.PAY_TYPE_QRCODE.getCode());
//head+content做md5并根据加签方式加密
String msg = CommonUtils.getRequestMsg(headMap,contentMap);
String msg = CommonUtils.getRequestMsg(xsRequestBo.getHead(),xsRequestBo.getContent());
log.info("【" + PAY_SER_CODE + "】接口-请求报文:msg="+msg);
String respMsg = HttpUtils.httpPost(XspayConfig.URL,msg);
@ -74,7 +146,7 @@ public class XsPayServiceImpl implements XsPayService {
try {
//解析响应报文并验签
CommonUtils.verifySignRespMsg(PAY_SER_CODE,respMsg);
HashMap<String,String> responseMap = JSONObject.parseObject(respMsg,new TypeReference<HashMap<String,String>>(){});
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);
@ -96,37 +168,77 @@ public class XsPayServiceImpl implements XsPayService {
return null;
}
@Override
public String getPayRequestBodyJson(String outTradeNo, BigDecimal money, String tradeType, String payType) throws Exception {
XsRequestBo xsRequestBo = getPayRequestBody(outTradeNo, money, tradeType, payType);
//json字符串
String jsonString = JSONObject.toJSONString(xsRequestBo);
return jsonString;
}
public XsRequestBo getPayRequestBody(String outTradeNo, BigDecimal money, String tradeType, String payType) throws CoBusinessException, Exception {
//构建请求参数
Map<String, String> headMap = CommonUtils.buildHeadMap(PAY_SER_CODE);
Map<String, Object> contentMap = buildPayContentMap(outTradeNo, 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> buildPayContentMap(){
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 对应 101004101005接口中merOrderId
contentMap.put("oldMerOrderId", orderFormid);
//oldDealId 对应 101004101005接口响应参数中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", System.currentTimeMillis()+"");
contentMap.put("merOrderId", orderFormid);
//商户名称 请根据实际情况替换
contentMap.put("displayName", "成美国际");
//TODO 商品名称
//商品名称 请根据实际情况替换
contentMap.put("goodsName", "商品名称");
//商品数量 请根据实际情况替换
contentMap.put("goodsCount", 1);
//商品类别 请根据实际情况替换
contentMap.put("goodsType", "01");
//订单金额单位分
contentMap.put("orderAmount", 100);
contentMap.put("orderAmount", 1);//money.multiply(new BigDecimal(100)).intValue());
//订单币种 CNY:人民币
contentMap.put("orderCurrencyCode", "CNY");
//贸易类型 0004-货物贸易
contentMap.put("tradeType", "0002");
contentMap.put("tradeType", tradeType);
//支付方式
contentMap.put("payType", "4");
contentMap.put("payType", payType);
//机构代码
contentMap.put("orgCode", "WECHATPAY");
//payerAccount
contentMap.put("payerAccount", "omCqSs9K_z2sgvgGeIzEi5gjyL6k");
// contentMap.put("payerAccount", "omCqSs9K_z2sgvgGeIzEi5gjyL6k");
//交易币种 CNY:人民币
contentMap.put("payCurrencyCode", "CNY");
//结算币种 CNY:人民币
@ -136,13 +248,16 @@ public class XsPayServiceImpl implements XsPayService {
//分账订单信息 shangFlag=1时必填
JSONArray jsonArray = buildSubMerchantOrderDetails();
contentMap.put("subMerchantOrderDetails", JSONArray.toJSONString(jsonArray));
//回调地址
contentMap.put("returnUrl", "http://lcoalhost:8080/gatewayTest/notify");
//回调地址--支付成功后的前端回调地址先写死首页
contentMap.put("returnUrl", returnUrl);
//通知地址
contentMap.put("noticeUrl", "http://lcoalhost:8080/gatewayTest/notify");
//平台ID
contentMap.put("noticeUrl", noticeUrl);
//平台ID-平台型支付的时候使用
contentMap.put("platformId","");
//商户用户号 请根据实际情况选择填写
//商户用户号 请根据实际情况选择填写 TODO 这个先写死但是应该要根据订单的支付人来传值
contentMap.put("customerId", "U00001");
//商户用户类型 请根据实际情况选择填写
contentMap.put("customerType", "1");
@ -152,6 +267,7 @@ public class XsPayServiceImpl implements XsPayService {
contentMap.put("customerIdNo", "460004198911216054");
//商户用户手机号 请根据实际情况选择填写
contentMap.put("customerTel", "13700418358");
//以下信息在支付类型为快捷支付的时候必填
//商户用户银行卡号
contentMap.put("bankCardNo", "");
//商户用户银行卡类型
@ -225,4 +341,39 @@ public class XsPayServiceImpl implements XsPayService {
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;
}
}

11
cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/utils/CommonUtils.java

@ -6,6 +6,7 @@ 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;
@ -47,7 +48,7 @@ public class CommonUtils {
*/
public static String getRequestMsg(Map<String, String> headMap, Map<String, Object> contentMap) throws Exception {
//生成加签源串 空值不参与加签
Map<String, Object> signMap = new LinkedHashMap<String, Object>();
Map<String, Object> signMap = new LinkedHashMap<>();
signMap.put("head", headMap);
signMap.put("content", contentMap);
//json字符串
@ -111,8 +112,14 @@ public class CommonUtils {
//headContentMap 转为json字符串时保留字段值为null的字段
SerializerFeature[] serializerFeatures = new SerializerFeature[]{SerializerFeature.WriteMapNullValue};
//获取json字符串 不包含sign字段
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");

4
cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/CereBuyerUserService.java

@ -39,6 +39,10 @@ public interface CereBuyerUserService {
void relievePhone(UserParam param, CereBuyerUser user) throws CoBusinessException;
void updateRealName(UserParam param, CereBuyerUser user) throws CoBusinessException;
void relieveRealName(UserParam param, CereBuyerUser user) throws CoBusinessException;
void updatePassword(UserParam param, CereBuyerUser user) throws CoBusinessException;
MyUser getUser(Long buyerUserId) throws CoBusinessException;

18
cereshop-app/src/main/java/com/shop/cereshop/app/service/buyer/impl/CereBuyerUserServiceImpl.java

@ -938,6 +938,24 @@ public class CereBuyerUserServiceImpl implements CereBuyerUserService {
cereBuyerUserDAO.relievePhone(cereBuyerUser);
}
@Override
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class})
public void updateRealName(UserParam param, CereBuyerUser user) throws CoBusinessException {
CereBuyerUser cereBuyerUser=new CereBuyerUser();
cereBuyerUser.setBuyerUserId(user.getBuyerUserId());
cereBuyerUser.setRealName(param.getRealName());
cereBuyerUser.setIdCard(param.getIdCard());
cereBuyerUserDAO.updateByPrimaryKeySelective(cereBuyerUser);
}
@Override
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class})
public void relieveRealName(UserParam param, CereBuyerUser user) throws CoBusinessException {
CereBuyerUser cereBuyerUser=new CereBuyerUser();
cereBuyerUser.setBuyerUserId(user.getBuyerUserId());
cereBuyerUserDAO.relieveRealName(cereBuyerUser);
}
/**
* 设置token信息
* @param user

60
cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/HuaxunService.java

@ -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);
}

145
cereshop-app/src/main/java/com/shop/cereshop/app/service/extend/impl/HuaxunServiceImpl.java

@ -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","验签校验失败");
}
}
}

18
cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java

@ -100,6 +100,7 @@ import com.shop.cereshop.app.service.stock.CereStockService;
import com.shop.cereshop.app.utils.DistributionUtil;
import com.shop.cereshop.commons.config.AlipayConfig;
import com.shop.cereshop.commons.config.PayConfig;
import com.shop.cereshop.commons.config.XspayConfig;
import com.shop.cereshop.commons.constant.*;
import com.shop.cereshop.commons.domain.activity.CereBuyerCoupon;
import com.shop.cereshop.commons.domain.activity.CerePlatformActivity;
@ -388,7 +389,9 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
@Transactional(isolation = Isolation.DEFAULT, propagation = Propagation.REQUIRED, rollbackFor = {CoBusinessException.class, Exception.class})
public PayUrl submit(OrderParam param, CereBuyerUser user, String ip) throws CoBusinessException, Exception {
String time = TimeUtils.yyMMddHHmmss();
if (param.getPaymentMode() == null) {
if(PayConfig.paymentMode == IntegerEnum.ORDER_PAY_XS.getCode()){
param.setPaymentMode(PayConfig.paymentMode);
}else if (param.getPaymentMode() == null) {
param.setPaymentMode(PayConfig.paymentMode);
}
//额外的校验
@ -501,10 +504,12 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
//调用支付接口
PayService payService = PayFactory.getPayService(param.getPaymentMode());
String openId = user.getWechatOpenId();
if (Arrays.asList(IntegerEnum.ORDER_PAY_ALI.getCode(),
IntegerEnum.ORDER_PAY_HUABEI.getCode()).contains(param.getPaymentMode())) {
openId = user.getAliUserId();
}
Map<String, String> map = payService.gotoPay(orderFormId, price, openId, ip, ParamEnum.PAY_XCX.getCode(), param.getHuabeiPeriod());
System.out.println("支付返回结果集" + map.toString());
ObjectMapper mapper = new ObjectMapper();
@ -1211,12 +1216,12 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
}
}*/
PayService payService = PayFactory.getPayService(refund.getPaymentMode());
Map<String, String> resultMap = payService.orderRefund(refund.getTransactionId(), refund.getOutRefundNo(), refund.getTotalFee(), cereShopOrder.getPrice());
Map<String, String> resultMap = payService.orderRefund(refund.getOutTradeNo(), refund.getTransactionId(), refund.getOutRefundNo(), refund.getTotalFee(), cereShopOrder.getPrice());
if (!EmptyUtils.isEmpty(resultMap)) {
if (resultMap.get("return_msg").equals(WxPayEnum.REFUND_SUCCESS.getCode()) &&
resultMap.get("return_code").equals(WxPayEnum.REFUND_OK.getCode())) {
//退款成功 支付宝的退款是立即退款的需要同步处理
if (Arrays.asList(IntegerEnum.ORDER_PAY_ALI.getCode(),
if (Arrays.asList(IntegerEnum.ORDER_PAY_ALI.getCode(),IntegerEnum.ORDER_PAY_XS.getCode(),
IntegerEnum.ORDER_PAY_HUABEI.getCode()).contains(cereShopOrder.getPaymentMode())) {
//内部调用不会执行事务所以通过springUtil获取service对象
CereShopOrderService cereShopOrderService = SpringUtil.getBean(CereShopOrderService.class);
@ -1256,7 +1261,7 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
//微信支付没通,暂时直接处理业务
// handleRefundTestWxLog(order.getOrderFormid(),refund.getTransactionId(),refund.getOutTradeNo());
PayService payService = PayFactory.getPayService(refund.getPaymentMode());
Map<String, String> resultMap = payService.orderRefund(refund.getTransactionId(), refund.getOutRefundNo(), refund.getTotalFee(), refund.getTotalFee());
Map<String, String> resultMap = payService.orderRefund(refund.getOutTradeNo(), refund.getTransactionId(), refund.getOutRefundNo(), refund.getTotalFee(), refund.getTotalFee());
if (!EmptyUtils.isEmpty(resultMap)) {
if (resultMap.get("return_msg").equals(WxPayEnum.REFUND_SUCCESS.getCode()) &&
resultMap.get("return_code").equals(WxPayEnum.REFUND_OK.getCode())) {
@ -3076,13 +3081,15 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
CereShopOrder shopOrder = cereShopOrderDAO.findById(param.getOrderId());
if (shopOrder != null) {
payUrl.setOrderId(param.getOrderId());
//TODO 这里需要获取父订单Id------pxh
payUrl.setMoney(shopOrder.getPrice());
//生成收款码
String formid = shopOrder.getOrderFormid() + "-" + RandomStringUtil.getRandomCode(3, 0) + "XCX";
String code_url = "";
log.info("支付方式:"+ PayConfig.paymentMode);
if(PayConfig.paymentMode == IntegerEnum.ORDER_PAY_XS.getCode()){
code_url = xsPayService.getOrderCollectionCode(formid, shopOrder.getPrice(), ip, WxPayEnum.PAY_TYPE_NATIVE.getCode());
code_url = xsPayService.getOrderCollectionCode(formid, shopOrder.getPrice(), ip, XspayConfig.DEFUALT_TRADE_TYPE);
}else {
code_url = wxPayService.getOrderCollectionCode(formid, shopOrder.getPrice(), ip, WxPayEnum.PAY_TYPE_NATIVE.getCode());
}
@ -3367,5 +3374,4 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
return param;
}
}

5
cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/JoinPlaceOrder.java

@ -8,6 +8,7 @@ import com.shop.cereshop.app.param.order.OrderParam;
import com.shop.cereshop.app.param.order.OrderProductParam;
import com.shop.cereshop.app.param.settlement.ProductSku;
import com.shop.cereshop.app.pay.weixin.service.WxPayService;
import com.shop.cereshop.app.pay.xs.service.XsPayService;
import com.shop.cereshop.app.redis.service.api.StringRedisService;
import com.shop.cereshop.app.service.activity.CereBuyerCouponService;
import com.shop.cereshop.app.service.activity.CerePlatformActivityService;
@ -65,7 +66,7 @@ public class JoinPlaceOrder extends PlaceOrderTemplate {
CereShopDiscountService cereShopDiscountService, CereShopPriceService cereShopPriceService,
CereShopComposeService cereShopComposeService, CereStockService cereStockService, CereProductSkuService cereProductSkuService,
CereShopSceneMemberService cereShopSceneMemberService, CereProductMemberService cereProductMemberService,
CereBuyerCouponService cereBuyerCouponService, WxPayService wxPayService, UploadService uploadService,
CereBuyerCouponService cereBuyerCouponService, WxPayService wxPayService, XsPayService xsPayService, UploadService uploadService,
CereOrderParentService cereOrderParentService, CereOrderProductService cereOrderProductService,
CereShopOrderDAO cereShopOrderDAO, StringRedisService stringRedisService, CereRedisKeyServcice cereRedisKeyServcice,
CereOrderProductAttributeService cereOrderProductAttributeService, CereBuyerReceiveService cereBuyerReceiveService,
@ -73,7 +74,7 @@ public class JoinPlaceOrder extends PlaceOrderTemplate {
CereBuyerUserService cereBuyerUserService, CerePlatformActivityService cerePlatformActivityService, WxCardUtil wxCardUtil) {
super(cereBuyerShopCouponService, cerePlatformSeckillService, cerePlatformDiscountService, cereShopSeckillService, cereShopDiscountService,
cereShopPriceService, cereShopComposeService, cereStockService, cereProductSkuService, cereShopSceneMemberService,
cereProductMemberService, cereBuyerCouponService, wxPayService, uploadService, cereOrderParentService, cereOrderProductService,
cereProductMemberService, cereBuyerCouponService, wxPayService, xsPayService, uploadService, cereOrderParentService, cereOrderProductService,
cereShopOrderDAO, stringRedisService, cereRedisKeyServcice, cereOrderProductAttributeService, cereBuyerReceiveService,
cereShopCartService, cereShopGroupWorkService, cereBuyerUserService, cerePlatformActivityService, wxCardUtil);
}

4
cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/LaunchPlaceOrder.java

@ -9,6 +9,7 @@ import com.shop.cereshop.app.param.order.OrderParam;
import com.shop.cereshop.app.param.order.OrderProductParam;
import com.shop.cereshop.app.param.settlement.ProductSku;
import com.shop.cereshop.app.pay.weixin.service.WxPayService;
import com.shop.cereshop.app.pay.xs.service.XsPayService;
import com.shop.cereshop.app.redis.service.api.StringRedisService;
import com.shop.cereshop.app.service.activity.CereBuyerCouponService;
import com.shop.cereshop.app.service.activity.CerePlatformActivityService;
@ -79,6 +80,7 @@ public class LaunchPlaceOrder extends PlaceOrderTemplate {
CereShopDiscountService cereShopDiscountService, CereShopPriceService cereShopPriceService, CereShopComposeService cereShopComposeService,
CereStockService cereStockService, CereProductSkuService cereProductSkuService, CereShopSceneMemberService cereShopSceneMemberService,
CereProductMemberService cereProductMemberService, CereBuyerCouponService cereBuyerCouponService, WxPayService wxPayService,
XsPayService xsPayService,
UploadService uploadService, CereOrderParentService cereOrderParentService, CereOrderProductService cereOrderProductService,
CereShopOrderDAO cereShopOrderDAO, StringRedisService stringRedisService, CereRedisKeyServcice cereRedisKeyServcice,
CereOrderProductAttributeService cereOrderProductAttributeService, CereBuyerReceiveService cereBuyerReceiveService,
@ -86,7 +88,7 @@ public class LaunchPlaceOrder extends PlaceOrderTemplate {
CerePlatformActivityService cerePlatformActivityService, WxCardUtil wxCardUtil) {
super(cereBuyerShopCouponService, cerePlatformSeckillService, cerePlatformDiscountService, cereShopSeckillService,
cereShopDiscountService, cereShopPriceService, cereShopComposeService, cereStockService, cereProductSkuService,
cereShopSceneMemberService, cereProductMemberService, cereBuyerCouponService, wxPayService, uploadService,
cereShopSceneMemberService, cereProductMemberService, cereBuyerCouponService, wxPayService, xsPayService, uploadService,
cereOrderParentService, cereOrderProductService, cereShopOrderDAO, stringRedisService, cereRedisKeyServcice,
cereOrderProductAttributeService, cereBuyerReceiveService, cereShopCartService, cereShopGroupWorkService,
cereBuyerUserService, cerePlatformActivityService, wxCardUtil);

5
cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/NormalPlaceOrder.java

@ -15,6 +15,7 @@ import com.shop.cereshop.app.param.seckill.ShopBusinessSeckill;
import com.shop.cereshop.app.param.seckill.ShopPlatformSeckill;
import com.shop.cereshop.app.param.settlement.ProductSku;
import com.shop.cereshop.app.pay.weixin.service.WxPayService;
import com.shop.cereshop.app.pay.xs.service.XsPayService;
import com.shop.cereshop.app.redis.service.api.StringRedisService;
import com.shop.cereshop.app.service.activity.CereBuyerCouponService;
import com.shop.cereshop.app.service.activity.CerePlatformActivityService;
@ -75,8 +76,8 @@ import java.util.stream.Collectors;
@Slf4j
public class NormalPlaceOrder extends PlaceOrderTemplate {
public NormalPlaceOrder(CereBuyerShopCouponService cereBuyerShopCouponService, CerePlatformSeckillService cerePlatformSeckillService, CerePlatformDiscountService cerePlatformDiscountService, CereShopSeckillService cereShopSeckillService, CereShopDiscountService cereShopDiscountService, CereShopPriceService cereShopPriceService, CereShopComposeService cereShopComposeService, CereStockService cereStockService, CereProductSkuService cereProductSkuService, CereShopSceneMemberService cereShopSceneMemberService, CereProductMemberService cereProductMemberService, CereBuyerCouponService cereBuyerCouponService, WxPayService wxPayService, UploadService uploadService, CereOrderParentService cereOrderParentService, CereOrderProductService cereOrderProductService, CereShopOrderDAO cereShopOrderDAO, StringRedisService stringRedisService, CereRedisKeyServcice cereRedisKeyServcice, CereOrderProductAttributeService cereOrderProductAttributeService, CereBuyerReceiveService cereBuyerReceiveService, CereShopCartService cereShopCartService, CereShopGroupWorkService cereShopGroupWorkService, CereBuyerUserService cereBuyerUserService, CerePlatformActivityService cerePlatformActivityService, WxCardUtil wxCardUtil) {
super(cereBuyerShopCouponService, cerePlatformSeckillService, cerePlatformDiscountService, cereShopSeckillService, cereShopDiscountService, cereShopPriceService, cereShopComposeService, cereStockService, cereProductSkuService, cereShopSceneMemberService, cereProductMemberService, cereBuyerCouponService, wxPayService, uploadService, cereOrderParentService, cereOrderProductService, cereShopOrderDAO, stringRedisService, cereRedisKeyServcice, cereOrderProductAttributeService, cereBuyerReceiveService, cereShopCartService, cereShopGroupWorkService, cereBuyerUserService, cerePlatformActivityService, wxCardUtil);
public NormalPlaceOrder(CereBuyerShopCouponService cereBuyerShopCouponService, CerePlatformSeckillService cerePlatformSeckillService, CerePlatformDiscountService cerePlatformDiscountService, CereShopSeckillService cereShopSeckillService, CereShopDiscountService cereShopDiscountService, CereShopPriceService cereShopPriceService, CereShopComposeService cereShopComposeService, CereStockService cereStockService, CereProductSkuService cereProductSkuService, CereShopSceneMemberService cereShopSceneMemberService, CereProductMemberService cereProductMemberService, CereBuyerCouponService cereBuyerCouponService, WxPayService wxPayService, XsPayService xsPayService, UploadService uploadService, CereOrderParentService cereOrderParentService, CereOrderProductService cereOrderProductService, CereShopOrderDAO cereShopOrderDAO, StringRedisService stringRedisService, CereRedisKeyServcice cereRedisKeyServcice, CereOrderProductAttributeService cereOrderProductAttributeService, CereBuyerReceiveService cereBuyerReceiveService, CereShopCartService cereShopCartService, CereShopGroupWorkService cereShopGroupWorkService, CereBuyerUserService cereBuyerUserService, CerePlatformActivityService cerePlatformActivityService, WxCardUtil wxCardUtil) {
super(cereBuyerShopCouponService, cerePlatformSeckillService, cerePlatformDiscountService, cereShopSeckillService, cereShopDiscountService, cereShopPriceService, cereShopComposeService, cereStockService, cereProductSkuService, cereShopSceneMemberService, cereProductMemberService, cereBuyerCouponService, wxPayService, xsPayService, uploadService, cereOrderParentService, cereOrderProductService, cereShopOrderDAO, stringRedisService, cereRedisKeyServcice, cereOrderProductAttributeService, cereBuyerReceiveService, cereShopCartService, cereShopGroupWorkService, cereBuyerUserService, cerePlatformActivityService, wxCardUtil);
}
@Override

12
cereshop-app/src/main/java/com/shop/cereshop/app/service/order/placeOrderTemplate/PlaceOrderTemplate.java

@ -9,6 +9,7 @@ import com.shop.cereshop.app.param.order.OrderParam;
import com.shop.cereshop.app.param.order.OrderProductParam;
import com.shop.cereshop.app.param.settlement.ProductSku;
import com.shop.cereshop.app.pay.weixin.service.WxPayService;
import com.shop.cereshop.app.pay.xs.service.XsPayService;
import com.shop.cereshop.app.redis.service.api.StringRedisService;
import com.shop.cereshop.app.service.activity.CereBuyerCouponService;
import com.shop.cereshop.app.service.activity.CerePlatformActivityService;
@ -32,6 +33,7 @@ import com.shop.cereshop.app.service.scene.CereShopSceneMemberService;
import com.shop.cereshop.app.service.seckill.CereShopSeckillService;
import com.shop.cereshop.app.service.stock.CereStockService;
import com.shop.cereshop.app.utils.ImageUtil;
import com.shop.cereshop.commons.config.XspayConfig;
import com.shop.cereshop.commons.constant.*;
import com.shop.cereshop.commons.domain.activity.CereBuyerCoupon;
import com.shop.cereshop.commons.domain.activity.CerePlatformActivity;
@ -88,6 +90,8 @@ public abstract class PlaceOrderTemplate {
protected final WxPayService wxPayService;
protected final XsPayService xsPayService;
protected final UploadService uploadService;
protected final CereOrderParentService cereOrderParentService;
@ -679,6 +683,14 @@ public abstract class PlaceOrderTemplate {
} else if (paymentMode != null && Arrays.asList(IntegerEnum.ORDER_PAY_ALI.getCode(),
IntegerEnum.ORDER_PAY_HUABEI.getCode()).contains(paymentMode)) {
// 支付宝支付
} else if (IntegerEnum.ORDER_PAY_XS.getCode().equals(paymentMode)) {
// 新生支付 - 生成收款码
String formid = parentFormId + "-" + RandomStringUtil.getRandomCode(3, 0) + "XCX";
String code_url = xsPayService.getOrderCollectionCode(formid, payUrl.getMoney(),
ip, XspayConfig.DEFUALT_TRADE_TYPE);
if (!EmptyUtils.isEmpty(code_url)) {
payUrl.setUrl(ImageUtil.genQrCodeBase64ByUrl(code_url));
}
} else {
//生成收款码
String formid = parentFormId + "-" + RandomStringUtil.getRandomCode(3, 0) + "XCX";

4
cereshop-app/src/main/java/com/shop/cereshop/app/utils/WechatUtil.java

@ -365,9 +365,9 @@ public class WechatUtil {
}
/**
* 向指定 URL 发送POST方法的请求
* 向指定 PAY_URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param url 发送请求的 PAY_URL
* @return 所代表远程资源的响应结果
*/
public static String sendPost(String url, Map<String, ?> paramMap) {

5
cereshop-app/src/main/resources/application-app-dev.yml

@ -225,3 +225,8 @@ pay:
xspay:
url: https://uwebgatetest.hnapay.com/webgate/unifiedAPI.htm
app_return_url: xx
app_notice_url: http://122.9.152.120/ceres-app-api/extend/xsPay/pay/notify
business_return_url: xx
business_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/pay/notify

2
cereshop-app/src/main/resources/application-security.yml

@ -43,6 +43,8 @@ security:
- /order/alipay/rolBack
- /order/alipayRefund/rolBack
- /order/pay
- /extend/**
- /extend/**
- /doc.html
- /doc.html#/**
- /webjars/**

4
cereshop-app/src/main/resources/application.yml

@ -77,6 +77,10 @@ pay:
xspay:
url: https://uwebgate.hnapay.com/webgate/unifiedAPI.htm
app_return_url: xx
app_notice_url: xx
business_return_url: xx
business_notice_url: xx
mer_code: 10000000381
sign_type: 1
rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANMGXGvYX9yqb5qauZgc2mXk4R+2op9KLhCuqO0mt5aTyAFfGXty2RHAinwQif6AUyfFZK7p0/9xz2yX4VHltA4qFNsgQmi2Qtry8MTbBrPtVgukWdLmcK7NqR9C8reXO7e/Np3SPNLle5MsEkwM25cMK56JEc3WMRe+KIRZ69d1AgMBAAECgYBTSW1suyeKplIKCQs7OBgSozUfGSwyBksMFoNhpihLa+RCdlBOYtO9p+qAcN6l7evkBIpqZqtfZIHjcEZj1m8reIHHBnuv/sKGXWPvMBKqckenwNnqUzlj4X8hvFtkbcqXLGdyYoicW+P5+P8zHmYRom+izd5FO9281zXa4UK6gQJBAOquqD84B1VnNq2xopaaJvxaL4c5IOinkfRWShttANCpt1D0t1cs+7WPq9sdFZ4cyHYomxuC4knqJh1E/WzCVqUCQQDmMZH8+6sgqOrgsECw6w0KdUci/XgzT/DRS/3MFMeRv7ygEtdlyvyxRirEArsjQgDg3IBLo9TxBUdygPhgXnSRAkEAtp95r9By7IOoKhw8cMO+qMuphqnvMP0NeD0Z6CO36ajYTXhRn9YSfiQyUQ1eAC9X05MfuJXucCR0ynwgVd0ZPQJAdYaRdow3TrFvWdAi9zDKs7A05ZRrrib+WJ1nsq5ZRfySnVeBSaNdaFTeuLx8NwAX2rY5emTm7zc2xys5pFoVQQJAUPrxmTbELDTF1by6POX/IT3iSeClzOx+M05Yd4sgXtALPjYt0VMLtnsfmt9qMEjhk0Q95wgdmeHsBHxno5qGfQ==

12
cereshop-app/src/main/resources/mybatis/mapper/buyer/CereBuyerUserDAO.xml

@ -178,6 +178,12 @@
<if test="birthday != null and birthday!=''">
birthday = #{birthday,jdbcType=VARCHAR},
</if>
<if test="realName != null and realName!=''">
real_name = #{realName,jdbcType=VARCHAR},
</if>
<if test="idCard != null and idCard!=''">
id_card = #{idCard,jdbcType=VARCHAR},
</if>
<if test="wechatOpenId != null and wechatOpenId!=''">
wechat_open_id = #{wechatOpenId,jdbcType=VARCHAR},
</if>
@ -291,6 +297,10 @@
UPDATE cere_buyer_user SET phone=NULL where buyer_user_id=#{buyerUserId}
</update>
<update id="relieveRealName" parameterType="com.shop.cereshop.commons.domain.buyer.CereBuyerUser">
UPDATE cere_buyer_user SET id_card=NULL,real_name=NULL where buyer_user_id=#{buyerUserId}
</update>
<update id="updateGrowth">
update cere_buyer_user
set growth = growth + #{growth}
@ -310,7 +320,7 @@
</update>
<select id="getUser" parameterType="java.lang.Object" resultType="com.shop.cereshop.app.page.buyer.MyUser">
SELECT a.buyer_user_id, `name`, `sex`, birthday, phone,a.create_time, head_image, member_level_id, growth,
SELECT a.buyer_user_id, `name`, `sex`, birthday, real_name,id_card,phone,a.create_time, head_image, member_level_id, growth,
a.credit, sum(b.credit) as totalCredit FROM cere_buyer_user a
left join cere_credit_record b on b.buyer_user_id = a.buyer_user_id and b.record_type = 1
where a.buyer_user_id = #{buyerUserId}

9
cereshop-app/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml

@ -744,4 +744,13 @@
<update id="updateBuyerData" parameterType="java.lang.Object">
UPDATE cere_shop_order SET buyer_user_id=#{buyerUserId} where buyer_user_id=#{id}
</update>
<!-- 返回该时间段内需要报关发货的订单,实际上还需要判断是否已经报关过 -->
<select id="findByPayTime" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.order.CereShopOrder">
SELECT a.* FROM cere_shop_order a
where a.payment_state=1
AND a.state = 2
AND a.payment_time >= #{payStartTime}
AND a.payment_time &lt; #{payEndTime}
</select>
</mapper>

120
cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopCrossDetailController.java

@ -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));
}
}

120
cereshop-business/src/main/java/com/shop/cereshop/business/controller/StorehouseController.java

@ -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));
}
}

15
cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopCrossDetailDAO.java

@ -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> {
}

16
cereshop-business/src/main/java/com/shop/cereshop/business/dao/storehouse/CereShopStorehouseDAO.java

@ -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> {
}

133
cereshop-business/src/main/java/com/shop/cereshop/business/page/shop/ShopCrossDetail.java

@ -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;
}

85
cereshop-business/src/main/java/com/shop/cereshop/business/page/storehouse/Storehouse.java

@ -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;
}

12
cereshop-business/src/main/java/com/shop/cereshop/business/param/product/SkuParam.java

@ -54,6 +54,18 @@ public class SkuParam {
private BigDecimal originalPrice;
/**
* * 所属仓库
*/
@ApiModelProperty(value = "所属仓库")
private Integer storehouseId;
/**
* 是否是跨境商品
*/
@ApiModelProperty(value = "是否是跨境商品")
private Integer isCross;
/**
* 库存数量
*/
@ApiModelProperty(value = "库存数量")

35
cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseGetAllParam.java

@ -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;
}

28
cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseGetByIdParam.java

@ -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;
}

86
cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseSaveParam.java

@ -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;
}

86
cereshop-business/src/main/java/com/shop/cereshop/business/param/storehouse/ShopStorehouseUpdateParam.java

@ -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;
}

3
cereshop-business/src/main/java/com/shop/cereshop/business/pay/PayFactory.java

@ -8,6 +8,7 @@ package com.shop.cereshop.business.pay;
import com.shop.cereshop.business.pay.alipay.service.AliPayService;
import com.shop.cereshop.business.pay.alipay.service.HuabeiPayService;
import com.shop.cereshop.business.pay.weixin.service.WxPayService;
import com.shop.cereshop.business.pay.xs.service.XsPayService;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.constant.IntegerEnum;
import com.shop.cereshop.commons.exception.CoBusinessException;
@ -23,6 +24,8 @@ public class PayFactory {
return SpringUtil.getBean(AliPayService.class);
} else if (paymentMode.equals(IntegerEnum.ORDER_PAY_HUABEI.getCode())) {
return SpringUtil.getBean(HuabeiPayService.class);
} else if (paymentMode.equals(IntegerEnum.ORDER_PAY_XS.getCode())) {
return SpringUtil.getBean(XsPayService.class);
}
}
throw new CoBusinessException(CoReturnFormat.SYS_ERROR);

2
cereshop-business/src/main/java/com/shop/cereshop/business/pay/PayService.java

@ -45,6 +45,6 @@ public interface PayService {
* @throws CoBusinessException
* @throws Exception
*/
public Map<String,String> orderRefund(String transactionId,String outRefundNo,BigDecimal total,BigDecimal refund) throws CoBusinessException,Exception;
public Map<String,String> orderRefund(String outTradeNo, String transactionId,String outRefundNo,BigDecimal total,BigDecimal refund) throws CoBusinessException,Exception;
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/pay/alipay/service/impl/AliPayServiceImpl.java

@ -88,7 +88,7 @@ public class AliPayServiceImpl implements AliPayService {
}
@Override
public Map<String, String> orderRefund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> orderRefund(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
Map<String, String> result = new HashMap<>();
AlipayClient client = new DefaultAlipayClient(AlipayConfig.URL, AlipayConfig.APPID, AlipayConfig.RSA_PRIVATE_KEY, AlipayConfig.FORMAT, AlipayConfig.CHARSET, AlipayConfig.ALIPAY_PUBLIC_KEY, AlipayConfig.SIGNTYPE);

2
cereshop-business/src/main/java/com/shop/cereshop/business/pay/alipay/service/impl/HuabeiPayServiceImpl.java

@ -82,7 +82,7 @@ public class HuabeiPayServiceImpl implements HuabeiPayService {
}
@Override
public Map<String, String> orderRefund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> orderRefund(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
return null;
}
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/pay/weixin/service/impl/WxPayServiceImpl.java

@ -211,7 +211,7 @@ public class WxPayServiceImpl implements WxPayService {
}
@Override
public Map<String, String> orderRefund(String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
public Map<String, String> orderRefund(String outTradeNo, String transactionId, String outRefundNo, BigDecimal total, BigDecimal refund) throws CoBusinessException, Exception {
return null;
}
}

24
cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/domain/XsCallBackRequestVo.java

@ -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;
}

24
cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/domain/XsRequestBo.java

@ -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;
}

27
cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/XsPayService.java

@ -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;
}

368
cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/impl/XsPayServiceImpl.java

@ -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) {
// //支付方式为B2CB2BH5成功响应时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) {
// //支付方式为B2CB2BH5成功响应时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) {
//支付方式为B2CB2BH5成功响应时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 对应 101004101005接口中merOrderId
contentMap.put("oldMerOrderId", orderFormid);
//oldDealId 对应 101004101005接口响应参数中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;
}
}

141
cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/utils/CommonUtils.java

@ -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;
}
}

60
cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/utils/HttpUtils.java

@ -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;
}
}

291
cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/utils/RSAUtils.java

@ -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);
}
}
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/service/log/CerePlatformLogService.java

@ -9,6 +9,8 @@ import com.shop.cereshop.commons.domain.business.CerePlatformBusiness;
import com.shop.cereshop.commons.exception.CoBusinessException;
public interface CerePlatformLogService {
void addLog(CerePlatformBusiness user, String module, String operation, String describe, Long id);
void addLog(CerePlatformBusiness user, String module, String operation, String describe, Long id, String time);
void deleteSignActivityByOnly(Long activityId,Long userId) throws CoBusinessException;

6
cereshop-business/src/main/java/com/shop/cereshop/business/service/log/impl/CerePlatformLogServiceImpl.java

@ -10,6 +10,7 @@ import com.shop.cereshop.business.service.log.CerePlatformLogService;
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness;
import com.shop.cereshop.commons.domain.log.CerePlatformLog;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -20,6 +21,11 @@ public class CerePlatformLogServiceImpl implements CerePlatformLogService {
private CerePlatformLogDAO cerePlatformLogDAO;
@Override
public void addLog(CerePlatformBusiness user, String module, String operation, String describe, Long id) {
String time= TimeUtils.yyMMddHHmmss();
addLog(user, module, operation, describe, id, time);
}
@Override
public void addLog(CerePlatformBusiness user, String module, String operation, String describe, Long id, String time) {
CerePlatformLog log=new CerePlatformLog();
log.setPlatformUserId(user.getBusinessUserId());

3
cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereShopOrderServiceImpl.java

@ -25,7 +25,6 @@ import com.shop.cereshop.business.pay.PayService;
import com.shop.cereshop.business.redis.service.api.StringRedisService;
import com.shop.cereshop.business.service.activity.CereBuyerCouponService;
import com.shop.cereshop.business.service.buyer.CereBuyerShopCouponService;
import com.shop.cereshop.business.service.buyer.CereBuyerUserService;
import com.shop.cereshop.business.service.log.CerePlatformLogService;
import com.shop.cereshop.business.service.notice.CereNoticeService;
import com.shop.cereshop.business.service.order.CereOrderReconciliationService;
@ -360,7 +359,7 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
//微信支付没通,暂时直接处理业务
// handleRefundTestWxLog(order.getOrderFormid(),refund.getTransactionId(),refund.getOutTradeNo());
PayService payService = PayFactory.getPayService(refund.getPaymentMode());
Map<String, String> resultMap = payService.orderRefund(refund.getTransactionId(), refund.getOutRefundNo(), refund.getTotalFee(), refund.getTotalFee());
Map<String, String> resultMap = payService.orderRefund(refund.getOrderFormid(), refund.getTransactionId(), refund.getOutRefundNo(), refund.getTotalFee(), refund.getTotalFee());
if(!EmptyUtils.isEmpty(resultMap)){
if(resultMap.get("return_msg").equals(WxPayEnum.REFUND_SUCCESS.getCode())&&
resultMap.get("return_code").equals(WxPayEnum.REFUND_OK.getCode())){

2
cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java

@ -727,6 +727,8 @@ public class CereShopProductServiceImpl implements CereShopProductService {
cereProductSku.setStockNumber(sku.getStockNumber());
cereProductSku.setTotal(sku.getStockNumber());
cereProductSku.setStyle(sku.getStyle());
cereProductSku.setIsCross(sku.getIsCross());
cereProductSku.setStorehouseId(sku.getStorehouseId());
cereProductSku.setWeight(sku.getWeight());
if(EmptyUtils.isEmpty(sku.getSkuId())){
cereProductSku.setProductId(cereShopProduct.getProductId());

57
cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/CereShopCrossDetailService.java

@ -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;
}

98
cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopCrossDetailServiceImpl.java

@ -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;
}
}

57
cereshop-business/src/main/java/com/shop/cereshop/business/service/storehouse/CereShopStorehouseService.java

@ -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;
}

99
cereshop-business/src/main/java/com/shop/cereshop/business/service/storehouse/impl/CereShopStorehouseServiceImpl.java

@ -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;
}
}

7
cereshop-business/src/main/resources/application-business-dev.yml

@ -197,3 +197,10 @@ refreshSkuRealInfoUrl: ${spring.domain}/product/refreshSkuRealInfo
#渠道券活动url
channelCouponActivityUrl: ${spring.domain}/h5/#/pages_category_page2/channelCouponSeaMee/index?
xspay:
url: https://uwebgatetest.hnapay.com/webgate/unifiedAPI.htm
app_return_url: xx
app_notice_url: http://122.9.152.120/ceres-app-api/extend/xsPay/pay/notify
business_return_url: xx
business_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/pay/notify

12
cereshop-business/src/main/resources/application.yml

@ -63,3 +63,15 @@ globalAdminPhone:
#自动收货时间 单位:毫秒
autoDeliveryTime: 604800000
xspay:
url: https://uwebgate.hnapay.com/webgate/unifiedAPI.htm
app_return_url: xx
app_notice_url: xx
business_return_url: xx
business_notice_url: xx
mer_code: 10000000381
sign_type: 1
rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANMGXGvYX9yqb5qauZgc2mXk4R+2op9KLhCuqO0mt5aTyAFfGXty2RHAinwQif6AUyfFZK7p0/9xz2yX4VHltA4qFNsgQmi2Qtry8MTbBrPtVgukWdLmcK7NqR9C8reXO7e/Np3SPNLle5MsEkwM25cMK56JEc3WMRe+KIRZ69d1AgMBAAECgYBTSW1suyeKplIKCQs7OBgSozUfGSwyBksMFoNhpihLa+RCdlBOYtO9p+qAcN6l7evkBIpqZqtfZIHjcEZj1m8reIHHBnuv/sKGXWPvMBKqckenwNnqUzlj4X8hvFtkbcqXLGdyYoicW+P5+P8zHmYRom+izd5FO9281zXa4UK6gQJBAOquqD84B1VnNq2xopaaJvxaL4c5IOinkfRWShttANCpt1D0t1cs+7WPq9sdFZ4cyHYomxuC4knqJh1E/WzCVqUCQQDmMZH8+6sgqOrgsECw6w0KdUci/XgzT/DRS/3MFMeRv7ygEtdlyvyxRirEArsjQgDg3IBLo9TxBUdygPhgXnSRAkEAtp95r9By7IOoKhw8cMO+qMuphqnvMP0NeD0Z6CO36ajYTXhRn9YSfiQyUQ1eAC9X05MfuJXucCR0ynwgVd0ZPQJAdYaRdow3TrFvWdAi9zDKs7A05ZRrrib+WJ1nsq5ZRfySnVeBSaNdaFTeuLx8NwAX2rY5emTm7zc2xys5pFoVQQJAUPrxmTbELDTF1by6POX/IT3iSeClzOx+M05Yd4sgXtALPjYt0VMLtnsfmt9qMEjhk0Q95wgdmeHsBHxno5qGfQ==
newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmVh2/xldLXhVU/mNT57m95uw0Hr0Pdl4pUyM2xV509LqLYTbLduCqqnuMTJUq7Irv8SsKfVqB7zKggxFyjmIfeeyTbhMDJkWZ20xRhv+rSw3ZBQD/Hbn+cxhi4FZ3gc+jUSI1pIsPrlvRK7E5DyWLa/RvZYiQfW/XYI4c1Mb29QIDAQAB

0
cereshop-business/src/main/resources/mybatis/mapper/log/CerePlatformWebLogDAO.xml → cereshop-business/src/main/resources/mybatis/mapper/log/HuaxunService.xml

8
cereshop-business/src/main/resources/mybatis/mapper/product/CereProductSkuDAO.xml

@ -120,6 +120,12 @@
<if test="originalPrice != null">
original_price = #{originalPrice,jdbcType=DECIMAL},
</if>
<if test="isCross != null">
is_cross = #{isCross,jdbcType=BIT},
</if>
<if test="storehouseId != null">
storehouse_id = #{storehouseId,jdbcType=BIGINT},
</if>
<if test="stockNumber != null">
stock_number = #{stockNumber,jdbcType=INTEGER},
</if>
@ -201,6 +207,8 @@
sku_id,
price,
original_price,
storehouse_id,
is_cross,
stock_number,
weight,
sku_image,

23
cereshop-business/src/main/resources/mybatis/mapper/storehouse/CereShopStorehouseDAO.xml

@ -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>

20
cereshop-commons/src/main/java/com/shop/cereshop/commons/config/HuaxunConfig.java

@ -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";
}

35
cereshop-commons/src/main/java/com/shop/cereshop/commons/config/XspayConfig.java

@ -5,15 +5,30 @@
*/
package com.shop.cereshop.commons.config;
import com.shop.cereshop.commons.constant.XsPayEnum;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Component
public class XspayConfig {
public static String DEFUALT_TRADE_TYPE = XsPayEnum.TRADE_TYPE_CROSS_BOARD_PAYMENT.getCode();
// 请求网关地址
public static String URL = "https://openapi.alipay.com/gateway.do";
// 支付回调地址
public static String APP_RETURN_URL = "xx";
// 支付结果通知地址
public static String APP_NOTICE_URL = "http://122.9.152.120/ceres-app-api/extend/xsPay/pay/notify";
// 支付回调地址
public static String BUSINESS_RETURN_URL = "xx";
// 支付结果通知地址
public static String BUSINESS_NOTICE_URL = "http://122.9.152.120/ceres-app-api/extend/xsPay/pay/notify";
/**
* 商户会员号 merCode
*/
@ -61,6 +76,26 @@ public class XspayConfig {
this.URL = url;
}
@Value("${xspay.app_return_url:}")
public void setAppReturnUrl(String url) {
this.APP_RETURN_URL = url;
}
@Value("${xspay.app_notice_url:}")
public void setAppNoticeUrl(String url) {
this.APP_NOTICE_URL = url;
}
@Value("${xspay.business_return_url:}")
public void setBusinessReturnUrl(String url) {
this.BUSINESS_RETURN_URL = url;
}
@Value("${xspay.business_notice_url:}")
public void setBusinessNoticeUrl(String url) {
this.BUSINESS_NOTICE_URL = url;
}
@Value("${xspay.mer_code:}")
public void setMerCode(String merCode) {
this.MER_CODE = merCode;

51
cereshop-commons/src/main/java/com/shop/cereshop/commons/constant/XsPayEnum.java

@ -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;
}
}

13
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/buyer/CereBuyerUser.java

@ -47,6 +47,19 @@ public class CereBuyerUser implements Serializable {
private String birthday;
/**
* 真实姓名
*/
@ApiModelProperty(value = "真实姓名")
private String realName;
/**
* 身份证号码
*/
@ApiModelProperty(value = "身份证号码")
private String idCard;
/**
* 微信openID
*/
private String wechatOpenId;

50
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/ExpressListVo.java

@ -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;
}

36
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/GoodListVo.java

@ -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;
}

18
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunExpressRequestBo.java

@ -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;
}

22
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunOrderRequestBo.java

@ -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;
}

22
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunPayBaoGuanRequestBo.java

@ -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;
}

22
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunPayBaoGuanResponseBo.java

@ -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;
}

27
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/HuaxunRequestBo.java

@ -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;
}

85
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/huaxun/OrderListVo.java

@ -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;
}

12
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/product/CereProductSku.java

@ -56,6 +56,18 @@ public class CereProductSku implements Serializable {
private BigDecimal originalPrice;
/**
* * 所属仓库
*/
@ApiModelProperty(value = "所属仓库")
private Integer storehouseId;
/**
* 是否是跨境商品
*/
@ApiModelProperty(value = "是否是跨境商品")
private Integer isCross;
/**
* 库存数量
*/
@ApiModelProperty(value = "库存数量")

156
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopCrossDetail.java

@ -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;
}

106
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/storehouse/CereShopStorehouse.java

@ -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;
}

4
cereshop-commons/src/main/java/com/shop/cereshop/commons/utils/KdniaoTrackQueryAPI.java

@ -86,8 +86,8 @@ public class KdniaoTrackQueryAPI {
}
/**
* 向指定 URL 发送POST方法的请求
* @param url 发送请求的 URL
* 向指定 PAY_URL 发送POST方法的请求
* @param url 发送请求的 PAY_URL
* @param params 请求的参数集合
* @return 远程资源的响应结果
*/

2
cereshop-app/src/main/java/com/shop/cereshop/app/pay/xs/utils/MD5Utils.java → cereshop-commons/src/main/java/com/shop/cereshop/commons/utils/MD5Utils.java

@ -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;
Loading…
Cancel
Save