Browse Source

bug相关

liuyc 2 years ago
parent
commit
97f73e891b

+ 11 - 10
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -175,18 +175,19 @@ public class TrialDetectionController extends BladeController {
     @ApiOperation(value = "自检多表PDF预览", notes = "传入nodeId、classify、contractId、projectId")
     @ApiOperation(value = "自检多表PDF预览", notes = "传入nodeId、classify、contractId、projectId")
     public R<Object> getPDFs(String nodeId, String classify, String contractId, String projectId) {
     public R<Object> getPDFs(String nodeId, String classify, String contractId, String projectId) {
         String sql = "select pdf_url, e_visa_pdf_url from u_information_query  where project_id ='" + projectId + "' and classify='" + classify + "' and  wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
         String sql = "select pdf_url, e_visa_pdf_url from u_information_query  where project_id ='" + projectId + "' and classify='" + classify + "' and  wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
-        List<InformationQuery> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper<InformationQuery>(InformationQuery.class));
-        Object pdfUrl = "";
-        if (list.size() > 0) {
-            for (InformationQuery informationQuery : list) {
-                pdfUrl = informationQuery.getPdfUrl();
-                if (informationQuery.getEVisaPdfUrl() != null) {
-                    pdfUrl = informationQuery.getEVisaPdfUrl(); //优先使用电签的PDF
-                }
-                break;
+        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
+        if (maps.size() >= 1) {
+            Map<String, Object> stringObjectMap = maps.get(0);
+            Object pdfUrl = stringObjectMap.get("pdf_url");
+            if (stringObjectMap.get("e_visa_pdf_url") != null) {
+                //优先使用电签的PDF
+                pdfUrl = stringObjectMap.get("e_visa_pdf_url");
             }
             }
+            return R.data(pdfUrl);
+        } else {
+            return R.fail("无历史数据预览,请保存数据");
         }
         }
-        return R.data(ObjectUtil.isNotEmpty(pdfUrl) ? pdfUrl : null);
+
     }
     }
 
 
     @GetMapping("/self/raw-material/tree")
     @GetMapping("/self/raw-material/tree")

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/InformationQueryClientImpl.java

@@ -9,6 +9,7 @@ import org.springblade.business.entity.InformationQueryFile;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.feign.InformationQueryClient;
 import org.springblade.business.service.IInformationQueryFileService;
 import org.springblade.business.service.IInformationQueryFileService;
 import org.springblade.business.service.IInformationQueryService;
 import org.springblade.business.service.IInformationQueryService;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import java.util.List;
 import java.util.List;
@@ -47,6 +48,7 @@ public class InformationQueryClientImpl implements InformationQueryClient {
     @Override
     @Override
     public void saveData(String nodeId, String projectId, String contractId, String classify, String link) {
     public void saveData(String nodeId, String projectId, String contractId, String classify, String link) {
         InformationQuery obj = new InformationQuery();
         InformationQuery obj = new InformationQuery();
+        obj.setId(SnowFlakeUtil.getId());
         obj.setWbsId(Long.valueOf(nodeId));
         obj.setWbsId(Long.valueOf(nodeId));
         obj.setProjectId(Long.valueOf(projectId));
         obj.setProjectId(Long.valueOf(projectId));
         obj.setContractId(Long.valueOf(contractId));
         obj.setContractId(Long.valueOf(contractId));

+ 1 - 0
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -572,6 +572,7 @@ public class TrialSelfInspectionRecordServiceImpl
 
 
         //保存实体表数据、记录信息
         //保存实体表数据、记录信息
         String pdfURL = excelTabClient.saveTabData(dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId());
         String pdfURL = excelTabClient.saveTabData(dto.getDataInfo(), dto.getType(), dto.getTableType(), dto.getId());
+
         //返回合并pdfURL
         //返回合并pdfURL
         if (StringUtils.isNotEmpty(pdfURL)) {
         if (StringUtils.isNotEmpty(pdfURL)) {
             LambdaUpdateWrapper<TrialSelfInspectionRecord> updateWrapper = new LambdaUpdateWrapper<>();
             LambdaUpdateWrapper<TrialSelfInspectionRecord> updateWrapper = new LambdaUpdateWrapper<>();

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

@@ -444,10 +444,11 @@ public class ContractInfoController extends BladeController {
     @ApiImplicitParams(value = {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "wbsId", value = "wbsId", required = true),
             @ApiImplicitParam(name = "wbsId", value = "wbsId", required = true),
             @ApiImplicitParam(name = "项目id", value = "projectId", required = true),
             @ApiImplicitParam(name = "项目id", value = "projectId", required = true),
-            @ApiImplicitParam(name = "合同段id", value = "contractId", required = true)
+            @ApiImplicitParam(name = "合同段id", value = "contractId", required = true),
+            @ApiImplicitParam(name = "自检记录id", value = "selfId", required = true)
     })
     })
-    public R trialRelationTree(String wbsId, String projectId, String contractId) {
-        Map<String,Object> tree = contractInfoService.trialRelationTree(wbsId, projectId, contractId);
+    public R trialRelationTree(String wbsId, String projectId, String contractId, String selfId) {
+        Map<String, Object> tree = contractInfoService.trialRelationTree(wbsId, projectId, contractId, selfId);
         if (tree != null && tree.size() > 0) {
         if (tree != null && tree.size() > 0) {
             return R.data(tree);
             return R.data(tree);
         }
         }
@@ -537,5 +538,4 @@ public class ContractInfoController extends BladeController {
     }
     }
 
 
 
 
-
 }
 }

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ContractInfoMapper.java

@@ -81,7 +81,7 @@ public interface ContractInfoMapper extends BaseMapper<ContractInfo> {
 
 
     List<UserContractInfoVO> userListByIds(@Param("ids") List<String> ids);
     List<UserContractInfoVO> userListByIds(@Param("ids") List<String> ids);
 
 
-    @Select("select quality_node_id from u_trial_self_quality_project")
-    List<String> queryList();
+    @Select("select quality_node_id from u_trial_self_quality_project where self_id = #{selfId}")
+    List<String> queryList(@Param("selfId") String selfId);
 
 
 }
 }

+ 1 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IContractInfoService.java

@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.manager.dto.FindAllUserByConditionDTO;
 import org.springblade.manager.dto.FindAllUserByConditionDTO;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.ContractRelationJlyz;
 import org.springblade.manager.entity.ContractRelationJlyz;
-import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.vo.*;
 import org.springblade.manager.vo.*;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.core.mp.base.BaseService;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.entity.User;
@@ -63,6 +62,6 @@ public interface IContractInfoService extends BaseService<ContractInfo> {
 
 
     List<UserContractInfoVO> getContractUserInfo(String contractId);
     List<UserContractInfoVO> getContractUserInfo(String contractId);
 
 
-    Map<String, Object> trialRelationTree(String wbsId, String projectId, String contractId);
+    Map<String, Object> trialRelationTree(String wbsId, String projectId, String contractId, String selfId);
 
 
 }
 }

+ 18 - 10
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ContractInfoServiceImpl.java

@@ -23,8 +23,6 @@ import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserContractInfoVO;
 import org.springblade.system.user.vo.UserVO2;
 import org.springblade.system.user.vo.UserVO2;
-import org.springframework.jdbc.core.BeanPropertyRowMapper;
-import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
@@ -303,19 +301,29 @@ public class ContractInfoServiceImpl extends BaseServiceImpl<ContractInfoMapper,
     }
     }
 
 
     @Override
     @Override
-    public Map<String, Object> trialRelationTree(String wbsId, String projectId, String contractId) {
-        Map<String,Object> maps = new HashMap<>();
-
+    public Map<String, Object> trialRelationTree(String wbsId, String projectId, String contractId, String selfId) {
         //合同段树
         //合同段树
         List<WbsTreeContractVO> wbsTreeContractVOS = baseMapper.tree2(Long.parseLong(wbsId), Long.parseLong(projectId), Long.parseLong(contractId), null, null, null);
         List<WbsTreeContractVO> wbsTreeContractVOS = baseMapper.tree2(Long.parseLong(wbsId), Long.parseLong(projectId), Long.parseLong(contractId), null, null, null);
         List<WbsTreeContractVO> wbsTreeContractVOList = buildWbsTreeByStream(wbsTreeContractVOS);
         List<WbsTreeContractVO> wbsTreeContractVOList = buildWbsTreeByStream(wbsTreeContractVOS);
-
         //是否勾选-试验关联工程部位信息
         //是否勾选-试验关联工程部位信息
-        List<String> list = baseMapper.queryList();
-
-        maps.put("treeContractAll",wbsTreeContractVOList);
-        maps.put("isSelectedStatus",list);
+        List<String> listResult = new ArrayList<>();
+        if (StringUtils.isNotEmpty(selfId)) {
+            List<String> list = baseMapper.queryList(selfId);
+            if (list.size() > 0) {
+                for (WbsTreeContractVO wbsTreeContractVO : wbsTreeContractVOS) {
+                    for (String s : list) {
+                        if (wbsTreeContractVO.getPrimaryKeyId().equals(s)) {
+                            listResult.add(s);
+                        }
+                    }
+                }
+            }
+        }
+        Map<String, Object> maps = new HashMap<>();
+        maps.put("treeContractAll", wbsTreeContractVOList);
+        maps.put("isSelectedStatus", listResult.stream().distinct().collect(Collectors.toList()));
         return maps;
         return maps;
     }
     }
 
 
+
 }
 }

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

@@ -326,7 +326,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     public void formulaFillData(List<TableInfo> tableInfoList, Long nodeId) {
     public void formulaFillData(List<TableInfo> tableInfoList, Long nodeId) {
         if (Func.isNotEmpty(tableInfoList)) {
         if (Func.isNotEmpty(tableInfoList)) {
             /*用来保存日志执行情况*/
             /*用来保存日志执行情况*/
-            StringBuilder log=new StringBuilder();
+            StringBuilder log = new StringBuilder();
             /*每次都是部分表单提交,保证跨节点跨表取数正常,其次是反向依赖的被动刷新*/
             /*每次都是部分表单提交,保证跨节点跨表取数正常,其次是反向依赖的被动刷新*/
             List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId.toString(), "1", tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId());
             List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId.toString(), "1", tableInfoList.get(0).getContractId(), tableInfoList.get(0).getProjectId());
             StopWatch stopWatch = new StopWatch();
             StopWatch stopWatch = new StopWatch();
@@ -347,7 +347,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 List<Formula> formulas = this.formulaService.getFormulaList(keyMappers);
                 List<Formula> formulas = this.formulaService.getFormulaList(keyMappers);
                 WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, nodeId));
                 WbsTreeContract wtc = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, nodeId));
                 CurrentNode currentNode = createCurrentNode(wtc);
                 CurrentNode currentNode = createCurrentNode(wtc);
-                TableElementConverter tec = new TableElementConverter(tableInfoList, keyMappers, formulas, coordinateMap,currentNode,tableAll);
+                TableElementConverter tec = new TableElementConverter(tableInfoList, keyMappers, formulas, coordinateMap, currentNode, tableAll);
                 tec.setLog(log);
                 tec.setLog(log);
                 if (tec.isPresent()) {
                 if (tec.isPresent()) {
                     tec.before();
                     tec.before();
@@ -355,12 +355,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                     tec.after();
                     tec.after();
                 }
                 }
                 stopWatch.stop();
                 stopWatch.stop();
-                Long totalTime=stopWatch.getTotalTimeMillis();
+                Long totalTime = stopWatch.getTotalTimeMillis();
                 log.append("公式执行消耗时间:").append(totalTime);
                 log.append("公式执行消耗时间:").append(totalTime);
                 StaticLog.info("公式执行用时:{}", totalTime);
                 StaticLog.info("公式执行用时:{}", totalTime);
-                String[] sql=new String[]{
-                        "delete from m_formula_log where id ="+wtc.getPKeyId(),
-                        "INSERT INTO m_formula_log (id,content) VALUES ("+wtc.getPKeyId()+", '"+log+"')"
+                String[] sql = new String[]{
+                        "delete from m_formula_log where id =" + wtc.getPKeyId(),
+                        "INSERT INTO m_formula_log (id,content) VALUES (" + wtc.getPKeyId() + ", '" + log + "')"
                 };
                 };
                 this.jdbcTemplate.batchUpdate(sql);
                 this.jdbcTemplate.batchUpdate(sql);
             }
             }
@@ -746,8 +746,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
             Elements xmtitle = doc.select("el-input[placeholder~=^项目名称]");
 
 
 
 
-
-
             // Elements title = doc.select("el-input[placeholder~=^编号]");
             // Elements title = doc.select("el-input[placeholder~=^编号]");
 
 
             /**
             /**
@@ -761,15 +759,15 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             ContractInfo contractInfo = contractInfoService.getById(wbsTreeContract.getContractId());
             ContractInfo contractInfo = contractInfoService.getById(wbsTreeContract.getContractId());
             // 施工单位名称
             // 施工单位名称
             if (dwtitle.size() >= 1) {
             if (dwtitle.size() >= 1) {
-                int y =Integer.parseInt(dwtitle.attr("trindex"));
-                if(y<=10){
+                int y = Integer.parseInt(dwtitle.attr("trindex"));
+                if (y <= 10) {
                     reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
                     reData.put(dwtitle.attr("keyName"), contractInfo.getConstructionUnitName());
                 }
                 }
 
 
             }
             }
             if (sgtitle.size() >= 1) {
             if (sgtitle.size() >= 1) {
-                int y =Integer.parseInt(sgtitle.attr("trindex"));
-                if(y<=10) {
+                int y = Integer.parseInt(sgtitle.attr("trindex"));
+                if (y <= 10) {
                     reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
                     reData.put(sgtitle.attr("keyName"), contractInfo.getConstructionUnitName());
                 }
                 }
             }
             }
@@ -804,7 +802,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             }
             }
 
 
             // 项目名称
             // 项目名称
-            if (xmtitle.size() >= 1 ) {
+            if (xmtitle.size() >= 1) {
                 for (Element element : xmtitle) {
                 for (Element element : xmtitle) {
                     int trindex = Integer.parseInt(element.attr("trindex"));
                     int trindex = Integer.parseInt(element.attr("trindex"));
                     if (trindex <= 6) {
                     if (trindex <= 6) {
@@ -906,7 +904,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     @Override
     @Override
     public R getBussPdfInfo(Long pkeyId) throws Exception {
     public R getBussPdfInfo(Long pkeyId) throws Exception {
 
 
-        String file_path =ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
 
 
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
@@ -1072,7 +1070,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
 
                 // 组装电签设置
                 // 组装电签设置
                 QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
                 QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
-                queryWrapper.in("type", 2,6);
+                queryWrapper.in("type", 2, 6);
                 queryWrapper.eq("tab_id", wbsTreeContract.getIsTypePrivatePid());
                 queryWrapper.eq("tab_id", wbsTreeContract.getIsTypePrivatePid());
 
 
                 List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
                 List<TextdictInfo> textdictInfos = textdictInfoService.getBaseMapper().selectList(queryWrapper);
@@ -1338,8 +1336,8 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             throw new ServiceException("操作失败!");
             throw new ServiceException("操作失败!");
         }
         }
 
 
-        @SuppressWarnings("unchecked") //忽略警告
-        Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfoTrial(pkeyId);
+        List<Map<String, Object>> bussDataInfoTrial = getBussDataInfoTrial(pkeyId);
+        Map<String, Object> DataInfo = bussDataInfoTrial.stream().findAny().orElse(null);
 
 
         // 获取excel流 和 html流
         // 获取excel流 和 html流
         Workbook wb = new Workbook();
         Workbook wb = new Workbook();
@@ -1357,7 +1355,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             }
             }
         }
         }
 
 
-        //数据不为空 &&
+        //数据不为空
         if (StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())) {
         if (StringUtils.isNotEmpty(wbsTreePrivate.getHtmlUrl())) {
             File htmlFile = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
             File htmlFile = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
             if (htmlFile.exists()) {
             if (htmlFile.exists()) {
@@ -1578,7 +1576,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         String querySql = "select * from u_information_query where classify='" + classify + "' and  wbs_id='" + id + "' and contract_id ='" + contractId + "'";
         String querySql = "select * from u_information_query where classify='" + classify + "' and  wbs_id='" + id + "' and contract_id ='" + contractId + "'";
         List<Map<String, Object>> resultSQL = jdbcTemplate.queryForList(querySql);
         List<Map<String, Object>> resultSQL = jdbcTemplate.queryForList(querySql);
         if (resultSQL.size() > 0) {
         if (resultSQL.size() > 0) {
-            informationQueryClient.updateInformationQuery(bladeFile.getLink(), classify, id.toString(), contractId);
+            String updateSql = "update u_information_query set pdf_url = '" + bladeFile.getLink() + "' where classify='" + classify + "' and  wbs_id='" + id + "' and contract_id ='" + contractId + "'";
+            jdbcTemplate.execute(updateSql);
+            //informationQueryClient.updateInformationQuery(bladeFile.getLink(), classify, id.toString(), contractId);
         } else {
         } else {
             informationQueryClient.saveData(id.toString(), projectId, contractId, classify, bladeFile.getLink());
             informationQueryClient.saveData(id.toString(), projectId, contractId, classify, bladeFile.getLink());
         }
         }