15178832520
2020-06-08 22651ce6313b3617b8713f11cefffaa4f9158590
调整支付接口
5个文件已修改
63 ■■■■■ 已修改文件
service-api/src/main/java/com/java110/api/listener/fee/PayFeePreListener.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/listener/fee/PayFeePreTempCarInoutListener.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-front/src/main/java/com/java110/front/smo/AppAbstractComponentSMO.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-front/src/main/java/com/java110/front/smo/payment/impl/ToPaySMOImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-front/src/main/java/com/java110/front/smo/payment/impl/ToPayTempCarInoutSMOImpl.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-api/src/main/java/com/java110/api/listener/fee/PayFeePreListener.java
@@ -10,6 +10,8 @@
import com.java110.core.smo.fee.IFeeInnerServiceSMO;
import com.java110.core.smo.community.IParkingSpaceInnerServiceSMO;
import com.java110.core.smo.community.IRoomInnerServiceSMO;
import com.java110.core.smo.store.ISmallWeChatInnerServiceSMO;
import com.java110.dto.smallWeChat.SmallWeChatDto;
import com.java110.entity.center.AppService;
import com.java110.entity.order.Orders;
import com.java110.core.event.service.api.ServiceDataFlowEvent;
@@ -22,6 +24,8 @@
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import java.util.List;
/**
 * @ClassName PayFeeListener
@@ -50,6 +54,8 @@
    @Autowired
    private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl;
    @Autowired
    private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl;
    @Override
@@ -92,6 +98,19 @@
        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
        paramOut.put("receivableAmount", paramObj.getString("receivableAmount"));
        SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
        smallWeChatDto.setObjId((String) paramObj.get("communityId"));
        smallWeChatDto.setAppId((String) paramObj.get("appId"));
        List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
        if(smallWeChatDtos.size() <= 0){
            throw new IllegalArgumentException("支付失败,小区未配置小程序信息");
        }
        //指定支付小区
        if("1000".equals(smallWeChatDtos.get(0).getObjType())){
            paramOut.put("payAppId",smallWeChatDtos.get(0).getAppId());
            paramOut.put("payMchId",smallWeChatDtos.get(0).getMchId());
        }
        responseEntity = new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
        dataFlowContext.setResponseEntity(responseEntity);
    }
service-api/src/main/java/com/java110/api/listener/fee/PayFeePreTempCarInoutListener.java
@@ -10,6 +10,8 @@
import com.java110.core.smo.fee.IFeeInnerServiceSMO;
import com.java110.core.smo.common.ICarInoutInnerServiceSMO;
import com.java110.core.smo.community.IRoomInnerServiceSMO;
import com.java110.core.smo.store.ISmallWeChatInnerServiceSMO;
import com.java110.dto.smallWeChat.SmallWeChatDto;
import com.java110.entity.center.AppService;
import com.java110.entity.order.Orders;
import com.java110.core.event.service.api.ServiceDataFlowEvent;
@@ -24,6 +26,7 @@
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import java.util.List;
import java.util.Map;
/**
@@ -53,6 +56,8 @@
    @Autowired
    private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl;
    @Autowired
    private ISmallWeChatInnerServiceSMO smallWeChatInnerServiceSMOImpl;
    @Override
@@ -97,6 +102,18 @@
        JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
        paramOut.put("receivableAmount", paramObj.getString("receivableAmount"));
        SmallWeChatDto smallWeChatDto = new SmallWeChatDto();
        smallWeChatDto.setObjId((String) paramObj.get("communityId"));
        smallWeChatDto.setAppId((String) paramObj.get("appId"));
        List<SmallWeChatDto> smallWeChatDtos = smallWeChatInnerServiceSMOImpl.querySmallWeChats(smallWeChatDto);
        if(smallWeChatDtos.size() <= 0){
            throw new IllegalArgumentException("支付失败,小区未配置小程序信息");
        }
        //指定支付小区
        if("1000".equals(smallWeChatDtos.get(0).getObjType())){
            paramOut.put("payAppId",smallWeChatDtos.get(0).getAppId());
            paramOut.put("payMchId",smallWeChatDtos.get(0).getMchId());
        }
        responseEntity = new ResponseEntity<>(paramOut.toJSONString(), HttpStatus.OK);
        dataFlowContext.setResponseEntity(responseEntity);
service-front/src/main/java/com/java110/front/smo/AppAbstractComponentSMO.java
@@ -69,7 +69,10 @@
     * @return
     * @throws Exception
     */
    protected Map<String, String> java110Payment(RestTemplate outRestTemplate,String feeName, String tradeType,String orderNum, double money, String openId) throws Exception {
    protected Map<String, String> java110Payment(RestTemplate outRestTemplate,
                                                 String feeName, String tradeType,
                                                 String orderNum, double money,
                                                 String openId,String payAppId,String payMchId) throws Exception {
        logger.info("【小程序支付】 统一下单开始, 订单编号=" + orderNum);
        SortedMap<String, String> resultMap = new TreeMap<String, String>();
//生成支付金额,开发环境处理支付金额数到0.01、0.02、0.03元
@@ -80,12 +83,20 @@
        Map<String, String> resMap = this.java110UnifieldOrder(outRestTemplate,feeName, orderNum, tradeType, payAmount, openId);
        if ("SUCCESS".equals(resMap.get("return_code")) && "SUCCESS".equals(resMap.get("result_code"))) {
            if(WechatAuthProperties.TRADE_TYPE_JSAPI.equals(tradeType)) {
                resultMap.put("appId", wechatAuthProperties.getAppId());
                if(payAppId != null){
                    resultMap.put("appId", payAppId);
                }else{
                    resultMap.put("appId", wechatAuthProperties.getAppId());
                }
                if(payMchId != null){
                    resultMap.put("sign", PayUtil.createSign(resultMap, payMchId));
                }else{
                    resultMap.put("sign", PayUtil.createSign(resultMap, wechatAuthProperties.getKey()));
                }
                resultMap.put("timeStamp", PayUtil.getCurrentTimeStamp());
                resultMap.put("nonceStr", PayUtil.makeUUID(32));
                resultMap.put("package", "prepay_id=" + resMap.get("prepay_id"));
                resultMap.put("signType", "MD5");
                resultMap.put("sign", PayUtil.createSign(resultMap, wechatAuthProperties.getKey()));
            }else if(WechatAuthProperties.TRADE_TYPE_APP.equals(tradeType)){
                resultMap.put("appId", wechatAuthProperties.getAppId());
                resultMap.put("timeStamp", PayUtil.getCurrentTimeStamp());
service-front/src/main/java/com/java110/front/smo/payment/impl/ToPaySMOImpl.java
@@ -83,9 +83,11 @@
        JSONObject realUserInfo = userResult.getJSONArray("users").getJSONObject(0);
        String openId = realUserInfo.getString("openId");
        String payAppId = orderInfo.getString("payAppId");
        String payMchId = orderInfo.getString("payMchId");
        //微信下单PayUtil
        Map result = super.java110Payment(outRestTemplate,paramIn.getString("feeName"),paramIn.getString("tradeType"), orderId, money, openId);
        Map result = super.java110Payment(outRestTemplate,paramIn.getString("feeName"),paramIn.getString("tradeType"), orderId, money, openId,payAppId,payMchId);
        responseEntity = new ResponseEntity(JSONObject.toJSONString(result), HttpStatus.OK);
        return responseEntity;
service-front/src/main/java/com/java110/front/smo/payment/impl/ToPayTempCarInoutSMOImpl.java
@@ -76,9 +76,11 @@
        JSONObject realUserInfo = userResult.getJSONArray("users").getJSONObject(0);
        String openId = realUserInfo.getString("openId");
        String payAppId = orderInfo.getString("payAppId");
        String payMchId = orderInfo.getString("payMchId");
        //微信下单PayUtil
        Map result = super.java110Payment(restTemplate,paramIn.getString("feeName"),paramIn.getString("tradeType"), orderId, money, openId);
        Map result = super.java110Payment(restTemplate,paramIn.getString("feeName"),paramIn.getString("tradeType"), orderId, money, openId,payAppId,payMchId);
        responseEntity = new ResponseEntity(JSONObject.toJSONString(result), HttpStatus.OK);
        return responseEntity;