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
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
package com.landtool.lanbase.modules.res.controller;
 
import java.net.URLDecoder;
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.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
 
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
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.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_DiyLayerInfo;
import com.landtool.lanbase.modules.res.entity.Res_ExtThemeMap;
import com.landtool.lanbase.modules.res.entity.Res_MainInfo;
import com.landtool.lanbase.modules.res.entity.Res_Theme_Module;
import com.landtool.lanbase.modules.res.service.ResDiyLayerInfoService;
import com.landtool.lanbase.modules.res.service.ResExtThemeMapService;
import com.landtool.lanbase.modules.res.service.ResMainInfoService;
import com.landtool.lanbase.modules.res.service.ResThemeModuleService;
import com.landtool.lanbase.modules.res.service.ResThemeRelationService;
import com.landtool.lanbase.modules.sys.controller.AbstractController;
import com.landtool.lanbase.modules.sys.service.SysFieldvalueService;
 
import cn.hutool.core.date.DateTime;
 
@Controller
@RequestMapping("/res/ResThemeModule")
public class ResThemeModuleController extends AbstractController {
    @Autowired
    private SysTemPropertyConfig sysConfig;
 
    @Autowired
    private ResThemeModuleService resThemeModuleService;
 
    @Autowired
    private ResThemeRelationService resThemeRelationService;
 
    @Autowired
    private ResMainInfoService resMainInfoService;
 
    @Autowired
    private OrgUserService orgUserService;
 
    @Autowired
    private SysFieldvalueService fieldUtils;
 
    @Autowired
    private SysFieldvalueService FieldUtils;
 
    @Autowired
    private OrgUnitService orgUnitService;
 
    @Autowired
    private ResDiyLayerInfoService resDiyLayerInfoService;
 
    @Autowired
    private ResExtThemeMapService resExtThemeMapService;
 
    @ResponseBody
    @RequestMapping("insert")
    public int insert(Res_Theme_Module record) {
        return resThemeModuleService.insert(record);
    }
 
    @ResponseBody
    @RequestMapping("insertSelective")
    public int insertSelective(Res_Theme_Module record) {
        return resThemeModuleService.insertSelective(record);
    }
 
    @RequestMapping("ResThemeModuleIndex")
    public String ResThemeModuleIndex(Model model,String selectIds) {
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());
        model.addAttribute("selectIds", selectIds);
        return "/ResManage/ResTheme/ResThemeModule";
    }
 
    /**
     * 查询业务专题列表
     * @param resThemeModule
     * @param pageBean
     * @return
     */
    @ResponseBody
    @RequestMapping("selectResThemeModule")
    public Result selectResThemeModule(Res_Theme_Module resThemeModule, PageBean pageBean) {
        PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
        List<Res_Theme_Module> list = resThemeModuleService.selectList(resThemeModule);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        int countNums = (int) ((Page) list).getTotal();
        PageBean<Res_Theme_Module> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
        pageData.setItems(list);
        StringBuilder rsb = new StringBuilder();
        rsb.append("{'totalCount':'" + countNums);
        rsb.append("','topics':[");
 
        List<Map<String, Object>> maps = new LinkedList<>();
        for (int i = 0; i < list.size(); i++) {
            String name = "";
            if (list.get(i).getDiyuserid() != null) {
                name = orgUserService.queryObject((long) list.get(i).getDiyuserid()).getChinesename();
            }
            String paneltitle = "";
            if(list.get(i).getPanelresid() != null) {
                Res_MainInfo resMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getPanelresid());
                if(resMainInfo != null) {
                    paneltitle = resMainInfo.getTitle();
                }
            }
            String maptitle = "";
            if(list.get(i).getMapresid() != null ) {
                Res_MainInfo mapresMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getMapresid());
                if(mapresMainInfo != null) {
                    maptitle = mapresMainInfo.getTitle();
                }
            }
            String panelurl = list.get(i).getPanelurl() == null ? "":list.get(i).getPanelurl();
            Map<String, Object> map = new HashMap<>();
            map.put("moduleid", list.get(i).getModuleid());
            map.put("title", list.get(i).getTitle());
            map.put("panelid", list.get(i).getPanelresid());
            map.put("paneltitle", paneltitle);
            map.put("mapid", list.get(i).getMapresid());
            map.put("maptitle", maptitle);
            map.put("diyuserid", name);
            map.put("panelurl", panelurl);
            maps.add(map);
 
 
//            if (i != 0) {
//                rsb.append(",");
//            }
//            rsb.append("{'moduleid':'" + list.get(i).getModuleid() + "'");
//            rsb.append(",'title':'" + list.get(i).getTitle() + "'");
//            rsb.append(",'panelid':'" + list.get(i).getPanelresid() + "'");
//            rsb.append(",'paneltitle':'" + paneltitle + "'");
//            rsb.append(",'panelurl':'" + list.get(i).getPanelurl() + "'");
//            rsb.append(",'mapid':'" + list.get(i).getMapresid() + "'");
//            rsb.append(",'maptitle':'" + maptitle + "'");
//            rsb.append(",'diyuserid':'" + name + "'}");
        }
        return Result.ok().put("totalCount", countNums).put("topics", maps);
    }
 
    /**
     * 新增修改页面
     */
    @RequestMapping("/AddResThemeModule")
    public String AddResThemeModule(Integer moduleid, Model model) {
        Res_Theme_Module resThemeModule = new Res_Theme_Module();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        if (moduleid != null) {
            resThemeModule = resThemeModuleService.selectByid(moduleid);
            if(resThemeModule.getFitbrowser()!=null){
                if(resThemeModule.getFitbrowser().indexOf("IE")>=0){
                    resThemeModule.setIsIE(1);
                }
                if(resThemeModule.getFitbrowser().indexOf("Google")>=0){
                    resThemeModule.setIsGoogle(1);
                }
                if(resThemeModule.getFitbrowser().indexOf("Firefox")>=0){
                    resThemeModule.setIsFirefox(1);
                }
            }
 
        }
 
        model.addAttribute("resThemeModule", resThemeModule);
        if (resThemeModule.getMapresid() != null) {
            Res_MainInfo resMainInfo1 = resMainInfoService.selectByPrimaryKey(resThemeModule.getMapresid());
            if (resMainInfo1 != null) {
                model.addAttribute("mapresid", resMainInfo1.getTitle());
                model.addAttribute("resourceClass",resMainInfo1.getResourceclass());
            }
            List<Res_DiyLayerInfo> layerInfos=resDiyLayerInfoService.selectByResourceid(resThemeModule.getMapresid());
            model.addAttribute("layerInfos",layerInfos);
        }
        if (resThemeModule.getPanelresid() != null) {
            Res_MainInfo resMainInfo2 = resMainInfoService.selectByPrimaryKey(resThemeModule.getPanelresid());
            if (resMainInfo2 != null) {
                model.addAttribute("panelresid", resMainInfo2.getTitle());
            }
        }
        String title = "";
        if(resThemeModule != null && resThemeModule.getServiceconfig() != null && !resThemeModule.getServiceconfig().trim().equals("")) {
            JSONObject obj = JSONObject.parseObject(resThemeModule.getServiceconfig());
            StringBuilder sb = new StringBuilder();
            if(!obj.getString("charts").equals("[]")){
                String charts = JSONArray.parseArray(obj.getString("charts")).get(0).toString();
                String charts1 = JSONObject.parseObject(charts).get("chart1").toString();
                title = JSONObject.parseObject(charts1).get("title").toString();
            }
            if(!obj.getString("tables").equals("[]")) {
                String charts = JSONArray.parseArray(obj.getString("tables")).get(0).toString();
                String charts1 = JSONObject.parseObject(charts).get("table1").toString();
                title = JSONObject.parseObject(charts1).get("groupby").toString();
            }
        }
        if(resThemeModule.getEchartsheight() != null && resThemeModule.getEchartsheight() %1==0) {
            model.addAttribute("echartsheight", resThemeModule.getEchartsheight().intValue());
        }else{
            model.addAttribute("echartsheight", resThemeModule.getEchartsheight());
        }
        model.addAttribute("charttitle", title);
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());
        return "/ResManage/ResTheme/AddResThemeModule";
    }
 
    /**
     * 新增修改
     */
    @ResponseBody
    @RequestMapping("updateOrInsert")
    public String updateOrInsert(Res_Theme_Module resThemeModule, Model model) {
        String msg = "";
        if (resThemeModule.getModuleid() == null) {
            //获取兼容浏览器,拼接成字符串
            String fitbrowser="";
 
            if(resThemeModule.getIsIE()==1 ){
                fitbrowser+="IE,";
            }
            if(resThemeModule.getIsGoogle()==1){
                fitbrowser+="Google,";
            }
            if(resThemeModule.getIsFirefox()==1){
                fitbrowser+="Firefox,";
            }
            if(fitbrowser.length()>0){
                fitbrowser=fitbrowser.substring(0,fitbrowser.length()-1);
            }
            resThemeModule.setFitbrowser(fitbrowser);
            resThemeModule.setDiyuserid(getUserId().intValue());
            if (resThemeModule.getIsclickchartfilter() == null) {
                resThemeModule.setIsclickchartfilter(0);
            }
            if (resThemeModule.getIsmaplinkage() == null) {
                resThemeModule.setIsmaplinkage(0);
            }
            resThemeModule.setDiytime(DateTime.now());
            int r = resThemeModuleService.insertSelective(resThemeModule);
            if (r == 1) {
                msg = "保存成功!";
            } else {
                msg = "保存失败!";
            }
        } else if (resThemeModule.getModuleid() != null) {
            String fitbrowser="";
 
            if(resThemeModule.getIsIE()==1 ){
                fitbrowser+="IE,";
            }
            if(resThemeModule.getIsGoogle()==1){
                fitbrowser+="Google,";
            }
            if(resThemeModule.getIsFirefox()==1){
                fitbrowser+="Firefox,";
            }
            if(fitbrowser.length()>0){
                fitbrowser=fitbrowser.substring(0,fitbrowser.length()-1);
            }
            resThemeModule.setFitbrowser(fitbrowser);
            if (resThemeModule.getIsclickchartfilter() == null) {
                resThemeModule.setIsclickchartfilter(0);
            }
            if (resThemeModule.getIsmaplinkage() == null) {
                resThemeModule.setIsmaplinkage(0);
            }
            int r = resThemeModuleService.updateById(resThemeModule);
            if (r == 1) {
                msg = "更新成功!";
            } else {
                msg = "更新失败!";
            }
        }
        return "{'msg':'" + msg + "','id':'" + resThemeModule.getModuleid() + "'}";
    }
 
    /**
     * 删除
     * @param moduleid
     * @return
     */
    @ResponseBody
    @RequestMapping("deleteById")
    public int DeleteById(Integer moduleid) {
        int t = resThemeRelationService.deleteByModuleId(moduleid);
        int r = resThemeModuleService.deleteById(moduleid);
        if (t >= 0 && r == 1) {
            return 1;
        } else {
            return 0;
        }
    }
 
    /**
     * 地图选择页面
     */
    @RequestMapping("selectMap")
    public String selectMap(Model model) {
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());
        return "/ResManage/ResTheme/MapSelect";
    }
 
    //根据resid获取diy id
    @ResponseBody
    @RequestMapping("selectDiyId")
    public List<Res_DiyLayerInfo> selectMap(Model model, Res_DiyLayerInfo resDiyLayerInfo) {
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());
        List<Res_DiyLayerInfo> diyinfoList = resDiyLayerInfoService.selectByResourceid(resDiyLayerInfo.getResourceid());
        return diyinfoList;
    }
 
 
 
    /**
     * 自动补全输入首字母查询
     * @param keyWord
     * @return
     */
    @ResponseBody
    @GetMapping("/findPinyinByKeyWord")
    public String[] findpinyinByKeyWord(@RequestParam(name = "keyWord") String keyWord,String type){
        keyWord = URLDecoder.decode(keyWord);
        Map<String,Object> map = new HashMap<String,Object>();
        map.put("type", type);
        map.put("keyWord",keyWord);
        List<Res_MainInfo> list = resThemeModuleService.selectCatalogZiYuanList(map);
        String[] arr = new String[list.size()];
        for (int i =0;i<list.size();i++) {
            String title = list.get(i).getTitle();
            arr[i] = title;
        }
        return arr;
    }
 
    /**
     * 地图选择页面(列表弃用,改用树形节点)
     */
    @RequestMapping ("selectMapList")
    @ResponseBody
    public String selectMapList(PageBean pageBean) {
        Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
//        if(!SecurityUtils.getSubject().isPermitted("org_user_admin")) {
////            // 如果是超级管理员,不添加用户id,查询所有。如果不是 添加id 查询单个
////            resMainInfo.setExistPermission(getUserId().toString());
////        }
        List<Res_MainInfo> mainInfoJoinCatalogList = resThemeModuleService.selectMapList();
        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++) {
            if (i != 0) {
                rsb.append(",");
            }
            rsb.append("{'resourceid':'" + mainInfoJoinCatalogList.get(i).getResourceid() + "'");// 资源id
            rsb.append(",'title':'" + mainInfoJoinCatalogList.get(i).getTitle() + "'");// 资源名称
            leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
            rsb.append(",'resourceclass':'" + leixin + "'");// 资源类型
            rsb.append(",'pubdate':'" + sdf.format(mainInfoJoinCatalogList.get(i).getPubdate()) + "'");// 发布时间
            String chinesename = orgUserService.getChinesename(mainInfoJoinCatalogList.get(i).getCreateuserid());// 查询发布人id对应的 name
            String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());
            rsb.append(",'pubunitid':'" + unitname + "'");// 发布单位id
            rsb.append(",'createuserid':'" + chinesename);// 发布添加人
            rsb.append("'}");
        }
        rsb.append("]}");
        return rsb.toString();
    }
 
    /**
     * 面板选择页面
     */
    @RequestMapping("selectPanel")
    public String selectPanel(Model model) {
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());
        return "/ResManage/ResTheme/PanelSelect";
    }
 
    /**
     * 获取业务集成--页面集成--Iframe区块列表(列表弃用,改用树形节点)
     * @return
     */
    @RequestMapping("getYWJCIFrameDataList")
    @ResponseBody
    public String getYWJCIFrameDataList(Res_MainInfo resMainInfo, PageBean pageBean) {
        Page<Res_MainInfo> page = PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
        resMainInfo.setResourceclass("YWJC");
        List<Res_MainInfo> mainInfoJoinCatalogList = resMainInfoService.getYWJCTreeData(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 (int 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() + "'");// 资源名称
            leixin = ResourceTypeList.get(mainInfoJoinCatalogList.get(i).getResourceclass());
            rsb.append(",'resourceclass':'" + leixin + "'");// 资源类型
            String unitname = orgUnitService.getUnitName((long) mainInfoJoinCatalogList.get(i).getPubunitid());
 
            rsb.append(",'pubunitid':'" + unitname + "'");// 发布单位id
            rsb.append("}");
        }
        rsb.append("]}");
        return rsb.toString();
    }
 
    //选择资源(type:1面板2地图)
    @RequestMapping("getSelectZiYuan")
    @ResponseBody
    public String getSelectZiYuan(Integer type,String parentid, String title, HttpServletRequest request){
        StringBuilder resCatalogJson = new StringBuilder();
        Map<String, Object> map = new HashMap<>();
 
        List<Map<String, Object>> maps = new LinkedList<>();
        if (parentid.indexOf("ZiYuan_") == -1) {
            map.put("parentid", parentid);
            map.put("title", title);                  //资源名称
            map.put("type", type);
            List<Res_Catalog> resCatalogList = resThemeModuleService.selectCatalog(map);// 获取子目录列表
            // 循环构造子目录节点
            for (Res_Catalog resCatalog : resCatalogList) {
                Map<String, Object> catlogmap = new HashMap<>();
                catlogmap.put("id", resCatalog.getCatlogid());
                catlogmap.put("name", resCatalog.getTitle());
                catlogmap.put("title", resCatalog.getTitle());
                catlogmap.put("isParent", true);
                catlogmap.put("iconOpen", "/image/classicons/folderOpen.png");
                catlogmap.put("iconClose", "/image/classicons/folder.png");
                maps.add(catlogmap);
 
//                if (!"".equals(resCatalogJson.toString())) {
//                    resCatalogJson.append(',');
//                }
//                resCatalogJson.append("{id: " + resCatalog.getCatlogid() + ",name:'" + resCatalog.getTitle() + "', isParent: true,iconOpen:'/image/classicons/folderOpen.png',iconClose:'/image/classicons/folder.png'}");
            }
            // 获取资源类型列表
            List<Res_MainInfo> resMainInfo = resThemeModuleService.selectCatalogZiYuanList(map); // 获取目录下业务图层资源列表
            // 循环构造资源节点
            for (Res_MainInfo resMainInfo1 : resMainInfo) {
                String unitname = orgUnitService.getUnitName((long) resMainInfo1.getPubunitid());
 
                Map<String, Object> catlogmap  = new HashMap<>();
 
 
//                if (!"".equals(resCatalogJson.toString())) {
//                    resCatalogJson.append(',');
//                }
 
                if(resMainInfo1.getResourceclass().equals("KJ_YWTC")){
                    catlogmap.put("id", "ZiYuan_" + resMainInfo1.getResourceid());
                    catlogmap.put("name", resMainInfo1.getTitle()+(unitname != null && unitname.length()>0?("("+unitname+")"):"" ));
                    catlogmap.put("title", resMainInfo1.getTitle());
                    catlogmap.put("resourceClass", resMainInfo1.getResourceclass());
                    catlogmap.put("isParent", false);
                    catlogmap.put("icon", "/image/classicons/KJ_YWTC.png");
 
//                    resCatalogJson.append("{id: 'ZiYuan_" + resMainInfo1.getResourceid() + "',name:'" + resMainInfo1.getTitle()
//                            +(unitname != null && unitname.length()>0?("("+unitname+")"):"" )+ "', title: '"
//                            + resMainInfo1.getDatasources() + "',resourceClass:'" + resMainInfo1.getResourceclass() + "',isParent:false,icon:'/image/classicons/KJ_YWTC.png'}");
                }else{
                    catlogmap.put("id", "ZiYuan_" + resMainInfo1.getResourceid());
                    catlogmap.put("name", resMainInfo1.getTitle()+(unitname != null && unitname.length()>0?("("+unitname+")"):"" ));
                    catlogmap.put("title", resMainInfo1.getTitle());
                    catlogmap.put("resourceClass", resMainInfo1.getResourceclass());
                    catlogmap.put("isParent", false);
                    catlogmap.put("icon", "/image/classicons/KJ_JCDT.png");
 
                    resCatalogJson.append("{id: 'ZiYuan_" + resMainInfo1.getResourceid() + "',name:'" + resMainInfo1.getTitle()
                            +(unitname != null && unitname.length()>0?("("+unitname+")"):"" )+ "', title: '"
                            + resMainInfo1.getDatasources() + "',resourceClass:'" + resMainInfo1.getResourceclass() + "',isParent:false,icon:'/image/classicons/KJ_JCDT.png'}");
                }
                maps.add(catlogmap);
            }
        }
        return JSON.toJSONString(maps, SerializerFeature.WriteMapNullValue);
    }
 
    @RequestMapping("ModuleList")
    public String ModuleList(Model model) {
        model.addAttribute("pubzyWebRoot", sysConfig.getPubzyWebRoot());
        model.addAttribute("systemName", sysConfig.getAppFullName());
        return "/ResManage/ResTheme/ModuleList";
    }
 
    /**
     * 获取模块列表(包含模块关联的资源名称)
     * @param resThemeModule
     * @param pageBean
     * @return
     */
    @ResponseBody
    @RequestMapping("getModuleList")
    public Result getModule(Res_Theme_Module resThemeModule,PageBean pageBean) {
        PageHelper.startPage(pageBean.getPage(), pageBean.getLimit());
        List<Res_Theme_Module> list = resThemeModuleService.selectList(resThemeModule);
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        int countNums = (int) ((Page) list).getTotal();
        PageBean<Res_Theme_Module> pageData = new PageBean<>(pageBean.getPage(), pageBean.getLimit(), countNums);
        pageData.setItems(list);
        StringBuilder rsb = new StringBuilder();
        rsb.append("{'totalCount':'" + countNums);
        rsb.append("','topics':[");
 
        List<Map<String, Object>> maps = new LinkedList<>();
        for (int i = 0; i < list.size(); i++) {
            String name = "";
            if (list.get(i).getDiyuserid() != null) {
                name = orgUserService.queryObject((long) list.get(i).getDiyuserid()).getChinesename();
            }
            String paneltitle = "";
            if(list.get(i).getPanelresid() != null) {
                Res_MainInfo resMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getPanelresid());
                if(resMainInfo != null) {
                    paneltitle = resMainInfo.getTitle();
                }
            }
            String maptitle = "";
            if(list.get(i).getMapresid() != null ) {
                Res_MainInfo mapresMainInfo = resMainInfoService.selectByPrimaryKey(list.get(i).getMapresid());
                if(mapresMainInfo != null) {
                    maptitle = mapresMainInfo.getTitle();
                }
            }
            String panelurl = list.get(i).getPanelurl() == null ? "":list.get(i).getPanelurl();
 
            Map<String, Object> map = new HashMap<>();
            map.put("moduleid", list.get(i).getModuleid());
            map.put("title", list.get(i).getTitle());
            map.put("panelid", list.get(i).getPanelresid());
            map.put("paneltitle", paneltitle);
            map.put("mapid", list.get(i).getMapresid());
            map.put("maptitle", maptitle);
            map.put("diyuserid", name);
            map.put("panelurl", panelurl);
            maps.add(map);
 
//            if (i != 0) {
//                rsb.append(",");
//            }
//            rsb.append("{'moduleid':'" + list.get(i).getModuleid() + "'");
//            rsb.append(",'title':'" + list.get(i).getTitle() + "'");
//            rsb.append(",'panelid':'" + list.get(i).getPanelresid() + "'");
//            rsb.append(",'paneltitle':'" + paneltitle + "'");
//            String panelurl = list.get(i).getPanelurl() == null ? "":list.get(i).getPanelurl();
//            rsb.append(",'panelurl':'" + panelurl + "'");
//            rsb.append(",'mapid':'" + list.get(i).getMapresid() + "'");
//            rsb.append(",'maptitle':'" + maptitle + "'");
//            rsb.append(",'diyuserid':'" + name + "'}");
        }
        return Result.ok().put("totalCount", countNums).put("topics", maps);
    }
 
    /**
     * 获取关联图层
     * @param resourceid
     * @return
     */
    @ResponseBody
    @RequestMapping("getMapLayers")
    public String getMapLayers(Integer resourceid) {
        String result = "";
        Res_ExtThemeMap resExtThemeMap = resExtThemeMapService.selectByPrimaryKey(resourceid);
        if(resExtThemeMap != null && resExtThemeMap.getMapjson() != null && !resExtThemeMap.getMapjson().equals("")){
            result = resExtThemeMap.getMapjson();
        }
        return  result;
    }
}