소스 검색

Merge remote-tracking branch 'origin/master' into master

yangyj 1 년 전
부모
커밋
c77d7e3f72
1개의 변경된 파일71개의 추가작업 그리고 52개의 파일을 삭제
  1. 71 52
      blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

+ 71 - 52
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -1208,19 +1208,23 @@ public class TaskController extends BladeController {
             taskUserOne.put("flowValue", "上报");
             taskProcessInfo.add(0, taskUserOne);
 
-            //判断当前用户所属流程,如果为第一流程则类型1显示Excel,如果是后面流程则类型2显示PDF,没有PDF则类型3
-            int currentUserFlow = 1;
+            //判断当前用户所属流程,如果为审计流程则类型1显示Excel,如果是后面流程则类型2显示PDF,没有PDF则类型3
+            Integer currentUserFlow = null;
+            Integer auditFlow = null;
             /*预设流程(平行、顺序审批)*/
             if (ObjectUtil.isNotEmpty(task.getFixedFlowId()) && !task.getFixedFlowId().equals(0L)) {
                 List<FixedFlowLink> query = jdbcTemplate.query("SELECT * FROM u_fixed_flow_link WHERE fixed_flow_id = ?", new Object[]{task.getFixedFlowId()}, new BeanPropertyRowMapper<>(FixedFlowLink.class));
+                //查看流程中是否存在审计流程
+                for (FixedFlowLink link : query) {
+                    if (StringUtils.isNotBlank(link.getFixedFlowLink()) && link.getFixedFlowLink().contains("审计")){
+                        auditFlow = link.getFixedFlowBranchSort();
+                        break;
+                    }
+                }
                 //校验当前用户在第几流程
                 Integer sort = query.stream().collect(Collectors.toMap(l -> l.getFixedFlowLinkUser(), l -> l.getFixedFlowBranchSort())).get(AuthUtil.getUserId());
                 // 为空则代表是上报人,直接显示当前结果
-                if (sort == null){
-                    currentUserFlow = 2;
-                }else {
-                    currentUserFlow = sort;
-                }
+                currentUserFlow = sort;
 
                 Map<String, List<FixedFlowLink>> group = query.stream()
                         .collect(Collectors.groupingBy(obj -> obj.getFixedFlowLink() + "@@@" + obj.getFixedFlowLinkType(),
@@ -1308,47 +1312,51 @@ public class TaskController extends BladeController {
                 String html = this.getExcelHtmlByBuss(Long.valueOf(task.getProjectId()));
                 if (html != null) {
                     vo.setTableHtml(html);
-                    //查看当前用户是否在第一流程
-                    if (currentUserFlow == 1) {
-                        //是第一人,设置意见为1,查询已经填写的值,如果没有则返回默认值
-                        vo.setOpinionType(1);
-                        R<WbsTreePrivate> r = wbsTreePrivateClient.getProjectOpinionNode(Long.valueOf(task.getProjectId()));
-                        if (r.getCode() != 200) {
-                            throw new ServiceException(r.getMsg());
-                        }
-                        WbsTreePrivate aPrivate = r.getData();
-                        //实体数据
+                    if (auditFlow != null){
+                        //查看当前用户是否在审计流程
+                        if (currentUserFlow != null && currentUserFlow.equals(auditFlow)) {
+                            //是意见人,设置意见为1,查询已经填写的值,如果没有则返回默认值
+                            vo.setOpinionType(1);
+                            R<WbsTreePrivate> r = wbsTreePrivateClient.getProjectOpinionNode(Long.valueOf(task.getProjectId()));
+                            if (r.getCode() != 200) {
+                                throw new ServiceException(r.getMsg());
+                            }
+                            WbsTreePrivate aPrivate = r.getData();
+                            //实体数据
 //                    String querySql = "select * from " + aPrivate.getInitTableName() + " where p_key_id=" + task.getId();
 //                    List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
-                        Map<String, Object> dataInfo = getBussDataInfo(aPrivate, task.getId());
-                        //todo 目前直接把key写死在代码里面,后面有空再去动态获取key
-                        Map<String, Object> tableData = new HashMap<>();
-                        if (dataInfo.size() == 0) {
-                            tableData.put("key_18__3_1", projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
-                            tableData.put("key_7__4_3", reportAllMoney);
-                            tableData.put("key_1__5_3", DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
-                            tableData.put("key_5__10_1", reportAllMoney);
-                            //获取本期之前所有计量期金额
-                            BigDecimal beforeMoney = contractMeterPeriodMapper.getBeforeMoney(period);
-                            if (beforeMoney != null){
-                                tableData.put("key_14__11_1",beforeMoney);
+                            Map<String, Object> dataInfo = getBussDataInfo(aPrivate, task.getId());
+                            //todo 目前直接把key写死在代码里面,后面有空再去动态获取key
+                            Map<String, Object> tableData = new HashMap<>();
+                            if (dataInfo.size() == 0) {
+                                tableData.put("key_18__3_1", projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
+                                tableData.put("key_7__4_3", reportAllMoney);
+                                tableData.put("key_1__5_3", DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
+                                tableData.put("key_5__10_1", reportAllMoney);
+                                //获取本期之前所有计量期金额
+                                BigDecimal beforeMoney = contractMeterPeriodMapper.getBeforeMoney(period);
+                                if (beforeMoney != null){
+                                    tableData.put("key_14__11_1",beforeMoney);
+                                }
+                                tableData.put("key_10__11_3", beforeMoney == null ? reportAllMoney : beforeMoney.add(reportAllMoney));
+                            } else {
+                                tableData = dataInfo;
+                                tableData.put("key_18__3_1", projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
                             }
-                            tableData.put("key_10__11_3", beforeMoney == null ? reportAllMoney : beforeMoney.add(reportAllMoney));
+                            vo.setTableData(tableData);
                         } else {
-                            tableData = dataInfo;
-                            tableData.put("key_18__3_1", projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
-                        }
-                        vo.setTableData(tableData);
-                    } else {
-                        if (StringUtils.isNotBlank(task.getAttachmentPdfUrl())) {
-                            vo.setOpinionType(2);
-                        } else {
-                            //不是第一人,判断PDF是否生成,生成了类型为2,没有生成类型为3
-                            vo.setOpinionType(3);
+                            if (StringUtils.isNotBlank(task.getAttachmentPdfUrl())) {
+                                vo.setOpinionType(2);
+                            } else {
+                                //不是意见人,判断PDF是否生成,生成了类型为2,没有生成类型为3
+                                vo.setOpinionType(3);
+                            }
                         }
+                    }else {
+                        vo.setOpinionType(3);
                     }
                 }else {
-                    vo.setOpinionType(3);
+                    vo.setOpinionType(4);
                 }
             }
 
@@ -2441,21 +2449,26 @@ public class TaskController extends BladeController {
         if (html != null) {
             if (task.getMeterTaskType() != null && task.getMeterTaskType() == 1) {
                 //判断当前用户所属流程,只处理第一流程
-                int currentUserFlow = 1;
+                Integer currentUserFlow = null;
+                Integer auditFlow = null;
                 Boolean isDefiniteFlow = false;
                 Boolean isAllApp = false;
                 List<FixedFlowLink> query = new ArrayList<>();
                 if (task.getFixedFlowId() != null && !task.getFixedFlowId().equals(0L)) {
                     isDefiniteFlow = true;
                     query = jdbcTemplate.query("SELECT * FROM u_fixed_flow_link WHERE fixed_flow_id = ?", new Object[]{task.getFixedFlowId()}, new BeanPropertyRowMapper<>(FixedFlowLink.class));
+                    //查看流程中是否存在审计流程
+                    for (FixedFlowLink link : query) {
+                        if (StringUtils.isNotBlank(link.getFixedFlowLink()) && link.getFixedFlowLink().contains("审计")){
+                            auditFlow = link.getFixedFlowBranchSort();
+                            break;
+                        }
+                    }
                     //校验当前用户在第几流程
                     Integer sort = query.stream().collect(Collectors.toMap(l -> l.getFixedFlowLinkUser(), l -> l.getFixedFlowBranchSort())).get(AuthUtil.getUserId());
-                    if (sort == null) {
-                        throw new ServiceException("未获取到当前用户在流程中的信息");
-                    }
                     currentUserFlow = sort;
                 }
-                if (currentUserFlow == 1) {
+                if (auditFlow != null && currentUserFlow != null && auditFlow.equals(currentUserFlow)) {
                     //当前流程所有用户id,后面PDF权限校验
                     Map<Long, String> flowIds = new HashMap<>();
                     //查询出项目审计意见节点的基本信息
@@ -2465,11 +2478,12 @@ public class TaskController extends BladeController {
                     }
                     WbsTreePrivate aPrivate = (WbsTreePrivate) r.getData();
                     if (isDefiniteFlow) {
-                        flowIds = query.stream().filter(l -> l.getFixedFlowBranchSort() == 1)
+                        Integer auditFlow2 = auditFlow;
+                        flowIds = query.stream().filter(l -> l.getFixedFlowBranchSort() == auditFlow2)
                                 .collect(Collectors.toMap(l -> l.getFixedFlowLinkUser(), l -> l.getFixedFlowLinkUserName()));
                         //获取出当前流程中所有用户
                         List<String> ids = query.stream()
-                                .filter(l -> l.getFixedFlowBranchSort() == 1 && !l.getFixedFlowLinkUser().equals(AuthUtil.getUserId()))
+                                .filter(l -> l.getFixedFlowBranchSort() == auditFlow2 && !l.getFixedFlowLinkUser().equals(AuthUtil.getUserId()))
                                 .map(l -> l.getFixedFlowLinkUser() + "")
                                 .collect(Collectors.toList());
                         //根据用户获取这些用户在当前任务中的进度,来判断是否全部审批完成
@@ -3541,16 +3555,21 @@ public class TaskController extends BladeController {
             return null;
         }
         WbsTreePrivate aPrivate = r.getData();
-        try {
-            InputStream fileInputStream = new FileInputStream(aPrivate.getHtmlUrl());
-//            InputStream fileInputStream = new FileInputStream("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1789967486389583872.html");
+        String fileUrl = null;
+        String os = System.getProperty("os.name").toLowerCase();
+        if (os.contains("win")) {
+            fileUrl = "C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1789967486389583872.html";
+        } else {
+            fileUrl = aPrivate.getHtmlUrl();
+        }
+        try (InputStream fileInputStream = new FileInputStream(fileUrl)){
             String htmlString = IoUtil.readToString(fileInputStream);
             htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
             htmlString = htmlString.replaceAll("title", "titlexx");
             // 远程搜索配置
             org.jsoup.nodes.Document doc = Jsoup.parse(htmlString);
             Element table = doc.select("table").first();
-            fileInputStream.close();
+
             return table+"";
         } catch (Exception e) {
            throw new ServiceException("解析咨询意见表单时发生异常");