java110
2021-09-03 1006ed84660edfabbb5273a523e0c3c5af20a387
service-front/src/main/java/com/java110/front/smo/payment/adapt/wechatPay/WechatOweFeeToNotifyAdapt.java
old mode 100644 new mode 100755
@@ -19,10 +19,9 @@
import com.alibaba.fastjson.JSONObject;
import com.java110.core.factory.WechatFactory;
import com.java110.dto.fee.FeeDto;
import com.java110.dto.rentingPool.RentingPoolDto;
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;
@@ -48,7 +47,7 @@
 */
@Component(value = "wechatOweFeeToNotifyAdapt")
public class WechatOweFeeToNotifyAdapt implements IPayNotifyAdapt {
public class WechatOweFeeToNotifyAdapt implements IOweFeeToNotifyAdapt {
    private static final Logger logger = LoggerFactory.getLogger(WechatOweFeeToNotifyAdapt.class);
@@ -67,7 +66,7 @@
     * @return
     * @throws Exception
     */
    public String confirmPayFee(String param) {
    public String confirmPayFee(String param,String wId) {
        String resXml = "";
        try {
            Map<String, Object> map = PayUtil.getMapFromXML(param);
@@ -140,13 +139,32 @@
        //查询用户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","");
            }
        }
    }
@@ -175,9 +193,9 @@
            responseEntity = new ResponseEntity<String>(e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
        } finally {
            logger.debug("请求地址为,{} 请求中心服务信息,{},中心服务返回信息,{}", url, httpEntity, responseEntity);
            return responseEntity;
        }
        return responseEntity;
    }
@@ -202,4 +220,5 @@
        return BeanConvertUtil.covertBean(smallWeChats.get(0), SmallWeChatDto.class);
    }
}