Quellcode durchsuchen

fix:结算单修改

CAYK\miaosen.zhao vor 3 Tagen
Ursprung
Commit
8f4a6f3d6e

+ 4 - 2
src/main/java/com/inkasso/factoring/settlement/service/Impl/SettlementManagementServiceImpl.java

@@ -69,6 +69,7 @@ import com.inkasso.factoring.tradingPlatform.entity.Platform;
 import com.inkasso.factoring.tradingPlatform.service.ITradingPlatformService;
 import jodd.util.StringUtil;
 import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.math3.dfp.DfpField;
 import org.apache.poi.xwpf.usermodel.XWPFTable;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -908,7 +909,8 @@ public class SettlementManagementServiceImpl extends ServiceImpl<SettlementBasic
                 for (SettlementGoodsInfo settlementGoodsInfo : settlementGoodsInfos) {
                     Map<String, Object> map = new HashMap<>();
                     CAcceptanceGoodsInfo acceptanceGoodsInfo = icAcceptanceGoodsInfoService.getById(settlementGoodsInfo.getAcceptanceGoodsInfoId());
-                    amountSum = amountSum.add(settlementGoodsInfo.getPurchaseTotalPrice());
+                    BigDecimal purchasePrice = acceptanceGoodsInfo.getPurchasePrice() == null ? BigDecimal.ZERO : acceptanceGoodsInfo.getPurchasePrice();
+                    amountSum = amountSum.add(purchasePrice.multiply(acceptanceGoodsInfo.getGoodsQuantity());
                     i = i + 1;
                     map.put("id", i);
                     map.put("goodsName", acceptanceGoodsInfo.getGoodsName());
@@ -922,7 +924,7 @@ public class SettlementManagementServiceImpl extends ServiceImpl<SettlementBasic
                     num = num.add(settlementGoodsInfo.getGoodsQuantity());
                 }
                 dataMap.put("num", num);
-                dataMap.put("amountSum", amountSum);
+                dataMap.put("amountSum", amountSum.setScale(2, RoundingMode.ROUND_HALF_UP));
             }
             dataMap.put("dealGoodsList", dealGoodsList);
             File docxFile = null;