2
13693261870
2022-09-16 653761a31dfeb50dd3d007e892d69c90bf0cdafc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
package com.landtool.lanbase.modules.res.controller;
 
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.HttpServletResponse;
 
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
 
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.landtool.lanbase.common.utils.Result;
import com.landtool.lanbase.config.SysTemPropertyConfig;
import com.landtool.lanbase.modules.api.utils.Excel;
import com.landtool.lanbase.modules.api.utils.PageBean;
import com.landtool.lanbase.modules.org.service.OrgUnitService;
import com.landtool.lanbase.modules.org.service.OrgUserService;
import com.landtool.lanbase.modules.res.entity.Res_Catalog;
import com.landtool.lanbase.modules.res.entity.Res_MainInfo;
import com.landtool.lanbase.modules.res.entity.ZiYuanTongJi.GroupByDataSources;
import com.landtool.lanbase.modules.res.entity.ZiYuanTongJi.GroupByMuLu;
import com.landtool.lanbase.modules.res.entity.ZiYuanTongJi.GroupByZiYuanLeiXing;
import com.landtool.lanbase.modules.res.service.ResActionRecordService;
import com.landtool.lanbase.modules.res.service.ResApplyRecommendService;
import com.landtool.lanbase.modules.res.service.ResCatalogService;
import com.landtool.lanbase.modules.res.service.ResMainInfoService;
import com.landtool.lanbase.modules.res.service.ZiYuanMuLuService;
import com.landtool.lanbase.modules.sys.controller.AbstractController;
import com.landtool.lanbase.modules.sys.service.SysFieldvalueService;
 
/**
 * @author ykm
 * @Description: 资源中心
 * @return
 * @date 2018/3/21 11:00
 */
@Controller
@RequestMapping("res/ZiYuanZhongXin")
public class ZiYuanZhongXinController extends AbstractController {
    @Autowired
    private SysTemPropertyConfig sysConfig;
    
    @Autowired
    private ResMainInfoService resMainInfoService;
    
    @Autowired
    private ResCatalogService resCatalogService;
    
    @Autowired
    private SysFieldvalueService FieldUtils;
    
    @Autowired
    private OrgUnitService orgUnitService;
    
    @Autowired
    private OrgUserService orgUserService;
    
    @Autowired
    private ResApplyRecommendService resApplyRecommendService;
    
    @Autowired
    private ResActionRecordService resActionRecordService;
 
    @Autowired
    public ZiYuanMuLuService ziYuanMuLuService;
    
    public static String strMuLu = "";
    
    /**
     * 资源中心
     * @param model
     * @return
     */
    @RequestMapping("indexbak")
    public String ziYuanZhongXinIndex(Model model) {
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());// sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());// sysConfig.getAppFullName());
        model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
        LinkedHashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
        // 资源类型饼状统计图
        List<GroupByZiYuanLeiXing> resourceclassList = resMainInfoService.selectResMainInfoGroupByLeiXing();
        
        String AllSeries = "";
        // 多于4个类型的话数据显示前7个资源数量最多的类型,后面的都以其它统计
        if (resourceclassList.size() > 4) {
            int counter = 0;
            for (int i = 4; i < resourceclassList.size(); i++) {
                counter += resourceclassList.get(i).getCount();
            }
            for (int i = 0; i < 4; i++) {
                GroupByZiYuanLeiXing item = resourceclassList.get(i);
                String leixing = ResourceTypeList.get(item.getResourceclass());
                AllSeries += (AllSeries == "" ? "" : ",") + "{ value: " + item.getCount() + ", name: '" + leixing + "'}";
            }
            AllSeries += (AllSeries == "" ? "" : ",") + "{ value: " + counter + ", name: '" + "其它" + "'}";
        }
        // 少于等于4个类型就全部显示
        else {
            for (int i = 0; i < resourceclassList.size(); i++) {
                GroupByZiYuanLeiXing item = resourceclassList.get(i);
                String leixing = ResourceTypeList.get(item.getResourceclass());
                AllSeries += (AllSeries == "" ? "" : ",") + "{ value: " + item.getCount() + ", name: '" + leixing + "'}";
            }
        }
        model.addAttribute("resourceclassSeries", "[" + AllSeries + "]");
        
        // 资源来源统计图
        List<GroupByDataSources> dataSourcesList = resMainInfoService.selectResMainInfoGroupByDataSources();
        String DataSourceLegends = "";
        String DataSourceSeries = "";
        int z = dataSourcesList.size();
        if(dataSourcesList.size() > 5) {
            z = 5;
        }
        for (int i = 0; i < z; i++) {
            GroupByDataSources item = dataSourcesList.get(i);
            if (item.getDatasources() == null || item.getDatasources().equals("")) {
                z++;
                continue;
            }
            String legend = item.getDatasources();
            if (item.getDatasources().length() > 6) {
                legend = item.getDatasources().substring(0, 6);
            }
            DataSourceLegends += (DataSourceLegends == "" ? "" : ",") + "'" + legend + "'";
            DataSourceSeries += (DataSourceSeries == "" ? "" : ",") + item.getCount();
        }
        model.addAttribute("DataSourceLegends", "[" + DataSourceLegends + "]");
        model.addAttribute("DataSourceSeries", "[" + DataSourceSeries + "]");
        
        // 资源目录统计图
        List<GroupByMuLu> catlogidList = resMainInfoService.selectResMainInfoGroupByMuLu();
        String MuLuLegends = "";
        String MuLuSeries = "";
        for (int i = 0; i < catlogidList.size(); i++) {
            GroupByMuLu item = catlogidList.get(i);
            //            if (item.getCatlogCode().equals("0"))
            //                continue;
            strMuLu = "";
            //            String legend = GetBianMu(item.getCatlogCode() == null ? 0 : Integer.parseInt(item.getCatlogCode()));
            MuLuLegends += (MuLuLegends == "" ? "" : ",") + "'" + item.getTitle() + "'";
            MuLuSeries += (MuLuSeries == "" ? "" : ",") + item.getCount();
        }
        model.addAttribute("MuLuLegends", "[" + MuLuLegends + "]");
        model.addAttribute("MuLuSeries", "[" + MuLuSeries + "]");
        Long userid = getUserId();
        Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("appuserid", userid);
        paramMap.put("appunitid", unitId);
        paramMap.put("isDiTuFuwu", null);
        List<Res_MainInfo> resourceList = resApplyRecommendService.getAllRecommend(paramMap);
        int recordCount = resourceList != null ? resourceList.size() : 0; // 记录总数
        model.addAttribute("totalpNum", recordCount);
        model.addAttribute("totalrNum", getMainInfoRecommendCount());
        model.addAttribute("gisPortal", sysConfig.getGisPortal());
        return "ZiYuanZhongXin/Index";
    }
    
    /**
     * 热门关键字搜索
     * @param key
     */
    @ResponseBody
    @RequestMapping("Search")
    public void search(String key) {
        if(!key.trim().equals("")) {
            String keyword = resMainInfoService.selectHotSearch(key);
            if (keyword == null) {
                resMainInfoService.insertHotSearch(key);
            } else {
                resMainInfoService.updateHotSearch(key);
            }
        }
    }
    
    /**
     * 查询访问排行列表功能
     */
    @ResponseBody
    @RequestMapping("selectFangWenPaiHangGD")
    public Result selectResMainInfojoinCatalog(Res_MainInfo resMainInfo, PageBean pageBean) {
        Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
        List<Res_MainInfo> mainInfoJoinCatalogList = resMainInfoService.selectResMainInfoFangWenPaiHang(resMainInfo);
        int countNums = (int) ((Page) mainInfoJoinCatalogList).getTotal();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
        pageData.setItems(mainInfoJoinCatalogList);
        LinkedHashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
//        StringBuilder rsb = new StringBuilder();
        String leixin = "";
//        rsb.append("{'totalCount':'" + countNums);
//        rsb.append("','topics':[");
 
        List<Map<String, Object>> maps = new LinkedList<>();
        for (Integer i = 0; i < mainInfoJoinCatalogList.size(); i++) {
            leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
            String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());// obj1.getString("unitname");
            Map<String, Object> map = new HashMap<>();
            map.put("resourceid", mainInfoJoinCatalogList.get(i).getResourceid());
            map.put("title", mainInfoJoinCatalogList.get(i).getTitle());
            map.put("resourceclass", leixin);
            map.put("pubdate", sdf.format(mainInfoJoinCatalogList.get(i).getPubdate()));
            map.put("pubunitid", unitname);
            map.put("fangwenpaihang", mainInfoJoinCatalogList.get(i).gett());
            maps.add(map);
 
//
//            if (i != 0) {
//                rsb.append(",");
//            }
//
//            rsb.append("{'resourceid':'" + mainInfoJoinCatalogList.get(i).getResourceid() + "'");// 资源id
//            rsb.append(",'title':'" + mainInfoJoinCatalogList.get(i).getTitle() + "'");// 资源名称
//
//            rsb.append(",'resourceclass':'" + leixin + "'");// 资源类型
//            rsb.append(",'pubdate':'" + sdf.format(mainInfoJoinCatalogList.get(i).getPubdate()) + "'");// 发布时间
//            rsb.append(",'pubunitid':'" + unitname + "'");// 发布单位id
//            rsb.append(",'fangwenpaihang':'" + mainInfoJoinCatalogList.get(i).gett() + "'");// 浏览次数
//            rsb.append("}");
        }
//        rsb.append("]}");
        return Result.ok().put("totalCount", countNums).put("topics", maps);
    }
    
    /**
     * 访问排行更多页面
     */
    @RequestMapping("FangWenPaiHangGD")
    public String fangWenPaiHangGD(Model model) {
        // 获取下拉框目录
        LinkedHashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
        model.addAttribute("ResourceTypeList", ResourceTypeList);
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());
        model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
        model.addAttribute("gisPortal", sysConfig.getGisPortal());
        return "ZiYuanZhongXin/FangWenPaiHangGD";
    }
    
    /**
     * 我的收藏更多页面
     */
    @RequestMapping("WoDeShouCangJiaGD")
    public String WoDeShouCangJiaGD(Model model) {
        // 获取下拉框目录
        LinkedHashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
        model.addAttribute("ResourceTypeList", ResourceTypeList);
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());
        model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
        model.addAttribute("gisPortal", sysConfig.getGisPortal());
        return "ZiYuanZhongXin/WoDeShouCangJiaGD";
    }
    
    /**
     * 资源统计更多页面
     */
    @RequestMapping("ZiYuanTongJiGD")
    public String ZiYuanTongJiGD(Model model) {
        // 获取下拉框目录
        LinkedHashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
        model.addAttribute("ResourceTypeList", ResourceTypeList);
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        List<String> DATASOURCES = resMainInfoService.selectDATASOURCES();
        model.addAttribute("DATASOURCESList", DATASOURCES);
        List<Res_Catalog> MuLuList = resCatalogService.selectResCatalogToParentid(0);
        model.addAttribute("MuLuList", MuLuList);
        model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
        model.addAttribute("gisPortal", sysConfig.getGisPortal());
        return "ZiYuanZhongXin/ZiYuanTongJiGD";
    }
    
    /**
     * 查询访问排行列表功能
     */
    @ResponseBody
    @RequestMapping("selectZiYuanTongJiGD")
    public String selectZiYuanTongJiGD(Res_MainInfo resMainInfo, PageBean pageBean) {
        Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
        List<Res_MainInfo> mainInfoJoinCatalogList = resMainInfoService.selectResMainInfojoinCatalog(resMainInfo);
        int countNums = (int) ((Page) mainInfoJoinCatalogList).getTotal();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        PageBean<Res_MainInfo> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
        pageData.setItems(mainInfoJoinCatalogList);
        LinkedHashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
        StringBuilder rsb = new StringBuilder();
        String leixin = "";
        rsb.append("{'totalCount':'" + countNums);
        rsb.append("','topics':[");
        for (Integer i = 0; i < mainInfoJoinCatalogList.size(); i++) {
            strMuLu = "";
            if (i != 0) {
                rsb.append(",");
            }
            
            rsb.append("{'resourceid':'" + mainInfoJoinCatalogList.get(i).getResourceid() + "'");// 资源id
            rsb.append(",'title':'" + mainInfoJoinCatalogList.get(i).getTitle() + "'");// 资源名称
            rsb.append(",'mulu':'" + GetBianMu(mainInfoJoinCatalogList.get(i).getCatlogid() == null ? 0 : mainInfoJoinCatalogList.get(i).getCatlogid()) + "'");// 所属目录编码
            leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
            rsb.append(",'resourceclass':'" + leixin + "'");// 资源类型
            rsb.append(",'datasources':'" + mainInfoJoinCatalogList.get(i).getDatasources() + "'");// 资源类型
            rsb.append(",'pubdate':'" + sdf.format(mainInfoJoinCatalogList.get(i).getPubdate()) + "'");// 发布时间
            String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());
            rsb.append(",'pubunitid':'" + unitname + "'");// 发布单位id
            rsb.append("}");
        }
        rsb.append("]}");
        return rsb.toString();
    }
    
    /**
     * 资源统计导出
     * @param response
     * @param resMainInfo
     * @return
     */
    @ResponseBody
    @RequestMapping("ZiYuanTongJiexcel")
    public String ZiYuanTongJiexcel(HttpServletResponse response, Res_MainInfo resMainInfo) {
        List<Res_MainInfo> mainInfoJoinCatalogList = resMainInfoService.selectResMainInfojoinCatalog(resMainInfo);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        LinkedHashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
        StringBuilder rsb = new StringBuilder();
        String leixin = "";
        rsb.append("{'totalCount':'" + "");
        rsb.append("','topics':[");
        for (Integer i = 0; i < mainInfoJoinCatalogList.size(); i++) {
            if (i != 0) {
                rsb.append(",");
            }
            
            rsb.append("{'resourceid':'" + mainInfoJoinCatalogList.get(i).getResourceid() + "'");// 资源id
            rsb.append(",'title':'" + mainInfoJoinCatalogList.get(i).getTitle() + "'");// 资源名称
            rsb.append(",'mulu':'" + GetBianMu(mainInfoJoinCatalogList.get(i).getCatlogid() == null ? 0 : mainInfoJoinCatalogList.get(i).getCatlogid()) + "'");// 所属目录编码
            leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
            rsb.append(",'resourceclass':'" + leixin + "'");// 资源类型
            rsb.append(",'datasources':'" + mainInfoJoinCatalogList.get(i).getDatasources() + "'");// 资源类型
            rsb.append(",'pubdate':'" + sdf.format(mainInfoJoinCatalogList.get(i).getPubdate()) + "'");// 发布时间
            String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());
            rsb.append(",'pubunitid':'" + unitname + "'");// 发布单位id
            rsb.append("}");
        }
        rsb.append("]}");
        
        String a[] = {"资源id", "资源名称", "所属目录", "资源类型", "发布时间", "发布单位", "数据来源"};
        try {
            String Filename = Excel.TJgoing(response, a, rsb.toString(), sysConfig.getUploadPath() + "excel\\");
            // bug...........
            // String path2 = env.getProperty("webroot") + "ZiYuanIcon/";
            String path2 = "/uploadPath/excel/";
            String desFile = path2 + Filename;
            System.out.println(desFile);
            return desFile;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
    
    /**
     * 递归获取资源目录名称
     * @param zymlBianMu
     * @return
     */
    private String CheckBianMu(Res_Catalog zymlBianMu) {
        if (zymlBianMu != null) {
            strMuLu += zymlBianMu.getTitle() + ">";
            if (zymlBianMu.getParentid() == 0) {
                return strMuLu;
            } else {
                zymlBianMu = resCatalogService.selectByPrimaryKey(zymlBianMu.getParentid());
                CheckBianMu(zymlBianMu);
            }
        }
        return strMuLu;
    }
    
    /**
     * 查询资源所属目录
     * @param Catlogid
     * @return
     */
    private String GetBianMu(int Catlogid) {
        String str = "";
        if (Catlogid > 0) {
            Res_Catalog zymlBianMu = resCatalogService.selectByPrimaryKey(Catlogid);
            String str2 = CheckBianMu(zymlBianMu);
            String[] res = str2.split(">");
            for (int i = res.length - 1; i >= 0; i--) {
                if (i == 0) {
                    str += res[i];
                } else {
                    str += res[i] + " > ";
                }
            }
        }
        return str;
    }
    
    /**
     * 资源推荐更多页面
     */
    @RequestMapping("ZiYuanTuiJianGD")
    public String ZiYuanTuiJianGD(Model model) {
        LinkedHashMap<String, String> resourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型
        model.addAttribute("resourceTypeList", resourceTypeList);
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
        model.addAttribute("systemName", sysConfig.getAppFullName());
        model.addAttribute("gisPortal", sysConfig.getGisPortal());
        return "ZiYuanZhongXin/ZiYuanTuiJianGD";
    }
    
    /**
     * 查询条件所属目录的目录树
     */
    @RequestMapping("MuLuShu")
    public String MuLuShu(Model model) {
        return "ResManage/ResRegister/MuLuShu";
    }
    
    /**
     * 资源推荐
     */
    private int getMainInfoRecommendCount() {
        Long userid = getUserId();
        Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
        int count = 0;
        //获取关键字
        List<String> keyWords = resActionRecordService.selectKeyWordsByUserid(Integer.parseInt(userid.toString()));
        if (keyWords != null && keyWords.size() > 0) {
//            String keywordStrs = "";
//            for (String k : keyWords) {
//                if (k.indexOf(",") != -1) {
//                    String[] newks = k.split(",");
//                    for (String newk : newks) {
//                        if (keywordStrs.indexOf("'" + newk + "',") == -1) keywordStrs += "'" + newk + "',";
//                    }
//                } else {
//                    if (keywordStrs.indexOf("'" + k + "',") == -1) keywordStrs += "'" + k + "',";
//                }
//            }
            Map<String, Object> paramMap = new HashMap<String, Object>();
//            paramMap.put("keywords", keywordStrs.substring(0, keywordStrs.length() - 1));
            paramMap.put("userid", userid);
            paramMap.put("isDiTuFuwu", null);
            List<Res_MainInfo> resourceList = resActionRecordService.selectMainInfoRecommends(paramMap);
            count = resourceList != null && resourceList.size() > 0 ? count = resourceList.size() : 0;
        }
        return count;
    }
 
    /**
     * 新版资源中心
     */
 
    /**
     * 资源中心
     * @param model
     * @return
     */
    @RequestMapping("index")
    public String newZiYuanZhongXinIndex(Model model) {
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());// sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());// sysConfig.getAppFullName());
        model.addAttribute("backstageWebRoot", sysConfig.getApiServer() + "/");
        LinkedHashMap<String, String> ResourceTypeList = FieldUtils.getFieldListByKey("ResourceType");// 获取资源类型列表
        // 资源类型饼状统计图
        List<GroupByZiYuanLeiXing> resourceclassList = resMainInfoService.selectResMainInfoGroupByLeiXing();
 
        String AllSeries = "";
        // 多于4个类型的话数据显示前7个资源数量最多的类型,后面的都以其它统计
        if (resourceclassList.size() > 4) {
            int counter = 0;
            for (int i = 4; i < resourceclassList.size(); i++) {
                counter += resourceclassList.get(i).getCount();
            }
            for (int i = 0; i < 4; i++) {
                GroupByZiYuanLeiXing item = resourceclassList.get(i);
                String leixing = ResourceTypeList.get(item.getResourceclass());
                AllSeries += (AllSeries == "" ? "" : ",") + "{ value: " + item.getCount() + ", name: '" + leixing + "'}";
            }
            AllSeries += (AllSeries == "" ? "" : ",") + "{ value: " + counter + ", name: '" + "其它" + "'}";
        }
        // 少于等于4个类型就全部显示
        else {
            for (int i = 0; i < resourceclassList.size(); i++) {
                GroupByZiYuanLeiXing item = resourceclassList.get(i);
                String leixing = ResourceTypeList.get(item.getResourceclass());
                AllSeries += (AllSeries == "" ? "" : ",") + "{ value: " + item.getCount() + ", name: '" + leixing + "'}";
            }
        }
        model.addAttribute("resourceclassSeries", "[" + AllSeries + "]");
 
        // 资源来源统计图
        List<GroupByDataSources> dataSourcesList = resMainInfoService.selectResMainInfoGroupByDataSources();
        String DataSourceLegends = "";
        String DataSourceSeries = "";
        int z = dataSourcesList.size();
        if(dataSourcesList.size() > 5) {
            z = 5;
        }
        for (int i = 0; i < z; i++) {
            GroupByDataSources item = dataSourcesList.get(i);
            if (item.getDatasources() == null || item.getDatasources().equals("")) {
                z++;
                continue;
            }
            String legend = item.getDatasources();
            if (item.getDatasources().length() > 6) {
                legend = item.getDatasources().substring(0, 6);
            }
            DataSourceLegends = "'" + legend + "'" + (DataSourceLegends == "" ? "" : ",") + DataSourceLegends ;
            DataSourceSeries = item.getCount() + (DataSourceSeries == "" ? "" : ",") + DataSourceSeries;
        }
        model.addAttribute("DataSourceLegends", "[" + DataSourceLegends + "]");
        model.addAttribute("DataSourceSeries", "[" + DataSourceSeries + "]");
 
        // 资源目录统计图
        List<GroupByMuLu> catlogidList = resMainInfoService.selectResMainInfoGroupByMuLu();
        String MuLuLegends = "";
        String MuLuSeries = "";
        for (int i = 0; i < catlogidList.size(); i++) {
            GroupByMuLu item = catlogidList.get(i);
            //            if (item.getCatlogCode().equals("0"))
            //                continue;
            strMuLu = "";
            //            String legend = GetBianMu(item.getCatlogCode() == null ? 0 : Integer.parseInt(item.getCatlogCode()));
            MuLuLegends += (MuLuLegends == "" ? "" : ",") + "'" + item.getTitle() + "'";
            MuLuSeries += (MuLuSeries == "" ? "" : ",") + item.getCount();
        }
        model.addAttribute("MuLuLegends", "[" + MuLuLegends + "]");
        model.addAttribute("MuLuSeries", "[" + MuLuSeries + "]");
 
        // 资源审核状态统计图
        model.addAttribute("shenhezhuangtaiSeries", "[" + ziYuanMuLuService.getZYTJ_ShenHeZhuangTai() + "]");
 
        //共享协议统计图
        model.addAttribute("sharprotocolSeries", "[" + ziYuanMuLuService.getGongXiangXieYiChart() + "]");
 
        Long userid = getUserId();
        Long unitId = orgUserService.getDefaultUnit(userid).getUnitid();
        Map<String, Object> paramMap = new HashMap<String, Object>();
        paramMap.put("appuserid", userid);
        paramMap.put("appunitid", unitId);
        paramMap.put("isDiTuFuwu", null);
        List<Res_MainInfo> resourceList = resApplyRecommendService.getAllRecommend(paramMap);
        int recordCount = resourceList != null ? resourceList.size() : 0; // 记录总数
        model.addAttribute("totalpNum", recordCount);
        model.addAttribute("totalrNum", getMainInfoRecommendCount());
        model.addAttribute("gisPortal", sysConfig.getGisPortal());
 
        model.addAttribute("logourl","ziyuanzhongxintitle");
        logger.info("返回前端页面ZiYuanZhongXin/New/Index");
        return "ZiYuanZhongXin/New/Index";
    }
}