Browse Source

支持多商家,修改结算功能

multiwx
xh-pan1 2 years ago
parent
commit
5d47dc779a
  1. 2
      cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/after/CereOrderAfterDAO.java
  2. 2
      cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/order/CereShopOrderDAO.java
  3. 11
      cereshop-admin/src/main/java/com/shop/cereshop/admin/pay/xs/XsPayService.java
  4. 77
      cereshop-admin/src/main/java/com/shop/cereshop/admin/pay/xs/impl/XsPayServiceImpl.java
  5. 2
      cereshop-admin/src/main/java/com/shop/cereshop/admin/service/activity/impl/CereActivitySignServiceImpl.java
  6. 2
      cereshop-admin/src/main/java/com/shop/cereshop/admin/service/after/impl/CereOrderAfterServiceImpl.java
  7. 2
      cereshop-admin/src/main/java/com/shop/cereshop/admin/service/business/CerePlatformBusinessService.java
  8. 2
      cereshop-admin/src/main/java/com/shop/cereshop/admin/service/business/impl/CerePlatformBusinessServiceImpl.java
  9. 1
      cereshop-admin/src/main/java/com/shop/cereshop/admin/service/mark/MarkDataServiceImpl.java
  10. 10
      cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/impl/CereShopWithdrawalServiceImpl.java
  11. 20
      cereshop-admin/src/main/resources/application-admin-dev.yml
  12. 16
      cereshop-admin/src/main/resources/application.yml
  13. 15
      cereshop-admin/src/main/resources/mybatis/mapper/activity/CereActivitySignDAO.xml
  14. 19
      cereshop-admin/src/main/resources/mybatis/mapper/after/CereOrderAfterDAO.xml
  15. 25
      cereshop-admin/src/main/resources/mybatis/mapper/business/CerePlatformBusinessDAO.xml
  16. 55
      cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
  17. 11
      cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopWithdrawalDAO.xml
  18. 6
      cereshop-app/src/main/java/com/shop/cereshop/app/dao/after/CereOrderAfterDAO.java
  19. 3
      cereshop-app/src/main/java/com/shop/cereshop/app/dao/order/CereShopOrderDAO.java
  20. 4
      cereshop-app/src/main/java/com/shop/cereshop/app/service/after/impl/CereOrderAfterServiceImpl.java
  21. 2
      cereshop-app/src/main/java/com/shop/cereshop/app/service/order/impl/CereShopOrderServiceImpl.java
  22. 2
      cereshop-app/src/main/resources/application-app-dev.yml
  23. 5
      cereshop-app/src/main/resources/application.yml
  24. 39
      cereshop-app/src/main/resources/mybatis/mapper/after/CereOrderAfterDAO.xml
  25. 55
      cereshop-app/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
  26. 6
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/AfterController.java
  27. 23
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/FinanceController.java
  28. 10
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/OrderController.java
  29. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopBankController.java
  30. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/activity/CereActivitySignDAO.java
  31. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/after/CereOrderAfterDAO.java
  32. 20
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java
  33. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopBankDAO.java
  34. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopWithdrawalDAO.java
  35. 6
      cereshop-business/src/main/java/com/shop/cereshop/business/page/finance/FlowingWater.java
  36. 11
      cereshop-business/src/main/java/com/shop/cereshop/business/param/after/AfterGetAllParam.java
  37. 6
      cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/BondParam.java
  38. 12
      cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/FinanceCountParam.java
  39. 11
      cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/FinanceDetailParam.java
  40. 22
      cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/FinanceSaveWithdralwalParam.java
  41. 12
      cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/FinanceWithdrawalParam.java
  42. 12
      cereshop-business/src/main/java/com/shop/cereshop/business/param/order/OrderGetAllParam.java
  43. 13
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/XsPayService.java
  44. 82
      cereshop-business/src/main/java/com/shop/cereshop/business/pay/xs/service/impl/XsPayServiceImpl.java
  45. 4
      cereshop-business/src/main/java/com/shop/cereshop/business/service/activity/impl/CereActivitySignServiceImpl.java
  46. 3
      cereshop-business/src/main/java/com/shop/cereshop/business/service/after/impl/CereOrderAfterServiceImpl.java
  47. 10
      cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereShopOrderService.java
  48. 43
      cereshop-business/src/main/java/com/shop/cereshop/business/service/order/impl/CereShopOrderServiceImpl.java
  49. 2
      cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/CereShopBankService.java
  50. 6
      cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopBankServiceImpl.java
  51. 38
      cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopWithdrawalServiceImpl.java
  52. 1
      cereshop-business/src/main/resources/application-business-dev.yml
  53. 1
      cereshop-business/src/main/resources/application.yml
  54. 18
      cereshop-business/src/main/resources/mybatis/mapper/activity/CereActivitySignDAO.xml
  55. 42
      cereshop-business/src/main/resources/mybatis/mapper/after/CereOrderAfterDAO.xml
  56. 281
      cereshop-business/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml
  57. 29
      cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopBankDAO.xml
  58. 11
      cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopWithdrawalDAO.xml
  59. 8
      cereshop-commons/src/main/java/com/shop/cereshop/commons/config/XspayConfig.java
  60. 7
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/after/CereOrderAfter.java
  61. 5
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/pay/CerePayLog.java
  62. 6
      cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopWithdrawal.java

2
cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/after/CereOrderAfterDAO.java

@ -26,8 +26,6 @@ public interface CereOrderAfterDAO extends BaseMapper<CereOrderAfter> {
int updateByPrimaryKeySelective(CereOrderAfter record);
int updateByPrimaryKey(CereOrderAfter record);
List<After> getAll(AfterGetAllParam param);
AfterDetail getById(@Param("afterId") Long afterId);

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

@ -32,8 +32,6 @@ public interface CereShopOrderDAO extends BaseMapper<CereShopOrder> {
int updateByPrimaryKeySelective(CereShopOrder record);
int updateByPrimaryKey(CereShopOrder record);
void updateAfterState(CereShopOrder cereShopOrder);
void updateState(CereShopOrder cereShopOrder);

11
cereshop-admin/src/main/java/com/shop/cereshop/admin/pay/xs/XsPayService.java

@ -6,6 +6,17 @@
package com.shop.cereshop.admin.pay.xs;
import com.shop.cereshop.admin.pay.PayService;
import com.shop.cereshop.commons.exception.CoBusinessException;
import java.math.BigDecimal;
public interface XsPayService extends PayService {
/**
* 提现
* @return
* @throws CoBusinessException
*/
String getMoney(Long businessId, String orderFormid,
String tradeType, BigDecimal money) throws CoBusinessException;
}

77
cereshop-admin/src/main/java/com/shop/cereshop/admin/pay/xs/impl/XsPayServiceImpl.java

@ -10,19 +10,24 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.parser.Feature;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.gson.Gson;
import com.shop.cereshop.admin.dao.order.CereOrderProductDAO;
import com.shop.cereshop.admin.dao.order.CereShopOrderDAO;
import com.shop.cereshop.admin.dao.shop.CereShopBankDAO;
import com.shop.cereshop.admin.page.business.BusinessGetAll;
import com.shop.cereshop.admin.pay.xs.XsPayService;
import com.shop.cereshop.admin.service.business.CerePlatformBusinessService;
import com.shop.cereshop.admin.service.shop.CerePlatformShopService;
import com.shop.cereshop.commons.config.XspayConfig;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.constant.WxPayEnum;
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness;
import com.shop.cereshop.commons.domain.order.CereOrderParent;
import com.shop.cereshop.commons.domain.order.CereOrderProduct;
import com.shop.cereshop.commons.domain.order.CereShopOrder;
import com.shop.cereshop.commons.domain.shop.CerePlatformShop;
import com.shop.cereshop.commons.domain.shop.CereShopBank;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.utils.EmptyUtils;
import com.shop.cereshop.commons.utils.StringUtils;
@ -41,7 +46,7 @@ import java.util.stream.Collectors;
public class XsPayServiceImpl implements XsPayService {
private static final String SHARE_REFUND_SER_CODE = "101022";
private static final String SHARE_GETMONEY_SER_CODE = "101019";
@Autowired
private CereShopOrderDAO cereShopOrderDAO;
@ -50,7 +55,9 @@ public class XsPayServiceImpl implements XsPayService {
private CereOrderProductDAO cereOrderProductDAO;
@Autowired
private CerePlatformShopService cerePlatformShopservice;
private CerePlatformBusinessService cerePlatformBusinessService;
@Autowired
private CerePlatformShopService cerePlatformShopService;
@Autowired
private CereShopBankDAO cereShopBankDAO;
@ -108,6 +115,60 @@ public class XsPayServiceImpl implements XsPayService {
}
@Override
public String getMoney(Long businessId, String orderFormid,
String tradeType, BigDecimal money) throws CoBusinessException {
//构建请求参数
Map<String, Object> contentMap = build19ContentMap(businessId, orderFormid, tradeType, money);
try {
String respMsg = XsPayUtils.requestByXs(SHARE_GETMONEY_SER_CODE, contentMap);
if(StrUtil.isNotBlank(respMsg)){
//解析响应报文并验签
CommonUtils.verifySignRespMsg(SHARE_GETMONEY_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));
return responeMsg;
}
} catch (CoBusinessException e) {
throw e;
} catch (Exception e) {
e.printStackTrace();
throw new CoBusinessException("10000","提现出错", "");
}
return null;
}
/**
* 构建content请求参数
* @return
*/
private Map<String,Object> build19ContentMap(Long businessId, String orderFormid,
String tradeType, BigDecimal money) throws CoBusinessException {
BusinessGetAll business = cerePlatformBusinessService.getById(businessId);
CereShopBank shopBank = cereShopBankDAO.selectOne(
Wrappers.<CereShopBank>lambdaQuery()
.eq(CereShopBank::getShopId, businessId));
if(shopBank == null){
throw new CoBusinessException("10000","查找不到绑定的银行卡信息", "");
}
Map<String, Object> contentMap = new LinkedHashMap<>();
contentMap.put("merOrderId", orderFormid);
contentMap.put("shareParId", business.getXsPayId());
contentMap.put("bankAcctNo", shopBank.getCardNumber());
contentMap.put("currencyCode", "CNY");
contentMap.put("tradeType", tradeType);
contentMap.put("settleType", "1");
contentMap.put("accPeriodStart", "");
contentMap.put("accPeriodEnd", "");
contentMap.put("settleFliter", money.multiply(BigDecimal.valueOf(100)).intValue());
contentMap.put("auditFlag", "0");
contentMap.put("noticeUrl", XspayConfig.BUSINESS_GETMONEY_NOTICE_URL);
return contentMap;
}
private Map<String,Object> build22ContentMap(String orderFormId, String merOrderId, String oldMerOrderId, String dealId, BigDecimal money, String noticeUrl) throws CoBusinessException {
List<CereShopOrder> orderList = null;
@ -137,7 +198,9 @@ public class XsPayServiceImpl implements XsPayService {
log.info("cereOrderProductList:" + new Gson().toJson(cereOrderProductList));
List<Long> shopIdList = orderList.stream().map(CereShopOrder::getShopId).distinct().collect(Collectors.toList());
List<CerePlatformShop> cerePlatformShopList = cerePlatformShopservice.getByIdList(shopIdList);
List<CerePlatformShop> cerePlatformShopList = cerePlatformShopService.getByIdList(shopIdList);
List<Long> businessIdList = cerePlatformShopList.stream().map(CerePlatformShop::getBusinessId).distinct().collect(Collectors.toList());
List<CerePlatformBusiness> cerePlatformBusinessList = cerePlatformBusinessService.getByIdList(businessIdList);
Map<String, Object> contentMap = new LinkedHashMap<>();
@ -148,7 +211,7 @@ public class XsPayServiceImpl implements XsPayService {
//oldDealId 对应 101004101005接口响应参数中dealId
// contentMap.put("oldDealId", dealId);
contentMap.put("oldSubOrderId", orderList.get(0).getOrderFormid());
JSONArray jsonArray = build22SubMerchantOrderDetails(orderList, cereOrderProductList, cerePlatformShopList);
JSONArray jsonArray = build22SubMerchantOrderDetails(orderList, cereOrderProductList, cerePlatformShopList, cerePlatformBusinessList);
if(jsonArray != null) {
contentMap.put("shareRefundDetail", JSONArray.toJSONString(jsonArray));
}
@ -164,7 +227,8 @@ public class XsPayServiceImpl implements XsPayService {
*/
private static JSONArray build22SubMerchantOrderDetails(List<CereShopOrder> orderList,
List<CereOrderProduct> cereOrderProductList,
List<CerePlatformShop> cerePlatformShopList){
List<CerePlatformShop> cerePlatformShopList,
List<CerePlatformBusiness> cerePlatformBusinessList){
if(cereOrderProductList.isEmpty()){
return null;
}
@ -174,6 +238,9 @@ public class XsPayServiceImpl implements XsPayService {
for (CereShopOrder cereShopOrder : orderList) {
CerePlatformShop cerePlatformShop = cerePlatformShopList.stream().filter(item ->
item.getShopId().equals(cereShopOrder.getShopId())).findFirst().orElse(null);
CerePlatformBusiness cerePlatformBusiness = cerePlatformBusinessList.stream().filter(item ->
item.getBusinessId().equals(cerePlatformShop.getBusinessId())).findFirst().orElse(null);
List<CereOrderProduct> orderProductList = cereOrderProductList.stream().filter(item -> item.getOrderId().equals(cereShopOrder.getOrderId())).collect(Collectors.toList());
for (CereOrderProduct cereOrderProduct : orderProductList) {
//子订单1 明细1

2
cereshop-admin/src/main/java/com/shop/cereshop/admin/service/activity/impl/CereActivitySignServiceImpl.java

@ -23,6 +23,7 @@ import com.shop.cereshop.commons.domain.common.Page;
import com.shop.cereshop.commons.domain.pay.CerePayLog;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.utils.EmptyUtils;
import com.shop.cereshop.commons.utils.ProjectUtil;
import com.shop.cereshop.commons.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -119,6 +120,7 @@ public class CereActivitySignServiceImpl implements CereActivitySignService {
cerePayLog.setRefundFee(payLog.getRefundFee());
cerePayLog.setPaymentMode(IntegerEnum.ORDER_PAY_WX.getCode());
cerePayLog.setShopId(payLog.getShopId());
cerePayLog.setProject(payLog.getProject());
cerePayLog.setState(StringEnum.PAY_LOG_REFUND.getCode());
cerePayLog.setTotalFee(payLog.getTotalFee());
cerePayLog.setPlatformCommission(payLog.getPlatformCommission());

2
cereshop-admin/src/main/java/com/shop/cereshop/admin/service/after/impl/CereOrderAfterServiceImpl.java

@ -370,6 +370,7 @@ public class CereOrderAfterServiceImpl implements CereOrderAfterService {
cerePayLog.setRefundFee(cereOrderAfter.getPrice());
cerePayLog.setPaymentMode(IntegerEnum.ORDER_PAY_WX.getCode());
cerePayLog.setShopId(payLog.getShopId());
cerePayLog.setProject(cereOrderAfter.getProject());
cerePayLog.setState(StringEnum.PAY_LOG_REFUND.getCode());
cerePayLog.setTotalFee(payLog.getTotalFee());
cerePayLog.setPlatformCommission(payLog.getPlatformCommission());
@ -451,6 +452,7 @@ public class CereOrderAfterServiceImpl implements CereOrderAfterService {
payLog.setOutRefundNo(outRefundNo);
payLog.setPaymentMode(order.getPaymentMode());
payLog.setShopId(order.getShopId());
payLog.setProject(order.getProject());
payLog.setState(StringEnum.PAY_LOG_REFUND.getCode());
payLog.setTotalFee(order.getPrice());
payLog.setPlatformCommission(order.getPlatformCommission());

2
cereshop-admin/src/main/java/com/shop/cereshop/admin/service/business/CerePlatformBusinessService.java

@ -35,7 +35,7 @@ public interface CerePlatformBusinessService {
void startOrStop(BusinessStartParam param, CerePlatformUser user) throws CoBusinessException;
BusinessGetAll getById(Long businessId) throws CoBusinessException,Exception;
BusinessGetAll getById(Long businessId) throws CoBusinessException;
Page getAll(BusinessGetAllParam param) throws CoBusinessException;

2
cereshop-admin/src/main/java/com/shop/cereshop/admin/service/business/impl/CerePlatformBusinessServiceImpl.java

@ -179,7 +179,7 @@ public class CerePlatformBusinessServiceImpl implements CerePlatformBusinessServ
}
@Override
public BusinessGetAll getById(Long businessId) throws CoBusinessException,Exception {
public BusinessGetAll getById(Long businessId) throws CoBusinessException {
BusinessGetAll shop = cerePlatformBusinessDAO.getById(businessId);
//解密密码
// shop.setShopPassword(EncryptUtil.decrypt(shop.getShopPassword()));

1
cereshop-admin/src/main/java/com/shop/cereshop/admin/service/mark/MarkDataServiceImpl.java

@ -185,6 +185,7 @@ public class MarkDataServiceImpl implements MarkDataService{
payLog.setPlatformCommission(decimal);
payLog.setUserId(String.valueOf(user.getBuyerUserId()));
payLog.setShopId(1l);
payLog.setProject("0");
payLog.setState("支付");
cerePayLogService.insert(payLog);
CerePlatformUser platformUser=new CerePlatformUser();

10
cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/impl/CereShopWithdrawalServiceImpl.java

@ -8,6 +8,7 @@ package com.shop.cereshop.admin.service.shop.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.shop.cereshop.admin.dao.shop.CereShopWithdrawalDAO;
import com.shop.cereshop.admin.pay.xs.XsPayService;
import com.shop.cereshop.admin.utils.EncodeUtil;
import com.shop.cereshop.commons.domain.common.Page;
import com.shop.cereshop.admin.param.withdrawal.WithdrawalGetAllParam;
@ -39,6 +40,9 @@ public class CereShopWithdrawalServiceImpl implements CereShopWithdrawalService
@Autowired
private EncodeUtil encodeUtil;
@Autowired
private XsPayService xsPayService;
@Override
public Page getAll(WithdrawalGetAllParam param) throws CoBusinessException {
PageHelper.startPage(param.getPage(),param.getPageSize());
@ -64,6 +68,12 @@ public class CereShopWithdrawalServiceImpl implements CereShopWithdrawalService
cereShopWithdrawal.setHandleTime(time);
cereShopWithdrawal.setState(IntegerEnum.WITHDRAWAL_ALREADY.getCode());
cereShopWithdrawalDAO.updateById(cereShopWithdrawal);
CereShopWithdrawal withdrawal = cereShopWithdrawalDAO.getById(param.getWithdrawalId());
//触发新生提现
xsPayService.getMoney(withdrawal.getShopId(), "bplatform-"+ withdrawal.getWithdrawalId(),
"0004", withdrawal.getWithdrawalMoney());
//新增日志
cerePlatformLogService.addLog(user,"提现申请管理","平台端操作","处理提现申请",String.valueOf(param.getWithdrawalId()),time);
}

20
cereshop-admin/src/main/resources/application-admin-dev.yml

@ -201,3 +201,23 @@ refreshSkuRealInfoUrl: ${spring.domain}/api/product/refreshSkuRealInfo
#渠道注册链接
channelRegisterUrl: ${spring.domain}/h5/#/pages_category_page2/userModule/register?
pay:
paymentMode: 4
xspay:
url: https://uwebgatetest.hnapay.com/webgate/unifiedAPI.htm
mer_code: 10000000381
app_return_url: xx
app_notice_url: http://122.9.152.120/ceres-app-api/extend/xsPay/pay/notify
app_baoguan_notice_url: http://122.9.152.120/ceres-app-api/extend/xsPay/pay/baoguannotify
business_return_url: xx
business_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/pay/notify
business_return_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/refund/notify
business_register_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/register/notify
business_getmoney_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/getmoney/notify
rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANMGXGvYX9yqb5qauZgc2mXk4R+2op9KLhCuqO0mt5aTyAFfGXty2RHAinwQif6AUyfFZK7p0/9xz2yX4VHltA4qFNsgQmi2Qtry8MTbBrPtVgukWdLmcK7NqR9C8reXO7e/Np3SPNLle5MsEkwM25cMK56JEc3WMRe+KIRZ69d1AgMBAAECgYBTSW1suyeKplIKCQs7OBgSozUfGSwyBksMFoNhpihLa+RCdlBOYtO9p+qAcN6l7evkBIpqZqtfZIHjcEZj1m8reIHHBnuv/sKGXWPvMBKqckenwNnqUzlj4X8hvFtkbcqXLGdyYoicW+P5+P8zHmYRom+izd5FO9281zXa4UK6gQJBAOquqD84B1VnNq2xopaaJvxaL4c5IOinkfRWShttANCpt1D0t1cs+7WPq9sdFZ4cyHYomxuC4knqJh1E/WzCVqUCQQDmMZH8+6sgqOrgsECw6w0KdUci/XgzT/DRS/3MFMeRv7ygEtdlyvyxRirEArsjQgDg3IBLo9TxBUdygPhgXnSRAkEAtp95r9By7IOoKhw8cMO+qMuphqnvMP0NeD0Z6CO36ajYTXhRn9YSfiQyUQ1eAC9X05MfuJXucCR0ynwgVd0ZPQJAdYaRdow3TrFvWdAi9zDKs7A05ZRrrib+WJ1nsq5ZRfySnVeBSaNdaFTeuLx8NwAX2rY5emTm7zc2xys5pFoVQQJAUPrxmTbELDTF1by6POX/IT3iSeClzOx+M05Yd4sgXtALPjYt0VMLtnsfmt9qMEjhk0Q95wgdmeHsBHxno5qGfQ==
newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmVh2/xldLXhVU/mNT57m95uw0Hr0Pdl4pUyM2xV509LqLYTbLduCqqnuMTJUq7Irv8SsKfVqB7zKggxFyjmIfeeyTbhMDJkWZ20xRhv+rSw3ZBQD/Hbn+cxhi4FZ3gc+jUSI1pIsPrlvRK7E5DyWLa/RvZYiQfW/XYI4c1Mb29QIDAQAB
default_company_code: 460116287K
default_company_name: 新生支付有限公司

16
cereshop-admin/src/main/resources/application.yml

@ -79,3 +79,19 @@ rsa:
#全局管理员手机号
globalAdminPhone: 13888088808
spay:
url: https://uwebgate.hnapay.com/webgate/unifiedAPI.htm
app_return_url: xx
app_notice_url: https://wechat.hnthee.com/ceres-app-api/extend/xsPay/pay/notify
app_baoguan_notice_url: https://wechat.hnthee.com/ceres-app-api/extend/xsPay/pay/baoguannotify
business_return_url: xx
business_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/pay/notify
business_return_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/refund/notify
business_register_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/register/notify
business_getmoney_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/getmoney/notify
mer_code: 10000000589
sign_type: 1
rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIsNcvBCDUYCkEyHcuzYyGL9TOHV0kQWcAUJmQqgIIcn7devK2fCSgZs5N42tVm59m07VyUmYXfXrFzx80qwp0Db3bUrqAZqMDB1YnxjiM+Rrrm0pPAPGvGUR4XunPIEbqidezUe1pZCMavejql+TkouXrtHQhZVJJHOQwhTvO03AgMBAAECgYBaFKRZMPEYYaDJcxXoiaeHOUENLE/C/CYlnUofsAxigmN6Tmh4F02NTA4YRqjFL8uMh9y0nGCYGof2zmcmA7rVPSOaQwqwqmc+lHWq/Jy5Z6cAxlod1UeA+BEF9gc/d6YNJx+1UoywMJgr4o/59K9MCZofFLUPGhxoMTQzTB34wQJBAL49KvP5EktoEbloVrqoMNXalgXmGeETrUGkc29uTegT/K/29FllcY5mlSJhnL/uoW8aMuU2V8h7fv7RoJBX/DUCQQC7HqNbl0tmj4ffBUsggoTyuKQby2bNLqPJ6wHcQB5OAZhP2E4q+KC9MpS3eT0ljC27/6T+y4Qvry+THmiU1jk7AkB4bWJWhZKmN6AYvctBaB1aE4CrBUnWqM0h48fLf4lD4/svLWbrfINRQPEhjadb/OUm3u/fF/KkEEGJcAxzs68NAkAIqCo2mpFKdWl7z+rh3if4csJk5swiwf2h4dV8Mxsz0K8TQpabNlV5a1WmB13k1s9m2zTu9MtwyVISJF4CRMbxAkEAi88aKBXP1TO9AFZwyNE2Z9dVcSk2xruj9yLgfKvpcZF5eGm3/S9wGz9k+753rxe/KMkWfWd0eIK3VK0iYJ9K+Q==
newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCSsyBgvE+lwHaiGWUTozg++a+1+wy5UulZtE8uFDIu3tyJECxiPUrw2NE5UBkVqgYsSJu0keb3vvv5/xwsU9/wPEdYb/lhzFMlYt5Z+cob/khek7WQtmdoxCV6+AdGpo5tho2BikbYHbvehNjE894GZGVI1y/rGKxXBltqYqwoEwIDAQAB

15
cereshop-admin/src/main/resources/mybatis/mapper/activity/CereActivitySignDAO.xml

@ -195,13 +195,20 @@
</select>
<select id="getAllBond" parameterType="com.shop.cereshop.admin.param.finance.BondParam" resultType="com.shop.cereshop.admin.page.finance.ShopBond">
SELECT b.shop_name,c.activity_name,a.sign_id,a.bond_money,a.bond_state,
a.payment_time,a.return_time FROM cere_activity_sign a
LEFT JOIN cere_platform_shop b ON a.shop_id=b.shop_id
SELECT
b.business_name shop_name,
c.activity_name,
a.sign_id,
a.bond_money,
a.bond_state,
a.payment_time,
a.return_time
FROM cere_activity_sign a
LEFT JOIN cere_platform_business b ON a.shop_id=b.business_id
LEFT JOIN cere_platform_activity c ON a.activity_id=c.activity_id
where a.state in (0,1) and c.if_bond=1 and bond_state=1
<if test="shopName!=null and shopName!=''">
and b.shop_name like concat('%',#{shopName},'%')
and b.business_name like concat('%',#{shopName},'%')
</if>
<if test="bondState!=null">
and a.bond_state=#{bondState}

19
cereshop-admin/src/main/resources/mybatis/mapper/after/CereOrderAfterDAO.xml

@ -3,6 +3,7 @@
<mapper namespace="com.shop.cereshop.admin.dao.after.CereOrderAfterDAO">
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.after.CereOrderAfter">
<id column="after_id" jdbcType="BIGINT" property="afterId" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="after_formid" jdbcType="VARCHAR" property="afterFormid" />
<result column="after_state" jdbcType="BIT" property="afterState" />
@ -16,7 +17,7 @@
<result column="update_time" jdbcType="VARCHAR" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
after_id, order_id, after_formid, after_state, after_type, price,`explain`, remark, reason,
after_id, order_id, project, after_formid, after_state, after_type, price,`explain`, remark, reason,
image, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@ -35,6 +36,9 @@
<if test="orderId != null">
order_id,
</if>
<if test="project != null and project!=''">
project,
</if>
<if test="afterFormid != null and afterFormid!=''">
after_formid,
</if>
@ -70,6 +74,9 @@
<if test="orderId != null">
#{orderId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
#{project,jdbcType=VARCHAR},
</if>
<if test="afterFormid != null and afterFormid!=''">
#{afterFormid,jdbcType=VARCHAR},
</if>
@ -108,6 +115,9 @@
<if test="orderId != null">
order_id = #{orderId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="afterFormid != null and afterFormid!=''">
after_formid = #{afterFormid,jdbcType=VARCHAR},
</if>
@ -171,10 +181,13 @@
c.shop_name,
c.shop_code,
h.create_time platformAfterTime
from cere_order_after a join cere_platform_after h on h.order_id = a.order_id
from cere_order_after a
join cere_platform_after h on h.order_id = a.order_id
join cere_shop_order b on b.order_id = a.order_id
join cere_platform_shop c on c.shop_id = b.shop_id
where a.after_state in (7, 9, 10)
where
a.after_state in (7, 9, 10)
AND a.project = '0'
<if test="shopName!=null and shopName!=''">
and (c.shop_name like concat('%',#{shopName},'%')
or c.shop_code like concat('%',#{shopName},'%'))

25
cereshop-admin/src/main/resources/mybatis/mapper/business/CerePlatformBusinessDAO.xml

@ -400,15 +400,26 @@
</update>
<select id="getAllFinance" parameterType="com.shop.cereshop.admin.param.finance.FinanceParam" resultType="com.shop.cereshop.admin.page.finance.Finance">
SELECT a.business_id,a.business_name,a.business_code,ifnull(b.revenue, 0) as revenue from cere_platform_business a
LEFT JOIN (SELECT SUM(cso.price) revenue,cps.MAX(business_id),cso.state from cere_shop_order cso
INNER JOIN cere_platform_shop cps ON cso.shop_id = cps.shop_id where cso.state in (2,3,4) GROUP BY cso.shop_id) b ON a.business_id=b.business_id
SELECT
a.business_id shopId,
a.business_name shopName,
a.business_code shopCode,
ifnull(b.revenue, 0) as revenue
from cere_platform_business a
LEFT JOIN (
SELECT
SUM(cso.price) revenue,
(SELECT cps.business_id FROM cere_platform_shop cps WHERE cso.shop_id = cps.shop_id) business_id,
cso.state
from cere_shop_order cso
where cso.state in (2,3,4)
GROUP BY cso.shop_id) b ON a.business_id=b.business_id
where 1=1
<if test="businessName!=null and businessName!=''">
and a.business_name like concat('%',#{businessName},'%')
<if test="shopName!=null and shopName!=''">
and a.business_name like concat('%',#{shopName},'%')
</if>
<if test="businessCode!=null and businessCode!=''">
and a.business_code like concat('%',#{businessCode},'%')
<if test="shopCode!=null and shopCode!=''">
and a.business_code like concat('%',#{shopCode},'%')
</if>
</select>

55
cereshop-admin/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml

@ -5,6 +5,7 @@
<id column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="order_formid" jdbcType="VARCHAR" property="orderFormid" />
<result column="buyer_user_id" jdbcType="BIGINT" property="buyerUserId" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
@ -44,7 +45,7 @@
<result column="platform_commission" jdbcType="DECIMAL" property="platformCommission" />
</resultMap>
<sql id="Base_Column_List">
order_id, parent_id,shop_id, order_formid, buyer_user_id,coupon_id,id,shop_seckill_id,shop_group_work_id,shop_discount_id,shop_operate_id,
order_id, parent_id,shop_id, project, order_formid, buyer_user_id,coupon_id,id,shop_seckill_id,shop_group_work_id,shop_discount_id,shop_operate_id,
order_price, logistics_price,discount_price, price,
`state`, payment_state, payment_mode, payment_time, customer_name, customer_phone,
receive_name, receive_phone, receive_adress,address,receive_time, postal_code, remark, after_state, logistics_id,
@ -70,6 +71,9 @@
<if test="shopId != null">
shop_id,
</if>
<if test="project != null and project!=''">
project,
</if>
<if test="orderFormid != null and orderFormid!=''">
order_formid,
</if>
@ -189,6 +193,9 @@
<if test="shopId != null">
#{shopId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
#{project,jdbcType=VARCHAR},
</if>
<if test="orderFormid != null and orderFormid!=''">
#{orderFormid,jdbcType=VARCHAR},
</if>
@ -311,6 +318,9 @@
<if test="shopId != null">
shop_id = #{shopId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="orderFormid != null and orderFormid!=''">
order_formid = #{orderFormid,jdbcType=VARCHAR},
</if>
@ -426,49 +436,6 @@
</set>
where order_id = #{orderId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.shop.cereshop.commons.domain.order.CereShopOrder">
update cere_shop_order
set parent_id = #{parentId,jdbcType=BIGINT},
shop_id = #{shopId,jdbcType=BIGINT},
order_formid = #{orderFormid,jdbcType=VARCHAR},
buyer_user_id = #{buyerUserId,jdbcType=BIGINT},
coupon_id = #{couponId,jdbcType=BIGINT},
id = #{id,jdbcType=BIGINT},
shop_seckill_id = #{shopSeckillId,jdbcType=BIGINT},
shop_group_work_id = #{shopGroupWorkId,jdbcType=BIGINT},
shop_discount_id = #{shopDiscountId,jdbcType=BIGINT},
shop_operate_id = #{shopOperateId,jdbcType=BIGINT},
order_price = #{orderPrice,jdbcType=DECIMAL},
logistics_price = #{logisticsPrice,jdbcType=DECIMAL},
discount_price = #{discountPrice,jdbcType=DECIMAL},
price = #{price,jdbcType=DECIMAL},
`state` = #{state,jdbcType=BIT},
payment_state = #{paymentState,jdbcType=BIT},
payment_mode = #{paymentMode,jdbcType=BIT},
payment_time = #{paymentTime,jdbcType=VARCHAR},
customer_name = #{customerName,jdbcType=VARCHAR},
customer_phone = #{customerPhone,jdbcType=VARCHAR},
receive_name = #{receiveName,jdbcType=VARCHAR},
receive_phone = #{receivePhone,jdbcType=VARCHAR},
receive_adress = #{receiveAdress,jdbcType=VARCHAR},
adress = #{address,jdbcType=VARCHAR},
receive_time = #{receiveTime,jdbcType=VARCHAR},
postal_code = #{postalCode,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
after_state = #{afterState,jdbcType=BIT},
logistics_id = #{logisticsId,jdbcType=BIGINT},
distributor_id = #{distributorId,jdbcType=BIGINT},
direct_distributor_money = #{directDistributorMoney,jdbcType=DECIMAL},
indirect_distributor_money = #{indirectDistributorMoney,jdbcType=DECIMAL},
seckill_id = #{seckillId,jdbcType=BIGINT},
discount_id = #{discountId,jdbcType=BIGINT},
polite_id = #{politeId,jdbcType=BIGINT},
scene_id = #{sceneId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=VARCHAR},
platform_commission = #{platformCommission,jdbcType=DECIMAL}
where order_id = #{orderId,jdbcType=BIGINT}
</update>
<update id="updateAfterState" parameterType="com.shop.cereshop.commons.domain.order.CereShopOrder">
update cere_shop_order

11
cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopWithdrawalDAO.xml

@ -101,7 +101,16 @@
</select>
<select id="getById" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.shop.CereShopWithdrawal">
SELECT withdrawal_id,shop_name,shop_code,bank_name,bank_card,collection_name,withdrawal_money,apply_time,handle_time
SELECT
withdrawal_id,
shop_name,
shop_code,
bank_name,
bank_card,
collection_name,
withdrawal_money,
apply_time,
handle_time
FROM cere_shop_withdrawal where withdrawal_id=#{withdrawalId}
</select>
</mapper>

6
cereshop-app/src/main/java/com/shop/cereshop/app/dao/after/CereOrderAfterDAO.java

@ -26,9 +26,9 @@ public interface CereOrderAfterDAO extends BaseMapper<CereOrderAfter> {
int updateByPrimaryKeySelective(CereOrderAfter record);
int updateByPrimaryKey(CereOrderAfter record);
List<Afters> getAll(@Param("state") Integer state,@Param("buyerUserId") Long buyerUserId);
List<Afters> getAll(@Param("state") Integer state,
@Param("buyerUserId") Long buyerUserId,
@Param("project") String project);
AfterDetail getById(@Param("afterId") Long afterId);

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

@ -32,9 +32,6 @@ public interface CereShopOrderDAO extends BaseMapper<CereShopOrder> {
int updateByPrimaryKeySelective(CereShopOrder record);
int updateByPrimaryKey(CereShopOrder record);
SettlementShop findSettlementShop(@Param("shopId") Long shopId);
List<SettlementShop> findSettlementShopList(@Param("shopIdList") List<Long> shopIdList);

4
cereshop-app/src/main/java/com/shop/cereshop/app/service/after/impl/CereOrderAfterServiceImpl.java

@ -25,6 +25,7 @@ import com.shop.cereshop.app.service.after.*;
import com.shop.cereshop.app.service.log.CerePlatformLogService;
import com.shop.cereshop.app.service.order.CereShopOrderService;
import com.shop.cereshop.app.service.redis.CereRedisKeyServcice;
import com.shop.cereshop.app.utils.ContextUtil;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.constant.IntegerEnum;
import com.shop.cereshop.commons.constant.StringEnum;
@ -111,6 +112,7 @@ public class CereOrderAfterServiceImpl implements CereOrderAfterService
BeanUtils.copyProperties(param,cereOrderAfter);
cereOrderAfter.setAfterFormid("SH"+RandomStringUtil.getRandomCode(15,0));
cereOrderAfter.setAfterState(IntegerEnum.AFTER_STAY.getCode());
cereOrderAfter.setProject(cereShopOrder.getProject());
cereOrderAfter.setCreateTime(time);
cereOrderAfter.setUpdateTime(time);
//查询规格信息数据
@ -269,7 +271,7 @@ public class CereOrderAfterServiceImpl implements CereOrderAfterService
@Override
public Page getAll(AfterGetAllParam param, CereBuyerUser user) throws CoBusinessException {
PageHelper.startPage(param.getPage(),param.getPageSize());
List<Afters> list=cereOrderAfterDAO.getAll(param.getState(),user.getBuyerUserId());
List<Afters> list=cereOrderAfterDAO.getAll(param.getState(),user.getBuyerUserId(), ContextUtil.getProject());
if(!EmptyUtils.isEmpty(list)){
list.forEach(afters -> {
//查询售后商品明细数据

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

@ -1007,6 +1007,7 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
payLog.setTransactionId(transaction_id);
payLog.setPaymentMode(order.getPaymentMode());
payLog.setShopId(order.getShopId());
payLog.setProject(order.getProject());
payLog.setState(StringEnum.PAY_LOG_REFUND.getCode());
payLog.setTotalFee(order.getPrice());
payLog.setPlatformCommission(order.getPlatformCommission());
@ -1540,6 +1541,7 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
payLog.setTransactionId(transactionId);
payLog.setPaymentMode(order.getPaymentMode());
payLog.setShopId(order.getShopId());
payLog.setProject(order.getProject());
payLog.setState(StringEnum.PAY_LOG_PAY.getCode());
payLog.setTotalFee(order.getPrice());
payLog.setPlatformCommission(order.getPlatformCommission());

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

@ -232,6 +232,8 @@ xspay:
business_return_url: xx
business_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/pay/notify
business_return_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/refund/notify
business_register_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/register/notify
business_getmoney_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/getmoney/notify
rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANMGXGvYX9yqb5qauZgc2mXk4R+2op9KLhCuqO0mt5aTyAFfGXty2RHAinwQif6AUyfFZK7p0/9xz2yX4VHltA4qFNsgQmi2Qtry8MTbBrPtVgukWdLmcK7NqR9C8reXO7e/Np3SPNLle5MsEkwM25cMK56JEc3WMRe+KIRZ69d1AgMBAAECgYBTSW1suyeKplIKCQs7OBgSozUfGSwyBksMFoNhpihLa+RCdlBOYtO9p+qAcN6l7evkBIpqZqtfZIHjcEZj1m8reIHHBnuv/sKGXWPvMBKqckenwNnqUzlj4X8hvFtkbcqXLGdyYoicW+P5+P8zHmYRom+izd5FO9281zXa4UK6gQJBAOquqD84B1VnNq2xopaaJvxaL4c5IOinkfRWShttANCpt1D0t1cs+7WPq9sdFZ4cyHYomxuC4knqJh1E/WzCVqUCQQDmMZH8+6sgqOrgsECw6w0KdUci/XgzT/DRS/3MFMeRv7ygEtdlyvyxRirEArsjQgDg3IBLo9TxBUdygPhgXnSRAkEAtp95r9By7IOoKhw8cMO+qMuphqnvMP0NeD0Z6CO36ajYTXhRn9YSfiQyUQ1eAC9X05MfuJXucCR0ynwgVd0ZPQJAdYaRdow3TrFvWdAi9zDKs7A05ZRrrib+WJ1nsq5ZRfySnVeBSaNdaFTeuLx8NwAX2rY5emTm7zc2xys5pFoVQQJAUPrxmTbELDTF1by6POX/IT3iSeClzOx+M05Yd4sgXtALPjYt0VMLtnsfmt9qMEjhk0Q95wgdmeHsBHxno5qGfQ==
newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmVh2/xldLXhVU/mNT57m95uw0Hr0Pdl4pUyM2xV509LqLYTbLduCqqnuMTJUq7Irv8SsKfVqB7zKggxFyjmIfeeyTbhMDJkWZ20xRhv+rSw3ZBQD/Hbn+cxhi4FZ3gc+jUSI1pIsPrlvRK7E5DyWLa/RvZYiQfW/XYI4c1Mb29QIDAQAB
default_company_code: 460116287K

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

@ -75,7 +75,7 @@ scrmTrackReportUrl: https://scrm-demo.zkthink.com/stage-api/wecom/clue-user/add
pay:
paymentMode: 4
xspay:
spay:
url: https://uwebgate.hnapay.com/webgate/unifiedAPI.htm
app_return_url: xx
app_notice_url: https://wechat.hnthee.com/ceres-app-api/extend/xsPay/pay/notify
@ -83,12 +83,13 @@ xspay:
business_return_url: xx
business_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/pay/notify
business_return_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/refund/notify
business_register_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/register/notify
business_getmoney_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/getmoney/notify
mer_code: 10000000589
sign_type: 1
rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIsNcvBCDUYCkEyHcuzYyGL9TOHV0kQWcAUJmQqgIIcn7devK2fCSgZs5N42tVm59m07VyUmYXfXrFzx80qwp0Db3bUrqAZqMDB1YnxjiM+Rrrm0pPAPGvGUR4XunPIEbqidezUe1pZCMavejql+TkouXrtHQhZVJJHOQwhTvO03AgMBAAECgYBaFKRZMPEYYaDJcxXoiaeHOUENLE/C/CYlnUofsAxigmN6Tmh4F02NTA4YRqjFL8uMh9y0nGCYGof2zmcmA7rVPSOaQwqwqmc+lHWq/Jy5Z6cAxlod1UeA+BEF9gc/d6YNJx+1UoywMJgr4o/59K9MCZofFLUPGhxoMTQzTB34wQJBAL49KvP5EktoEbloVrqoMNXalgXmGeETrUGkc29uTegT/K/29FllcY5mlSJhnL/uoW8aMuU2V8h7fv7RoJBX/DUCQQC7HqNbl0tmj4ffBUsggoTyuKQby2bNLqPJ6wHcQB5OAZhP2E4q+KC9MpS3eT0ljC27/6T+y4Qvry+THmiU1jk7AkB4bWJWhZKmN6AYvctBaB1aE4CrBUnWqM0h48fLf4lD4/svLWbrfINRQPEhjadb/OUm3u/fF/KkEEGJcAxzs68NAkAIqCo2mpFKdWl7z+rh3if4csJk5swiwf2h4dV8Mxsz0K8TQpabNlV5a1WmB13k1s9m2zTu9MtwyVISJF4CRMbxAkEAi88aKBXP1TO9AFZwyNE2Z9dVcSk2xruj9yLgfKvpcZF5eGm3/S9wGz9k+753rxe/KMkWfWd0eIK3VK0iYJ9K+Q==
newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCSsyBgvE+lwHaiGWUTozg++a+1+wy5UulZtE8uFDIu3tyJECxiPUrw2NE5UBkVqgYsSJu0keb3vvv5/xwsU9/wPEdYb/lhzFMlYt5Z+cob/khek7WQtmdoxCV6+AdGpo5tho2BikbYHbvehNjE894GZGVI1y/rGKxXBltqYqwoEwIDAQAB
huaxun:
url: https://bg.qdhuaxun.cn/index.php
appId: 8bd29f557af22ec4062774

39
cereshop-app/src/main/resources/mybatis/mapper/after/CereOrderAfterDAO.xml

@ -3,6 +3,7 @@
<mapper namespace="com.shop.cereshop.app.dao.after.CereOrderAfterDAO">
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.after.CereOrderAfter">
<id column="after_id" jdbcType="BIGINT" property="afterId" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="after_formid" jdbcType="VARCHAR" property="afterFormid" />
<result column="after_state" jdbcType="BIT" property="afterState" />
@ -18,7 +19,7 @@
<result column="update_time" jdbcType="VARCHAR" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
after_id, order_id, after_formid, after_state,goods_state, after_type, price,`explain`,return_reason, remark, reason,
after_id, order_id, project, after_formid, after_state,goods_state, after_type, price,`explain`,return_reason, remark, reason,
image, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@ -37,6 +38,9 @@
<if test="orderId != null">
order_id,
</if>
<if test="project != null and project!=''">
project,
</if>
<if test="afterFormid != null and afterFormid!=''">
after_formid,
</if>
@ -78,6 +82,9 @@
<if test="orderId != null">
#{orderId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
#{project,jdbcType=VARCHAR},
</if>
<if test="afterFormid != null and afterFormid!=''">
#{afterFormid,jdbcType=VARCHAR},
</if>
@ -122,6 +129,9 @@
<if test="orderId != null">
order_id = #{orderId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="afterFormid != null and afterFormid!=''">
after_formid = #{afterFormid,jdbcType=VARCHAR},
</if>
@ -161,30 +171,19 @@
</set>
where after_id = #{afterId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.shop.cereshop.commons.domain.after.CereOrderAfter">
update cere_order_after
set order_id = #{orderId,jdbcType=BIGINT},
after_formid = #{afterFormid,jdbcType=VARCHAR},
after_state = #{afterState,jdbcType=BIT},
goods_state = #{goodsState,jdbcType=BIT},
after_type = #{afterType,jdbcType=BIT},
price = #{price,jdbcType=DECIMAL},
`explain` = #{explain,jdbcType=VARCHAR},
return_reason = #{returnReason,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
reason = #{reason,jdbcType=VARCHAR},
image = #{image,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=VARCHAR}
where after_id = #{afterId,jdbcType=BIGINT}
</update>
<select id="getAll" parameterType="java.lang.Object" resultType="com.shop.cereshop.app.page.after.Afters">
SELECT a.order_id,a.after_id,a.after_type,a.after_state,a.goods_state,
a.price,b.shop_id,c.shop_name,a.create_time,a.after_formid,c.shop_logo from cere_order_after a
a.price,b.shop_id,c.shop_name,a.create_time,a.after_formid,c.shop_logo
from cere_order_after a
LEFT JOIN cere_shop_order b ON a.order_id=b.order_id
LEFT JOIN cere_platform_shop c ON b.shop_id=c.shop_id
where b.buyer_user_id=#{buyerUserId}
where
1=1
<if test="project != null and project!=''">
a.project = #{project}
</if>
b.buyer_user_id=#{buyerUserId}
<if test='state==1'>
and a.after_state in (1,2,3,5,6,7,10)
</if>

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

@ -5,6 +5,7 @@
<id column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="parent_id" jdbcType="BIGINT" property="parentId" />
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="order_formid" jdbcType="VARCHAR" property="orderFormid" />
<result column="buyer_user_id" jdbcType="BIGINT" property="buyerUserId" />
<result column="coupon_id" jdbcType="BIGINT" property="couponId" />
@ -44,7 +45,7 @@
<result column="platform_commission" jdbcType="DECIMAL" property="platformCommission" />
</resultMap>
<sql id="Base_Column_List">
order_id, parent_id,shop_id, order_formid, buyer_user_id,coupon_id,id,shop_seckill_id,shop_group_work_id,shop_discount_id,shop_operate_id,
order_id, parent_id,shop_id, project, order_formid, buyer_user_id,coupon_id,id,shop_seckill_id,shop_group_work_id,shop_discount_id,shop_operate_id,
order_price, logistics_price,discount_price, price,
`state`, payment_state, payment_mode, payment_time, customer_name, customer_phone,
receive_name, receive_phone, receive_adress,address,receive_time, postal_code, remark, after_state, logistics_id,
@ -70,6 +71,9 @@
<if test="shopId != null">
shop_id,
</if>
<if test="project != null and project!=''">
project,
</if>
<if test="orderFormid != null and orderFormid!=''">
order_formid,
</if>
@ -189,6 +193,9 @@
<if test="shopId != null">
#{shopId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
#{project,jdbcType=VARCHAR},
</if>
<if test="orderFormid != null and orderFormid!=''">
#{orderFormid,jdbcType=VARCHAR},
</if>
@ -311,6 +318,9 @@
<if test="shopId != null">
shop_id = #{shopId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="orderFormid != null and orderFormid!=''">
order_formid = #{orderFormid,jdbcType=VARCHAR},
</if>
@ -425,49 +435,6 @@
</set>
where order_id = #{orderId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.shop.cereshop.commons.domain.order.CereShopOrder">
update cere_shop_order
set parent_id = #{parentId,jdbcType=BIGINT},
shop_id = #{shopId,jdbcType=BIGINT},
order_formid = #{orderFormid,jdbcType=VARCHAR},
buyer_user_id = #{buyerUserId,jdbcType=BIGINT},
coupon_id = #{couponId,jdbcType=BIGINT},
id = #{id,jdbcType=BIGINT},
shop_seckill_id = #{shopSeckillId,jdbcType=BIGINT},
shop_group_work_id = #{shopGroupWorkId,jdbcType=BIGINT},
shop_discount_id = #{shopDiscountId,jdbcType=BIGINT},
shop_operate_id = #{shopOperateId,jdbcType=BIGINT},
order_price = #{orderPrice,jdbcType=DECIMAL},
logistics_price = #{logisticsPrice,jdbcType=DECIMAL},
discount_price = #{discountPrice,jdbcType=DECIMAL},
price = #{price,jdbcType=DECIMAL},
`state` = #{state,jdbcType=BIT},
payment_state = #{paymentState,jdbcType=BIT},
payment_mode = #{paymentMode,jdbcType=BIT},
payment_time = #{paymentTime,jdbcType=VARCHAR},
customer_name = #{customerName,jdbcType=VARCHAR},
customer_phone = #{customerPhone,jdbcType=VARCHAR},
receive_name = #{receiveName,jdbcType=VARCHAR},
receive_phone = #{receivePhone,jdbcType=VARCHAR},
receive_adress = #{receiveAdress,jdbcType=VARCHAR},
adress = #{address,jdbcType=VARCHAR},
receive_time = #{receiveTime,jdbcType=VARCHAR},
postal_code = #{postalCode,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
after_state = #{afterState,jdbcType=BIT},
logistics_id = #{logisticsId,jdbcType=BIGINT},
distributor_id = #{distributorId,jdbcType=BIGINT},
direct_distributor_money = #{directDistributorMoney,jdbcType=DECIMAL},
indirect_distributor_money = #{indirectDistributorMoney,jdbcType=DECIMAL},
seckill_id = #{seckillId,jdbcType=BIGINT},
discount_id = #{discountId,jdbcType=BIGINT},
polite_id = #{politeId,jdbcType=BIGINT},
scene_id = #{sceneId,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=VARCHAR},
platform_commission = #{platformCommission,jdbcType=DECIMAL}
where order_id = #{orderId,jdbcType=BIGINT}
</update>
<!--<update id="updateAfterState" parameterType="com.shop.cereshop.commons.domain.order.CereShopOrder">
update cere_shop_order

6
cereshop-business/src/main/java/com/shop/cereshop/business/controller/AfterController.java

@ -73,7 +73,8 @@ public class AfterController {
@PostMapping(value = "getAll")
@ApiOperation(value = "售后管理查询")
public Result<Page<After>> getAll(@RequestBody AfterGetAllParam param) throws CoBusinessException{
param.setShopId(ContextUtil.getBusinessId());
param.setBusinessId(ContextUtil.getBusinessId());
param.setProject(ContextUtil.getProject());
Page page=cereOrderAfterService.getAll(param);
return new Result(page);
}
@ -247,7 +248,8 @@ public class AfterController {
@PostMapping(value = "export")
@ApiOperation(value = "售后管理导出")
public void export(@RequestBody AfterGetAllParam param, HttpServletRequest request, HttpServletResponse response) throws CoBusinessException{
param.setShopId(ContextUtil.getBusinessId());
param.setBusinessId(ContextUtil.getBusinessId());
param.setProject(ContextUtil.getProject());
Page<After> page=cereOrderAfterService.getAll(param);
List<AfterExportDTO> list = page.getList().stream().map(s -> {
AfterExportDTO afterExportDTO = new AfterExportDTO();

23
cereshop-business/src/main/java/com/shop/cereshop/business/controller/FinanceController.java

@ -23,7 +23,10 @@ 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.web.bind.annotation.*;
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;
import java.util.List;
@ -57,7 +60,8 @@ public class FinanceController {
@PostMapping(value = "getFinanceCount")
@ApiOperation(value = "财务统计数据查询")
public Result<FinanceCount> getFinanceCount(@RequestBody FinanceCountParam param) throws CoBusinessException{
param.setShopId(ContextUtil.getBusinessId());
param.setBusinessId(ContextUtil.getBusinessId());
param.setProject(ContextUtil.getProject());
FinanceCount count=cereShopOrderService.getFinanceCount(param);
return new Result(count);
}
@ -70,8 +74,8 @@ public class FinanceController {
@PostMapping(value = "getBank")
@ApiOperation(value = "查询绑定银行卡")
public Result<Bank> getBank(@RequestBody ShopParam param) throws CoBusinessException{
param.setShopId(ContextUtil.getBusinessId());
Bank bank=cereShopOrderService.getBank(param.getShopId());
param.setBusinessId(ContextUtil.getBusinessId());
Bank bank=cereShopOrderService.getBank(param.getBusinessId());
return new Result(bank);
}
@ -83,7 +87,8 @@ public class FinanceController {
@PostMapping(value = "getWithdrawalDetails")
@ApiOperation(value = "提现明细查询")
public Result<List<WithdrawalDetail>> getWithdrawalDetails(@RequestBody FinanceWithdrawalParam param) throws CoBusinessException{
param.setShopId(ContextUtil.getBusinessId());
param.setBusinessId(ContextUtil.getBusinessId());
param.setProject(ContextUtil.getProject());
List<WithdrawalDetail> list=cereShopOrderService.getWithdrawalDetails(param);
return new Result(list);
}
@ -96,7 +101,8 @@ public class FinanceController {
@PostMapping(value = "getDetails")
@ApiOperation(value = "流水明细")
public Result<Page<FlowingWater>> getDetails(@RequestBody FinanceDetailParam param) throws CoBusinessException{
param.setShopId(ContextUtil.getBusinessId());
param.setBusinessId(ContextUtil.getBusinessId());
param.setProject(ContextUtil.getProject());
Page page=cereShopOrderService.getDetails(param);
return new Result(page);
}
@ -113,7 +119,8 @@ public class FinanceController {
public Result withdrawal(@RequestBody FinanceSaveWithdralwalParam withdrawal, HttpServletRequest request) throws CoBusinessException{
//获取当前登录账户
CerePlatformBusinessUser user = (CerePlatformBusinessUser) request.getAttribute("user");
withdrawal.setShopId(ContextUtil.getBusinessId());
withdrawal.setBusinessId(ContextUtil.getBusinessId());
withdrawal.setProject(ContextUtil.getProject());
cereShopWithdrawalService.save(withdrawal,user);
return new Result(user.getUsername(),"提现申请", GsonUtil.objectToGson(withdrawal));
}
@ -125,7 +132,7 @@ public class FinanceController {
@PostMapping(value = "getAllBond")
@ApiOperation(value = "保证金管理查询")
public Result<BondCount> getAllBond(@RequestBody BondParam param) throws CoBusinessException{
param.setShopId(ContextUtil.getBusinessId());
param.setBusinessId(ContextUtil.getBusinessId());
BondCount count =cereActivitySignService.getAllBond(param);
return new Result(count);
}

10
cereshop-business/src/main/java/com/shop/cereshop/business/controller/OrderController.java

@ -75,7 +75,8 @@ public class OrderController {
@PostMapping(value = "getAll")
@ApiOperation(value = "订单管理查询")
public Result<Page<ShopOrder>> getAll(@RequestBody OrderGetAllParam param) throws CoBusinessException{
param.setShopId(ContextUtil.getBusinessId());
param.setBusinessId(ContextUtil.getBusinessId());
param.setProject(ContextUtil.getProject());
Page page=cereShopOrderService.getAll(param);
return new Result(page);
}
@ -88,7 +89,7 @@ public class OrderController {
@PostMapping(value = "getById")
@ApiOperation(value = "订单详情查询")
public Result<ShopOrder> getById(@RequestBody OrderGetByIdParam param) throws CoBusinessException{
ShopOrder shopOrder=cereShopOrderService.getById(ContextUtil.getBusinessId(), param.getOrderId());
ShopOrder shopOrder=cereShopOrderService.getById(param.getOrderId());
return new Result(shopOrder);
}
@ -115,7 +116,8 @@ public class OrderController {
@PostMapping(value = "export")
@ApiOperation(value = "订单管理导出")
public void export(@RequestBody OrderGetAllParam param, HttpServletRequest request, HttpServletResponse response) throws CoBusinessException {
param.setShopId(ContextUtil.getBusinessId());
param.setBusinessId(ContextUtil.getBusinessId());
param.setProject(ContextUtil.getProject());
param.setPage(1);
param.setPageSize(10000);
Page<ShopOrder> page = cereShopOrderService.getAll(param);
@ -201,7 +203,7 @@ public class OrderController {
return new Result<>(null);
}
scrmSyncVerifyUtil.verify(param.getShopId(), param.getSecret());
ShopOrder shopOrder = cereShopOrderService.getById(param.getShopId(), param.getBusinessId());
ShopOrder shopOrder = cereShopOrderService.getById(param.getBusinessId());
return new Result(shopOrder);
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopBankController.java

@ -141,7 +141,7 @@ public class ShopBankController {
@ApiOperation(value = "收款账户信息查询")
public Result<ShopBankDetail> getById(@RequestBody ShopParam param) throws CoBusinessException{
param.setShopId(ContextUtil.getBusinessId());
ShopBankDetail bank = cereShopBankService.getById(param.getShopId());
ShopBankDetail bank = cereShopBankService.getByShopId(param.getShopId());
return new Result(bank);
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/activity/CereActivitySignDAO.java

@ -53,7 +53,7 @@ public interface CereActivitySignDAO extends BaseMapper<CereActivitySign> {
Integer findActivityState(@Param("activityId") Long activityId);
BigDecimal findBondTotal(@Param("shopId") Long shopId);
BigDecimal findBondTotal(@Param("businessId") Long businessId);
List<ShopBond> getAllBond(BondParam param);

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/after/CereOrderAfterDAO.java

@ -32,8 +32,6 @@ public interface CereOrderAfterDAO extends BaseMapper<CereOrderAfter> {
int updateByPrimaryKeySelective(CereOrderAfter record);
int updateByPrimaryKey(CereOrderAfter record);
List<After> getAll(AfterGetAllParam param);
After getById(@Param("afterId") Long afterId);

20
cereshop-business/src/main/java/com/shop/cereshop/business/dao/order/CereShopOrderDAO.java

@ -40,7 +40,7 @@ public interface CereShopOrderDAO extends BaseMapper<CereShopOrder> {
List<ShopOrder> getAll(OrderGetAllParam param);
ShopOrder getById(@Param("orderId") Long orderId, @Param("shopId") Long shopId);
ShopOrder getById(@Param("orderId") Long orderId);
Integer getOrderTotals(@Param("buyerUserId") Long buyerUserId);
@ -48,23 +48,23 @@ public interface CereShopOrderDAO extends BaseMapper<CereShopOrder> {
void updateState(CereShopOrder cereShopOrder);
BigDecimal getTurnover(@Param("shopId") Long shopId);
BigDecimal getTurnover(@Param("project") String project, @Param("businessId") Long businessId, @Param("shopId") Long shopId);
BigDecimal getPlatformCommission(@Param("shopId") Long shopId);
BigDecimal getPlatformCommission(@Param("project") String project, @Param("businessId") Long businessId, @Param("shopId") Long shopId);
BigDecimal getFrozenMoney(@Param("shopId") Long shopId);
BigDecimal getFrozenMoney(@Param("project") String project, @Param("businessId") Long businessId, @Param("shopId") Long shopId);
BigDecimal getWithdrawableMoney(@Param("shopId") Long shopId);
BigDecimal getWithdrawableMoney(@Param("project") String project, @Param("businessId") Long businessId, @Param("shopId") Long shopId);
BigDecimal getAllWithdrawableMoney(@Param("shopId") Long shopId);
BigDecimal getAllWithdrawableMoney(@Param("project") String project, @Param("businessId") Long businessId, @Param("shopId") Long shopId);
BigDecimal getWithdrawableStayMoney(@Param("shopId") Long shopId);
BigDecimal getWithdrawableStayMoney(@Param("project") String project, @Param("businessId") Long businessId, @Param("shopId") Long shopId);
List<Finance> getFinanceByDay(@Param("shopId") Long shopId,@Param("time") String time,@Param("type") int type);
List<Finance> getFinanceByDay(@Param("project") String project, @Param("businessId") Long businessId, @Param("shopId") Long shopId,@Param("time") String time,@Param("type") int type);
List<Finance> getFinanceByMonth(@Param("shopId") Long shopId,@Param("time") String time,@Param("type") int type);
List<Finance> getFinanceByMonth(@Param("project") String project, @Param("businessId") Long businessId, @Param("shopId") Long shopId,@Param("time") String time,@Param("type") int type);
Bank getBank(@Param("shopId") Long shopId);
Bank getBank(@Param("businessId") Long businessId);
List<WithdrawalDetail> getWithdrawalDetails(FinanceWithdrawalParam param);

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopBankDAO.java

@ -21,7 +21,7 @@ public interface CereShopBankDAO extends BaseMapper<CereShopBank> {
void deleteData(CereShopBank bank);
ShopBankDetail getById(@Param("shopId") Long shopId);
ShopBankDetail getByShopId(@Param("shopId") Long shopId);
CerePlatformShop findByPhone(@Param("shopId") Long shopId, @Param("phone") String phone);
}

2
cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopWithdrawalDAO.java

@ -16,5 +16,5 @@ public interface CereShopWithdrawalDAO extends BaseMapper<CereShopWithdrawal> {
int insertSelective(CereShopWithdrawal record);
CereShopBank findBank(@Param("shopId") Long shopId);
CereShopBank findBank(@Param("businessId") Long businessId);
}

6
cereshop-business/src/main/java/com/shop/cereshop/business/page/finance/FlowingWater.java

@ -25,6 +25,12 @@ public class FlowingWater {
private Long shopId;
/**
* 店铺名称
*/
@ApiModelProperty(value = "店铺名称")
private String shopName;
/**
* 流水类型
*/
@ApiModelProperty(value = "流水类型")

11
cereshop-business/src/main/java/com/shop/cereshop/business/param/after/AfterGetAllParam.java

@ -26,6 +26,17 @@ public class AfterGetAllParam extends PageParam {
private Long shopId;
/**
* 商家id
*/
@ApiModelProperty(value = "商家id")
private Long businessId;
/**
* 平台
*/
@ApiModelProperty(value = "平台")
private String project;
/**
* 搜索类型 1-订单ID 2-买家账户 3-收件人姓名 4-收件人手机号 5-商品ID
*/
@ApiModelProperty(value = "搜索类型 1-订单ID 2-买家账户 3-收件人姓名 4-收件人手机号 5-商品ID")

6
cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/BondParam.java

@ -21,8 +21,8 @@ import java.util.List;
public class BondParam extends PageParam {
/**
* 店铺id
* 商家id
*/
@ApiModelProperty(value = "店铺id")
private Long shopId;
@ApiModelProperty(value = "商家id")
private Long businessId;
}

12
cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/FinanceCountParam.java

@ -17,12 +17,24 @@ import lombok.Data;
public class FinanceCountParam {
/**
* 商家id
*/
@ApiModelProperty(value = "关联商家id")
private Long businessId;
/**
* 店铺id
*/
@ApiModelProperty(value = "关联店铺id")
private Long shopId;
/**
* 平台号
*/
@ApiModelProperty(value = "平台号")
private String project;
/**
* 时间条件 1-日汇总 2-月汇总
*/
@ApiModelProperty(value = "时间条件 1-日汇总 2-月汇总")

11
cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/FinanceDetailParam.java

@ -18,12 +18,23 @@ import lombok.Data;
public class FinanceDetailParam extends PageParam {
/**
* 商家id
*/
@ApiModelProperty(value = "关联商家id")
private Long businessId;
/**
* 店铺id
*/
@ApiModelProperty(value = "关联店铺id")
private Long shopId;
/**
* 平台号
*/
@ApiModelProperty(value = "平台号")
private String project;
/**
* 时间
*/
@ApiModelProperty(value = "时间")

22
cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/FinanceSaveWithdralwalParam.java

@ -19,21 +19,33 @@ import java.math.BigDecimal;
public class FinanceSaveWithdralwalParam {
/**
* 店铺id
* 商家id
*/
@ApiModelProperty(value = "关联店铺id")
private Long shopId;
@ApiModelProperty(value = "关联商家id")
private Long businessId;
// /**
// * 店铺id
// */
// @ApiModelProperty(value = "关联店铺id")
// private Long shopId;
/**
* 平台号
*/
@ApiModelProperty(value = "平台号")
private String project;
/**
* 店铺名称
*/
@ApiModelProperty(value = "店铺名称")
@ApiModelProperty(value = "商家名称")
private String shopName;
/**
* 店铺编码
*/
@ApiModelProperty(value = "店铺编码")
@ApiModelProperty(value = "商家编码")
private String shopCode;
/**

12
cereshop-business/src/main/java/com/shop/cereshop/business/param/finance/FinanceWithdrawalParam.java

@ -20,12 +20,24 @@ import java.util.List;
public class FinanceWithdrawalParam {
/**
* 商家id
*/
@ApiModelProperty(value = "关联商家id")
private Long businessId;
/**
* 店铺id
*/
@ApiModelProperty(value = "关联店铺id")
private Long shopId;
/**
* 平台号
*/
@ApiModelProperty(value = "平台号")
private String project;
/**
* 提现时间数组
*/
@ApiModelProperty(value = "时间")

12
cereshop-business/src/main/java/com/shop/cereshop/business/param/order/OrderGetAllParam.java

@ -33,6 +33,18 @@ public class OrderGetAllParam extends PageParam {
private Long shopId;
/**
* 商家id
*/
@ApiModelProperty(value = "商家id")
private Long businessId;
/**
* 平台
*/
@ApiModelProperty(value = "平台")
private String project;
/**
* 搜索类型 1-订单ID 2-买家账户 3-收件人姓名 4-收件人手机号 5-商品ID
*/
@ApiModelProperty(value = "搜索类型 1-订单ID 2-买家账户 3-收件人姓名 4-收件人手机号 5-商品ID")

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

@ -1,7 +1,6 @@
package com.shop.cereshop.business.pay.xs.service;
import com.shop.cereshop.business.page.shop.Shop;
import com.shop.cereshop.business.pay.PayService;
import com.shop.cereshop.business.pay.xs.domain.XsCallBackRequestVo;
import com.shop.cereshop.commons.exception.CoBusinessException;
@ -32,10 +31,18 @@ public interface XsPayService extends PayService {
/**
* 新生分账用户认证
* @param shopId
* @param businessId
* @param operationType
* @return
* @throws CoBusinessException
*/
String registerByXs(Long shopId, String operationType) throws CoBusinessException;
String registerByXs(Long businessId, String operationType) throws CoBusinessException;
/**
* 提现
* @return
* @throws CoBusinessException
*/
String getMoney(Long businessId, String orderFormid,
String tradeType, BigDecimal money) throws CoBusinessException;
}

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

@ -16,6 +16,7 @@ import com.shop.cereshop.business.pay.xs.domain.XsCallBackRequestVo;
import com.shop.cereshop.business.pay.xs.service.XsPayService;
import com.shop.cereshop.business.pay.xs.utils.CommonUtils;
import com.shop.cereshop.business.service.business.CerePlatformBusinessService;
import com.shop.cereshop.business.service.shop.CerePlatformShopService;
import com.shop.cereshop.commons.config.XspayConfig;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.constant.IntegerEnum;
@ -51,6 +52,7 @@ public class XsPayServiceImpl implements XsPayService {
//支付申请服务代码 serCode
private static final String REGISTER_SHARE_SER_CODE = "101015";
private static final String SHARE_GETMONEY_SER_CODE = "101019";
@Autowired
private CereShopOrderDAO cereShopOrderDAO;
@ -61,6 +63,9 @@ public class XsPayServiceImpl implements XsPayService {
private CerePlatformBusinessService cerePlatformBusinessService;
@Autowired
private CerePlatformShopService cerePlatformShopService;
@Autowired
private CereShopBankDAO cereShopBankDAO;
@Override
@ -189,9 +194,9 @@ public class XsPayServiceImpl implements XsPayService {
* @return
*/
@Override
public String registerByXs(Long shopId, String operationType) throws CoBusinessException {
public String registerByXs(Long businessId, String operationType) throws CoBusinessException {
//构建请求参数
Map<String, Object> contentMap = build15ContentMap(shopId, operationType);
Map<String, Object> contentMap = build15ContentMap(businessId, operationType);
try {
String respMsg = XsPayUtils.requestByXs(REGISTER_SHARE_SER_CODE, contentMap);
if(StrUtil.isNotBlank(respMsg)){
@ -212,6 +217,31 @@ public class XsPayServiceImpl implements XsPayService {
return null;
}
@Override
public String getMoney(Long businessId, String orderFormid,
String tradeType, BigDecimal money) throws CoBusinessException {
//构建请求参数
Map<String, Object> contentMap = build19ContentMap(businessId, orderFormid, tradeType, money);
try {
String respMsg = XsPayUtils.requestByXs(SHARE_GETMONEY_SER_CODE, contentMap);
if(StrUtil.isNotBlank(respMsg)){
//解析响应报文并验签
CommonUtils.verifySignRespMsg(SHARE_GETMONEY_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));
return responeMsg;
}
} catch (CoBusinessException e) {
throw e;
} catch (Exception e) {
e.printStackTrace();
throw new CoBusinessException("10000","提现出错", "");
}
return null;
}
/**
* 构建content请求参数
* @return
@ -260,7 +290,9 @@ public class XsPayServiceImpl implements XsPayService {
log.info("cereOrderProductList:" + new Gson().toJson(cereOrderProductList));
List<Long> shopIdList = orderList.stream().map(CereShopOrder::getShopId).distinct().collect(Collectors.toList());
List<CerePlatformBusiness> cerePlatformBusinessList = cerePlatformBusinessService.getByIdList(shopIdList);
List<CerePlatformShop> cerePlatformShopList = cerePlatformShopService.getByIdList(shopIdList);
List<Long> businessIdList = cerePlatformShopList.stream().map(CerePlatformShop::getBusinessId).distinct().collect(Collectors.toList());
List<CerePlatformBusiness> cerePlatformBusinessList = cerePlatformBusinessService.getByIdList(businessIdList);
Map<String, Object> contentMap = new LinkedHashMap<>();
@ -271,7 +303,7 @@ public class XsPayServiceImpl implements XsPayService {
//oldDealId 对应 101004101005接口响应参数中dealId
// contentMap.put("oldDealId", dealId);
contentMap.put("oldSubOrderId", orderList.get(0).getOrderFormid());
JSONArray jsonArray = build22SubMerchantOrderDetails(orderList, cereOrderProductList, cerePlatformBusinessList);
JSONArray jsonArray = build22SubMerchantOrderDetails(orderList, cereOrderProductList, cerePlatformShopList, cerePlatformBusinessList);
if(jsonArray != null) {
contentMap.put("shareRefundDetail", JSONArray.toJSONString(jsonArray));
}
@ -367,17 +399,17 @@ public class XsPayServiceImpl implements XsPayService {
* @param operationType 0-初始化 1-新增 2-修改
* @return
*/
private Map<String,Object> build15ContentMap(Long shopId, String operationType) throws CoBusinessException {
private Map<String,Object> build15ContentMap(Long businessId, String operationType) throws CoBusinessException {
Map<String, Object> contentMap = new LinkedHashMap<>();
contentMap.put("subUserId", shopId.toString());
contentMap.put("subUserId", businessId.toString());
if(StringUtils.equals("0", operationType)){
contentMap.put("operationType", operationType);
contentMap.put("region", "0");
return contentMap;
}
Business business = cerePlatformBusinessService.getById(shopId);
ShopBankDetail shopBankDetail = cereShopBankDAO.getById(shopId);
Business business = cerePlatformBusinessService.getById(businessId);
ShopBankDetail shopBankDetail = cereShopBankDAO.getByShopId(businessId);
if(shopBankDetail == null){
throw new CoBusinessException("10000","查找不到添加的银行卡信息", "");
}
@ -465,11 +497,40 @@ public class XsPayServiceImpl implements XsPayService {
/**
* 构建content请求参数
* @return
*/
private Map<String,Object> build19ContentMap(Long businessId, String orderFormid,
String tradeType, BigDecimal money) throws CoBusinessException {
Business business = cerePlatformBusinessService.getById(businessId);
ShopBankDetail shopBankDetail = cereShopBankDAO.getByShopId(businessId);
if(shopBankDetail == null){
throw new CoBusinessException("10000","查找不到绑定的银行卡信息", "");
}
Map<String, Object> contentMap = new LinkedHashMap<>();
contentMap.put("merOrderId", orderFormid);
contentMap.put("shareParId", business.getXsPayId());
contentMap.put("bankAcctNo", shopBankDetail.getCardNumber());
contentMap.put("currencyCode", "CNY");
contentMap.put("tradeType", tradeType);
contentMap.put("settleType", "1");
contentMap.put("accPeriodStart", "");
contentMap.put("accPeriodEnd", "");
contentMap.put("settleFliter", money.multiply(BigDecimal.valueOf(100)).intValue());
contentMap.put("auditFlag", "0");
contentMap.put("noticeUrl", XspayConfig.BUSINESS_GETMONEY_NOTICE_URL);
return contentMap;
}
/**
* 构建分账明细
* @return
*/
private static JSONArray build22SubMerchantOrderDetails(List<CereShopOrder> orderList,
List<CereOrderProduct> cereOrderProductList,
List<CerePlatformShop> cerePlatformShopList,
List<CerePlatformBusiness> cerePlatformBusinessList){
if(cereOrderProductList.isEmpty()){
return null;
@ -478,8 +539,11 @@ public class XsPayServiceImpl implements XsPayService {
JSONArray detailArray1 = new JSONArray();
for (CereShopOrder cereShopOrder : orderList) {
CerePlatformShop cerePlatformShop = cerePlatformShopList.stream().filter(item ->
item.getShopId().equals(cereShopOrder.getShopId())).findFirst().orElse(null);
CerePlatformBusiness cerePlatformBusiness = cerePlatformBusinessList.stream().filter(item ->
item.getBusinessId().equals(cereShopOrder.getShopId())).findFirst().orElse(null);
item.getBusinessId().equals(cerePlatformShop.getBusinessId())).findFirst().orElse(null);
List<CereOrderProduct> orderProductList = cereOrderProductList.stream().filter(item -> item.getOrderId().equals(cereShopOrder.getOrderId())).collect(Collectors.toList());
for (CereOrderProduct cereOrderProduct : orderProductList) {
//子订单1 明细1

4
cereshop-business/src/main/java/com/shop/cereshop/business/service/activity/impl/CereActivitySignServiceImpl.java

@ -407,6 +407,7 @@ public class CereActivitySignServiceImpl implements CereActivitySignService {
payLog.setTransactionId(transaction_id);
payLog.setPaymentMode(paymentMode);
payLog.setShopId(cereActivitySign.getShopId());
payLog.setProject("0");
payLog.setState(StringEnum.PAY_LOG_PAY.getCode());
payLog.setTotalFee(cereActivitySign.getBondMoney());
//保证金不收佣金
@ -458,7 +459,7 @@ public class CereActivitySignServiceImpl implements CereActivitySignService {
public BondCount getAllBond(BondParam param) throws CoBusinessException {
BondCount count=new BondCount();
//查询保证金总额
count.setTotal(cereActivitySignDAO.findBondTotal(param.getShopId()));
count.setTotal(cereActivitySignDAO.findBondTotal(param.getBusinessId()));
PageHelper.startPage(param.getPage(),param.getPageSize());
List<ShopBond> list=cereActivitySignDAO.getAllBond(param);
if(!EmptyUtils.isEmpty(list)){
@ -505,6 +506,7 @@ public class CereActivitySignServiceImpl implements CereActivitySignService {
cerePayLog.setRefundFee(payLog.getRefundFee());
cerePayLog.setPaymentMode(IntegerEnum.ORDER_PAY_WX.getCode());
cerePayLog.setShopId(payLog.getShopId());
cerePayLog.setProject(payLog.getProject());
cerePayLog.setState(StringEnum.PAY_LOG_REFUND.getCode());
cerePayLog.setTotalFee(payLog.getTotalFee());
cerePayLog.setPlatformCommission(BigDecimal.valueOf(0));

3
cereshop-business/src/main/java/com/shop/cereshop/business/service/after/impl/CereOrderAfterServiceImpl.java

@ -461,6 +461,7 @@ public class CereOrderAfterServiceImpl implements CereOrderAfterService {
cerePayLog.setRefundFee(cereOrderAfter.getPrice());
cerePayLog.setPaymentMode(paymentMode);
cerePayLog.setShopId(payLog.getShopId());
cerePayLog.setProject(payLog.getProject());
cerePayLog.setState(StringEnum.PAY_LOG_REFUND.getCode());
cerePayLog.setTotalFee(payLog.getTotalFee());
cerePayLog.setPlatformCommission(payLog.getPlatformCommission());
@ -468,7 +469,7 @@ public class CereOrderAfterServiceImpl implements CereOrderAfterService {
cerePayLog.setRemark(payLog.getOrderFormid()+"订单退款"+cereOrderAfter.getPrice()+"元");
cerePayLogService.insert(cerePayLog);
//扣减成长值
ShopOrder shopOrder = cereShopOrderService.getById(payLog.getShopId(), payLog.getOrderId());
ShopOrder shopOrder = cereShopOrderService.getById(payLog.getOrderId());
if (shopOrder != null) {
cereBuyerUserService.updateGrowth(shopOrder.getBuyerUserId(), payLog.getTotalFee().setScale(0, BigDecimal.ROUND_UP).negate().intValue());
}

10
cereshop-business/src/main/java/com/shop/cereshop/business/service/order/CereShopOrderService.java

@ -27,13 +27,13 @@ import java.util.Map;
public interface CereShopOrderService {
Page getAll(OrderGetAllParam param) throws CoBusinessException;
ShopOrder getById(Long shopId, Long orderId) throws CoBusinessException;
ShopOrder getById(Long orderId) throws CoBusinessException;
void updateState(CereShopOrder cereShopOrder) throws CoBusinessException;
FinanceCount getFinanceCount(FinanceCountParam param) throws CoBusinessException;
Bank getBank(Long shopId) throws CoBusinessException;
Bank getBank(Long businessId) throws CoBusinessException;
List<WithdrawalDetail> getWithdrawalDetails(FinanceWithdrawalParam param) throws CoBusinessException;
@ -41,11 +41,11 @@ public interface CereShopOrderService {
void updateBatchStock(List<CereProductSku> skus) throws CoBusinessException;
BigDecimal getWithdrawableStayMoney(Long shopId);
BigDecimal getWithdrawableStayMoney(String project, Long businessId);
BigDecimal getAllWithdrawableMoney(Long shopId);
BigDecimal getAllWithdrawableMoney(String project, Long businessId);
BigDecimal getWithdrawableMoney(Long shopId);
BigDecimal getWithdrawableMoney(String project, Long businessId);
CereShopOrder findById(Long orderId);

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

@ -37,6 +37,7 @@ import com.shop.cereshop.business.service.tool.CereShopDiscountDetailService;
import com.shop.cereshop.business.service.tool.CereShopDiscountService;
import com.shop.cereshop.business.service.tool.CereShopSeckillDetailService;
import com.shop.cereshop.business.service.tool.CereShopSeckillService;
import com.shop.cereshop.business.utils.ContextUtil;
import com.shop.cereshop.business.utils.EncodeUtil;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.constant.IntegerEnum;
@ -153,8 +154,8 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
}
@Override
public ShopOrder getById(Long shopId, Long orderId) throws CoBusinessException {
ShopOrder shopOrder=cereShopOrderDAO.getById(orderId, shopId);
public ShopOrder getById(Long orderId) throws CoBusinessException {
ShopOrder shopOrder=cereShopOrderDAO.getById(orderId);
if(shopOrder!=null){
//根据买家账户查询下单总数
shopOrder.setTotal(cereShopOrderDAO.getOrderTotals(shopOrder.getBuyerUserId()));
@ -187,24 +188,24 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
public FinanceCount getFinanceCount(FinanceCountParam param) throws CoBusinessException {
FinanceCount count=new FinanceCount();
//查询累计营业额
count.setTurnover(cereShopOrderDAO.getTurnover(param.getShopId()));
count.setTurnover(cereShopOrderDAO.getTurnover(param.getProject(), param.getBusinessId(), param.getShopId()));
//查询累计平台分账佣金
count.setPlatformCommission(cereShopOrderDAO.getPlatformCommission(param.getShopId()));
count.setPlatformCommission(cereShopOrderDAO.getPlatformCommission(param.getProject(), param.getBusinessId(), param.getShopId()));
//查询冻结金额
count.setFrozenMoney(cereShopOrderDAO.getFrozenMoney(param.getShopId()));
count.setFrozenMoney(cereShopOrderDAO.getFrozenMoney(param.getProject(), param.getBusinessId(), param.getShopId()));
//查询提现中金额
count.setWithdrawableStayMoney(cereShopOrderDAO.getWithdrawableStayMoney(param.getShopId()));
count.setWithdrawableStayMoney(cereShopOrderDAO.getWithdrawableStayMoney(param.getProject(), param.getBusinessId(), param.getShopId()));
//查询总的可提现金额
BigDecimal withdrawableMoney = cereShopOrderDAO.getAllWithdrawableMoney(param.getShopId());
BigDecimal withdrawableMoney = cereShopOrderDAO.getAllWithdrawableMoney(param.getProject(), param.getBusinessId(), param.getShopId());
//查询已提现的金额
BigDecimal money=cereShopOrderDAO.getWithdrawableMoney(param.getShopId());
BigDecimal money=cereShopOrderDAO.getWithdrawableMoney(param.getProject(), param.getBusinessId(), param.getShopId());
//计算可提现金额=总的提现金额-提现中金额-已提现金额
count.setWithdrawableMoney(withdrawableMoney.subtract(count.getWithdrawableStayMoney()).subtract(money));
if(IntegerEnum.DAY_CONDITION.getCode().equals(param.getCondition())){
//查询指定月份下每天的收入
List<Finance> incomes=cereShopOrderDAO.getFinanceByDay(param.getShopId(),param.getTime(),1);
List<Finance> incomes=cereShopOrderDAO.getFinanceByDay(param.getProject(), param.getBusinessId(),param.getShopId(),param.getTime(),1);
//查询指定月份下每天的支出
List<Finance> expenditures=cereShopOrderDAO.getFinanceByDay(param.getShopId(),param.getTime(),2);
List<Finance> expenditures=cereShopOrderDAO.getFinanceByDay(param.getProject(), param.getBusinessId(), param.getShopId(),param.getTime(),2);
//将支出数据转为map
Map<String, Finance> map = expenditures.stream()
.filter(Objects::nonNull)
@ -220,9 +221,9 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
count.setFinances(incomes);
}else {
//查询指定月份下每月的收入
List<Finance> incomes=cereShopOrderDAO.getFinanceByMonth(param.getShopId(),param.getTime(),1);
List<Finance> incomes=cereShopOrderDAO.getFinanceByMonth(param.getProject(), param.getBusinessId(),param.getShopId(),param.getTime(),1);
//查询指定月份下每月的支出
List<Finance> expenditures=cereShopOrderDAO.getFinanceByMonth(param.getShopId(),param.getTime(),2);
List<Finance> expenditures=cereShopOrderDAO.getFinanceByMonth(param.getProject(), param.getBusinessId(), param.getShopId(),param.getTime(),2);
//将支出数据转为map
Map<String, Finance> map = expenditures.stream()
.filter(Objects::nonNull)
@ -241,7 +242,7 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
}
@Override
public Bank getBank(Long shopId) throws CoBusinessException {
public Bank getBank(Long businessId) throws CoBusinessException {
// //查询提现中金额
// BigDecimal stayMoney = cereShopOrderDAO.getWithdrawableStayMoney(shopId);
// //查询总的可提现金额
@ -253,7 +254,7 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
// if(total.compareTo(BigDecimal.ZERO)!=1){
// throw new CoBusinessException(CoReturnFormat.BALANCE_NOT_ENOUGH);
// }
return cereShopOrderDAO.getBank(shopId);
return cereShopOrderDAO.getBank(businessId);
}
@Override
@ -268,7 +269,6 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
List<FlowingWater> list=cereShopOrderDAO.getDetails(param);
if(!EmptyUtils.isEmpty(list)){
list.forEach(a -> {
a.setShopId(param.getShopId());
//查询流水发生时的冻结金额和可用余额之和
a.setBalance(getBalance(a));
});
@ -284,18 +284,18 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
}
@Override
public BigDecimal getWithdrawableStayMoney(Long shopId) {
return cereShopOrderDAO.getWithdrawableStayMoney(shopId);
public BigDecimal getWithdrawableStayMoney(String project, Long businessId) {
return cereShopOrderDAO.getWithdrawableStayMoney(project, businessId, null);
}
@Override
public BigDecimal getAllWithdrawableMoney(Long shopId) {
return cereShopOrderDAO.getAllWithdrawableMoney(shopId);
public BigDecimal getAllWithdrawableMoney(String project, Long businessId) {
return cereShopOrderDAO.getAllWithdrawableMoney(project, businessId, null);
}
@Override
public BigDecimal getWithdrawableMoney(Long shopId) {
return cereShopOrderDAO.getWithdrawableMoney(shopId);
public BigDecimal getWithdrawableMoney(String project, Long businessId) {
return cereShopOrderDAO.getWithdrawableMoney(project, businessId, null);
}
@Override
@ -463,6 +463,7 @@ public class CereShopOrderServiceImpl implements CereShopOrderService {
payLog.setTransactionId(transaction_id);
payLog.setPaymentMode(order.getPaymentMode());
payLog.setShopId(order.getShopId());
payLog.setProject(order.getProject());
payLog.setState(StringEnum.PAY_LOG_REFUND.getCode());
payLog.setTotalFee(order.getPrice());
payLog.setPlatformCommission(order.getPlatformCommission());

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

@ -21,7 +21,7 @@ public interface CereShopBankService {
void delete(BankDeleteParam param, CerePlatformBusinessUser user) throws CoBusinessException;
ShopBankDetail getById(@Param("shopId") Long shopId) throws CoBusinessException;
ShopBankDetail getByShopId(@Param("shopId") Long shopId) throws CoBusinessException;
CerePlatformShop findByPhone(Long shopId, String phone);
}

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

@ -50,7 +50,7 @@ public class CereShopBankServiceImpl implements CereShopBankService {
cereShopBank.setStatus(0);
cereShopBankDAO.insert(cereShopBank);
String responeMsg = xsPayService.registerByXs(param.getShopId(), "1");
String responeMsg = xsPayService.registerByXs(param.getShopId(), "2");
JSONObject jsonObject = JSONObject.parseObject(responeMsg);
String status = jsonObject.getJSONObject("content").getString("status");
if(StringUtils.equals(status, "1")){
@ -102,8 +102,8 @@ public class CereShopBankServiceImpl implements CereShopBankService {
}
@Override
public ShopBankDetail getById(Long shopId) throws CoBusinessException {
return cereShopBankDAO.getById(shopId);
public ShopBankDetail getByShopId(Long shopId) throws CoBusinessException {
return cereShopBankDAO.getByShopId(shopId);
}
@Override

38
cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopWithdrawalServiceImpl.java

@ -5,17 +5,22 @@
*/
package com.shop.cereshop.business.service.shop.impl;
import com.shop.cereshop.business.dao.business.CerePlatformBusinessDAO;
import com.shop.cereshop.business.dao.shop.CereShopWithdrawalDAO;
import com.shop.cereshop.business.param.finance.FinanceSaveWithdralwalParam;
import com.shop.cereshop.business.pay.xs.service.XsPayService;
import com.shop.cereshop.business.service.log.CerePlatformLogService;
import com.shop.cereshop.business.service.order.CereShopOrderService;
import com.shop.cereshop.business.service.shop.CereShopWithdrawalService;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.constant.IntegerEnum;
import com.shop.cereshop.commons.domain.business.CerePlatformBusiness;
import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser;
import com.shop.cereshop.commons.domain.shop.CereShopBank;
import com.shop.cereshop.commons.domain.shop.CereShopWithdrawal;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.utils.ProjectUtil;
import com.shop.cereshop.commons.utils.StringUtils;
import com.shop.cereshop.commons.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -29,6 +34,9 @@ import java.math.BigDecimal;
public class CereShopWithdrawalServiceImpl implements CereShopWithdrawalService {
@Autowired
private CerePlatformBusinessDAO cerePlatformBusinessDAO;
@Autowired
private CereShopWithdrawalDAO cereShopWithdrawalDAO;
@Autowired
@ -37,36 +45,50 @@ public class CereShopWithdrawalServiceImpl implements CereShopWithdrawalService
@Autowired
private CereShopOrderService cereShopOrderService;
@Autowired
private XsPayService xsPayService;
@Override
@Transactional(isolation= Isolation.DEFAULT,propagation= Propagation.REQUIRED,rollbackFor = {CoBusinessException.class, Exception.class})
public void save(FinanceSaveWithdralwalParam param, CerePlatformBusinessUser user) throws CoBusinessException {
//查询提现中金额
BigDecimal stayMoney = cereShopOrderService.getWithdrawableStayMoney(param.getShopId());
BigDecimal stayMoney = cereShopOrderService.getWithdrawableStayMoney(param.getProject(), param.getBusinessId());
//查询总的可提现金额
BigDecimal withdrawableMoney = cereShopOrderService.getAllWithdrawableMoney(param.getShopId());
BigDecimal withdrawableMoney = cereShopOrderService.getAllWithdrawableMoney(param.getProject(), param.getBusinessId());
//查询已提现的金额
BigDecimal money=cereShopOrderService.getWithdrawableMoney(param.getShopId());
BigDecimal money=cereShopOrderService.getWithdrawableMoney(param.getProject(), param.getBusinessId());
//计算可提现金额=总的提现金额-提现中金额-已提现金额
BigDecimal total = withdrawableMoney.subtract(stayMoney).subtract(money);
if(param.getWithdrawalMoney().compareTo(total)==1){
throw new CoBusinessException(CoReturnFormat.BALANCE_NOT_ENOUGH);
}
String time = TimeUtils.yyMMddHHmmss();
CerePlatformBusiness cerePlatformBusiness = cerePlatformBusinessDAO.selectById(param.getBusinessId());
//查询当前商家绑定账户信息
CereShopBank cereShopBank=cereShopWithdrawalDAO.findBank(param.getShopId());
CereShopBank cereShopBank=cereShopWithdrawalDAO.findBank(param.getBusinessId());
if(cereShopBank!=null){
CereShopWithdrawal withdrawal=new CereShopWithdrawal();
withdrawal.setShopId(param.getShopId());
withdrawal.setShopId(param.getShopId());
withdrawal.setShopCode(param.getShopCode());
withdrawal.setShopName(param.getShopName());
withdrawal.setShopId(param.getBusinessId());
withdrawal.setShopCode(cerePlatformBusiness.getBusinessCode());
withdrawal.setShopName(cerePlatformBusiness.getBusinessName());
withdrawal.setBankCard(param.getBankCard());
withdrawal.setBankName(param.getBankName());
withdrawal.setProject(param.getProject());
withdrawal.setCollectionName(cereShopBank.getCardName());
withdrawal.setWithdrawalMoney(param.getWithdrawalMoney());
withdrawal.setApplyTime(time);
withdrawal.setState(IntegerEnum.WITHDRAWAL_STAY.getCode());
if(!StringUtils.equals(param.getProject(), ProjectUtil.DEFAULT_PROJECT)){
withdrawal.setState(IntegerEnum.WITHDRAWAL_ALREADY.getCode());
withdrawal.setHandleTime(time);
}
cereShopWithdrawalDAO.insert(withdrawal);
if(!StringUtils.equals(param.getProject(), ProjectUtil.DEFAULT_PROJECT)){
//触发新生提现
xsPayService.getMoney(param.getBusinessId(), "business-"+ withdrawal.getWithdrawalId(),
"0004", param.getWithdrawalMoney());
}
//新增日志
cerePlatformLogService.addLog(user,"财务管理","商户端操作","添加提现申请",withdrawal.getWithdrawalId(),time);
}

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

@ -208,6 +208,7 @@ xspay:
business_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/pay/notify
business_return_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/refund/notify
business_register_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/register/notify
business_getmoney_notice_url: http://122.9.152.120/ceres-business-api/extend/xsPay/getmoney/notify
rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANMGXGvYX9yqb5qauZgc2mXk4R+2op9KLhCuqO0mt5aTyAFfGXty2RHAinwQif6AUyfFZK7p0/9xz2yX4VHltA4qFNsgQmi2Qtry8MTbBrPtVgukWdLmcK7NqR9C8reXO7e/Np3SPNLle5MsEkwM25cMK56JEc3WMRe+KIRZ69d1AgMBAAECgYBTSW1suyeKplIKCQs7OBgSozUfGSwyBksMFoNhpihLa+RCdlBOYtO9p+qAcN6l7evkBIpqZqtfZIHjcEZj1m8reIHHBnuv/sKGXWPvMBKqckenwNnqUzlj4X8hvFtkbcqXLGdyYoicW+P5+P8zHmYRom+izd5FO9281zXa4UK6gQJBAOquqD84B1VnNq2xopaaJvxaL4c5IOinkfRWShttANCpt1D0t1cs+7WPq9sdFZ4cyHYomxuC4knqJh1E/WzCVqUCQQDmMZH8+6sgqOrgsECw6w0KdUci/XgzT/DRS/3MFMeRv7ygEtdlyvyxRirEArsjQgDg3IBLo9TxBUdygPhgXnSRAkEAtp95r9By7IOoKhw8cMO+qMuphqnvMP0NeD0Z6CO36ajYTXhRn9YSfiQyUQ1eAC9X05MfuJXucCR0ynwgVd0ZPQJAdYaRdow3TrFvWdAi9zDKs7A05ZRrrib+WJ1nsq5ZRfySnVeBSaNdaFTeuLx8NwAX2rY5emTm7zc2xys5pFoVQQJAUPrxmTbELDTF1by6POX/IT3iSeClzOx+M05Yd4sgXtALPjYt0VMLtnsfmt9qMEjhk0Q95wgdmeHsBHxno5qGfQ==
newpay_public_key: MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDmVh2/xldLXhVU/mNT57m95uw0Hr0Pdl4pUyM2xV509LqLYTbLduCqqnuMTJUq7Irv8SsKfVqB7zKggxFyjmIfeeyTbhMDJkWZ20xRhv+rSw3ZBQD/Hbn+cxhi4FZ3gc+jUSI1pIsPrlvRK7E5DyWLa/RvZYiQfW/XYI4c1Mb29QIDAQAB
default_company_code: 460116287K

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

@ -73,6 +73,7 @@ xspay:
business_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/pay/notify
business_return_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/refund/notify
business_register_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/register/notify
business_getmoney_notice_url: https://wechat.hnthee.com/ceres-business-api/extend/xsPay/getmoney/notify
mer_code: 10000000589
sign_type: 1
rsa_private_key: MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAIsNcvBCDUYCkEyHcuzYyGL9TOHV0kQWcAUJmQqgIIcn7devK2fCSgZs5N42tVm59m07VyUmYXfXrFzx80qwp0Db3bUrqAZqMDB1YnxjiM+Rrrm0pPAPGvGUR4XunPIEbqidezUe1pZCMavejql+TkouXrtHQhZVJJHOQwhTvO03AgMBAAECgYBaFKRZMPEYYaDJcxXoiaeHOUENLE/C/CYlnUofsAxigmN6Tmh4F02NTA4YRqjFL8uMh9y0nGCYGof2zmcmA7rVPSOaQwqwqmc+lHWq/Jy5Z6cAxlod1UeA+BEF9gc/d6YNJx+1UoywMJgr4o/59K9MCZofFLUPGhxoMTQzTB34wQJBAL49KvP5EktoEbloVrqoMNXalgXmGeETrUGkc29uTegT/K/29FllcY5mlSJhnL/uoW8aMuU2V8h7fv7RoJBX/DUCQQC7HqNbl0tmj4ffBUsggoTyuKQby2bNLqPJ6wHcQB5OAZhP2E4q+KC9MpS3eT0ljC27/6T+y4Qvry+THmiU1jk7AkB4bWJWhZKmN6AYvctBaB1aE4CrBUnWqM0h48fLf4lD4/svLWbrfINRQPEhjadb/OUm3u/fF/KkEEGJcAxzs68NAkAIqCo2mpFKdWl7z+rh3if4csJk5swiwf2h4dV8Mxsz0K8TQpabNlV5a1WmB13k1s9m2zTu9MtwyVISJF4CRMbxAkEAi88aKBXP1TO9AFZwyNE2Z9dVcSk2xruj9yLgfKvpcZF5eGm3/S9wGz9k+753rxe/KMkWfWd0eIK3VK0iYJ9K+Q==

18
cereshop-business/src/main/resources/mybatis/mapper/activity/CereActivitySignDAO.xml

@ -333,11 +333,16 @@
</select>
<select id="getAllBond" parameterType="com.shop.cereshop.business.param.finance.BondParam" resultType="com.shop.cereshop.business.page.finance.ShopBond">
SELECT c.activity_name,a.sign_id,a.bond_money,a.bond_state,
a.payment_time,a.return_time FROM cere_activity_sign a
LEFT JOIN cere_platform_shop b ON a.shop_id=b.shop_id
SELECT
c.activity_name,
a.sign_id,
a.bond_money,
a.bond_state,
a.payment_time,
a.return_time
FROM cere_activity_sign a
LEFT JOIN cere_platform_activity c ON a.activity_id=c.activity_id
where a.shop_id=#{shopId} and a.state in (0,1) and c.if_bond=1
where a.shop_id=#{businessId} and a.state in (0,1) and c.if_bond=1
ORDER BY a.update_time DESC,a.create_time DESC
</select>
@ -346,8 +351,9 @@
</select>
<select id="findBondTotal" resultType="java.math.BigDecimal">
SELECT IF(SUM(bond_money) IS NULL,0,SUM(bond_money)) from cere_activity_sign where state in (0,1)
and shop_id=#{shopId} and bond_state=1
SELECT
IF(SUM(bond_money) IS NULL,0,SUM(bond_money)) from cere_activity_sign where state in (0,1)
and shop_id=#{businessId} and bond_state=1
</select>
<select id="findShopUserId" parameterType="java.lang.Long" resultType="java.lang.Long">

42
cereshop-business/src/main/resources/mybatis/mapper/after/CereOrderAfterDAO.xml

@ -3,6 +3,7 @@
<mapper namespace="com.shop.cereshop.business.dao.after.CereOrderAfterDAO">
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.after.CereOrderAfter">
<id column="after_id" jdbcType="BIGINT" property="afterId" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="order_id" jdbcType="BIGINT" property="orderId" />
<result column="after_formid" jdbcType="VARCHAR" property="afterFormid" />
<result column="after_state" jdbcType="BIT" property="afterState" />
@ -16,7 +17,7 @@
<result column="update_time" jdbcType="VARCHAR" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
after_id, order_id, after_formid, after_state, after_type, price,`explain`, remark, reason,
after_id, order_id, project, after_formid, after_state, after_type, price,`explain`, remark, reason,
image, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
@ -35,6 +36,9 @@
<if test="orderId != null">
order_id,
</if>
<if test="project != null and project!=''">
project,
</if>
<if test="afterFormid != null and afterFormid!=''">
after_formid,
</if>
@ -70,6 +74,9 @@
<if test="orderId != null">
#{orderId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
#{project,jdbcType=VARCHAR},
</if>
<if test="afterFormid != null and afterFormid!=''">
#{afterFormid,jdbcType=VARCHAR},
</if>
@ -108,6 +115,9 @@
<if test="orderId != null">
order_id = #{orderId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="afterFormid != null and afterFormid!=''">
after_formid = #{afterFormid,jdbcType=VARCHAR},
</if>
@ -141,21 +151,6 @@
</set>
where after_id = #{afterId,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.shop.cereshop.commons.domain.after.CereOrderAfter">
update cere_order_after
set order_id = #{orderId,jdbcType=BIGINT},
after_formid = #{afterFormid,jdbcType=VARCHAR},
after_state = #{afterState,jdbcType=BIT},
after_type = #{afterType,jdbcType=BIT},
price = #{price,jdbcType=DECIMAL},
`explain` = #{explain,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR},
reason = #{reason,jdbcType=VARCHAR},
image = #{image,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=VARCHAR},
update_time = #{updateTime,jdbcType=VARCHAR}
where after_id = #{afterId,jdbcType=BIGINT}
</update>
<select id="getAll" parameterType="com.shop.cereshop.business.param.after.AfterGetAllParam" resultType="com.shop.cereshop.business.page.after.After">
SELECT a.after_id,a.after_formid,c.order_formid,a.price,a.after_state,a.order_id,
@ -170,11 +165,22 @@
IF(a.after_state=2,'退款中',IF(a.after_state=3,'退货中',IF(a.after_state=4,'退款成功',
IF(a.after_state=5,'退款失败',IF(a.after_state=6,'审核不通过',IF(
a.after_state=7,'评审中',IF(a.after_state=8,'退货完成,拒绝退款',
IF(a.after_state=9,'已关闭','审核通过'))))))))) after_state_name FROM cere_order_after a
IF(a.after_state=9,'已关闭','审核通过'))))))))) after_state_name
FROM cere_order_after a
LEFT JOIN cere_after_product b ON a.after_id=b.after_id
LEFT JOIN cere_shop_order c ON a.order_id=c.order_id
LEFT JOIN cere_platform_shop d ON c.shop_id=d.shop_id
where c.shop_id=#{shopId} and a.after_state<![CDATA[!= ]]>7
where
a.after_state<![CDATA[!= ]]>7
<if test="shopId!=null">
and a.shop_id=#{shopId}
</if>
<if test="businessId!=null">
and d.business_id=#{businessId}
</if>
<if test="project!=null and project!=''">
and a.project=#{project}
</if>
<if test='searchType=="1" and search!=null and search!=""'>
and a.after_id like concat('%',#{search},'%')
</if>

281
cereshop-business/src/main/resources/mybatis/mapper/order/CereShopOrderDAO.xml

@ -5,6 +5,7 @@
<id column="order_id" jdbcType="BIGINT" property="orderId"/>
<result column="parent_id" jdbcType="BIGINT" property="parentId"/>
<result column="shop_id" jdbcType="BIGINT" property="shopId"/>
<result column="project" jdbcType="VARCHAR" property="project"/>
<result column="order_formid" jdbcType="VARCHAR" property="orderFormid"/>
<result column="buyer_user_id" jdbcType="BIGINT" property="buyerUserId"/>
<result column="coupon_id" jdbcType="BIGINT" property="couponId"/>
@ -45,7 +46,7 @@
<result column="platform_commission" jdbcType="DECIMAL" property="platformCommission" />
</resultMap>
<sql id="Base_Column_List">
order_id, parent_id,shop_id, order_formid, buyer_user_id, coupon_id,id, shop_seckill_id, shop_group_work_id,
order_id, parent_id,shop_id, project, order_formid, buyer_user_id, coupon_id,id, shop_seckill_id, shop_group_work_id,
shop_discount_id, shop_operate_id, order_price, logistics_price,discount_price, price, old_price,
`state`, payment_state, payment_mode, payment_time, customer_name, customer_phone,
receive_name, receive_phone, receive_adress,address,receive_time, postal_code, remark, after_state, logistics_id,
@ -72,6 +73,9 @@
<if test="shopId != null">
shop_id = #{shopId,jdbcType=BIGINT},
</if>
<if test="project != null and project!=''">
project = #{project,jdbcType=VARCHAR},
</if>
<if test="orderFormid != null and orderFormid!=''">
order_formid = #{orderFormid,jdbcType=VARCHAR},
</if>
@ -192,12 +196,40 @@
<select id="getAll" parameterType="com.shop.cereshop.business.param.order.OrderGetAllParam"
resultType="com.shop.cereshop.business.page.order.ShopOrder">
SELECT a.order_id,a.order_formid,a.buyer_user_id,a.price,IF(a.order_id IS NOT NULL,sum(b.number),NULL) number,a.state,a.remark,d.transaction_id,
a.customer_name,a.payment_mode,a.payment_state,a.payment_time,a.create_time,a.receive_name,a.receive_phone,a.address,a.receive_adress,c.shop_name FROM cere_shop_order a
SELECT
a.order_id,
a.order_formid,
a.buyer_user_id,
a.price,
IF(a.order_id IS NOT NULL,sum(b.number),NULL) number,
a.state,
a.remark,
d.transaction_id,
a.customer_name,
a.payment_mode,
a.payment_state,
a.payment_time,
a.create_time,
a.receive_name,
a.receive_phone,
a.address,
a.receive_adress,
c.shop_name
FROM cere_shop_order a
LEFT JOIN cere_order_product b ON a.order_id=b.order_id
LEFT JOIN cere_platform_shop c ON a.shop_id=c.shop_id
LEFT JOIN cere_pay_log d ON a.order_formid=d.order_formid
where a.shop_id=#{shopId}
where
1=1
<if test="shopId!=null">
and a.shop_id=#{shopId}
</if>
<if test="businessId!=null">
and c.business_id=#{businessId}
</if>
<if test="project!=null and project!=''">
and a.project=#{project}
</if>
<if test='searchType=="1" and search!=null and search!=""'>
and a.order_id like concat('%',#{search},'%')
</if>
@ -258,23 +290,21 @@
a.buyer_user_id,
e.deliver_formid,f.dict_name express,
IF(c.after_state = 1, '审核中',
IF(c.after_state = 2, '退款中', IF(c.after_state = 3, '退货中', IF(c.after_state = 4, '退款成功',
IF(c.after_state = 5, '退款失败',
IF(c.after_state = 6, '审核不通过', IF(
c.after_state = 7, '评审中',
IF(c.after_state = 8,
'退货完成,拒绝退款',
IF(c.after_state = 9, '已关闭', '审核通过'))))))))) after_state_name
IF(c.after_state = 2, '退款中',
IF(c.after_state = 3, '退货中',
IF(c.after_state = 4, '退款成功',
IF(c.after_state = 5, '退款失败',
IF(c.after_state = 6, '审核不通过',
IF(c.after_state = 7, '评审中',
IF(c.after_state = 8, '退货完成,拒绝退款',
IF(c.after_state = 9, '已关闭', '审核通过'))))))))) after_state_name
from cere_shop_order a
LEFT JOIN cere_pay_log b ON a.order_formid = b.order_formid and b.state = '支付'
LEFT JOIN cere_order_after c ON a.order_id = c.order_id
LEFT JOIN cere_order_logistics d ON a.logistics_id = d.logistics_id
LEFT JOIN cere_order_dilever e ON a.order_id=e.order_id
LEFT JOIN cere_platform_dict f ON e.express=f.dict_id
LEFT JOIN cere_pay_log b ON a.order_formid = b.order_formid and b.state = '支付'
LEFT JOIN cere_order_after c ON a.order_id = c.order_id
LEFT JOIN cere_order_logistics d ON a.logistics_id = d.logistics_id
LEFT JOIN cere_order_dilever e ON a.order_id=e.order_id
LEFT JOIN cere_platform_dict f ON e.express=f.dict_id
where a.order_id = #{orderId}
<if test="shopId != null and shopId != 0">
and a.shop_id = #{shopId}
</if>
</select>
<select id="getOrderTotals" parameterType="java.lang.Object" resultType="java.lang.Integer">
@ -324,115 +354,228 @@
where order_id = #{orderId,jdbcType=BIGINT}
</update>
<select id="getTurnover" parameterType="java.lang.Object" resultType="java.math.BigDecimal">
SELECT IFNULL(SUM(IFNULL(price, 0)), 0)
FROM cere_shop_order
where shop_id = #{shopId}
and state in (2, 3, 4)
<select id="getTurnover" resultType="java.math.BigDecimal">
SELECT IFNULL(SUM(IFNULL(cso.price, 0)), 0)
FROM cere_shop_order cso
INNER JOIN cere_platform_shop cps ON cso.shop_id=cps.shop_id
where
cso.state in (2, 3, 4)
<if test="project != null and project != ''">
AND cso.project = #{project}
</if>
<if test="businessId != null">
AND cps.business_id = #{businessId}
</if>
<if test="shopId != null">
AND cso.shop_id = #{shopId}
</if>
</select>
<select id="getPlatformCommission" parameterType="java.lang.Object" resultType="java.math.BigDecimal">
SELECT IFNULL(SUM(IFNULL(platform_commission, 0)), 0)
FROM cere_shop_order
where shop_id = #{shopId}
and state in (2, 3, 4)
<select id="getPlatformCommission" resultType="java.math.BigDecimal">
SELECT IFNULL(SUM(IFNULL(cso.platform_commission, 0)), 0)
FROM cere_shop_order cso
INNER JOIN cere_platform_shop cps ON cso.shop_id=cps.shop_id
where
cso.state in (2, 3, 4)
<if test="project != null and project != ''">
AND cso.project = #{project}
</if>
<if test="businessId != null">
AND cps.business_id = #{businessId}
</if>
<if test="shopId != null">
AND cso.shop_id = #{shopId}
</if>
</select>
<select id="getFrozenMoney" parameterType="java.lang.Object" resultType="java.math.BigDecimal">
<select id="getFrozenMoney" resultType="java.math.BigDecimal">
SELECT IFNULL(SUM(IFNULL(cso.price, 0)),0)
FROM cere_shop_order cso
inner join cere_platform_shop cps on cps.shop_id = cso.shop_id
where cso.shop_id = #{shopId}
WHERE 1=1
<if test="project != null and project != ''">
AND cso.project = #{project}
</if>
<if test="businessId != null">
AND cps.business_id = #{businessId}
</if>
<if test="shopId != null">
AND cso.shop_id = #{shopId}
</if>
and (cso.state in (2, 3) or (cso.state = 4 AND DATEDIFF(cso.receive_time, sysdate()) <![CDATA[<=]]> IFNULL(cps.share_days, 0)))
</select>
<select id="getWithdrawableMoney" parameterType="java.lang.Object" resultType="java.math.BigDecimal">
SELECT IF(SUM(withdrawal_money) IS NULL, 0, SUM(withdrawal_money))
FROM cere_shop_withdrawal
where shop_id = #{shopId}
and state = 1
SELECT IF(SUM(csw.withdrawal_money) IS NULL, 0, SUM(csw.withdrawal_money))
FROM cere_shop_withdrawal csw
where csw.state = 1
<if test="project != null and project != ''">
AND csw.project = #{project}
</if>
<if test="businessId != null">
AND csw.shop_id = #{businessId}
</if>
</select>
<select id="getAllWithdrawableMoney" parameterType="java.lang.Object" resultType="java.math.BigDecimal">
<select id="getAllWithdrawableMoney" resultType="java.math.BigDecimal">
SELECT IFNULL(SUM(IFNULL(cso.price, 0)),0)
FROM cere_shop_order cso
inner join cere_platform_shop cps on cps.shop_id = cso.shop_id
where cso.shop_id = #{shopId}
where
1=1
<if test="project != null and project != ''">
AND cso.project = #{project}
</if>
<if test="businessId != null">
AND cps.business_id = #{businessId}
</if>
<if test="shopId != null">
AND cso.shop_id = #{shopId},
</if>
and (cso.state = 4 AND DATEDIFF(cso.receive_time, sysdate()) <![CDATA[>]]> IFNULL(cps.share_days, 0))
</select>
<select id="getWithdrawableStayMoney" parameterType="java.lang.Object" resultType="java.math.BigDecimal">
SELECT IFNULL(SUM(IFNULL(withdrawal_money, 0)),0)
FROM cere_shop_withdrawal
where shop_id = #{shopId}
and state = 0
<select id="getWithdrawableStayMoney" resultType="java.math.BigDecimal">
SELECT IFNULL(SUM(IFNULL(csw.withdrawal_money, 0)),0)
FROM cere_shop_withdrawal csw
where csw.state = 0
<if test="project != null and project != ''">
AND csw.project = #{project}
</if>
<if test="businessId != null">
AND csw.shop_id = #{businessId}
</if>
</select>
<select id="getFinanceByDay" parameterType="java.lang.Object"
resultType="com.shop.cereshop.business.page.finance.Finance">
SELECT IFNULL(SUM(IFNULL(total_fee, 0)),0) income,IFNULL(SUM(IFNULL(platform_commission, 0)),0) commission,LEFT(create_time,10) time from cere_pay_log
where shop_id=#{shopId} and create_time like concat('%',#{time},'%')
SELECT
IFNULL(SUM(IFNULL(cpl.total_fee, 0)),0) income,
IFNULL(SUM(IFNULL(cpl.platform_commission, 0)),0) commission,
LEFT(cpl.create_time,10) time
from cere_pay_log cpl
INNER JOIN cere_platform_shop cps ON cpl.shop_id=cps.shop_id
where
1=1
<if test="project != null and project != ''">
AND cpl.project = #{project}
</if>
<if test="businessId != null">
AND cps.business_id = #{businessId}
</if>
<if test="shopId != null">
AND cpl.shop_id = #{shopId}
</if>
and cpl.create_time like concat('%',#{time},'%')
<if test='type=="1"'>
and state='支付'
and cpl.state='支付'
</if>
<if test='type=="2"'>
and (state='退款' OR state='提现')
and (cpl.state='退款' OR cpl.state='提现')
</if>
GROUP BY LEFT(create_time,10)
ORDER BY create_time DESC
GROUP BY LEFT(cpl.create_time,10)
ORDER BY cpl.create_time DESC
</select>
<select id="getFinanceByMonth" parameterType="java.lang.Object"
resultType="com.shop.cereshop.business.page.finance.Finance">
SELECT IFNULL(SUM(IFNULL(total_fee, 0)),0) income,IFNULL(SUM(IFNULL(platform_commission, 0)),0) commission,LEFT(create_time,7) time from cere_pay_log
where shop_id=#{shopId} and create_time like concat('%',#{time},'%')
SELECT
IFNULL(SUM(IFNULL(cpl.total_fee, 0)),0) income,
IFNULL(SUM(IFNULL(cpl.platform_commission, 0)),0) commission,
LEFT(cpl.create_time,7) time
from cere_pay_log cpl
INNER JOIN cere_platform_shop cps ON cpl.shop_id=cps.shop_id
where
1=1
<if test="project != null and project != ''">
AND cpl.project = #{project}
</if>
<if test="businessId != null">
AND cps.business_id = #{businessId}
</if>
<if test="shopId != null">
AND cpl.shop_id = #{shopId}
</if>
and cpl.create_time like concat('%',#{time},'%')
<if test='type=="1"'>
and state='支付'
and cpl.state='支付'
</if>
<if test='type=="2"'>
and (state='退款' OR state='提现')
and (cpl.state='退款' OR cpl.state='提现')
</if>
GROUP BY LEFT(create_time,7)
ORDER BY create_time DESC
GROUP BY LEFT(cpl.create_time,7)
ORDER BY cpl.create_time DESC
</select>
<select id="getWithdrawalDetails" parameterType="com.shop.cereshop.business.param.finance.FinanceWithdrawalParam"
resultType="com.shop.cereshop.business.page.finance.WithdrawalDetail">
SELECT withdrawal_money,state,bank_card,bank_name,apply_time from cere_shop_withdrawal
where shop_id=#{shopId}
SELECT
csw.withdrawal_money,
csw.state,
csw.bank_card,
csw.bank_name,
csw.apply_time
from cere_shop_withdrawal csw
where 1=1
<if test="project != null and project != ''">
AND csw.project = #{project}
</if>
<if test="businessId != null">
AND csw.shop_id = #{businessId}
</if>
<if test="startTime!=null and startTime!=''">
and apply_time&gt;=#{startTime} and apply_time&lt;=#{endTime}
</if>
</select>
<select id="getBank" parameterType="java.lang.Object" resultType="com.shop.cereshop.business.page.finance.Bank">
<select id="getBank" resultType="com.shop.cereshop.business.page.finance.Bank">
SELECT a.shop_id,
b.shop_name,
b.shop_code,
b.business_name shopName,
b.business_code shopCode,
c.dict_name bankName,
a.card_number bankCard,
a.card_name collectionNme
from cere_shop_bank a
LEFT JOIN cere_platform_shop b ON a.shop_id = b.shop_id
LEFT JOIN cere_platform_dict c ON a.bank = c.dict_id
where a.shop_id = #{shopId}
INNER JOIN cere_platform_business b ON a.shop_id = b.business_id
INNER JOIN cere_platform_dict c ON a.bank = c.dict_id
where a.shop_id = #{businessId}
</select>
<select id="getDetails" parameterType="com.shop.cereshop.business.param.finance.FinanceDetailParam"
resultType="com.shop.cereshop.business.page.finance.FlowingWater">
SELECT IF(state='支付','订单入账',IF(state='退款','买家退款','提现')) waterType,
order_formid,IF(state='支付','收入','支出') incomeType,total_fee money,platform_commission commission,create_time time from cere_pay_log
where shop_id=#{shopId} and create_time like concat('%',#{time},'%')
SELECT
cpl.shop_id,
cps.shop_name,
IF(cpl.state='支付','订单入账',IF(cpl.state='退款','买家退款','提现')) waterType,
cpl.order_formid,
IF(cpl.state='支付','收入','支出') incomeType,
cpl.total_fee money,
cpl.platform_commission commission,
cpl.create_time time
from cere_pay_log cpl
INNER JOIN cere_platform_shop cps ON cpl.shop_id=cps.shop_id
where
1=1
<if test="project != null and project != ''">
AND cpl.project = #{project}
</if>
<if test="businessId != null">
AND cps.business_id = #{businessId}
</if>
<if test="shopId != null">
AND cpl.shop_id = #{shopId}
</if>
and cpl.create_time like concat('%',#{time},'%')
<if test='income=="1"'>
and state='支付'
and cpl.state='支付'
</if>
<if test='income=="2"'>
and (state='退款' OR state='提现')
and (cpl.state='退款' OR cpl.state='提现')
</if>
<if test="state!=null and state!=''">
and state=#{state}
and cpl.state=#{state}
</if>
ORDER BY create_time DESC
ORDER BY cpl.create_time DESC
</select>
<select id="getTurnoverByTime" parameterType="com.shop.cereshop.business.page.finance.FlowingWater"

29
cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopBankDAO.xml

@ -55,23 +55,34 @@
DELETE FROM cere_shop_bank where shop_id=#{shopId}
</delete>
<select id="getById" parameterType="java.lang.Object" resultType="com.shop.cereshop.business.page.shop.ShopBankDetail">
SELECT a.shop_id, a.card_name, a.card_number,a.bank,a.status,b.shop_phone phone,c.dict_name bankName
<select id="getByShopId" parameterType="java.lang.Object" resultType="com.shop.cereshop.business.page.shop.ShopBankDetail">
SELECT a.shop_id, a.card_name, a.card_number,a.bank,a.status,b.business_phone phone,c.dict_name bankName
FROM cere_shop_bank a
LEFT JOIN cere_platform_shop b ON a.shop_id=b.shop_id
LEFT JOIN cere_platform_business b ON a.shop_id=b.business_id
LEFT JOIN cere_platform_dict c ON a.bank=c.dict_id
where a.shop_id=#{shopId}
</select>
<select id="getBank" parameterType="java.lang.Object" resultType="com.shop.cereshop.business.page.finance.Bank">
SELECT a.shop_id,b.shop_name,b.shop_code,c.dict_name bankName,
a.card_number bankCard,a.card_name collectionNme,a.status from cere_shop_bank a
LEFT JOIN cere_platform_shop b ON a.shop_id=b.shop_id
<select id="getBank"
parameterType="java.lang.Object"
resultType="com.shop.cereshop.business.page.finance.Bank">
SELECT
a.shop_id,
b.business_name shop_name,
b.business_code shop_code,
c.dict_name bankName,
a.card_number bankCard,
a.card_name collectionNme,
a.status
from cere_shop_bank a
LEFT JOIN cere_platform_business b ON a.shop_id=b.business_id
LEFT JOIN cere_platform_dict c ON a.bank=c.dict_id
where a.shop_id=#{shopId}
</select>
<select id="findByPhone" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.shop.CerePlatformShop">
SELECT shop_id FROM cere_platform_shop where shop_id=#{shopId} and shop_phone=#{phone}
<select id="findByPhone"
parameterType="java.lang.Object"
resultType="com.shop.cereshop.commons.domain.shop.CerePlatformShop">
SELECT shop_id FROM cere_platform_business where business_id=#{shopId} and business_phone=#{phone}
</select>
</mapper>

11
cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopWithdrawalDAO.xml

@ -3,6 +3,7 @@
<mapper namespace="com.shop.cereshop.business.dao.shop.CereShopWithdrawalDAO">
<resultMap id="BaseResultMap" type="com.shop.cereshop.commons.domain.shop.CereShopWithdrawal">
<id column="withdrawal_id" jdbcType="BIGINT" property="withdrawalId" />
<result column="project" jdbcType="VARCHAR" property="project" />
<result column="shop_id" jdbcType="BIGINT" property="shopId" />
<result column="shop_name" jdbcType="VARCHAR" property="shopName" />
<result column="shop_code" jdbcType="VARCHAR" property="shopCode" />
@ -17,6 +18,9 @@
<insert id="insertSelective" keyColumn="withdrawal_id" keyProperty="withdrawalId" parameterType="com.shop.cereshop.commons.domain.shop.CereShopWithdrawal" useGeneratedKeys="true">
insert into cere_shop_withdrawal
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="project != null and project!=''">
project,
</if>
<if test="shopId != null">
shop_id,
</if>
@ -49,6 +53,9 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="project != null and project!=''">
#{project,jdbcType=VARCHAR},
</if>
<if test="shopId != null">
#{shopId,jdbcType=BIGINT},
</if>
@ -82,7 +89,7 @@
</trim>
</insert>
<select id="findBank" parameterType="java.lang.Object" resultType="com.shop.cereshop.commons.domain.shop.CereShopBank">
SELECT * FROM cere_shop_bank where shop_id=#{shopId}
<select id="findBank" resultType="com.shop.cereshop.commons.domain.shop.CereShopBank">
SELECT * FROM cere_shop_bank where shop_id=#{businessId}
</select>
</mapper>

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

@ -38,6 +38,10 @@ public class XspayConfig {
// 分账方录入结果通知地址
public static String BUSINESS_REGISTER_NOTICE_URL = "http://122.9.152.120/ceres-business-api/extend/xsPay/register/notify";
// 提现结果通知地址
public static String BUSINESS_GETMONEY_NOTICE_URL = "http://122.9.152.120/ceres-business-api/extend/xsPay/getmoney/notify";
/**
* 商户会员号 merCode
*/
@ -121,6 +125,10 @@ public class XspayConfig {
this.BUSINESS_REGISTER_NOTICE_URL = url;
}
@Value("${xspay.business_getmoney_notice_url:}")
public void setBusinessGetMoneyNoticeUrl(String url) {
this.BUSINESS_GETMONEY_NOTICE_URL = url;
}
@Value("${xspay.mer_code:}")
public void setMerCode(String merCode) {

7
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/after/CereOrderAfter.java

@ -30,6 +30,13 @@ public class CereOrderAfter implements Serializable {
*/
private Long orderId;
/**
* 所属终端
*/
private String project;
/**
* 售后单号
*/

5
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/pay/CerePayLog.java

@ -28,6 +28,11 @@ public class CerePayLog implements Serializable {
private Long shopId;
/**
* 平台号
*/
private String project;
/**
* 关联订单编号
*/
private String orderFormid;

6
cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopWithdrawal.java

@ -29,6 +29,12 @@ public class CereShopWithdrawal implements Serializable {
@TableId(type = IdType.AUTO)
private Long withdrawalId;
/**
* 平台号
*/
@ApiModelProperty(value = "平台号")
private String project;
/**
* 关联店铺id
*/

Loading…
Cancel
Save