|
|
@@ -0,0 +1,72 @@
|
|
|
+package com.lc.ibps.business.service.impl;
|
|
|
+
|
|
|
+import com.lc.ibps.api.base.constants.StateEnum;
|
|
|
+import com.lc.ibps.api.form.sql.util.BeanUtils;
|
|
|
+import com.lc.ibps.base.core.util.Collections;
|
|
|
+import com.lc.ibps.base.framework.table.ICommonDao;
|
|
|
+import com.lc.ibps.business.service.HomeService;
|
|
|
+import com.lc.ibps.cloud.entity.APIResult;
|
|
|
+import lombok.extern.log4j.Log4j2;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+@Log4j2
|
|
|
+@Service
|
|
|
+public class HomeServiceImpl implements HomeService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ICommonDao<?> commonDao;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public APIResult file(String diDian) {
|
|
|
+ APIResult<Object> result = new APIResult<>();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ if (BeanUtils.isEmpty(diDian)){
|
|
|
+ result.setState(StateEnum.ERROR_EMPLOYEE.getCode());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ String sql = " select id_,name_ from ibps_cat_type where category_key_ = 'FILE_TYPE' and DEPTH_ = '1' and AUTHORITY_NAME like '%" + diDian + "%' ";
|
|
|
+ List<Map<String,Object>> list = (List<Map<String,Object>>) commonDao.query(sql);
|
|
|
+ if(Collections.isEmpty(list)){
|
|
|
+ result.setState(StateEnum.ERROR_CAT_CATEGORY.getCode());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ //依据1级的结构去找所有的下级结构,并且分类放在一起
|
|
|
+ for (Map<String,Object> item : list) {
|
|
|
+ List<Map<String, Object>> fileList = find(item,diDian);
|
|
|
+ map.put(item.get("name_").toString(),fileList);
|
|
|
+ }
|
|
|
+ result.setVariables(map);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<Map<String,Object>> find(Map<String,Object> map,String diDian){
|
|
|
+ String typeId = map.get("id_").toString();
|
|
|
+ String sql = " SELECT t.name_, COUNT(w.xi_lei_id_) as sum " +
|
|
|
+ " FROM t_wjxxb w JOIN ibps_cat_type t ON w.xi_lei_id_ = t.id_ " +
|
|
|
+ " WHERE t.category_key_ = 'FILE_TYPE' " +
|
|
|
+ " AND t.DEPTH_ = '2' " +
|
|
|
+ " AND t.authority_name LIKE '%" + diDian + "%' " +
|
|
|
+ " AND t.path_ REGEXP ( " +
|
|
|
+ " SELECT GROUP_CONCAT(id_ SEPARATOR '|') " +
|
|
|
+ " FROM ( " +
|
|
|
+ " SELECT id_ " +
|
|
|
+ " FROM ibps_cat_type " +
|
|
|
+ " WHERE category_key_ = 'FILE_TYPE' " +
|
|
|
+ " AND DEPTH_ in('2') " +
|
|
|
+ " AND AUTHORITY_NAME LIKE '%" + diDian + "%' " +
|
|
|
+ " AND path_ LIKE '%" + typeId + "%' " +
|
|
|
+ " AND AUTHORITY_NAME LIKE '%\"buMen\":\"\"%' " +
|
|
|
+ " ORDER BY SN_, ID_ " +
|
|
|
+ " ) AS sub " +
|
|
|
+ " ) " +
|
|
|
+ " AND w.shi_fou_guo_shen_ = '有效' " +
|
|
|
+ " AND w.di_dian_ = '" + diDian + "' " +
|
|
|
+ " GROUP BY xi_lei_id_";
|
|
|
+ List<Map<String,Object>> list = (List<Map<String,Object>>) commonDao.query(sql);
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+}
|