瀏覽代碼

2023 09 28 bug修改

zhuwei 1 年之前
父節點
當前提交
65b5c6e00f

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -417,7 +417,7 @@ public class InformationWriteQueryController extends BladeController {
                         String isExitSql = "select * from information_schema.TABLES where TABLE_NAME='" + treeContract.getInitTableName() + "'";
                         List<Map<String, Object>> tabList = this.jdbcTemplate.queryForList(isExitSql);
                         if (tabList.size() == 0) {
-                            continue; //未找到实体表跳过
+                            continue; //未找到实体表
                         }
 
                         String sql = "select * from " + treeContract.getInitTableName() + " where p_key_id = " + treeContract.getPKeyId();

+ 92 - 18
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -1,5 +1,6 @@
 package org.springblade.manager.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -9,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.google.gson.Gson;
 import com.spire.xls.*;
 import com.spire.xls.collections.PicturesCollection;
 import com.spire.xls.core.spreadsheet.HTMLOptions;
@@ -2006,24 +2008,8 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "contractId", value = "合同段Id", required = true)
     })
     public R getPdfS(String nodeId, String classify, String contractId) throws FileNotFoundException {
+        String file_path = FileUtils.getSysLocalFileUrl();
         //获取节点下的所有表单,和附件,如果表单全是隐藏的,并且没有附件,则提示暂无数据
-//        WbsTreeContract node = wbsTreeContractService.getOne(new LambdaQueryWrapper<WbsTreeContract>().eq(WbsTreeContract::getPKeyId,nodeId));
-//        List<WbsTreeContract> list = wbsTreeContractService.list(new LambdaQueryWrapper<WbsTreeContract>().eq(WbsTreeContract::getParentId, node.getId()).eq(WbsTreeContract::getContractId, contractId));
-//        tableInfoService.list(new LambdaQueryWrapper<ta>())
-//        if (list != null && list.size() > 0){
-//            Boolean isShow = true;
-//            for (WbsTreeContract contract : list) {
-//                if (contract.getIsBussShow() == 1){
-//                    isShow = false;
-//                    break;
-//                }
-//            }
-//            if (isShow){
-//                return R.fail("无历史数据预览,请保存数据");
-//            }
-//        }else {
-//            return R.fail("无历史数据预览,请保存数据");
-//        }
         String sql = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position,status from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
         if (maps.size() >= 1) {
@@ -2042,7 +2028,25 @@ public class ExcelTabController extends BladeController {
             if (StringUtils.isEmpty(pdfUrl) || pdfUrl.equals("null")) {
                 return R.fail("暂无PDF数据");
             } else {
-                return R.data(pdfUrl);
+                // 由于独立附件 需要追加最后
+                List<TableFileVO> data = tableFileService.selectTableFileListByTen(Long.valueOf(nodeId+""));
+                List<String> datainfo = new ArrayList<>();
+                datainfo.add(pdfUrl);
+                if(data!=null && data.size()>=1){
+                    for(TableFileVO tabsx :data){
+                        datainfo.add(tabsx.getUrl());
+                    }
+                    String listPdf = file_path + "/pdf/" + nodeId + ".pdf";
+                    File tabpdf2 = ResourceUtil.getFile(listPdf);
+                    if (tabpdf2.exists()) {
+                        tabpdf2.delete();
+                    }
+                    FileUtils.mergePdfPublicMethods(datainfo, listPdf);
+                    String netUrl = FileUtils.getNetUrl(listPdf);
+                    return R.data(netUrl);
+                }else{
+                    return R.data(pdfUrl);
+                }
             }
         } else {
             return R.fail("无历史数据预览,请保存数据");
@@ -3843,11 +3847,14 @@ public class ExcelTabController extends BladeController {
 
     })
     public R addBussFile(@RequestParam("file") MultipartFile[] file, String nodeId) {
+        List<TableFile> fileList = new ArrayList<>();
         if(file!=null && file.length>=1){
             for (MultipartFile multipartFile:file){
                 R<BladeFile> bladeFile = iossClient.addFileInfo(multipartFile);
                 BladeFile bladeFile1 = bladeFile.getData();
+
                 TableFile tableFile = new TableFile();
+
                 String fileExtension = FileUtil.getFileExtension(bladeFile1.getName()).toLowerCase();
                 tableFile.setTabId(nodeId + "");
                 tableFile.setName(multipartFile.getOriginalFilename());
@@ -3855,11 +3862,78 @@ public class ExcelTabController extends BladeController {
                 tableFile.setDomainUrl(bladeFile1.getLink());
                 tableFile.setIsDeleted(0);
                 tableFile.setExtension(fileExtension);
+                fileList.add(tableFile);
             }
+            tableFileService.saveOrUpdateBatch(fileList);
             return R.data("操作成功");
         }else{
             return R.data("请上传pdf");
         }
+
     }
 
+
+    @PostMapping("/save_nodeId")
+    @ApiOperationSupport(order = 72)
+    @ApiOperation(value = "pdf", notes = "pdf")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "contractId", value = "contractId", required = true),
+            @ApiImplicitParam(name = "nodeIds", value = "nodeIds", required = true),
+            @ApiImplicitParam(name = "classify", value = "classify", required = true),
+            @ApiImplicitParam(name = "projectId", value = "projectId", required = true)
+    })
+    public R synPDFInfo(String contractId,String nodeIds, String classify, String projectId) throws Exception {
+
+        if( contractId==null && StringUtils.isEmpty(contractId)){
+            return R.data("contractId不能为空");
+        }
+
+        if(nodeIds==null && StringUtils.isEmpty(nodeIds)){
+            return R.data("nodeId不能为空");
+        }
+
+        if(classify==null && StringUtils.isEmpty(classify)){
+            return R.data("classify不能为空");
+        }
+
+        if(projectId==null && StringUtils.isEmpty(projectId)){
+            return R.data("projectId不能为空");
+        }
+
+        String nodeId[] = Func.toStrArray(nodeIds);
+
+        for(String noId : nodeId){
+            JSONObject js = new JSONObject();
+            JSONObject js2 = new JSONObject();
+            List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(noId, classify, contractId, projectId);
+            JSONArray array = new JSONArray();
+            if(tableAll!=null && tableAll.size()>=1){
+                for(AppWbsTreeContractVO tab:tableAll){
+                    try {
+                        R bussDataInfo = excelTabService.getBussDataInfo(tab.getPKeyId(), 0);
+                        Map<String, Object> jo = (Map<String, Object>) bussDataInfo.getData();
+                        String s = new Gson().toJson(jo);
+                        //字符串转jsonobject
+                        JSONObject obj = JSON.parseObject(s);
+                        obj.put("classify",classify);
+                        obj.put("nodeId",noId);
+                        obj.put("contractId",contractId);
+                        obj.put("pkeyId",tab.getPKeyId());
+                        obj.put("projectId",projectId);
+                        obj.put("isCollapseLoad",true);
+                        obj.put("isRenderForm",true);
+                        array.add(obj);
+                    }catch (Exception e){
+                        e.printStackTrace();
+                    }finally {
+                        continue;
+                    }
+                }
+            }
+            js2.put("orderList",array);
+            js.put("dataInfo",js2);
+            this.saveBussData2(js);
+        }
+        return R.data("成功");
+    }
 }

+ 34 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TableFileController.java

@@ -17,6 +17,7 @@
 package org.springblade.manager.controller;
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.annotations.*;
@@ -25,6 +26,8 @@ import lombok.AllArgsConstructor;
 
 import org.springblade.business.dto.TrialSelfInspectionRecordDTO;
 import org.springblade.business.entity.TrialSelfInspectionRecord;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
@@ -36,6 +39,7 @@ import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.service.IExcelTabService;
 import org.springblade.manager.service.IWbsTreeContractService;
 import org.springblade.manager.service.IWbsTreePrivateService;
+import org.springblade.manager.vo.ExcelTabVO;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.*;
@@ -209,4 +213,34 @@ public class TableFileController extends BladeController {
         return R.fail(200, "未查询到数据");
     }
 
+
+    /**
+     * 独立追加附件
+     */
+    @GetMapping("/selectTableFileListByTen")
+    @ApiOperationSupport(order = 4)
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "pkeyid", value = "表单pkeyid", required = true),
+    })
+    public R selectTableFileListByTen(Long pkeyid) {
+        List<TableFileVO> dataList= tableFileService.selectTableFileListByTen(pkeyid);
+        return R.data(dataList);
+    }
+
+
+    /**
+     * 删除 表单附件信息
+     */
+    @PostMapping("/delTabById")
+    @ApiOperationSupport(order = 1)
+    @ApiOperation(value = "独立附件删除", notes = "传入ids")
+    public R delTabById(@ApiParam(value = "主键集合", required = true) @RequestParam String ids){
+        if(ids!=null && org.apache.commons.lang.StringUtils.isNotEmpty(ids)){
+            Long[] longArray = Func.toLongArray(ids);
+            for(Long id:longArray){
+                tableFileService.delDataById(ids, null);
+            }
+        }
+        return R.data("成功");
+    }
 }

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/TableFileMapper.java

@@ -43,6 +43,9 @@ public interface TableFileMapper extends BaseMapper<TableFile> {
 
     List<TableFileVO> selectTableFileList(String pKid);
 
+
+    List<TableFileVO> selectTableFileListByTen(String pKid);
+
     void delDataById(String id, Long recordId);
 
     List<TableFile> getAllFileByIds(@Param("ids") List<Long> ids);

+ 3 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/TableFileMapper.xml

@@ -50,4 +50,7 @@
         </if>
     </delete>
 
+    <select id="selectTableFileListByTen" resultMap="TableFileVO">
+        select *,domain_url as url from m_table_file where is_deleted = 0 and type=10 and tab_id = #{pKid}
+    </select>
 </mapper>

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

@@ -24,6 +24,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.manager.bean.TableInfo;
 import org.springblade.manager.entity.ExcelEditCallback;
 import org.springblade.manager.entity.ExcelTab;
+import org.springblade.manager.entity.TableFile;
 import org.springblade.manager.entity.WbsFormElement;
 import org.springblade.manager.enums.ExecuteType;
 import org.springblade.manager.vo.ExceTabTreVO;
@@ -181,4 +182,5 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
 
 
     R saveBussData(JSONArray dataArray) throws Exception;
+
 }

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

@@ -47,4 +47,6 @@ public interface ITableFileService extends IService<TableFile> {
 
     void delDataById(String pkid, Long id);
 
+    List<TableFileVO> selectTableFileListByTen(Long pKid);
+
 }

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

@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.mixsmart.utils.FormulaUtils;
 import com.mixsmart.utils.ListUtils;
 import com.mixsmart.utils.RegexUtils;
+import com.spire.pdf.PdfDocument;
 import com.spire.xls.FileFormat;
 import com.spire.xls.Worksheet;
 import lombok.AllArgsConstructor;
@@ -1622,7 +1623,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                     if ((dataDate[0].trim()).equals((dataDate[1].trim()))) {
                                         myData = dataDate[0];
                                     } else {
-                                        myData = dataDate[0] + "-" + dataDate[1].trim();
+                                        myData = dataDate[0].replace("\"","") + "-" + dataDate[1].trim().replace("\"","");
                                     }
 
                                 }
@@ -1660,7 +1661,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                             if (myData.equals("1")) {
                                                 short fontIndex = cell.getCellStyle().getFontIndex();
                                                 Font fontAt = workbook.getFontAt(fontIndex);
-                                                fontAt.setFontName("EUDC");
+                                                fontAt.setFontName("宋体");
                                                 cell.getCellStyle().setFont(fontAt);
                                                 cell.setCellValue(exceVal.replace("□", "\u2611"));
                                             }
@@ -1691,7 +1692,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                     if (cell != null || ObjectUtils.isNotEmpty(cell)) {
                                         short fontIndex = cell.getCellStyle().getFontIndex();
                                         Font fontAt = workbook.getFontAt(fontIndex);
-                                        fontAt.setFontName("EUDC");
+                                        fontAt.setFontName("宋体");
                                         cell.getCellStyle().setFont(fontAt);
                                         cell.setCellValue(myData);
                                     }
@@ -1705,9 +1706,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     }
                 }
             }
-
             // 组装电签设置
-
             Elements dqids = table.getElementsByAttribute("dqid");
             for (Element element : dqids){
                 String dqid = element.attr("dqid");
@@ -1745,12 +1744,13 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         FileOutputStream outputStream = new FileOutputStream(excelPath);
         workbook.write(outputStream);
 
-        com.spire.xls.Workbook workbook2 = new com.spire.xls.Workbook();
+        FileUtils.excelToPdf(excelPath,pdfPath);
+      //  com.spire.xls.Workbook workbook2 = new com.spire.xls.Workbook();
 
-        workbook2.loadFromFile(excelPath);
+      //  workbook2.loadFromFile(excelPath);
         //设置转换后的PDF页面高宽适应工作表的内容大小
-        workbook2.getConverterSetting().setSheetFitToPage(true);
-        workbook2.saveToFile(pdfPath, FileFormat.PDF);
+        //workbook2.getConverterSetting().setSheetFitToPage(true);
+       // workbook2.saveToFile(pdfPath, FileFormat.PDF);
 
         BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
 

+ 4 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/TableFileServiceImpl.java

@@ -55,4 +55,8 @@ public class TableFileServiceImpl extends ServiceImpl<TableFileMapper, TableFile
         baseMapper.delDataById(pkid, id);
     }
 
+    @Override
+    public List<TableFileVO> selectTableFileListByTen(Long pKid) {
+        return baseMapper.selectTableFileListByTen(pKid + "");
+    }
 }

+ 9 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java

@@ -405,6 +405,15 @@ public class FileUtils {
         return fileInputStream;
     }
 
+    public static String getNetUrl(String fileUrl){
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+
+       String path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
+
+        return path;
+    }
+
     public static String getSysLocalFileUrl() {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         if (SystemUtils.isMacOs()) {