瀏覽代碼

公式里统一处理pdf双引号问题,计量查看合同单元金额错误,试验记录编号无法正常保存

chenr 7 月之前
父節點
當前提交
3ef7b85bbe

+ 33 - 25
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -1130,31 +1130,39 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     private void updateRecordNoOrReportNo(TrialSelfInspectionRecord obj, TrialSelfInspectionRecordDTO dto) {
             JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
             //获取第一张表的数据  编号以第一张表为准
-            JSONObject jsonObject = dataArray.getJSONObject(0);
-            String pkeyId = jsonObject.getString("pkeyId");
-            String sql = "select * from m_wbs_tree_private where p_key_id =" + pkeyId;
-            WbsTreePrivate table = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
-            String fileUrl = table.getHtmlUrl();
-            try {
-                InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
-                String htmlString = IoUtil.readToString(fileInputStream);
-                htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
-                Document doc = Jsoup.parse(htmlString);
-                // 查找所有具有 placeholderxx 属性的元素
-                //表类型 1,9=记录表 2,10=报告单
-                if(table.getTableType() == 9 || table.getTableType() == 1){
-                    //记录表  以第一张表为准
-                     this.updateRecordNoOrReportNo(dto, jsonObject, doc, "记录编 号:", "record_no");
-                     this.updateRecordNoOrReportNo(dto, jsonObject, doc, "记录编号:", "record_no");
-                }else if(table.getTableType() == 10 || table.getTableType() == 2){
-                    //报告单
-                    this.updateRecordNoOrReportNo(dto,jsonObject,doc,"报告编号:","report_no");
-                    //:不一样 一个中文一个英文
-                    this.updateRecordNoOrReportNo(dto,jsonObject,doc,"报告编号:","report_no");
-                }
-            } catch (Exception e) {
-                log.error(e.getMessage());
-            }
+            List<JSONObject> dataList = dataArray.toJavaList(JSONObject.class);
+           // 根据 type 字段进行分组
+             Map<String, List<JSONObject>> groupedByType = dataList.stream()
+            .collect(Collectors.groupingBy(jsonObject -> jsonObject.getString("type")));
+          for (Map.Entry<String, List<JSONObject>> entry : groupedByType.entrySet()) {
+              List<JSONObject> jsonObjects = groupedByType.get(entry.getKey());
+              JSONObject   jsonObject = jsonObjects.get(0);
+              String pkeyId = jsonObject.getString("pkeyId");
+              String sql = "select * from m_wbs_tree_private where p_key_id =" + pkeyId;
+              WbsTreePrivate table = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<>(WbsTreePrivate.class));
+              String fileUrl = table.getHtmlUrl();
+              try {
+                  InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+                  String htmlString = IoUtil.readToString(fileInputStream);
+                  htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
+                  Document doc = Jsoup.parse(htmlString);
+                  // 查找所有具有 placeholderxx 属性的元素
+                  //表类型 1,9=记录表 2,10=报告单
+                  if(table.getTableType() == 9 || table.getTableType() == 1){
+                      //记录表  以第一张表为准
+                      this.updateRecordNoOrReportNo(dto, jsonObject, doc, "记录编 号:", "record_no");
+                      this.updateRecordNoOrReportNo(dto, jsonObject, doc, "记录编号:", "record_no");
+                  }else if(table.getTableType() == 10 || table.getTableType() == 2){
+                      //报告单
+                      this.updateRecordNoOrReportNo(dto,jsonObject,doc,"报告编号:","report_no");
+                      //  :不一样 一个中文一个英文
+                      this.updateRecordNoOrReportNo(dto,jsonObject,doc,"报告编号:","report_no");
+                  }
+              } catch (Exception e) {
+                  log.error(e.getMessage());
+              }
+          }
+
 
     }
 

+ 14 - 0
blade-service/blade-manager/src/main/java/com/mixsmart/utils/StringUtils.java

@@ -966,6 +966,20 @@ public class StringUtils {
         Matcher m = r.matcher(String.valueOf(value));
         return m.matches();
     }
+    /**
+     * @Description 是否包含双引号
+     * @Param [value]
+     * @return boolean
+     * @Author chenr
+     * @Date 2024.12.24 15:24
+     **/
+    public static boolean isDoubleQuotationMarks(Object value) {
+        if (value == null || value.toString().length() < 2) {
+            return false;
+        }
+        return value.toString().matches("^\"[^\"]*\"$");
+    }
+
 
     public static boolean isDouble(Object value) {
         return isNumber(value) && value.toString().contains(".");

+ 13 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -1156,7 +1156,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
             if(fd.verify()){
                 Formula formula =fd.getFormula();
                 System.out.println(formula.getId()+":"+fd.getEName());
-                if(fd.getId()==1575037732017668109L){
+                if(fd.getId()==1575046319821553669L){
                     System.out.println("");
                 }
                 String f=formula.getFormula();
@@ -1953,6 +1953,18 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                     Formula f = fd.getFormula();
                     fd.setValues(FormulaUtils.setScale(f.getScale(),fd.getValues()));
                 }
+                /*统一处理双引号*/
+                if(fd.getFormula()!=null&&!fd.empty()&&fd.getValues().stream().map(ElementData::getValue).anyMatch(StringUtils::isDoubleQuotationMarks)){
+                    List<ElementData> values = fd.getValues();
+                    if(values.size()>0){
+                        for (ElementData value : values) {
+                            Object value1 = value.getValue();
+                            if(ObjectUtil.isNotEmpty(value1)){
+                                value.setValue(value1.toString().replace("\"",""));
+                            }
+                        }
+                    }
+                }
             }
         }
         /*合格率显示*/

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

@@ -39,6 +39,7 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -726,9 +727,26 @@ public class MeterTreeController extends BladeController {
             List<MeterTreeLinkWbsTreeVO> wbsTreeVOS = meterTreeLinkWbsTreeService.getWbsListByMeterId(vo.getContractId(), vo.getId());
             vo.setLinkNodeList(wbsTreeVOS);
         } else {
-            meterTreeContractService.getAllChildNodeMoney(vo);
+            //meterTreeContractService.getAllChildNodeMoney(vo);
             //设置清单
             List<ContractFromVO> contrFormAllByContrId = contractInventoryFormService.getChildNodeResolveForm(vo.getContractId(), vo.getId());
+            //设置施工图金额和变更后金额
+            BigDecimal buildPictureMoney=new BigDecimal("0");
+            BigDecimal changeMoney=new BigDecimal("0");
+            if(!contrFormAllByContrId.isEmpty()){
+                for (ContractFromVO fromVO : contrFormAllByContrId) {
+                    if(fromVO.getCurrentPrice()!=null&&fromVO.getBuildPictureTotal()!=null){
+                        BigDecimal b1=fromVO.getCurrentPrice().multiply(fromVO.getBuildPictureTotal());
+                        buildPictureMoney=buildPictureMoney.add(b1);
+                    }
+                    if(fromVO.getCurrentPrice()!=null&&fromVO.getChangeTotal()!=null){
+                        BigDecimal b2=fromVO.getCurrentPrice().multiply(fromVO.getChangeTotal());
+                        changeMoney=changeMoney.add(b2);
+                    }
+                }
+            }
+            vo.setBuildPictureMoney(buildPictureMoney.setScale(2,BigDecimal.ROUND_HALF_UP));
+            vo.setChangeMoney(changeMoney.setScale(2,BigDecimal.ROUND_HALF_UP));
             vo.setDecompositionList(contrFormAllByContrId);
         }
         return R.data(vo);