吴学文
2020-01-11 58872665eca6273aae92247c32e9582ee1d9a9c7
AppFrontService/src/main/java/com/java110/app/smo/payment/impl/ToPaySMOImpl.java
@@ -16,6 +16,7 @@
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.io.IOException;
@@ -24,6 +25,7 @@
import java.util.SortedMap;
import java.util.TreeMap;
@Service("toPaySMOImpl")
public class ToPaySMOImpl extends AppAbstractComponentSMO implements IToPaySMO {
    private static final Logger logger = LoggerFactory.getLogger(AppAbstractComponentSMO.class);
@@ -74,7 +76,7 @@
        JSONObject userResult = JSONObject.parseObject(responseEntity.getBody().toString());
        int total = userResult.getIntValue("total");
        if(total < 1){
        if (total < 1) {
            //未查询到用户信息
            throw new IllegalArgumentException("未查询微信用户");
        }
@@ -147,8 +149,12 @@
//转换为xml
        String xmlData = PayUtil.mapToXml(paramMap);
        logger.debug("调用支付统一下单接口" + xmlData);
        ResponseEntity<String> responseEntity = restTemplate.postForEntity(
                wechatAuthProperties.getWxPayUnifiedOrder(), xmlData, String.class);
        logger.debug("统一下单返回"+responseEntity);
//请求微信后台,获取预支付ID
        if (responseEntity.getStatusCode() != HttpStatus.OK) {
            throw new IllegalArgumentException("支付失败" + responseEntity.getBody());