Kaynağa Gözat

商品字段bug

qzyReal 2 yıl önce
ebeveyn
işleme
a605093d3a

+ 2 - 2
app/utils/request.js

@@ -1,6 +1,6 @@
-const server = 'http://127.0.0.1:8099/pro';
+// const server = 'http://127.0.0.1:8099/pro';
 // const server = 'https://pco.aseanbusiness.cn/pro';
-// const server = 'https://dxkaa1.bgigc.com/pro';
+const server = 'https://dxkaa1.bgigc.com/pro';
 
 import common from '../common/js/common.js';
 

+ 15 - 1
sp-server/src/main/java/com/pj/api/jh/service/JhService.java

@@ -29,10 +29,12 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.nio.charset.Charset;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.Date;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -70,7 +72,7 @@ public class JhService {
             throw new BusinessException("金额不正确");
         }
         String openid = request.getParameter("openid");
-        String desc = request.getParameter("desc");
+        String desc = handlerDesc(request.getParameter("desc"));
         String businessId = request.getParameter("b");
         String c = request.getParameter("c");
         String a = request.getParameter("a");
@@ -125,6 +127,18 @@ public class JhService {
       //  return new HashMap<>();
     }
 
+    private    String handlerDesc(String desc){
+        if (StrUtil.isEmpty(desc)){
+            return "";
+        }
+        if (desc.getBytes(Charset.forName("utf-8")).length>128){
+            desc=StrUtil.sub(desc,0,desc.lastIndexOf("-"));
+            handlerDesc(desc);
+        }
+        return desc;
+    }
+
+
     public Map<String, Object> buildCheckParams(String outTradeNo) {
         Map<String, Object> params = new HashMap<>();
         params.put("businessMerchantNo", jhConfig.getBusinessMerchantNo());

+ 8 - 13
sp-server/src/main/java/com/pj/api/service/ApiService.java

@@ -62,6 +62,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
+import java.nio.charset.Charset;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
@@ -106,19 +107,7 @@ public class ApiService {
     private WxConfig wxConfig;
     @Resource
     private MyConfig myConfig;
-    @Resource
-    private TbCarService tbCarService;
-    @Resource
-    private RelationTypeItemService relationTypeItemService;
-
-    @Resource
-    private TbItemTypeService tbItemTypeService;
-
-    @Resource
-    private TbGoodsService tbGoodsService;
 
-    @Resource
-    private TbBusinessSortService tbBusinessSortService;
 
 
 
@@ -283,5 +272,11 @@ public class ApiService {
         });
         return list;
     }
-
+    public   String handlerDesc(String desc){
+        if (desc.getBytes(Charset.forName("utf-8")).length>128){
+            desc=StrUtil.sub(desc,0,desc.lastIndexOf("-"));
+            handlerDesc(desc);
+        }
+        return desc;
+    }
 }

+ 11 - 2
sp-server/src/main/java/com/pj/api/wx/service/WxService.java

@@ -115,7 +115,7 @@ public class WxService {
         params.put("mch_id", wxConfig.getMachId());
         params.put("openid", openid);
         params.put("nonce_str", RandomUtil.randomString(32));
-        params.put("body", desc);
+        params.put("body", handlerDesc(desc));
         params.put("out_trade_no", out_trade_no);
         // params.put("attach", JSONUtil.toJsonStr(atchMap));
         String total_free = partConfig.isTestEnv() ? "1" : NumberUtil.mul(money, 100 + "").intValue() + "";
@@ -359,5 +359,14 @@ public class WxService {
            wxSendMsgService.delete(wxSendMsg.getId());
         }
     }
-
+    private    String handlerDesc(String desc){
+        if (StrUtil.isEmpty(desc)){
+            return "";
+        }
+        if (desc.getBytes(Charset.forName("utf-8")).length>128){
+            desc=StrUtil.sub(desc,0,desc.lastIndexOf("-"));
+            handlerDesc(desc);
+        }
+        return desc;
+    }
 }

+ 1 - 0
sp-server/src/main/java/com/pj/project/tb_business/TbBusinessService.java

@@ -461,6 +461,7 @@ public class TbBusinessService extends ServiceImpl<TbBusinessMapper, TbBusiness>
     public Map<String, Object> getBusinessMoney(String businessCarId, String state) {
         Map<String, Object> result = new HashMap<>();
         List<TbBusiness> businessList = this.findOtherBusinessByCarId(businessCarId);
+        businessList=businessList.stream().filter(tbBusiness -> 3 != tbBusiness.getPayStatus()).collect(Collectors.toList());
         Set<TbBusinessCar> cars = new HashSet<>();
         //越南车是否需要支付
         int vietnamCarPay = businessList.stream().anyMatch(tbBusiness -> {