java110
2020-12-11 83b8db7d50d0fd8e7f4f4ac1070c28b827190e56
service-front/src/main/java/com/java110/front/smo/payment/impl/GoodsToPaySMOImpl.java
@@ -13,6 +13,7 @@
import com.java110.utils.constant.ServiceConstant;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.vo.ResultVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -49,7 +50,7 @@
    protected void validate(IPageData pd, JSONObject paramIn) {
        Assert.jsonObjectHaveKey(paramIn, "addressId", "请求报文中未包含地址");
        Assert.jsonObjectHaveKey(paramIn, "userId", "请求报文中未包含用户ID");
        Assert.jsonObjectHaveKey(paramIn, "personId", "请求报文中未包含用户ID");
        Assert.hasKey(paramIn, "goodsList", "未包含商品信息");
@@ -70,13 +71,17 @@
        //查询用户ID
        paramIn.put("userId", pd.getUserId());
        String url = ServiceConstant.SERVICE_API_URL + "/app/storeOrder/saveStoreOrder";
        String url = ServiceConstant.SERVICE_API_URL + "/api/storeOrder/saveStoreOrder";
        responseEntity = super.callCenterService(restTemplate, pd, paramIn.toJSONString(), url, HttpMethod.POST);
        if (responseEntity.getStatusCode() != HttpStatus.OK) {
            return responseEntity;
        }
        JSONObject orderInfo = JSONObject.parseObject(responseEntity.getBody().toString());
        if (orderInfo.getInteger("code") != ResultVo.CODE_OK) {
            throw new IllegalArgumentException("下单失败:" + orderInfo.getString("msg"));
        }
        orderInfo = orderInfo.getJSONObject("data");
        String orderId = orderInfo.getString("orderId");
        double money = Double.parseDouble(orderInfo.getString("payPrice"));
        String appType = OwnerAppUserDto.APP_TYPE_WECHAT_MINA;
@@ -88,7 +93,7 @@
            appType = OwnerAppUserDto.APP_TYPE_APP;
        }
        Map tmpParamIn = new HashMap();
        tmpParamIn.put("userId", pd.getUserId());
        tmpParamIn.put("userId", paramIn.getString("personId"));
        tmpParamIn.put("appType", appType);
        responseEntity = super.getOwnerAppUser(pd, restTemplate, tmpParamIn);
        logger.debug("查询用户信息返回报文:" + responseEntity);
@@ -106,7 +111,9 @@
        JSONObject realUserInfo = userResult.getJSONArray("data").getJSONObject(0);
        String openId = realUserInfo.getString("openId");
        Map result = super.java110Payment(outRestTemplate, paramIn.getString("feeName"), paramIn.getString("tradeType"), orderId, money, openId, smallWeChatDto);
        Map result = super.java110Payment(outRestTemplate, "商品购买",
                paramIn.getString("tradeType"), orderId, money, openId,
                smallWeChatDto, wechatAuthProperties.getGoodsNotifyUrl());
        responseEntity = new ResponseEntity(JSONObject.toJSONString(result), HttpStatus.OK);
        return responseEntity;