Parcourir la source

Merge branch 'test-merge' of http://219.151.181.73:3000/zhuwei/bladex into test-merge

lvy il y a 1 jour
Parent
commit
ffc176c215

+ 17 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/entity/HideProcess.java

@@ -0,0 +1,17 @@
+package org.springblade.business.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+@TableName("m_hide_process")
+public class HideProcess implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    private Long id;
+    private Long contractId;
+    private Integer classifyType;
+    private Integer hideType;
+}

+ 7 - 3
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/MaterialProgressVO.java

@@ -1,6 +1,7 @@
 package org.springblade.business.vo;
 
 import io.swagger.annotations.ApiModelProperty;
+import io.swagger.models.auth.In;
 import lombok.Data;
 
 import java.math.BigDecimal;
@@ -22,8 +23,8 @@ public class MaterialProgressVO {
     @ApiModelProperty("WBS进度")
     private List<TreeMaterialProgress> treeMaterialProgressList = new ArrayList<>();
 
-    public void setProcessMaterialList(String title, Integer amount, Long successAmount) {
-        this.processMaterialList.add(new ProcessMaterial(title, amount, successAmount));
+    public void setProcessMaterialList(String title, Integer amount, Long successAmount, Integer isHide) {
+        this.processMaterialList.add(new ProcessMaterial(title, amount, successAmount,isHide));
     }
 
     public void setProcessMaterialStatusList(String title, Integer submitAmount, Integer awaitAmount, Integer approvalAmount) {
@@ -195,8 +196,10 @@ public class MaterialProgressVO {
         private Long successAmount;
         @ApiModelProperty("完成率")
         private BigDecimal ratio;
+        @ApiModelProperty("是否隐藏 0显示1隐藏")
+        private Integer isHide;
 
-        public ProcessMaterial(String title, Integer amount, Long successAmount) {
+        public ProcessMaterial(String title, Integer amount, Long successAmount,Integer isHide) {
             this.title = title;
             this.amount = amount;
             this.successAmount = successAmount;
@@ -206,6 +209,7 @@ public class MaterialProgressVO {
             } else {
                 this.ratio = new BigDecimal("0");
             }
+            this.isHide = isHide;
         }
 
     }

+ 46 - 11
blade-service/blade-business/src/main/java/org/springblade/business/controller/MaterialProgressController.java

@@ -22,11 +22,13 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
+import org.springblade.business.entity.HideProcess;
 import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.service.IImageClassificationFileService;
 import org.springblade.business.service.IInformationQueryService;
 import org.springblade.business.vo.MaterialProgressVO;
 import org.springblade.business.vo.QueryProcessDataVO;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
@@ -41,10 +43,7 @@ import org.springblade.system.entity.Menu;
 import org.springblade.system.entity.RoleMenu;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -490,7 +489,7 @@ public class MaterialProgressController extends BladeController {
                 }
                 if (countList.size() > 0) {
                     //设置参数
-                    this.setParameter(countList, reVO, classifyType);
+                    this.setParameter(countList, reVO, classifyType,contractId);
                 }
                 filtetDataByRole(contract, reVO,1);
                 return R.data(reVO);
@@ -501,7 +500,7 @@ public class MaterialProgressController extends BladeController {
             List<WbsTreeContract> submitNodeList = this.wbsTreeContractClient.queryContractSubmitWbsTreeByContractId(contractId);
             if (submitNodeList != null && submitNodeList.size() > 0) {
                 //设置参数
-                this.setParameter(submitNodeList, reVO, classifyType);
+                this.setParameter(submitNodeList, reVO, classifyType,contractId);
                 filtetDataByRole(contract, reVO,1);
                 return R.data(reVO);
             }
@@ -513,7 +512,7 @@ public class MaterialProgressController extends BladeController {
     /**
      * 设置参数
      */
-    private void setParameter(List<WbsTreeContract> submitNodeList, MaterialProgressVO reVO, String classifyType) {
+    private void setParameter(List<WbsTreeContract> submitNodeList, MaterialProgressVO reVO, String classifyType,String contractId) {
         classifyType = StringUtils.isEmpty(classifyType) ? "1" : classifyType;
         //汇总四个填报类型的总数
         List<String> process = new ArrayList<>(), workStartReports = new ArrayList<>(), evaluation = new ArrayList<>(), completion = new ArrayList<>();
@@ -541,11 +540,47 @@ public class MaterialProgressController extends BladeController {
         if (completion.size() > 0) {
             completionAmount = this.informationQueryService.count(Wrappers.<InformationQuery>query().select("distinct wbs_id").in("wbs_id", completion).eq("classify", classifyType));
         }
+        String sql="select * from m_hide_process where contract_id= "+contractId+" and classify_type= "+classifyType;
+        List<HideProcess> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(HideProcess.class));
+        String hideTypes="";
+        if(!list.isEmpty()){
+            hideTypes= list.stream().map(HideProcess::getHideType).map(String::valueOf).collect(Collectors.joining(","));
+        }
+        reVO.setProcessMaterialList("开工报告", workStartReports.size(), workStartReportsAmount,hideTypes.contains("1")?1:0);
+        reVO.setProcessMaterialList("工序资料", process.size(), processAmount,hideTypes.contains("2")?1:0);
+        reVO.setProcessMaterialList("评定资料", evaluation.size(), evaluationAmount,hideTypes.contains("3")?1:0);
+        reVO.setProcessMaterialList("中间交工", completion.size(), completionAmount,hideTypes.contains("4")?1:0);
+    }
 
-        reVO.setProcessMaterialList("开工报告", workStartReports.size(), workStartReportsAmount);
-        reVO.setProcessMaterialList("工序资料", process.size(), processAmount);
-        reVO.setProcessMaterialList("评定资料", evaluation.size(), evaluationAmount);
-        reVO.setProcessMaterialList("中间交工", completion.size(), completionAmount);
+    /**
+     *
+     * @param contractId
+     * @param classifyType 1施工2监理
+     * @param hideType 1开工报告 2工序资料 3评定资料 4中间交工
+     * @param type 0显示 1隐藏
+     * @return
+     */
+    @GetMapping("/hideProcessMaterial")
+    @ApiOperation(value = "隐藏进度")
+    @ApiOperationSupport(order = 2)
+    private R hideProcessMaterial(Long contractId,Integer classifyType,Integer hideType,Integer type){
+        classifyType = StringUtils.isEmpty(String.valueOf(classifyType)) ? 1 : classifyType;
+        if(type==0){
+            String sql="select * from m_hide_process where contract_id= "+contractId+" and classify_type= "+classifyType+" and hide_type= "+hideType;
+            List<HideProcess> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(HideProcess.class));
+            if(!list.isEmpty()){
+                String delete="delete from m_hide_process where id="+list.get(0).getId();
+                jdbcTemplate.execute(delete);
+            }
+        }else {
+            String sql="select * from m_hide_process where contract_id= "+contractId+" and classify_type= "+classifyType+" and hide_type= "+hideType;
+            List<HideProcess> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(HideProcess.class));
+            if(list.isEmpty()){
+                String insertSql="insert into m_hide_process(id,contract_id,classify_type,hide_type) values("+ SnowFlakeUtil.getId()+","+contractId+","+classifyType+","+hideType+")";
+                jdbcTemplate.execute(insertSql);
+            }
+        }
+        return R.success("操作成功");
     }
 
     /**

+ 2 - 2
blade-service/blade-business/src/main/java/org/springblade/business/mapper/ArchiveFileMapper.xml

@@ -98,7 +98,7 @@
         <if test="vo.sourceType != null and vo.sourceType != ''">
             and u.source_type = #{vo.sourceType}
         </if>
-        <if test="vo.isArchive != null and vo.isArchive != ''">
+        <if test="vo.isArchive != null">
             <choose>
                 <when test="vo.isArchive == 0">
                     AND (u.is_archive = #{vo.isArchive} OR u.is_archive IS NULL)
@@ -184,7 +184,7 @@
         <if test="vo.sourceType != null and vo.sourceType != ''">
             and u.source_type = #{vo.sourceType}
         </if>
-        <if test="vo.isArchive != null and vo.isArchive != ''">
+        <if test="vo.isArchive != null">
             <choose>
                 <when test="vo.isArchive == 0">
                     AND (u.is_archive = #{vo.isArchive} OR u.is_archive IS NULL)

+ 101 - 99
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/HtmlTableToExcelConverter.java

@@ -61,131 +61,133 @@ public class HtmlTableToExcelConverter {
         Map<Integer, Set<Integer>> occupiedCells = new HashMap<>();
 
         int excelRowNum = 0;
-        for (Element tr : table.select("tr")) {
-            // 跳过空行
-            if (tr.children().isEmpty()) {
-                excelRowNum++;
-                continue;
-            }
+        if (table != null) {
+            for (Element tr : table.select("tr")) {
+                // 跳过空行
+                if (tr.children().isEmpty()) {
+                    excelRowNum++;
+                    continue;
+                }
 
-            // 创建行并设置默认行高(比默认值小)
-            Row excelRow = sheet.createRow(excelRowNum);
+                // 创建行并设置默认行高(比默认值小)
+                Row excelRow = sheet.createRow(excelRowNum);
 
 
-            // 初始化当前行占用集合
-            occupiedCells.putIfAbsent(excelRowNum, new HashSet<>());
+                // 初始化当前行占用集合
+                occupiedCells.putIfAbsent(excelRowNum, new HashSet<>());
 
-            int excelColNum = 0;
+                int excelColNum = 0;
 
 
-            //是否设置行高
-            Boolean isHeight = false;
+                //是否设置行高
+                Boolean isHeight = false;
 
-            for (Element td : tr.select("td")) {
+                for (Element td : tr.select("td")) {
 
-                //设置行高
-                String style1 = td.attr("style");
-                if (!isHeight && StringUtil.isNotBlank(style1)) {
-                    List<String> collect = Arrays.stream(style1.split(";")).collect(Collectors.toList());
-                    HashMap<String, String> map = new HashMap<>();
-                    collect.forEach(s -> {
-                        map.put(s.split(":")[0], s.split(":")[1]);
-                    });
+                    //设置行高
+                    String style1 = td.attr("style");
+                    if (!isHeight && StringUtil.isNotBlank(style1)) {
+                        List<String> collect = Arrays.stream(style1.split(";")).collect(Collectors.toList());
+                        HashMap<String, String> map = new HashMap<>();
+                        collect.forEach(s -> {
+                            map.put(s.split(":")[0], s.split(":")[1]);
+                        });
 
-                    String height = map.get("height");
-                    Float rowHeight = 16f; // 默认16点
-                    if (StringUtil.isNotBlank(height)) {
-                        isHeight = true;
-                        height = height.replace("px", "");
-                        try {
-                            Float px = Float.valueOf(height);
-                            rowHeight = px * 0.75f; // 像素转点 (1px ≈ 0.75pt)
-                        } catch (Exception ignored) {
-                            ignored.printStackTrace();
-                        }
+                        String height = map.get("height");
+                        Float rowHeight = 16f; // 默认16点
+                        if (StringUtil.isNotBlank(height)) {
+                            isHeight = true;
+                            height = height.replace("px", "");
+                            try {
+                                Float px = Float.valueOf(height);
+                                rowHeight = px * 0.75f; // 像素转点 (1px ≈ 0.75pt)
+                            } catch (Exception ignored) {
+                                ignored.printStackTrace();
+                            }
 
-                        excelRow.setHeightInPoints(rowHeight);
+                            excelRow.setHeightInPoints(rowHeight);
+                        }
                     }
-                }
 
 
-                // 跳过已被占用的单元格
-                while (isCellOccupied(occupiedCells, excelRowNum, excelColNum)) {
-                    excelColNum++;
-                }
+                    // 跳过已被占用的单元格
+                    while (isCellOccupied(occupiedCells, excelRowNum, excelColNum)) {
+                        excelColNum++;
+                    }
 
-                // 处理列跨度和行跨度
-                int colspan = getSpan(td, "colspan");
-                int rowspan = getSpan(td, "rowspan");
+                    // 处理列跨度和行跨度
+                    int colspan = getSpan(td, "colspan");
+                    int rowspan = getSpan(td, "rowspan");
 
-                // 获取单元格内容
-                String cellText = extractCellText(td);
+                    // 获取单元格内容
+                    String cellText = extractCellText(td);
 
-                // 创建单元格
-                Cell cell = excelRow.createCell(excelColNum);
-                cell.setCellValue(cellText);
+                    // 创建单元格
+                    Cell cell = excelRow.createCell(excelColNum);
+                    cell.setCellValue(cellText);
 
-                // 应用样式
-                String styleKey = getCellStyleKey(td, cssRules);
-                if (!styleCache.containsKey(styleKey)) {
-                    CellStyle style = createCellStyle(workbook, td, cssRules, fontCache);
-                    styleCache.put(styleKey, style);
+                    // 应用样式
+                    String styleKey = getCellStyleKey(td, cssRules);
+                    if (!styleCache.containsKey(styleKey)) {
+                        CellStyle style = createCellStyle(workbook, td, cssRules, fontCache);
+                        styleCache.put(styleKey, style);
 
-                    // 检查是否需要自动换行
-                    if (shouldWrapText(td, cssRules, cellText)) {
-                        style.setWrapText(true);
+                        // 检查是否需要自动换行
+                        if (shouldWrapText(td, cssRules, cellText)) {
+                            style.setWrapText(true);
+                        }
                     }
-                }
-                cell.setCellStyle(styleCache.get(styleKey));
-
-                // 记录列宽(优先使用HTML中的宽度)
-                if (td.hasAttr("width")) {
-                    String widthStr = td.attr("width").replace("px", "");
-                    try {
-                        float px = Float.parseFloat(widthStr);
-                        float charWidth = px / 7f; // 像素转字符宽度 (1字符≈7px)
-
-                        // 考虑跨列情况:总宽度分配到各列
-                        for (int i = 0; i < colspan; i++) {
-                            int colIdx = excelColNum + i;
-                            float perColWidth = charWidth / colspan;
-
-                            // 取最大宽度作为列宽
-                            columnWidths.putIfAbsent(colIdx, 0f);
-                            if (perColWidth > columnWidths.get(colIdx)) {
-                                columnWidths.put(colIdx, perColWidth);
+                    cell.setCellStyle(styleCache.get(styleKey));
+
+                    // 记录列宽(优先使用HTML中的宽度)
+                    if (td.hasAttr("width")) {
+                        String widthStr = td.attr("width").replace("px", "");
+                        try {
+                            float px = Float.parseFloat(widthStr);
+                            float charWidth = px / 7f; // 像素转字符宽度 (1字符≈7px)
+
+                            // 考虑跨列情况:总宽度分配到各列
+                            for (int i = 0; i < colspan; i++) {
+                                int colIdx = excelColNum + i;
+                                float perColWidth = charWidth / colspan;
+
+                                // 取最大宽度作为列宽
+                                columnWidths.putIfAbsent(colIdx, 0f);
+                                if (perColWidth > columnWidths.get(colIdx)) {
+                                    columnWidths.put(colIdx, perColWidth);
+                                }
                             }
+                        } catch (NumberFormatException ignored) {
                         }
-                    } catch (NumberFormatException ignored) {
                     }
-                }
 
-                // 标记当前单元格占据的所有位置
-                markCellsAsOccupied(occupiedCells, excelRowNum, excelColNum, rowspan, colspan);
-
-                // 创建合并区域
-                if (colspan > 1 || rowspan > 1) {
-                    CellRangeAddress region = new CellRangeAddress(
-                            excelRowNum,
-                            excelRowNum + rowspan - 1,
-                            excelColNum,
-                            excelColNum + colspan - 1
-                    );
-
-                    // 检查是否与现有区域重叠
-                    if (!isOverlapping(mergedRegions, region)) {
-                        sheet.addMergedRegion(region);
-                        mergedRegions.add(region);
-                        CellStyle cellStyle = styleCache.get(styleKey);
-                        mergedFrame.put(region, cellStyle);
-                        // 为合并区域设置边框(使用左上角单元格的样式)
-//                        setMergedRegionBorders(workbook, sheet, region, styleCache.get(styleKey));
+                    // 标记当前单元格占据的所有位置
+                    markCellsAsOccupied(occupiedCells, excelRowNum, excelColNum, rowspan, colspan);
+
+                    // 创建合并区域
+                    if (colspan > 1 || rowspan > 1) {
+                        CellRangeAddress region = new CellRangeAddress(
+                                excelRowNum,
+                                excelRowNum + rowspan - 1,
+                                excelColNum,
+                                excelColNum + colspan - 1
+                        );
+
+                        // 检查是否与现有区域重叠
+                        if (!isOverlapping(mergedRegions, region)) {
+                            sheet.addMergedRegion(region);
+                            mergedRegions.add(region);
+                            CellStyle cellStyle = styleCache.get(styleKey);
+                            mergedFrame.put(region, cellStyle);
+                            // 为合并区域设置边框(使用左上角单元格的样式)
+    //                        setMergedRegionBorders(workbook, sheet, region, styleCache.get(styleKey));
+                        }
                     }
-                }
 
-                excelColNum += colspan;
+                    excelColNum += colspan;
+                }
+                excelRowNum++;
             }
-            excelRowNum++;
         }
         // 修复合并单元格边框问题
         fixMergedRegionBorders(workbook, sheet, mergedRegions, mergedFrame);

+ 4 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java

@@ -1125,6 +1125,10 @@ public class WbsTreeContractController extends BladeController {
                     if (td1.attr("dqid").length() > 0) { // 跳过包含dqid的td
                         continue;
                     }
+                    // 跳过包含hc-table-form-upload子元素的td
+                    if (!td1.select("hc-table-form-upload").isEmpty()) {
+                        continue;
+                    }
 
                     Element td2 = tdElements2.size() > j ? tdElements2.get(j) : null;
                     if (td2 == null) break;

+ 5 - 0
blade-service/blade-user/pom.xml

@@ -93,6 +93,11 @@
             <artifactId>commons-io</artifactId>
             <version>2.18.0</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml-schemas</artifactId>
+            <version>4.1.2</version>
+        </dependency>
 
     </dependencies>