|
|
@@ -1,20 +1,5 @@
|
|
|
package cn.vbdsm.powerservice.service.online.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 javax.core.common.utils.StringUtils;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-
|
|
|
import cn.vbdsm.common.config.I18nConfig;
|
|
|
import cn.vbdsm.common.constants.SystemConstant;
|
|
|
import cn.vbdsm.common.utils.DateUtil;
|
|
|
@@ -23,248 +8,262 @@ import cn.vbdsm.powerservice.dao.AuthDao;
|
|
|
import cn.vbdsm.powerservice.dao.MonitorDao;
|
|
|
import cn.vbdsm.powerservice.dao.SysIndustryDao;
|
|
|
import cn.vbdsm.powerservice.service.online.facade.IAuthService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import javax.core.common.Page;
|
|
|
+import javax.core.common.ResultMsg;
|
|
|
+import javax.core.common.utils.DataUtils;
|
|
|
+import javax.core.common.utils.StringUtils;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Service("authService")
|
|
|
public class AuthService implements IAuthService {
|
|
|
-
|
|
|
- @Autowired AuthDao authDao;
|
|
|
- @Autowired SysIndustryDao sysIndustryDao;
|
|
|
- @Autowired MonitorDao monitorDao;
|
|
|
|
|
|
- @Override
|
|
|
- public ResultMsg<Page<Map<String,Object>>> getAllUser(String local, Integer isRoot, Long cid,String userType,String realName) {
|
|
|
- Page<Map<String,Object>> page = null;
|
|
|
- try {
|
|
|
- //系统管理员
|
|
|
- if(null != isRoot && isRoot == 1){
|
|
|
- cid = null;
|
|
|
- }
|
|
|
- Map<String,Object> proxyCompany = authDao.selectOneProxyCompany(cid);
|
|
|
- if(null != proxyCompany.get("tg") && DataUtils.getInteger(proxyCompany.get("tg")) == 1){//是总部
|
|
|
- cid = null;
|
|
|
- }
|
|
|
- List<Map<String,Object>> userList = authDao.selectList(cid, userType,realName);
|
|
|
- if(!CollectionUtils.isEmpty(userList)){
|
|
|
- page = new Page<Map<String,Object>>(1, userList.size(), userList.size(), userList);
|
|
|
- }else{
|
|
|
- page = new Page<Map<String,Object>>();
|
|
|
- }
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
|
|
|
- } catch (Exception e) {
|
|
|
- // TODO Auto-generated catch block
|
|
|
- e.printStackTrace();
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_ERROR,I18nConfig.getValue(local, "tips","get_error"));
|
|
|
- }
|
|
|
- }
|
|
|
+ @Autowired
|
|
|
+ AuthDao authDao;
|
|
|
+ @Autowired
|
|
|
+ SysIndustryDao sysIndustryDao;
|
|
|
+ @Autowired
|
|
|
+ MonitorDao monitorDao;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultMsg<Page<Map<String, Object>>> getAllUser(String local, Integer isRoot, Long cid, String userType, String realName) {
|
|
|
+ Page<Map<String, Object>> page = null;
|
|
|
+ try {
|
|
|
+ //系统管理员
|
|
|
+ if (null != isRoot && isRoot == 1) {
|
|
|
+ cid = null;
|
|
|
+ } else {
|
|
|
+ Map<String, Object> proxyCompany = authDao.selectOneProxyCompany(cid);
|
|
|
+ if (null != proxyCompany.get("tg") && DataUtils.getInteger(proxyCompany.get("tg")) == 1) {//是总部
|
|
|
+ cid = null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Map<String, Object>> userList = authDao.selectList(cid, userType, realName);
|
|
|
+ if (!CollectionUtils.isEmpty(userList)) {
|
|
|
+ page = new Page<Map<String, Object>>(1, userList.size(), userList.size(), userList);
|
|
|
+ } else {
|
|
|
+ page = new Page<Map<String, Object>>();
|
|
|
+ }
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO Auto-generated catch block
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
- public ResultMsg<Page<Map<String, Object>>> getCustomList(String local,
|
|
|
- Long siteId, Long uid, String name, int pageNo, int pageSize,
|
|
|
- int province, int city, int district) {
|
|
|
- if(null == uid){
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_PARAM_ERROR,I18nConfig.getValue(local, "tips","get_error"));
|
|
|
- }
|
|
|
- try{
|
|
|
- Map<String,Object> user = authDao.selectOneUser(uid);
|
|
|
- Long cid = DataUtils.getLong(user.get("companyId"));
|
|
|
- if(null == cid){
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),new Page<Map<String,Object>>());
|
|
|
- }
|
|
|
- Map<String,Object> proxyCompany = authDao.selectOneProxyCompany(cid);
|
|
|
- if(null != proxyCompany.get("tg") && DataUtils.getInteger(proxyCompany.get("tg")) == 1){//总部
|
|
|
- cid = null;
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public ResultMsg<Page<Map<String, Object>>> getCustomList(String local,
|
|
|
+ Long siteId, Long uid, String name, int pageNo, int pageSize,
|
|
|
+ int province, int city, int district) {
|
|
|
+ if (null == uid) {
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ Map<String, Object> user = authDao.selectOneUser(uid);
|
|
|
+ Long cid = DataUtils.getLong(user.get("companyId"));
|
|
|
+ if (null == cid) {
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), new Page<Map<String, Object>>());
|
|
|
+ }
|
|
|
+ Map<String, Object> proxyCompany = authDao.selectOneProxyCompany(cid);
|
|
|
+ if (null != proxyCompany.get("tg") && DataUtils.getInteger(proxyCompany.get("tg")) == 1) {//总部
|
|
|
+ cid = null;
|
|
|
+ }
|
|
|
|
|
|
/*if(null != proxyCompany.get("tg") && DataUtils.getInteger(proxyCompany.get("tg")) != 1){//不是总部
|
|
|
cid = DataUtils.getLong(proxyCompany.get("higherOrg"));
|
|
|
}*/
|
|
|
- //查询对应客户信息
|
|
|
- Page<Map<String,Object>> page = authDao.selectList(siteId, uid, cid, name, pageNo, pageSize, province, city, district);
|
|
|
- if(CollectionUtils.isEmpty(page.getRows())){
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
|
|
|
- }
|
|
|
- Long parentCode = (long)-1;
|
|
|
- List<SysIndustry> industryList = sysIndustryDao.selectList(parentCode);
|
|
|
- for(int i=0;i<page.getRows().size();i++){
|
|
|
- if(null == page.getRows().get(i).get("industry1")){
|
|
|
- continue;
|
|
|
- }
|
|
|
- for(SysIndustry si : industryList){
|
|
|
- if(DataUtils.getLong(page.getRows().get(i).get("industry1")).equals(si.getCode())){
|
|
|
- page.getRows().get(i).put("industryName", si.getName());
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
|
|
|
- }catch(Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_ERROR,I18nConfig.getValue(local, "tips","get_error"));
|
|
|
- }
|
|
|
- }
|
|
|
+ //查询对应客户信息
|
|
|
+ Page<Map<String, Object>> page = authDao.selectList(siteId, uid, cid, name, pageNo, pageSize, province, city, district);
|
|
|
+ if (CollectionUtils.isEmpty(page.getRows())) {
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
|
|
|
+ }
|
|
|
+ Long parentCode = (long) -1;
|
|
|
+ List<SysIndustry> industryList = sysIndustryDao.selectList(parentCode);
|
|
|
+ for (int i = 0; i < page.getRows().size(); i++) {
|
|
|
+ if (null == page.getRows().get(i).get("industry1")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (SysIndustry si : industryList) {
|
|
|
+ if (DataUtils.getLong(page.getRows().get(i).get("industry1")).equals(si.getCode())) {
|
|
|
+ page.getRows().get(i).put("industryName", si.getName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
- public ResultMsg<Object> savePowerServie(String local, Long uid, String id,String endTime) {
|
|
|
- if(null == uid || StringUtils.isEmpty(id)){
|
|
|
- return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips","add_error"));
|
|
|
- }
|
|
|
- //转成时间戳
|
|
|
- long time = DateUtil.str2Date(endTime, endTime.length()).getTime();
|
|
|
- List<Map<String,Object>> psList = new ArrayList<Map<String,Object>>();
|
|
|
- try{
|
|
|
- List<Map<String,Object>> puList = authDao.selectList(id);
|
|
|
- for(Map<String,Object> m: puList){
|
|
|
- Map<String,Object> ps = new HashMap<String,Object>();
|
|
|
- ps.put("companyId", m.get("id"));
|
|
|
- ps.put("userId", uid);
|
|
|
- ps.put("endTime", time);
|
|
|
- ps.put("times",0);
|
|
|
- psList.add(ps);
|
|
|
- }
|
|
|
- int result = authDao.savePowerService(psList);
|
|
|
- if(result > 0){
|
|
|
- return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","add_success"));
|
|
|
- }else{
|
|
|
- return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","add_error"));
|
|
|
- }
|
|
|
- }catch(Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","add_error"));
|
|
|
- }
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public ResultMsg<Object> savePowerServie(String local, Long uid, String id, String endTime) {
|
|
|
+ if (null == uid || StringUtils.isEmpty(id)) {
|
|
|
+ return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
|
|
|
+ }
|
|
|
+ //转成时间戳
|
|
|
+ long time = DateUtil.str2Date(endTime, endTime.length()).getTime();
|
|
|
+ List<Map<String, Object>> psList = new ArrayList<Map<String, Object>>();
|
|
|
+ try {
|
|
|
+ List<Map<String, Object>> puList = authDao.selectList(id);
|
|
|
+ for (Map<String, Object> m : puList) {
|
|
|
+ Map<String, Object> ps = new HashMap<String, Object>();
|
|
|
+ ps.put("companyId", m.get("id"));
|
|
|
+ ps.put("userId", uid);
|
|
|
+ ps.put("endTime", time);
|
|
|
+ ps.put("times", 0);
|
|
|
+ psList.add(ps);
|
|
|
+ }
|
|
|
+ int result = authDao.savePowerService(psList);
|
|
|
+ if (result > 0) {
|
|
|
+ return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "add_success"));
|
|
|
+ } else {
|
|
|
+ return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "add_error"));
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
- public ResultMsg<Page<Map<String, Object>>> getServiceList(String local,
|
|
|
- Long siteId, Long uid, String name, int pageNo, int pageSize,
|
|
|
- int province, int city, int district,String userType) {
|
|
|
- if(null == uid){
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_PARAM_ERROR,"");
|
|
|
- }
|
|
|
- try{
|
|
|
- Page<Map<String,Object>> page;
|
|
|
- //如果是园区帐号,不能用该查询
|
|
|
- if("01080009".equals(userType)) {
|
|
|
- page = authDao.selectParkCpList(siteId, uid, name, pageNo, pageSize, province, city, district);
|
|
|
- }else {
|
|
|
- page = authDao.selectList(siteId, uid, name, pageNo, pageSize, province, city, district);
|
|
|
- }
|
|
|
- if(CollectionUtils.isEmpty(page.getRows())){
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
|
|
|
- }
|
|
|
-
|
|
|
- Map<Long, String> monitorCountMap = this.getOnlineMonitorCount();
|
|
|
-
|
|
|
- Long parentCode = (long)-1;
|
|
|
- List<SysIndustry> industryList = sysIndustryDao.selectList(parentCode);
|
|
|
- for(int i=0;i<page.getRows().size();i++){
|
|
|
-
|
|
|
- if(monitorCountMap.containsKey(page.getRows().get(i).get("orgId"))){
|
|
|
- page.getRows().get(i).put("monitorOnline", monitorCountMap.get(page.getRows().get(i).get("orgId")));
|
|
|
- }
|
|
|
-
|
|
|
- if(null == page.getRows().get(i).get("industry1")){
|
|
|
- continue;
|
|
|
- }
|
|
|
- for(SysIndustry si : industryList){
|
|
|
- if(DataUtils.getLong(page.getRows().get(i).get("industry1")).equals(si.getCode())){
|
|
|
- page.getRows().get(i).put("industryName", si.getName());
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
|
|
|
- }catch(Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_ERROR,I18nConfig.getValue(local, "tips","get_error"));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- private Map<Long, String> getOnlineMonitorCount(){
|
|
|
- //各企业监测点总数
|
|
|
- List<Map<String, Object>> allMonitorMapList = monitorDao.selectMonitorOnlineCount(-1);
|
|
|
- Map<Long, Integer> allMonitorMap = new HashMap<Long, Integer>();
|
|
|
- for(Map<String, Object> map : allMonitorMapList){
|
|
|
- long companyId = DataUtils.getLong(map.get("companyId"));
|
|
|
- int count = DataUtils.getInteger(map.get("count"));
|
|
|
-
|
|
|
- allMonitorMap.put(companyId, count);
|
|
|
- }
|
|
|
- //在线监测点数量
|
|
|
- List<Map<String, Object>> onlineMonitorMapList = monitorDao.selectMonitorOnlineCount(1);
|
|
|
- Map<Long, Integer> onlineMonitorMap = new HashMap<Long, Integer>();
|
|
|
- for(Map<String, Object> map : onlineMonitorMapList){
|
|
|
- long companyId = DataUtils.getLong(map.get("companyId"));
|
|
|
- int count = DataUtils.getInteger(map.get("count"));
|
|
|
-
|
|
|
- onlineMonitorMap.put(companyId, count);
|
|
|
- }
|
|
|
-
|
|
|
- Map<Long, String> countInfoMap = new HashMap<Long, String>();
|
|
|
- Iterator<Long> it = allMonitorMap.keySet().iterator();
|
|
|
- while(it.hasNext()){
|
|
|
- long companyId = it.next();
|
|
|
- int allMonitors = allMonitorMap.get(companyId);
|
|
|
- int onlineMonitors = 0;
|
|
|
- if(onlineMonitorMap.get(companyId) != null){
|
|
|
- onlineMonitors = onlineMonitorMap.get(companyId);
|
|
|
- }
|
|
|
- int offlineMonitors = allMonitors - onlineMonitors;
|
|
|
-
|
|
|
- countInfoMap.put(companyId, offlineMonitors + "/" + allMonitors);
|
|
|
- }
|
|
|
-
|
|
|
- return countInfoMap;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @Override
|
|
|
- public ResultMsg<Object> removePowerServie(String local, Long uid, String id) {
|
|
|
- if(null == uid || StringUtils.isEmpty(id)){
|
|
|
- return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips","remove_error"));
|
|
|
- }
|
|
|
- try{
|
|
|
- List<Long> ids = new ArrayList<Long>();
|
|
|
- if(id.indexOf(",") > 0){
|
|
|
- String []strs = id.split(",");
|
|
|
- for(String s:strs){
|
|
|
- ids.add(DataUtils.getLong(s));
|
|
|
- }
|
|
|
- }else{
|
|
|
- ids.add(DataUtils.getLong(id));
|
|
|
- }
|
|
|
- int result = authDao.deleteByIds(ids);
|
|
|
- if(result > 0){
|
|
|
- return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips","remove_success"));
|
|
|
- }else{
|
|
|
- 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<Page<Map<String, Object>>> getServiceList(String local,
|
|
|
+ Long siteId, Long uid, String name, int pageNo, int pageSize,
|
|
|
+ int province, int city, int district, String userType) {
|
|
|
+ if (null == uid) {
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_PARAM_ERROR, "");
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ Page<Map<String, Object>> page;
|
|
|
+ //如果是园区帐号,不能用该查询
|
|
|
+ if ("01080009".equals(userType)) {
|
|
|
+ page = authDao.selectParkCpList(siteId, uid, name, pageNo, pageSize, province, city, district);
|
|
|
+ } else {
|
|
|
+ page = authDao.selectList(siteId, uid, name, pageNo, pageSize, province, city, district);
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(page.getRows())) {
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<Long, String> monitorCountMap = this.getOnlineMonitorCount();
|
|
|
+
|
|
|
+ Long parentCode = (long) -1;
|
|
|
+ List<SysIndustry> industryList = sysIndustryDao.selectList(parentCode);
|
|
|
+ for (int i = 0; i < page.getRows().size(); i++) {
|
|
|
+
|
|
|
+ if (monitorCountMap.containsKey(page.getRows().get(i).get("orgId"))) {
|
|
|
+ page.getRows().get(i).put("monitorOnline", monitorCountMap.get(page.getRows().get(i).get("orgId")));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (null == page.getRows().get(i).get("industry1")) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (SysIndustry si : industryList) {
|
|
|
+ if (DataUtils.getLong(page.getRows().get(i).get("industry1")).equals(si.getCode())) {
|
|
|
+ page.getRows().get(i).put("industryName", si.getName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private Map<Long, String> getOnlineMonitorCount() {
|
|
|
+ //各企业监测点总数
|
|
|
+ List<Map<String, Object>> allMonitorMapList = monitorDao.selectMonitorOnlineCount(-1);
|
|
|
+ Map<Long, Integer> allMonitorMap = new HashMap<Long, Integer>();
|
|
|
+ for (Map<String, Object> map : allMonitorMapList) {
|
|
|
+ long companyId = DataUtils.getLong(map.get("companyId"));
|
|
|
+ int count = DataUtils.getInteger(map.get("count"));
|
|
|
+
|
|
|
+ allMonitorMap.put(companyId, count);
|
|
|
+ }
|
|
|
+ //在线监测点数量
|
|
|
+ List<Map<String, Object>> onlineMonitorMapList = monitorDao.selectMonitorOnlineCount(1);
|
|
|
+ Map<Long, Integer> onlineMonitorMap = new HashMap<Long, Integer>();
|
|
|
+ for (Map<String, Object> map : onlineMonitorMapList) {
|
|
|
+ long companyId = DataUtils.getLong(map.get("companyId"));
|
|
|
+ int count = DataUtils.getInteger(map.get("count"));
|
|
|
+
|
|
|
+ onlineMonitorMap.put(companyId, count);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<Long, String> countInfoMap = new HashMap<Long, String>();
|
|
|
+ Iterator<Long> it = allMonitorMap.keySet().iterator();
|
|
|
+ while (it.hasNext()) {
|
|
|
+ long companyId = it.next();
|
|
|
+ int allMonitors = allMonitorMap.get(companyId);
|
|
|
+ int onlineMonitors = 0;
|
|
|
+ if (onlineMonitorMap.get(companyId) != null) {
|
|
|
+ onlineMonitors = onlineMonitorMap.get(companyId);
|
|
|
+ }
|
|
|
+ int offlineMonitors = allMonitors - onlineMonitors;
|
|
|
+
|
|
|
+ countInfoMap.put(companyId, offlineMonitors + "/" + allMonitors);
|
|
|
+ }
|
|
|
+
|
|
|
+ return countInfoMap;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultMsg<Object> removePowerServie(String local, Long uid, String id) {
|
|
|
+ if (null == uid || StringUtils.isEmpty(id)) {
|
|
|
+ return new ResultMsg<Object>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ List<Long> ids = new ArrayList<Long>();
|
|
|
+ if (id.indexOf(",") > 0) {
|
|
|
+ String[] strs = id.split(",");
|
|
|
+ for (String s : strs) {
|
|
|
+ ids.add(DataUtils.getLong(s));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ids.add(DataUtils.getLong(id));
|
|
|
+ }
|
|
|
+ int result = authDao.deleteByIds(ids);
|
|
|
+ if (result > 0) {
|
|
|
+ return new ResultMsg<Object>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "remove_success"));
|
|
|
+ } else {
|
|
|
+ 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<Page<Map<String, Object>>> getServiceLogList(String local, Long uid) {
|
|
|
- Page<Map<String,Object>> page = null;
|
|
|
- if(null == uid){
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips","get_error"));
|
|
|
- }
|
|
|
- List<Map<String,Object>> pulList = null;
|
|
|
- try{
|
|
|
- //查询对应服务记录信息
|
|
|
- pulList = authDao.selectList(uid);
|
|
|
- if(!CollectionUtils.isEmpty(pulList)){
|
|
|
- page = new Page<Map<String,Object>>(0, pulList.size(), pulList.size(), pulList);
|
|
|
- }else{
|
|
|
- page = new Page<Map<String,Object>>();
|
|
|
- }
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_SUCCESS,I18nConfig.getValue(local, "tips","get_success"),page);
|
|
|
- }catch(Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- return new ResultMsg<Page<Map<String,Object>>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips","remove_error"));
|
|
|
- }
|
|
|
- }
|
|
|
+ @Override
|
|
|
+ public ResultMsg<Page<Map<String, Object>>> getServiceLogList(String local, Long uid) {
|
|
|
+ Page<Map<String, Object>> page = null;
|
|
|
+ if (null == uid) {
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_PARAM_ERROR, I18nConfig.getValue(local, "tips", "get_error"));
|
|
|
+ }
|
|
|
+ List<Map<String, Object>> pulList = null;
|
|
|
+ try {
|
|
|
+ //查询对应服务记录信息
|
|
|
+ pulList = authDao.selectList(uid);
|
|
|
+ if (!CollectionUtils.isEmpty(pulList)) {
|
|
|
+ page = new Page<Map<String, Object>>(0, pulList.size(), pulList.size(), pulList);
|
|
|
+ } else {
|
|
|
+ page = new Page<Map<String, Object>>();
|
|
|
+ }
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_SUCCESS, I18nConfig.getValue(local, "tips", "get_success"), page);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return new ResultMsg<Page<Map<String, Object>>>(SystemConstant.RESULT_STATUS_ERROR, I18nConfig.getValue(local, "tips", "remove_error"));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|