ソースを参照

Merge remote-tracking branch 'origin/master'

chenr 2 ヶ月 前
コミット
13424c8155
19 ファイル変更191 行追加69 行削除
  1. 3 0
      blade-common/src/main/java/org/springblade/common/utils/BaseUtils.java
  2. 2 6
      blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/AliOssBuilder.java
  3. 5 5
      blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/OssBuilder.java
  4. 1 1
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MeterInfo.java
  5. 7 1
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/SubprojectInterimPaymentSummary.java
  6. 14 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/InventoryFormApply.java
  7. 16 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/MiddleMeterApply.java
  8. 14 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/vo/MeterInventoryVO.java
  9. 64 6
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java
  10. 1 1
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/FormulaUtils.java
  11. 1 1
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/StringUtils.java
  12. 0 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  13. 3 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorFormat.java
  14. 6 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorMeter.java
  15. 9 4
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java
  16. 18 7
      blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java
  17. 8 22
      blade-service/blade-manager/src/main/java/org/springblade/manager/utils/PdfAddimgUtil.java
  18. 15 6
      blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/MiddleMeterApplyMapper.xml
  19. 4 4
      blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/MiddleMeterApplyServiceImpl.java

+ 3 - 0
blade-common/src/main/java/org/springblade/common/utils/BaseUtils.java

@@ -162,6 +162,9 @@ public class BaseUtils {
     public static String bigDecimalScale(Object s,int scale){
              return str2BigDecimal(s).setScale(scale,RoundingMode.HALF_UP).stripTrailingZeros().toPlainString();
     }
+    public static String stripTrailingZeros(Object s){
+        return str2BigDecimal(s).stripTrailingZeros().toPlainString();
+    }
 
     /*默认返回零*/
     public static Double obj2DoubleZero(Object obj) {

+ 2 - 6
blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/AliOssBuilder.java

@@ -21,13 +21,9 @@ import com.aliyun.oss.OSSClient;
 import com.aliyun.oss.common.auth.CredentialsProvider;
 import com.aliyun.oss.common.auth.DefaultCredentialProvider;
 import lombok.SneakyThrows;
-import org.springblade.core.oss.AliossTemplate;
-import org.springblade.core.oss.OssTemplate;
 import org.springblade.core.oss.props.OssProperties;
 import org.springblade.core.oss.rule.BladeOssRule;
-import org.springblade.core.oss.rule.OssRule;
 import org.springblade.resource.builder.ossre.AliossTemplateRe;
-import org.springblade.resource.builder.ossre.OssTemplateRe;
 import org.springblade.resource.entity.Oss;
 
 /**
@@ -55,8 +51,8 @@ public class AliOssBuilder {
         conf.setMaxErrorRetry(5);
         OssProperties ossProperties = new OssProperties();
 
-        //ossProperties.setEndpoint(oss.getEndpoint());
-       ossProperties.setEndpoint("https://oss-cn-shenzhen.aliyuncs.com/");
+        ossProperties.setEndpoint(oss.getEndpoint());
+
 
         ossProperties.setAccessKey(oss.getAccessKey());
         ossProperties.setSecretKey(oss.getSecretKey());

+ 5 - 5
blade-ops/blade-resource/src/main/java/org/springblade/resource/builder/oss/OssBuilder.java

@@ -21,15 +21,15 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.log.exception.ServiceException;
-import org.springblade.core.oss.OssTemplate;
 import org.springblade.core.oss.enums.OssEnum;
 import org.springblade.core.oss.enums.OssStatusEnum;
 import org.springblade.core.oss.props.OssProperties;
 import org.springblade.core.oss.rule.BladeOssRule;
-import org.springblade.core.oss.rule.OssRule;
 import org.springblade.core.secure.utils.AuthUtil;
-import org.springblade.core.tool.utils.*;
-import org.springblade.resource.builder.ossre.AliossTemplateRe;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.StringPool;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.core.tool.utils.WebUtil;
 import org.springblade.resource.builder.ossre.OssTemplateRe;
 import org.springblade.resource.entity.Oss;
 import org.springblade.resource.service.IOssService;
@@ -38,7 +38,6 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 import static org.springblade.core.cache.constant.CacheConstant.RESOURCE_CACHE;
-import static org.springblade.resource.builder.oss.AliOssBuilder.*;
 
 /**
  * Oss云存储统一构建类
@@ -86,6 +85,7 @@ public class OssBuilder {
         String tenantId = AuthUtil.getTenantId();
         Oss oss = getOss(tenantId, code);
        // oss.setEndpoint("http://183.247.216.148:9000/");
+        //oss.setEndpoint("https://oss-cn-shenzhen.aliyuncs.com/");
         Oss ossCached = ossPool.get(tenantId);
         OssTemplateRe template = templatePool.get(tenantId);
         // 若为空或者不一致,则重新加载

+ 1 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MeterInfo.java

@@ -101,7 +101,7 @@ public class MeterInfo {
         return Collections.emptyList();
     }
 
-    /*中期支付证书里的*/
+    /**中期支付证书里的*/
     private List<InterimPayCertificateItem> interimPayCertificateItems =new ArrayList<>();
 
     public Map<Long,LinkedHashMap<String,InterimPayCertificateItem>> getInterimPayCertificateItemGroup(){

+ 7 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/SubprojectInterimPaymentSummary.java

@@ -107,11 +107,17 @@ public class SubprojectInterimPaymentSummary  implements  DataModel{
 
     public void calculate(List<SubprojectInterimPaymentSummary> data,Integer scale){
         if(data!=null&&data.size()>0){
-
+            /*合同金额*/
+            count(this::setContractMoney,data,SubprojectInterimPaymentSummary::getContractMoney,scale);
             /*本次支付*/
             count(this::setCurrentPeriodPay,data,SubprojectInterimPaymentSummary::getCurrentPeriodPay,scale);
             /*本次累计支付*/
             count(this::setCurrentPeriodEndPay,data,SubprojectInterimPaymentSummary::getCurrentPeriodEndPay,scale);
+            if(BigDecimal.ZERO.compareTo(BaseUtils.str2BigDecimal(this.contractMoney))==0)return;
+            BigDecimal ra=BaseUtils.str2BigDecimal(this.currentPeriodPay).multiply(new BigDecimal(100)).divide(BaseUtils.str2BigDecimal(this.contractMoney),2,RoundingMode.HALF_UP);
+            if(BigDecimal.ZERO.compareTo(ra)<0) {
+                setPayRatio(ra.stripTrailingZeros().toPlainString()+"%");
+            }
         }
     }
 

+ 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());
+        }
+    }
 }

+ 64 - 6
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -975,12 +975,14 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String selfSubmit(TrialSelfInspectionRecordDTO dto) throws FileNotFoundException {
+
         //------初始当前填报的表pKeyIds------
         this.initTrialTabIds(dto);
 
-        //------初始编号信息------
-        this.initBuildNumber(dto);
-
+        if(!this.judgingParameters(dto)){
+            //------初始编号信息------
+            this.initBuildNumber(dto);
+        }
         //------新增或编辑------
         this.saveOrUpdate(dto);
 
@@ -990,7 +992,9 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
             //如果传递了就修改对应记录的值
             this.updateRecordNoOrReportNo(obj, dto);
             //------编辑时记录表编号或报告单编号为Null的重新生成------
-            this.reBuildNumber(obj, dto);
+            if(this.judgingParameters(dto)){
+                this.reBuildNumber(obj, dto);
+            }
 
             //------保存实体表数据、试验记录信息、生成PDF------
             this.submitTrialData(obj, dto);
@@ -1039,15 +1043,65 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
                 if("1".equals(singleTableType[i])){
                     //记录表
                     this.updateRecordNoOrReportNo(dto,jsonObject,doc,"记录编 号:","record_no");
+                    this.updateRecordNoOrReportNo(dto,jsonObject,doc,"记录编号:","record_no");
                 }else if("2".equals(singleTableType[i])){
                     //报告单
                     this.updateRecordNoOrReportNo(dto,jsonObject,doc,"报告编号:","report_no");
                 }
             } catch (Exception e) {
-
+                log.error(e.getMessage());
             }
+        }
+    }
 
+    /**
+     * 判断入参中用户是否自己手动填写了 报告编号或者记录编号
+     * @param dto
+     * @return
+     */
+    private boolean judgingParameters(TrialSelfInspectionRecordDTO dto) {
+        JSONArray dataArray = dto.getDataInfo().getJSONArray("orderList");
+        for (int i = 0; i < dataArray.size(); i++) {
+            JSONObject jsonObject = dataArray.getJSONObject(i);
+            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);
+                //可能出现的几种情况 4种情况 记录编 号: 记录编号: 报告编号: 编号:
+                Elements elementsWithPlaceholderxx = doc.select("[placeholderxx='记录编 号:']");
+                if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+                    elementsWithPlaceholderxx = doc.select("[placeholderxx='记录编号:']");
+                    if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+                        elementsWithPlaceholderxx = doc.select("[placeholderxx='报告编号:']");
+                        if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+                            elementsWithPlaceholderxx = doc.select("[placeholderxx='编号:']");
+                        }
+                    }
+                }
+                //没找到直接返回false
+                if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+                    log.error("方法:private boolean JudgingParameters(TrialSelfInspectionRecordDTO dto)中 未找到元素");
+                    return false;
+                }
+                Element first = elementsWithPlaceholderxx.first();
+                String key = first.attr("id");
+                //记录编号或者报告编号的值
+                String recordOrReportNo = jsonObject.getString(key);
+                if(recordOrReportNo != null || "".equals(recordOrReportNo)){
+                    return true;
+                }else {
+                    return false;
+                }
+            } catch (Exception e) {
+                log.error(e.getMessage());
+            }
         }
+        return false;
     }
 
     /**
@@ -1060,10 +1114,14 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
      */
     private void updateRecordNoOrReportNo(TrialSelfInspectionRecord dto,JSONObject jsonObject,Document doc,String  value, String fileVlue) {
         Elements elementsWithPlaceholderxx = doc.select("[placeholderxx="+value+"]");
-        if((elementsWithPlaceholderxx.size() == 0 ||elementsWithPlaceholderxx == null) && value.equals("报告编号:")){
+        if((elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null) && value.equals("报告编号:")){
+            //特殊情况
             value = "编号:";
             elementsWithPlaceholderxx = doc.select("[placeholderxx="+value+"]");
         }
+        if(elementsWithPlaceholderxx.size() == 0 || elementsWithPlaceholderxx == null){
+            return;
+        }
         Element first = elementsWithPlaceholderxx.first();
         String key = first.attr("id");
         //记录编号或者报告编号的值

+ 1 - 1
blade-service/blade-manager/src/main/java/com/mixsmart/utils/FormulaUtils.java

@@ -938,7 +938,7 @@ public class FormulaUtils {
     /*不会自动识别小数位*/
     public static List<ElementData> setScaleMeter(Integer scale, List<ElementData> data){
         if(scale!=null){
-            return data.stream().peek(e->{if(StringUtils.isDouble(e.getValue())){e.setValue(StringUtils.number2StringZero(e.getValue(),scale));}}).collect(Collectors.toList());
+            return data.stream().peek(e->{if(StringUtils.isDouble(e.getValue())){e.setValue(StringUtils.number2String(e.getValue(),scale));}}).collect(Collectors.toList());
         }
        return data;
     }

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

@@ -1185,7 +1185,7 @@ public class StringUtils {
             }
             String val = new BigDecimal(handleNull(number)).setScale(handleObj2Integer(scale), BigDecimal.ROUND_HALF_UP).toString();
             if (val.contains(".")) {
-                return new BigDecimal(val).toString().replaceAll("(0+|\\.0+)$", "");
+                return new BigDecimal(val).stripTrailingZeros().toPlainString();
             }
             return val;
         }

+ 0 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -22,7 +22,6 @@ import org.apache.commons.codec.Charsets;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.poi.ss.usermodel.WorkbookFactory;
-import org.jetbrains.annotations.TestOnly;
 import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
@@ -4093,7 +4092,6 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "contractId", value = "合同段id", required = true)
     })
     public R<List<Map<String, Object>>> getBussDataInfoTrialentrust(Long id, Long pkeyId, Long contractId, Long sampleId) {
-
         List<Map<String, Object>> bussDataInfoTrial = excelTabService.getBussDataInfoTrialentrust(id, pkeyId, contractId,sampleId);
         return R.data(bussDataInfoTrial);
     }

+ 3 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorFormat.java

@@ -19,7 +19,7 @@ import java.util.stream.IntStream;
 /**
  * @author yangyj
  * @Date 2023/12/18 14:24
- * @description TODO
+ * @description 格式化
  */
 @EqualsAndHashCode(callSuper = true)
 @Data
@@ -65,6 +65,8 @@ public class ExecutorFormat extends FormulaExecutor {
                     fd.getValues().forEach(ed -> {
                         if (BaseUtils.isZero(ed.getValue())) {
                             ed.setValue(StringPool.EMPTY);
+                        }else  if(BaseUtils.isNumber(ed.getValue())&&ed.stringValue().endsWith("0")){
+                            ed.setValue(BaseUtils.stripTrailingZeros(ed.getValue()));
                         }
                     });
                 }

+ 6 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorMeter.java

@@ -2461,8 +2461,9 @@ public class ExecutorMeter extends FormulaExecutor {
                 tfd.setRepeat(true);
                 /*根据依赖获取输出目标元素*/
                 elementWriter.write(tfd,pageSum);
-                tec.periodInfo.setMeterNumber(StringUtils.handleNull(pageSum));
+                //tec.periodInfo.setMeterNumber(StringUtils.handleNull(pageSum));
             });
+            tec.periodInfo.setMeterNumber(StringUtils.handleNull(pageSum));
 
         }
 
@@ -2493,7 +2494,10 @@ public class ExecutorMeter extends FormulaExecutor {
 
         /*删除没有计量的章节*/
         public LinkedHashMap<String,NodeTable> removeNodeTable(LinkedHashMap<String,List<MeterApply>> meterApplyGroup){
-            List<NodeTable> table2E16= tec.getTableAll().stream().filter(e-> Pattern.matches("【2-16】工程计量表\\(\\d+章\\)",e.getNodeName().replaceAll("\\s+",""))).collect(Collectors.toList());
+            List<NodeTable> table2E16= tec.getTableAll().stream().filter(e-> Pattern.matches("【2-16】工程计量表(\\(\\d+章\\))?",e.getNodeName().replaceAll("\\s+",""))).collect(Collectors.toList());
+            table2E16.stream().filter(e->e.getNodeName().equals("【2-16】工程计量表")).findAny().ifPresent(t->{
+                t.setNodeName(t.getNodeName()+"(100章)");
+            });
             List<String>chapters =new ArrayList<>(meterApplyGroup.keySet());
             List<Long> removeIds=table2E16.stream().filter(t->!BaseUtils.inChain(chapters,t.getNodeName())).map(NodeTable::getPKeyId).collect(Collectors.toList());
             /*删除没有计量的章节*/

+ 9 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -4430,8 +4430,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
             htmlString = htmlString.replaceAll("title", "titlexx");
             Document doc = Jsoup.parse(htmlString);
-            //通过html获取页面上的key值 返回key值对应的数据
-            setBasicFormData(doc, reData, sampleInfo, trialMaterialMobilization,null);
+
             if (dataIn.size() >= 1) {
                 Map<String, Object> mysqlData = dataIn.get(0);
                 for (String key : mysqlData.keySet()) {
@@ -4497,10 +4496,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     }
                 }
             }
+            //通过html获取页面上的key值 返回key值对应的数据
+            setBasicFormData(doc, reData, sampleInfo, trialMaterialMobilization,null);
         } catch (Exception e) {
             e.printStackTrace();
         }
 
+
         // 获取默认值
         QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
         queryWrapper.select("col_key", "sig_role_name");
@@ -4530,7 +4532,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     }
 
     private static void setBasicFormData(Document doc, Map<String, Object> reData, TrialSampleInfo sampleInfo ,TrialMaterialMobilization trialMaterialMobilization, EntrustInfo entrustInfo) {
-        setFirstData(doc,"委托编号",entrustInfo.getEntrustNo(),reData);
+        if(entrustInfo != null){
+            setFirstData(doc,"委托编号",entrustInfo.getEntrustNo(),reData);
+        }
         setFirstData(doc,"样品编号",sampleInfo.getSpecificationNumber(),reData);
         setFirstData(doc,"取样地点",sampleInfo.getSamplingLocation(),reData);
         setFirstData(doc,"样品描述",sampleInfo.getSampleDescription(),reData);
@@ -4545,12 +4549,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             setFirstData(doc,"生产厂家",trialMaterialMobilization.getPlaceOfProduction(),reData);
         }
         String representativeCount = sampleInfo.getRepresentativeCount();
+        String calculationUnit = sampleInfo.getCalculationUnit();
         Date mobilizationDate = sampleInfo.getMobilizationDate();
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm");
         String format = simpleDateFormat.format(mobilizationDate);
         setFirstData(doc,"批号",sampleInfo.getBatchNumber(),reData);
         setFirstData(doc,"拟用结构部 位",sampleInfo.getProposedPosition(),reData);
-        setFirstData(doc,"进场日期代表数量",format+representativeCount,reData);
+        setFirstData(doc,"进场日期代表数量",format+"/"+representativeCount+calculationUnit,reData);
     }
     private static void setFirstData(Document doc, String elementValue,Object value,Map<String, Object> reData) {
 

+ 18 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java

@@ -1,22 +1,23 @@
 package org.springblade.manager.utils;
 
-import com.aliyun.oss.common.utils.DateUtil;
-import com.aspose.cells.License;
 import com.aspose.cells.PdfSaveOptions;
 import com.aspose.cells.SaveFormat;
 import com.aspose.cells.Workbook;
 import com.itextpdf.text.Document;
 import com.itextpdf.text.pdf.PdfCopy;
 import com.itextpdf.text.pdf.PdfReader;
-import com.spire.xls.*;
 import com.spire.xls.CellRange;
+import com.spire.xls.FileFormat;
+import com.spire.xls.Worksheet;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
 import com.sun.image.codec.jpeg.JPEGCodec;
 import com.sun.image.codec.jpeg.JPEGImageEncoder;
 import org.apache.commons.lang.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
-import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
-import org.apache.poi.ss.usermodel.*;
+import org.apache.poi.ss.usermodel.ClientAnchor;
+import org.apache.poi.ss.usermodel.PrintSetup;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.util.Units;
 import org.apache.poi.xssf.usermodel.XSSFPrintSetup;
@@ -30,16 +31,20 @@ import org.springblade.common.utils.CommonUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SystemUtils;
 import org.springblade.common.vo.DataVO;
-import org.springblade.core.tool.utils.*;
+import org.springblade.core.tool.utils.FileUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.IoUtil;
+import org.springblade.core.tool.utils.ResourceUtil;
 import org.springblade.system.cache.ParamCache;
+
 import javax.imageio.ImageIO;
 import javax.servlet.http.HttpServletResponse;
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.net.URLEncoder;
-import java.util.*;
 import java.util.List;
+import java.util.*;
 import java.util.regex.Matcher;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
@@ -399,6 +404,12 @@ public class FileUtils {
         if(fileUrl.indexOf("/www/wwwroot")>=0){
             file_path2 = file_path;
         }
+//        File file = new File(fileUrl);
+//
+//        if(file.exists()){
+//            //存在
+//            return fileUrl;
+//        }
        String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path2, "");
         return path;
     }

+ 8 - 22
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/PdfAddimgUtil.java

@@ -1,37 +1,22 @@
 package org.springblade.manager.utils;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import com.itextpdf.text.BaseColor;
 import com.itextpdf.text.Element;
 import com.itextpdf.text.Image;
 import com.itextpdf.text.Rectangle;
-import com.itextpdf.text.pdf.BaseFont;
-import com.itextpdf.text.pdf.PdfContentByte;
-import com.itextpdf.text.pdf.PdfDictionary;
-import com.itextpdf.text.pdf.PdfName;
-import com.itextpdf.text.pdf.PdfReader;
-import com.itextpdf.text.pdf.PdfStamper;
-import com.itextpdf.text.pdf.parser.ContentByteUtils;
-import com.itextpdf.text.pdf.parser.ImageRenderInfo;
-import com.itextpdf.text.pdf.parser.PdfContentStreamProcessor;
-import com.itextpdf.text.pdf.parser.RenderListener;
-import com.itextpdf.text.pdf.parser.TextRenderInfo;
+import com.itextpdf.text.pdf.*;
+import com.itextpdf.text.pdf.parser.*;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.entity.TextdictInfo;
 import org.springblade.manager.vo.PDFIndexInfo;
-import org.springblade.manager.vo.TextdictInfoVO;
 import org.springblade.system.cache.ParamCache;
 
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 public class PdfAddimgUtil {
 
     public static void pdfAddImgInfo(String pdfUrl, String keyword, Map<Long, TextdictInfo> textMap) throws Exception {
@@ -51,6 +36,7 @@ public class PdfAddimgUtil {
                 try {
                     inputStream.close();
                 } catch (IOException e) {
+                    inputStream.close();
                 }
             }
         }

+ 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);