liuyc 2 years ago
parent
commit
5d28a9401d

+ 4 - 3
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TrialSelfInspectionRecordServiceImpl.java

@@ -713,10 +713,11 @@ public class TrialSelfInspectionRecordServiceImpl
                 String delSql = "delete from u_trial_self_quality_project where self_id = " + obj.getId();
                 jdbcTemplate.execute(delSql);
             } else {
-                List<Long> recordIds = Func.toLongList(obj.getProjectPosition());
                 String delSql = "delete from u_trial_self_quality_project where self_id = " + obj.getId();
                 jdbcTemplate.execute(delSql);
+
                 //保留新增
+                List<Long> recordIds = Func.toLongList(obj.getProjectPosition());
                 for (Long recordNodeId : recordIds) {
                     String insertSql = "insert into u_trial_self_quality_project(id,self_id,quality_node_id) values (" + SnowFlakeUtil.getId() + "," + obj.getId() + "," + recordNodeId + ")";
                     jdbcTemplate.execute(insertSql);
@@ -959,7 +960,7 @@ public class TrialSelfInspectionRecordServiceImpl
         if (("1").equals(dto.getTableType())) {
             if (StringUtils.isEmpty(dto.getRecordNo())) {
                 //获取记录表最大编号
-                List<String> recordNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getRecordNo).collect(Collectors.toList());
+                List<String> recordNos = trialSelfInspectionRecords.stream().filter(f -> ObjectUtils.isNotEmpty(f.getRecordNo())).map(TrialSelfInspectionRecord::getRecordNo).collect(Collectors.toList());
                 String maxRecordNo;
                 if (recordNos.size() == 0 || ObjectUtil.isEmpty(recordNos)) {
                     maxRecordNo = "0001";
@@ -999,7 +1000,7 @@ public class TrialSelfInspectionRecordServiceImpl
         if (("2").equals(dto.getTableType())) {
             if (StringUtils.isEmpty(dto.getReportNo())) {
                 //获取报告单最大编号
-                List<String> reportNos = trialSelfInspectionRecords.stream().map(TrialSelfInspectionRecord::getReportNo).collect(Collectors.toList());
+                List<String> reportNos = trialSelfInspectionRecords.stream().filter(f -> ObjectUtils.isNotEmpty(f.getReportNo())).map(TrialSelfInspectionRecord::getReportNo).collect(Collectors.toList());
                 String maxReportNo;
                 if (reportNos.size() == 0 || ObjectUtil.isEmpty(reportNos)) {
                     maxReportNo = "0001";

+ 31 - 17
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -455,7 +455,7 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "tabId", value = "表Id", required = true),
     })
     public R<List<ExceTabTreVO>> saveLinkeTab(Long exceTabId, Long tabId) throws IOException {
-        String file_path =ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         //String file_path = "C:\\Users\\泓创开发\\Desktop";
 
         // 关联 私有项目 wbs 数据信息
@@ -492,11 +492,11 @@ public class ExcelTabController extends BladeController {
         //解析
         Element table = doc.select("table").first();
         Elements trs = table.select("tr");
-        if (aPrivate.getInitTableId() == null){
+        if (aPrivate.getInitTableId() == null) {
             org.springblade.manager.entity.TableInfo tableInfo = tableInfoService.getOne(new LambdaQueryWrapper<org.springblade.manager.entity.TableInfo>()
                     .eq(org.springblade.manager.entity.TableInfo::getTabEnName, aPrivate.getInitTableName()));
-            aPrivate.setInitTableId(tableInfo.getId()+"");
-            updateWrapper.set("init_table_id", tableInfo.getId()+"");
+            aPrivate.setInitTableId(tableInfo.getId() + "");
+            updateWrapper.set("init_table_id", tableInfo.getId() + "");
         }
 
         List<WbsFormElement> elementList = wbsFormElementService.selectElementListByFid(aPrivate.getInitTableId() + "");
@@ -1144,7 +1144,7 @@ public class ExcelTabController extends BladeController {
                                     }
                                 } else {
                                     Element bforData = tds.get(j - 1);
-                                    if (!bforData.text().isEmpty() || bforData.html().indexOf("hc-form-checkbox-group")>=0) {
+                                    if (!bforData.text().isEmpty() || bforData.html().indexOf("hc-form-checkbox-group") >= 0) {
                                         if (rowspan >= 1) {
                                             data.empty().append("<el-input @keyup.shift.up='keyupShiftUp' @keyup.shift.down='keyupShiftDown' @keyup.shift.left='keyupShiftLeft' @keyup.shift.right='keyupShiftRight' type='textarea' @contextmenu.prevent.native='RightClick(" + parm + ")' trIndex=" + i + " tdIndex=" + j + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%;'   :rows=" + rowspan * 2 + " placeholder=''> </el-input>");
                                         } else {
@@ -1408,13 +1408,13 @@ public class ExcelTabController extends BladeController {
         String tabName = wbsTreeContract.getInitTableName();
         // 字段查询 并去掉公式字段
 
-        String colkeys = "SELECT GROUP_CONCAT(e_key) as colkeys from m_table_info a ,m_wbs_form_element b WHERE a.tab_en_name = '"+tabName+"' and a.id=b.f_id ";
+        String colkeys = "SELECT GROUP_CONCAT(e_key) as colkeys from m_table_info a ,m_wbs_form_element b WHERE a.tab_en_name = '" + tabName + "' and a.id=b.f_id ";
         Map<String, Object> stringObjectMap = jdbcTemplate.queryForMap(colkeys);
         colkeys = stringObjectMap.get("colkeys") + "";
 
         // 复制表数据
 
-        String querySql = "insert into "+tabName+" (id,p_key_id,"+colkeys+") select '"+newPkId+"','"+newPkId+"'," + colkeys + " from " + tabName + " where p_key_id=" + pkeyId;
+        String querySql = "insert into " + tabName + " (id,p_key_id," + colkeys + ") select '" + newPkId + "','" + newPkId + "'," + colkeys + " from " + tabName + " where p_key_id=" + pkeyId;
         jdbcTemplate.execute(querySql);
 
         wbsTreeContractService.save(wbsTreeContract);
@@ -1528,9 +1528,9 @@ public class ExcelTabController extends BladeController {
                 //优先使用电签的PDF
                 pdfUrl = stringObjectMap.get("e_visa_pdf_url");
             }
-            if(StringUtils.isEmpty(pdfUrl+"")){
-                return R.fail(300,"无数据");
-            }else{
+            if (StringUtils.isEmpty(pdfUrl + "")) {
+                return R.fail(300, "无数据");
+            } else {
                 return R.data(pdfUrl);
             }
 
@@ -1645,7 +1645,7 @@ public class ExcelTabController extends BladeController {
     })
     public R<String> getTheLogPdInfo(String theLogId, String nodePrimaryKeyId, String recordTime, String contractId) throws Exception {
         //获取配置的路径
-        String file_path =ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
 
         //获取对应的日志
         JSONObject theLogJson;
@@ -1797,7 +1797,7 @@ public class ExcelTabController extends BladeController {
                                 String key = e.getColKey();
                                 String[] keys = key.split("__");
                                 String[] trtd = keys[1].split("_");
-                                if ( trs.size() > (Integer.parseInt(trtd[0]))) {
+                                if (trs.size() > (Integer.parseInt(trtd[0]))) {
                                     Element trData = trs.get(Integer.parseInt(trtd[0]));
                                     Elements tdDatas = trData.select("td");
                                     if (tdDatas.size() > Integer.parseInt(trtd[1])) {
@@ -1816,7 +1816,8 @@ public class ExcelTabController extends BladeController {
                                         cellRange.getCellStyle().getFont().setColor(Color.white);
                                     }
 
-                            }});
+                                }
+                            });
                         }
                     }
                 }
@@ -1976,10 +1977,10 @@ public class ExcelTabController extends BladeController {
                     resultMapList.add(reData);
                 }
             }
-        }else {
+        } else {
             WbsTreePrivate node = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getPKeyId, nodePrimaryKeyId));
             WbsTreePrivate tableNode = this.wbsTreePrivateService.getOne(Wrappers.<WbsTreePrivate>lambdaQuery()
-                    .eq(WbsTreePrivate::getParentId, node.getId()).eq(WbsTreePrivate::getProjectId,node.getProjectId()));
+                    .eq(WbsTreePrivate::getParentId, node.getId()).eq(WbsTreePrivate::getProjectId, node.getProjectId()));
             Map<String, Object> reData = new HashMap<>();
             // 获取默认值
             QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
@@ -1995,7 +1996,6 @@ public class ExcelTabController extends BladeController {
         }
 
 
-
         return R.data(resultMapList);
     }
 
@@ -2735,13 +2735,27 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "id", value = "记录id-当做groupId", required = true)
     })
     public R<List<Map<String, Object>>> getBussDataInfoTrial(Long id, Long pkeyId) {
-        List<Map<String, Object>> bussDataInfoTrial = excelTabService.getBussDataInfoTrial(id, pkeyId );
+        List<Map<String, Object>> bussDataInfoTrial = excelTabService.getBussDataInfoTrial(id, pkeyId);
         return R.data(bussDataInfoTrial);
     }
 
+    @GetMapping("/get-buss-dataInfo-list-trial")
+    @ApiOperationSupport(order = 34)
+    @ApiOperation(value = "获取试验用户保存数据-质检关联", notes = "获取试验用户保存数据")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "pkeyId", value = "表id", required = true),
+            @ApiImplicitParam(name = "id", value = "记录id-当做groupId", required = true)
+    })
+    public R<Map<String, Object>> getBussDataInfoListTrial(Long id, Long pkeyId) {
+        List<Map<String, Object>> bussDataInfoTrial = excelTabService.getBussDataInfoTrial(id, pkeyId);
+        bussDataInfoTrial.get(0).remove("group_id");
+        return R.data(bussDataInfoTrial.get(0));
+    }
+
 
     /**
      * 在线excel 修改回调
+     *
      * @throws IOException
      */
     @PostMapping(value = "/callbackSave")

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

@@ -1435,8 +1435,9 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         String tabName = wbsTreePrivate.getInitTableName();
         String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
         List<Map<String, Object>> tabList = jdbcTemplate.queryForList(isExitSql);
-        if (tabList == null || tabList.size() <= 0) {
-            throw new ServiceException("无实体表对应");
+        if (tabList.size() <= 0) {
+            //不存在返回null
+            return list;
         }
 
         String querySql = "select * from " + wbsTreePrivate.getInitTableName() + " where p_key_id=" + pkeyId + " and group_id = " + groupId;