Quellcode durchsuchen

optimize temp car bug

java110 vor 3 Jahren
Ursprung
Commit
02ba380054

+ 25 - 25
service-acct/pom.xml

@@ -24,31 +24,31 @@
       <groupId>com.alipay.sdk</groupId>
       <artifactId>alipay-sdk-java</artifactId>
     </dependency>
-    <!--<dependency>-->
-      <!--<groupId>com.icbc</groupId>-->
-      <!--<artifactId>b2cVerify</artifactId>-->
-      <!--<version>2.0.0.5</version>-->
-    <!--</dependency>-->
-    <!--<dependency>-->
-      <!--<groupId>com.icbc</groupId>-->
-      <!--<artifactId>icbc</artifactId>-->
-      <!--<version>2.0.0.5</version>-->
-    <!--</dependency>-->
-    <!--<dependency>-->
-      <!--<groupId>com.icbc</groupId>-->
-      <!--<artifactId>icbc-api-sdk-cop</artifactId>-->
-      <!--<version>2.0.0.5</version>-->
-    <!--</dependency>-->
-    <!--<dependency>-->
-      <!--<groupId>com.icbc</groupId>-->
-      <!--<artifactId>icbc-api-sdk-cop-io</artifactId>-->
-      <!--<version>v1.0</version>-->
-    <!--</dependency>-->
-    <!--<dependency>-->
-      <!--<groupId>com.icbc</groupId>-->
-      <!--<artifactId>icbc-ca</artifactId>-->
-      <!--<version>2.0.0.5</version>-->
-    <!--</dependency>-->
+<!--    <dependency>-->
+<!--      <groupId>com.icbc</groupId>-->
+<!--      <artifactId>b2cVerify</artifactId>-->
+<!--      <version>2.0.0.5</version>-->
+<!--    </dependency>-->
+<!--    <dependency>-->
+<!--      <groupId>com.icbc</groupId>-->
+<!--      <artifactId>icbc</artifactId>-->
+<!--      <version>2.0.0.5</version>-->
+<!--    </dependency>-->
+<!--    <dependency>-->
+<!--      <groupId>com.icbc</groupId>-->
+<!--      <artifactId>icbc-api-sdk-cop</artifactId>-->
+<!--      <version>2.0.0.5</version>-->
+<!--    </dependency>-->
+<!--    <dependency>-->
+<!--      <groupId>com.icbc</groupId>-->
+<!--      <artifactId>icbc-api-sdk-cop-io</artifactId>-->
+<!--      <version>v1.0</version>-->
+<!--    </dependency>-->
+<!--    <dependency>-->
+<!--      <groupId>com.icbc</groupId>-->
+<!--      <artifactId>icbc-ca</artifactId>-->
+<!--      <version>2.0.0.5</version>-->
+<!--    </dependency>-->
 
   </dependencies>
   <build>

+ 21 - 9
service-acct/src/main/java/com/java110/acct/payment/adapt/icbc/IcbcPaymentFactoryAdapt.java.txt

@@ -23,7 +23,9 @@ import com.java110.dto.payment.PaymentOrderDto;
 import com.java110.dto.smallWeChat.SmallWeChatDto;
 import com.java110.intf.store.ISmallWechatV1InnerServiceSMO;
 import com.java110.intf.user.IOwnerAppUserInnerServiceSMO;
+import com.java110.utils.cache.CommonCache;
 import com.java110.utils.cache.MappingCache;
+import com.java110.utils.cache.UrlCache;
 import com.java110.utils.constant.WechatConstant;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
@@ -161,6 +163,9 @@ public class IcbcPaymentFactoryAdapt implements IPaymentFactoryAdapt {
         if (TRADE_TYPE_JSAPI.equals(tradeType)) {
             resultMap.putAll(JSONObject.toJavaObject(resMap, Map.class));
             //resultMap.put("sign", resultMap.get("paySign"));
+            resultMap.put("appId", resultMap.get("appid"));
+            resultMap.put("timeStamp", resultMap.get("timestamp"));
+            resultMap.put("nonceStr", resultMap.get("noncestr"));
         } else if (TRADE_TYPE_APP.equals(tradeType)) {
             resultMap.put("appId", smallWeChatDto.getAppId());
             resultMap.put("timeStamp", PayUtil.getCurrentTimeStamp());
@@ -236,12 +241,17 @@ public class IcbcPaymentFactoryAdapt implements IPaymentFactoryAdapt {
                bizContent.setOrder_apd_inf("");
         CardbusinessAggregatepayB2cOnlineConsumepurchaseResponseV1 response;
 
+        System.out.println("request:" + JSON.toJSONString(request));
+
+
         response = client.execute(request, System.currentTimeMillis() + "");//msgId消息通讯唯一编号,要求每次调用独立生成,APP级唯一
 
         if (response.getReturnCode() == 0) {
             // 6、业务成功处理,请根据接口文档用response.getxxx()获取同步返回的业务数据
             System.out.println("ReturnCode:" + response.getReturnCode());
             System.out.println("response:" + JSON.toJSONString(response));
+            CommonCache.setValue("icbc_"+icbcAppId,smallWeChatDto.getAppId(),CommonCache.PAY_DEFAULT_EXPIRE_TIME);
+            CommonCache.setValue("icbc_community_"+icbcAppId,smallWeChatDto.getObjId(),CommonCache.PAY_DEFAULT_EXPIRE_TIME);
             return JSONObject.parseObject(response.getWx_data_package());
         } else {
             // 失败
@@ -257,17 +267,17 @@ public class IcbcPaymentFactoryAdapt implements IPaymentFactoryAdapt {
         PaymentOrderDto paymentOrderDto = new PaymentOrderDto();
         JSONObject json = JSON.parseObject(param);
 
-        String appId;
-        if (json.containsKey("wId")) {
-            String wId = json.get("wId").toString();
-            wId = wId.replace(" ", "+");
-            appId = WechatFactory.getAppId(wId);
-        } else {
-            appId = json.get("appid").toString();
+        String appId = CommonCache.getAndRemoveValue("icbc_"+json.getString("app_id"));
+
+        if(StringUtil.isEmpty(appId)){
+            throw new IllegalArgumentException("支付通知失败");
         }
 
+        String communityId =   CommonCache.getAndRemoveValue("icbc_community_"+json.getString("app_id"));
+
         JSONObject paramIn = new JSONObject();
         paramIn.put("appId", appId);
+        paramIn.put("communityId", communityId);
         SmallWeChatDto smallWeChatDto = getSmallWechat(paramIn);
         if (smallWeChatDto == null) {
             throw new IllegalArgumentException("未配置公众号或者小程序信息");
@@ -280,12 +290,11 @@ public class IcbcPaymentFactoryAdapt implements IPaymentFactoryAdapt {
         params.put("app_id", json.getString("app_id"));
         params.put("charset", json.getString("charset"));
         params.put("format", json.getString("format"));
-        params.put("encrypt_type", json.getString("encrypt_type"));
         params.put("timestamp", json.getString("timestamp"));
         params.put("biz_content", json.getString("biz_content"));
         params.put("sign_type", json.getString("sign_type"));//目前上行网关签名暂时仅支持RSA
 
-        String path = "/app/payment/notify/icbc/992020011134400001\"";
+        String path ="/app/payment/notify/icbc/992020011134400001";
         String signStr = WebUtils.buildOrderedSignStr(path, params);
         String results = null;
         String responseBizContent = null;
@@ -298,6 +307,7 @@ public class IcbcPaymentFactoryAdapt implements IPaymentFactoryAdapt {
 
         boolean flag = false;
         String content = "";
+        System.out.println("signStr="+signStr);
         try {
             flag = IcbcSignature.verify(signStr, json.getString("sign_type"), apiPublicKey, json.getString("charset"), json.getString("sign"));
         } catch (IcbcApiException e) {
@@ -314,6 +324,8 @@ public class IcbcPaymentFactoryAdapt implements IPaymentFactoryAdapt {
                 } catch (IcbcApiException e) {
                     e.printStackTrace();
                 }
+            }else{
+                content = json.getString("biz_content");
             }
             /**********合作方/分行 业务逻辑处理**********/
             JSONObject map = JSONObject.parseObject(content);

+ 24 - 19
service-acct/src/main/java/com/java110/acct/smo/impl/NotifyPaymentV1InnerServiceSMOImpl.java

@@ -69,34 +69,39 @@ public class NotifyPaymentV1InnerServiceSMOImpl extends BaseServiceSMO implement
     @Override
     public ResponseEntity<String> notifyPayment(@RequestBody NotifyPaymentOrderDto notifyPaymentOrderDto) {
 
-        String payNotifyAdapt = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAYMENT_ADAPT);
-        payNotifyAdapt = StringUtil.isEmpty(payNotifyAdapt) ? DEFAULT_PAYMENT_NOTIFY_ADAPT : payNotifyAdapt;
+        try {
+            String payNotifyAdapt = MappingCache.getValue(WechatConstant.WECHAT_DOMAIN, WechatConstant.PAYMENT_ADAPT);
+            payNotifyAdapt = StringUtil.isEmpty(payNotifyAdapt) ? DEFAULT_PAYMENT_NOTIFY_ADAPT : payNotifyAdapt;
 //支付适配器IPayNotifyAdapt
-        logger.debug("适配器:" + payNotifyAdapt);
-        IPaymentFactoryAdapt tPayNotifyAdapt = ApplicationContextFactory.getBean(payNotifyAdapt, IPaymentFactoryAdapt.class);
-        PaymentOrderDto paymentOrderDto = tPayNotifyAdapt.java110NotifyPayment(notifyPaymentOrderDto.getParam());
-        logger.info("【支付回调响应】 响应内容:\n" + paymentOrderDto.getResponseEntity());
+            logger.debug("适配器:" + payNotifyAdapt);
+            IPaymentFactoryAdapt tPayNotifyAdapt = ApplicationContextFactory.getBean(payNotifyAdapt, IPaymentFactoryAdapt.class);
+            PaymentOrderDto paymentOrderDto = tPayNotifyAdapt.java110NotifyPayment(notifyPaymentOrderDto.getParam());
+            logger.info("【支付回调响应】 响应内容:\n" + paymentOrderDto.getResponseEntity());
 
-        if (StringUtil.isEmpty(paymentOrderDto.getOrderId())) {
-            return paymentOrderDto.getResponseEntity();
-        }
+            if (StringUtil.isEmpty(paymentOrderDto.getOrderId())) {
+                return paymentOrderDto.getResponseEntity();
+            }
 
-        String paramIn = CommonCache.getAndRemoveValue("unifiedPayment_" + paymentOrderDto.getOrderId());
+            String paramIn = CommonCache.getAndRemoveValue("unifiedPayment_" + paymentOrderDto.getOrderId());
 
-        JSONObject reqJson = JSONObject.parseObject(paramIn);
+            JSONObject reqJson = JSONObject.parseObject(paramIn);
 
-        IPaymentBusiness paymentBusiness = ApplicationContextFactory.getBean(reqJson.getString("business"), IPaymentBusiness.class);
+            IPaymentBusiness paymentBusiness = ApplicationContextFactory.getBean(reqJson.getString("business"), IPaymentBusiness.class);
 
-        if (paymentBusiness == null) {
-            throw new CmdException("当前支付业务不支持");
-        }
+            if (paymentBusiness == null) {
+                throw new CmdException("当前支付业务不支持");
+            }
 
-        paymentOrderDto.setAppId(notifyPaymentOrderDto.getAppId());
+            paymentOrderDto.setAppId(notifyPaymentOrderDto.getAppId());
 
-        //2.0 相应业务 下单 返回 单号 ,金额,
-        paymentBusiness.notifyPayment(paymentOrderDto, reqJson);
+            //2.0 相应业务 下单 返回 单号 ,金额,
+            paymentBusiness.notifyPayment(paymentOrderDto, reqJson);
 
 
-        return paymentOrderDto.getResponseEntity();
+            return paymentOrderDto.getResponseEntity();
+        }catch (Exception e){
+            logger.error("通知是配置异常",e);
+            throw e;
+        }
     }
 }

+ 1 - 1
service-common/src/main/java/com/java110/common/cmd/machineTranslate/MachineUploadCarLogCmd.java

@@ -193,7 +193,7 @@ public class MachineUploadCarLogCmd extends Cmd {
                 tempCarName = "临时车";
             }
 
-            int day = DateUtil.differentDaysUp(ownerCarDtos.get(0).getEndTime(),DateUtil.getCurrentDate());
+            int day = DateUtil.differentDaysUp(DateUtil.getCurrentDate(),ownerCarDtos.get(0).getEndTime());
 
             if(day <= -5){
                 tempCar = CAR_TYPE_NO_DATA;