Parcourir la source

中间计量申请比例1

qianxb il y a 1 an
Parent
commit
784521af87

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

@@ -108,4 +108,10 @@ public class InventoryFormApply extends BaseEntity {
     @ApiModelProperty(value = "审批状态,0未上报,1待审批,2已审批,3已废除")
     private Integer approveStatus;
 
+    @ApiModelProperty(value = "最高支付比例")
+    private Integer upPayRatio;
+
+    @ApiModelProperty(value = "支付金额")
+    private BigDecimal PayMoney;
+
 }

+ 6 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/InventoryFormApplyTask.java

@@ -91,4 +91,10 @@ public class InventoryFormApplyTask extends BaseEntity {
     @ApiModelProperty(value = "审批状态,0未上报,1待审批,2已审批,3已废除")
     private Integer approveStatus;
 
+    @ApiModelProperty(value = "最高支付比例")
+    private Integer upPayRatio;
+
+    @ApiModelProperty(value = "支付金额")
+    private BigDecimal PayMoney;
+
 }

+ 3 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/InventoryFormMeter.java

@@ -81,4 +81,7 @@ public class InventoryFormMeter extends BaseEntity {
     @ApiModelProperty(value = "最高支付比例")
     private Integer upPayRatio;
 
+    @ApiModelProperty(value = "最高支付金额")
+    private BigDecimal upPayMoney;
+
 }

+ 3 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ContractFromVO.java

@@ -110,4 +110,7 @@ public class ContractFromVO {
 
     @ApiModelProperty(value = "最高支付比例")
     private Integer upPayRatio;
+
+    @ApiModelProperty(value = "最高支付比例金额")
+    private BigDecimal upPayMoney;
 }

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

@@ -64,5 +64,13 @@ public class MeterInventoryVO {
     @ApiModelProperty(value = "清单合同变更后数量")
     private BigDecimal contractChangeAllTotal;
 
+    @ApiModelProperty(value = "最高支付比例")
+    private Integer upPayRatio;
+
+    @ApiModelProperty(value = "最高支付金额")
+    private BigDecimal upPayMoney;
+
+    @ApiModelProperty(value = "其他期支付金额")
+    private BigDecimal otherPayMoney;
 
 }

+ 13 - 3
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MiddleMeterApplyMapper.xml

@@ -51,13 +51,19 @@
         select id,form_number,form_name,current_price,change_total as contractChangeAllTotal,
                IF (cif.build_change_total is null ,0,1) as isCreateDivide,
                (select is_over_meter from m_contract_info mci WHERE id = #{contractId}) as isContractOver,
+                (select up_pay_ratio from s_inventory_form_meter where is_deleted = 0
+                and contract_meter_id = #{nodeId} and contract_form_id = cif.id) as upPayRatio,
+                (select up_pay_money from s_inventory_form_meter where is_deleted = 0
+                and contract_meter_id = #{nodeId} and contract_form_id = cif.id) as upPayMoney,
                IFNULL((select sum(change_build_picture_total) from s_inventory_form_meter where is_deleted = 0
                     and contract_meter_id = #{nodeId} and contract_form_id = cif.id),0) as change_total,
                IFNULL((select sum(build_picture_total) from s_inventory_form_meter where is_deleted = 0
                             and contract_meter_id = #{nodeId} and contract_form_id = cif.id),0) as resolveTotal,
                0 as currentMeterTotal,0 as containChangeTotal,0 as currentMeterMoney,
                (IFNULL((select sum(current_meter_total) from s_inventory_form_apply where is_deleted = 0
-                            and contract_meter_id = #{nodeId} and contract_form_id = cif.id),0)) as allMeterTotal
+                            and contract_meter_id = #{nodeId} and contract_form_id = cif.id),0)) as allMeterTotal,
+                (IFNULL((select sum(pay_money) from s_inventory_form_apply where is_deleted = 0
+                and contract_meter_id = #{nodeId} and contract_form_id = cif.id),0)) as otherPayMoney
         from s_contract_inventory_form  cif where contract_id = #{contractId} and is_deleted = 0 and is_form_node = 1
         AND id in
         <foreach collection="ids" item="id" open="(" separator="," close=")">
@@ -121,7 +127,7 @@
     </select>
     <select id="getForm" resultType="org.springblade.meter.vo.MeterInventoryVO">
         select ifa.id as taskDetailId,ifa.contract_form_id as id,ifa.form_number,ifa.form_name,ifa.current_price,ifa.build_picture_total as resolveTotal,
-               ifa.change_build_picture_total as changeTotal,
+               ifa.change_build_picture_total as changeTotal,ifa.up_pay_ratio as upPayRatio,
                ifa.current_meter_total as currentMeterTotal,0 as containChangeTotal,
                ifa.current_meter_money as currentMeterMoney,
                (select cif.change_total  from s_contract_inventory_form cif where cif.id = ifa.contract_form_id ) as contractChangeAllTotal,
@@ -130,7 +136,11 @@
                (IFNULL((select sum(current_meter_total) from s_inventory_form_apply where is_deleted = 0
                       and contract_meter_id = #{nodeId} and contract_form_id = ifa.contract_form_id and id != ifa.id),0)) as otherMeterTotal,
                (IFNULL((select sum(current_meter_total) from s_inventory_form_apply where is_deleted = 0
-                      and contract_meter_id = #{nodeId} and contract_form_id = ifa.contract_form_id),0)) as allMeterTotal
+                      and contract_meter_id = #{nodeId} and contract_form_id = ifa.contract_form_id),0)) as allMeterTotal,
+               (IFNULL((select sum(pay_money) from s_inventory_form_apply where is_deleted = 0
+                      and contract_meter_id = #{nodeId} and contract_form_id = ifa.contract_form_id),0)) as otherPayMoney,
+               (select up_pay_money from s_inventory_form_meter ifm where ifm.is_deleted = 0
+                      and ifm.contract_meter_id = #{nodeId} and ifm.contract_form_id = ifa.contract_form_id) as upPayMoney
         from s_inventory_form_apply ifa
         where ifa.contract_id = #{contractId} and ifa.is_deleted = 0
         AND ifa.middle_meter_id = #{id}

+ 5 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/InventoryFormMeterServiceImpl.java

@@ -101,6 +101,9 @@ public class InventoryFormMeterServiceImpl extends BaseServiceImpl<InventoryForm
             if (vo.getBuildPictureTotal() == null){
                 throw new ServiceException("请填写施工图数量");
             }
+            if (vo.getUpPayRatio() == null){
+                throw new ServiceException("请填写最高支付比例");
+            }
             //校验当前节点下当前清单,是否在变更令中变更,或计量中计量
             if (vo.getCiteStatus() == 0 && formIsChange(meterId,vo.getContractFormId())){
                 throw new ServiceException("清单["+vo.getFormName()+"]已经变更或计量,请刷新页面");
@@ -108,6 +111,7 @@ public class InventoryFormMeterServiceImpl extends BaseServiceImpl<InventoryForm
             //统计
             vo.setBuildPictureMoney(vo.getCurrentPrice().multiply(vo.getBuildPictureTotal()));
             vo.setChangeBuildPictureMoney(vo.getCurrentPrice().multiply(vo.getChangeBuildPictureTotal()));
+            vo.setUpPayMoney(vo.getChangeBuildPictureMoney().multiply(new BigDecimal(vo.getUpPayRatio()).divide(new BigDecimal(100))));
             b1 = b1.add(vo.getBuildPictureMoney());
             b2 = b2.add(vo.getChangeBuildPictureMoney());
             //修改,如果是已经被引用则跳过
@@ -119,6 +123,7 @@ public class InventoryFormMeterServiceImpl extends BaseServiceImpl<InventoryForm
                        .set(InventoryFormMeter::getBuildPictureMoney,vo.getBuildPictureMoney())
                        .set(InventoryFormMeter::getChangeBuildPictureMoney,vo.getChangeBuildPictureMoney())
                        .set(InventoryFormMeter::getUpPayRatio,vo.getUpPayRatio())
+                       .set(InventoryFormMeter::getUpPayMoney,vo.getUpPayMoney())
                );
             }
         }

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

@@ -198,12 +198,14 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
                 formApply.setCurrentPrice(l.getCurrentPrice());
                 formApply.setBuildPictureTotal(l.getResolveTotal());
                 formApply.setChangeBuildPictureTotal(l.getChangeTotal());
-                if (l.getCurrentMeterTotal() != null && l.getCurrentPrice() != null) {
+                if (l.getCurrentMeterTotal() != null && l.getCurrentPrice() != null && l.getUpPayRatio() != null) {
                     formApply.setCurrentMeterTotal(l.getCurrentMeterTotal());
                     formApply.setCurrentMeterMoney(l.getCurrentPrice().multiply(l.getCurrentMeterTotal()));
+                    formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(new BigDecimal(l.getUpPayRatio()).divide(new BigDecimal(100))));
                 }else {
-                    throw new ServiceException("计量金额和计量数量不能为空");
+                    throw new ServiceException("单价和计量数量和支付比例不能为空");
                 }
+                formApply.setUpPayRatio(l.getUpPayRatio());
                 return formApply;
             }).collect(Collectors.toList());
              for (InventoryFormApply formApply : formApplies) {
@@ -345,12 +347,14 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
                 formApply.setCurrentPrice(l.getCurrentPrice());
                 formApply.setBuildPictureTotal(l.getResolveTotal());
                 formApply.setChangeBuildPictureTotal(l.getChangeTotal());
-                if (l.getCurrentMeterTotal() != null && l.getCurrentPrice() != null) {
+                if (l.getCurrentMeterTotal() != null && l.getCurrentPrice() != null && l.getUpPayRatio() != null) {
                     formApply.setCurrentMeterTotal(l.getCurrentMeterTotal());
                     formApply.setCurrentMeterMoney(l.getCurrentPrice().multiply(l.getCurrentMeterTotal()));
+                    formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(new BigDecimal(l.getUpPayRatio()).divide(new BigDecimal(100))));
                 }else {
-                    throw new ServiceException("计量金额和计量数量不能为空");
+                    throw new ServiceException("单价和计量数量和支付比例不能为空");
                 }
+                formApply.setUpPayRatio(l.getUpPayRatio());
                 return formApply;
             }).collect(Collectors.toList());
             for (InventoryFormApply formApply : formApplies) {