Browse Source

计量-中间计量申请小数,与计量总金额

qianxb 5 months ago
parent
commit
151ec0da5c

+ 14 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/InventoryFormApply.java

@@ -128,4 +128,18 @@ public class InventoryFormApply extends BaseEntity {
             this.currentMeterTotal = new BigDecimal(currentMeterTotal.stripTrailingZeros().toPlainString());
         }
     }
+
+    public BigDecimal getCurrentMeterMoney() {
+        if (currentMeterMoney == null){
+            return null;
+        }else {
+            return new BigDecimal(currentMeterMoney.stripTrailingZeros().toPlainString());
+        }
+    }
+
+    public void setCurrentMeterMoney(BigDecimal currentMeterMoney) {
+        if (currentMeterMoney != null) {
+            this.currentMeterMoney = new BigDecimal(currentMeterMoney.stripTrailingZeros().toPlainString());
+        }
+    }
 }

+ 16 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/MiddleMeterApply.java

@@ -137,4 +137,20 @@ public class MiddleMeterApply extends BaseEntity {
 
     @ApiModelProperty(value = "是否自动计量生成1(自动批量计量生成)0(手动新增)")
     private Integer isAutoBuild;
+
+
+
+    public BigDecimal getMeterMoney() {
+        if (meterMoney == null){
+            return null;
+        }else {
+            return new BigDecimal(meterMoney.stripTrailingZeros().toPlainString());
+        }
+    }
+
+    public void setMeterMoney(BigDecimal meterMoney) {
+        if (meterMoney != null) {
+            this.meterMoney = new BigDecimal(meterMoney.stripTrailingZeros().toPlainString());
+        }
+    }
 }

+ 14 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterInventoryVO.java

@@ -100,4 +100,18 @@ public class MeterInventoryVO {
     public void setAllMeterTotal(BigDecimal allMeterTotal) {
         this.allMeterTotal = new BigDecimal(allMeterTotal.stripTrailingZeros().toPlainString());
     }
+
+    public BigDecimal getCurrentMeterMoney() {
+        if (currentMeterMoney == null){
+            return null;
+        }else {
+            return new BigDecimal(currentMeterMoney.stripTrailingZeros().toPlainString());
+        }
+    }
+
+    public void setCurrentMeterMoney(BigDecimal currentMeterMoney) {
+        if (currentMeterMoney != null) {
+            this.currentMeterMoney = new BigDecimal(currentMeterMoney.stripTrailingZeros().toPlainString());
+        }
+    }
 }

+ 15 - 6
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MiddleMeterApplyMapper.xml

@@ -212,13 +212,22 @@
             and middle_meter_id != #{middleId}
         </if>
     </select>
+<!--    <select id="getCurrentMeterMoney" resultType="java.math.BigDecimal">-->
+<!--        select ifnull(sum(meter_money),0)-->
+<!--        from s_middle_meter_apply-->
+<!--        where contract_id = #{contractId} and is_deleted = 0 and approve_status != 3-->
+<!--        <if test="contractPeriodId != -1">-->
+<!--            and contract_period_id = #{contractPeriodId}-->
+<!--        </if>-->
+<!--    </select>-->
+
     <select id="getCurrentMeterMoney" resultType="java.math.BigDecimal">
-        select ifnull(sum(meter_money),0)
-        from s_middle_meter_apply
-        where contract_id = #{contractId} and is_deleted = 0 and approve_status != 3
-        <if test="contractPeriodId != -1">
-            and contract_period_id = #{contractPeriodId}
-        </if>
+        select ifnull(sum(current_period_pay),0)
+        from s_interim_pay_certificate_item where  chapter_seq='小计' and is_deleted = 0
+                and certificate_id =
+                (select id from s_interim_pay_certificate
+                    WHERE contract_id = #{contractId} and contract_period_id = #{contractPeriodId} and is_deleted = 0
+                )
     </select>
 
 

+ 4 - 4
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/MiddleMeterApplyServiceImpl.java

@@ -271,7 +271,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
                 formApply.setChangeBuildPictureTotal(l.getChangeTotal());
                 if (l.getCurrentMeterTotal() != null && l.getCurrentPrice() != null) {
                     formApply.setCurrentMeterTotal(l.getCurrentMeterTotal());
-                    formApply.setCurrentMeterMoney(l.getCurrentPrice().multiply(l.getCurrentMeterTotal()));
+                    formApply.setCurrentMeterMoney(l.getCurrentPrice().multiply(l.getCurrentMeterTotal()).setScale(0,RoundingMode.HALF_UP));
 
                 }else {
                     throw new ServiceException("单价和计量数量不能为空");
@@ -298,7 +298,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
              for (InventoryFormApply formApply : formApplies) {
                  big = big.add(formApply.getCurrentMeterMoney());
              }
-             apply.setMeterMoney(big);
+             apply.setMeterMoney(big.setScale(0,RoundingMode.HALF_UP));
             inventoryFormApplyService.saveBatch(formApplies);
         }else {
              throw new ServiceException("请添加需要计量的清单");
@@ -473,7 +473,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
                 formApply.setChangeBuildPictureTotal(l.getChangeTotal());
                 if (l.getCurrentMeterTotal() != null && l.getCurrentPrice() != null) {
                     formApply.setCurrentMeterTotal(l.getCurrentMeterTotal());
-                    formApply.setCurrentMeterMoney(l.getCurrentPrice().multiply(l.getCurrentMeterTotal()));
+                    formApply.setCurrentMeterMoney(l.getCurrentPrice().multiply(l.getCurrentMeterTotal()).setScale(0,RoundingMode.HALF_UP));
                 }else {
                     throw new ServiceException("单价和计量数量和支付比例不能为空");
                 }
@@ -499,7 +499,7 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
             for (InventoryFormApply formApply : formApplies) {
                 big = big.add(formApply.getCurrentMeterMoney());
             }
-            apply.setMeterMoney(big);
+            apply.setMeterMoney(big.setScale(0,RoundingMode.HALF_UP));
             inventoryFormApplyService.saveBatch(formApplies);
         }
         this.updateById(apply);