指标库新增web页面树形接口

This commit is contained in:
ly19960718 2021-04-15 16:59:37 +08:00
parent 504ed6351c
commit 1cb0677f2e
17 changed files with 232 additions and 8 deletions

View File

@ -1,5 +1,6 @@
package com.tenlion.twoduty.controller.api.indexlib;
import com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibCountDTO;
import com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibZTreeDTO;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
@ -39,6 +40,18 @@ public class IndexLibController extends DefaultBaseController {
@Autowired
private IIndexLibService indexLibService;
@ApiOperation(value = "指标统计", notes = "指标统计接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("countIndexLib/{indexLibParentId}")
public IndexLibCountDTO countIndexLib(@PathVariable("indexLibParentId") String indexLibParentId ){
return indexLibService.countIndexLib(indexLibParentId);
}
@ApiOperation(value = "web页面导航列表", notes = "web页面导航列表接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("listwebtags")
@ -53,10 +66,6 @@ public class IndexLibController extends DefaultBaseController {
@GetMapping("listztreeweb/{indexLibParentId}")
public List<IndexLibZTreeDTO> listZTreeWeb(@PathVariable("indexLibParentId") String indexLibParentId ) {
Map<String, Object> params = requestParams();
/* String indexLibParentId = "0";
if (!StringUtils.isBlank(params.get("id") == null ? null : params.get("id").toString())) {
indexLibParentId = params.get("id").toString();
}*/
params.put("indexLibParentId",indexLibParentId);
return indexLibService.listZTreeWeb(params);
}

View File

@ -28,7 +28,7 @@ public class indexWebController extends DefaultBaseController {
@ApiOperation(value = "后台页面首页", notes = "后台页面首页接口")
@GetMapping("indexweb")
public ModelAndView indexweb(){
public ModelAndView indexWeb(){
ModelAndView mv = new ModelAndView("index");
mv.addObject("userName",securityComponent.getCurrentUser().getUserName());
mv.addObject("userUserName",securityComponent.getCurrentUser().getUserUsername());

View File

@ -1,5 +1,6 @@
package com.tenlion.twoduty.dao.indexlib;
import com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibCountDTO;
import com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibZTreeDTO;
import ink.wgink.exceptions.RemoveException;
import ink.wgink.exceptions.SaveException;
@ -153,4 +154,13 @@ public interface IIndexLibDao {
*/
Integer countByParentIdWeb(Map<String, Object> params) throws SearchException;
/**
* 统计指标状态数量
* @param params
* @return
* @throws SearchException
*/
IndexLibCountDTO countIndexLibAuditStatusNum(Map<String, Object> params) throws SearchException;
}

View File

@ -1,5 +1,7 @@
package com.tenlion.twoduty.pojo.bos.indextemplate;
import io.swagger.annotations.ApiModelProperty;
/**
*
* @ClassName: IndexTemplateBO
@ -15,6 +17,7 @@ public class IndexTemplateBO {
private String indexTemplateSavePath;
private String indexTemplateUploadPath;
private String indexTemplateListPath;
private String indexTemplateTableName;
private String indexTemplateRemark;
private Integer indexTemplateState;
private String gmtCreate;
@ -118,4 +121,12 @@ public class IndexTemplateBO {
public void setIndexTemplateState(Integer indexTemplateState) {
this.indexTemplateState = indexTemplateState;
}
public String getIndexTemplateTableName() {
return indexTemplateTableName;
}
public void setIndexTemplateTableName(String indexTemplateTableName) {
this.indexTemplateTableName = indexTemplateTableName;
}
}

View File

@ -0,0 +1,52 @@
package com.tenlion.twoduty.pojo.dtos.indexlib;
/**
* 统计实体
* @version 1.0
* @author LY
* @date 2021/4/15 15:56
*/
public class IndexLibCountDTO {
private Integer count1;
private Integer count2;
private Integer count3;
private Integer count4;
public Integer getCount1() {
return count1;
}
public void setCount1(Integer count1) {
this.count1 = count1;
}
public Integer getCount2() {
return count2;
}
public void setCount2(Integer count2) {
this.count2 = count2;
}
public Integer getCount3() {
return count3;
}
public void setCount3(Integer count3) {
this.count3 = count3;
}
public Integer getCount4() {
return count4;
}
public void setCount4(Integer count4) {
this.count4 = count4;
}
}

View File

@ -27,6 +27,8 @@ public class IndexTemplateDTO {
private String indexTemplateUploadPath;
@ApiModelProperty(name = "indexTemplateListPath", value = "列表路径")
private String indexTemplateListPath;
@ApiModelProperty(name = "indexTemplateTableName", value = "业务表名")
private String indexTemplateTableName;
@ApiModelProperty(name = "indexTemplateRemark", value = "模板说明")
private String indexTemplateRemark;
@ApiModelProperty(name = "indexTemplateState", value = "模板状态")
@ -87,4 +89,12 @@ public class IndexTemplateDTO {
public void setIndexTemplateState(Integer indexTemplateState) {
this.indexTemplateState = indexTemplateState;
}
public String getIndexTemplateTableName() {
return indexTemplateTableName;
}
public void setIndexTemplateTableName(String indexTemplateTableName) {
this.indexTemplateTableName = indexTemplateTableName;
}
}

View File

@ -17,6 +17,7 @@ public class IndexTemplatePO {
private String indexTemplateSavePath;
private String indexTemplateUploadPath;
private String indexTemplateListPath;
private String indexTemplateTableName;
private String indexTemplateRemark;
private Integer indexTemplateState;
private String gmtCreate;
@ -120,4 +121,12 @@ public class IndexTemplatePO {
public void setIndexTemplateState(Integer indexTemplateState) {
this.indexTemplateState = indexTemplateState;
}
public String getIndexTemplateTableName() {
return indexTemplateTableName;
}
public void setIndexTemplateTableName(String indexTemplateTableName) {
this.indexTemplateTableName = indexTemplateTableName;
}
}

View File

@ -25,6 +25,8 @@ public class IndexTemplateVO {
private String indexTemplateUploadPath;
@ApiModelProperty(name = "indexTemplateListPath", value = "列表路径")
private String indexTemplateListPath;
@ApiModelProperty(name = "indexTemplateTableName", value = "业务表名")
private String indexTemplateTableName;
@ApiModelProperty(name = "indexTemplateRemark", value = "模板说明")
private String indexTemplateRemark;
@ApiModelProperty(name = "indexTemplateState", value = "模板状态")
@ -78,4 +80,12 @@ public class IndexTemplateVO {
public void setIndexTemplateState(Integer indexTemplateState) {
this.indexTemplateState = indexTemplateState;
}
public String getIndexTemplateTableName() {
return indexTemplateTableName;
}
public void setIndexTemplateTableName(String indexTemplateTableName) {
this.indexTemplateTableName = indexTemplateTableName;
}
}

View File

@ -1,5 +1,6 @@
package com.tenlion.twoduty.service.indexlib;
import com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibCountDTO;
import com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibZTreeDTO;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.SuccessResultList;
@ -20,6 +21,12 @@ import java.util.Map;
**/
public interface IIndexLibService {
/**
* 统计指标状态数量
* @param indexLibParentId
* @return
*/
IndexLibCountDTO countIndexLib(String indexLibParentId);
/**
* 获取web页面导航

View File

@ -1,6 +1,8 @@
package com.tenlion.twoduty.service.indexlib.impl;
import com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibCountDTO;
import com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibZTreeDTO;
import com.tenlion.twoduty.pojo.dtos.indextemplate.IndexTemplateDTO;
import com.tenlion.twoduty.service.indextemplate.IIndexTemplateService;
import ink.wgink.common.base.DefaultBaseService;
import ink.wgink.pojo.ListPage;
@ -19,6 +21,7 @@ import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.*;
@ -37,6 +40,51 @@ public class IndexLibServiceImpl extends DefaultBaseService implements IIndexLib
@Autowired
private IIndexTemplateService indexTemplateService;
public IndexLibCountDTO countIndexLib(String indexLibParentId){
Integer count1 = 0;
Integer count2 = 0;
Integer count3 = 0;
Integer count4 = 0;
Map<String, Object> params = new HashMap<String, Object>();
params.put("indexLibParentId",indexLibParentId);
//查询指标分类树
List<IndexLibZTreeDTO> listZTreeWeb = this.listZTreeWeb(params);
for (IndexLibZTreeDTO indexLibZTreeDTO : listZTreeWeb) {
params.clear();
params.put("indexLibState",1);
params.put("indexLibParentId",indexLibZTreeDTO.getId());
//查询具体指标
List<IndexLibDTO> list = this.list(params);
for (IndexLibDTO indexLibDTO : list) {
String templateId = indexLibDTO.getIndexTemplateId();
if (StringUtils.isBlank(templateId)) {
IndexTemplateDTO indexTemplateDTO = indexTemplateService.get(templateId);
String templateTableName = indexTemplateDTO.getIndexTemplateTableName();
if (StringUtils.isBlank(templateTableName)) {
//统计
Map<String, Object> counts = new HashMap<String, Object>();
counts.put("tableName",templateTableName);
counts.put("indexLibId",indexLibZTreeDTO.getId());
IndexLibCountDTO indexLibCountDTO = indexLibDao.countIndexLibAuditStatusNum(counts);
count1 += indexLibCountDTO.getCount1();
count2 += indexLibCountDTO.getCount2();
count3 += indexLibCountDTO.getCount3();
count4 += indexLibCountDTO.getCount4();
}
}
}
}
IndexLibCountDTO indexLibCountDTO = new IndexLibCountDTO();
indexLibCountDTO.setCount1(count1);
indexLibCountDTO.setCount2(count2);
indexLibCountDTO.setCount3(count3);
indexLibCountDTO.setCount4(count4);
return indexLibCountDTO;
}
public List<IndexLibZTreeDTO> listWebTags(Map<String, Object> params){
return indexLibDao.listZTreeWeb(params);
}

View File

@ -47,14 +47,21 @@
<result column="is_delete" property="isDelete"/>
</resultMap>
<resultMap id="indexLibZTreeDTO" type="com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibZTreeDTO">
<result column="index_lib_id" property="id"/>
<result column="index_lib_name" property="name"/>
<result column="index_lib_parent_id" property="pId"/>
</resultMap>
<resultMap id="indexLibCountDTO" type="com.tenlion.twoduty.pojo.dtos.indexlib.IndexLibCountDTO">
<result column="count_1" property="count1"/>
<result column="count_2" property="count2"/>
<result column="count_3" property="count3"/>
<result column="count_4" property="count4"/>
</resultMap>
<!-- 树形列表 -->
<select id="listZTreeWeb" parameterType="map" resultMap="indexLibZTreeDTO">
@ -421,4 +428,17 @@
t1.is_delete = 0
</select>
<!-- 统计指标状态数量 -->
<select id="countIndexLibAuditStatusNum" parameterType="map" resultType="indexLibCountDTO">
SELECT
COUNT(CASE WHEN `audit_status` = 0 THEN 1 ELSE NULL END) AS 'count_1' ,
COUNT(CASE WHEN `audit_status` = 1 THEN 1 ELSE NULL END) AS 'count_2',
COUNT(CASE WHEN `audit_status` = 2 THEN 1 ELSE NULL END) AS 'count_3',
COUNT(CASE WHEN `audit_status` = -1 THEN 1 ELSE NULL END) AS 'count_4'
FROM
${tableName}
WHERE is_delete = 0 AND index_lib_id = #{indexLibId}
</select>
</mapper>

View File

@ -8,6 +8,7 @@
<result column="index_template_save_path" property="indexTemplateSavePath"/>
<result column="index_template_upload_path" property="indexTemplateUploadPath"/>
<result column="index_template_list_path" property="indexTemplateListPath"/>
<result column="index_template_table_name" property="indexTemplateTableName"/>
<result column="index_template_remark" property="indexTemplateRemark"/>
<result column="index_template_state" property="indexTemplateState"/>
</resultMap>
@ -18,6 +19,7 @@
<result column="index_template_save_path" property="indexTemplateSavePath"/>
<result column="index_template_upload_path" property="indexTemplateUploadPath"/>
<result column="index_template_list_path" property="indexTemplateListPath"/>
<result column="index_template_table_name" property="indexTemplateTableName"/>
<result column="index_template_remark" property="indexTemplateRemark"/>
<result column="index_template_state" property="indexTemplateState"/>
<result column="gmt_create" property="gmtCreate"/>
@ -33,6 +35,7 @@
<result column="index_template_save_path" property="indexTemplateSavePath"/>
<result column="index_template_upload_path" property="indexTemplateUploadPath"/>
<result column="index_template_list_path" property="indexTemplateListPath"/>
<result column="index_template_table_name" property="indexTemplateTableName"/>
<result column="index_template_remark" property="indexTemplateRemark"/>
<result column="index_template_state" property="indexTemplateState"/>
<result column="gmt_create" property="gmtCreate"/>
@ -50,6 +53,7 @@
index_template_save_path,
index_template_upload_path,
index_template_list_path,
index_template_table_name,
index_template_remark,
index_template_state,
gmt_create,
@ -63,6 +67,7 @@
#{indexTemplateSavePath},
#{indexTemplateUploadPath},
#{indexTemplateListPath},
#{indexTemplateTableName}
#{indexTemplateRemark},
#{indexTemplateState},
#{gmtCreate},
@ -118,6 +123,9 @@
</if>
<if test="indexTemplateListPath != null and indexTemplateListPath != ''">
index_template_list_path = #{indexTemplateListPath},
</if>
<if test="indexTemplateTableName != null and indexTemplateTableName != ''">
index_template_table_name = #{indexTemplateTableName},
</if>
<if test="indexTemplateRemark != null and indexTemplateRemark != ''">
index_template_remark = #{indexTemplateRemark},
@ -138,6 +146,7 @@
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.index_template_id
@ -159,6 +168,7 @@
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.gmt_create,
@ -183,6 +193,7 @@
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.gmt_create,
@ -207,6 +218,7 @@
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state
FROM
@ -236,6 +248,7 @@
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.gmt_create,
@ -269,6 +282,7 @@
t1.index_template_save_path,
t1.index_template_upload_path,
t1.index_template_list_path,
t1.index_template_table_name,
t1.index_template_remark,
t1.index_template_state,
t1.gmt_create,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -1 +1,4 @@
/*可以在这里添加你自己的css*/
img {
max-width: 100%; /*图片自适应宽度*/
}

View File

@ -120,6 +120,15 @@
return rowData;
}
},
{field: 'indexTemplateTableName', width: 180, title: '业务表名', align:'center',
templet: function(row) {
var rowData = row[this.field];
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
return '-';
}
return rowData;
}
},
{field: 'indexTemplateRemark', width: 180, title: '模板说明', align:'center',
templet: function(row) {
var rowData = row[this.field];

View File

@ -46,6 +46,12 @@
<input type="text" id="indexTemplateListPath" name="indexTemplateListPath" class="layui-input" value="" placeholder="请输入列表路径" maxlength="150">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">业务表名</label>
<div class="layui-input-block">
<input type="text" id="indexTemplateTableName" name="indexTemplateTableName" class="layui-input" value="" placeholder="请输入业务表名" maxlength="150">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">模板状态</label>
<div class="layui-input-block">

View File

@ -46,6 +46,12 @@
<input type="text" id="indexTemplateListPath" name="indexTemplateListPath" class="layui-input" value="" placeholder="请输入列表路径" maxlength="150">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">业务表名</label>
<div class="layui-input-block">
<input type="text" id="indexTemplateTableName" name="indexTemplateTableName" class="layui-input" value="" placeholder="请输入业务表名" maxlength="150">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label">模板状态</label>
<div class="layui-input-block">