1098226878
2021-09-06 8d0d2ac5db499a72cc029c6c5ced1d4f82c2c4d1
service-front/src/main/java/com/java110/front/smo/payment/adapt/fuiouPay/FuiouOweFeeToNotifyAdapt.java
old mode 100644 new mode 100755
@@ -21,7 +21,7 @@
import com.java110.dto.fee.FeeDto;
import com.java110.dto.smallWeChat.SmallWeChatDto;
import com.java110.front.properties.WechatAuthProperties;
import com.java110.front.smo.payment.adapt.IPayNotifyAdapt;
import com.java110.front.smo.payment.adapt.IOweFeeToNotifyAdapt;
import com.java110.utils.cache.CommonCache;
import com.java110.utils.constant.CommonConstant;
import com.java110.utils.constant.ServiceConstant;
@@ -58,7 +58,7 @@
 */
@Component(value = "fuiouOweFeeToNotifyAdapt")
public class FuiouOweFeeToNotifyAdapt implements IPayNotifyAdapt {
public class FuiouOweFeeToNotifyAdapt implements IOweFeeToNotifyAdapt {
    private static final Logger logger = LoggerFactory.getLogger(FuiouOweFeeToNotifyAdapt.class);
@@ -77,7 +77,7 @@
     * @return
     * @throws Exception
     */
    public String confirmPayFee(String param) {
    public String confirmPayFee(String param, String wId) {
        JSONObject resJson = new JSONObject();
        resJson.put("result_code", "010002");
        resJson.put("result_msg", "失败");
@@ -87,7 +87,7 @@
            String resultCode = map.getString("result_code");
            if ("000000".equals(resultCode)) {
                //更新数据
                int result = confirmPayFee(map);
                int result = confirmPayFee(map, wId);
                if (result > 0) {
                    //支付成功
                    resJson.put("result_code", "000000");
@@ -103,8 +103,7 @@
    }
    public int confirmPayFee(JSONObject map) {
        String wId = map.get("wId").toString();
    public int confirmPayFee(JSONObject map, String wId) {
        wId = wId.replace(" ", "+");
        ResponseEntity<String> responseEntity = null;
@@ -133,13 +132,33 @@
        //查询用户ID
        JSONObject paramIn = JSONObject.parseObject(order);
        paramIn.put("oId", orderId);
        String url = ServiceConstant.SERVICE_API_URL + "/api/feeApi/payOweFee";
        freshFees(paramIn);
        String url = ServiceConstant.SERVICE_API_URL + "/api/fee.payOweFee";
        responseEntity = this.callCenterService(restTemplate, "-1", paramIn.toJSONString(), url, HttpMethod.POST);
        if (responseEntity.getStatusCode() != HttpStatus.OK) {
            return 0;
        }
        return 1;
    }
    private void freshFees(JSONObject paramIn) {
        if (!paramIn.containsKey("fees")) {
            return;
        }
        JSONArray fees = paramIn.getJSONArray("fees");
        JSONObject fee = null;
        for (int feeIndex = 0; feeIndex < fees.size(); feeIndex++) {
            fee = fees.getJSONObject(feeIndex);
            if (fee.containsKey("deadlineTime")) {
                fee.put("startTime", fee.getString("endTime"));
                fee.put("endTime", fee.getString("deadlineTime"));
                fee.put("receivedAmount", fee.getString("feePrice"));
                fee.put("state", "");
            }
        }
    }
@@ -168,9 +187,8 @@
            responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        } finally {
            logger.debug("请求地址为,{} 请求中心服务信息,{},中心服务返回信息,{}", url, httpEntity, responseEntity);
            return responseEntity;
        }
        return responseEntity;
    }