Bladeren bron

临时停车费支持支付宝支付

java110 3 jaren geleden
bovenliggende
commit
bdfedffd7a

+ 1 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java

@@ -30,6 +30,7 @@ public class FeeDto extends PageDto implements Serializable {
     public static final String FEE_FLAG_CYCLE_ONCE = "4012024";//间接性费用
     public static final String REDIS_PAY_OWE_FEE = "PAY_OWE_FEE_";
     public static final String REDIS_PAY_TEMP_CAR_FEE = "PAY_TEMP_CAR_FEE_";
+    public static final String REDIS_PAY_TEMP_CAR_FEE_COMMUNITY = "REDIS_PAY_TEMP_CAR_FEE_COMMUNITY_";
 
     private String amount;
     private String incomeObjId;

+ 86 - 0
service-acct/src/main/java/com/java110/acct/cmd/alipay/NotifyPayTempCarFeeCmd.java

@@ -0,0 +1,86 @@
+package com.java110.acct.cmd.alipay;
+
+import com.alibaba.fastjson.JSONObject;
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.internal.util.AlipaySignature;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.factory.CommunitySettingFactory;
+import com.java110.dto.fee.FeeDto;
+import com.java110.intf.community.IParkingAreaV1InnerServiceSMO;
+import com.java110.intf.fee.ITempCarFeeCreateOrderV1InnerServiceSMO;
+import com.java110.intf.store.ISmallWechatV1InnerServiceSMO;
+import com.java110.intf.user.IOwnerCarOpenUserV1InnerServiceSMO;
+import com.java110.utils.cache.CommonCache;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+
+import java.text.ParseException;
+import java.util.LinkedHashMap;
+
+@Java110Cmd(serviceCode = "alipay.notifyPayTempCarFee")
+public class NotifyPayTempCarFeeCmd extends Cmd {
+
+    @Autowired
+    private IOwnerCarOpenUserV1InnerServiceSMO ownerCarOpenUserV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IParkingAreaV1InnerServiceSMO parkingAreaV1InnerServiceSMOImpl;
+
+    @Autowired
+    private ISmallWechatV1InnerServiceSMO smallWechatV1InnerServiceSMOImpl;
+
+    @Autowired
+    private ITempCarFeeCreateOrderV1InnerServiceSMO tempCarFeeCreateOrderV1InnerServiceSMOImpl;
+
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        Assert.jsonObjectHaveKey(reqJson, "out_trade_no", "请求报文中未包含订单信息");
+        Assert.jsonObjectHaveKey(reqJson, "sign", "请求报文中未包含签名信息");
+
+        String communityId = CommonCache.getAndRemoveValue(FeeDto.REDIS_PAY_TEMP_CAR_FEE_COMMUNITY + reqJson.getString("out_trade_no"));
+
+        String resultInfo = reqJson.getString("resultInfo");
+        String[] temp = resultInfo.split("&");
+        LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
+        //把拆分数据放在map集合内
+        for (int i = 0; i < temp.length; i++) {
+            String[] arr = temp[i].split("=", 2); //通过"="号分割成2个数据
+            String[] tempAagin = new String[arr.length]; //再开辟一个数组用来接收分割后的数据
+            for (int j = 0; j < arr.length; j++) {
+                tempAagin[j] = arr[j];
+            }
+            map.put(tempAagin[0], tempAagin[1]);
+        }
+        System.out.println(map);
+        boolean signVerified = false;
+        try {
+            signVerified = AlipaySignature.rsaCheckV1(map,
+                    CommunitySettingFactory.getRemark(communityId, "ALIPAY_PUBLIC_KEY")
+                    , "UTF-8", "RSA2");
+        } catch (AlipayApiException e) {
+            throw new RuntimeException(e);
+        }
+        if (!signVerified) {
+            throw new CmdException("签名失败");
+        }
+
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        ResponseEntity responseEntity = null;
+
+
+        JSONObject paramIn = new JSONObject();
+        paramIn.put("oId", reqJson.getString("out_trade_no"));
+        responseEntity = tempCarFeeCreateOrderV1InnerServiceSMOImpl.notifyOrder(paramIn);
+        context.setResponseEntity(responseEntity);
+
+    }
+}

+ 64 - 42
service-acct/src/main/java/com/java110/acct/cmd/alipay/PayTempCarFeeCmd.java

@@ -2,13 +2,18 @@ package com.java110.acct.cmd.alipay;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alipay.api.AlipayApiException;
+import com.alipay.api.AlipayClient;
+import com.alipay.api.DefaultAlipayClient;
+import com.alipay.api.request.AlipayTradeCreateRequest;
+import com.alipay.api.response.AlipayTradeCreateResponse;
 import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.context.ICmdDataFlowContext;
-import com.java110.core.context.IPageData;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.CallApiServiceFactory;
+import com.java110.core.factory.CommunitySettingFactory;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.fee.FeeDto;
 import com.java110.dto.ownerCarOpenUser.OwnerCarOpenUserDto;
 import com.java110.dto.parking.ParkingAreaDto;
 import com.java110.dto.smallWeChat.SmallWeChatDto;
@@ -17,22 +22,20 @@ import com.java110.intf.fee.ITempCarFeeCreateOrderV1InnerServiceSMO;
 import com.java110.intf.store.ISmallWechatV1InnerServiceSMO;
 import com.java110.intf.user.IOwnerCarOpenUserV1InnerServiceSMO;
 import com.java110.po.ownerCarOpenUser.OwnerCarOpenUserPo;
+import com.java110.utils.cache.CommonCache;
 import com.java110.utils.cache.MappingCache;
-import com.java110.utils.constant.WechatConstant;
 import com.java110.utils.exception.CmdException;
-import com.java110.utils.factory.ApplicationContextFactory;
 import com.java110.utils.util.Assert;
-import com.java110.utils.util.StringUtil;
+import com.java110.utils.util.DateUtil;
+import com.java110.vo.ResultVo;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 
 import java.text.ParseException;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
 
 @Java110Cmd(serviceCode = "alipay.payTempCarFee")
 public class PayTempCarFeeCmd extends Cmd {
@@ -71,15 +74,7 @@ public class PayTempCarFeeCmd extends Cmd {
 
         Assert.listOnlyOne(parkingAreaDtos, "停车场不存在");
         reqJson.put("communityId", parkingAreaDtos.get(0).getCommunityId());
-        SmallWeChatDto smallWeChatDto = getSmallWechat( reqJson);
-
-        if (smallWeChatDto == null) { //从配置文件中获取 小程序配置信息
-            smallWeChatDto = new SmallWeChatDto();
-            smallWeChatDto.setAppId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "wechatAppId"));
-            smallWeChatDto.setAppSecret(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "wechatAppSecret"));
-            smallWeChatDto.setMchId(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "mchId"));
-            smallWeChatDto.setPayPassword(MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, "key"));
-        }
+
         JSONArray couponList = reqJson.getJSONArray("couponList");
         List<String> couponIds = new ArrayList<String>();
         if (couponList != null && couponList.size() > 0) {
@@ -92,15 +87,15 @@ public class PayTempCarFeeCmd extends Cmd {
         reqJson.put("userId", "-1");
 
         JSONObject paramIn = new JSONObject();
-        paramIn.put("paId",reqJson.getString("paId"));
-        paramIn.put("carNum",reqJson.getString("carNum"));
-        paramIn.put("machineId",reqJson.getString("machineId"));
-        paramIn.put("couponIds",StringUtils.join(couponIds, ","));
+        paramIn.put("paId", reqJson.getString("paId"));
+        paramIn.put("carNum", reqJson.getString("carNum"));
+        paramIn.put("machineId", reqJson.getString("machineId"));
+        paramIn.put("couponIds", StringUtils.join(couponIds, ","));
         responseEntity = tempCarFeeCreateOrderV1InnerServiceSMOImpl.createOrder(paramIn);
 
         if (responseEntity.getStatusCode() != HttpStatus.OK) {
             context.setResponseEntity(responseEntity);
-            return ;
+            return;
         }
         JSONObject orderInfo = JSONObject.parseObject(responseEntity.getBody().toString());
         if (orderInfo.getIntValue("code") != 0) {
@@ -121,33 +116,30 @@ public class PayTempCarFeeCmd extends Cmd {
                 param.put("code", "101");
                 param.put("msg", "扣费为0回调失败");
                 context.setResponseEntity(new ResponseEntity(JSONObject.toJSONString(param), HttpStatus.OK));
-                return ;
+                return;
             }
             param.put("code", "100");
             param.put("msg", "扣费为0回调成功");
             context.setResponseEntity(new ResponseEntity(JSONObject.toJSONString(param), HttpStatus.OK));
-            return ;
+            return;
         }
         String openId = reqJson.getString("openId");
-        String payAdapt = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAY_ADAPT);
-        //payAdapt = StringUtil.isEmpty(payAdapt) ? DEFAULT_PAY_ADAPT : payAdapt;
-        //支付适配器
-//        IPayAdapt tPayAdapt = ApplicationContextFactory.getBean(payAdapt, IPayAdapt.class);
-//        Map result = tPayAdapt.java110Payment(outRestTemplate, paramIn.getString("feeName"), paramIn.getString("tradeType"),
-//                orderId, money, openId, smallWeChatDto, wechatAuthProperties.getTempCarFeeNotifyUrl());
-   //     responseEntity = new ResponseEntity(JSONObject.toJSONString(result), HttpStatus.OK);
-//        if (!"0".equals(result.get("code"))) {
-//            context.setResponseEntity(responseEntity);
-//            return ;
-//        }
-//        JSONObject saveFees = new JSONObject();
-//        saveFees.put("orderId", paramIn.getString("inoutId"));
-//        saveFees.put("carNum", paramIn.getString("carNum"));
-//        saveFees.put("amount", money);
-//        saveFees.put("paId", paramIn.getString("paId"));
-//        saveFees.put("payTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
-//        saveFees.put("payType", "2");
-//        CommonCache.setValue(FeeDto.REDIS_PAY_TEMP_CAR_FEE + orderId, saveFees.toJSONString(), CommonCache.PAY_DEFAULT_EXPIRE_TIME);
+        ResultVo result = doAlipay(reqJson, paramIn.getString("feeName"), orderId, money, openId);
+
+        responseEntity = new ResponseEntity(JSONObject.toJSONString(result), HttpStatus.OK);
+        context.setResponseEntity(responseEntity);
+        if (!"0".equals(result.getCode())) {
+            return;
+        }
+        JSONObject saveFees = new JSONObject();
+        saveFees.put("orderId", paramIn.getString("inoutId"));
+        saveFees.put("carNum", paramIn.getString("carNum"));
+        saveFees.put("amount", money);
+        saveFees.put("paId", paramIn.getString("paId"));
+        saveFees.put("payTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+        saveFees.put("payType", "2");
+        CommonCache.setValue(FeeDto.REDIS_PAY_TEMP_CAR_FEE + orderId, saveFees.toJSONString(), CommonCache.PAY_DEFAULT_EXPIRE_TIME);
+        CommonCache.setValue(FeeDto.REDIS_PAY_TEMP_CAR_FEE_COMMUNITY + orderId, reqJson.getString("communityId"), CommonCache.PAY_DEFAULT_EXPIRE_TIME);
         //记录openId 和车辆关系 以免每次 输入 车牌号麻烦
         OwnerCarOpenUserPo ownerCarOpenUserPo = new OwnerCarOpenUserPo();
         ownerCarOpenUserPo.setCarNum(reqJson.getString("carNum"));
@@ -159,6 +151,36 @@ public class PayTempCarFeeCmd extends Cmd {
         ownerCarOpenUserV1InnerServiceSMOImpl.saveOwnerCarOpenUser(ownerCarOpenUserPo);
     }
 
+    private ResultVo doAlipay(JSONObject reqJson, String feeName, String orderId, double money, String openId) {
+        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
+                CommunitySettingFactory.getValue(reqJson.getString("communityId"), "APP_ID"),
+                CommunitySettingFactory.getRemark(reqJson.getString("communityId"), "APP_PRIVATE_KEY"),
+                "json",
+                "UTF-8",
+                CommunitySettingFactory.getRemark(reqJson.getString("communityId"), "ALIPAY_PUBLIC_KEY"),
+                "RSA2");
+        AlipayTradeCreateRequest request = new AlipayTradeCreateRequest();
+        request.setNotifyUrl(MappingCache.getValue("ALIPAY", "temp"));
+        JSONObject bizContent = new JSONObject();
+        bizContent.put("out_trade_no", orderId);
+        bizContent.put("total_amount", money);
+        bizContent.put("subject", feeName);
+        bizContent.put("buyer_id", openId);
+        bizContent.put("timeout_express", "10m");
+        request.setBizContent(bizContent.toString());
+        AlipayTradeCreateResponse response = null;
+        try {
+            response = alipayClient.execute(request);
+            if (response.isSuccess()) {
+                return new ResultVo(ResultVo.CODE_OK, ResultVo.MSG_OK,orderId);
+            } else {
+                return new ResultVo(ResultVo.CODE_ERROR, response.getMsg());
+            }
+        } catch (AlipayApiException e) {
+            throw new CmdException("支付宝下单失败" + e);
+        }
+    }
+
     private SmallWeChatDto getSmallWechat(JSONObject paramIn) {
 
         SmallWeChatDto smallWeChatDto = new SmallWeChatDto();

+ 55 - 0
service-api/src/main/java/com/java110/api/controller/app/AliPayNotifyController.java

@@ -0,0 +1,55 @@
+package com.java110.api.controller.app;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.smo.payment.ITempCarFeeToNotifySMO;
+import com.java110.core.base.controller.BaseController;
+import com.java110.core.log.LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.ws.Action;
+import java.util.Map;
+
+@RestController
+@RequestMapping(path = "/app/alipay/notify")
+public class AliPayNotifyController extends BaseController {
+    private final static Logger logger = LoggerFactory.getLogger(PaymentController.class);
+
+    @Autowired
+    private ITempCarFeeToNotifySMO tempCarFeeToNotifySMOImpl;
+
+    /**
+     * <p>支付回调Api</p>
+     *
+     * @param request
+     * @throws Exception
+     */
+    @RequestMapping(path = "/receive", method = RequestMethod.POST)
+    public ResponseEntity<String> receive(HttpServletRequest request) {
+        JSONObject paramIn = new JSONObject();
+        for (String key : request.getParameterMap().keySet()) {
+            paramIn.put(key, request.getParameter(key));
+            logger.debug("支付宝回调报文form" + key + ":: " + request.getParameter(key));
+        }
+        logger.debug("支付宝支付回调报文" + paramIn.toJSONString());
+
+        /*接收参数*/
+        Map<String, String> params = getRequestParams(request);
+        System.out.println("params:" + params);
+        String sign = params.get("sign");
+        System.out.println(sign);
+
+        paramIn.put("resultInfo",request.getQueryString());
+
+
+        // 收到通知后记得返回SUCCESS
+        return tempCarFeeToNotifySMOImpl.aliPayToNotify(paramIn.toJSONString(), request);
+
+
+    }
+}

+ 8 - 0
service-api/src/main/java/com/java110/api/smo/payment/ITempCarFeeToNotifySMO.java

@@ -15,4 +15,12 @@ public interface ITempCarFeeToNotifySMO {
      * @return
      */
     public ResponseEntity<String> toNotify(String param,HttpServletRequest request);
+
+    /**
+     * 支付宝支付
+     * @param param
+     * @param request
+     * @return
+     */
+    ResponseEntity<String> aliPayToNotify(String param,HttpServletRequest request);
 }

+ 52 - 2
service-api/src/main/java/com/java110/api/smo/payment/impl/TempCarFeeToNotifySMOImpl.java

@@ -1,26 +1,39 @@
 package com.java110.api.smo.payment.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.java110.api.smo.AppAbstractComponentSMO;
 import com.java110.api.smo.payment.IOweFeeToNotifySMO;
 import com.java110.api.smo.payment.ITempCarFeeToNotifySMO;
 import com.java110.api.smo.payment.adapt.IOweFeeToNotifyAdapt;
 import com.java110.api.smo.payment.adapt.ITempCarFeeToNotifyAdapt;
+import com.java110.core.context.IPageData;
 import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.CommonConstant;
 import com.java110.utils.constant.WechatConstant;
 import com.java110.utils.factory.ApplicationContextFactory;
+import com.java110.utils.util.DateUtil;
 import com.java110.utils.util.StringUtil;
 import org.slf4j.Logger;
 import com.java110.core.log.LoggerFactory;
+import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
 
 @Service("tempCarFeeToNotifySMOImpl")
-public class TempCarFeeToNotifySMOImpl implements ITempCarFeeToNotifySMO {
+public class TempCarFeeToNotifySMOImpl extends AppAbstractComponentSMO implements ITempCarFeeToNotifySMO {
     private static final Logger logger = LoggerFactory.getLogger(TempCarFeeToNotifySMOImpl.class);
 
-    private static final String APP_ID = "992020011134400001";
+    /**
+     * 支付宝appId
+     */
+    private static final String APP_ID = "992022082855370008";
 
     private static final String DEFAULT_OWE_FEE_TO_NOTIFY_ADAPT = "wechatTempCarFeeToNotifyAdapt";// 默认微信通用支付
 
@@ -37,5 +50,42 @@ public class TempCarFeeToNotifySMOImpl implements ITempCarFeeToNotifySMO {
         return new ResponseEntity<String>(resXml, HttpStatus.OK);
     }
 
+    @Override
+    public ResponseEntity<String> aliPayToNotify(String param, HttpServletRequest request) {
+
+
+        String url = "alipay.notifyPayTempCarFee";
+        /**
+         *   postParameters.put("carNum", tempCarPayOrderDto.getCarNum());
+         *         postParameters.put("extPaId", tempCarPayOrderDto.getPaId());
+         *         postParameters.put("orderId", tempCarPayOrderDto.getOrderId());
+         *         postParameters.put("amount", tempCarPayOrderDto.getAmount());
+         *         postParameters.put("payTime", tempCarPayOrderDto.getPayTime());
+         *         postParameters.put("payType", tempCarPayOrderDto.getPayType());
+         */
+        ResponseEntity<String> responseEntity = super.callCenterService(getHeaders("-1"), param, url, HttpMethod.POST);
+
+        return responseEntity;
+    }
+
+    private Map<String, String> getHeaders(String userId) {
+        Map<String, String> headers = new HashMap<>();
+        headers.put(CommonConstant.HTTP_APP_ID.toLowerCase(), APP_ID);
+        headers.put(CommonConstant.HTTP_USER_ID.toLowerCase(), userId);
+        headers.put(CommonConstant.HTTP_TRANSACTION_ID.toLowerCase(), UUID.randomUUID().toString());
+        headers.put(CommonConstant.HTTP_REQ_TIME.toLowerCase(), DateUtil.getDefaultFormateTimeString(new Date()));
+        headers.put(CommonConstant.HTTP_SIGN.toLowerCase(), "");
+        return headers;
+    }
 
+
+    @Override
+    protected void validate(IPageData pd, JSONObject paramIn) {
+
+    }
+
+    @Override
+    protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) throws Exception {
+        return null;
+    }
 }

+ 54 - 0
springboot/src/main/java/com/java110/boot/controller/app/AliPayNotifyController.java

@@ -0,0 +1,54 @@
+package com.java110.boot.controller.app;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.boot.smo.payment.ITempCarFeeToNotifySMO;
+import com.java110.core.base.controller.BaseController;
+import com.java110.core.log.LoggerFactory;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Map;
+
+@RestController
+@RequestMapping(path = "/app/alipay/notify")
+public class AliPayNotifyController extends BaseController {
+    private final static Logger logger = LoggerFactory.getLogger(PaymentController.class);
+
+    @Autowired
+    private ITempCarFeeToNotifySMO tempCarFeeToNotifySMOImpl;
+
+    /**
+     * <p>支付回调Api</p>
+     *
+     * @param request
+     * @throws Exception
+     */
+    @RequestMapping(path = "/receive", method = RequestMethod.POST)
+    public ResponseEntity<String> receive(HttpServletRequest request) {
+        JSONObject paramIn = new JSONObject();
+        for (String key : request.getParameterMap().keySet()) {
+            paramIn.put(key, request.getParameter(key));
+            logger.debug("支付宝回调报文form" + key + ":: " + request.getParameter(key));
+        }
+        logger.debug("支付宝支付回调报文" + paramIn.toJSONString());
+
+        /*接收参数*/
+        Map<String, String> params = getRequestParams(request);
+        System.out.println("params:" + params);
+        String sign = params.get("sign");
+        System.out.println(sign);
+
+        paramIn.put("resultInfo",request.getQueryString());
+
+
+        // 收到通知后记得返回SUCCESS
+        return tempCarFeeToNotifySMOImpl.aliPayToNotify(paramIn.toJSONString(), request);
+
+
+    }
+}

+ 8 - 0
springboot/src/main/java/com/java110/boot/smo/payment/ITempCarFeeToNotifySMO.java

@@ -15,4 +15,12 @@ public interface ITempCarFeeToNotifySMO {
      * @return
      */
     public ResponseEntity<String> toNotify(String param,HttpServletRequest request);
+
+    /**
+     * 支付宝支付
+     * @param param
+     * @param request
+     * @return
+     */
+    ResponseEntity<String> aliPayToNotify(String param,HttpServletRequest request);
 }

+ 55 - 3
springboot/src/main/java/com/java110/boot/smo/payment/impl/TempCarFeeToNotifySMOImpl.java

@@ -1,24 +1,39 @@
 package com.java110.boot.smo.payment.impl;
 
+import com.alibaba.fastjson.JSONObject;
+import com.java110.boot.smo.AppAbstractComponentSMO;
+import com.java110.boot.smo.payment.IOweFeeToNotifySMO;
 import com.java110.boot.smo.payment.ITempCarFeeToNotifySMO;
+import com.java110.boot.smo.payment.adapt.IOweFeeToNotifyAdapt;
 import com.java110.boot.smo.payment.adapt.ITempCarFeeToNotifyAdapt;
-import com.java110.core.log.LoggerFactory;
+import com.java110.core.context.IPageData;
 import com.java110.utils.cache.MappingCache;
+import com.java110.utils.constant.CommonConstant;
 import com.java110.utils.constant.WechatConstant;
 import com.java110.utils.factory.ApplicationContextFactory;
+import com.java110.utils.util.DateUtil;
 import com.java110.utils.util.StringUtil;
 import org.slf4j.Logger;
+import com.java110.core.log.LoggerFactory;
+import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
 
 @Service("tempCarFeeToNotifySMOImpl")
-public class TempCarFeeToNotifySMOImpl implements ITempCarFeeToNotifySMO {
+public class TempCarFeeToNotifySMOImpl extends AppAbstractComponentSMO implements ITempCarFeeToNotifySMO {
     private static final Logger logger = LoggerFactory.getLogger(TempCarFeeToNotifySMOImpl.class);
 
-    private static final String APP_ID = "992020011134400001";
+    /**
+     * 支付宝appId
+     */
+    private static final String APP_ID = "992022082855370008";
 
     private static final String DEFAULT_OWE_FEE_TO_NOTIFY_ADAPT = "wechatTempCarFeeToNotifyAdapt";// 默认微信通用支付
 
@@ -35,5 +50,42 @@ public class TempCarFeeToNotifySMOImpl implements ITempCarFeeToNotifySMO {
         return new ResponseEntity<String>(resXml, HttpStatus.OK);
     }
 
+    @Override
+    public ResponseEntity<String> aliPayToNotify(String param, HttpServletRequest request) {
+
+
+        String url = "alipay.notifyPayTempCarFee";
+        /**
+         *   postParameters.put("carNum", tempCarPayOrderDto.getCarNum());
+         *         postParameters.put("extPaId", tempCarPayOrderDto.getPaId());
+         *         postParameters.put("orderId", tempCarPayOrderDto.getOrderId());
+         *         postParameters.put("amount", tempCarPayOrderDto.getAmount());
+         *         postParameters.put("payTime", tempCarPayOrderDto.getPayTime());
+         *         postParameters.put("payType", tempCarPayOrderDto.getPayType());
+         */
+        ResponseEntity<String> responseEntity = super.callCenterService(getHeaders("-1"), param, url, HttpMethod.POST);
+
+        return responseEntity;
+    }
+
+    private Map<String, String> getHeaders(String userId) {
+        Map<String, String> headers = new HashMap<>();
+        headers.put(CommonConstant.HTTP_APP_ID.toLowerCase(), APP_ID);
+        headers.put(CommonConstant.HTTP_USER_ID.toLowerCase(), userId);
+        headers.put(CommonConstant.HTTP_TRANSACTION_ID.toLowerCase(), UUID.randomUUID().toString());
+        headers.put(CommonConstant.HTTP_REQ_TIME.toLowerCase(), DateUtil.getDefaultFormateTimeString(new Date()));
+        headers.put(CommonConstant.HTTP_SIGN.toLowerCase(), "");
+        return headers;
+    }
+
+
+    @Override
+    protected void validate(IPageData pd, JSONObject paramIn) {
 
+    }
+
+    @Override
+    protected ResponseEntity<String> doBusinessProcess(IPageData pd, JSONObject paramIn) throws Exception {
+        return null;
+    }
 }