liuyc преди 2 години
родител
ревизия
0e40160dc2

+ 2 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/TableInfoDTO.java

@@ -33,4 +33,6 @@ public class TableInfoDTO extends TableInfo {
 
 	private String nodeName;
 
+	private Integer tableType;
+
 }

+ 23 - 21
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/TableInfo.java

@@ -17,7 +17,9 @@
 package org.springblade.manager.entity;
 
 import com.baomidou.mybatisplus.annotation.TableName;
+
 import java.io.Serializable;
+
 import org.springblade.core.mp.base.BaseEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -33,26 +35,26 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 public class TableInfo extends BaseEntity {
 
-	private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-	/**
-	* 表单英文名
-	*/
-		private String tabEnName;
-	/**
-	* 表单中文名称
-	*/
-		private String tabChName;
-	/**
-	* 表单类型
-	*/
-		private Integer tabType;
-	/**
-	* 表单所属方
-	*/
-		private String tableOwner;
-	/**
-	* 填报率百分比
-	*/
-		private String fillRate;
+    /**
+     * 表单英文名
+     */
+    private String tabEnName;
+    /**
+     * 表单中文名称
+     */
+    private String tabChName;
+    /**
+     * 表单类型
+     */
+    private Integer tabType;
+    /**
+     * 表单所属方
+     */
+    private String tableOwner;
+    /**
+     * 填报率百分比
+     */
+    private String fillRate;
 }

+ 5 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/WbsFormElementVO2.java

@@ -9,6 +9,11 @@ import java.util.List;
 @Data
 public class WbsFormElementVO2 implements Serializable {
 
+    /**
+     * 项目id
+     */
+    private String projectId;
+
     /**
      * 实体表名
      */

+ 5 - 15
blade-service/blade-business/src/main/java/org/springblade/business/controller/TrialDetectionController.java

@@ -1,8 +1,6 @@
 package org.springblade.business.controller;
 
-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 io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -11,27 +9,19 @@ import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import lombok.SneakyThrows;
 import org.springblade.business.dto.*;
-import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.entity.TrialDetectionData;
 import org.springblade.business.service.ITrialDetectionDataService;
 import org.springblade.business.service.ITrialSampleInfoService;
 import org.springblade.business.service.ITrialSelfInspectionRecordService;
 import org.springblade.business.vo.*;
-import org.springblade.common.constant.CommonConstant;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
-import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.FileUtil;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.manager.entity.TableFile;
-import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.feign.WbsTreePrivateClient;
 import org.springblade.manager.vo.WbsTreePrivateVO;
-import org.springblade.resource.vo.NewBladeFile;
-import org.springblade.system.cache.ParamCache;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -48,11 +38,11 @@ import java.util.Map;
 @Api(value = "试验检测", tags = "试验检测接口")
 public class TrialDetectionController extends BladeController {
 
-    private ITrialDetectionDataService iTrialDetectionDataService;
-    private ITrialSampleInfoService iTrialSampleInfoService;
-    private ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
-    private WbsTreePrivateClient wbsTreePrivateClient;
-    private JdbcTemplate jdbcTemplate;
+    private final ITrialDetectionDataService iTrialDetectionDataService;
+    private final ITrialSampleInfoService iTrialSampleInfoService;
+    private final ITrialSelfInspectionRecordService iTrialSelfInspectionRecordService;
+    private final WbsTreePrivateClient wbsTreePrivateClient;
+    private final JdbcTemplate jdbcTemplate;
 
     @GetMapping("/data/detail")
     @ApiOperationSupport(order = 1)

+ 6 - 3
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -382,7 +382,9 @@
             query.report_number,
             query.file_user_id_and_name,
             query.pdf_url,
-            query.e_visa_pdf_url
+            query.e_visa_pdf_url,
+            (select sort from m_wbs_tree_contract where p_key_id = query.wbs_id and is_deleted = 0) as sort,
+            (select parent_id from m_wbs_tree_contract where p_key_id = query.wbs_id and is_deleted = 0) as parentId
         from
         (
             select
@@ -395,7 +397,8 @@
                 file_user_id_and_name,
                 date_format(create_time,'%Y-%m-%d') as createTimes,
                 pdf_url,
-                e_visa_pdf_url
+                e_visa_pdf_url,
+                wbs_id
             from u_information_query
             where
                 is_deleted = 0
@@ -414,13 +417,13 @@
                     #{wbsIdc}
                 </foreach>
             </if>
-            order by create_time ASC
         ) AS query
         where
           1 = 1
         <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
             and query.createTimes between #{query.startTime} and #{query.endTime}
         </if>
+        order by parentId,sort
         limit #{current}, #{size}
     </select>
 

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

@@ -63,20 +63,20 @@ public class TrialSelfInspectionRecordServiceImpl
         extends BaseServiceImpl<TrialSelfInspectionRecordMapper, TrialSelfInspectionRecord>
         implements ITrialSelfInspectionRecordService {
 
-    private TrialSampleInfoMapper trialSampleInfoMapper;
-    private TrialMaterialMobilizationMapper trialMaterialMobilizationMapper;
-    private IUserClient iUserClient;
-    private ContractClient contractClient;
-    private WbsTreePrivateClient wbsTreePrivateClient;
-    private WbsTreeContractClient wbsTreeContractClient;
-    private ExcelTabClient excelTabClient;
-    private IDictClient iDictClient;
-    private JdbcTemplate jdbcTemplate;
-    private NewIOSSClient newIOSSClient;
-    private InformationQueryClient informationQueryClient;
-    private IOSSClient iossClient;
-    private CommonFileClient commonFileClient;
-    private TableFileClient tableFileClient;
+    private final TrialSampleInfoMapper trialSampleInfoMapper;
+    private final TrialMaterialMobilizationMapper trialMaterialMobilizationMapper;
+    private final IUserClient iUserClient;
+    private final ContractClient contractClient;
+    private final WbsTreePrivateClient wbsTreePrivateClient;
+    private final WbsTreeContractClient wbsTreeContractClient;
+    private final ExcelTabClient excelTabClient;
+    private final IDictClient iDictClient;
+    private final JdbcTemplate jdbcTemplate;
+    private final NewIOSSClient newIOSSClient;
+    private final InformationQueryClient informationQueryClient;
+    private final IOSSClient iossClient;
+    private final CommonFileClient commonFileClient;
+    private final TableFileClient tableFileClient;
 
     @Override
     public IPage<TrialSelfInspectionRecordVO> selfPage(IPage<TrialSelfInspectionRecord> page, TrialSelfInspectionRecordPageDTO dto) {

+ 7 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TableInfoController.java

@@ -34,6 +34,8 @@ import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.manager.dto.TableInfoDTO;
 import org.springblade.manager.entity.WbsTree;
 import org.springblade.manager.service.impl.WbsTreeServiceImpl;
+import org.springblade.system.entity.Dict;
+import org.springblade.system.feign.IDictClient;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -58,6 +60,7 @@ public class TableInfoController extends BladeController {
 
     private final ITableInfoService tableInfoService;
     private final WbsTreeServiceImpl wbsTreeService;
+    private final IDictClient dictClient;
 
     /**
      * 详情
@@ -147,12 +150,15 @@ public class TableInfoController extends BladeController {
                 wbsTree.setNodeName(tableInfo.getNodeName());
                 wbsTree.setFullName(tableInfo.getNodeName());
                 wbsTree.setTableOwner(tableInfo.getTableOwner());
-                wbsTree.setTableType(tableInfo.getTabType());
+                wbsTree.setTableType(tableInfo.getTableType());
+
                 wbsTreeService.updateById(wbsTree);
 
                 TableInfo tableInfoObj = BeanUtil.copyProperties(tableInfo, TableInfo.class);
                 if (tableInfoObj != null) {
                     tableInfoObj.setTabChName(wbsTree.getNodeName());
+                    tableInfoObj.setTabType(wbsTree.getTableType());
+                    tableInfoObj.setTableOwner(wbsTree.getTableOwner());
                     tableInfoService.updateById(tableInfoObj);
                 }
             }

+ 0 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java

@@ -1,12 +1,10 @@
 package org.springblade.manager.controller;
 
-import com.alibaba.cloud.commons.lang.StringUtils;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.*;
 import lombok.AllArgsConstructor;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.Func;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.service.IWbsTreeContractService;
@@ -27,7 +25,6 @@ public class WbsTreeContractController extends BladeController {
 
     private final IWbsTreeContractService iWbsTreeContractService;
 
-
     @GetMapping("/search-node-tables")
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "查询当前节点下所有元素表信息", notes = "传入节点primaryKeyId、type、合同段id、项目id")

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

@@ -686,12 +686,21 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             File file1 = ResourceUtil.getFile(wbsTreeContract.getHtmlUrl());
             String htmlString = IoUtil.readToString(new FileInputStream(file1));
             Document doc = Jsoup.parse(htmlString);
-            //解析
-            Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
+
+            // 解析
+            // 模糊匹配
+            /*Elements dwtitle = doc.select("el-input[placeholder~=.*承包单位]");
             Elements sgtitle = doc.select("el-input[placeholder~=^施工单位]");
             Elements htdtitle = doc.select("el-input[placeholder~=.*合同段.*]");
             Elements jltitle = doc.select("el-input[placeholder~=^监理单位]");
-            Elements bhtitle = doc.select("el-input[placeholder~=^编号]");
+            Elements bhtitle = doc.select("el-input[placeholder~=^编号]");*/
+
+            // 精确匹配
+            Elements dwtitle = doc.select("el-input[placeholder=承包单位]");
+            Elements sgtitle = doc.select("el-input[placeholder=施工单位]");
+            Elements htdtitle = doc.select("el-input[placeholder=合同段]");
+            Elements jltitle = doc.select("el-input[placeholder=监理单位]");
+            Elements bhtitle = doc.select("el-input[placeholder=编号]");
 
             // Elements title = doc.select("el-input[placeholder~=^编号]");
 
@@ -700,7 +709,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
              * 监理单位:引用监理单位名称
              * 合同段、所属建设项目(合同段):引用合同段编号
              */
-
             ContractInfo contractInfo = contractInfoService.getById(wbsTreeContract.getContractId());
             // 施工单位名称
             if (dwtitle.size() >= 1) {
@@ -792,6 +800,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
                 }
             }
         }
+
         // 获取默认值
         QueryWrapper<TextdictInfo> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("type", 4);
@@ -807,7 +816,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
             }
         }
 
-
         // 移除Id 和 p_key_id
         reData.remove("id");
         reData.remove("p_key_id");

+ 56 - 36
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsFormElementServiceImpl.java

@@ -10,16 +10,10 @@ import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.constant.BladeConstant;
-import org.springblade.core.tool.utils.DateUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.StringPool;
-import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.manager.dto.FormElementDTO2;
 import org.springblade.manager.dto.WbsFormElementDTO2;
-import org.springblade.manager.entity.TableInfo;
-import org.springblade.manager.entity.WbsFormElement;
-import org.springblade.manager.entity.WbsTabRelationExcelTab;
-import org.springblade.manager.entity.WbsTree;
+import org.springblade.manager.entity.*;
 import org.springblade.manager.excel.WbsFormElementBatchExcel;
 import org.springblade.manager.excel.WbsFormElementExcel;
 import org.springblade.manager.mapper.TableInfoMapper;
@@ -352,38 +346,52 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
         if (StringUtils.isEmpty(wbsFormElementVO2.getInitTableName())) {
             throw new ServiceException("未获取到实体表名称,操作失败");
         }
-        //获取当前表所有元素
-        List<WbsFormElement> wbsFormElements = baseMapper.selectList(Wrappers.<WbsFormElement>query().lambda()
-                .eq(WbsFormElement::getFId, wbsFormElementVO2.getId()));
-        List<String> eKeys = new ArrayList<>();
-        wbsFormElements.forEach(id -> {
-            String eKey1 = id.getEKey();
-            eKeys.add(eKey1);
-        });
-
-        int id;
-        if (eKeys.size() == 0) {
-            id = 0;
-        } else {
-            id = Integer.parseInt(eKeys.get(eKeys.size() - 1).split("_")[1]);
+        WbsTree wbsTree = new WbsTree();
+        wbsTree.setInitTableName(wbsFormElementVO2.getInitTableName());
+        Integer integer = baseMapper.showShowTabLike(wbsTree);
+        if (integer != 1) {
+            throw new ServiceException("实体信息表不存在");
         }
+        WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.selectOne(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getProjectId, wbsFormElementVO2.getProjectId()).eq(WbsTreePrivate::getId, wbsFormElementVO2.getId()));
+        if (wbsTreePrivate != null && ObjectUtil.isNotEmpty(wbsTreePrivate.getInitTableId())) {
+            //获取当前表所有元素
+            List<WbsFormElement> wbsFormElements = baseMapper.selectList(Wrappers.<WbsFormElement>query().lambda()
+                    .eq(WbsFormElement::getFId, wbsTreePrivate.getInitTableId()));
+            List<String> eKeys = new ArrayList<>();
+            wbsFormElements.forEach(id -> {
+                String eKey1 = id.getEKey();
+                eKeys.add(eKey1);
+            });
+
+            int id;
+            if (eKeys.size() == 0) {
+                id = 0;
+            } else {
+                id = Integer.parseInt(eKeys.get(eKeys.size() - 1).split("_")[1]);
+            }
 
-        //新增元素
-        List<WbsFormElement> listData = wbsFormElementVO2.getListData();
-        for (WbsFormElement listDatum : listData) {
-            id++;
-            listDatum.setFId(wbsFormElementVO2.getId());
-            String initTableFiledType = WbsElementUtil.getInitTableFiledType(listDatum.getEType());
-            Integer elementLength = WbsElementUtil.getElementLength2(initTableFiledType);
-            listDatum.setELength(elementLength);
-            listDatum.setEKey("key_" + id);
-        }
+            //新增元素
+            List<WbsFormElement> listData = wbsFormElementVO2.getListData();
+            for (WbsFormElement listDatum : listData) {
+                id++;
 
-        this.saveBatch(listData);
+                listDatum.setFId(wbsTreePrivate.getInitTableId());
 
-        //同步
-        return syncDataFiled(wbsFormElementVO2.getInitTableName(), listData);
+                String initTableFiledType = WbsElementUtil.getInitTableFiledType(listDatum.getEType());
+                Integer elementLength = WbsElementUtil.getElementLength2(initTableFiledType);
+                listDatum.setELength(elementLength);
+                listDatum.setEKey("key_" + id);
+            }
 
+            this.saveBatch(listData);
+
+            //同步
+            syncDataFiled(wbsFormElementVO2.getInitTableName(), listData);
+            return true;
+
+        } else {
+            throw new ServiceException("未获取到对应元素表的initTableId");
+        }
     }
 
     @Override
@@ -802,7 +810,19 @@ public class WbsFormElementServiceImpl extends BaseServiceImpl<WbsFormElementMap
             // String initTableFiledType = getInitTableFiledType(listDatum.getEType());
             // int elementLength = getElementLength(initTableFiledType);
             //同步
-            baseMapper.addTableFiled(initTableName, listDatum.getEKey(), "varchar", DEFAULT_ELEMENT_LENGTH_VARCHAR);
+            //判断是否存在该Key字段
+            int row1 = wbsTreeMapper.isThereAField(initTableName, listDatum.getEKey());
+            if (row1 == 0) {
+                //追加字段到实体表中
+                wbsTreeMapper.alterTableFiled(initTableName, listDatum.getEKey(), "varchar", DEFAULT_ELEMENT_LENGTH_VARCHAR);
+                //判断是否追加成功
+                int row2 = wbsTreeMapper.isThereAField(initTableName, listDatum.getEKey());
+                if (row2 != 1) {
+                    //追加失败,删除元素,跳过
+                    baseMapper.deleteElementByfId2(listDatum.getId());
+                }
+            }
+            //baseMapper.addTableFiled(initTableName, listDatum.getEKey(), "varchar", DEFAULT_ELEMENT_LENGTH_VARCHAR);
         }
         return true;
     }