Parcourir la source

Fix修复客户管理服务商角色账号登录的数据未过滤

Yue il y a 2 ans
Parent
commit
c970085d4b

+ 197 - 182
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/dao/OrgDao.java

@@ -1,197 +1,212 @@
 package cn.vbdsm.manage.dao;
 package cn.vbdsm.manage.dao;
 
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import cn.vbdsm.model.Org;
+import org.springframework.stereotype.Repository;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import javax.core.common.Page;
 import javax.core.common.Page;
 import javax.core.common.jdbc.BaseDaoSupport;
 import javax.core.common.jdbc.BaseDaoSupport;
 import javax.core.common.jdbc.QueryRule;
 import javax.core.common.jdbc.QueryRule;
 import javax.sql.DataSource;
 import javax.sql.DataSource;
-
-import org.springframework.stereotype.Repository;
-
-import cn.vbdsm.model.Org;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
 /**
  * 访问结构表数据
  * 访问结构表数据
- * @author liuzhixiong
  *
  *
+ * @author liuzhixiong
  */
  */
 @Repository
 @Repository
-public class OrgDao extends BaseDaoSupport<Org, Long>  {
-
-	@Override
-	protected String getPKColumn() {return "id";}
-	
-	@Resource(name="dynamicDataSource")
-	public void setDataSource(DataSource dataSource){
-		super.setDataSourceReadOnly(dataSource);
-		super.setDataSourceWrite(dataSource);
-	}
-	
-	/**
-	 * 查询所有机构
-	 * @return
-	 */
-	public List<Org> selectAll() {
-		QueryRule queryRule = QueryRule.getInstance();
-		queryRule.andEqual("isDel", 0);
-		return super.find(queryRule);
-	}
-	
-	/**
-	 * 查询所有机构的id,name
-	 * @return
-	 */
-	public Map<Long, String> selectOrgIdName(){
-		String sql = "SELECT id,name FROM t_org WHERE orgType=2 AND isDel=0";
-		List<Map<String, Object>> list = super.findBySql(sql, new Object[]{});
-		Map<Long, String> idNameMap = new HashMap<Long, String>();
-		for(Map<String, Object> map : list){
-			long id = Long.parseLong(map.get("id").toString());
-			String name = map.get("name").toString();
-			
-			idNameMap.put(id, name);
-		}
-		return idNameMap;
-	}
-	
-	/**
-	 * 按站点查询机构的id,name
-	 * @return
-	 */
-	public Map<Long, String> selectOrgBySite(int fromSite){
-		String sql = "SELECT org.id,org.name FROM t_org AS org, t_org_site AS site WHERE org.id=site.orgId AND org.orgType=2 AND org.isDel=0 AND site.siteId = ?";
-		List<Map<String, Object>> list = super.findBySql(sql, new Object[]{fromSite});
-		Map<Long, String> idNameMap = new HashMap<Long, String>();
-		for(Map<String, Object> map : list){
-			long id = Long.parseLong(map.get("id").toString());
-			String name = map.get("name").toString();
-			
-			idNameMap.put(id, name);
-		}
-		return idNameMap;
-	}
-	
-	/**
-	 * 查询机构分页数据
-	 * @param pageNo	页码
-	 * @param pageSize	每页条数
-	 * @return
-	 */
-	public Page<Org> selectAllForPage(int pageNo, int pageSize, int orgType){
-		QueryRule queryRule = QueryRule.getInstance();
-		queryRule.andEqual("orgType", orgType);
-		queryRule.andEqual("isDel", 0);
-		queryRule.addAscOrder("id");
-		long count = super.getCount(queryRule);
-		if (count == 0) {
-			return new Page<Org>();
-		}
-		return super.find(queryRule, pageNo, pageSize);
-	}
-
-	
-	
-	public Page<Org> selectListByFromSite(int pageNo, int pageSize, int orgType, int fromSite){
-		if(pageNo <= 1) pageNo = 0;
-		if(pageNo > 1) pageNo = pageNo - 1;
-		List<Object> conditionList = new ArrayList<Object>();
-		String sql = "SELECT org.* FROM t_org AS org,t_org_site AS site WHERE org.id=site.orgId AND org.isDel=0 AND org.orgType=? AND site.siteId = ?";
-		conditionList.add(orgType);
-		conditionList.add(fromSite);
-		String countSql = "SELECT count(*) " + removeSelect(removeOrders(sql.toString()));
-		long count = this.jdbcTemplateReadOnly().queryForLong(countSql, conditionList.toArray());
-		if(count == 0){
-			return new Page<Org>();
-		}
-		sql += " limit ?,?";
-		conditionList.add(pageNo * pageSize);
-		conditionList.add(pageSize);
-		
-		List<Map<String, Object>> dataList = super.findBySql(sql, conditionList);
-		List<Org> orgList = new ArrayList<Org>();
-		for(Map<String, Object> map : dataList){
-			Org org = new Org();
-			org.setId(Long.parseLong(map.get("id").toString()));
-			org.setName(map.get("name").toString());
-			org.setAddress(map.get("address").toString());
-			
-			orgList.add(org);
-		}
-		Page<Org> page = new Page<Org>(pageNo, count, pageSize, orgList);
-		return page;
-	}
-
-	/**
-	 * 批量修改删除状态
-	 * @param ids
-	 * @param disable
-	 * @return
-	 */
-	public int removeBatch(String[] ids, int state) {
-		int result = 0  ;
-		String sql = "update t_org set isDel = ?  where id = ?";
-		for(String id : ids){
-			super.update(sql, state,id);
-			result++;
-		}
-		return result;
-	}
-
-	/**
-	 * 获取电力企业信息
-	 * @author grxie
-	 * @param companyId
-	 * @return
-	 */
-	public Map<String, Object> getPowerUser(long companyId) {
-		String sql = "SELECT org.name _name,org.serviceId _serviceId,org.address _address,tp.id _powerUserId,tp.expiredDate _expiredDate,tp.rank _rank,"
-				+ "tp.industry1 _industry1,tp.industry2 _industry2,tp.industry3 _industry3,tp.applyLoad _applyLoad,tp.zbsl _zbsl,"
-				+ "tp.voltageClass _voltageClass,tp.jffs _jffs,tp.powerSupply _powerSupply,tp.style _style,tp.jbdj _jbdj,tp.state _state "
-				+ "FROM t_org org,t_poweruser tp WHERE org.id = tp.orgId AND org.id = ? ";
-		return super.findUniqueBySql(sql, companyId);
-	}
-	
-	/**
-	 * 获取服务机构信息
-	 * @author grxie
-	 * @param companyId
-	 * @return
-	 */
-	public Map<String, Object> getProxyCompany(long companyId){
-		String sql = "SELECT org.name _name,org.address _address,tpc.principal _principal,tpc.tel _tel,tpc.tg _tg "
-				+ "FROM t_org org,t_proxy_company tpc WHERE org.id = tpc.orgId AND org.id = ?";
-		return super.findUniqueBySql(sql, companyId);
-	}
-	/**
-	 * 获取所有电厂
-	 * @author grxie
-	 * @param companyId
-	 * @return
-	 */
-	public List<Map<String, Object>> getAllPlant(){
-		String sql = "SELECT org.id value,org.name text FROM t_org org,t_poweruser user WHERE org.id = user.orgId AND user.style = 4";
-		return super.findBySql(sql, new HashMap<String, Object>());
-	}
-	
-	/**
-	 * 获取所有企业
-	 * @author grxie
-	 * @param companyId
-	 * @return
-	 */
-	public List<Map<String, Object>> getAllCompany(){
-		String sql = "SELECT org.id value,org.name text FROM t_org org,t_poweruser user WHERE org.id = user.orgId AND user.style = 1";
-		return super.findBySql(sql, new HashMap<String, Object>());
-	}
-
-	public List<Org> selectByIds(List<Long> orgIds) {
-		QueryRule queryRule = QueryRule.getInstance();
-		queryRule.andIn("id", orgIds);
-		return super.find(queryRule);
-	}
+public class OrgDao extends BaseDaoSupport<Org, Long> {
+
+    @Override
+    protected String getPKColumn() {
+        return "id";
+    }
+
+    @Resource(name = "dynamicDataSource")
+    public void setDataSource(DataSource dataSource) {
+        super.setDataSourceReadOnly(dataSource);
+        super.setDataSourceWrite(dataSource);
+    }
+
+    /**
+     * 查询所有机构
+     *
+     * @return
+     */
+    public List<Org> selectAll() {
+        QueryRule queryRule = QueryRule.getInstance();
+        queryRule.andEqual("isDel", 0);
+        return super.find(queryRule);
+    }
+
+    /**
+     * 查询所有机构的id,name
+     *
+     * @return
+     */
+    public Map<Long, String> selectOrgIdName() {
+        String sql = "SELECT id,name FROM t_org WHERE orgType=2 AND isDel=0";
+        List<Map<String, Object>> list = super.findBySql(sql);
+        Map<Long, String> idNameMap = new HashMap<Long, String>();
+        for (Map<String, Object> map : list) {
+            long id = Long.parseLong(map.get("id").toString());
+            String name = map.get("name").toString();
+
+            idNameMap.put(id, name);
+        }
+        return idNameMap;
+    }
+
+    /**
+     * 按站点查询机构的id,name
+     *
+     * @return
+     */
+    public Map<Long, String> selectOrgBySite(int fromSite, Long cid) {
+        Map<String, Object> pamam = new HashMap<String, Object>();
+        pamam.put("siteId", fromSite);
+        String sql = "SELECT org.id,org.name FROM t_org AS org, t_org_site AS site WHERE org.id=site.orgId AND org.orgType=2 AND org.isDel=0 AND site.siteId = :siteId";
+        if (null != cid) {
+            sql += " AND org.id = :cid";
+            pamam.put("cid", cid);
+        }
+        List<Map<String, Object>> list = super.findBySql(sql, pamam);
+        Map<Long, String> idNameMap = new HashMap<Long, String>();
+        for (Map<String, Object> map : list) {
+            long id = Long.parseLong(map.get("id").toString());
+            String name = map.get("name").toString();
+
+            idNameMap.put(id, name);
+        }
+        return idNameMap;
+    }
+
+    /**
+     * 查询机构分页数据
+     *
+     * @param pageNo   页码
+     * @param pageSize 每页条数
+     * @return
+     */
+    public Page<Org> selectAllForPage(int pageNo, int pageSize, int orgType) {
+        QueryRule queryRule = QueryRule.getInstance();
+        queryRule.andEqual("orgType", orgType);
+        queryRule.andEqual("isDel", 0);
+        queryRule.addAscOrder("id");
+        long count = super.getCount(queryRule);
+        if (count == 0) {
+            return new Page<Org>();
+        }
+        return super.find(queryRule, pageNo, pageSize);
+    }
+
+
+    public Page<Org> selectListByFromSite(int pageNo, int pageSize, int orgType, int fromSite) {
+        if (pageNo <= 1) pageNo = 0;
+        if (pageNo > 1) pageNo = pageNo - 1;
+        List<Object> conditionList = new ArrayList<Object>();
+        String sql = "SELECT org.* FROM t_org AS org,t_org_site AS site WHERE org.id=site.orgId AND org.isDel=0 AND org.orgType=? AND site.siteId = ?";
+        conditionList.add(orgType);
+        conditionList.add(fromSite);
+        String countSql = "SELECT count(*) " + removeSelect(removeOrders(sql));
+        long count = this.jdbcTemplateReadOnly().queryForLong(countSql, conditionList.toArray());
+        if (count == 0) {
+            return new Page<Org>();
+        }
+        sql += " limit ?,?";
+        conditionList.add(pageNo * pageSize);
+        conditionList.add(pageSize);
+
+        List<Map<String, Object>> dataList = super.findBySql(sql, conditionList);
+        List<Org> orgList = new ArrayList<Org>();
+        for (Map<String, Object> map : dataList) {
+            Org org = new Org();
+            org.setId(Long.parseLong(map.get("id").toString()));
+            org.setName(map.get("name").toString());
+            org.setAddress(map.get("address").toString());
+
+            orgList.add(org);
+        }
+        Page<Org> page = new Page<Org>(pageNo, count, pageSize, orgList);
+        return page;
+    }
+
+    /**
+     * 批量修改删除状态
+     *
+     * @param ids
+     * @param disable
+     * @return
+     */
+    public int removeBatch(String[] ids, int state) {
+        int result = 0;
+        String sql = "update t_org set isDel = ?  where id = ?";
+        for (String id : ids) {
+            super.update(sql, state, id);
+            result++;
+        }
+        return result;
+    }
+
+    /**
+     * 获取电力企业信息
+     *
+     * @param companyId
+     * @return
+     * @author grxie
+     */
+    public Map<String, Object> getPowerUser(long companyId) {
+        String sql = "SELECT org.name _name,org.serviceId _serviceId,org.address _address,tp.id _powerUserId,tp.expiredDate _expiredDate,tp.rank _rank,"
+                + "tp.industry1 _industry1,tp.industry2 _industry2,tp.industry3 _industry3,tp.applyLoad _applyLoad,tp.zbsl _zbsl,"
+                + "tp.voltageClass _voltageClass,tp.jffs _jffs,tp.powerSupply _powerSupply,tp.style _style,tp.jbdj _jbdj,tp.state _state "
+                + "FROM t_org org,t_poweruser tp WHERE org.id = tp.orgId AND org.id = ? ";
+        return super.findUniqueBySql(sql, companyId);
+    }
+
+    /**
+     * 获取服务机构信息
+     *
+     * @param companyId
+     * @return
+     * @author grxie
+     */
+    public Map<String, Object> getProxyCompany(long companyId) {
+        String sql = "SELECT org.name _name,org.address _address,tpc.principal _principal,tpc.tel _tel,tpc.tg _tg "
+                + "FROM t_org org,t_proxy_company tpc WHERE org.id = tpc.orgId AND org.id = ?";
+        return super.findUniqueBySql(sql, companyId);
+    }
+
+    /**
+     * 获取所有电厂
+     *
+     * @param companyId
+     * @return
+     * @author grxie
+     */
+    public List<Map<String, Object>> getAllPlant() {
+        String sql = "SELECT org.id value,org.name text FROM t_org org,t_poweruser user WHERE org.id = user.orgId AND user.style = 4";
+        return super.findBySql(sql, new HashMap<String, Object>());
+    }
+
+    /**
+     * 获取所有企业
+     *
+     * @param companyId
+     * @return
+     * @author grxie
+     */
+    public List<Map<String, Object>> getAllCompany() {
+        String sql = "SELECT org.id value,org.name text FROM t_org org,t_poweruser user WHERE org.id = user.orgId AND user.style = 1";
+        return super.findBySql(sql, new HashMap<String, Object>());
+    }
+
+    public List<Org> selectByIds(List<Long> orgIds) {
+        QueryRule queryRule = QueryRule.getInstance();
+        queryRule.andIn("id", orgIds);
+        return super.find(queryRule);
+    }
 }
 }

+ 208 - 192
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/mvc/action/web/CustomAction.java

@@ -1,9 +1,11 @@
 package cn.vbdsm.manage.mvc.action.web;
 package cn.vbdsm.manage.mvc.action.web;
 
 
-import javax.core.common.ResultMsg;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import cn.vbdsm.core.mvc.action.BaseAction;
+import cn.vbdsm.core.service.ILangService;
+import cn.vbdsm.manage.mvc.vo.PowerUserVo;
+import cn.vbdsm.manage.service.IPowerUserService;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.ModelAttribute;
@@ -11,200 +13,214 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.ModelAndView;
 
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import cn.vbdsm.core.mvc.action.BaseAction;
-import cn.vbdsm.core.service.ILangService;
-import cn.vbdsm.manage.mvc.vo.PowerUserVo;
-import cn.vbdsm.manage.service.IPowerUserService;
+import javax.core.common.ResultMsg;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 
 
 /**
 /**
  * 客户管理
  * 客户管理
- * @author Tanpeng
  *
  *
+ * @author Tanpeng
  */
  */
 @Controller
 @Controller
 @RequestMapping("/web/custom")
 @RequestMapping("/web/custom")
 public class CustomAction extends BaseAction {
 public class CustomAction extends BaseAction {
-	//	private final static Logger logger = Logger.getLogger(CategoryAction.class);
-
-	@Autowired private IPowerUserService powerUserService;
-	@Autowired private ILangService langService;
-
-	/**
-	 * 获取全部
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("getAll.json")
-	public ModelAndView getAll(HttpServletRequest request,HttpServletResponse response){
-		String local = super.getLocal(request);
-		ResultMsg<?> result  = powerUserService.getAll(local);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	
-	/**
-	 * 根据id获取信息
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("getOne.json")
-	public ModelAndView getOne(HttpServletRequest request,HttpServletResponse response
-			,@RequestParam(value="id",defaultValue="",required=true) Long id){
-		String local = super.getLocal(request);
-		ResultMsg<?> result  = powerUserService.getOne(local,id);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	/**
-	 * 分页
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("getForPage.json")
-	public ModelAndView getForPage(HttpServletRequest request,HttpServletResponse response,
-			@RequestParam(value="name",defaultValue="",required=false) String name,
-			@RequestParam(value="serviceId",defaultValue="",required=false) Long serviceId,
-			@RequestParam(value="province",defaultValue="",required=false) Integer province,
-			@RequestParam(value="city",defaultValue="",required=false) Integer city,
-			@RequestParam(value="district",defaultValue="",required=false) Integer district,
-			@RequestParam(value="pageNo",defaultValue="1",required=false) int pageNo,
-			@RequestParam(value="pageSize",defaultValue="20",required=false) int pageSize){
-		String local = super.getLocal(request);
-		JSONObject userInfo = super.getUserInfo(request);
-		JSONArray roles = userInfo.getJSONArray("roles");
-		int isRoot =  langService.isRoot(roles);
-		Long siteId=userInfo.getJSONObject("site").getLong("id");
-		ResultMsg<?> result  = powerUserService.getForPage(local,name,serviceId,province,city,district,isRoot,siteId,pageNo,pageSize);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	
-	/**
-	 * 根据园区id分页查询
-	 * @param request
-	 * @param response
-	 * @param parkId  园区id
-	 * @param parkFlag  标记(0:查询parkId不为空  1:查询parkId为空)
-	 * @param pageNo
-	 * @param pageSize
-	 * @return
-	 */
-	@RequestMapping("getListByParkId.json")
-	public ModelAndView getListByParkId(HttpServletRequest request,HttpServletResponse response,
-			@RequestParam(value="parkId",defaultValue="",required=false) Long parkId,
-			@RequestParam(value="parkFlag",defaultValue="",required=false) Long parkFlag,
-			@RequestParam(value="pageNo",defaultValue="1",required=false) int pageNo,
-			@RequestParam(value="pageSize",defaultValue="20",required=false) int pageSize){
-		String local = super.getLocal(request);
-		ResultMsg<?> result  = powerUserService.getListByParkId(local,parkId,parkFlag,pageNo,pageSize);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	/**
-	 * 解除园区关联关系
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("removeParkId.json")
-	public ModelAndView removeParkId(HttpServletRequest request,HttpServletResponse response,
-			@RequestParam(value="id",defaultValue="",required=false) String id){
-		String local = super.getLocal(request);
-		ResultMsg<?> result  = powerUserService.removeParkId(local,id);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	
-	/**
-	 * 添加园区关联关系
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("addParkId.json")
-	public ModelAndView addParkId(HttpServletRequest request,HttpServletResponse response,
-			@RequestParam(value="id",defaultValue="",required=false) String id,
-			@RequestParam(value="parkId",defaultValue="",required=false) Long parkId){
-		String local = super.getLocal(request);
-		ResultMsg<?> result  = powerUserService.addParkId(local,parkId,id);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	/**
-	 * 添加
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("add.json")
-	public ModelAndView add(HttpServletRequest request,HttpServletResponse response,@ModelAttribute PowerUserVo vo){
-		String local = super.getLocal(request);
-		JSONObject userInfo = super.getUserInfo(request);
-		ResultMsg<?> result  = powerUserService.add(local,vo,userInfo);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	
-	/**
-	 * 修改
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("modify.json")
-	public ModelAndView modify(HttpServletRequest request,HttpServletResponse response,@ModelAttribute PowerUserVo vo){
-		String local = super.getLocal(request);
-		ResultMsg<?> result  = powerUserService.modify(local,vo);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	/**
-	 * 伪删
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("remove.json")
-	public ModelAndView remove(HttpServletRequest request,HttpServletResponse response,@RequestParam(value="id",defaultValue="",required=true) String id){
-		String local = super.getLocal(request);
-		ResultMsg<?> result  = powerUserService.remove(local,id);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	
-	/**
-	 * 删除
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("realDel.json")
-	public ModelAndView realDel(HttpServletRequest request,HttpServletResponse response,@RequestParam(value="id",defaultValue="",required=true) Long id){
-		String local = super.getLocal(request);
-		ResultMsg<?> result  = powerUserService.realDel(local,id);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	/**
-	 * 修改用户状态
-	 * @param request
-	 * @param response
-	 * @param id
-	 * @param state
-	 * @return
-	 */
-	@RequestMapping("modifyState.json")
-	public ModelAndView modify(HttpServletRequest request,HttpServletResponse response,
-			@RequestParam(value="id",defaultValue="",required=true) String id,
-			@RequestParam(value="state",defaultValue="",required=true) Integer state){
-		String local = super.getLocal(request);
-		ResultMsg<?> result  = powerUserService.modifySate(local,id,state);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
+    //	private final static Logger logger = Logger.getLogger(CategoryAction.class);
+
+    @Autowired
+    private IPowerUserService powerUserService;
+    @Autowired
+    private ILangService langService;
+
+    /**
+     * 获取全部
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("getAll.json")
+    public ModelAndView getAll(HttpServletRequest request, HttpServletResponse response) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = powerUserService.getAll(local);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+
+    /**
+     * 根据id获取信息
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("getOne.json")
+    public ModelAndView getOne(HttpServletRequest request, HttpServletResponse response
+            , @RequestParam(value = "id", defaultValue = "", required = true) Long id) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = powerUserService.getOne(local, id);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+    /**
+     * 分页
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("getForPage.json")
+    public ModelAndView getForPage(HttpServletRequest request, HttpServletResponse response,
+                                   @RequestParam(value = "name", defaultValue = "", required = false) String name,
+                                   @RequestParam(value = "serviceId", defaultValue = "", required = false) Long serviceId,
+                                   @RequestParam(value = "province", defaultValue = "", required = false) Integer province,
+                                   @RequestParam(value = "city", defaultValue = "", required = false) Integer city,
+                                   @RequestParam(value = "district", defaultValue = "", required = false) Integer district,
+                                   @RequestParam(value = "pageNo", defaultValue = "1", required = false) int pageNo,
+                                   @RequestParam(value = "pageSize", defaultValue = "20", required = false) int pageSize) {
+        String local = super.getLocal(request);
+        JSONObject userInfo = super.getUserInfo(request);
+        JSONArray roles = userInfo.getJSONArray("roles");
+        int isRoot = langService.isRoot(roles);
+        Long siteId = userInfo.getJSONObject("site").getLong("id");
+        if (null == serviceId) {
+            String userType = userInfo.getJSONObject("user").getString("userType");
+            serviceId = userType.equals("01080004") ? userInfo.getJSONObject("company").getLong("id") : null;
+        }
+        ResultMsg<?> result = powerUserService.getForPage(local, name, serviceId, province, city, district, isRoot, siteId, pageNo, pageSize);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+
+    /**
+     * 根据园区id分页查询
+     *
+     * @param request
+     * @param response
+     * @param parkId   园区id
+     * @param parkFlag 标记(0:查询parkId不为空  1:查询parkId为空)
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    @RequestMapping("getListByParkId.json")
+    public ModelAndView getListByParkId(HttpServletRequest request, HttpServletResponse response,
+                                        @RequestParam(value = "parkId", defaultValue = "", required = false) Long parkId,
+                                        @RequestParam(value = "parkFlag", defaultValue = "", required = false) Long parkFlag,
+                                        @RequestParam(value = "pageNo", defaultValue = "1", required = false) int pageNo,
+                                        @RequestParam(value = "pageSize", defaultValue = "20", required = false) int pageSize) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = powerUserService.getListByParkId(local, parkId, parkFlag, pageNo, pageSize);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+    /**
+     * 解除园区关联关系
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("removeParkId.json")
+    public ModelAndView removeParkId(HttpServletRequest request, HttpServletResponse response,
+                                     @RequestParam(value = "id", defaultValue = "", required = false) String id) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = powerUserService.removeParkId(local, id);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+
+    /**
+     * 添加园区关联关系
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("addParkId.json")
+    public ModelAndView addParkId(HttpServletRequest request, HttpServletResponse response,
+                                  @RequestParam(value = "id", defaultValue = "", required = false) String id,
+                                  @RequestParam(value = "parkId", defaultValue = "", required = false) Long parkId) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = powerUserService.addParkId(local, parkId, id);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+    /**
+     * 添加
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("add.json")
+    public ModelAndView add(HttpServletRequest request, HttpServletResponse response, @ModelAttribute PowerUserVo vo) {
+        String local = super.getLocal(request);
+        JSONObject userInfo = super.getUserInfo(request);
+        ResultMsg<?> result = powerUserService.add(local, vo, userInfo);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+
+    /**
+     * 修改
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("modify.json")
+    public ModelAndView modify(HttpServletRequest request, HttpServletResponse response, @ModelAttribute PowerUserVo vo) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = powerUserService.modify(local, vo);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+    /**
+     * 伪删
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("remove.json")
+    public ModelAndView remove(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "id", defaultValue = "", required = true) String id) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = powerUserService.remove(local, id);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+
+    /**
+     * 删除
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("realDel.json")
+    public ModelAndView realDel(HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "id", defaultValue = "", required = true) Long id) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = powerUserService.realDel(local, id);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+    /**
+     * 修改用户状态
+     *
+     * @param request
+     * @param response
+     * @param id
+     * @param state
+     * @return
+     */
+    @RequestMapping("modifyState.json")
+    public ModelAndView modify(HttpServletRequest request, HttpServletResponse response,
+                               @RequestParam(value = "id", defaultValue = "", required = true) String id,
+                               @RequestParam(value = "state", defaultValue = "", required = true) Integer state) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = powerUserService.modifySate(local, id, state);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
 }
 }

+ 163 - 152
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/mvc/action/web/ProxyCompanyAction.java

@@ -1,12 +1,12 @@
 package cn.vbdsm.manage.mvc.action.web;
 package cn.vbdsm.manage.mvc.action.web;
 
 
-import java.util.List;
-
-import javax.core.common.Page;
-import javax.core.common.ResultMsg;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
+import cn.vbdsm.core.mvc.action.BaseAction;
+import cn.vbdsm.core.service.ILangService;
+import cn.vbdsm.manage.mvc.vo.OrgSiteVo;
+import cn.vbdsm.manage.service.IProxyCompanyService;
+import cn.vbdsm.manage.service.ISiteService;
+import cn.vbdsm.manage.vo.ProxyCompanyVo;
+import com.alibaba.fastjson.JSONObject;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.ModelAttribute;
@@ -15,156 +15,167 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.ModelAndView;
 
 
-import com.alibaba.fastjson.JSONObject;
-import cn.vbdsm.core.mvc.action.BaseAction;
-import cn.vbdsm.core.service.ILangService;
-import cn.vbdsm.manage.mvc.vo.OrgSiteVo;
-import cn.vbdsm.manage.service.IProxyCompanyService;
-import cn.vbdsm.manage.service.ISiteService;
-import cn.vbdsm.manage.vo.ProxyCompanyVo;
+import javax.core.common.Page;
+import javax.core.common.ResultMsg;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 
 
 /**
 /**
  * 服务公司管理
  * 服务公司管理
- * @author liuzhixiong
  *
  *
+ * @author liuzhixiong
  */
  */
 @Controller
 @Controller
 @RequestMapping("/web/proxy")
 @RequestMapping("/web/proxy")
-public class ProxyCompanyAction extends BaseAction{
-	
-	@Autowired IProxyCompanyService proxyService;
-	@Autowired ISiteService siteService;
-	@Autowired private ILangService langService;
-	
-	/**
-	 * 查询分页数据
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("getList.json")
-	public ModelAndView getList(HttpServletRequest request, HttpServletResponse response,
-			@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
-			@RequestParam(value = "pageSize", defaultValue = "20") int pageSize){
-		String local = super.getLocal(request);
-		JSONObject userinfo = super.getUserInfo(request);
-		int site = userinfo.getJSONObject("site").getInteger("id");
-		int isRoot = langService.isRoot(userinfo.getJSONArray("roles"));
-		if(pageNo < 1) pageNo = 1;
-		
-		ResultMsg<Page<ProxyCompanyVo>> result = proxyService.getAllForPage(local, isRoot, site, pageNo, pageSize);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result.getData()));
-	}
-	
-	/**
-	 * 查询单个服务公司
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("getOne/{id}.json")
-	public ModelAndView getOne(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") long id){
-		ProxyCompanyVo proxy = proxyService.getOne(id);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(proxy));
-	}
-	
-	/**
-	 * 新增、修改服务公司
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("addOrModify.json")
-	public ModelAndView addOrModify(HttpServletRequest request, HttpServletResponse response, @ModelAttribute ProxyCompanyVo proxyVo){
-		JSONObject userinfo = super.getUserInfo(request);
-		long uid = userinfo.getJSONObject("user").getLong("id");
-		int isRoot = langService.isRoot(userinfo.getJSONArray("roles"));
-		int site = userinfo.getJSONObject("site").getInteger("id");
-		String local = super.getLocal(request);
-		ResultMsg<String> result = proxyService.addOrModify(local, uid, isRoot, site, proxyVo);
-		
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	/**
-	 * 删除服务公司
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("remove/{id}.json")
-	public ModelAndView remove(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") long id){
-		JSONObject userinfo = super.getUserInfo(request);
-		long uid = userinfo.getJSONObject("user").getLong("id");
-		String local = super.getLocal(request);
-		ResultMsg<String> result = proxyService.removeOne(local, uid, id);
-		
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	/**
-	 * 批量删除服务公司
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("removeBatch.json")
-	public ModelAndView removeBatch(HttpServletRequest request, HttpServletResponse response, @RequestParam("ids") String ids){
-		JSONObject userinfo = super.getUserInfo(request);
-		long uid = userinfo.getJSONObject("user").getLong("id");
-		String local = super.getLocal(request);
-		ResultMsg<String> result = proxyService.removeBatch(local, uid, ids);
-		 
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
-	}
-	
-	/**
-	 * 获取服务公司下拉框
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("getComboxDataAll.json")
-	public ModelAndView getComboxDataAll(HttpServletRequest request,HttpServletResponse response){
-		String local = super.getLocal(request);
-		ResultMsg<?> result = proxyService.getComboxDataAll(local);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result.getData()));
-	}
-	
-	/**
-	 * 获取服务公司下拉框
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("getComboxData.json")
-	public ModelAndView getComboxData(HttpServletRequest request,HttpServletResponse response){
-		String local = super.getLocal(request);
-		JSONObject userinfo = super.getUserInfo(request);
-		int site = userinfo.getJSONObject("site").getInteger("id");
-		int isRoot = langService.isRoot(userinfo.getJSONArray("roles"));
-		ResultMsg<?> result = proxyService.getComboxData(local, isRoot, site);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(result.getData()));
-	}
-	
-	/**
-	 * 获取站点
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	@RequestMapping("getSiteData.json")
-	public ModelAndView getSiteData(HttpServletRequest request,HttpServletResponse response,
-			@RequestParam(value="orgId", defaultValue="0") long orgId){
-		String local = super.getLocal(request);
-		JSONObject userinfo = super.getUserInfo(request);
-		long uid = userinfo.getJSONObject("user").getLong("id");
-		long cid = userinfo.getJSONObject("company").getLong("id");
-		int site = userinfo.getJSONObject("site").getInteger("id");
-		int isRoot = langService.isRoot(userinfo.getJSONArray("roles"));
-		
-		List<OrgSiteVo> osVoList = proxyService.getSiteList(local, uid, cid, isRoot, site, orgId);
-		return super.callBackForJsonp(request, response, JSONObject.toJSONString(osVoList));
-	}
-	
+public class ProxyCompanyAction extends BaseAction {
+
+    @Autowired
+    IProxyCompanyService proxyService;
+    @Autowired
+    ISiteService siteService;
+    @Autowired
+    private ILangService langService;
+
+    /**
+     * 查询分页数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("getList.json")
+    public ModelAndView getList(HttpServletRequest request, HttpServletResponse response,
+                                @RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
+                                @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        String local = super.getLocal(request);
+        JSONObject userinfo = super.getUserInfo(request);
+        int site = userinfo.getJSONObject("site").getInteger("id");
+        int isRoot = langService.isRoot(userinfo.getJSONArray("roles"));
+        if (pageNo < 1) pageNo = 1;
+
+        ResultMsg<Page<ProxyCompanyVo>> result = proxyService.getAllForPage(local, isRoot, site, pageNo, pageSize);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result.getData()));
+    }
+
+    /**
+     * 查询单个服务公司
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("getOne/{id}.json")
+    public ModelAndView getOne(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") long id) {
+        ProxyCompanyVo proxy = proxyService.getOne(id);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(proxy));
+    }
+
+    /**
+     * 新增、修改服务公司
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("addOrModify.json")
+    public ModelAndView addOrModify(HttpServletRequest request, HttpServletResponse response, @ModelAttribute ProxyCompanyVo proxyVo) {
+        JSONObject userinfo = super.getUserInfo(request);
+        long uid = userinfo.getJSONObject("user").getLong("id");
+        int isRoot = langService.isRoot(userinfo.getJSONArray("roles"));
+        int site = userinfo.getJSONObject("site").getInteger("id");
+        String local = super.getLocal(request);
+        ResultMsg<String> result = proxyService.addOrModify(local, uid, isRoot, site, proxyVo);
+
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+    /**
+     * 删除服务公司
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("remove/{id}.json")
+    public ModelAndView remove(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") long id) {
+        JSONObject userinfo = super.getUserInfo(request);
+        long uid = userinfo.getJSONObject("user").getLong("id");
+        String local = super.getLocal(request);
+        ResultMsg<String> result = proxyService.removeOne(local, uid, id);
+
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+    /**
+     * 批量删除服务公司
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("removeBatch.json")
+    public ModelAndView removeBatch(HttpServletRequest request, HttpServletResponse response, @RequestParam("ids") String ids) {
+        JSONObject userinfo = super.getUserInfo(request);
+        long uid = userinfo.getJSONObject("user").getLong("id");
+        String local = super.getLocal(request);
+        ResultMsg<String> result = proxyService.removeBatch(local, uid, ids);
+
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result));
+    }
+
+    /**
+     * 获取服务公司下拉框
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("getComboxDataAll.json")
+    public ModelAndView getComboxDataAll(HttpServletRequest request, HttpServletResponse response) {
+        String local = super.getLocal(request);
+        ResultMsg<?> result = proxyService.getComboxDataAll(local);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result.getData()));
+    }
+
+    /**
+     * 获取服务公司下拉框
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("getComboxData.json")
+    public ModelAndView getComboxData(HttpServletRequest request, HttpServletResponse response) {
+        String local = super.getLocal(request);
+        JSONObject userinfo = super.getUserInfo(request);
+        int site = userinfo.getJSONObject("site").getInteger("id");
+        int isRoot = langService.isRoot(userinfo.getJSONArray("roles"));
+        String userType = userinfo.getJSONObject("user").getString("userType");
+        Long cid = userType.equals("01080004") ? userinfo.getJSONObject("company").getLong("id") : null;
+        ResultMsg<?> result = proxyService.getComboxData(local, isRoot, site, cid);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(result.getData()));
+    }
+
+    /**
+     * 获取站点
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping("getSiteData.json")
+    public ModelAndView getSiteData(HttpServletRequest request, HttpServletResponse response,
+                                    @RequestParam(value = "orgId", defaultValue = "0") long orgId) {
+        String local = super.getLocal(request);
+        JSONObject userinfo = super.getUserInfo(request);
+        long uid = userinfo.getJSONObject("user").getLong("id");
+        long cid = userinfo.getJSONObject("company").getLong("id");
+        int site = userinfo.getJSONObject("site").getInteger("id");
+        int isRoot = langService.isRoot(userinfo.getJSONArray("roles"));
+
+        List<OrgSiteVo> osVoList = proxyService.getSiteList(local, uid, cid, isRoot, site, orgId);
+        return super.callBackForJsonp(request, response, JSONObject.toJSONString(osVoList));
+    }
+
 }
 }

+ 91 - 81
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/service/IProxyCompanyService.java

@@ -1,90 +1,100 @@
 package cn.vbdsm.manage.service;
 package cn.vbdsm.manage.service;
 
 
-import java.util.List;
+import cn.vbdsm.manage.mvc.vo.OrgSiteVo;
+import cn.vbdsm.manage.vo.ProxyCompanyVo;
 
 
 import javax.core.common.Page;
 import javax.core.common.Page;
 import javax.core.common.ResultMsg;
 import javax.core.common.ResultMsg;
-
-import cn.vbdsm.manage.mvc.vo.OrgSiteVo;
-import cn.vbdsm.manage.vo.ProxyCompanyVo;
+import java.util.List;
 
 
 public interface IProxyCompanyService {
 public interface IProxyCompanyService {
-	
-	/**
-	 * 分页查询所有代理服务商
-	 * @param local
-	 * @param isRoot 是否超级管理员
-	 * @param fromSite 站点来源
-	 * @param pageNo
-	 * @param pageSize
-	 * @return
-	 */
-	public ResultMsg<Page<ProxyCompanyVo>> getAllForPage(String local, int isRoot, int fromSite, int pageNo, int pageSize);
-	
-	/**
-	 * 查询一个代理服务商
-	 * @param local
-	 * @param uid	登录用户id
-	 * @param pageNo
-	 * @param pageSize
-	 * @return
-	 */
-	public ProxyCompanyVo getOne(long id);
-	
-	/**
-	 * 新增or修改
-	 * @param local
-	 * @param uid 登录用户id
-	 * @param isRoot	是否超级管理员
-	 * @param fromSite	站点来源
-	 * @param proxyVo
-	 * @return
-	 */
-	public ResultMsg<String> addOrModify(String local, long uid, int isRoot, long fromSite, ProxyCompanyVo proxyVo);
-	
-	/**
-	 * 删除一条记录(伪删除)
-	 * @param local
-	 * @param uid
-	 * @param id
-	 * @return
-	 */
-	public ResultMsg<String> removeOne(String local, long uid, long id);
-	
-	/**
-	 * 批量删除(伪删除)
-	 * @param local
-	 * @param uid
-	 * @param id
-	 * @return
-	 */
-	public ResultMsg<String> removeBatch(String local, long uid, String ids);
 
 
-	/**
-	 * 获取全部服务公司的下拉框数据
-	 * @param local
-	 * @param parentId
-	 * @return
-	 */
-	public ResultMsg<?> getComboxDataAll(String local);
-	
-	/**
-	 * 获取服务公司下拉框数据,根据用户角色过滤
-	 * @param local
-	 * @param parentId
-	 * @return
-	 */
-	public ResultMsg<?> getComboxData(String local, int isRoot, int fromSite);
-	
-	/**
-	 * 获取机构数据
-	 * @param local
-	 * @param uid
-	 * @param cid
-	 * @param isRoot
-	 * @param fromSite
-	 * @return
-	 */
-	public List<OrgSiteVo> getSiteList(String local, long uid, long cid, int isRoot, int fromSite, long orgId);
-	
+    /**
+     * 分页查询所有代理服务商
+     *
+     * @param local
+     * @param isRoot   是否超级管理员
+     * @param fromSite 站点来源
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    ResultMsg<Page<ProxyCompanyVo>> getAllForPage(String local, int isRoot, int fromSite, int pageNo, int pageSize);
+
+    /**
+     * 查询一个代理服务商
+     *
+     * @param local
+     * @param uid      登录用户id
+     * @param pageNo
+     * @param pageSize
+     * @return
+     */
+    ProxyCompanyVo getOne(long id);
+
+    /**
+     * 新增or修改
+     *
+     * @param local
+     * @param uid      登录用户id
+     * @param isRoot   是否超级管理员
+     * @param fromSite 站点来源
+     * @param proxyVo
+     * @return
+     */
+    ResultMsg<String> addOrModify(String local, long uid, int isRoot, long fromSite, ProxyCompanyVo proxyVo);
+
+    /**
+     * 删除一条记录(伪删除)
+     *
+     * @param local
+     * @param uid
+     * @param id
+     * @return
+     */
+    ResultMsg<String> removeOne(String local, long uid, long id);
+
+    /**
+     * 批量删除(伪删除)
+     *
+     * @param local
+     * @param uid
+     * @param id
+     * @return
+     */
+    ResultMsg<String> removeBatch(String local, long uid, String ids);
+
+    /**
+     * 获取全部服务公司的下拉框数据
+     *
+     * @param local
+     * @param parentId
+     * @return
+     */
+    ResultMsg<?> getComboxDataAll(String local);
+
+    /**
+     * 获取服务公司下拉框数据,根据用户角色过滤
+     *
+     * @param local
+     * @param parentId
+     * @return
+     */
+    ResultMsg<?> getComboxData(String local, int isRoot, int fromSite, Long cid);
+
+    ResultMsg<?> getComboxData(String local, int isRoot, int fromSite);
+
+    /**
+     * 获取机构数据
+     * 获取机构数据
+     *
+     * @param local
+     * @param uid
+     * @param cid
+     * @param isRoot
+     * @param fromSite
+     * @return
+     */
+    List<OrgSiteVo> getSiteList(String local, long uid, long cid, int isRoot, int fromSite, long orgId);
+
 }
 }

+ 373 - 370
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/service/impl/PowerUserService.java

@@ -1,22 +1,5 @@
 package cn.vbdsm.manage.service.impl;
 package cn.vbdsm.manage.service.impl;
 
 
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import javax.core.common.Page;
-import javax.core.common.ResultMsg;
-import javax.core.common.jdbc.QueryRule;
-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 com.alibaba.fastjson.JSONObject;
 import cn.vbdsm.common.config.I18nConfig;
 import cn.vbdsm.common.config.I18nConfig;
 import cn.vbdsm.common.constants.SystemConstant;
 import cn.vbdsm.common.constants.SystemConstant;
 import cn.vbdsm.manage.dao.OrgDao;
 import cn.vbdsm.manage.dao.OrgDao;
@@ -27,21 +10,41 @@ import cn.vbdsm.manage.mvc.vo.PowerUserVo;
 import cn.vbdsm.manage.service.IPowerUserService;
 import cn.vbdsm.manage.service.IPowerUserService;
 import cn.vbdsm.model.Org;
 import cn.vbdsm.model.Org;
 import cn.vbdsm.model.PowerUser;
 import cn.vbdsm.model.PowerUser;
+import com.alibaba.fastjson.JSONObject;
+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.jdbc.QueryRule;
+import javax.core.common.utils.DataUtils;
+import javax.core.common.utils.StringUtils;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 
 @Service("powerUserService")
 @Service("powerUserService")
 public class PowerUserService implements IPowerUserService {
 public class PowerUserService implements IPowerUserService {
-	@Autowired PowerUserDao powerUserDao;
-	@Autowired ProxyCompanyDao proxyCompanyDao;
-	@Autowired ProxyCompanyService proxyCompanyService;
-	@Autowired OrgDao orgDao;
-	@Autowired OrgSiteDao orgSiteDao;
-	
-	/**
-	 * 获取全部
-	 */
-	public ResultMsg<?> getAll(String local) {
-		Page<PowerUserVo> page = null;
-		try{
+    @Autowired
+    PowerUserDao powerUserDao;
+    @Autowired
+    ProxyCompanyDao proxyCompanyDao;
+    @Autowired
+    ProxyCompanyService proxyCompanyService;
+    @Autowired
+    OrgDao orgDao;
+    @Autowired
+    OrgSiteDao orgSiteDao;
+
+    /**
+     * 获取全部
+     */
+    public ResultMsg<?> getAll(String local) {
+        Page<PowerUserVo> page = null;
+        try {
 			/*List<PowerUser> list = powerUserDao.selectAll();
 			/*List<PowerUser> list = powerUserDao.selectAll();
 			if(CollectionUtils.isEmpty(list) || list.size() < 1){
 			if(CollectionUtils.isEmpty(list) || list.size() < 1){
 				page = new Page<PowerUserVo>();
 				page = new Page<PowerUserVo>();
@@ -62,30 +65,30 @@ public class PowerUserService implements IPowerUserService {
 				puvList.add(vo);
 				puvList.add(vo);
 			}
 			}
 			page = new Page<PowerUserVo>(0, puvList.size(), puvList.size(), puvList);*/
 			page = new Page<PowerUserVo>(0, puvList.size(), puvList.size(), puvList);*/
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
-		}catch(Exception e){
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
-		}
-	}
-	
-	/**
-	 * 根据id获取信息
-	 */
-	public ResultMsg<?> getOne(String local, Long id) {
-		if(null == id){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
-		}
-		PowerUserVo vo = new PowerUserVo();
-		try{
-			//Map<String,Object> obj = powerUserDao.selectByOrgId(orgId);
-			PowerUser powerUser = powerUserDao.get(id);
-			DataUtils.copySimpleObject(powerUser, vo);
-			Org org = orgDao.get(powerUser.getOrgId());
-			DataUtils.copySimpleObject(org, vo);
-			//vo.setOrgId(org.getId());
-			vo.setId(powerUser.getId());
-			//站点
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+    }
+
+    /**
+     * 根据id获取信息
+     */
+    public ResultMsg<?> getOne(String local, Long id) {
+        if (null == id) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+        PowerUserVo vo = new PowerUserVo();
+        try {
+            //Map<String,Object> obj = powerUserDao.selectByOrgId(orgId);
+            PowerUser powerUser = powerUserDao.get(id);
+            DataUtils.copySimpleObject(powerUser, vo);
+            Org org = orgDao.get(powerUser.getOrgId());
+            DataUtils.copySimpleObject(org, vo);
+            //vo.setOrgId(org.getId());
+            vo.setId(powerUser.getId());
+            //站点
 			/*List<Map<String, Object>> sList = orgDao.selectOrgSiteByOrgId(org.getId());
 			/*List<Map<String, Object>> sList = orgDao.selectOrgSiteByOrgId(org.getId());
 			Long [] siteId = new Long[sList.size()];
 			Long [] siteId = new Long[sList.size()];
 			int i = 0;
 			int i = 0;
@@ -94,334 +97,334 @@ public class PowerUserService implements IPowerUserService {
 				i++;
 				i++;
 			}
 			}
 			vo.setSiteId(siteId);*/
 			vo.setSiteId(siteId);*/
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),vo);
-		}catch(Exception e){
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
-		}
-	}
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), vo);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+    }
 
 
-	/**
-	 * 分页查询
-	 */
-	public ResultMsg<?> getForPage(String local, String name, Long serviceId,
-			Integer province,Integer city,Integer district,Integer isRoot,Long fromSite, int pageNo, int pageSize) {
-		Page<PowerUserVo> _page = new Page<PowerUserVo>();
-		try{
-			//查找t_org表
-			Page<Map<String,Object>> page = powerUserDao.selectAllForPage(pageNo, pageSize, name,serviceId,province,city,district,isRoot,fromSite);
-			if(CollectionUtils.isEmpty(page.getRows())){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),_page);
-			}
-			List<PowerUserVo> list = new ArrayList<PowerUserVo>();
-			//获取服务公司
-			ResultMsg<?> result = proxyCompanyService.getComboxData(local, isRoot.intValue(), isRoot.intValue() !=1 ?fromSite.intValue():0);
-			List<Map<String, Object>> mList = (List<Map<String, Object>>)result.getData();
-			for(Map<String,Object> map : page.getRows()){
-				PowerUserVo vo = new PowerUserVo();
-				vo.setId(DataUtils.getLong(map.get("id")));
-				vo.setOrgId(DataUtils.getLong(map.get("orgId")));
-				vo.setName(DataUtils.getString(map.get("name")));
-				vo.setState(DataUtils.getInteger(map.get("state")));
-				vo.setExpiredDate(DataUtils.getString(map.get("expiredDate")));
-				vo.setLoginTimes(DataUtils.getLong(map.get("loginTimes")));
-				vo.setServiceId(DataUtils.getLong(map.get("serviceId")));
-				vo.setAddress(DataUtils.getString(map.get("address")));
-				for(Map<String, Object> m : mList){
-					if(vo.getServiceId().longValue() == DataUtils.getLong(m.get("id")).longValue()){
-						vo.setTitle(DataUtils.getString(m.get("title")));
-						break;
-					}
-				}
-				list.add(vo);
-			}
-			_page.setRows(list);
-			_page.setTotal(page.getTotal());
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),_page);
-		}catch(Exception e){
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
-		}
-	}
+    /**
+     * 分页查询
+     */
+    public ResultMsg<?> getForPage(String local, String name, Long serviceId,
+                                   Integer province, Integer city, Integer district, Integer isRoot, Long fromSite, int pageNo, int pageSize) {
+        Page<PowerUserVo> _page = new Page<PowerUserVo>();
+        try {
+            //查找t_org表
+            Page<Map<String, Object>> page = powerUserDao.selectAllForPage(pageNo, pageSize, name, serviceId, province, city, district, isRoot, fromSite);
+            if (CollectionUtils.isEmpty(page.getRows())) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), _page);
+            }
+            List<PowerUserVo> list = new ArrayList<PowerUserVo>();
+            //获取服务公司
+            ResultMsg<?> result = proxyCompanyService.getComboxData(local, isRoot.intValue(), isRoot.intValue() != 1 ? fromSite.intValue() : 0);
+            List<Map<String, Object>> mList = (List<Map<String, Object>>) result.getData();
+            for (Map<String, Object> map : page.getRows()) {
+                PowerUserVo vo = new PowerUserVo();
+                vo.setId(DataUtils.getLong(map.get("id")));
+                vo.setOrgId(DataUtils.getLong(map.get("orgId")));
+                vo.setName(DataUtils.getString(map.get("name")));
+                vo.setState(DataUtils.getInteger(map.get("state")));
+                vo.setExpiredDate(DataUtils.getString(map.get("expiredDate")));
+                vo.setLoginTimes(DataUtils.getLong(map.get("loginTimes")));
+                vo.setServiceId(DataUtils.getLong(map.get("serviceId")));
+                vo.setAddress(DataUtils.getString(map.get("address")));
+                for (Map<String, Object> m : mList) {
+                    if (vo.getServiceId().longValue() == DataUtils.getLong(m.get("id")).longValue()) {
+                        vo.setTitle(DataUtils.getString(m.get("title")));
+                        break;
+                    }
+                }
+                list.add(vo);
+            }
+            _page.setRows(list);
+            _page.setTotal(page.getTotal());
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), _page);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+    }
 
 
 
 
-	/**
-	 * 伪删(支持批量)
-	 */
-	@Transactional
-	public ResultMsg<?> remove(String local, String id) {
-		if(StringUtils.isEmpty(id)){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
-		}
-		try{
-			String [] ids = null;
-			if(id.indexOf(",") > 0){
-				ids = id.split(",");
-			}else{
-				ids = new String[]{id};
-			}
-			int result = orgDao.removeBatch(ids, SystemConstant.ENABLE);
-			if(result > 0){
-				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"));
-		}
-	}
+    /**
+     * 伪删(支持批量)
+     */
+    @Transactional
+    public ResultMsg<?> remove(String local, String id) {
+        if (StringUtils.isEmpty(id)) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
+        }
+        try {
+            String[] ids = null;
+            if (id.indexOf(",") > 0) {
+                ids = id.split(",");
+            } else {
+                ids = new String[]{id};
+            }
+            int result = orgDao.removeBatch(ids, SystemConstant.ENABLE);
+            if (result > 0) {
+                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"));
+        }
+    }
 
 
-	/**
-	 * 删除
-	 */
-	public ResultMsg<?> realDel(String local, Long id) {
-		try{
-			if(null == id){
-				return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
-			}
-			boolean result = powerUserDao.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"));
-		}
-	}
+    /**
+     * 删除
+     */
+    public ResultMsg<?> realDel(String local, Long id) {
+        try {
+            if (null == id) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
+            }
+            boolean result = powerUserDao.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"));
+        }
+    }
 
 
-	/**
-	 * 修改
-	 */
-	public ResultMsg<?> modify(String local, PowerUserVo vo) {
-		if(StringUtils.isEmpty(vo.getName()) || StringUtils.isEmpty(vo.getAddress()) || StringUtils.isEmpty(vo.getCoordinate())){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
-		}
-		
-		try{
-			PowerUser powerUser = new PowerUser();
-			DataUtils.copySimpleObject(vo, powerUser);
-			if(null == powerUser.getNormalLoad()){
-				powerUser.setNormalLoad(new BigDecimal(0));
-			}
-			if(null == powerUser.getHalfLoadStart()){
-				powerUser.setHalfLoadStart(new BigDecimal(0));
-			}
-			if(null == powerUser.getHalfLoadEnd()){
-				powerUser.setHalfLoadEnd(new BigDecimal(0));
-			}
-			if(null == powerUser.getStopLoad()){
-				powerUser.setStopLoad(new BigDecimal(0));
-			}
-			int result = powerUserDao.update(powerUser);
-			if(result == 0){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
-			}
-			Org org = new Org();
-			DataUtils.copySimpleObject(vo, org);
-			org.setId(vo.getOrgId());
-			org.setOrgType(1);
-			StringBuffer appNo = new StringBuffer();
-			//app授权
-			if(null != vo.getAppNo() && vo.getAppNo().length > 0){
-				 for(int i=0;i<vo.getAppNo().length;i++){
-					 if(i < vo.getAppNo().length - 1){
-						 appNo.append(vo.getAppNo()[i]).append(","); 
-					 }else{
-						 appNo.append(vo.getAppNo()[i]); 
-					 }
-				 }
-			}
-			org.setAppNo(appNo.toString());
-			result = orgDao.update(org);
-			if(result == 0){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
-			}
-			if(null == vo.getSiteId() || vo.getSiteId().length == 0){
-				//删除
-				result = orgSiteDao.deleteOrgSite(org.getId());
-			}else{
-				//修改
-				result = orgSiteDao.updateOrgSite(org.getId(), vo.getSiteId());
-			}
-			if(result == 0){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
-			}
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","modify_success"),vo);
-			
-		}catch(Exception e){
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
-		}
-	}
+    /**
+     * 修改
+     */
+    public ResultMsg<?> modify(String local, PowerUserVo vo) {
+        if (StringUtils.isEmpty(vo.getName()) || StringUtils.isEmpty(vo.getAddress()) || StringUtils.isEmpty(vo.getCoordinate())) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+        }
 
 
-	/**
-	 * 修改状态(支持批量)
-	 */
-	public ResultMsg<?> modifySate(String local, String id, Integer state) {
-		if(StringUtils.isEmpty(id)){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
-		}
-		try{
-			String [] ids = null;
-			if(id.indexOf(",") > 0){
-				ids = id.split(",");
-			}else{
-				ids = new String[]{id};
-			}
-			int result = powerUserDao.modifyStateBatch(ids, state);
-			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"));
-		}
-	}
+        try {
+            PowerUser powerUser = new PowerUser();
+            DataUtils.copySimpleObject(vo, powerUser);
+            if (null == powerUser.getNormalLoad()) {
+                powerUser.setNormalLoad(new BigDecimal(0));
+            }
+            if (null == powerUser.getHalfLoadStart()) {
+                powerUser.setHalfLoadStart(new BigDecimal(0));
+            }
+            if (null == powerUser.getHalfLoadEnd()) {
+                powerUser.setHalfLoadEnd(new BigDecimal(0));
+            }
+            if (null == powerUser.getStopLoad()) {
+                powerUser.setStopLoad(new BigDecimal(0));
+            }
+            int result = powerUserDao.update(powerUser);
+            if (result == 0) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+            }
+            Org org = new Org();
+            DataUtils.copySimpleObject(vo, org);
+            org.setId(vo.getOrgId());
+            org.setOrgType(1);
+            StringBuffer appNo = new StringBuffer();
+            //app授权
+            if (null != vo.getAppNo() && vo.getAppNo().length > 0) {
+                for (int i = 0; i < vo.getAppNo().length; i++) {
+                    if (i < vo.getAppNo().length - 1) {
+                        appNo.append(vo.getAppNo()[i]).append(",");
+                    } else {
+                        appNo.append(vo.getAppNo()[i]);
+                    }
+                }
+            }
+            org.setAppNo(appNo.toString());
+            result = orgDao.update(org);
+            if (result == 0) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+            }
+            if (null == vo.getSiteId() || vo.getSiteId().length == 0) {
+                //删除
+                result = orgSiteDao.deleteOrgSite(org.getId());
+            } else {
+                //修改
+                result = orgSiteDao.updateOrgSite(org.getId(), vo.getSiteId());
+            }
+            if (result == 0) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+            }
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "modify_success"), vo);
 
 
-	public ResultMsg<?> getList(String local, String cityId) {
-		try {
-			QueryRule queryRule = QueryRule.getInstance();
-			if(!StringUtils.isEmpty(cityId)){
-				queryRule.andLike("city", cityId);
-			}
-			List<PowerUser> list = powerUserDao.find(queryRule);
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),list);
-		}catch(Exception e){
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
-		}
-	}
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+        }
+    }
 
 
-	@Override
-	public ResultMsg<?> add(String local, PowerUserVo vo, JSONObject userinfo) {
-		try{
-			if(StringUtils.isEmpty(vo.getName()) || StringUtils.isEmpty(vo.getAddress()) || StringUtils.isEmpty(vo.getCoordinate())){
-				return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
-			}
-			if(null == vo.getFgpFlag()){
-				vo.setFgpFlag(SystemConstant.DISABLE);
-			}
-			if(null == vo.getPowerSupply()){
-				vo.setPowerSupply(SystemConstant.ENABLE);
-			}
-			if(null == vo.getJffs()){
-				vo.setJffs(SystemConstant.DISABLE);
-			}
-			//入库t_org表
-			Org org = new Org();
-			DataUtils.copySimpleObject(vo, org);
-			org.setOrgType(1);
-			org.setCreateTime(System.currentTimeMillis());
-			org.setCreatorId(userinfo.getJSONObject("user").getLong("id"));
-			org.setDel(SystemConstant.DISABLE);
-			StringBuffer appNo = new StringBuffer();
-			//app授权
-			if(null != vo.getAppNo() && vo.getAppNo().length > 0){
-				 for(int i=0;i<vo.getAppNo().length;i++){
-					 if(i < vo.getAppNo().length - 1){
-						 appNo.append(vo.getAppNo()[i]).append(","); 
-					 }else{
-						 appNo.append(vo.getAppNo()[i]); 
-					 }
-				 }
-			}
-			org.setAppNo(appNo.toString());
-			Long orgId =  orgDao.saveAndReturnId(org);
-			if(orgId == 0){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
-			}
-			//入库t_poweruser表
-			PowerUser powerUser = new PowerUser();
-			DataUtils.copySimpleObject(vo, powerUser);
-			powerUser.setOrgId(orgId);
-			powerUser.setState(SystemConstant.DISABLE);
-			Long id = powerUserDao.insertAndReturnId(powerUser);
-			if(id == 0){
-				//删除之前入库的数据
-				orgDao.delete(orgId);
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
-			}
-			
-			if(null == vo.getSiteId() || vo.getSiteId().length == 0){
-				vo.setId(id);
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "add_success"),vo);
-			}
-			//入库t_org_site表
-			int result =  orgSiteDao.insertOrgSite(orgId, vo.getSiteId());
-			if(result == 0){
-				//删除之前入库的数据
-				orgDao.delete(orgId);
-				powerUserDao.delete(id);
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
-			}
-			vo.setId(id);
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "add_success"));
-		}catch(Exception e){
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
-		}
-	}
+    /**
+     * 修改状态(支持批量)
+     */
+    public ResultMsg<?> modifySate(String local, String id, Integer state) {
+        if (StringUtils.isEmpty(id)) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "modify_error"));
+        }
+        try {
+            String[] ids = null;
+            if (id.indexOf(",") > 0) {
+                ids = id.split(",");
+            } else {
+                ids = new String[]{id};
+            }
+            int result = powerUserDao.modifyStateBatch(ids, state);
+            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"));
+        }
+    }
 
 
-	@Override
-	public ResultMsg<?> getListByParkId(String local, Long parkId,Long parkFlag, int pageNo,
-			int pageSize) {
-		Page<Map<String,Object>> page = null;
-		try{
-			//根据parkId查询对应省市区
-			Org org = orgDao.get(parkId);
-			Integer province = org.getProvince();
-			Integer city = org.getCity();
-			Integer district= org.getDistrict();
-			if(1 == parkFlag){
-				parkId = null;
-			}
-			page = powerUserDao.selectListByParkId(parkId,province,city,district,pageNo,pageSize);
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
-		}catch(Exception e){
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
-		}
-	}
+    public ResultMsg<?> getList(String local, String cityId) {
+        try {
+            QueryRule queryRule = QueryRule.getInstance();
+            if (!StringUtils.isEmpty(cityId)) {
+                queryRule.andLike("city", cityId);
+            }
+            List<PowerUser> list = powerUserDao.find(queryRule);
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), list);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+    }
 
 
-	@Override
-	public ResultMsg<?> removeParkId(String local, String id) {
-		if(StringUtils.isEmpty(id)){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
-		}
-		
-		try{
-			String []ids = id.split(",");
-			int result = powerUserDao.modifyParkIdBatch(ids,null);
-			if(result > 0){
-				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"));
-		}
-	}
+    @Override
+    public ResultMsg<?> add(String local, PowerUserVo vo, JSONObject userinfo) {
+        try {
+            if (StringUtils.isEmpty(vo.getName()) || StringUtils.isEmpty(vo.getAddress()) || StringUtils.isEmpty(vo.getCoordinate())) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+            }
+            if (null == vo.getFgpFlag()) {
+                vo.setFgpFlag(SystemConstant.DISABLE);
+            }
+            if (null == vo.getPowerSupply()) {
+                vo.setPowerSupply(SystemConstant.ENABLE);
+            }
+            if (null == vo.getJffs()) {
+                vo.setJffs(SystemConstant.DISABLE);
+            }
+            //入库t_org表
+            Org org = new Org();
+            DataUtils.copySimpleObject(vo, org);
+            org.setOrgType(1);
+            org.setCreateTime(System.currentTimeMillis());
+            org.setCreatorId(userinfo.getJSONObject("user").getLong("id"));
+            org.setDel(SystemConstant.DISABLE);
+            StringBuffer appNo = new StringBuffer();
+            //app授权
+            if (null != vo.getAppNo() && vo.getAppNo().length > 0) {
+                for (int i = 0; i < vo.getAppNo().length; i++) {
+                    if (i < vo.getAppNo().length - 1) {
+                        appNo.append(vo.getAppNo()[i]).append(",");
+                    } else {
+                        appNo.append(vo.getAppNo()[i]);
+                    }
+                }
+            }
+            org.setAppNo(appNo.toString());
+            Long orgId = orgDao.saveAndReturnId(org);
+            if (orgId == 0) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+            }
+            //入库t_poweruser表
+            PowerUser powerUser = new PowerUser();
+            DataUtils.copySimpleObject(vo, powerUser);
+            powerUser.setOrgId(orgId);
+            powerUser.setState(SystemConstant.DISABLE);
+            Long id = powerUserDao.insertAndReturnId(powerUser);
+            if (id == 0) {
+                //删除之前入库的数据
+                orgDao.delete(orgId);
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+            }
 
 
-	@Override
-	public ResultMsg<?> addParkId(String local, Long parkId, String id) {
-		if(StringUtils.isEmpty(id)){
-			return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
-		}
-		
-		try{
-			String []ids = id.split(",");
-			int result = powerUserDao.modifyParkIdBatch(ids,parkId);
-			if(result > 0){
-				return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","add_success"));
-			}
-			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"));
-		}
-	}
+            if (null == vo.getSiteId() || vo.getSiteId().length == 0) {
+                vo.setId(id);
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "add_success"), vo);
+            }
+            //入库t_org_site表
+            int result = orgSiteDao.insertOrgSite(orgId, vo.getSiteId());
+            if (result == 0) {
+                //删除之前入库的数据
+                orgDao.delete(orgId);
+                powerUserDao.delete(id);
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+            }
+            vo.setId(id);
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "add_success"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+        }
+    }
+
+    @Override
+    public ResultMsg<?> getListByParkId(String local, Long parkId, Long parkFlag, int pageNo,
+                                        int pageSize) {
+        Page<Map<String, Object>> page = null;
+        try {
+            //根据parkId查询对应省市区
+            Org org = orgDao.get(parkId);
+            Integer province = org.getProvince();
+            Integer city = org.getCity();
+            Integer district = org.getDistrict();
+            if (1 == parkFlag) {
+                parkId = null;
+            }
+            page = powerUserDao.selectListByParkId(parkId, province, city, district, pageNo, pageSize);
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+    }
+
+    @Override
+    public ResultMsg<?> removeParkId(String local, String id) {
+        if (StringUtils.isEmpty(id)) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
+        }
+
+        try {
+            String[] ids = id.split(",");
+            int result = powerUserDao.modifyParkIdBatch(ids, null);
+            if (result > 0) {
+                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"));
+        }
+    }
+
+    @Override
+    public ResultMsg<?> addParkId(String local, Long parkId, String id) {
+        if (StringUtils.isEmpty(id)) {
+            return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
+        }
+
+        try {
+            String[] ids = id.split(",");
+            int result = powerUserDao.modifyParkIdBatch(ids, parkId);
+            if (result > 0) {
+                return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "add_success"));
+            }
+            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"));
+        }
+    }
 
 
 
 
 }
 }

+ 322 - 296
VB_DSM_V2.1/vbdsm-web/vbdsm-manage/src/main/java/cn/vbdsm/manage/service/impl/ProxyCompanyService.java

@@ -1,18 +1,5 @@
 package cn.vbdsm.manage.service.impl;
 package cn.vbdsm.manage.service.impl;
 
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-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.config.I18nConfig;
 import cn.vbdsm.common.constants.SystemConstant;
 import cn.vbdsm.common.constants.SystemConstant;
 import cn.vbdsm.manage.dao.OrgDao;
 import cn.vbdsm.manage.dao.OrgDao;
@@ -26,295 +13,334 @@ import cn.vbdsm.model.Org;
 import cn.vbdsm.model.OrgSite;
 import cn.vbdsm.model.OrgSite;
 import cn.vbdsm.model.ProxyCompany;
 import cn.vbdsm.model.ProxyCompany;
 import cn.vbdsm.model.Site;
 import cn.vbdsm.model.Site;
+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.*;
 
 
 @Service("proxyCompanyService")
 @Service("proxyCompanyService")
 public class ProxyCompanyService implements IProxyCompanyService {
 public class ProxyCompanyService implements IProxyCompanyService {
-	
-	@Autowired ProxyCompanyDao proxyDao;
-	@Autowired OrgDao orgDao;
-	@Autowired OrgSiteDao orgSiteDao;
-	@Autowired SiteDao siteDao;
 
 
-	@Override
-	public ResultMsg<Page<ProxyCompanyVo>> getAllForPage(String local, int isRoot, int fromSite, int pageNo, int pageSize) {
-		//查询所有服务代理商的id、name
-		Map<Long, String> orgNameMap = orgDao.selectOrgIdName();
-		Map<Long, ProxyCompany> pcDataMap = proxyDao.selectAllPC();
-		
-		//机构分页数据
-		Page<Org> page = new Page<Org>();
-		if(isRoot == 1){//超级管理员查询所有
-			page = orgDao.selectAllForPage(pageNo, pageSize, 2);
-		}else{
-			page = orgDao.selectListByFromSite(pageNo, pageSize, 2, fromSite);
-		}
-		List<Org> dataList = page.getRows();
-		List<ProxyCompanyVo> voList = new ArrayList<ProxyCompanyVo>();
-		for(Org org : dataList){
-			long orgId = org.getId();
-			
-			ProxyCompanyVo pcVo = new ProxyCompanyVo();
-			DataUtils.copySimpleObject(org, pcVo);
-			
-			if(pcDataMap.containsKey(orgId)){
-				ProxyCompany pc = pcDataMap.get(orgId);
-				pcVo.setPrincipal(pc.getPrincipal());
-				pcVo.setTel(pc.getTel());
-				pcVo.setTg(pc.getTg());
-				if(pc.getHigherOrg() != null){
-					pcVo.setHigherOrgName(orgNameMap.get(pc.getHigherOrg()));
-				}
-			}
-			voList.add(pcVo);
-		}
-		return new ResultMsg<Page<ProxyCompanyVo>>(SystemConstant.RESULT_STATUS_SUCCESS, new Page<ProxyCompanyVo>(pageNo, page.getTotal(), pageSize, voList));
-	}
-	
-	@Override
-	public ProxyCompanyVo getOne(long id){
-		Org org = orgDao.get(id);
-		ProxyCompany pc = proxyDao.get(id);
-		ProxyCompanyVo vo = new ProxyCompanyVo();
-		DataUtils.copySimpleObject(org, vo);
-		DataUtils.copySimpleObject(pc, vo);
-		return vo;
-	}
+    @Autowired
+    ProxyCompanyDao proxyDao;
+    @Autowired
+    OrgDao orgDao;
+    @Autowired
+    OrgSiteDao orgSiteDao;
+    @Autowired
+    SiteDao siteDao;
+
+    @Override
+    public ResultMsg<Page<ProxyCompanyVo>> getAllForPage(String local, int isRoot, int fromSite, int pageNo, int pageSize) {
+        //查询所有服务代理商的id、name
+        Map<Long, String> orgNameMap = orgDao.selectOrgIdName();
+        Map<Long, ProxyCompany> pcDataMap = proxyDao.selectAllPC();
+
+        //机构分页数据
+        Page<Org> page = new Page<Org>();
+        if (isRoot == 1) {//超级管理员查询所有
+            page = orgDao.selectAllForPage(pageNo, pageSize, 2);
+        } else {
+            page = orgDao.selectListByFromSite(pageNo, pageSize, 2, fromSite);
+        }
+        List<Org> dataList = page.getRows();
+        List<ProxyCompanyVo> voList = new ArrayList<ProxyCompanyVo>();
+        for (Org org : dataList) {
+            long orgId = org.getId();
+
+            ProxyCompanyVo pcVo = new ProxyCompanyVo();
+            DataUtils.copySimpleObject(org, pcVo);
+
+            if (pcDataMap.containsKey(orgId)) {
+                ProxyCompany pc = pcDataMap.get(orgId);
+                pcVo.setPrincipal(pc.getPrincipal());
+                pcVo.setTel(pc.getTel());
+                pcVo.setTg(pc.getTg());
+                if (pc.getHigherOrg() != null) {
+                    pcVo.setHigherOrgName(orgNameMap.get(pc.getHigherOrg()));
+                }
+            }
+            voList.add(pcVo);
+        }
+        return new ResultMsg<Page<ProxyCompanyVo>>(SystemConstant.RESULT_STATUS_SUCCESS, new Page<ProxyCompanyVo>(pageNo, page.getTotal(), pageSize, voList));
+    }
+
+    @Override
+    public ProxyCompanyVo getOne(long id) {
+        Org org = orgDao.get(id);
+        ProxyCompany pc = proxyDao.get(id);
+        ProxyCompanyVo vo = new ProxyCompanyVo();
+        DataUtils.copySimpleObject(org, vo);
+        DataUtils.copySimpleObject(pc, vo);
+        return vo;
+    }
+
+    @Override
+    public ResultMsg<String> addOrModify(String local, long uid, int isRoot, long fromSite, ProxyCompanyVo proxyVo) {
+        String msg = "";
+        int status = 0;
+        Long id = proxyVo.getId();
+        if (null == id) {//新增
+            try {
+                //机构表
+                Org org = new Org();
+                org.setName(proxyVo.getName());
+                org.setOrgType(2);
+                org.setProvince(proxyVo.getProvince());
+                org.setCity(proxyVo.getCity());
+                org.setDistrict(proxyVo.getDistrict());
+                org.setAddress(proxyVo.getAddress());
+                org.setCoordinate(proxyVo.getCoordinate());
+                org.setCreatorId(uid);
+                org.setCreateTime(System.currentTimeMillis());
+                org.setDel(0);
+                long orgId = orgDao.saveAndReturnId(org);
+                //服务公司表
+                ProxyCompany pc = new ProxyCompany();
+                pc.setOrgId(orgId);
+                pc.setPrincipal(proxyVo.getPrincipal());
+                pc.setTel(proxyVo.getTel());
+                pc.setTg(proxyVo.getTg());
+                pc.setHigherOrg(proxyVo.getHigherOrg());
+                proxyDao.saveOne(pc);
+                //中间表
+                if (isRoot == 1) {//超级管理员可选择多站点
+                    String site = proxyVo.getSite();
+                    if (site != null && !"".equals(site)) {
+                        String[] ids = site.split(",");
+                        for (int i = 0; i < ids.length; i++) {
+                            long siteId = Long.parseLong(ids[i]);
+                            OrgSite os = new OrgSite();
+                            os.setOrgId(orgId);
+                            os.setSiteId(siteId);
+                            orgSiteDao.saveOne(os);
+                        }
+                    }
+                } else {//非超级管理员直接绑定其所在的站点
+                    OrgSite os = new OrgSite();
+                    os.setOrgId(orgId);
+                    os.setSiteId(fromSite);
+                    orgSiteDao.saveOne(os);
+                }
+
+                msg = I18nConfig.getValue(local, "tips", "add_success");
+                status = SystemConstant.RESULT_STATUS_SUCCESS;
+            } catch (Exception e) {
+                e.printStackTrace();
+                msg = I18nConfig.getValue(local, "tips", "add_error");
+                status = SystemConstant.RESULT_STATUS_ERROR;
+            }
+        } else {//修改
+            try {
+                //机构表
+                Org org = orgDao.get(id);
+                org.setName(proxyVo.getName());
+                org.setOrgType(2);
+                org.setProvince(proxyVo.getProvince());
+                org.setCity(proxyVo.getCity());
+                org.setDistrict(proxyVo.getDistrict());
+                org.setAddress(proxyVo.getAddress());
+                org.setCoordinate(proxyVo.getCoordinate());
+                org.setCreatorId(uid);
+                org.setCreateTime(System.currentTimeMillis());
+                org.setDel(0);
+                orgDao.update(org);
+                //服务公司表
+                ProxyCompany pc = proxyDao.get(id);
+                pc.setPrincipal(proxyVo.getPrincipal());
+                pc.setTel(proxyVo.getTel());
+                pc.setTg(proxyVo.getTg());
+                pc.setHigherOrg(proxyVo.getHigherOrg());
+                proxyDao.update(pc);
+                //中间表
+                if (isRoot == 1) {//超级管理员可选择多站点
+                    //如果存在则先删除,重新绑定
+                    List<OrgSite> siteList = orgSiteDao.selectByOrgId(id);
+                    if (siteList.size() > 0) {
+                        orgSiteDao.deleteAll(siteList);
+                    }
+                    String site = proxyVo.getSite();
+                    if (site != null && !"".equals(site)) {
+                        String[] ids = site.split(",");
+                        for (int i = 0; i < ids.length; i++) {
+                            long siteId = Long.parseLong(ids[i]);
+                            OrgSite os = new OrgSite();
+                            os.setOrgId(id);
+                            os.setSiteId(siteId);
+                            orgSiteDao.saveOne(os);
+                        }
+                    }
+                }
+
+                msg = I18nConfig.getValue(local, "tips", "modify_success");
+                status = SystemConstant.RESULT_STATUS_SUCCESS;
+            } catch (Exception e) {
+                e.printStackTrace();
+                msg = I18nConfig.getValue(local, "tips", "modify_error");
+                status = SystemConstant.RESULT_STATUS_ERROR;
+            }
+        }
+        return new ResultMsg<String>(status, msg, null);
+    }
+
+    @Override
+    public ResultMsg<String> removeOne(String local, long uid, long id) {
+        Org org = orgDao.get(id);
+        String msg = "";
+        try {
+            if (org == null) {
+                msg = I18nConfig.getValue(local, "setting", "not_exists");
+                return new ResultMsg<String>(SystemConstant.RESULT_STATUS_ERROR, msg, "ERROR");
+            } else {
+                org.setDel(1);
+                orgDao.update(org);
+
+                msg = I18nConfig.getValue(local, "tips", "remove_success");
+                return new ResultMsg<String>(SystemConstant.RESULT_STATUS_SUCCESS, msg, "SUCCESS");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+
+            msg = I18nConfig.getValue(local, "tips", "remove_error");
+            return new ResultMsg<String>(SystemConstant.RESULT_STATUS_ERROR, msg, "ERROR");
+        }
+    }
+
+    @Override
+    public ResultMsg<String> removeBatch(String local, long uid, String ids) {
+        String msg = "";
+        try {
+            String[] idStr = ids.split(",");
+            for (int i = 0; i < idStr.length; i++) {
+                Long id = Long.parseLong(idStr[i]);
+                Org org = orgDao.get(id);
+                if (org != null) {
+                    org.setDel(1);
+                    orgDao.update(org);
+                }
+            }
+            msg = I18nConfig.getValue(local, "tips", "remove_success");
+            return new ResultMsg<String>(SystemConstant.RESULT_STATUS_SUCCESS, msg, "SUCCESS");
+        } catch (Exception e) {
+            e.printStackTrace();
+
+            msg = I18nConfig.getValue(local, "tips", "remove_error");
+            return new ResultMsg<String>(SystemConstant.RESULT_STATUS_ERROR, msg, "ERROR");
+        }
+    }
+
+    @Override
+    public ResultMsg<?> getComboxDataAll(String local) {
+        List<Map<String, Object>> mList = new ArrayList<Map<String, Object>>();
+        try {
+            Map<Long, String> dataMap = orgDao.selectOrgIdName();
+            Iterator<Long> it = dataMap.keySet().iterator();
+            while (it.hasNext()) {
+                long id = it.next();
+                String name = dataMap.get(id);
+
+                Map<String, Object> map = new HashMap<String, Object>();
+                map.put("id", id);
+                map.put("title", name);
+                mList.add(map);
+            }
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), mList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+
+    }
+
+    @Override
+    public ResultMsg<?> getComboxData(String local, int isRoot, int fromSite, Long cid) {
+        List<Map<String, Object>> mList = new ArrayList<Map<String, Object>>();
+        try {
+            Map<Long, String> dataMap = new HashMap<Long, String>();
+            if (isRoot == 1) {
+                dataMap = orgDao.selectOrgIdName();
+            } else {
+                dataMap = orgDao.selectOrgBySite(fromSite, cid);
+            }
+            Iterator<Long> it = dataMap.keySet().iterator();
+            while (it.hasNext()) {
+                long id = it.next();
+                String name = dataMap.get(id);
+
+                Map<String, Object> map = new HashMap<String, Object>();
+                map.put("id", id);
+                map.put("title", name);
+                mList.add(map);
+            }
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), mList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+
+    }
+
+    @Override
+    public ResultMsg<?> getComboxData(String local, int isRoot, int fromSite) {
+        List<Map<String, Object>> mList = new ArrayList<Map<String, Object>>();
+        try {
+            Map<Long, String> dataMap = new HashMap<Long, String>();
+            if (isRoot == 1) {
+                dataMap = orgDao.selectOrgIdName();
+            } else {
+                dataMap = orgDao.selectOrgBySite(fromSite, null);
+            }
+            Iterator<Long> it = dataMap.keySet().iterator();
+            while (it.hasNext()) {
+                long id = it.next();
+                String name = dataMap.get(id);
+
+                Map<String, Object> map = new HashMap<String, Object>();
+                map.put("id", id);
+                map.put("title", name);
+                mList.add(map);
+            }
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), mList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
+        }
+
+    }
 
 
-	@Override
-	public ResultMsg<String> addOrModify(String local, long uid, int isRoot, long fromSite, ProxyCompanyVo proxyVo) {
-		String msg = "";
-		int status = 0;
-		Long id = proxyVo.getId();
-		if(null == id){//新增
-			try {
-				//机构表
-				Org org = new Org();
-				org.setName(proxyVo.getName());
-				org.setOrgType(2);
-				org.setProvince(proxyVo.getProvince());
-				org.setCity(proxyVo.getCity());
-				org.setDistrict(proxyVo.getDistrict());
-				org.setAddress(proxyVo.getAddress());
-				org.setCoordinate(proxyVo.getCoordinate());
-				org.setCreatorId(uid);
-				org.setCreateTime(System.currentTimeMillis());
-				org.setDel(0);
-				long orgId = orgDao.saveAndReturnId(org);
-				//服务公司表
-				ProxyCompany pc = new ProxyCompany();
-				pc.setOrgId(orgId);
-				pc.setPrincipal(proxyVo.getPrincipal());
-				pc.setTel(proxyVo.getTel());
-				pc.setTg(proxyVo.getTg());
-				pc.setHigherOrg(proxyVo.getHigherOrg());
-				proxyDao.saveOne(pc);
-				//中间表
-				if(isRoot == 1){//超级管理员可选择多站点
-					String site = proxyVo.getSite();
-					if(site != null && !"".equals(site)){
-						String [] ids = site.split(",");
-						for(int i=0; i<ids.length; i++){
-							long siteId = Long.parseLong(ids[i]);
-							OrgSite os = new OrgSite();
-							os.setOrgId(orgId);
-							os.setSiteId(siteId);
-							orgSiteDao.saveOne(os);
-						}
-					}
-				}else{//非超级管理员直接绑定其所在的站点
-					OrgSite os = new OrgSite();
-					os.setOrgId(orgId);
-					os.setSiteId(fromSite);
-					orgSiteDao.saveOne(os);
-				}
-				
-				msg = I18nConfig.getValue(local,"tips", "add_success");
-				status = SystemConstant.RESULT_STATUS_SUCCESS;
-			} catch (Exception e) {
-				e.printStackTrace();
-				msg = I18nConfig.getValue(local,"tips", "add_error");
-				status = SystemConstant.RESULT_STATUS_ERROR;
-			}
-		}else{//修改
-			try {
-				//机构表
-				Org org = orgDao.get(id);
-				org.setName(proxyVo.getName());
-				org.setOrgType(2);
-				org.setProvince(proxyVo.getProvince());
-				org.setCity(proxyVo.getCity());
-				org.setDistrict(proxyVo.getDistrict());
-				org.setAddress(proxyVo.getAddress());
-				org.setCoordinate(proxyVo.getCoordinate());
-				org.setCreatorId(uid);
-				org.setCreateTime(System.currentTimeMillis());
-				org.setDel(0);
-				orgDao.update(org);
-				//服务公司表
-				ProxyCompany pc = proxyDao.get(id);
-				pc.setPrincipal(proxyVo.getPrincipal());
-				pc.setTel(proxyVo.getTel());
-				pc.setTg(proxyVo.getTg());
-				pc.setHigherOrg(proxyVo.getHigherOrg());
-				proxyDao.update(pc);
-				//中间表
-				if(isRoot == 1){//超级管理员可选择多站点
-					//如果存在则先删除,重新绑定
-					List<OrgSite> siteList = orgSiteDao.selectByOrgId(id);
-					if(siteList.size() > 0){
-						orgSiteDao.deleteAll(siteList);
-					}
-					String site = proxyVo.getSite();
-					if(site != null && !"".equals(site)){
-						String [] ids = site.split(",");
-						for(int i=0; i<ids.length; i++){
-							long siteId = Long.parseLong(ids[i]);
-							OrgSite os = new OrgSite();
-							os.setOrgId(id);
-							os.setSiteId(siteId);
-							orgSiteDao.saveOne(os);
-						}
-					}
-				}
-				
-				msg = I18nConfig.getValue(local, "tips", "modify_success");
-				status = SystemConstant.RESULT_STATUS_SUCCESS;
-			} catch (Exception e) {
-				e.printStackTrace();
-				msg = I18nConfig.getValue(local,"tips", "modify_error");
-				status = SystemConstant.RESULT_STATUS_ERROR;
-			}
-		}
-		return new ResultMsg<String>(status, msg, null);
-	}
-	
-	@Override
-	public ResultMsg<String> removeOne(String local, long uid, long id) {
-		Org org = orgDao.get(id);
-		String msg = "";
-		try {
-			if(org == null){
-				msg = I18nConfig.getValue(local, "setting", "not_exists");
-				return new ResultMsg<String>(SystemConstant.RESULT_STATUS_ERROR, msg, "ERROR");
-			}else{
-				org.setDel(1);
-				orgDao.update(org);
-				
-				msg = I18nConfig.getValue(local, "tips", "remove_success");
-				return new ResultMsg<String>(SystemConstant.RESULT_STATUS_SUCCESS, msg, "SUCCESS");
-			}
-		} catch (Exception e) {
-			e.printStackTrace();
-			
-			msg = I18nConfig.getValue(local, "tips", "remove_error");
-			return new ResultMsg<String>(SystemConstant.RESULT_STATUS_ERROR, msg, "ERROR");
-		}
-	}
+    @Override
+    public List<OrgSiteVo> getSiteList(String local, long uid, long cid, int isRoot, int fromSite, long orgId) {
+        List<OrgSiteVo> dataList = new ArrayList<OrgSiteVo>();
+        if (isRoot == 1) {
+            Site condition = new Site();
+            //查询全部机构
+            Page<Site> page = siteDao.selectAll(condition);
 
 
-	@Override
-	public ResultMsg<String> removeBatch(String local, long uid, String ids) {
-		String msg = "";
-		try {
-			String[] idStr = ids.split(",");
-			for(int i=0; i<idStr.length; i++){
-				Long id = Long.parseLong(idStr[i]);
-				Org org = orgDao.get(id);
-				if(org != null){
-					org.setDel(1);
-					orgDao.update(org);
-				}
-			}
-			msg = I18nConfig.getValue(local, "tips", "remove_success");
-			return new ResultMsg<String>(SystemConstant.RESULT_STATUS_SUCCESS, msg, "SUCCESS");
-		} catch (Exception e) {
-			e.printStackTrace();
-			
-			msg = I18nConfig.getValue(local, "tips", "remove_error");
-			return new ResultMsg<String>(SystemConstant.RESULT_STATUS_ERROR, msg, "ERROR");
-		}
-	}
-	
-	@Override
-	public ResultMsg<?> getComboxDataAll(String local) {
-		List<Map<String, Object>> mList = new ArrayList<Map<String, Object>>();;
-		try{
-			Map<Long, String> dataMap = orgDao.selectOrgIdName();
-			Iterator<Long> it = dataMap.keySet().iterator();
-			while(it.hasNext()){
-				long id = it.next();
-				String name = dataMap.get(id);
-				
-				Map<String, Object> map = new HashMap<String, Object>();
-				map.put("id", id);
-				map.put("title", name);
-				mList.add(map);
-			}
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"), mList);
-		}catch(Exception e){
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
-		}
-		
-	}
+            //查询中间表,机构与站点是否绑定
+            Map<Long, Long> osMap = new HashMap<Long, Long>();
+            List<OrgSite> orgSiteList = orgSiteDao.selectByOrgId(orgId);
+            for (OrgSite os : orgSiteList) {
+                osMap.put(os.getSiteId(), os.getOrgId());
+            }
+            List<Site> siteList = page.getRows();
+            for (Site site : siteList) {
+                Map<String, Object> map = new HashMap<String, Object>();
+                map.put("id", site.getId());
+                map.put("name", site.getName());
+                OrgSiteVo sitevo = new OrgSiteVo();
+                sitevo.setId(site.getId());
+                sitevo.setName(site.getName());
+                if (osMap.containsKey(site.getId())) {
+                    sitevo.setChecked(true);
+                }
+                dataList.add(sitevo);
+            }
+        }
 
 
-	@Override
-	public ResultMsg<?> getComboxData(String local, int isRoot, int fromSite) {
-		List<Map<String, Object>> mList = new ArrayList<Map<String, Object>>();;
-		try{
-			Map<Long, String> dataMap = new HashMap<Long, String>();
-			if(isRoot == 1){
-				dataMap = orgDao.selectOrgIdName();
-			}else{
-				dataMap = orgDao.selectOrgBySite(fromSite);
-			}
-			Iterator<Long> it = dataMap.keySet().iterator();
-			while(it.hasNext()){
-				long id = it.next();
-				String name = dataMap.get(id);
-				
-				Map<String, Object> map = new HashMap<String, Object>();
-				map.put("id", id);
-				map.put("title", name);
-				mList.add(map);
-			}
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"), mList);
-		}catch(Exception e){
-			e.printStackTrace();
-			return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
-		}
-		
-	}
-	
-	@Override
-	public List<OrgSiteVo> getSiteList(String local, long uid, long cid, int isRoot, int fromSite, long orgId){
-		List<OrgSiteVo> dataList = new ArrayList<OrgSiteVo>();
-		if(isRoot == 1){
-			Site condition = new Site();
-			//查询全部机构
-			Page<Site> page = siteDao.selectAll(condition);
-			
-			//查询中间表,机构与站点是否绑定
-			Map<Long, Long> osMap = new HashMap<Long, Long>();
-			List<OrgSite> orgSiteList = orgSiteDao.selectByOrgId(orgId);
-			for(OrgSite os : orgSiteList){
-				osMap.put(os.getSiteId(), os.getOrgId());
-			}
-			List<Site> siteList = page.getRows();
-			for(Site site : siteList){
-				Map<String, Object> map = new HashMap<String, Object>();
-				map.put("id", site.getId());
-				map.put("name", site.getName());
-				OrgSiteVo sitevo = new OrgSiteVo();
-				sitevo.setId(site.getId());
-				sitevo.setName(site.getName());
-				if(osMap.containsKey(site.getId())){
-					sitevo.setChecked(true);
-				}
-				dataList.add(sitevo);
-			}
-		}
-		
-		return dataList;
-	}
+        return dataList;
+    }
 
 
 }
 }