Browse Source

计量清单金额取整

qianxb 1 năm trước cách đây
mục cha
commit
6706635fe3

+ 2 - 2
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMaterialMapper.xml

@@ -48,10 +48,10 @@
         select id,material_number,material_name,unit,price
         from s_contract_material where is_deleted = 0 and contract_id = #{dto.contractId}
         <if test="dto.materialNumber != null and dto.materialNumber != ''">
-            and u.material_number like concat('%',#{dto.materialNumber},'%')
+            and material_number like concat('%',#{dto.materialNumber},'%')
         </if>
         <if test="dto.materialName != null and dto.materialName != ''">
-            and u.material_name like concat('%',#{dto.materialName},'%')
+            and material_name like concat('%',#{dto.materialName},'%')
         </if>
     </select>
     <select id="getLinkAllForm" resultType="org.springblade.meter.vo.GetLinkAllFormVO">

+ 2 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ChangeTokenFormServiceImpl.java

@@ -43,6 +43,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.*;
@@ -594,7 +595,7 @@ public class ChangeTokenFormServiceImpl extends BaseServiceImpl<ChangeTokenFormM
             ContractInventoryForm fo = new ContractInventoryForm();
             fo.setId(aLong);
             fo.setChangeTotal(inventory.getChangeAfterTotal());
-            fo.setChangeMoney(inventory.getChangeAfterMoney());
+            fo.setChangeMoney(inventory.getChangeAfterMoney().setScale(0, RoundingMode.HALF_UP));
             list2.add(fo);
         }
         //批量新增清单汇总到 变更令与计量单元中间表

+ 6 - 5
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractInventoryFormServiceImpl.java

@@ -41,6 +41,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -188,7 +189,7 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
                                 fo.setChangePrice(fo.getBidPrice());
                             }
                             if (fo.getContractTotal() != null && fo.getBidPrice() != null) {
-                                fo.setContractMoney(fo.getContractTotal().multiply(fo.getBidPrice()));
+                                fo.setContractMoney(fo.getContractTotal().multiply(fo.getBidPrice()).setScale(0, RoundingMode.HALF_UP));
                                 fo.setChangeMoney(fo.getContractMoney());
                             }
                         } else {
@@ -412,8 +413,8 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
                 form.setCurrentPrice(form.getBidPrice());
                 form.setChangePrice(form.getBidPrice());
                 form.setChangeTotal(form.getContractTotal());
-                form.setContractMoney(form.getBidPrice().multiply(form.getContractTotal()));
-                form.setChangeMoney(form.getChangePrice().multiply(form.getChangeTotal()));
+                form.setContractMoney(form.getBidPrice().multiply(form.getContractTotal()).setScale(0,RoundingMode.HALF_UP));
+                form.setChangeMoney(form.getChangePrice().multiply(form.getChangeTotal()).setScale(0,RoundingMode.HALF_UP));
             }
         }
         //设置层级
@@ -521,8 +522,8 @@ public class ContractInventoryFormServiceImpl extends BaseServiceImpl<ContractIn
                 form.setChangeMoney(new BigDecimal(0));
             }else {
                 form.setChangeTotal(form.getContractTotal());
-                form.setContractMoney(form.getBidPrice().multiply(form.getContractTotal()));
-                form.setChangeMoney(form.getChangePrice().multiply(form.getChangeTotal()));
+                form.setContractMoney(form.getBidPrice().multiply(form.getContractTotal()).setScale(0,RoundingMode.HALF_UP));
+                form.setChangeMoney(form.getChangePrice().multiply(form.getChangeTotal()).setScale(0,RoundingMode.HALF_UP));
             }
         }
         //当前节点的清单类型是否被修改了,