Răsfoiți Sursa

排序相关

liuyc 2 ani în urmă
părinte
comite
9d1a696cde

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

@@ -19,6 +19,7 @@ package org.springblade.manager.entity;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
 
+import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiModelProperty;
 import org.springblade.core.mp.base.BaseEntity;
 import lombok.Data;
@@ -97,7 +98,12 @@ public class ExcelTab extends BaseEntity {
 	* 附件大小
 	*/
 	@ApiModelProperty(value = "附件大小")
-		private Long attachSize;
+	private Long attachSize;
 
+	/**
+	 * 排序
+	 */
+	@ApiModelProperty(value = "排序")
+	private Integer sort;
 
 }

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/TreeNodeVO.java

@@ -2,9 +2,11 @@ package org.springblade.manager.vo;
 
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import lombok.Data;
 import org.springblade.core.tool.node.BaseNode;
 import org.springblade.core.tool.node.TreeNode;
 
+@Data
 public class TreeNodeVO extends BaseNode<TreeNode> {
     private static final long serialVersionUID = 1L;
     private String title;
@@ -43,6 +45,8 @@ public class TreeNodeVO extends BaseNode<TreeNode> {
 
     private Integer majorDataType;
 
+    private String mixRatioTestIds;
+
     public TreeNodeVO() {
     }
 

+ 32 - 23
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -256,6 +256,16 @@ public class ExcelTabController extends BladeController {
         return R.data(tree);
     }
 
+    /**
+     * 清表模板树节点排序
+     */
+    @PostMapping("/tab-sort")
+    @ApiOperationSupport(order = 8)
+    @ApiOperation(value = "清表模板树节点排序", notes = "传入节点ids字符串,英文逗号分割")
+    public R<Object> tabSort(@RequestParam String ids) {
+        return R.status(excelTabService.tabSort(Func.toStrList(ids)));
+    }
+
     /**
      * 上传文件
      *
@@ -409,7 +419,7 @@ public class ExcelTabController extends BladeController {
                     wbsTreePrivateService.update(updateWrapper);
                 }
             }
-        }else{
+        } else {
             excelTabService.saveOrUpdate(excelTab);
         }
 
@@ -440,7 +450,7 @@ public class ExcelTabController extends BladeController {
     })
     public R<List<ExceTabTreVO>> saveLinkeTab(Long exceTabId, Long tabId) throws IOException {
         //String file_path ="C:\\Users\\Administrator\\Desktop\\fsdownload\\"; //ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        String file_path =ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
+        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
 
         // 关联 私有项目 wbs 数据信息
         WbsTreePrivate wbsTree = new WbsTreePrivate();
@@ -460,7 +470,7 @@ public class ExcelTabController extends BladeController {
 
         // 复制模版htmlURL
         File file_in = ResourceUtil.getFile(excelTab.getHtmlUrl());
-       // File file_in = ResourceUtil.getFile(file_path+"1542338623020961794.html");
+        // File file_in = ResourceUtil.getFile(file_path+"1542338623020961794.html");
         String filecode = SnowFlakeUtil.getId() + "";
         String thmlUrl = file_path + "/privateUrl/" + filecode + ".html";
         File file_out = ResourceUtil.getFile(thmlUrl);
@@ -541,7 +551,7 @@ public class ExcelTabController extends BladeController {
 
 
         //由于日志无法拿到基本节点,将 关联html的id 放入在父节点excelId 处理
-        if (aPrivate.getType()!=10 && aPrivate.getWbsType().equals("4")) {
+        if (aPrivate.getType() != 10 && aPrivate.getWbsType().equals("4")) {
             WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getBaseMapper().selectOne(Wrappers.<WbsTreePrivate>query().lambda()
                     .eq(WbsTreePrivate::getId, aPrivate.getParentId())  // 获取父节点Id
                     .eq(WbsTreePrivate::getWbsType, "4")  // 内型为4
@@ -554,7 +564,7 @@ public class ExcelTabController extends BladeController {
         }
         wbsTreePrivateService.update(updateWrapper);
         //关联项目下所有的合同段
-        if(aPrivate.getType()!=10){
+        if (aPrivate.getType() != 10) {
             aPrivate.setHtmlUrl(thmlUrl);
             wbsTreeContractService.updateAllNodeTabById(aPrivate);
         }
@@ -606,7 +616,7 @@ public class ExcelTabController extends BladeController {
         // 标题解决
         ProjectInfo projectInfo = projectInfoService.getById(wbsTreeContract.getProjectId());
         // 添加标题显示
-       // Elements dwtitle = doc.getElementsByAttributeValueMatching("style", "18.0pt");
+        // Elements dwtitle = doc.getElementsByAttributeValueMatching("style", "18.0pt");
         Elements trs = table.select("tr");
         for (int i = 0; i < 6; i++) {
             Element tr = trs.get(i);
@@ -615,10 +625,10 @@ public class ExcelTabController extends BladeController {
                 Element data = tds.get(j);
                 int colspan = data.attr("COLSPAN").equals("") ? 0 : Integer.parseInt(data.attr("COLSPAN"));
                 String style = data.attr("style");
-                if(style.indexOf("font-size")>=0){
-                    int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:")+10,style.indexOf(".0pt")));
-                    if (StringUtils.isNotEmpty(data.text())  && fontsize>=12) {
-                        trs.get(i-1).select("td").get(0).text(projectInfo.getProjectName());
+                if (style.indexOf("font-size") >= 0) {
+                    int fontsize = Integer.parseInt(style.substring(style.indexOf("font-size:") + 10, style.indexOf(".0pt")));
+                    if (StringUtils.isNotEmpty(data.text()) && fontsize >= 12) {
+                        trs.get(i - 1).select("td").get(0).text(projectInfo.getProjectName());
                     }
                 }
             }
@@ -1250,7 +1260,7 @@ public class ExcelTabController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
-    public R copeBussTab(Long pkeyId){
+    public R copeBussTab(Long pkeyId) {
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
 
@@ -1289,7 +1299,7 @@ public class ExcelTabController extends BladeController {
         // 复制表数据
         String querySql = "select " + colkeys + " from " + tabName + " where p_key_id=" + pkeyId;
         List<Map<String, Object>> dataList = jdbcTemplate.queryForList(querySql);
-        if (dataList != null && dataList.size()>=1) {
+        if (dataList != null && dataList.size() >= 1) {
             Map<String, Object> dataMap2 = dataList.get(0);
 
             dataMap2.remove("p_key_id");
@@ -1421,7 +1431,7 @@ public class ExcelTabController extends BladeController {
         String sql = "select pdf_url, e_visa_pdf_url from u_information_query  where classify='" + classify + "' and  wbs_id='" + nodeId + "' and contract_id ='" + contractId + "' ";
 
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
-        if(maps!=null && maps.size()>=1){
+        if (maps != null && maps.size() >= 1) {
             Map<String, Object> stringObjectMap = maps.get(0);
             Object pdfUrl = stringObjectMap.get("pdf_url");
             if (stringObjectMap.get("e_visa_pdf_url") != null) {
@@ -1429,7 +1439,7 @@ public class ExcelTabController extends BladeController {
                 pdfUrl = stringObjectMap.get("e_visa_pdf_url");
             }
             return R.data(pdfUrl);
-        }else{
+        } else {
             return R.fail("无历史数据预览,请保存数据");
         }
     }
@@ -1473,7 +1483,7 @@ public class ExcelTabController extends BladeController {
         }
 
         R info = this.excelTabService.saveOrUpdateInfo(tableInfoList);
-        if(!info.isSuccess()){
+        if (!info.isSuccess()) {
             return info;
         }
         //单个 pdf加载
@@ -1772,11 +1782,11 @@ public class ExcelTabController extends BladeController {
                     //数据结果
                     Map<String, Object> reData = new HashMap<>();
 
-                    String id = mysqlData.get("id")+"" ;
-                    String querySqlx = "SELECT tree_primary_key_id as primaryKeyId,title as path from u_contract_log_wbs where  business_id ='"+id+"' and is_deleted=0";
+                    String id = mysqlData.get("id") + "";
+                    String querySqlx = "SELECT tree_primary_key_id as primaryKeyId,title as path from u_contract_log_wbs where  business_id ='" + id + "' and is_deleted=0";
                     List<Map<String, Object>> businessDat = this.jdbcTemplate.queryForList(querySqlx);
-                    if(businessDat!=null){
-                        reData.put("linkTabIds",businessDat);
+                    if (businessDat != null) {
+                        reData.put("linkTabIds", businessDat);
                     }
 
                     for (String key : mysqlData.keySet()) {
@@ -2554,8 +2564,8 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "linkids", value = "节点信息表", required = true),
             @ApiImplicitParam(name = "type", value = "(1 元素表关联  2表示新增 3 表示项目节点关联)", required = true)
     })
-    public R saveLinkeTableInfo(String tabId, String linkids,String type){
-        return wbsTreePrivateService.saveLinkeTableInfo(tabId,linkids,type);
+    public R saveLinkeTableInfo(String tabId, String linkids, String type) {
+        return wbsTreePrivateService.saveLinkeTableInfo(tabId, linkids, type);
     }
 
 
@@ -2565,10 +2575,9 @@ public class ExcelTabController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
-    public R getBussDataInfoTrial(Long pkeyId){
+    public R getBussDataInfoTrial(Long pkeyId) {
         return excelTabService.getBussDataInfoTrial(pkeyId);
     }
 
 
-
 }

+ 10 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsInfoController.java

@@ -169,5 +169,15 @@ public class WbsInfoController extends BladeController {
         return R.fail("未查询到信息");
     }
 
+    /**
+     * 元素库、独立库节点排序
+     */
+    @PostMapping("/tab-sort")
+    @ApiOperationSupport(order = 9)
+    @ApiOperation(value = "元素库、独立库节点排序", notes = "传入节点primaryKeyIds字符串,英文逗号分割")
+    public R<Object> tabNodeSort(@RequestParam String primaryKeyIds) {
+        return R.status(wbsInfoService.tabNodeSort(Func.toStrList(primaryKeyIds)));
+    }
+
 
 }

+ 2 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ExcelTabMapper.xml

@@ -21,6 +21,7 @@
         <result column="extension" property="extension"/>
         <result column="attach_size" property="attachSize"/>
         <result column="tab_type" property="tabType"/>
+        <result column="sort" property="sort"/>
     </resultMap>
 
     <resultMap id="treeNodeResultMap" type="org.springblade.manager.vo.ExceTabTreVO">
@@ -84,7 +85,7 @@
         <if test="param1!=null and param1!=''">
             and dept.tenant_id = #{param1}
         </if>
-        ORDER BY dept.create_time
+        ORDER BY dept.sort,dept.create_time
     </select>
 
 

+ 9 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.xml

@@ -58,6 +58,7 @@
         <result column="nodeType" property="nodeType"/>
         <result column="isExistForm" property="isExistForm"/>
         <result column="majorDataType" property="majorDataType"/>
+        <result column="mixRatioTestIds" property="mixRatioTestIds"/>
     </resultMap>
 
     <resultMap id="treeNodeResultMap2" type="org.springblade.manager.vo.TreeNodeVO">
@@ -304,6 +305,7 @@
         d.id AS "key",
         d.major_data_type AS "majorDataType",
         d.is_exist_form AS "isExistForm",
+        d.mix_ratio_test_ids AS "mixRatioTestIds",
         (
         SELECT
         CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
@@ -545,6 +547,7 @@
         (SELECT count(1) FROM m_wbs_form_element WHERE f_id = initTableId and is_deleted=0) AS "elementTotal",
         (SELECT dict_value from blade_dict where code='owner_type' and dict_key not in(-1,0) and dict_key=table_owner )
         as tabOwner,
+        (SELECT sort FROM m_wbs_node_sort c WHERE a.p_key_id = c.p_key_id) AS sort,
         (
         SELECT
         CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
@@ -578,6 +581,8 @@
         <if test="titleName != null and titleName != ''">
             and a.title like concat('%',#{titleName},'%') and LENGTH(a.p_key_id)>11
         </if>
+
+        order by sort
     </select>
 
     <!-- 项目级 表单类型分类 wbs树 -->
@@ -588,6 +593,7 @@
         (SELECT count(1) FROM m_wbs_form_element WHERE f_id = initTableId and is_deleted=0) AS "elementTotal",
         (SELECT dict_value from blade_dict where code='owner_type' and dict_key not in(-1,0) and dict_key=table_owner )
         as tabOwner,
+        (SELECT sort FROM m_wbs_node_sort c WHERE a.p_key_id = c.p_key_id) AS sort,
         (
         SELECT
         CASE WHEN count(1) > 0 THEN 1 ELSE 0 END
@@ -610,7 +616,8 @@
         SELECT dict_key as p_key_id ,dict_value as title,'12345678910' as parent_id,0 as table_type,0 as fill_rate,0 as
         table_owner,0 as initTableId from blade_dict where code='table_type' and dict_key not in(-1,0)
         union all
-        SELECT id as p_key_id,tab_ch_name as title,tab_type as parent_id,tab_type as table_type,fill_rate,table_owner,id as initTableId  from m_table_info WHERE is_deleted=0
+        SELECT id as p_key_id,tab_ch_name as title,tab_type as parent_id,tab_type as table_type,fill_rate,table_owner,id
+        as initTableId from m_table_info WHERE is_deleted=0
         ) a where 1=1
         <if test="parentId != null and parentId != ''">
             and a.parent_id = #{parentId}
@@ -618,6 +625,7 @@
         <if test="titleName != null and titleName != ''">
             and a.title like concat('%',#{titleName},'%') and LENGTH(a.p_key_id)>11
         </if>
+        order by sort
     </select>
 
     <select id="selectWbsTreeContractList" resultType="org.springblade.manager.entity.WbsTreePrivate">

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

@@ -139,4 +139,7 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
      */
     String saveOrUpdateTheLog(List<TableInfo> tableInfoList);
 
+    boolean tabSort(List<String> idList);
+
+
 }

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsInfoService.java

@@ -19,4 +19,6 @@ public interface IWbsInfoService extends BaseService<WbsInfo> {
 
     WbsInfo findById(Long id);
 
+    boolean tabNodeSort(List<String> primaryKeyList);
+
 }

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

@@ -455,6 +455,16 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         ));
     }
 
+    @Override
+    public boolean tabSort(List<String> idList) {
+        int sort = 1;
+        for (String id : idList) {
+            this.update(Wrappers.<ExcelTab>lambdaUpdate().set(ExcelTab::getSort, sort).eq(ExcelTab::getId, id));
+            sort++;
+        }
+        return true;
+    }
+
     /**
      * 保存首件
      */
@@ -1080,7 +1090,6 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
     }
 
 
-
     /**
      * 试验 获取填报信息
      */

+ 21 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsInfoServiceImpl.java

@@ -3,8 +3,10 @@ package org.springblade.manager.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.AllArgsConstructor;
 import oracle.sql.BfileDBAccess;
+import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.StringUtil;
 import org.springblade.manager.dto.WbsInfoDTO;
 import org.springblade.manager.entity.WbsTree;
 import org.springblade.manager.mapper.WbsInfoMapper;
@@ -12,6 +14,7 @@ import org.springblade.manager.service.IWbsInfoService;
 import org.springblade.core.mp.base.BaseServiceImpl;
 import org.springblade.manager.entity.WbsInfo;
 import org.springblade.manager.vo.WbsInfoVO;
+import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springframework.transaction.annotation.Transactional;
@@ -23,6 +26,7 @@ import java.util.List;
 public class WbsInfoServiceImpl extends BaseServiceImpl<WbsInfoMapper, WbsInfo> implements IWbsInfoService {
 
     private final WbsTreeServiceImpl wbsTreeService;
+    private final JdbcTemplate jdbcTemplate;
 
     @Override
     public IPage<WbsInfo> selectWbsInfoPage(IPage<WbsInfo> page, WbsInfo wbsInfo) {
@@ -72,4 +76,21 @@ public class WbsInfoServiceImpl extends BaseServiceImpl<WbsInfoMapper, WbsInfo>
         return baseMapper.selectById2(id);
     }
 
+    @Override
+    public boolean tabNodeSort(List<String> primaryKeyList) {
+        int sort = 1;
+        for (String id : primaryKeyList) {
+            //删除
+            String delSql = "delete from m_wbs_node_sort where p_key_id = " + id;
+            jdbcTemplate.execute(delSql);
+
+            //新增
+            String sql = "insert into m_wbs_node_sort(id,p_key_id,sort) values (" + SnowFlakeUtil.getId() + "," + id + "," + sort + ")";
+            jdbcTemplate.execute(sql);
+
+            sort++;
+        }
+        return true;
+    }
+
 }