Ver Fonte

Merge remote-tracking branch 'origin/master'

liuyc há 1 ano atrás
pai
commit
2f10fb5f70

+ 5 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/BusinessTaskPageVO.java

@@ -2,8 +2,10 @@ package org.springblade.business.vo;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springblade.business.entity.TaskParallel;
 
 import java.io.Serializable;
+import java.util.List;
 
 @Data
 public class BusinessTaskPageVO implements Serializable {
@@ -50,4 +52,7 @@ public class BusinessTaskPageVO implements Serializable {
     @ApiModelProperty(value = "流程分支实例id")
     private String parallelProcessInstanceId;
 
+    @ApiModelProperty(value = "签字人员集合")
+    private List<TaskParallel> taskApproveUserNamesList;
+
 }

+ 1 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/TableFile.java

@@ -66,7 +66,7 @@ public class TableFile implements Serializable {
      */
     private String extension;
     /**
-     * 1 表示表单 2表示附件
+     * 1 表示表单 2表示附件 10节点附件
      */
     private Integer type;
     /**

+ 87 - 1
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveMeasurementController.java

@@ -3,7 +3,14 @@ package org.springblade.archive.controller;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
 import org.springblade.archive.service.IArchiveAutoPdfService;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.feign.ArchiveFileClient;
@@ -14,13 +21,22 @@ import org.springblade.manager.feign.ArchiveTreeContractClient;
 import org.springblade.resource.feign.CommonFileClient;
 import org.springblade.resource.feign.IOSSClient;
 import org.springblade.resource.feign.NewIOSSClient;
-import org.springframework.http.HttpStatus;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.http.*;
+import org.springframework.util.LinkedMultiValueMap;
+import org.springframework.util.MultiValueMap;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.client.RestTemplate;
 import org.springframework.web.multipart.MultipartFile;
 import org.springblade.core.tool.api.R;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -107,4 +123,74 @@ public class ArchiveMeasurementController {
         }
         return R.success(ResultCode.SUCCESS);
     }
+
+    @PostMapping("/test")
+    @ApiOperation(value = "上传文件", notes = "上传文件")
+    public R test() {
+        String projectName ="重庆试验项目";
+        String contractName ="第一合同段";
+        String periodName ="第三期";
+        String fileName ="交工证书";
+        String fileTime ="2023.03.11";
+        String dutyUser ="设计单位";
+        String fileUrl ="https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20230908/8287a3eee944e8fd8dabedeeed961432.pdf";
+        String dstUrl  ="http://127.0.0.1:8090/blade-archive/archiveMeasurement/upFile";
+        sendFileToArchive(projectName,contractName,periodName,fileName,fileTime,dutyUser,fileUrl,dstUrl);
+        return R.success(ResultCode.SUCCESS);
+    }
+
+
+
+    public void sendFileToArchive(String projectName, String contractName, String periodName, String fileName,
+                                  String fileTime, String dutyUser, String fileUrl, String dstUrl) {
+        try {
+            // 使用 RestTemplate 下载文件
+            RestTemplate restTemplate = new RestTemplate();
+            ResponseEntity<byte[]> response = restTemplate.getForEntity(fileUrl, byte[].class);
+            if (response.getStatusCode() == HttpStatus.OK) {
+                byte[] fileBytes = response.getBody();
+
+                // 将下载的文件保存到临时文件
+                Path tempFilePath = Files.createTempFile("temp-", "-" + fileName);
+                Files.write(tempFilePath, fileBytes, StandardOpenOption.CREATE);
+
+                // 创建请求参数
+                MultiValueMap<String, Object> requestParams = new LinkedMultiValueMap<>();
+                requestParams.add("projectName", projectName);
+                requestParams.add("contractName", contractName);
+                requestParams.add("periodName", periodName);
+                requestParams.add("fileName", fileName);
+                requestParams.add("fileTime", fileTime);
+                requestParams.add("dutyUser", dutyUser);
+                requestParams.add("fileData", new FileSystemResource(tempFilePath.toFile()));
+
+                // 发起 POST 请求
+                HttpHeaders headers = new HttpHeaders();
+                headers.setContentType(MediaType.MULTIPART_FORM_DATA);
+                HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(requestParams, headers);
+                RestTemplate postRestTemplate = new RestTemplate();
+                ResponseEntity<String> postResponse = postRestTemplate.exchange(
+                        URI.create(dstUrl),
+                        HttpMethod.POST,
+                        requestEntity,
+                        String.class
+                );
+
+                // 处理响应结果
+                if (postResponse.getStatusCode() == HttpStatus.OK) {
+                    System.out.println("File sent to archive successfully.");
+                } else {
+                    System.out.println("Failed to send file to archive. Response: " + postResponse.getBody());
+                }
+
+                // 删除临时文件
+                Files.delete(tempFilePath);
+            } else {
+                System.out.println("Failed to download file from the provided URL: " + fileUrl);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
 }

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

@@ -1296,7 +1296,6 @@ public class InformationWriteQueryController extends BladeController {
                                 String sql = "update u_trial_self_inspection_record set task_status = '待审批' where id = " + startTaskVO.getTrialSelfInspectionRecordId();
                                 jdbcTemplate.execute(sql);
                             }
-
                             var = true;
                         }
                     }

+ 18 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -1223,11 +1223,10 @@ public class TaskController extends BladeController {
             String resultIds = processInstanceIds.stream()
                     .map(id -> "'" + id + "'")
                     .collect(Collectors.joining(","));
-            taskParallelGroupMap = jdbcTemplate.query("select process_instance_id,task_user,task_user_name,e_visa_status,e_visa_content,parallel_process_instance_id from u_task_parallel where process_instance_id in(" + resultIds + ") order by id", new BeanPropertyRowMapper<>(TaskParallel.class)).stream().collect(Collectors.groupingBy(TaskParallel::getProcessInstanceId));
+            taskParallelGroupMap = jdbcTemplate.query("select process_instance_id,task_user,task_user_name,e_visa_status,e_visa_content,parallel_process_instance_id ,status from u_task_parallel where process_instance_id in(" + resultIds + ") order by id", new BeanPropertyRowMapper<>(TaskParallel.class)).stream().collect(Collectors.groupingBy(TaskParallel::getProcessInstanceId));
         }
 
         Map<String, List<TaskParallel>> finalTaskParallelGroupMap = taskParallelGroupMap;
-
         //获取用户信息Map
         Map<Long, String> nameMap = jdbcTemplate.query("select id,name from blade_user where is_deleted = 0", new BeanPropertyRowMapper<>(User.class)).stream().collect(Collectors.toMap(User::getId, User::getName, (key1, key2) -> key1));
 
@@ -1264,6 +1263,23 @@ public class TaskController extends BladeController {
                             vo.setEVisaStatus("废除成功");
                         }
 
+                        //判断签字人的验证 2 代表绿色  3 黄色 999 红色  其他代表 灰色
+                        List<TaskParallel> statList = new ArrayList<>();
+                        for(TaskParallel taskPa : taskParallelList){
+                            if(taskPa.getStatus()==2 && taskPa.getEVisaStatus()==1){
+                                taskPa.setEVisaStatus(2);
+                            }else if(taskPa.getStatus()==3 && taskPa.getTaskUser().equals(SecureUtil.getUserId().toString())){
+                                taskPa.setEVisaStatus(3);
+                            }else if(taskPa.getStatus()==999){
+                                taskPa.setEVisaStatus(999);
+                            }else{
+                                taskPa.setEVisaStatus(1);
+                            }
+                            statList.add(taskPa);
+                        }
+
+                        vo.setTaskApproveUserNamesList(statList);
+
                         /*List<String> contentsList = new LinkedList<>();
                         for (TaskParallel taskParallel : taskParallelList) {
                             contentsList.add("【" + taskParallel.getTaskUserName() + "】msg:" + (ObjectUtil.isNotEmpty(taskParallel.getEVisaContent()) ? taskParallel.getEVisaContent() : "null") + " code:" + (ObjectUtil.isNotEmpty(taskParallel.getEVisaStatus()) ? taskParallel.getEVisaStatus() : "null "));

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

@@ -1590,8 +1590,6 @@ public class ExcelTabController extends BladeController {
 
                             if (!inputText.equals("")) {
                                 exctabCell.setExctabId(excelId);
-
-
                                 exctabCell.setTextInfo(inputText);
                                 if (inputText.contains("日期") || inputText.contains("年") || inputText.contains("月") || inputText.contains("日")) {
                                     //日期
@@ -3830,4 +3828,38 @@ public class ExcelTabController extends BladeController {
         return excelTabService.saveBussData(dataArray);
     }
 
+
+    /**
+     * 质检附件追加
+     * @return ObjectStat
+     */
+    @SneakyThrows
+    @PostMapping("/add-bussfile-node")
+    @ApiOperationSupport(order = 20)
+    @ApiOperation(value = "附件上传", notes = "附件上传")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "file", value = "file", required = true),
+            @ApiImplicitParam(name = "nodeId", value = "nodeId", required = true),
+
+    })
+    public R addBussFile(@RequestParam("file") MultipartFile[] file, String nodeId) {
+        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());
+                tableFile.setType(10);
+                tableFile.setDomainUrl(bladeFile1.getLink());
+                tableFile.setIsDeleted(0);
+                tableFile.setExtension(fileExtension);
+            }
+            return R.data("操作成功");
+        }else{
+            return R.data("请上传pdf");
+        }
+    }
+
 }

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

@@ -15,6 +15,7 @@ import com.mixsmart.utils.FormulaUtils;
 import com.mixsmart.utils.ListUtils;
 import com.mixsmart.utils.RegexUtils;
 import com.spire.xls.FileFormat;
+import com.spire.xls.Worksheet;
 import lombok.AllArgsConstructor;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
@@ -1606,6 +1607,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                                 short fontIndex = cell.getCellStyle().getFontIndex();
                                                 Font fontAt = workbook.getFontAt(fontIndex);
                                                 fontAt.setFontName("EUDC");
+                                                cell.getCellStyle().setFont(fontAt);
                                                 cell.setCellValue(exceVal.replace("□", "\u2611"));
                                             }
                                         } else {
@@ -1636,6 +1638,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                                         short fontIndex = cell.getCellStyle().getFontIndex();
                                         Font fontAt = workbook.getFontAt(fontIndex);
                                         fontAt.setFontName("EUDC");
+                                        cell.getCellStyle().setFont(fontAt);
                                         cell.setCellValue(myData);
                                     }
                                     boolean wrap = Optional.ofNullable(cell).map(Cell::getCellStyle).map(CellStyle::getWrapText).orElse(true);
@@ -1689,8 +1692,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         workbook.write(outputStream);
 
         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);