Эх сурвалжийг харах

Merge remote-tracking branch 'origin/master' into master

yangyj 1 жил өмнө
parent
commit
aae0f50fe6

+ 7 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/ResolveInventoryVO.java

@@ -37,4 +37,11 @@ public class ResolveInventoryVO {
     @ApiModelProperty(value = "分解剩余量")
     private BigDecimal resolveResidueTotal;
 
+    //下面两个属性为判断是否还有计量数量
+    @ApiModelProperty(value = "累计计量数量")
+    private BigDecimal allMeterTotal;
+
+    @ApiModelProperty(value = "实际为节点清单施工图变更后数量")
+    private BigDecimal ChangeTotal2;
+
 }

+ 1 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/InterimPayCertificateController.java

@@ -90,7 +90,7 @@ public class InterimPayCertificateController extends BladeController {
 			@ApiImplicitParam(name = "contractId", value = "合同id", required = true)
 	})
 	public R<IPage<InterimPayCertificate>> page(InterimPayCertificate interimPayCertificate, Query query) {
-		IPage<InterimPayCertificate> pages = interimPayCertificateService.page(Condition.getPage(query), Condition.getQueryWrapper(interimPayCertificate));
+		IPage<InterimPayCertificate> pages = interimPayCertificateService.page(Condition.getPage(query), Condition.getQueryWrapper(interimPayCertificate).orderByDesc("create_time"));
 		return R.data(pages);
 	}
 

+ 1 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MaterialStartStatementMapper.xml

@@ -28,7 +28,7 @@
         select *
         from s_material_start_statement mss
         where contract_id = #{statement.contractId} and type = #{statement.type} and is_deleted = 0
-        order by sort
+        order by create_time desc
     </select>
 
 

+ 5 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MiddleMeterApplyMapper.xml

@@ -40,7 +40,11 @@
     <select id="getFormList" resultType="org.springblade.meter.vo.ResolveInventoryVO">
         select id,form_number,form_name,current_price,contract_total,change_total,
                change_total as buildChangeTotal,
-                (change_total - IFNULL((select sum(build_picture_total) from s_inventory_form_meter where is_deleted = 0 and contract_form_id = cif.id),0)) as resolveResidueTotal
+                (change_total - IFNULL((select sum(build_picture_total) from s_inventory_form_meter where is_deleted = 0 and contract_form_id = cif.id),0)) as resolveResidueTotal,
+                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 ChangeTotal2,
+                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
         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=")">

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

@@ -115,6 +115,8 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
             return vos;
         }
         vos = baseMapper.getFormList(contractId, nodeId, list);
+        vos = vos.stream().filter(l-> !l.getAllMeterTotal().equals(l.getChangeTotal2()) && l.getChangeTotal2().compareTo(BigDecimal.ZERO) != 0)
+                .collect(Collectors.toList());
         return vos;
     }
 
@@ -133,8 +135,10 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
         vos = vos.stream().filter(l-> !l.getAllMeterTotal().equals(l.getChangeTotal()) && l.getChangeTotal().compareTo(BigDecimal.ZERO) != 0)
                             .collect(Collectors.toList());
         for (MeterInventoryVO vo : vos) {
-            //默认分解清单的比例为0
-            vo.setPayRatio(new BigDecimal(0));
+            //如果合同计量单元填写了比例,则默认分解清单的比例为0
+            if (vo.getUpPayRatio() != null) {
+                vo.setPayRatio(new BigDecimal(0));
+            }
             //设置其他计量总数
             vo.setOtherMeterTotal(vo.getAllMeterTotal().subtract(vo.getCurrentMeterTotal()));
             vo.setOtherPayRatio(vo.getOtherMeterTotal().divide(vo.getChangeTotal(), 4, RoundingMode.DOWN).multiply(new BigDecimal(100)).setScale(2));
@@ -232,20 +236,22 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
                     throw new ServiceException("单价和计量数量不能为空");
                 }
                 //校验比例是否在范围之内
-                if (l.getUpPayRatio() == null || l.getPayRatio() == null){
-                    throw new ServiceException("新增失败,支付比例不能为空");
-                }
-                if (apply.getIsLinkData() == 0) {
-                    if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(l.getUpPayRatio()) > 0) {
-                        throw new ServiceException("新增失败,累计支付比例大于计量单元,计量单元比例:"+l.getUpPayRatio()+",其他期计量比例:"+l.getOtherPayRatio());
+                if (l.getUpPayRatio() != null){
+                    if (l.getPayRatio() == null) {
+                        throw new ServiceException("新增失败,支付比例不能为空");
                     }
-                }else {
-                    if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(new BigDecimal(100)) > 0) {
-                        throw new ServiceException("新增失败,累计支付比例不能小于0大于100,其他期计量比例:"+l.getOtherPayRatio());
+                    if (apply.getIsLinkData() == 0) {
+                        if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(l.getUpPayRatio()) > 0) {
+                            throw new ServiceException("新增失败,累计支付比例大于计量单元,计量单元比例:"+l.getUpPayRatio()+",其他期计量比例:"+l.getOtherPayRatio());
+                        }
+                    }else {
+                        if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(new BigDecimal(100)) > 0) {
+                            throw new ServiceException("新增失败,累计支付比例不能小于0大于100,其他期计量比例:"+l.getOtherPayRatio());
+                        }
                     }
+                    formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(l.getUpPayRatio().divide(new BigDecimal(100))));
+                    formApply.setPayRatio(l.getPayRatio());
                 }
-                formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(l.getUpPayRatio().divide(new BigDecimal(100))));
-                formApply.setPayRatio(l.getPayRatio());
                 return formApply;
             }).collect(Collectors.toList());
              for (InventoryFormApply formApply : formApplies) {
@@ -405,20 +411,22 @@ public class MiddleMeterApplyServiceImpl extends BaseServiceImpl<MiddleMeterAppl
                     throw new ServiceException("单价和计量数量和支付比例不能为空");
                 }
                 //校验比例是否在范围之内
-                if (l.getUpPayRatio() == null || l.getPayRatio() == null){
-                    throw new ServiceException("新增失败,支付比例不能为空");
-                }
-                if (apply.getIsLinkData() == 0) {
-                    if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(l.getUpPayRatio()) > 0) {
-                        throw new ServiceException("新增失败,累计支付比例大于计量单元,计量单元比例:"+l.getUpPayRatio()+",其他期计量比例:"+l.getOtherPayRatio());
+                if (l.getUpPayRatio() != null ){
+                    if (l.getPayRatio() == null) {
+                        throw new ServiceException("修改失败,支付比例不能为空");
                     }
-                }else {
-                    if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(new BigDecimal(100)) > 0) {
-                        throw new ServiceException("新增失败,累计支付比例不能小于0大于100,其他期计量比例:"+l.getOtherPayRatio());
+                    if (apply.getIsLinkData() == 0) {
+                        if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(l.getUpPayRatio()) > 0) {
+                            throw new ServiceException("修改失败,累计支付比例大于计量单元,计量单元比例:"+l.getUpPayRatio()+",其他期计量比例:"+l.getOtherPayRatio());
+                        }
+                    }else {
+                        if (l.getPayRatio().compareTo(BigDecimal.ZERO) < 0 || l.getPayRatio().add(l.getOtherPayRatio()).compareTo(new BigDecimal(100)) > 0) {
+                            throw new ServiceException("修改失败,累计支付比例不能小于0大于100,其他期计量比例:"+l.getOtherPayRatio());
+                        }
                     }
+                    formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(l.getUpPayRatio().divide(new BigDecimal(100))));
+                    formApply.setPayRatio(l.getPayRatio());
                 }
-                formApply.setPayMoney(formApply.getCurrentMeterMoney().multiply(l.getUpPayRatio().divide(new BigDecimal(100))));
-                formApply.setPayRatio(l.getPayRatio());
                 return formApply;
             }).collect(Collectors.toList());
             for (InventoryFormApply formApply : formApplies) {