Quellcode durchsuchen

Fix 桌面版图标兼容

Yue vor 2 Jahren
Ursprung
Commit
65322d884f

+ 302 - 277
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/service/impl/ApplyService.java

@@ -1,18 +1,5 @@
 package cn.vbdsm.manage.service.impl;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.core.common.Page;
-import javax.core.common.ResultMsg;
-import javax.core.common.utils.DataUtils;
-import javax.core.common.utils.StringUtils;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-
 import cn.vbdsm.common.config.I18nConfig;
 import cn.vbdsm.common.constants.SystemConstant;
 import cn.vbdsm.manage.dao.ApplyDao;
@@ -20,27 +7,38 @@ import cn.vbdsm.manage.dao.ApplySiteDao;
 import cn.vbdsm.manage.service.IApplyService;
 import cn.vbdsm.model.Apply;
 import cn.vbdsm.model.ApplySite;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+import javax.core.common.Page;
+import javax.core.common.ResultMsg;
+import javax.core.common.utils.DataUtils;
+import javax.core.common.utils.StringUtils;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 应用管理
- * @author Tanyongde
  *
+ * @author Tanyongde
  */
 @Service("applyService")
 public class ApplyService implements IApplyService {
-	@Autowired
-	private ApplyDao applyDao;
-	@Autowired
-	private ApplySiteDao applySiteDao;
-	
-	/**
-	 * 获取全部应用
-	 */
-	public ResultMsg<?> getAll(String local,int isRoot,List<Long> roleIds,Integer siteId){
-		Page<Apply> page = new Page<Apply>();
-		try {
-			List<Apply> list = null;
-			//系统管理员
+    @Autowired
+    private ApplyDao applyDao;
+    @Autowired
+    private ApplySiteDao applySiteDao;
+
+    /**
+     * 获取全部应用
+     */
+    public ResultMsg<?> getAll(String local, int isRoot, List<Long> roleIds, Integer siteId) {
+        Page<Apply> page = new Page<Apply>();
+        try {
+            List<Apply> list = null;
+            //系统管理员
 //			if(isRoot == SystemConstant.IS_ROOT){
 //				list = applyDao.selectAll();
 //				String str = "";
@@ -52,265 +50,292 @@ public class ApplyService implements IApplyService {
 //				//System.out.println(str1);
 //				System.out.println(str);
 //			}else{
-				//先根据站点获取应用
-				List<ApplySite> siteList = applySiteDao.selectList(siteId,roleIds);
-				if(CollectionUtils.isEmpty(siteList)){
-					page.setRows(new ArrayList<Apply>());
-					return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
-				}
-				List<Long> applyIds = new ArrayList<Long>();
-				for(int i=0;i<siteList.size();i++){
-					applyIds.add(siteList.get(i).getApplyId());
-				}
-				list = applyDao.selectList(applyIds);
-				//String str = "";
-				//String str1= "";
-				//for (Apply ap : list) {
-					//str +=ap.getId() +"," +ap.getTitle()+";";
-					//str1 += ap.getTitle()+",";
-				//}
-				//System.out.println(str1);
-				//System.out.println(str);
+            //先根据站点获取应用
+            List<ApplySite> siteList = applySiteDao.selectList(siteId, roleIds);
+            if (CollectionUtils.isEmpty(siteList)) {
+                page.setRows(new ArrayList<Apply>());
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+            }
+            List<Long> applyIds = new ArrayList<Long>();
+            for (int i = 0; i < siteList.size(); i++) {
+                applyIds.add(siteList.get(i).getApplyId());
+            }
+            list = applyDao.selectList(applyIds);
+            //String str = "";
+            //String str1= "";
+            //for (Apply ap : list) {
+            //str +=ap.getId() +"," +ap.getTitle()+";";
+            //str1 += ap.getTitle()+",";
+            //}
+            //System.out.println(str1);
+            //System.out.println(str);
 //			}
-			if(null == list || 0 == list.size()){
-				page.setRows(new ArrayList<Apply>());
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
-			}
-			page = new Page<Apply>(0, list.size(), list.size(), list);
-			return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","get_success"),page);
-		} catch (Exception e) {
-			e.printStackTrace();
-			return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local,"tips", "get_error"));
-		}
-	}
-	
-	
-	/**
-	 * 根据分类ID获取应用
-	 */
-	public ResultMsg<?> getList(String local, Long categoryId,Integer type,int isRoot,List<Long> roleIds,Integer siteId){
+
+            if (null == list || 0 == list.size()) {
+                page.setRows(new ArrayList<Apply>());
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+            }
+            for (Apply apply : list) {
+                String icon = apply.getIcon();
+                String[] iconArr = icon.split("@");
+                if (iconArr.length > 1) {
+                    apply.setIcon(iconArr[1]);
+                } else {
+                    apply.setIcon("bigScreen.png");
+                }
+            }
+            page = new Page<Apply>(0, list.size(), list.size(), list);
+            return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+    }
+
+
+    /**
+     * 根据分类ID获取应用
+     */
+    public ResultMsg<?> getList(String local, Long categoryId, Integer type, int isRoot, List<Long> roleIds, Integer siteId) {
 		/*if(null == categoryId){
 			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "param_error"));
 		}*/
-		Page<Apply> page = new Page<Apply>();
-		try {
-			List<Apply> list = null;
-			if(isRoot == SystemConstant.IS_ROOT){		
-				list = applyDao.selectList(categoryId,type);
-			}else{
-				//先根据站点获取应用
-				List<ApplySite> siteList = applySiteDao.selectList(siteId, roleIds);
-				if(CollectionUtils.isEmpty(siteList)){
-					page.setRows(new ArrayList<Apply>());
-					return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
-				}
-				List<Long> applyIds = new ArrayList<Long>();
-				for(int i=0;i<siteList.size();i++){
-					applyIds.add(siteList.get(i).getApplyId());
-				}
-				list = applyDao.selectList(categoryId,type,applyIds);
-			}
-			if(null == list || 0 == list.size()){
-				page.setRows(new ArrayList<Apply>());
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
-			}
-			page = new Page<Apply>(0, list.size(), list.size(), list);
-			return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","get_success"),page);
-		} catch (Exception e) {
-			e.printStackTrace();
-			return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local,"tips", "get_error"));
-		}
-	}
+        Page<Apply> page = new Page<Apply>();
+        try {
+            List<Apply> list = null;
+            if (isRoot == SystemConstant.IS_ROOT) {
+                list = applyDao.selectList(categoryId, type);
+            } else {
+                //先根据站点获取应用
+                List<ApplySite> siteList = applySiteDao.selectList(siteId, roleIds);
+                if (CollectionUtils.isEmpty(siteList)) {
+                    page.setRows(new ArrayList<Apply>());
+                    return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+                }
+                List<Long> applyIds = new ArrayList<Long>();
+                for (int i = 0; i < siteList.size(); i++) {
+                    applyIds.add(siteList.get(i).getApplyId());
+                }
+                list = applyDao.selectList(categoryId, type, applyIds);
+            }
+            if (null == list || 0 == list.size()) {
+                page.setRows(new ArrayList<Apply>());
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+            }
+            for (Apply apply : list) {
+                String icon = apply.getIcon();
+                String[] iconArr = icon.split("@");
+                if (iconArr.length > 1) {
+                    apply.setIcon(iconArr[1]);
+                } else {
+                    apply.setIcon("bigScreen.png");
+                }
+            }
+            page = new Page<Apply>(0, list.size(), list.size(), list);
+            return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+    }
 
-	/**
-	 * 添加应用
-	 */
-	@Transactional
-	public ResultMsg<?> add(String local,Apply apply) {
-		if(null == apply || StringUtils.isEmpty(apply.getTitle()) || StringUtils.isEmpty(apply.getSiteIds())) {
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips","param_error"));
-		}
-		try {
-			if(null == apply.getCategoryId()){
-				apply.setCategoryId(DataUtils.getLong(0));
-			}
-			
-			if(null == apply.getWidth() || apply.getWidth() <= 0){
-				apply.setWidth((float) 800);
-			}
-			
-			if(null == apply.getHeight() || apply.getHeight() <= 0){
-				apply.setWidth((float) 600);
-			}
-			
-			if(null == apply.getType()){
-				apply.setType(1);
-			}
-			
-			//添加应用
-			long id = applyDao.insertAndReturnId(apply);
-			//添加应用站点
-			String roleIds = apply.getRoleIds();
-			String []roleId = roleIds.split(",");
-			String siteIds = apply.getSiteIds();
-			String []siteId = siteIds.split(",");
-			List<ApplySite> siteList = new ArrayList<ApplySite>();
-			for(String r : roleId){
-				for(String s : siteId){
-					ApplySite applySite = new ApplySite();
-					applySite.setRoleId(DataUtils.getLong(r));
-					applySite.setApplyId(id);
-					applySite.setSiteId(DataUtils.getLong(s));
-					siteList.add(applySite);
-				}
-			}
-			int result = applySiteDao.saveAll(siteList);
-			if(id > 0 && result > 0){
-				apply.setId(id);
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","add_success"),apply);
-			}
-			//添加不成功时删除应用
-			applyDao.delete(id);
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","add_error"));
-		} catch (Exception e) {
- 			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","add_error"));
-		}
-	}
+    /**
+     * 添加应用
+     */
+    @Transactional
+    public ResultMsg<?> add(String local, Apply apply) {
+        if (null == apply || StringUtils.isEmpty(apply.getTitle()) || StringUtils.isEmpty(apply.getSiteIds())) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "param_error"));
+        }
+        try {
+            if (null == apply.getCategoryId()) {
+                apply.setCategoryId(DataUtils.getLong(0));
+            }
 
+            if (null == apply.getWidth() || apply.getWidth() <= 0) {
+                apply.setWidth((float) 800);
+            }
 
-	/**
-	 * 根据id删除应用
-	 */
-	@Transactional
-	public ResultMsg<?> realDel(String local,Long id) {
-		if(null == id){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips","param_error"));
-		}
-		try {
-			boolean result = applyDao.delete(id);
-			if(result){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","remove_success"));
-			}
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","remove_error"));
-		} catch (Exception e) {
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","remove_error"));
-		}
-	}
-	
-	/**
-	 * 根据id修改应用状态
-	 */
-	@Transactional
-	public ResultMsg<?> remove(String local,Long id) {
-		if(null == id){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips","param_error"));
-		}
-		try {
-			Apply apply = applyDao.get(id);
-			if(null == apply){
-				return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips","param_error"));
-			}
-			apply.setState(SystemConstant.DISABLE);
-			int result = applyDao.update(apply);
-			if(result > 0){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","modify_success"));
-			}
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","modify_error"));
-		} catch (Exception e) {
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","modify_error"));
-		}
-	}
+            if (null == apply.getHeight() || apply.getHeight() <= 0) {
+                apply.setWidth((float) 600);
+            }
 
+            if (null == apply.getType()) {
+                apply.setType(1);
+            }
 
-	/**
-	 * 修改应用信息
-	 */
-	@Transactional
-	public ResultMsg<?> modify(String local,Apply apply) {
-		if(null == apply || StringUtils.isEmpty(apply.getTitle())){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips","param_error"));
-		}
-		
-		try {
-			if(null == apply.getCategoryId()){
-				apply.setCategoryId(DataUtils.getLong(0));
-			}
-			
-			if(null == apply.getWidth() || apply.getWidth() <= 0){
-				apply.setWidth((float) 800);
-			}
-			
-			if(null == apply.getHeight() || apply.getHeight() <= 0){
-				apply.setWidth((float) 600);
-			}
-			
-			if(null == apply.getType()){
-				apply.setType(1);
-			}
-			int result = applyDao.update(apply);
-			applySiteDao.deleteByAppId(apply.getId());
-			//添加应用站点
-			String roleIds = apply.getRoleIds();
-			String []roleId = roleIds.split(",");
-			String siteIds = apply.getSiteIds();
-			String []siteId = siteIds.split(",");
-			List<ApplySite> siteList = new ArrayList<ApplySite>();
-			for(String r : roleId){
-				for(String s : siteId){
-					ApplySite applySite = new ApplySite();
-					applySite.setRoleId(DataUtils.getLong(r));
-					applySite.setApplyId(apply.getId());
-					applySite.setSiteId(DataUtils.getLong(s));
-					siteList.add(applySite);
-				}
-			}
-			applySiteDao.saveAll(siteList);
-			if(result > 0){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local,"tips", "modify_success"),apply);
-			}
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","modify_error"));
-		} catch (Exception e) {
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","modify_error"));
-		}
-	}
+            //添加应用
+            long id = applyDao.insertAndReturnId(apply);
+            //添加应用站点
+            String roleIds = apply.getRoleIds();
+            String[] roleId = roleIds.split(",");
+            String siteIds = apply.getSiteIds();
+            String[] siteId = siteIds.split(",");
+            List<ApplySite> siteList = new ArrayList<ApplySite>();
+            for (String r : roleId) {
+                for (String s : siteId) {
+                    ApplySite applySite = new ApplySite();
+                    applySite.setRoleId(DataUtils.getLong(r));
+                    applySite.setApplyId(id);
+                    applySite.setSiteId(DataUtils.getLong(s));
+                    siteList.add(applySite);
+                }
+            }
+            int result = applySiteDao.saveAll(siteList);
+            if (id > 0 && result > 0) {
+                apply.setId(id);
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "add_success"), apply);
+            }
+            //添加不成功时删除应用
+            applyDao.delete(id);
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+        }
+    }
 
 
-	public ResultMsg<?> getListByType(String local, Integer type,int isRoot,List<Long> roleIds,Integer siteId) {
-		if(null == type){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "param_error"));
-		}
-		Page<Apply> page = new Page<Apply>();
-		try {
-			List<Apply> list = null;
-			//系统管理员
-			if(isRoot == SystemConstant.IS_ROOT){
-				list = applyDao.selectByType(type);
-			}else{
-				//先根据站点获取应用
-				List<ApplySite> siteList = applySiteDao.selectList(siteId, roleIds);
-				if(CollectionUtils.isEmpty(siteList)){
-					page.setRows(new ArrayList<Apply>());
-					return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
-				}
-				List<Long> applyIds = new ArrayList<Long>();
-				for(int i=0;i<siteList.size();i++){
-					applyIds.add(siteList.get(i).getApplyId());
-				}
-				list = applyDao.selectList(applyIds);
-			}
-			if(null == list || 0 == list.size()){
-				page.setRows(new ArrayList<Apply>());
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
-			}
-			page = new Page<Apply>(0, list.size(), list.size(), list);
-			return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","get_success"),page);
-		} catch (Exception e) {
-			e.printStackTrace();
-			return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local,"tips", "get_error"));
-		}
-	}
+    /**
+     * 根据id删除应用
+     */
+    @Transactional
+    public ResultMsg<?> realDel(String local, Long id) {
+        if (null == id) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "param_error"));
+        }
+        try {
+            boolean result = applyDao.delete(id);
+            if (result) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "remove_success"));
+            }
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
+        }
+    }
+
+    /**
+     * 根据id修改应用状态
+     */
+    @Transactional
+    public ResultMsg<?> remove(String local, Long id) {
+        if (null == id) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "param_error"));
+        }
+        try {
+            Apply apply = applyDao.get(id);
+            if (null == apply) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "param_error"));
+            }
+            apply.setState(SystemConstant.DISABLE);
+            int result = applyDao.update(apply);
+            if (result > 0) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "modify_success"));
+            }
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+        }
+    }
+
+
+    /**
+     * 修改应用信息
+     */
+    @Transactional
+    public ResultMsg<?> modify(String local, Apply apply) {
+        if (null == apply || StringUtils.isEmpty(apply.getTitle())) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "param_error"));
+        }
+        //修改图标 没有@分割符只修改桌面的
+        Apply old = applyDao.get(apply.getId());
+        if (old == null) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+        }
+        if (!apply.getIcon().contains("@")) {
+            String[] iconArr = old.getIcon().split("@");
+            apply.setIcon(iconArr[0] + "@" + apply.getIcon());
+        }
+        try {
+            if (null == apply.getCategoryId()) {
+                apply.setCategoryId(DataUtils.getLong(0));
+            }
+
+            if (null == apply.getWidth() || apply.getWidth() <= 0) {
+                apply.setWidth((float) 800);
+            }
+
+            if (null == apply.getHeight() || apply.getHeight() <= 0) {
+                apply.setWidth((float) 600);
+            }
+
+            if (null == apply.getType()) {
+                apply.setType(1);
+            }
+            int result = applyDao.update(apply);
+            applySiteDao.deleteByAppId(apply.getId());
+            //添加应用站点
+            String roleIds = apply.getRoleIds();
+            String[] roleId = roleIds.split(",");
+            String siteIds = apply.getSiteIds();
+            String[] siteId = siteIds.split(",");
+            List<ApplySite> siteList = new ArrayList<ApplySite>();
+            for (String r : roleId) {
+                for (String s : siteId) {
+                    ApplySite applySite = new ApplySite();
+                    applySite.setRoleId(DataUtils.getLong(r));
+                    applySite.setApplyId(apply.getId());
+                    applySite.setSiteId(DataUtils.getLong(s));
+                    siteList.add(applySite);
+                }
+            }
+            applySiteDao.saveAll(siteList);
+            if (result > 0) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "modify_success"), apply);
+            }
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+        }
+    }
+
+
+    public ResultMsg<?> getListByType(String local, Integer type, int isRoot, List<Long> roleIds, Integer siteId) {
+        if (null == type) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "param_error"));
+        }
+        Page<Apply> page = new Page<Apply>();
+        try {
+            List<Apply> list = null;
+            //系统管理员
+            if (isRoot == SystemConstant.IS_ROOT) {
+                list = applyDao.selectByType(type);
+            } else {
+                //先根据站点获取应用
+                List<ApplySite> siteList = applySiteDao.selectList(siteId, roleIds);
+                if (CollectionUtils.isEmpty(siteList)) {
+                    page.setRows(new ArrayList<Apply>());
+                    return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+                }
+                List<Long> applyIds = new ArrayList<Long>();
+                for (int i = 0; i < siteList.size(); i++) {
+                    applyIds.add(siteList.get(i).getApplyId());
+                }
+                list = applyDao.selectList(applyIds);
+            }
+            if (null == list || 0 == list.size()) {
+                page.setRows(new ArrayList<Apply>());
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+            }
+            page = new Page<Apply>(0, list.size(), list.size(), list);
+            return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Page<Apply>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+    }
 }

+ 269 - 263
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/service/impl/DesktopService.java

@@ -1,292 +1,298 @@
 package cn.vbdsm.manage.service.impl;
 
 
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import javax.core.common.ResultMsg;
-import javax.core.common.utils.DataUtils;
-import javax.core.common.utils.StringUtils;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import cn.vbdsm.common.config.I18nConfig;
 import cn.vbdsm.common.constants.SystemConstant;
-import cn.vbdsm.manage.dao.ApplyDao;
-import cn.vbdsm.manage.dao.BaseCodeDao;
-import cn.vbdsm.manage.dao.OrgDao;
-import cn.vbdsm.manage.dao.PowerUserContactDao;
-import cn.vbdsm.manage.dao.UserApplyDao;
+import cn.vbdsm.manage.dao.*;
 import cn.vbdsm.manage.service.IDesktopService;
 import cn.vbdsm.model.Apply;
 import cn.vbdsm.model.BaseCode;
 import cn.vbdsm.model.PowerUserContact;
 import cn.vbdsm.model.UserApply;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.core.common.ResultMsg;
+import javax.core.common.utils.DataUtils;
+import javax.core.common.utils.StringUtils;
+import java.util.*;
 
 /**
  * 桌面管理
- * @author Tanyongde
  *
+ * @author Tanyongde
  */
 @Service
-public class DesktopService implements IDesktopService{
-	@Autowired private UserApplyDao userApplyDao;
-	@Autowired private ApplyDao applyDao;
+public class DesktopService implements IDesktopService {
+    @Autowired
+    private UserApplyDao userApplyDao;
+    @Autowired
+    private ApplyDao applyDao;
+
+    @Autowired
+    private OrgDao orgDao;
+    @Autowired
+    private PowerUserContactDao powerUserContactDao;
+    @Autowired
+    private BaseCodeDao codeDao;
+
+    /**
+     * 获取我的桌面应用
+     */
+    public ResultMsg<?> getMyApplies(String local, String uid) {
+        if (StringUtils.isEmpty(uid)) {
+            return new ResultMsg<Integer>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "param_error"));
+        }
+        try {
+            Map<Long, JSONObject> myapps = new TreeMap<Long, JSONObject>();
+            Map<Long, JSONObject> appstore = new HashMap<Long, JSONObject>();
+            List<Long> myappIds = new ArrayList<Long>();
+
+            //封装我的应用
+            UserApply userApply = userApplyDao.selectByUserId(DataUtils.getLong(uid));
+            if (null != userApply) {
+                String applies = userApply.getApplies();
+                JSONArray arr = JSONArray.parseArray(applies);
+                for (Object obj : arr) {
+                    JSONObject json = (JSONObject) obj;
+                    myapps.put(json.getLong("id"), json);
+                    myappIds.add(json.getLong("id"));
+                }
+            }
+
+            //从应用中心中取出相关的应用,并封装到map中
+            List<Apply> appstoreList = applyDao.selectList(myappIds, -1);
+            if (null != appstoreList) {
+                for (Apply apply : appstoreList) {
+                    String icon = apply.getIcon();
+                    String[] iconArr = icon.split("@");
+                    if (iconArr.length > 1) {
+                        apply.setIcon(iconArr[1]);
+                    } else {
+                        apply.setIcon("bigScreen.png");
+                    }
+                    JSONObject app = (JSONObject) JSONObject.toJSON(apply);
+                    appstore.put(apply.getId(), app);
+                }
+            }
+
+            //合并两个结果
+            String noRewriteFileds = "title|orderNum|free|price|state|roleIds|siteIds";
+            for (Long id : myapps.keySet()) {
+                for (String filed : myapps.get(id).keySet()) {
+                    if (filed.matches(noRewriteFileds)) {
+                        continue;
+                    }
+                    if (appstore.get(id) == null) {
+                        continue;
+                    }
+                    myapps.get(id).put(filed, appstore.get(id).get(filed));
+                }
+            }
+
+            //输出合并好的结果
+            JSONArray applies = new JSONArray();
+            for (JSONObject json : myapps.values()) {
+                applies.add(json);
+            }
+
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), applies);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+    }
+
+    /**
+     * 添加我的应用
+     */
+    public ResultMsg<?> add(String local, String uid, Long id, Long expiredTime, Integer isDir) {
+        if (null == id) {
+            return new ResultMsg<Integer>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+        }
+        JSONArray arr = null;
+        try {
+            UserApply.ApplyItem applyItem = new UserApply().new ApplyItem();
+            Apply apply = applyDao.get(id);
+
+            DataUtils.copySimpleObject(apply, applyItem);
+            if (null != expiredTime) {
+                applyItem.setExpiredTime(expiredTime);
+            }
+            if (null != isDir) {
+                applyItem.setIsDir(isDir);
+            }
+            applyItem.setCount(1);
+            applyItem.setBuyTime(System.currentTimeMillis());
+            UserApply userApply = userApplyDao.selectByUserId(DataUtils.getLong(uid));
+            String applies = "";
+            if (null == userApply) {
+                arr = new JSONArray();
+                userApply = new UserApply();
+                arr.add(JSON.toJSON(applyItem));
+                applies = JSON.toJSONString(arr);
+                userApply.setUserId(DataUtils.getLong(uid));
+                userApply.setApplies(applies);
+                long result = userApplyDao.saveAndReturnId(userApply);
+                if (result > 0) {
+                    userApply.setId(result);
+                    return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "add_success"), applyItem);
+                } else {
+                    return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+                }
+            } else {
+                applies = userApply.getApplies();
+                arr = JSONArray.parseArray(applies);
+                for (int i = 0; i < arr.size(); i++) {
+                    JSONObject obj = (JSONObject) arr.get(i);
+                    //提示应用已经存在
+                    if (id == obj.getLong("id")) {
+                        return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "no_again_buy"), applyItem);
+                    }
+                }
+                arr.add(JSON.toJSON(applyItem));
+                applies = JSON.toJSONString(arr);
+                userApply.setApplies(applies);
+                int result = userApplyDao.update(userApply);
+                if (result > 0) {
+                    return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "add_success"), applyItem);
+                } else {
+                    return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+        }
+    }
 
-	@Autowired private OrgDao orgDao;
-	@Autowired private PowerUserContactDao powerUserContactDao;
-	@Autowired private BaseCodeDao codeDao;
-	
-	/**
-	 * 获取我的桌面应用
-	 */
-	public ResultMsg<?> getMyApplies(String local,String uid){
-		if(StringUtils.isEmpty(uid)){
-			return new ResultMsg<Integer>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local,"tips" ,"param_error"));
-		}
-		try {
-			Map<Long,JSONObject> myapps = new TreeMap<Long, JSONObject>();
-			Map<Long,JSONObject> appstore = new HashMap<Long,JSONObject>();
-			List<Long> myappIds = new ArrayList<Long>();
-			
-			//封装我的应用
-			UserApply userApply = userApplyDao.selectByUserId(DataUtils.getLong(uid));
-			if(null != userApply){
-				String applies = userApply.getApplies();
-				JSONArray arr = JSONArray.parseArray(applies);
-				for (Object obj : arr) {
-					JSONObject json = (JSONObject)obj;
-					myapps.put(json.getLong("id"), json);
-					myappIds.add(json.getLong("id"));
-				}
-			}
-			
-			//从应用中心中取出相关的应用,并封装到map中
-			List<Apply> appstoreList = applyDao.selectList(myappIds,-1);
-			if(null != appstoreList){
-				for (Apply apply : appstoreList) {
-					JSONObject app = (JSONObject)JSONObject.toJSON(apply);
-					appstore.put(apply.getId(), app);
-				}
-			}
-			
-			//合并两个结果
-			String noRewriteFileds = "title|orderNum|free|price|state|roleIds|siteIds";
-			for (Long id : myapps.keySet()) {
-				for (String filed : myapps.get(id).keySet()) {
-					if(filed.matches(noRewriteFileds)){ continue; }
-					if(appstore.get(id) == null){ continue; }
-					myapps.get(id).put(filed, appstore.get(id).get(filed));
-				}
-			}
-			
-			//输出合并好的结果
-			JSONArray applies = new JSONArray();
-			for (JSONObject json : myapps.values()) {
-				applies.add(json);
-			}
-			
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local,"tips", "get_success"),applies);
-		} catch (Exception e) {
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local,"tips", "get_error"));
-		}
-	}
+    /**
+     * 删除我的应用
+     */
+    public ResultMsg<?> remove(String local, String uid, String id) {
+        if (null == id) {
+            return new ResultMsg<Integer>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
+        }
+        UserApply userApply = userApplyDao.selectByUserId(DataUtils.getLong(uid));
+        if (null == userApply) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "remove_success"));
+        } else {
+            String[] ids = id.split(",");
+            String applies = userApply.getApplies();
+            JSONArray arr = JSONArray.parseArray(applies);
+            for (int i = 0; i < arr.size(); i++) {
+                JSONObject obj = (JSONObject) arr.get(i);
+                for (String s : ids) {
+                    if (obj.getLong("id").equals(DataUtils.getLong(s))) {
+                        arr.remove(i);
+                        break;
+                    }
+                }
+            }
+            applies = JSON.toJSONString(arr);
+            userApply.setApplies(applies);
+            int result = userApplyDao.update(userApply);
+            if (result > 0) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "remove_success"), userApply);
+            } else {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
+            }
+        }
+    }
 
-	/**
-	 * 添加我的应用
-	 */
-	public ResultMsg<?> add(String local,String uid, Long id, Long expiredTime, Integer isDir) {
-		if(null == id){
-			return new ResultMsg<Integer>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local,"tips" ,"add_error"));
-		}
-		JSONArray arr = null;
-		try {
-			UserApply.ApplyItem applyItem =   new UserApply().new ApplyItem();
-			Apply apply = applyDao.get(id);
+    /**
+     * 获取机构基本信息
+     *
+     * @param companyId
+     * @return
+     * @author grxie
+     */
+    public ResultMsg<?> getCompanyInfo(long companyId) {
+        ResultMsg<JSONObject> resultMsg = null;
+        try {
+            JSONObject result = new JSONObject();
+            Map<String, Object> powerUser = orgDao.getPowerUser(companyId);
+            if (powerUser.isEmpty()) return new ResultMsg<JSONObject>();
 
-			DataUtils.copySimpleObject(apply, applyItem);
-			if(null != expiredTime){
-				applyItem.setExpiredTime(expiredTime);
-			}
-			if(null != isDir){
-				applyItem.setIsDir(isDir);
-			}
-			applyItem.setCount(1);
-			applyItem.setBuyTime(System.currentTimeMillis());
-			UserApply userApply = userApplyDao.selectByUserId(DataUtils.getLong(uid));
-			String applies = "";
-			if(null == userApply){
-				arr = new JSONArray();
-				userApply = new UserApply();
-				arr.add(JSON.toJSON(applyItem));
-				applies = JSON.toJSONString(arr);
-				userApply.setUserId(DataUtils.getLong(uid));
-				userApply.setApplies(applies);
-				long result = userApplyDao.saveAndReturnId(userApply);
-				if(result > 0){
-					userApply.setId(result);
-					return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local,"tips", "add_success"),applyItem);
-				}else{
-					return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local,"tips", "add_error"));
-				}
-			}else{
-				applies = userApply.getApplies();
-				arr = JSONArray.parseArray(applies);
-				for(int i=0;i<arr.size();i++){
-					JSONObject obj = (JSONObject)arr.get(i);
-					//提示应用已经存在
-					if(id == obj.getLong("id")){
-						return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local,"tips", "no_again_buy"),applyItem);
-					}
-				}
-				arr.add(JSON.toJSON(applyItem));
-				applies = JSON.toJSONString(arr);
-				userApply.setApplies(applies);
-				int result = userApplyDao.update(userApply);
-				if(result > 0){
-					return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local,"tips", "add_success"),applyItem);
-				}else{
-					return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local,"tips", "add_error"));
-				}
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local,"tips", "add_error"));
-		}
-	}
+            result.put("powerName", DataUtils.getString(powerUser.get("_name")));//电力企业机构名称
+            result.put("powerAddress", (null == powerUser.get("_address")) ? null : DataUtils.getString(powerUser.get("_address")));//电力企业地址
+            result.put("powerExpiredDate", (null == powerUser.get("_expiredDate")) ? null : DataUtils.getString(powerUser.get("_expiredDate")));//电力企业服务到期日
 
-	/**
-	 * 删除我的应用
-	 */
-	public ResultMsg<?> remove(String local, String uid, String id) {
-		if(null == id){
-			return new ResultMsg<Integer>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local,"tips" ,"remove_error"));
-		}
-		UserApply userApply = userApplyDao.selectByUserId(DataUtils.getLong(uid));
-		if(null == userApply){
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local,"tips", "remove_success"));
-		}else{
-			String []ids = id.split(",");
-			String applies = userApply.getApplies();
-			JSONArray arr = JSONArray.parseArray(applies);
-			for(int i=0;i<arr.size();i++){
-				JSONObject obj = (JSONObject)arr.get(i);
-				for(String s : ids){
-					if(obj.getLong("id").equals(DataUtils.getLong(s))){
-						arr.remove(i);
-						break;
-					}
-				}
-			}
-			applies = JSON.toJSONString(arr);
-			userApply.setApplies(applies);
-			int result = userApplyDao.update(userApply);
-			if(result > 0){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local,"tips", "remove_success"),userApply);
-			}else{
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local,"tips", "remove_error"));
-			}
-		}
-	}
+            if (null != powerUser.get("_rank")) {
+                int rank = DataUtils.getInteger(powerUser.get("_rank"));
+                String rankName = null;
+                if (rank == 0) rankName = "普通";
+                else if (rank == 1) rankName = "省级";
+                else if (rank == 2) rankName = "市级";
+                else if (rank == 3) rankName = "省级和市级";
+                result.put("powerRank", rankName);//电力企业级别
+            }
+            result.put("powerIndustry1", (null == powerUser.get("_industry1")) ? null : DataUtils.getString(powerUser.get("_industry1")));//电力企业行业
+            result.put("powerIndustry2", (null == powerUser.get("_industry2")) ? null : DataUtils.getString(powerUser.get("_industry2")));//电力企业行业
+            result.put("powerIndustry3", (null == powerUser.get("_industry3")) ? null : DataUtils.getString(powerUser.get("_industry3")));//电力企业行业
+            result.put("powerApplyLoad", (null == powerUser.get("_applyLoad")) ? null : DataUtils.getString(powerUser.get("_applyLoad")));//电力企业包装容量
+            result.put("powerZbsl", (null == powerUser.get("_zbsl")) ? null : DataUtils.getString(powerUser.get("_zbsl")));//电力企业主变数量
 
-	/**
-	 * 获取机构基本信息
-	 * @author grxie
-	 * @param companyId
-	 * @return
-	 */
-	public ResultMsg<?> getCompanyInfo(long companyId){
-		ResultMsg<JSONObject> resultMsg = null;
-		try {
-			JSONObject result = new JSONObject();
-			Map<String, Object> powerUser = orgDao.getPowerUser(companyId);
-			if(powerUser.isEmpty()) return new ResultMsg<JSONObject>();
+            if (null != powerUser.get("_voltageClass")) {
+                BaseCode baseCode = codeDao.get(DataUtils.getString(powerUser.get("_voltageClass")));
+                if (null != baseCode)
+                    result.put("powerVoltageClass", baseCode.getCodeZH());//电力企业电压等级
+            }
 
-			result.put("powerName", DataUtils.getString(powerUser.get("_name")));//电力企业机构名称
-			result.put("powerAddress", (null == powerUser.get("_address"))?null:DataUtils.getString(powerUser.get("_address")));//电力企业地址
-			result.put("powerExpiredDate", (null == powerUser.get("_expiredDate"))?null:DataUtils.getString(powerUser.get("_expiredDate")));//电力企业服务到期日
-			
-			if(null != powerUser.get("_rank")) {
-				int rank = DataUtils.getInteger(powerUser.get("_rank"));
-				String rankName = null;
-				if(rank == 0) rankName = "普通";
-				else if(rank == 1) rankName = "省级";
-				else if(rank == 2) rankName = "市级";
-				else if(rank == 3) rankName = "省级和市级";
-				result.put("powerRank", rankName);//电力企业级别
-			}
-			result.put("powerIndustry1", (null == powerUser.get("_industry1"))?null:DataUtils.getString(powerUser.get("_industry1")));//电力企业行业
-			result.put("powerIndustry2", (null == powerUser.get("_industry2"))?null:DataUtils.getString(powerUser.get("_industry2")));//电力企业行业
-			result.put("powerIndustry3", (null == powerUser.get("_industry3"))?null:DataUtils.getString(powerUser.get("_industry3")));//电力企业行业
-			result.put("powerApplyLoad", (null == powerUser.get("_applyLoad"))?null:DataUtils.getString(powerUser.get("_applyLoad")));//电力企业包装容量
-			result.put("powerZbsl", (null == powerUser.get("_zbsl"))?null:DataUtils.getString(powerUser.get("_zbsl")));//电力企业主变数量
-			
-			if(null != powerUser.get("_voltageClass")) {
-				BaseCode baseCode = codeDao.get(DataUtils.getString(powerUser.get("_voltageClass")));
-				if(null != baseCode)
-					result.put("powerVoltageClass", baseCode.getCodeZH());//电力企业电压等级
-			}
-			
-			int jffs = (null == powerUser.get("_jffs"))?1:DataUtils.getInteger(powerUser.get("_jffs"));
-			String jffsName = null;
-			if(jffs==1) jffsName = "容量";
-			else if(jffs==2) jffsName = "需量";
-			else if(jffs==3) jffsName = "单一电价";
-			result.put("powerJffs", jffsName);//电力企业计费方式(1:容量、2:需量、3:单一电价,默认为1)
+            int jffs = (null == powerUser.get("_jffs")) ? 1 : DataUtils.getInteger(powerUser.get("_jffs"));
+            String jffsName = null;
+            if (jffs == 1) jffsName = "容量";
+            else if (jffs == 2) jffsName = "需量";
+            else if (jffs == 3) jffsName = "单一电价";
+            result.put("powerJffs", jffsName);//电力企业计费方式(1:容量、2:需量、3:单一电价,默认为1)
 
-			result.put("powerIsFgp", null == powerUser.get("_isFgp")?"否":(DataUtils.getInteger(powerUser.get("_isFgp"))==0?"否":"是"));//电力企业是否启用自定义用电时段(0:否、1:是,默认为0)
+            result.put("powerIsFgp", null == powerUser.get("_isFgp") ? "否" : (DataUtils.getInteger(powerUser.get("_isFgp")) == 0 ? "否" : "是"));//电力企业是否启用自定义用电时段(0:否、1:是,默认为0)
 
-			int supply = (null == powerUser.get("_powerSupply"))?1:DataUtils.getInteger(powerUser.get("_powerSupply"));
-			String powerSupply = null;
-			if(supply==1) powerSupply = "网供";
-			else if(supply==2) powerSupply = "电厂";
-			else if(supply==3) powerSupply = "混合";
-			result.put("powerPowerSupply", powerSupply);//电力企业供电电源(1:网供、 2:电厂、3:混合,默认为1)
+            int supply = (null == powerUser.get("_powerSupply")) ? 1 : DataUtils.getInteger(powerUser.get("_powerSupply"));
+            String powerSupply = null;
+            if (supply == 1) powerSupply = "网供";
+            else if (supply == 2) powerSupply = "电厂";
+            else if (supply == 3) powerSupply = "混合";
+            result.put("powerPowerSupply", powerSupply);//电力企业供电电源(1:网供、 2:电厂、3:混合,默认为1)
 
-			if(null != powerUser.get("_style")) {
-				int style = DataUtils.getInteger(powerUser.get("_style"));
-				String styleName = null;
-				if(style==1) styleName = "工况企业";
-				else if(style==2) styleName = "办公楼宇";
-				else if(style==3) styleName = "电厂";
-				result.put("powerType", styleName);//电力企业类型(1:工况企业、2:办公楼宇、3:电厂)
-			}
-			result.put("powerJbdj", (null == powerUser.get("_jbdj"))?null:DataUtils.getString(powerUser.get("_jbdj")));//电力企业基本电价(元)
-			result.put("powerState", (null == powerUser.get("_state"))?"正常":(DataUtils.getInteger(powerUser.get("_state"))==0?"正常":"停产"));//电力企业状态(0:正常、1停产 默认0)
+            if (null != powerUser.get("_style")) {
+                int style = DataUtils.getInteger(powerUser.get("_style"));
+                String styleName = null;
+                if (style == 1) styleName = "工况企业";
+                else if (style == 2) styleName = "办公楼宇";
+                else if (style == 3) styleName = "电厂";
+                result.put("powerType", styleName);//电力企业类型(1:工况企业、2:办公楼宇、3:电厂)
+            }
+            result.put("powerJbdj", (null == powerUser.get("_jbdj")) ? null : DataUtils.getString(powerUser.get("_jbdj")));//电力企业基本电价(元)
+            result.put("powerState", (null == powerUser.get("_state")) ? "正常" : (DataUtils.getInteger(powerUser.get("_state")) == 0 ? "正常" : "停产"));//电力企业状态(0:正常、1停产 默认0)
 
-			if(null != powerUser.get("_serviceId")) {
-				Map<String, Object> proxyCompany = orgDao.getProxyCompany(DataUtils.getLong(powerUser.get("_serviceId")));
-				result.put("proxyName", (null == proxyCompany.get("_name"))?null:DataUtils.getString(proxyCompany.get("_name")));//服务机构名称
-				result.put("proxyAddress", (null == proxyCompany.get("_address"))?null:DataUtils.getString(proxyCompany.get("_address")));//服务机构地址
-				result.put("proxyPrincipal", (null == proxyCompany.get("_principal"))?null:DataUtils.getString(proxyCompany.get("_principal")));//服务机构负责人
-				result.put("proxyTel", (null == proxyCompany.get("_tel"))?null:DataUtils.getString(proxyCompany.get("_tel")));//服务机构联系电话
-				if(null != proxyCompany.get("_tg")) {
-					int tg = DataUtils.getInteger(proxyCompany.get("_tg"));
-					String tgName = null;
-					if(tg == 0) tgName = "服务商/代理";
-					else if(tg == 1) tgName = "总部";
-					else if(tg == 2) tgName = "服务公司";
-					result.put("proxyTg", tgName);//服务机构类型
-				}
-			}
-			//企业联系人列表
-			List<PowerUserContact> contactList = powerUserContactDao.queryListByCompanyId(DataUtils.getLong(powerUser.get("_powerUserId")));
-			result.put("powerContact", JSONObject.toJSONString(contactList));
+            if (null != powerUser.get("_serviceId")) {
+                Map<String, Object> proxyCompany = orgDao.getProxyCompany(DataUtils.getLong(powerUser.get("_serviceId")));
+                result.put("proxyName", (null == proxyCompany.get("_name")) ? null : DataUtils.getString(proxyCompany.get("_name")));//服务机构名称
+                result.put("proxyAddress", (null == proxyCompany.get("_address")) ? null : DataUtils.getString(proxyCompany.get("_address")));//服务机构地址
+                result.put("proxyPrincipal", (null == proxyCompany.get("_principal")) ? null : DataUtils.getString(proxyCompany.get("_principal")));//服务机构负责人
+                result.put("proxyTel", (null == proxyCompany.get("_tel")) ? null : DataUtils.getString(proxyCompany.get("_tel")));//服务机构联系电话
+                if (null != proxyCompany.get("_tg")) {
+                    int tg = DataUtils.getInteger(proxyCompany.get("_tg"));
+                    String tgName = null;
+                    if (tg == 0) tgName = "服务商/代理";
+                    else if (tg == 1) tgName = "总部";
+                    else if (tg == 2) tgName = "服务公司";
+                    result.put("proxyTg", tgName);//服务机构类型
+                }
+            }
+            //企业联系人列表
+            List<PowerUserContact> contactList = powerUserContactDao.queryListByCompanyId(DataUtils.getLong(powerUser.get("_powerUserId")));
+            result.put("powerContact", JSONObject.toJSONString(contactList));
 
-			resultMsg = new ResultMsg<JSONObject>(SystemConstant.RESULT_STATUS_SUCCESS, result);
-		} catch (Exception e) {
-			resultMsg = new ResultMsg<JSONObject>(SystemConstant.RESULT_STATUS_ERROR);
-		}
+            resultMsg = new ResultMsg<JSONObject>(SystemConstant.RESULT_STATUS_SUCCESS, result);
+        } catch (Exception e) {
+            resultMsg = new ResultMsg<JSONObject>(SystemConstant.RESULT_STATUS_ERROR);
+        }
 
-		return resultMsg;
-	}
+        return resultMsg;
+    }
 }

+ 273 - 257
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/service/impl/ExplorerService.java

@@ -1,274 +1,290 @@
 package cn.vbdsm.manage.service.impl;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.core.common.Page;
-import javax.core.common.ResultMsg;
-import javax.core.common.utils.DataUtils;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 import cn.vbdsm.common.config.I18nConfig;
 import cn.vbdsm.common.constants.SystemConstant;
 import cn.vbdsm.manage.dao.WarnAlarmParamsDao;
 import cn.vbdsm.manage.model.AlarmParam;
 import cn.vbdsm.manage.mvc.vo.ExplorerMenuVo;
 import cn.vbdsm.manage.mvc.vo.TreeMenuNewVo;
-import cn.vbdsm.manage.service.IApplyCategoryService;
-import cn.vbdsm.manage.service.IApplyService;
-import cn.vbdsm.manage.service.IDesktopService;
-import cn.vbdsm.manage.service.IExplorerService;
-import cn.vbdsm.manage.service.ITreemenuService;
+import cn.vbdsm.manage.service.*;
 import cn.vbdsm.model.Apply;
 import cn.vbdsm.model.ApplyCategory;
 import cn.vbdsm.model.TreeMenu;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import javax.core.common.Page;
+import javax.core.common.ResultMsg;
+import javax.core.common.utils.DataUtils;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Service
 public class ExplorerService implements IExplorerService {
-	@Autowired IApplyCategoryService applyCategoryService;
-	@Autowired IDesktopService desktopService;
-	@Autowired IApplyService applyService;
-	@Autowired ITreemenuService treemenuService;
-	@Autowired WarnAlarmParamsDao warnAlarmParamsDao;
+    @Autowired
+    IApplyCategoryService applyCategoryService;
+    @Autowired
+    IDesktopService desktopService;
+    @Autowired
+    IApplyService applyService;
+    @Autowired
+    ITreemenuService treemenuService;
+    @Autowired
+    WarnAlarmParamsDao warnAlarmParamsDao;
+
+    @Override
+    public ResultMsg<?> getMyApplies(String local, int isRoot, List<Long> roleIds, Integer siteId, TreeMenu condition, Long cid, Long uid) {
+        //菜单集合
+        List<ExplorerMenuVo> list = new ArrayList<ExplorerMenuVo>();
+
+        //获取全部分类
+        ResultMsg<?> applyCategoryResult = applyCategoryService.getAll(local);
+        //获取应用
+        ResultMsg<?> applyResult = applyService.getAll(local, isRoot, roleIds, siteId);
+
+        //获取菜单
+        ResultMsg<Page<TreeMenu>> treemenuResult = treemenuService.getAll(local, condition, cid, uid);
+
+        //Set<String> relationMenus = new HashSet<String>();
+
+        Page<ApplyCategory> applyCategoryPage = (Page<ApplyCategory>) applyCategoryResult.getData();
+        Page<Apply> applyPage = (Page<Apply>) applyResult.getData();
+        for (ApplyCategory applyCategory : applyCategoryPage.getRows()) {
+            List<ExplorerMenuVo> applies = new ArrayList<ExplorerMenuVo>();
+            for (Apply apply : applyPage.getRows()) {
+                if (!applyCategory.getId().equals(apply.getCategoryId())) {
+                    continue;
+                }
+                //System.out.println(JSONObject.toJSONString(apply));
+                //JSONObject attr = new JSONObject();
+                ExplorerMenuVo applyVo = new ExplorerMenuVo();
+                applyVo.setId(apply.getId());
+                applyVo.setText(apply.getTitle());
+                String icon = apply.getIcon();
+                String[] iconArr = icon.split("@");
+
+                applyVo.setIconCls(iconArr[0]);
+                //attr.put("icon", apply.getIcon());
+                //applyVo.setAttributes(attr);
+                String content = apply.getContent();
+                content = content.substring(1, content.length() - 1);
+                String[] menuIds = content.split(",");
+                List<ExplorerMenuVo> treeMenus = new ArrayList<ExplorerMenuVo>();
+                for (String s : menuIds) {
+                    if (s.equals("0") || s.equals("null")) {
+                        continue;
+                    }
+                    for (TreeMenu treeMenu : treemenuResult.getData().getRows()) {
+                        if (!DataUtils.getLong(s).equals(treeMenu.getId())) {
+                            continue;
+                        }
+                        ExplorerMenuVo treeMenuVo = new ExplorerMenuVo();
+                        treeMenuVo.setId(treeMenu.getId());
+                        treeMenuVo.setText(treeMenu.getName());
+                        Map attributes = new HashMap();
+                        attributes.put("appId", apply.getId());
+                        attributes.put("menuId", treeMenu.getId());
+                        attributes.put("url", treeMenu.getUrl());
+                        attributes.put("platform", treeMenu.getPlatform());
+                        treeMenuVo.setAttributes(attributes);
+                        treeMenus.add(treeMenuVo);
+                    }
+                }
+                if (treeMenus.size() > 1) {
+                    applyVo.setChildren(treeMenus);
+                } else {
+                    //((Map)treeMenus.get(0).getAttributes()).remove("url");
+                    ((Map) treeMenus.get(0).getAttributes()).put("icon", apply.getIcon());
+                    applyVo.setAttributes(treeMenus.get(0).getAttributes());
+                }
+                applies.add(applyVo);
+            }
+            if (applies.size() > 0) {
+                ExplorerMenuVo applyCategoryVo = new ExplorerMenuVo();
+                applyCategoryVo.setId(applyCategory.getId());
+                applyCategoryVo.setText(applyCategory.getTitle());
+                applyCategoryVo.setIconCls("");
+                applyCategoryVo.setChildren(applies);
+                list.add(applyCategoryVo);
+            }
+        }
+        return new ResultMsg<List<ExplorerMenuVo>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), list);
+    }
+
+    @Override
+    public ResultMsg<?> getMyTreeApplies(String local, int isRoot, List<Long> roleIds, Integer siteId,
+                                         TreeMenu condition, Long cid, Long uid, String userType, String authCid) {
+        //菜单集合
+        List<TreeMenuNewVo> list = new ArrayList<TreeMenuNewVo>();
+        //大屏展示菜单集合
+        List<TreeMenuNewVo> bigScreen = new ArrayList<TreeMenuNewVo>();
 
-	@Override
-	public ResultMsg<?> getMyApplies(String local,int isRoot,List<Long> roleIds,Integer siteId,TreeMenu condition,Long cid,Long uid) {
-		//菜单集合
-		List<ExplorerMenuVo> list = new ArrayList<ExplorerMenuVo>();
+        //获取全部分类
+        ResultMsg<?> applyCategoryResult = applyCategoryService.getAll(local);
+        //获取应用
+        ResultMsg<?> applyResult = applyService.getAll(local, isRoot, roleIds, siteId);
+        //获取菜单
+        ResultMsg<Page<TreeMenu>> treemenuResult = treemenuService.getAll(local, condition, cid, uid);
 
-		//获取全部分类
-		ResultMsg<?> applyCategoryResult = applyCategoryService.getAll(local);
-		//获取应用
-		ResultMsg<?> applyResult = applyService.getAll(local, isRoot, roleIds, siteId);
+        Page<ApplyCategory> applyCategoryPage = (Page<ApplyCategory>) applyCategoryResult.getData();
+        Page<Apply> applyPage = (Page<Apply>) applyResult.getData();
+        //
+        Map<String, Map<String, Object>> big = new HashMap<String, Map<String, Object>>();
+        AlarmParam alarmParam = warnAlarmParamsDao.selectOne();
+        Long roleId = roleIds.get(0);
+        for (ApplyCategory applyCategory : applyCategoryPage.getRows()) {
+            List<TreeMenuNewVo> applies = new ArrayList<TreeMenuNewVo>();
 
-		//获取菜单
-		ResultMsg<Page<TreeMenu>> treemenuResult = treemenuService.getAll(local, condition, cid, uid);
+            for (Apply apply : applyPage.getRows()) {
+                if (!applyCategory.getId().equals(apply.getCategoryId())) {
+                    continue;
+                }
+                TreeMenuNewVo applyVo = new TreeMenuNewVo();
+                applyVo.setId(apply.getId());
+                applyVo.setText(apply.getTitle());
 
-		//Set<String> relationMenus = new HashSet<String>();
+                String content = apply.getContent();
+                content = content.substring(1, content.length() - 1);
+                String[] menuIds = content.split(",");
+                //menuIds大于1的时候,不需要图标,二级菜单为sub-icon
+                // 修改icon
+                String icon = apply.getIcon();
+                String[] iconArr = icon.split("@");
+                applyVo.setIcon(iconArr[0]);
+                //}
+                List<TreeMenuNewVo> treeMenus = new ArrayList<TreeMenuNewVo>();
+                for (String s : menuIds) {
+                    if (s.equals("0") || s.equals("null")) {
+                        continue;
+                    }
+                    for (TreeMenu treeMenu : treemenuResult.getData().getRows()) {
+                        if (!DataUtils.getLong(s).equals(treeMenu.getId())) {
+                            continue;
+                        }
+                        //平台中心进去统一用电概况
+                        if (authCid != null && !"".equals(authCid)) {
+                            //if (apply.getId() == 142) {
+                            if (apply.getId() == 73) {
+                                Map<String, Object> map = new HashMap<String, Object>();
+                                map.put("url", treeMenu.getUrl());
+                                map.put("appId", apply.getId());
+                                map.put("menuId", treeMenu.getId());
+                                map.put("platform", treeMenu.getPlatform());
+                                map.put("text", apply.getTitle());
+                                big.put("index", map);
+                            }
+                        } else {
+                            //政府监管
+                            //if (roleId == 33 || roleId == 45) {
+                            if (roleId == 7 || roleId == 8) {
+                                //大屏显示
+                                //if (applyCategory.getId() == 36) {
+                                if (applyCategory.getId() == 14) {
+                                    if ("01080006".equals(userType)) {
+                                        Map<String, Object> map = new HashMap<String, Object>();
+                                        map.put("url", treeMenu.getUrl());
+                                        map.put("appId", apply.getId());
+                                        map.put("menuId", treeMenu.getId());
+                                        map.put("platform", treeMenu.getPlatform());
+                                        map.put("text", apply.getTitle());
+                                        map.put("dispalyNum", alarmParam.getDispalyNum());
+                                        map.put("delay", alarmParam.getBroadcastTime());
+                                        big.put(apply.getIcon(), map);
+                                    }
+                                    //} else if (applyCategory.getId() == 32) {
+                                    //数据中心
+                                } else if (applyCategory.getId() == 11) {
+                                    //运行
+                                    //if (apply.getId() == 143 && !"01080006".equals(userType) && s.equals("1536")) {
+                                    if (apply.getId() == 74 && !"01080006".equals(userType) && s.equals("51")) {
+                                        Map<String, Object> map = new HashMap<String, Object>();
+                                        map.put("url", treeMenu.getUrl());
+                                        map.put("appId", apply.getId());
+                                        map.put("menuId", treeMenu.getId());
+                                        map.put("platform", treeMenu.getPlatform());
+                                        map.put("text", treeMenu.getName());
+                                        big.put("index", map);
+                                    }
+                                }
+                                // } else if (roleId == 35 || roleId == 36 || roleId == 43 || roleId == 44) {
+                                //电能管理师 及 园区监管
+                            } else if (roleId == 2 || roleId == 3 || roleId == 4 || roleId == 9) {
+                                //电能服务
+                                //if (apply.getId() == 94) {
+                                if (apply.getId() == 42) {
+                                    Map<String, Object> map = new HashMap<String, Object>();
+                                    map.put("url", treeMenu.getUrl());
+                                    map.put("appId", apply.getId());
+                                    map.put("menuId", treeMenu.getId());
+                                    map.put("platform", treeMenu.getPlatform());
+                                    map.put("text", apply.getTitle());
+                                    big.put("index", map);
+                                }
+                            } else if (roleId == 1) {
+                                //if (apply.getId() == 143 && s.equals("1536")) {
+                                if (apply.getId() == 74 && s.equals("51")) {
+                                    Map<String, Object> map = new HashMap<String, Object>();
+                                    map.put("url", treeMenu.getUrl());
+                                    map.put("appId", apply.getId());
+                                    map.put("menuId", treeMenu.getId());
+                                    map.put("platform", treeMenu.getPlatform());
+                                    map.put("text", apply.getTitle());
+                                    big.put("index", map);
+                                }
+                            } else {
+                                //默认用电概况
+                                //if (apply.getId() == 142) {
+                                if (apply.getId() == 73) {
+                                    Map<String, Object> map = new HashMap<String, Object>();
+                                    map.put("url", treeMenu.getUrl());
+                                    map.put("appId", apply.getId());
+                                    map.put("menuId", treeMenu.getId());
+                                    map.put("platform", treeMenu.getPlatform());
+                                    map.put("text", apply.getTitle());
+                                    big.put("index", map);
+                                }
+                            }
 
-		Page<ApplyCategory> applyCategoryPage = (Page<ApplyCategory>)applyCategoryResult.getData();
-		Page<Apply> applyPage = (Page<Apply>)applyResult.getData();
-		for(ApplyCategory applyCategory:applyCategoryPage.getRows()){
-			List<ExplorerMenuVo> applies = new ArrayList<ExplorerMenuVo>();
-			for(Apply apply:applyPage.getRows()){
-				if(!applyCategory.getId().equals(apply.getCategoryId())){
-					continue;
-				}
-				//System.out.println(JSONObject.toJSONString(apply));
-				//JSONObject attr = new JSONObject();
-				ExplorerMenuVo applyVo = new ExplorerMenuVo();
-				applyVo.setId(apply.getId());
-				applyVo.setText(apply.getTitle());
-				applyVo.setIconCls(apply.getIcon());
-				//attr.put("icon", apply.getIcon());
-				//applyVo.setAttributes(attr);
-				String content = apply.getContent();
-				content = content.substring(1, content.length()-1);
-				String []menuIds = content.split(",");
-				List<ExplorerMenuVo> treeMenus = new ArrayList<ExplorerMenuVo>();
-				for (String s : menuIds) {
-					if(s.equals("0") || s.equals("null")){
-						continue;
-					}
-					for(TreeMenu treeMenu:treemenuResult.getData().getRows()){
-						if(!DataUtils.getLong(s).equals(treeMenu.getId())){
-							continue;
-						}
-						ExplorerMenuVo treeMenuVo = new ExplorerMenuVo();
-						treeMenuVo.setId(treeMenu.getId());
-						treeMenuVo.setText(treeMenu.getName());
-						Map attributes = new HashMap();
-						attributes.put("appId", apply.getId());
-						attributes.put("menuId", treeMenu.getId());
-						attributes.put("url", treeMenu.getUrl());
-						attributes.put("platform", treeMenu.getPlatform());
-						treeMenuVo.setAttributes(attributes);
-						treeMenus.add(treeMenuVo);
-					}
-				}
-				if(treeMenus.size() > 1){
-					applyVo.setChildren(treeMenus);
-				}else{
-					//((Map)treeMenus.get(0).getAttributes()).remove("url");
-					((Map)treeMenus.get(0).getAttributes()).put("icon", apply.getIcon());
-					applyVo.setAttributes(treeMenus.get(0).getAttributes());
-				}
-				applies.add(applyVo);
-			}
-			if(applies.size() > 0){
-				ExplorerMenuVo applyCategoryVo = new ExplorerMenuVo();
-				applyCategoryVo.setId(applyCategory.getId());
-				applyCategoryVo.setText(applyCategory.getTitle());
-				applyCategoryVo.setIconCls("");
-				applyCategoryVo.setChildren(applies);
-				list.add(applyCategoryVo);
-			}
-		}
-		return new ResultMsg<List<ExplorerMenuVo>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","get_success"), list);
-	}
+                        }
 
-	@Override
-	public ResultMsg<?> getMyTreeApplies(String local, int isRoot, List<Long> roleIds, Integer siteId,
-			TreeMenu condition, Long cid, Long uid,String userType,String authCid) {
-		//菜单集合
-		List<TreeMenuNewVo> list = new ArrayList<TreeMenuNewVo>();
-		//大屏展示菜单集合
-		List<TreeMenuNewVo> bigScreen = new ArrayList<TreeMenuNewVo>();
-		
-		//获取全部分类
-		ResultMsg<?> applyCategoryResult = applyCategoryService.getAll(local);
-		//获取应用
-		ResultMsg<?> applyResult = applyService.getAll(local, isRoot, roleIds, siteId);
-		//获取菜单
-		ResultMsg<Page<TreeMenu>> treemenuResult = treemenuService.getAll(local, condition, cid, uid);
 
-		Page<ApplyCategory> applyCategoryPage = (Page<ApplyCategory>)applyCategoryResult.getData();
-		Page<Apply> applyPage = (Page<Apply>)applyResult.getData();
-		//
-		Map<String, Map<String,Object>> big = new HashMap<String, Map<String,Object>>();
-		AlarmParam alarmParam = warnAlarmParamsDao.selectOne();
-		Long roleId = roleIds.get(0);
-		for(ApplyCategory applyCategory:applyCategoryPage.getRows()){
-			List<TreeMenuNewVo> applies = new ArrayList<TreeMenuNewVo>();
-			
-			for(Apply apply:applyPage.getRows()){
-				if(!applyCategory.getId().equals(apply.getCategoryId())){
-					continue;
-				}
-				TreeMenuNewVo applyVo = new TreeMenuNewVo();
-				applyVo.setId(apply.getId());
-				applyVo.setText(apply.getTitle());
-			
-				String content = apply.getContent();
-				content = content.substring(1, content.length()-1);
-				String []menuIds = content.split(",");
-				//menuIds大于1的时候,不需要图标,二级菜单为sub-icon
-				//重新修改为自由2级菜单有数据
-				applyVo.setIcon(apply.getIcon());
-				//}
-				List<TreeMenuNewVo> treeMenus = new ArrayList<TreeMenuNewVo>();
-				for (String s : menuIds) {
-					if(s.equals("0") || s.equals("null")){
-						continue;
-					}
-					for(TreeMenu treeMenu:treemenuResult.getData().getRows()){
-						if(!DataUtils.getLong(s).equals(treeMenu.getId())){
-							continue;
-						}
-						//平台中心进去统一用电概况
-						if(authCid!=null&&!"".equals(authCid)) {
-							if(apply.getId()==142) {
-								Map<String,Object> map = new HashMap<String, Object>();
-								map.put("url", treeMenu.getUrl());
-								map.put("appId", apply.getId());
-								map.put("menuId", treeMenu.getId());
-								map.put("platform", treeMenu.getPlatform());
-								map.put("text", apply.getTitle());
-								big.put("index", map);
-							}
-						}else {
-							//数据中心
-							if(roleId ==33||roleId ==45) {
-								if(applyCategory.getId() ==36) {
-									if("01080006".equals(userType)) {
-										Map<String,Object> map = new HashMap<String, Object>();
-										map.put("url", treeMenu.getUrl());
-										map.put("appId", apply.getId());
-										map.put("menuId", treeMenu.getId());
-										map.put("platform", treeMenu.getPlatform());
-										map.put("text", apply.getTitle());
-										map.put("dispalyNum", alarmParam.getDispalyNum());
-										map.put("delay", alarmParam.getBroadcastTime());
-										big.put(apply.getIcon(), map);
-									}
-								}else if(applyCategory.getId()==32){
-									//运行
-									if(apply.getId() ==143 &&!"01080006".equals(userType)&&s.equals("1536")) {
-										Map<String,Object> map = new HashMap<String, Object>();
-										map.put("url", treeMenu.getUrl());
-										map.put("appId", apply.getId());
-										map.put("menuId", treeMenu.getId());
-										map.put("platform", treeMenu.getPlatform());
-										map.put("text", treeMenu.getName());
-										big.put("index", map);
-									}
-								}
-							}else if(roleId ==35||roleId==36||roleId ==43||roleId ==44) {
-								//电能服务
-								if(apply.getId()==94) {
-									Map<String,Object> map = new HashMap<String, Object>();
-									map.put("url", treeMenu.getUrl());
-									map.put("appId", apply.getId());
-									map.put("menuId", treeMenu.getId());
-									map.put("platform", treeMenu.getPlatform());
-									map.put("text", apply.getTitle());
-									big.put("index", map);
-								}
-							}else if(roleId==1){
-								if(apply.getId() ==143&&s.equals("1536")) {
-									Map<String,Object> map = new HashMap<String, Object>();
-									map.put("url", treeMenu.getUrl());
-									map.put("appId", apply.getId());
-									map.put("menuId", treeMenu.getId());
-									map.put("platform", treeMenu.getPlatform());
-									map.put("text", apply.getTitle());
-									big.put("index", map);
-								}
-							}else {
-								//默认用电概况
-								if(apply.getId()==142) {
-									Map<String,Object> map = new HashMap<String, Object>();
-									map.put("url", treeMenu.getUrl());
-									map.put("appId", apply.getId());
-									map.put("menuId", treeMenu.getId());
-									map.put("platform", treeMenu.getPlatform());
-									map.put("text", apply.getTitle());
-									big.put("index", map);
-								}
-							}
-							
-						}
-						
-						
-						TreeMenuNewVo treeMenuVo = new TreeMenuNewVo();
-						treeMenuVo.setId(treeMenu.getId());
-						treeMenuVo.setText(treeMenu.getName());
-						if(treeMenu.getUrl() != null || !"".equals(treeMenu.getUrl())) {
-							treeMenuVo.setHref("flag");
-						}
-						Map attributes = new HashMap();
-						attributes.put("appId", apply.getId());
-						attributes.put("menuId", treeMenu.getId());
-						attributes.put("url", treeMenu.getUrl());
-						attributes.put("platform", treeMenu.getPlatform());
-						treeMenuVo.setAttributes(attributes);
-						treeMenuVo.setIcon("sub-icon");
-						treeMenus.add(treeMenuVo);
-					}
-				}
-				if(treeMenus.size() > 1){
-					applyVo.setNodes(treeMenus);
-				}else{
-					//((Map)treeMenus.get(0).getAttributes()).put("icon", "sub-icon");
-					applyVo.setAttributes(treeMenus.get(0).getAttributes());
-				}
-				applies.add(applyVo);
-			}
-			if(applies.size() > 0){
-				TreeMenuNewVo treeMenuNewVo = new TreeMenuNewVo();
-				if(applyCategory.getId() !=36) {
-					treeMenuNewVo.setId(applyCategory.getId());
-					treeMenuNewVo.setText(applyCategory.getTitle());
-					treeMenuNewVo.setIcon(applyCategory.getIcon());
-					treeMenuNewVo.setNodes(applies);
-					list.add(treeMenuNewVo);
-				}
-			}
-		}
+                        TreeMenuNewVo treeMenuVo = new TreeMenuNewVo();
+                        treeMenuVo.setId(treeMenu.getId());
+                        treeMenuVo.setText(treeMenu.getName());
+                        if (treeMenu.getUrl() != null || !"".equals(treeMenu.getUrl())) {
+                            treeMenuVo.setHref("flag");
+                        }
+                        Map attributes = new HashMap();
+                        attributes.put("appId", apply.getId());
+                        attributes.put("menuId", treeMenu.getId());
+                        attributes.put("url", treeMenu.getUrl());
+                        attributes.put("platform", treeMenu.getPlatform());
+                        treeMenuVo.setAttributes(attributes);
+                        treeMenuVo.setIcon("sub-icon");
+                        treeMenus.add(treeMenuVo);
+                    }
+                }
+                if (treeMenus.size() > 1) {
+                    applyVo.setNodes(treeMenus);
+                } else {
+                    //((Map)treeMenus.get(0).getAttributes()).put("icon", "sub-icon");
+                    applyVo.setAttributes(treeMenus.get(0).getAttributes());
+                }
+                applies.add(applyVo);
+            }
+            if (applies.size() > 0) {
+                TreeMenuNewVo treeMenuNewVo = new TreeMenuNewVo();
+                if (applyCategory.getId() != 36) {
+                    treeMenuNewVo.setId(applyCategory.getId());
+                    treeMenuNewVo.setText(applyCategory.getTitle());
+                    treeMenuNewVo.setIcon(applyCategory.getIcon());
+                    treeMenuNewVo.setNodes(applies);
+                    list.add(treeMenuNewVo);
+                }
+            }
+        }
 //		TreeMenuNewVo bigScreenMenuNewVo = new TreeMenuNewVo();
 //		for (TreeMenuNewVo treeMenuNewVo : list) {
 //			if(treeMenuNewVo.getId()==36) {
@@ -285,15 +301,15 @@ public class ExplorerService implements IExplorerService {
 //		if(bigScreenMenuNewVo.getId()!=null) {
 //			list.add(bigScreenMenuNewVo);
 //		}
-		Map map = new HashMap<String, Object>();
-		map.put("list", list);
+        Map map = new HashMap<String, Object>();
+        map.put("list", list);
 //		if(bigScreen.size()>0) {
 //			map.put("bigScreen", bigScreen);
 //		}
-		if(!big.isEmpty()) {
-			map.put("bigScreen", big);
-		}
-		return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","get_success"), map);
-	}
+        if (!big.isEmpty()) {
+            map.put("bigScreen", big);
+        }
+        return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), map);
+    }
 
 }