puhanshu
2022-01-14 55402cc48ecee2ac135624db4d31119b459a1be7
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java
@@ -27,6 +27,8 @@
import java.math.BigDecimal;
import java.util.Date;
import static java.util.Objects.nonNull;
/**
 * 商业街订单表(McsOrder)表服务实现类
 *
@@ -44,12 +46,14 @@
    private String payKey;
    @Value("${min.app.mchId}")
    private String mchId;
    //@Value("${min.app.notifyUrl}")
    private String notifyUrl="http://387405oo37.zicp.vip/mcsOrder/wxNotify";
    @Value("${mcs.notifyUrl}")
    private String notifyUrl;
    @Resource
    private RabbitTemplate rabbitTemplate;
    @Resource
    private McsMerchantService mcsMerchantService;
    private static String H5_LOGIN_APPID="wx475fcd33c8030df8";
    @Override
    public R pageList(CommonPage commonPage) {
        return R.ok(this.baseMapper.pageList(new Page(commonPage.getPage(),commonPage.getSize()),commonPage));
@@ -89,7 +93,11 @@
                    money = BigDecimal.valueOf(0.01);
                }
                // 调用wx支付
                String result = WxPayUtils.h5pay(appid, mchId, payKey, notifyUrl, "点亮支付", mcsOrderVO.getOpenId(),
                String realAppId=appid;
                if(mcsOrderVO.getTradeType().equals("JSAPI")){
                    realAppId=H5_LOGIN_APPID;
                }
                String result = WxPayUtils.h5pay(realAppId, mchId, payKey, notifyUrl, "点亮支付", mcsOrderVO.getOpenId(),
                        mcsOrder.getOrderNo(), money,mcsOrderVO.getTradeType(), mcsOrderVO.getClientIp());
                if (mcsOrderVO.getTradeType().equals("NATIVE")) {
                    JSONObject jsonObjectResult = JSONObject.parseObject(result);
@@ -125,7 +133,11 @@
        mcsOrderBase.setPayTime(mcsOrderVO.getPayTime());
        int i=this.baseMapper.updateById(mcsOrderBase);
        if(i>0){
            mcsMerchantService.updateOrAddMcsMerchantAfterOrder(mcsOrderBase.getMerchantName(),mcsOrderBase.getConfigId(),mcsOrderBase.getUserId());
            R r = mcsMerchantService.updateOrAddMcsMerchantAfterOrder(mcsOrderBase.getMerchantName(), mcsOrderBase.getConfigId(), mcsOrderBase.getUserId());
            if (R.isOk(r) && nonNull(r.getData())) {
                mcsOrderBase.setMerchantId(JSONObject.parseObject(JSONObject.toJSONString(r.getData()), Long.class));
                this.baseMapper.updateById(mcsOrderBase);
            }
        }
        return R.ok();
    }