|
@@ -19,7 +19,6 @@ import com.fs.api.param.OrderListParam;
|
|
|
import com.fs.api.vo.OrderListVO;
|
|
import com.fs.api.vo.OrderListVO;
|
|
|
import com.fs.api.vo.ProductListVO;
|
|
import com.fs.api.vo.ProductListVO;
|
|
|
import com.fs.common.config.FSSysConfig;
|
|
import com.fs.common.config.FSSysConfig;
|
|
|
-import com.fs.common.core.domain.AjaxResult;
|
|
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.domain.entity.SysDictData;
|
|
import com.fs.common.core.domain.entity.SysDictData;
|
|
|
import com.fs.common.core.redis.RedisCache;
|
|
import com.fs.common.core.redis.RedisCache;
|
|
@@ -33,7 +32,6 @@ import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.IpUtil;
|
|
import com.fs.common.utils.IpUtil;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
import com.fs.common.utils.StringUtils;
|
|
|
-import com.fs.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.fs.common.utils.ip.IpUtils;
|
|
import com.fs.common.utils.ip.IpUtils;
|
|
|
import com.fs.common.utils.spring.SpringUtils;
|
|
import com.fs.common.utils.spring.SpringUtils;
|
|
|
import com.fs.company.domain.*;
|
|
import com.fs.company.domain.*;
|
|
@@ -48,8 +46,10 @@ import com.fs.config.cloud.CloudHostProper;
|
|
|
import com.fs.core.config.WxMaConfiguration;
|
|
import com.fs.core.config.WxMaConfiguration;
|
|
|
import com.fs.core.config.WxPayProperties;
|
|
import com.fs.core.config.WxPayProperties;
|
|
|
import com.fs.core.utils.OrderCodeUtils;
|
|
import com.fs.core.utils.OrderCodeUtils;
|
|
|
|
|
+import com.fs.course.domain.FsCoursePlaySourceConfig;
|
|
|
import com.fs.course.dto.FsOrderDeliveryNoteDTO;
|
|
import com.fs.course.dto.FsOrderDeliveryNoteDTO;
|
|
|
import com.fs.course.dto.OrderOpenIdTransDTO;
|
|
import com.fs.course.dto.OrderOpenIdTransDTO;
|
|
|
|
|
+import com.fs.course.mapper.FsCoursePlaySourceConfigMapper;
|
|
|
import com.fs.erp.domain.*;
|
|
import com.fs.erp.domain.*;
|
|
|
import com.fs.erp.dto.*;
|
|
import com.fs.erp.dto.*;
|
|
|
import com.fs.erp.dto.df.*;
|
|
import com.fs.erp.dto.df.*;
|
|
@@ -74,7 +74,6 @@ import com.fs.his.utils.ConfigUtil;
|
|
|
import com.fs.his.vo.FsInquiryOrderVO;
|
|
import com.fs.his.vo.FsInquiryOrderVO;
|
|
|
import com.fs.his.vo.FsStoreOrderAmountScrmStatsVo;
|
|
import com.fs.his.vo.FsStoreOrderAmountScrmStatsVo;
|
|
|
import com.fs.his.vo.FsStoreOrderExcelVO;
|
|
import com.fs.his.vo.FsStoreOrderExcelVO;
|
|
|
-import com.fs.his.vo.*;
|
|
|
|
|
import com.fs.his.vo.FsPrescribeVO;
|
|
import com.fs.his.vo.FsPrescribeVO;
|
|
|
import com.fs.hisStore.config.FsErpConfig;
|
|
import com.fs.hisStore.config.FsErpConfig;
|
|
|
import com.fs.hisStore.constants.ErpTypeEnum;
|
|
import com.fs.hisStore.constants.ErpTypeEnum;
|
|
@@ -83,7 +82,6 @@ import com.fs.hisStore.mapper.*;
|
|
|
import com.fs.hisStore.param.*;
|
|
import com.fs.hisStore.param.*;
|
|
|
import com.fs.hisStore.vo.*;
|
|
import com.fs.hisStore.vo.*;
|
|
|
import com.fs.hisStore.vo.FsStoreOrderErpExportVO;
|
|
import com.fs.hisStore.vo.FsStoreOrderErpExportVO;
|
|
|
-import com.fs.hisStore.vo.FsStoreOrderExportVO;
|
|
|
|
|
import com.fs.hisStore.vo.FsStoreOrderItemVO;
|
|
import com.fs.hisStore.vo.FsStoreOrderItemVO;
|
|
|
import com.fs.hisStore.vo.FsStoreOrderVO;
|
|
import com.fs.hisStore.vo.FsStoreOrderVO;
|
|
|
import com.fs.hisStore.vo.FsStoreProductAttrValueVO;
|
|
import com.fs.hisStore.vo.FsStoreProductAttrValueVO;
|
|
@@ -151,7 +149,6 @@ import javax.annotation.PostConstruct;
|
|
|
import java.lang.reflect.Field;
|
|
import java.lang.reflect.Field;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.nio.charset.Charset;
|
|
import java.nio.charset.Charset;
|
|
|
-import java.sql.SQLException;
|
|
|
|
|
import java.sql.Timestamp;
|
|
import java.sql.Timestamp;
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
@@ -166,7 +163,6 @@ import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import static com.fs.his.utils.PhoneUtil.decryptPhone;
|
|
import static com.fs.his.utils.PhoneUtil.decryptPhone;
|
|
|
-import static com.fs.his.utils.PhoneUtil.encryptPhone;
|
|
|
|
|
import static com.fs.hisStore.constants.StoreConstants.DELIVERY;
|
|
import static com.fs.hisStore.constants.StoreConstants.DELIVERY;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -179,7 +175,6 @@ import static com.fs.hisStore.constants.StoreConstants.DELIVERY;
|
|
|
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
|
|
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
- private static final String STORE_PAY_CONF = "his.pay";
|
|
|
|
|
|
|
|
|
|
Logger logger = LoggerFactory.getLogger(getClass());
|
|
Logger logger = LoggerFactory.getLogger(getClass());
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -188,6 +183,10 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private CompanyUserUserMapper companyUserUserMapper;
|
|
private CompanyUserUserMapper companyUserUserMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
|
|
+ private FsCoursePlaySourceConfigMapper fsCoursePlaySourceConfigMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private MerchantAppConfigMapper merchantAppConfigMapper;
|
|
|
|
|
+ @Autowired
|
|
|
private IFsStoreOrderStatusScrmService orderStatusService;
|
|
private IFsStoreOrderStatusScrmService orderStatusService;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private FsStoreCartScrmMapper cartMapper;
|
|
private FsStoreCartScrmMapper cartMapper;
|
|
@@ -1401,7 +1400,6 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
order.setStatus(OrderInfoEnum.STATUS_2.getValue());
|
|
order.setStatus(OrderInfoEnum.STATUS_2.getValue());
|
|
|
order.setDeliveryId(deliveryId);
|
|
order.setDeliveryId(deliveryId);
|
|
|
order.setDeliverySendTime(new Date());
|
|
order.setDeliverySendTime(new Date());
|
|
|
- order.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
|
|
fsStoreOrderMapper.updateFsStoreOrder(order);
|
|
fsStoreOrderMapper.updateFsStoreOrder(order);
|
|
|
orderStatusService.create(order.getId(), OrderLogEnum.DELIVERY_GOODS.getValue(),
|
|
orderStatusService.create(order.getId(), OrderLogEnum.DELIVERY_GOODS.getValue(),
|
|
@@ -2460,9 +2458,12 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
fsStoreAfterSalesParam.setProductList(productParams);
|
|
fsStoreAfterSalesParam.setProductList(productParams);
|
|
|
|
|
|
|
|
return fsStoreAfterSalesScrmService.applyForAfterSales(order.getUserId(),fsStoreAfterSalesParam);
|
|
return fsStoreAfterSalesScrmService.applyForAfterSales(order.getUserId(),fsStoreAfterSalesParam);
|
|
|
- } else{
|
|
|
|
|
- jSTOrderService.refundUpdateScrm(request);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ }/* else{
|
|
|
|
|
+ ErpRefundOrder order1=new ErpRefundOrder();
|
|
|
|
|
+ order1.setOrderCode(order.getOrderCode());
|
|
|
|
|
+ order1.setDeliverySn(order.getDeliverySn());
|
|
|
|
|
+ erpOrderService.refundOrder(order1);
|
|
|
|
|
+ }*/
|
|
|
}
|
|
}
|
|
|
order.setStatus(-2);
|
|
order.setStatus(-2);
|
|
|
order.setRefundPrice(order.getPayMoney());
|
|
order.setRefundPrice(order.getPayMoney());
|
|
@@ -2484,13 +2485,24 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
//将钱退还给用户
|
|
//将钱退还给用户
|
|
|
List<FsStorePaymentScrm> payments = paymentService.selectFsStorePaymentByOrderId(order.getId());
|
|
List<FsStorePaymentScrm> payments = paymentService.selectFsStorePaymentByOrderId(order.getId());
|
|
|
if (payments != null) {
|
|
if (payments != null) {
|
|
|
- String json = configService.selectConfigByKey("his.pay");
|
|
|
|
|
-
|
|
|
|
|
- FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
|
|
for (FsStorePaymentScrm payment : payments) {
|
|
for (FsStorePaymentScrm payment : payments) {
|
|
|
|
|
+ if (StringUtils.isBlank(payment.getAppId())) {
|
|
|
|
|
+ throw new IllegalArgumentException("appId不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(payment.getAppId());
|
|
|
|
|
+ if (fsCoursePlaySourceConfig == null) {
|
|
|
|
|
+ throw new CustomException("未找到appId对应的小程序配置: " + payment.getAppId());
|
|
|
|
|
+ }
|
|
|
|
|
+ Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
|
|
|
|
|
+ if (merchantConfigId == null || merchantConfigId <= 0) {
|
|
|
|
|
+ throw new CustomException("小程序没有配置商户信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
|
|
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
|
|
+
|
|
|
if (payment.getPayMode() == null || payment.getPayMode().equals("wx")) {
|
|
if (payment.getPayMode() == null || payment.getPayMode().equals("wx")) {
|
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
|
- payConfig.setAppId(fsPayConfig.getAppId());
|
|
|
|
|
|
|
+ payConfig.setAppId(payment.getAppId());
|
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
payConfig.setKeyPath(fsPayConfig.getKeyPath());
|
|
payConfig.setKeyPath(fsPayConfig.getKeyPath());
|
|
@@ -3135,6 +3147,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
|
|
|
|
|
//获取运费模板区域列表按照城市排序
|
|
//获取运费模板区域列表按照城市排序
|
|
|
List<FsShippingTemplatesRegionScrm> shippingTemplatesRegionList = shippingTemplatesRegionService.selectFsShippingTemplatesRegionListByTempIdsAndCityIds(StringUtils.join(tempIds, ","), StringUtils.join(citys, ","));
|
|
List<FsShippingTemplatesRegionScrm> shippingTemplatesRegionList = shippingTemplatesRegionService.selectFsShippingTemplatesRegionListByTempIdsAndCityIds(StringUtils.join(tempIds, ","), StringUtils.join(citys, ","));
|
|
|
|
|
+
|
|
|
boolean isQg = false;
|
|
boolean isQg = false;
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(shippingTemplatesRegionList)&&CollectionUtils.isNotEmpty(shippingTemplatesList)&&shippingTemplatesList.size()<2) {
|
|
if (CollectionUtils.isEmpty(shippingTemplatesRegionList)&&CollectionUtils.isNotEmpty(shippingTemplatesList)&&shippingTemplatesList.size()<2) {
|
|
@@ -4234,7 +4247,7 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
else if(param.getPayType().equals(2)){
|
|
else if(param.getPayType().equals(2)){
|
|
|
order.setPayType("2");
|
|
order.setPayType("2");
|
|
|
BigDecimal payMoney=order.getPayPrice().multiply(new BigDecimal(storeConfig.getPayRate())).divide(new BigDecimal(100));
|
|
BigDecimal payMoney=order.getPayPrice().multiply(new BigDecimal(storeConfig.getPayRate())).divide(new BigDecimal(100));
|
|
|
- payMoney=new BigDecimal(payMoney.setScale(0, BigDecimal.ROUND_HALF_UP).longValue());
|
|
|
|
|
|
|
+ payMoney=new BigDecimal(payMoney.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
// 如果小程序需要支付的金额小于0.01元,不能走物流代收,让走货到付款 xgb
|
|
// 如果小程序需要支付的金额小于0.01元,不能走物流代收,让走货到付款 xgb
|
|
|
if (payMoney.compareTo(new BigDecimal("0.01")) < 0) {
|
|
if (payMoney.compareTo(new BigDecimal("0.01")) < 0) {
|
|
|
return R.error("物流代收计算支付金额为0,不允许选择物流代收");
|
|
return R.error("物流代收计算支付金额为0,不允许选择物流代收");
|
|
@@ -4266,14 +4279,25 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
}
|
|
|
this.updateFsStoreOrder(order);
|
|
this.updateFsStoreOrder(order);
|
|
|
}
|
|
}
|
|
|
- String payCode = OrderCodeUtils.getOrderSn();
|
|
|
|
|
|
|
+ String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
if((order.getPayType().equals("1")||order.getPayType().equals("2")||order.getPayType().equals("3")) && order.getPayMoney().compareTo(new BigDecimal(0))>0){
|
|
if((order.getPayType().equals("1")||order.getPayType().equals("2")||order.getPayType().equals("3")) && order.getPayMoney().compareTo(new BigDecimal(0))>0){
|
|
|
- String json = configService.selectConfigByKey(STORE_PAY_CONF);
|
|
|
|
|
- FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
|
|
|
|
+ if (StringUtils.isBlank(param.getAppId())) {
|
|
|
|
|
+ throw new IllegalArgumentException("appId不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
|
|
|
|
|
+ if (fsCoursePlaySourceConfig == null) {
|
|
|
|
|
+ throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
|
|
|
|
|
+ }
|
|
|
|
|
+ Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
|
|
|
|
|
+ if (merchantConfigId == null || merchantConfigId <= 0) {
|
|
|
|
|
+ throw new CustomException("小程序没有配置商户信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
|
|
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
- storePayment.setPayMode(fsPayConfig.getType());
|
|
|
|
|
|
|
+ storePayment.setPayMode(merchantAppConfig.getMerchantType());
|
|
|
storePayment.setStatus(0);
|
|
storePayment.setStatus(0);
|
|
|
storePayment.setPayCode(payCode);
|
|
storePayment.setPayCode(payCode);
|
|
|
storePayment.setPayMoney(order.getPayMoney());
|
|
storePayment.setPayMoney(order.getPayMoney());
|
|
@@ -4285,10 +4309,11 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
storePayment.setUserId(user.getUserId());
|
|
storePayment.setUserId(user.getUserId());
|
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
storePayment.setOrderId(order.getId());
|
|
storePayment.setOrderId(order.getId());
|
|
|
- storePayment.setAppId(fsPayConfig.getAppId() == null ? "" : fsPayConfig.getAppId());
|
|
|
|
|
|
|
+ storePayment.setAppId(fsCoursePlaySourceConfig.getAppid() == null ? "" : fsCoursePlaySourceConfig.getAppid());
|
|
|
|
|
+ storePayment.setMerConfigId(merchantAppConfig.getId());
|
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
|
|
|
|
|
- if (fsPayConfig.getType().equals("hf")){
|
|
|
|
|
|
|
+ if (merchantAppConfig.getMerchantType().equals("hf")){
|
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
o.setTradeType("T_MINIAPP");
|
|
o.setTradeType("T_MINIAPP");
|
|
|
o.setOpenid(user.getMaOpenId());
|
|
o.setOpenid(user.getMaOpenId());
|
|
@@ -4297,7 +4322,8 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
o.setGoodsDesc("商城订单支付");
|
|
o.setGoodsDesc("商城订单支付");
|
|
|
o.setAppId(param.getAppId());
|
|
o.setAppId(param.getAppId());
|
|
|
try {
|
|
try {
|
|
|
- HuiFuUtils.doDiv(o,order.getCompanyId());
|
|
|
|
|
|
|
+
|
|
|
|
|
+ HuiFuUtils.doDiv(o,order.getCompanyId(), storePayment.getMerConfigId());
|
|
|
//存储分账明细
|
|
//存储分账明细
|
|
|
HuiFuUtils.saveDivItem(o, order.getOrderCode(), storePayment.getPayCode());
|
|
HuiFuUtils.saveDivItem(o, order.getOrderCode(), storePayment.getPayCode());
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -4320,9 +4346,9 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
else{
|
|
else{
|
|
|
return R.error(result.getResp_desc());
|
|
return R.error(result.getResp_desc());
|
|
|
}
|
|
}
|
|
|
- }else if (fsPayConfig.getType().equals("wx")){
|
|
|
|
|
|
|
+ }else if (merchantAppConfig.getMerchantType().equals("wx")){
|
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
|
- payConfig.setAppId(fsPayConfig.getAppId());
|
|
|
|
|
|
|
+ payConfig.setAppId(fsCoursePlaySourceConfig.getAppid());
|
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
@@ -4405,14 +4431,25 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
if(!order.getIsPayRemain().equals(0)){
|
|
if(!order.getIsPayRemain().equals(0)){
|
|
|
return R.error("此订单已支付");
|
|
return R.error("此订单已支付");
|
|
|
}
|
|
}
|
|
|
- String payCode = OrderCodeUtils.getOrderSn();
|
|
|
|
|
- String json = configService.selectConfigByKey(STORE_PAY_CONF);
|
|
|
|
|
- FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
|
|
|
|
+ String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
|
|
+ if (StringUtils.isBlank(param.getAppId())) {
|
|
|
|
|
+ throw new IllegalArgumentException("appId不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
|
|
|
|
|
+ if (fsCoursePlaySourceConfig == null) {
|
|
|
|
|
+ throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
|
|
|
|
|
+ }
|
|
|
|
|
+ Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
|
|
|
|
|
+ if (merchantConfigId == null || merchantConfigId <= 0) {
|
|
|
|
|
+ throw new CustomException("小程序没有配置商户信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
|
|
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
storePayment.setStatus(0);
|
|
storePayment.setStatus(0);
|
|
|
- storePayment.setPayMode(fsPayConfig.getType());
|
|
|
|
|
|
|
+ storePayment.setPayMode(merchantAppConfig.getMerchantType());
|
|
|
storePayment.setPayCode(payCode);
|
|
storePayment.setPayCode(payCode);
|
|
|
storePayment.setPayMoney(order.getPayDelivery());
|
|
storePayment.setPayMoney(order.getPayDelivery());
|
|
|
storePayment.setCreateTime(new Date());
|
|
storePayment.setCreateTime(new Date());
|
|
@@ -4424,9 +4461,11 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
storePayment.setOrderId(order.getId());
|
|
storePayment.setOrderId(order.getId());
|
|
|
storePayment.setIsPayRemain(1);
|
|
storePayment.setIsPayRemain(1);
|
|
|
|
|
+ storePayment.setMerConfigId(merchantAppConfig.getId());
|
|
|
|
|
+ storePayment.setAppId(param.getAppId());
|
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
|
|
|
|
|
- if (fsPayConfig.getType().equals("hf")){
|
|
|
|
|
|
|
+ if (merchantAppConfig.getMerchantType().equals("hf")){
|
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
o.setTradeType("T_MINIAPP");
|
|
o.setTradeType("T_MINIAPP");
|
|
|
o.setOpenid(user.getMaOpenId());
|
|
o.setOpenid(user.getMaOpenId());
|
|
@@ -4449,10 +4488,10 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
else{
|
|
else{
|
|
|
return R.error(result.getResp_desc());
|
|
return R.error(result.getResp_desc());
|
|
|
}
|
|
}
|
|
|
- }else if (fsPayConfig.getType().equals("wx")){
|
|
|
|
|
|
|
+ }else if (merchantAppConfig.getMerchantType().equals("wx")){
|
|
|
//创建微信订单
|
|
//创建微信订单
|
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
|
- payConfig.setAppId(fsPayConfig.getAppId());
|
|
|
|
|
|
|
+ payConfig.setAppId(fsCoursePlaySourceConfig.getAppid());
|
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
@@ -4522,16 +4561,27 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
return R.error("正在支付中...");
|
|
return R.error("正在支付中...");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- String json = configService.selectConfigByKey(STORE_PAY_CONF);
|
|
|
|
|
- FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
|
|
- String payCode = OrderCodeUtils.getOrderSn();
|
|
|
|
|
|
|
+ if (StringUtils.isBlank(param.getAppId())) {
|
|
|
|
|
+ throw new IllegalArgumentException("appId不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
|
|
|
|
|
+ if (fsCoursePlaySourceConfig == null) {
|
|
|
|
|
+ throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
|
|
|
|
|
+ }
|
|
|
|
|
+ Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
|
|
|
|
|
+ if (merchantConfigId == null || merchantConfigId <= 0) {
|
|
|
|
|
+ throw new CustomException("小程序没有配置商户信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
|
|
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
|
|
+ String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
//易宝支付
|
|
//易宝支付
|
|
|
FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
storePayment.setStatus(0);
|
|
storePayment.setStatus(0);
|
|
|
storePayment.setPayCode(payCode);
|
|
storePayment.setPayCode(payCode);
|
|
|
- storePayment.setPayMode(fsPayConfig.getType());
|
|
|
|
|
|
|
+ storePayment.setPayMode(merchantAppConfig.getMerchantType());
|
|
|
storePayment.setPayMoney(order.getPayMoney());
|
|
storePayment.setPayMoney(order.getPayMoney());
|
|
|
storePayment.setCreateTime(new Date());
|
|
storePayment.setCreateTime(new Date());
|
|
|
storePayment.setPayTypeCode("weixin");
|
|
storePayment.setPayTypeCode("weixin");
|
|
@@ -4541,9 +4591,11 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
storePayment.setUserId(user.getUserId());
|
|
storePayment.setUserId(user.getUserId());
|
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
storePayment.setOrderId(order.getId());
|
|
storePayment.setOrderId(order.getId());
|
|
|
|
|
+ storePayment.setMerConfigId(merchantAppConfig.getId());
|
|
|
|
|
+ storePayment.setAppId(param.getAppId());
|
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
|
|
|
|
|
- if (fsPayConfig.getType().equals("hf")){
|
|
|
|
|
|
|
+ if (merchantAppConfig.getMerchantType().equals("hf")){
|
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
o.setTradeType("T_MINIAPP");
|
|
o.setTradeType("T_MINIAPP");
|
|
|
o.setOpenid(user.getMaOpenId());
|
|
o.setOpenid(user.getMaOpenId());
|
|
@@ -4566,10 +4618,10 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
else{
|
|
else{
|
|
|
return R.error(result.getResp_desc());
|
|
return R.error(result.getResp_desc());
|
|
|
}
|
|
}
|
|
|
- }else if (fsPayConfig.getType().equals("wx")){
|
|
|
|
|
|
|
+ }else if (merchantAppConfig.getMerchantType().equals("wx")){
|
|
|
//创建微信订单
|
|
//创建微信订单
|
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
|
- payConfig.setAppId(fsPayConfig.getAppId());
|
|
|
|
|
|
|
+ payConfig.setAppId(fsCoursePlaySourceConfig.getAppid());
|
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
@@ -4623,14 +4675,25 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
}
|
|
}
|
|
|
FsUserScrm user=userService.selectFsUserById(order.getUserId());
|
|
FsUserScrm user=userService.selectFsUserById(order.getUserId());
|
|
|
if(user!=null){
|
|
if(user!=null){
|
|
|
- String payCode = OrderCodeUtils.getOrderSn();
|
|
|
|
|
- String json = configService.selectConfigByKey(STORE_PAY_CONF);
|
|
|
|
|
- FsPayConfigScrm fsPayConfig = JSON.parseObject(json, FsPayConfigScrm.class);
|
|
|
|
|
|
|
+ String payCode = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
|
|
+ if (StringUtils.isBlank(param.getAppId())) {
|
|
|
|
|
+ throw new IllegalArgumentException("appId不能为空");
|
|
|
|
|
+ }
|
|
|
|
|
+ FsCoursePlaySourceConfig fsCoursePlaySourceConfig = fsCoursePlaySourceConfigMapper.selectCoursePlaySourceConfigByAppId(param.getAppId());
|
|
|
|
|
+ if (fsCoursePlaySourceConfig == null) {
|
|
|
|
|
+ throw new CustomException("未找到appId对应的小程序配置: " + param.getAppId());
|
|
|
|
|
+ }
|
|
|
|
|
+ Long merchantConfigId = fsCoursePlaySourceConfig.getMerchantConfigId();
|
|
|
|
|
+ if (merchantConfigId == null || merchantConfigId <= 0) {
|
|
|
|
|
+ throw new CustomException("小程序没有配置商户信息");
|
|
|
|
|
+ }
|
|
|
|
|
+ MerchantAppConfig merchantAppConfig = merchantAppConfigMapper.selectMerchantAppConfigById(fsCoursePlaySourceConfig.getMerchantConfigId());
|
|
|
|
|
+ FsPayConfig fsPayConfig = JSON.parseObject(merchantAppConfig.getDataJson(), FsPayConfig.class);
|
|
|
FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
FsStorePaymentScrm storePayment=new FsStorePaymentScrm();
|
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
storePayment.setCompanyId(order.getCompanyId());
|
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
storePayment.setCompanyUserId(order.getCompanyUserId());
|
|
|
storePayment.setStatus(0);
|
|
storePayment.setStatus(0);
|
|
|
- storePayment.setPayMode(fsPayConfig.getType());
|
|
|
|
|
|
|
+ storePayment.setPayMode(merchantAppConfig.getMerchantType());
|
|
|
storePayment.setPayCode(payCode);
|
|
storePayment.setPayCode(payCode);
|
|
|
storePayment.setPayMoney(order.getPayDelivery());
|
|
storePayment.setPayMoney(order.getPayDelivery());
|
|
|
storePayment.setCreateTime(new Date());
|
|
storePayment.setCreateTime(new Date());
|
|
@@ -4642,9 +4705,11 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
storePayment.setBusinessOrderId(order.getId().toString());
|
|
|
storePayment.setOrderId(order.getId());
|
|
storePayment.setOrderId(order.getId());
|
|
|
storePayment.setIsPayRemain(1);
|
|
storePayment.setIsPayRemain(1);
|
|
|
|
|
+ storePayment.setMerConfigId(merchantAppConfig.getId());
|
|
|
|
|
+ storePayment.setAppId(param.getAppId());
|
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
fsStorePaymentMapper.insertFsStorePayment(storePayment);
|
|
|
|
|
|
|
|
- if (fsPayConfig.getType().equals("hf")){
|
|
|
|
|
|
|
+ if (merchantAppConfig.getMerchantType().equals("hf")){
|
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
HuiFuCreateOrder o = new HuiFuCreateOrder();
|
|
|
o.setTradeType("T_MINIAPP");
|
|
o.setTradeType("T_MINIAPP");
|
|
|
o.setOpenid(user.getMaOpenId());
|
|
o.setOpenid(user.getMaOpenId());
|
|
@@ -4668,9 +4733,9 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
else{
|
|
else{
|
|
|
return R.error(result.getResp_desc());
|
|
return R.error(result.getResp_desc());
|
|
|
}
|
|
}
|
|
|
- }else if(fsPayConfig.getType().equals("wx")) {
|
|
|
|
|
|
|
+ }else if(merchantAppConfig.getMerchantType().equals("wx")) {
|
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
WxPayConfig payConfig = new WxPayConfig();
|
|
|
- payConfig.setAppId(fsPayConfig.getAppId());
|
|
|
|
|
|
|
+ payConfig.setAppId(fsCoursePlaySourceConfig.getAppid());
|
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
payConfig.setMchId(fsPayConfig.getWxMchId());
|
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
payConfig.setMchKey(fsPayConfig.getWxMchKey());
|
|
|
payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
payConfig.setSubAppId(org.apache.commons.lang3.StringUtils.trimToNull(null));
|
|
@@ -4750,7 +4815,11 @@ public class FsStoreOrderScrmServiceImpl implements IFsStoreOrderScrmService {
|
|
|
// 物流代收
|
|
// 物流代收
|
|
|
order.setPayType("2");
|
|
order.setPayType("2");
|
|
|
BigDecimal payMoney=order.getPayPrice().multiply(new BigDecimal(storeConfig.getPayRate())).divide(new BigDecimal(100));
|
|
BigDecimal payMoney=order.getPayPrice().multiply(new BigDecimal(storeConfig.getPayRate())).divide(new BigDecimal(100));
|
|
|
- payMoney=new BigDecimal(payMoney.setScale(0, BigDecimal.ROUND_HALF_UP).longValue());
|
|
|
|
|
|
|
+ payMoney=new BigDecimal(payMoney.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
|
|
+ // 如果小程序需要支付的金额小于0.01元,不能走物流代收,让走货到付款 xgb
|
|
|
|
|
+ if (payMoney.compareTo(new BigDecimal("0.01")) < 0) {
|
|
|
|
|
+ return R.error("物流代收计算支付金额为0,不允许选择物流代收");
|
|
|
|
|
+ }
|
|
|
order.setPayDelivery(order.getPayPrice().subtract(payMoney));
|
|
order.setPayDelivery(order.getPayPrice().subtract(payMoney));
|
|
|
order.setPayMoney(payMoney);
|
|
order.setPayMoney(payMoney);
|
|
|
}
|
|
}
|