Переглянути джерело

json长数值问题处理

yzc 2 роки тому
батько
коміт
c064b8c6d7
14 змінених файлів з 36 додано та 30 видалено
  1. 3 0
      hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRequestFundsServiceImpl.java
  2. 3 3
      hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java
  3. 1 1
      hx-purchase/src/main/java/com/fjhx/purchase/service/arrival/impl/ArrivalServiceImpl.java
  4. 1 1
      hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchasePayRecordDetailServiceImpl.java
  5. 1 1
      hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchasePayRecordServiceImpl.java
  6. 1 1
      hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchaseServiceImpl.java
  7. 2 2
      hx-purchase/src/main/java/com/fjhx/purchase/service/subscribe/impl/SubscribeDetailServiceImpl.java
  8. 2 2
      hx-purchase/src/main/java/com/fjhx/purchase/service/subscribe/impl/SubscribeServiceImpl.java
  9. 1 1
      hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlowByWdly.java
  10. 2 2
      hx-sale/src/main/java/com/fjhx/sale/service/documents/impl/DocumentsServiceImpl.java
  11. 2 2
      hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierInfoServiceImpl.java
  12. 2 2
      hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/quality/impl/QualityInfoServiceImpl.java
  13. 13 10
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockServiceImpl.java
  14. 2 2
      hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitServiceImpl.java

+ 3 - 0
hx-account/src/main/java/com/fjhx/account/service/account/impl/AccountRequestFundsServiceImpl.java

@@ -77,6 +77,9 @@ public class AccountRequestFundsServiceImpl extends ServiceImpl<AccountRequestFu
         Page<AccountRequestFundsVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
         //赋值部门名称、归属公司名称
         List<AccountRequestFundsVo> records = page.getRecords();
+        if(ObjectUtil.isEmpty(records)){
+            return page;
+        }
 
         //切换数据源
         DynamicDataSourceContextHolder.push(SourceConstant.COMMON);

+ 3 - 3
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -181,7 +181,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
             //将部门id转为字符串(帮助解决前端问题)
             json.put("deptId", json.getString("deptId"));
 
-            record.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+            record.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         }
 
         return page;
@@ -447,7 +447,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         if (ObjectUtil.isNotEmpty(victoriatouristJson)) {
             JSONObject json = JSONObject.parseObject(victoriatouristJson);
             json.put("deptId", SecurityUtils.getDeptId());
-            productInfoDto.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+            productInfoDto.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         }
         add(productInfoDto);
     }
@@ -511,7 +511,7 @@ public class ProductInfoServiceImpl extends ServiceImpl<ProductInfoMapper, Produ
         String victoriatouristJson = productInfo.getVictoriatouristJson();
         JSONObject json = ObjectUtil.isNotEmpty(victoriatouristJson) ? JSONObject.parseObject(victoriatouristJson) : new JSONObject();
         json.put("deptId", productInfoDto.getDeptId());
-        productInfo.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+        productInfo.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         updateById(productInfo);
     }
 

+ 1 - 1
hx-purchase/src/main/java/com/fjhx/purchase/service/arrival/impl/ArrivalServiceImpl.java

@@ -250,7 +250,7 @@ public class ArrivalServiceImpl extends ServiceImpl<ArrivalMapper, Arrival> impl
 
         json.put("arrivalId", arrival.getId());
         json.put("arrivalCode", arrival.getCode());
-        stockWait.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+        stockWait.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         stockWaitService.save(stockWait);
 
         //取出到货明细

+ 1 - 1
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchasePayRecordDetailServiceImpl.java

@@ -62,7 +62,7 @@ public class PurchasePayRecordDetailServiceImpl extends ServiceImpl<PurchasePayR
         String victoriatouristJson = purchase.getVictoriatouristJson();
         JSONObject json = ObjectUtil.isEmpty(victoriatouristJson) ? new JSONObject() : JSONObject.parseObject(victoriatouristJson);
         json.put("paidAmount", BigDecimal.ZERO);
-        purchase.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+        purchase.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         purchaseService.updateById(purchase);
 
         //清空付款记录记录信息

+ 1 - 1
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchasePayRecordServiceImpl.java

@@ -84,7 +84,7 @@ public class PurchasePayRecordServiceImpl extends ServiceImpl<PurchasePayRecordM
             String victoriatouristJson = purchase.getVictoriatouristJson();
             JSONObject json = ObjectUtil.isEmpty(victoriatouristJson) ? new JSONObject() : JSONObject.parseObject(victoriatouristJson);
             json.put("paidAmount", add);
-            purchase.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+            purchase.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
 
             purchaseService.updateById(purchase);
 

+ 1 - 1
hx-purchase/src/main/java/com/fjhx/purchase/service/purchase/impl/PurchaseServiceImpl.java

@@ -239,7 +239,7 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase>
                     JSONObject json = JSONObject.parseObject(victoriatouristJson);
                     String warehouseName = warehousesMap.get(json.getLong("receiptWarehouseId"));
                     json.put("receiptWarehouseName", warehouseName);
-                    purchaseVo.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+                    purchaseVo.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
                 }
             }
             //赋值到货状态

+ 2 - 2
hx-purchase/src/main/java/com/fjhx/purchase/service/subscribe/impl/SubscribeDetailServiceImpl.java

@@ -1,7 +1,7 @@
 package com.fjhx.purchase.service.subscribe.impl;
 
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONWriter;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
@@ -180,7 +180,7 @@ public class SubscribeDetailServiceImpl extends ServiceImpl<SubscribeDetailMappe
                 if (ObjectUtil.isNotEmpty(victoriatouristJson)) {
                     JSONObject json = JSONObject.parseObject(victoriatouristJson);
                     json.put("receiptWarehouseName", warehousesMap.get(json.getLong("receiptWarehouseId")));
-                    subscribeDetailVo.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+                    subscribeDetailVo.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
                 }
             }
         }

+ 2 - 2
hx-purchase/src/main/java/com/fjhx/purchase/service/subscribe/impl/SubscribeServiceImpl.java

@@ -1,7 +1,7 @@
 package com.fjhx.purchase.service.subscribe.impl;
 
 import cn.hutool.extra.spring.SpringUtil;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONWriter;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
@@ -128,7 +128,7 @@ public class SubscribeServiceImpl extends ServiceImpl<SubscribeMapper, Subscribe
             Warehouse warehouse = warehouseService.getById(receiptWarehouseId);
             if (ObjectUtils.isNotEmpty(victoriatouristJson)) {
                 json.put("receiptWarehouseName", warehouse.getName());
-                subscribe.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+                subscribe.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
             }
         }
         return subscribe;

+ 1 - 1
hx-sale/src/main/java/com/fjhx/sale/flow/PurchaseFlowByWdly.java

@@ -124,7 +124,7 @@ public class PurchaseFlowByWdly extends FlowDelegate {
                 String victoriatouristJson1 = purchase.getVictoriatouristJson();
                 JSONObject json1 = JSONObject.parseObject(victoriatouristJson1);
                 json1.put("receiptWarehouseId", receiptWarehouseId);
-                purchase.setVictoriatouristJson(json1.toJSONString(JSONWriter.Feature.WriteLongAsString));
+                purchase.setVictoriatouristJson(com.alibaba.fastjson2.JSONObject.toJSONString(json1,JSONWriter.Feature.WriteLongAsString));
                 purchaseService.updateById(purchase);
             }
             return purchase.getId();

+ 2 - 2
hx-sale/src/main/java/com/fjhx/sale/service/documents/impl/DocumentsServiceImpl.java

@@ -2,7 +2,7 @@ package com.fjhx.sale.service.documents.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONWriter;
 import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -393,7 +393,7 @@ public class DocumentsServiceImpl extends ServiceImpl<DocumentsMapper, Documents
             pdfData.setDocumentId(documents.getId());
             pdfData.setContractCode(contract.getCode());
             pdfData.setDataType(0);//报关单
-            pdfData.setContent(data.toJSONString(JSONWriter.Feature.WriteLongAsString));
+            pdfData.setContent(JSONObject.toJSONString(data,JSONWriter.Feature.WriteLongAsString));
         }
         return pdfData;
     }

+ 2 - 2
hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierInfoServiceImpl.java

@@ -4,7 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.ListUtil;
 import cn.hutool.core.stream.CollectorUtil;
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONWriter;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
@@ -133,7 +133,7 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
         JSONObject json = ObjectUtil.isNotEmpty(result.getVictoriatouristJson()) ? JSONObject.parseObject(result.getVictoriatouristJson()) : new JSONObject();
         json.put("accountPeriod",json.getString("accountPeriod"));
         json.put("returnPeriod",json.getString("returnPeriod"));
-        result.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+        result.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         return result;
     }
 

+ 2 - 2
hx-victoriatourist/src/main/java/com/fjhx/victoriatourist/service/quality/impl/QualityInfoServiceImpl.java

@@ -3,7 +3,7 @@ package com.fjhx.victoriatourist.service.quality.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONWriter;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@@ -257,7 +257,7 @@ public class QualityInfoServiceImpl extends ServiceImpl<QualityInfoMapper, Quali
             }
             json.put("frozenQuantity", frozenQuantity);
 
-            stock.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+            stock.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
             stockList.add(stock);
 
             StockJournalDetails stockJournalDetails = new StockJournalDetails();

+ 13 - 10
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockServiceImpl.java

@@ -2,8 +2,8 @@ package com.fjhx.wms.service.stock.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONWriter;
 import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -154,7 +154,10 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
                 BigDecimal defectiveQuantity = json.getBigDecimal("defectiveQuantity");
                 defectiveQuantity = ObjectUtil.isEmpty(defectiveQuantity) ? BigDecimal.ZERO : defectiveQuantity;
                 json.put("defectiveQuantity", defectiveQuantity);
-                item.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+
+                JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString);
+
+                item.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
             });
         }
 
@@ -179,7 +182,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
             JSONObject json = ObjectUtil.isNotEmpty(victoriatouristJson) ? JSONObject.parseObject(victoriatouristJson) : new JSONObject();
             String warehouseName = warehouseMap.get(json.getLong("warehouseId"));
             json.put("warehouseName", warehouseName);
-            stockVo.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+            stockVo.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         }
         return page;
     }
@@ -211,7 +214,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
             BigDecimal defectiveQuantity = stockVo.getDefectiveQuantity();
             defectiveQuantity = defectiveQuantity == null ? BigDecimal.ZERO : defectiveQuantity;
             json.put("defectiveQuantity", defectiveQuantity);
-            stockVo.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+            stockVo.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         }
 
         //赋值产品名称
@@ -239,7 +242,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
             BigDecimal defectiveQuantity = json.getBigDecimal("defectiveQuantity");
             defectiveQuantity = ObjectUtil.isEmpty(defectiveQuantity) ? BigDecimal.ZERO : defectiveQuantity;
             json.put("defectiveQuantity", defectiveQuantity);
-            item.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+            item.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         });
 
         //赋值产品分类
@@ -426,7 +429,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
                 frozenQuantity = frozenQuantity == null ? BigDecimal.ZERO : frozenQuantity;
                 frozenQuantity = frozenQuantity.add(stock.getQuantity());
                 json.put("frozenQuantity", frozenQuantity);
-                oldStocks.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+                oldStocks.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
             } else if (type == 4) {
                 //维多利亚待出库操作次品库存
                 String victoriatouristJson = oldStocks.getVictoriatouristJson();
@@ -442,7 +445,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
                     throw new ServiceException("以下商品次品库存不足,无法出库:" + productInfo.getName());
                 }
                 json.put("defectiveQuantity", defectiveQuantity);
-                oldStocks.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+                oldStocks.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
             } else {
                 throw new ServiceException("未知库存操作类型");
             }
@@ -482,7 +485,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
         }
         stock1.setQuantity(quantity.add(stock.getQuantity()));
         json.put("defectiveQuantity", defectiveQuantity.subtract(stock.getQuantity()));
-        stock1.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+        stock1.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         updateById(stock1);
     }
 
@@ -521,7 +524,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
         }
         stock1.setQuantity(quantity.subtract(stock.getQuantity()));
         json.put("defectiveQuantity", defectiveQuantity.add(stock.getQuantity()));
-        stock1.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+        stock1.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         updateById(stock1);
     }
 

+ 2 - 2
hx-wms/src/main/java/com/fjhx/wms/service/stock/impl/StockWaitServiceImpl.java

@@ -136,7 +136,7 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
             }
             JSONObject json = JSONObject.parseObject(victoriatouristJson);
             json.put("receiptWarehouseName", warehousesMap.get(json.getLong("receiptWarehouseId")));
-            stockWaitVo.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+            stockWaitVo.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         }
 
         return page;
@@ -233,7 +233,7 @@ public class StockWaitServiceImpl extends ServiceImpl<StockWaitMapper, StockWait
         String victoriatouristJson = stockWait.getVictoriatouristJson();
         JSONObject json = ObjectUtil.isNotEmpty(victoriatouristJson) ? JSONObject.parseObject(victoriatouristJson) : new JSONObject();
         json.put("receiptWarehouseId", stockWaitDto.getWarehouseId());
-        stockWait.setVictoriatouristJson(json.toJSONString(JSONWriter.Feature.WriteLongAsString));
+        stockWait.setVictoriatouristJson(JSONObject.toJSONString(json,JSONWriter.Feature.WriteLongAsString));
         updateById(stockWait);
 
         //操作库存