Browse Source

增加中台接口规范逻辑

cuixubin 3 years ago
parent
commit
c1535c8bad
29 changed files with 153 additions and 314 deletions
  1. 3 3
      src/main/java/com/persagy/framework/construct/RequestProcessor.java
  2. 46 2
      src/main/java/com/persagy/framework/util/ConfigUtil.java
  3. 6 0
      src/main/java/com/persagy/framework/util/DateUtils.java
  4. 32 1
      src/main/java/com/persagy/framework/util/WServiceUtil.java
  5. 9 6
      src/main/java/com/persagy/framework/web/controller/entrance/UnifierController.java
  6. 2 3
      src/main/java/com/persagy/functions/common/business/HelloWorld.java
  7. 3 4
      src/main/java/com/persagy/functions/common/business/HelloWorld2.java
  8. 2 1
      src/main/java/com/persagy/functions/common/business/HelloWorld3.java
  9. 6 6
      src/main/java/com/persagy/functions/weather/business/v2020/DayStaticData.java
  10. 2 2
      src/main/java/com/persagy/functions/weather/business/v2020/maintain/HourToDayData.java
  11. 0 13
      src/main/java/com/persagy/functions/weather/constant/ConstStaticType.java
  12. 13 0
      src/main/java/com/persagy/functions/weather/constant/ConstStatisticType.java
  13. 3 27
      src/main/java/com/persagy/functions/weather/constant/WeatherConstant.java
  14. 5 5
      src/main/java/com/persagy/functions/weather/service/DayStaticService.java
  15. 13 13
      src/main/java/com/persagy/functions/weather/service/impl/DayStaticServiceImpl.java
  16. 2 2
      src/main/java/com/persagy/functions/weather/thread/HourToDayAvgDataComputeThread.java
  17. 4 4
      src/main/java/com/persagy/functions/weather/thread/HourToDayDataComputeThread.java
  18. 2 2
      src/main/java/com/persagy/functions/weather/thread/HourToDayMaxDataComputeThread.java
  19. BIN
      src/main/resources/config/research/CmsBranchPointInfo.xlsx
  20. BIN
      src/main/resources/config/research/CmsItemBranch.xlsx
  21. BIN
      src/main/resources/config/research/branch.xlsx
  22. BIN
      src/main/resources/config/research/calculateUnit.xlsx
  23. BIN
      src/main/resources/config/research/energyModel.xlsx
  24. BIN
      src/main/resources/config/research/meter.xlsx
  25. BIN
      src/main/resources/config/research/pointInfo.xlsx
  26. BIN
      src/main/resources/config/research/projectInfo.xlsx
  27. BIN
      src/main/resources/config/research/relation.xlsx
  28. BIN
      src/main/resources/config/research/researchUse.xlsx
  29. 0 220
      src/main/resources/config/research/survey2.json

+ 3 - 3
src/main/java/com/persagy/framework/construct/RequestProcessor.java

@@ -1,6 +1,6 @@
 package com.persagy.framework.construct;
 
-import java.util.Map;
+import com.persagy.framework.dto.DataQueryParam;
 
 /**
  * 请求处理接口 
@@ -8,9 +8,9 @@ import java.util.Map;
 public interface RequestProcessor {
 	/***
 	 * 请求处理执行逻辑
-	 * @param paramMap 参数信息
+	 * @param param 参数信息
 	 * @return 处理结果
 	 * @throws Exception
 	 */
-	public Object handle(Map<String, Object> paramMap) throws Exception;
+	public Object handle(DataQueryParam param) throws Exception;
 }

+ 46 - 2
src/main/java/com/persagy/framework/util/ConfigUtil.java

@@ -22,6 +22,8 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 
 import com.persagy.core.constant.SystemConstant;
+import com.persagy.framework.dto.WeatherItemConfig;
+import com.persagy.framework.dto.WeatherItemDTO;
 import com.persagy.functions.weather.dto.CityDTO;
 
 @SuppressWarnings("unchecked")
@@ -50,6 +52,8 @@ public class ConfigUtil {
 	private static Map<String, CityDTO> id2City = new HashMap<String, CityDTO>();
 	/** 万达用到的城市{数据字典城市编码:城市名称} */
 	private static Map<String, String> wandaCity = new HashMap<String, String>();
+	/** 气象指标配置信息 */
+	private static WeatherItemConfig weatherItemConfig = new WeatherItemConfig();
 
 	public static List<Map<String, String>> getAllThread() {
 		List<Map<String, String>> tList = new ArrayList<>();
@@ -158,6 +162,19 @@ public class ConfigUtil {
 
 		return wandaCity;
 	}
+	
+	public static WeatherItemConfig weatherItemConfig() {
+		if(weatherItemConfig.getItems().isEmpty()) {
+			try {
+				
+			}catch (Exception e) {
+				// TODO: handle exception
+				e.printStackTrace();
+			}
+		}
+		
+		return weatherItemConfig;
+	}
 
 	/**
 	 * 刷新龙湖定制配置信息,从新读取配置文件信息加载到缓存
@@ -353,6 +370,19 @@ public class ConfigUtil {
 		initWandaCities();
 		LOGGER.info("refresh wandaCities config end. cityNum: " + wandaCity.size());
 	}
+	
+	public static void cache_refresh_weatherItem() throws Exception {
+		LOGGER.info("refresh weatherItem config start...");
+		initWeatherItemConfig();
+		LOGGER.info("refresh weatherItem config end. itemsNum: " + weatherItemConfig.getItems().size());
+	}
+
+	private static void initWeatherItemConfig() {
+		WeatherItemConfig wic = getConfigMap("/config/business/weatherItem.json", WeatherItemConfig.class);
+		if(null != wic && wic.getItems() != null && wic.getItems().size() > 0) {
+			weatherItemConfig = wic;
+		}
+	}
 
 	/**
 	 * 从Geography.json配置文件获取数据,刷新数据字典城市名称与城市编码对应关系
@@ -818,12 +848,26 @@ public class ConfigUtil {
 		cache_refresh_geography();
 		cache_refresh_cityexl();
 		cache_refresh_wandact();
+		cache_refresh_weatherItem();
 	}
 
 	public static void main(String[] args) throws Exception {
-		cache_refresh_wandact();
-		System.out.println(wandaCity);
+		WeatherItemConfig wic = getConfigMap("/config/business/weatherItem.json", WeatherItemConfig.class);
+		
+		Map<String, List<String>> map = new HashMap<>();
+		for(WeatherItemDTO item : wic.getItems()) {
+			for(String type : item.getDataTypeBelong()) {
+				if(map.containsKey(type)) {
+					map.get(type).add(item.getName());
+				}else {
+					map.put(type, new ArrayList<>(Arrays.asList(item.getName())));
+				}
+			}
+		}
 		
+		for(String type : map.keySet()) {
+			System.out.println(type+": "+map.get(type));
+		}
 		/*
 		List<String> list = FileTools.readFileToList(new File("D:/wz/wanda.txt"));
 		for(String city : list) {

+ 6 - 0
src/main/java/com/persagy/framework/util/DateUtils.java

@@ -36,6 +36,12 @@ public class DateUtils extends org.apache.commons.lang.time.DateUtils{
 	public static final String SDF_YEAR = "yyyy-01-01";
 	public static final String SDF_ONLY_HOUR_MINUTE = "HH:mm";
 
+	public static Date long2Date(long timeLong) throws ParseException {
+		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+		String d = format.format(timeLong); 
+		return format.parse(d);
+	}
+	
 	/**
 	 * 将 yyyy-MM-ddTHH:mm:ss+08:00格式的时间字符串转换为日期对象
 	 * @param dataStr

+ 32 - 1
src/main/java/com/persagy/framework/util/WServiceUtil.java

@@ -45,6 +45,23 @@ public class WServiceUtil {
 	 * 查询天气实况
 	 * @param location 城市标识
 	 * @return
+	 * 
+	 * {
+	 * 	"text": "晴",
+	 * 	"code": "0",
+	 * 	"temperature": "13",
+	 * 	"feels_like": "15",
+	 * 	"pressure": "1008",
+	 * 	"humidity": "18",
+	 * 	"visibility": "18.7",
+	 * 	"wind_direction": "南",
+	 * 	"wind_direction_degree": "189",
+	 * 	"wind_speed": "5.76",
+	 * 	"wind_scale": "2",
+	 * 	"clouds": "0",
+	 * 	"dew_point": ""
+	 * }
+	 * 
 	 */
 	public static Map<String, Object> getNowWeather(String location) {
 		Map<String, Object> nowObj = new HashMap<String, Object>();
@@ -87,7 +104,21 @@ public class WServiceUtil {
 	/**
 	 * 查询空气质量实况数据
 	 * @param location 城市标识
-	 * @return
+	 * @return 
+	 * 
+	 * {
+	 * 	"aqi": "68",
+	 * 	"pm25": "24",
+	 * 	"pm10": "86",
+	 * 	"so2": "2",
+	 * 	"no2": "8",
+	 * 	"co": "0.242",
+	 * 	"o3": "83",
+	 * 	"primary_pollutant": "PM10",
+	 * 	"last_update": "2021-02-06T14:00:00+08:00",
+	 * 	"quality": "良"
+	 * }
+	 * 
 	 */
 	public static Map<String, Object> getNowAir(String location) {
 		Map<String, Object> nowObj = new HashMap<String, Object>();

+ 9 - 6
src/main/java/com/persagy/framework/web/controller/entrance/UnifierController.java

@@ -46,6 +46,7 @@ import com.persagy.core.utils.HttpUtils;
 import com.persagy.ems.pojo.system.FileResource;
 import com.persagy.framework.construct.RequestProcessor;
 import com.persagy.framework.dto.ApiResult;
+import com.persagy.framework.dto.DataQueryParam;
 import com.persagy.framework.dto.FileConfigDTO;
 import com.persagy.framework.dto.FileResourceExtension;
 import com.persagy.framework.util.CommonToolUtils;
@@ -78,11 +79,13 @@ public class UnifierController {
 	@Resource
 	protected ApplicationContext context;
 	
-	@RequestMapping(value = "/common/{" + HANDLE_TYPE + "}")
+	@RequestMapping(value = "/dataQuery/{" + HANDLE_TYPE + "}")
 	@ResponseBody
 	public ApiResult businessHandle(@PathVariable(HANDLE_TYPE) String handleType, 
-			@RequestBody Map<String, Object> param, HttpServletRequest request) throws Exception {
+			@RequestBody Map<String, Object> paramMap, HttpServletRequest request) throws Exception {
 		String ip = CommonToolUtils.getIpAddr(request);
+		
+		
 		ConstBusinessStatic.add(ip, handleType);
 		RequestIpStatisticThread.addupdateIpApiEndDateMap(ip, handleType);
 		
@@ -100,7 +103,7 @@ public class UnifierController {
 		
 		if(null == serviceBean || !(serviceBean instanceof RequestProcessor)) {
 			// 请求统计接口具体服务应1存在于spring容器;2实现了RequestProcessor接口
-			apiResult.setMessage("request service unsupport!");
+			apiResult.setMessage("request dataType unsupport!");
 			return apiResult;
 		}else {
 			businessService = (RequestProcessor) serviceBean;
@@ -108,19 +111,19 @@ public class UnifierController {
 		
 		try {
 			
-			apiResult.setData(businessService.handle(param));
+			apiResult.setData(businessService.handle(new DataQueryParam(paramMap)));
 			
 			apiResult.setResult(ApiResult.result_success);
 		} catch (Exception e) {
 			apiResult.setResult(ApiResult.result_fail);
 			apiResult.setMessage(e.getMessage());
-		    log.error("Request Error! requesterIp="+ip+" API=" + handleType + ", Param=" + param + ", Msg=" + e.getMessage(), e);
+		    log.error("Request Error! requesterIp="+ip+" API=" + handleType + ", Param=" + paramMap + ", Msg=" + e.getMessage(), e);
 		}
 
 		long end = System.currentTimeMillis();
 	    long timeInterval = (end - start.longValue()) / 1000;
 	    if (timeInterval > 5) {
-	    	log.warn("TimeCost Warning! requesterIp=" +ip+ "timeCost=" +timeInterval + "s, API=" + handleType + ", Param=" + param);
+	    	log.warn("TimeCost Warning! requesterIp=" +ip+ "timeCost=" +timeInterval + "s, API=" + handleType + ", Param=" + paramMap);
 	    }
 	    
 	    return apiResult;

+ 2 - 3
src/main/java/com/persagy/functions/common/business/HelloWorld.java

@@ -1,16 +1,15 @@
 package com.persagy.functions.common.business;
 
-import java.util.Map;
-
 import org.springframework.stereotype.Service;
 
 import com.persagy.framework.construct.RequestProcessor;
+import com.persagy.framework.dto.DataQueryParam;
 
 @Service("helloworld")
 public class HelloWorld implements RequestProcessor {
 
 	@Override
-	public Object handle(Map<String, Object> paramMap) throws Exception {
+	public Object handle(DataQueryParam param) throws Exception {
 		return "helloworld!";
 	}
 

+ 3 - 4
src/main/java/com/persagy/functions/common/business/HelloWorld2.java

@@ -1,17 +1,16 @@
 package com.persagy.functions.common.business;
 
-import java.util.Map;
-
 import org.springframework.stereotype.Service;
 
 import com.persagy.framework.construct.RequestProcessor;
+import com.persagy.framework.dto.DataQueryParam;
 
 @Service("helloworld2")
 public class HelloWorld2 implements RequestProcessor {
 
 	@Override
-	public Object handle(Map<String, Object> paramMap) throws Exception {
-		return paramMap;
+	public Object handle(DataQueryParam param) throws Exception {
+		return param;
 	}
 
 }

+ 2 - 1
src/main/java/com/persagy/functions/common/business/HelloWorld3.java

@@ -8,12 +8,13 @@ import java.util.Map;
 import org.springframework.stereotype.Service;
 
 import com.persagy.framework.construct.RequestProcessor;
+import com.persagy.framework.dto.DataQueryParam;
 
 @Service("helloworld3")
 public class HelloWorld3 implements RequestProcessor {
 
 	@Override
-	public Object handle(Map<String, Object> paramMap) throws Exception {
+	public Object handle(DataQueryParam param) throws Exception {
 		List<Map<String, String>> list = new ArrayList<>();
 		for(int i=0; i<5; i++) {
 			Map<String, String> item = new HashMap<>();

+ 6 - 6
src/main/java/com/persagy/functions/weather/business/v2020/DayStaticData.java

@@ -19,7 +19,7 @@ import com.persagy.ems.pojo.wz.DayStaticRecord;
 import com.persagy.framework.util.ConfigUtil;
 import com.persagy.framework.util.DateUtils;
 import com.persagy.functions.weather.constant.Const;
-import com.persagy.functions.weather.constant.ConstStaticType;
+import com.persagy.functions.weather.constant.ConstStatisticType;
 import com.persagy.functions.weather.constant.ConstTime;
 import com.persagy.functions.weather.service.DayStaticService;
 
@@ -41,11 +41,11 @@ public class DayStaticData extends BaseBusinessService<Map> implements BusinessS
 			throw new Exception(Const.ErrorTag.paramMis);
 		}
 		
-		ConstStaticType dtype = null;
+		ConstStatisticType dtype = null;
 		if(null == dataType) {
-			dtype = ConstStaticType.Max;
+			dtype = ConstStatisticType.Max;
 		}else {
-			dtype = ConstStaticType.getItem(dataType);
+			dtype = ConstStatisticType.getItem(dataType);
 		}
 		if(null == dtype) {
 			throw new Exception(Const.ErrorTag.paramUnrecognized);
@@ -75,7 +75,7 @@ public class DayStaticData extends BaseBusinessService<Map> implements BusinessS
 		Long t1 = System.currentTimeMillis();
 		
 		Map<Date, DayStaticRecord> maxMap = new HashMap<>();
-		if(dtype == ConstStaticType.Max || dtype == ConstStaticType.All) {
+		if(dtype == ConstStatisticType.Max || dtype == ConstStatisticType.All) {
 			List<DayStaticRecord> listMax = dayStaticService.query(location, timeFrom, timeTo);
 			if(null != listMax) {
 				for(DayStaticRecord obj : listMax) {
@@ -87,7 +87,7 @@ public class DayStaticData extends BaseBusinessService<Map> implements BusinessS
 		Long t2 = System.currentTimeMillis();
 		
 		Map<Date, DayStaticMoreRecord> avgMap = new HashMap<>();
-		if(dtype == ConstStaticType.Avg || dtype == ConstStaticType.All) {
+		if(dtype == ConstStatisticType.Avg || dtype == ConstStatisticType.All) {
 			List<DayStaticMoreRecord> listAvg = dayStaticService.queryMore(location, timeFrom, timeTo);
 			if(null != listAvg) {
 				for(DayStaticMoreRecord obj : listAvg) {

+ 2 - 2
src/main/java/com/persagy/functions/weather/business/v2020/maintain/HourToDayData.java

@@ -13,7 +13,7 @@ import com.persagy.core.service.BaseBusinessService;
 import com.persagy.core.service.BusinessService;
 import com.persagy.framework.util.DateUtils;
 import com.persagy.functions.weather.constant.Const;
-import com.persagy.functions.weather.constant.ConstStaticType;
+import com.persagy.functions.weather.constant.ConstStatisticType;
 import com.persagy.functions.weather.service.DayHisRecordService;
 import com.persagy.functions.weather.service.DayStaticService;
 import com.persagy.functions.weather.service.HourRecordService;
@@ -43,7 +43,7 @@ public class HourToDayData extends BaseBusinessService<Map> implements BusinessS
 		String startDay = (String) dto.get("startDay");
 		String endDay = (String) dto.get("endDay");
 		String type = (String) dto.get("type");
-		ConstStaticType stype = ConstStaticType.getItem(type);
+		ConstStatisticType stype = ConstStatisticType.getItem(type);
 		
 		if((cityId == null && cityIdList == null) || startDay == null || endDay == null || stype == null) {
 			throw new Exception(Const.ErrorTag.paramMis);

+ 0 - 13
src/main/java/com/persagy/functions/weather/constant/ConstStaticType.java

@@ -1,13 +0,0 @@
-package com.persagy.functions.weather.constant;
-
-public enum ConstStaticType {
-	Max,Avg,All;
-	public static ConstStaticType getItem(String str) {
-		for(ConstStaticType e : ConstStaticType.values()) {
-			if(e.name().equals(str)) {
-				return e;
-			}
-		}
-		return null;
-	}
-}

+ 13 - 0
src/main/java/com/persagy/functions/weather/constant/ConstStatisticType.java

@@ -0,0 +1,13 @@
+package com.persagy.functions.weather.constant;
+
+public enum ConstStatisticType {
+	Max,Avg,All;
+	public static ConstStatisticType getItem(String str) {
+		for(ConstStatisticType e : ConstStatisticType.values()) {
+			if(e.name().equals(str)) {
+				return e;
+			}
+		}
+		return null;
+	}
+}

+ 3 - 27
src/main/java/com/persagy/functions/weather/constant/WeatherConstant.java

@@ -8,6 +8,8 @@ import java.util.Map;
  * Description: 天气信息码常量   
  */
 public class WeatherConstant {
+//	public static final Set<String> 
+	
 	// 数据字典天气信息码及对应描述信息
 	private static final Map<String, String> code2DescMap = new HashMap<>();
 	/** 获取天气现象代码及描述信息 */
@@ -64,31 +66,5 @@ public class WeatherConstant {
 		standCodeDesc.put("38", "热"); standCodeDesc.put("99", "未知");
 	}
 	
-	// 第三方天气信息编码与数据字典编码对应关系
-	private static final Map<String, String> code2DicCodeMap = new HashMap<>();
-	public static Map<String, String> getCode2DicCodeMap() {
-		return code2DicCodeMap;
-	}
-	static {
-		code2DicCodeMap.put("0", "1"); code2DicCodeMap.put("1", "1");
-		code2DicCodeMap.put("2", "1"); code2DicCodeMap.put("3", "1");
-		code2DicCodeMap.put("4", "2"); code2DicCodeMap.put("5", "2");
-		code2DicCodeMap.put("6", "2"); code2DicCodeMap.put("7", "2");
-		code2DicCodeMap.put("8", "2"); code2DicCodeMap.put("9", "3");
-		code2DicCodeMap.put("10", "4"); code2DicCodeMap.put("11", "5");
-		code2DicCodeMap.put("12", "6"); code2DicCodeMap.put("13", "8");
-		code2DicCodeMap.put("14", "9"); code2DicCodeMap.put("15", "A");
-		code2DicCodeMap.put("16", "B"); code2DicCodeMap.put("17", "C");
-		code2DicCodeMap.put("18", "D"); code2DicCodeMap.put("19", "K");
-		code2DicCodeMap.put("20", "7"); code2DicCodeMap.put("21", "E");
-		code2DicCodeMap.put("22", "F"); code2DicCodeMap.put("23", "G");
-		code2DicCodeMap.put("24", "H"); code2DicCodeMap.put("25", "I");
-		code2DicCodeMap.put("26", "M"); code2DicCodeMap.put("27", "N");
-		code2DicCodeMap.put("28", "N"); code2DicCodeMap.put("29", "O");
-		code2DicCodeMap.put("30", "J"); code2DicCodeMap.put("31", "P");
-		code2DicCodeMap.put("32", "Q"); code2DicCodeMap.put("33", "Q");
-		code2DicCodeMap.put("34", "Q"); code2DicCodeMap.put("35", "Q");
-		code2DicCodeMap.put("36", "Q"); code2DicCodeMap.put("37", "Q");
-		code2DicCodeMap.put("38", "Q"); code2DicCodeMap.put("99", "Q");
-	}
+	
 }

+ 5 - 5
src/main/java/com/persagy/functions/weather/service/DayStaticService.java

@@ -7,7 +7,7 @@ import java.util.Map;
 import com.persagy.ems.pojo.wz.DayStaticMoreRecord;
 import com.persagy.ems.pojo.wz.DayStaticRecord;
 import com.persagy.ems.pojo.wz.HourRecordData;
-import com.persagy.functions.weather.constant.ConstStaticType;
+import com.persagy.functions.weather.constant.ConstStatisticType;
 
 public interface DayStaticService {
 	/**查询日最值统计数据*/
@@ -21,13 +21,13 @@ public interface DayStaticService {
 	/**重新计算某日的日最值和日均值*/
 	public boolean restaticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist) throws Exception;
 	/**由24小时数据统计到日最值和日均值数据表*/
-	public boolean staticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist, ConstStaticType type) throws Exception;
+	public boolean staticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist, ConstStatisticType type) throws Exception;
 	/**由24小时数据统计到日最值和日均值数据表*/
-	public boolean staticHourToDay(String cityId, Map<Date, List<HourRecordData>> sourceData, ConstStaticType type) throws Exception;
+	public boolean staticHourToDay(String cityId, Map<Date, List<HourRecordData>> sourceData, ConstStatisticType type) throws Exception;
 	/**重新计算某日的日最值和日均值*/
-	public boolean restaticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist, ConstStaticType type) throws Exception;
+	public boolean restaticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist, ConstStatisticType type) throws Exception;
 	/**重新计算某日的日最值和日均值*/
-	public boolean restaticHourToDay(String cityId, Map<Date, List<HourRecordData>> sourceData, ConstStaticType type) throws Exception;
+	public boolean restaticHourToDay(String cityId, Map<Date, List<HourRecordData>> sourceData, ConstStatisticType type) throws Exception;
 	/**由24小时数据统计到日最值和日均值数据表*/
 	public boolean staticHourToDay(String cityId, Date dayTime) throws Exception;
 	/**重新计算某日的日最值和日均值*/

+ 13 - 13
src/main/java/com/persagy/functions/weather/service/impl/DayStaticServiceImpl.java

@@ -17,7 +17,7 @@ import com.persagy.ems.pojo.wz.DayStaticMoreRecord;
 import com.persagy.ems.pojo.wz.DayStaticRecord;
 import com.persagy.ems.pojo.wz.HourRecordData;
 import com.persagy.framework.util.DateUtils;
-import com.persagy.functions.weather.constant.ConstStaticType;
+import com.persagy.functions.weather.constant.ConstStatisticType;
 import com.persagy.functions.weather.dto.NumAvgDTO;
 import com.persagy.functions.weather.service.DayStaticService;
 import com.persagy.functions.weather.service.HourRecordService;
@@ -174,12 +174,12 @@ public class DayStaticServiceImpl implements DayStaticService {
 	
 	@Override
 	public boolean staticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist) throws Exception {
-		return staticHourToDay(cityId, dayTime, sourcelist, ConstStaticType.All);
+		return staticHourToDay(cityId, dayTime, sourcelist, ConstStatisticType.All);
 	}
 	
 	@Override
 	public boolean restaticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist) throws Exception {
-		return restaticHourToDay(cityId, dayTime, sourcelist, ConstStaticType.All);
+		return restaticHourToDay(cityId, dayTime, sourcelist, ConstStatisticType.All);
 	}
 	
 	@Override
@@ -246,16 +246,16 @@ public class DayStaticServiceImpl implements DayStaticService {
 	}
 
 	@Override
-	public boolean staticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist, ConstStaticType type)
+	public boolean staticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist, ConstStatisticType type)
 			throws Exception {
 		if ((sourcelist == null) || (sourcelist.isEmpty())) {
 			log.error("day static error." + DateUtils.date2Str(dayTime, "yyyy-MM-dd") + " cityId=" + cityId
 					+ ", no hour records.");
 		} else {
-			if(ConstStaticType.All == type || ConstStaticType.Max == type) {
+			if(ConstStatisticType.All == type || ConstStatisticType.Max == type) {
 				save(getMaxStaticObjFromHourData(cityId, dayTime, sourcelist));
 			}
-			if(ConstStaticType.All == type || ConstStaticType.Avg == type) {
+			if(ConstStatisticType.All == type || ConstStatisticType.Avg == type) {
 				save(getAvgStaticObjFromHourData(cityId, dayTime, sourcelist));
 			}
 			
@@ -266,11 +266,11 @@ public class DayStaticServiceImpl implements DayStaticService {
 	
 	@Override
 	public boolean staticHourToDay(String cityId, Map<Date, List<HourRecordData>> sourceData,
-			ConstStaticType type) throws Exception {
+			ConstStatisticType type) throws Exception {
 		if ((sourceData == null) || (sourceData.isEmpty())) {
 			log.error("day static error. no hour records.");
 		}else {
-			if(ConstStaticType.All == type || ConstStaticType.Max == type) {
+			if(ConstStatisticType.All == type || ConstStatisticType.Max == type) {
 				List<DayStaticRecord> saveList = new ArrayList<>();
 				for(Date dayTime : sourceData.keySet()) {
 					saveList.add(getMaxStaticObjFromHourData(cityId, dayTime, sourceData.get(dayTime)));
@@ -279,7 +279,7 @@ public class DayStaticServiceImpl implements DayStaticService {
 				save(saveList);
 			}
 			
-			if(ConstStaticType.All == type || ConstStaticType.Avg == type) {
+			if(ConstStatisticType.All == type || ConstStatisticType.Avg == type) {
 				List<DayStaticMoreRecord> saveList = new ArrayList<>();
 				for(Date dayTime : sourceData.keySet()) {
 					saveList.add(getAvgStaticObjFromHourData(cityId, dayTime, sourceData.get(dayTime)));
@@ -293,13 +293,13 @@ public class DayStaticServiceImpl implements DayStaticService {
 	}
 
 	@Override
-	public boolean restaticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist, ConstStaticType type)
+	public boolean restaticHourToDay(String cityId, Date dayTime, List<HourRecordData> sourcelist, ConstStatisticType type)
 			throws Exception {
 		if ((sourcelist == null) || (sourcelist.isEmpty())) {
 			log.error("day static error." + DateUtils.date2Str(dayTime, "yyyy-MM-dd") + " cityId=" + cityId
 					+ ", no hour records.");
 		} else {
-			if(ConstStaticType.All == type || ConstStaticType.Max == type) {
+			if(ConstStatisticType.All == type || ConstStatisticType.Max == type) {
 				DayStaticRecord queryObj = new DayStaticRecord();
 				queryObj.setCityId(cityId);
 				queryObj.setDayTime(dayTime);
@@ -307,7 +307,7 @@ public class DayStaticServiceImpl implements DayStaticService {
 				coreService.remove(queryObj);
 				save(getMaxStaticObjFromHourData(cityId, dayTime, sourcelist));
 			}
-			if(ConstStaticType.All == type || ConstStaticType.Avg == type) {
+			if(ConstStatisticType.All == type || ConstStatisticType.Avg == type) {
 				DayStaticMoreRecord moreObj = new DayStaticMoreRecord();
 				moreObj.setCityId(cityId);
 				moreObj.setDayTime(dayTime);
@@ -322,7 +322,7 @@ public class DayStaticServiceImpl implements DayStaticService {
 	}
 
 	@Override
-	public boolean restaticHourToDay(String cityId, Map<Date, List<HourRecordData>> sourceData, ConstStaticType type)
+	public boolean restaticHourToDay(String cityId, Map<Date, List<HourRecordData>> sourceData, ConstStatisticType type)
 			throws Exception {
 		if ((sourceData == null) || (sourceData.isEmpty())) {
 			log.error("day static error. no hour records.");

+ 2 - 2
src/main/java/com/persagy/functions/weather/thread/HourToDayAvgDataComputeThread.java

@@ -13,7 +13,7 @@ import org.apache.log4j.Logger;
 import com.persagy.ems.pojo.wz.HourRecordData;
 import com.persagy.framework.util.ConfigUtil;
 import com.persagy.framework.util.DateUtils;
-import com.persagy.functions.weather.constant.ConstStaticType;
+import com.persagy.functions.weather.constant.ConstStatisticType;
 import com.persagy.functions.weather.service.DayStaticService;
 import com.persagy.functions.weather.service.HourRecordService;
 
@@ -91,7 +91,7 @@ public class HourToDayAvgDataComputeThread implements Runnable {
 					
 					
 					try {
-						dayStaticService.restaticHourToDay(cid, dayDate_list, ConstStaticType.Avg);
+						dayStaticService.restaticHourToDay(cid, dayDate_list, ConstStatisticType.Avg);
 						LOGGER.info("hourDataToDayAvgData, cityNow:" + cindex + "/" + hourCites.size() + ", time:" + DateUtils.date2Str(sdate, "yyyy-MM-dd"));
 					} catch (Exception e) {
 						LOGGER.info("hourDataToDayAvgData Error, cCity=" + cid + ", msg=" + e.getMessage()); 

+ 4 - 4
src/main/java/com/persagy/functions/weather/thread/HourToDayDataComputeThread.java

@@ -14,7 +14,7 @@ import com.persagy.ems.pojo.wz.DayHisRecord;
 import com.persagy.ems.pojo.wz.HourRecordData;
 import com.persagy.framework.util.ConfigUtil;
 import com.persagy.framework.util.DateUtils;
-import com.persagy.functions.weather.constant.ConstStaticType;
+import com.persagy.functions.weather.constant.ConstStatisticType;
 import com.persagy.functions.weather.service.DayHisRecordService;
 import com.persagy.functions.weather.service.DayStaticService;
 import com.persagy.functions.weather.service.HourRecordService;
@@ -28,7 +28,7 @@ public class HourToDayDataComputeThread implements Runnable {
 	private Set<String> cityIds;
 	private Date fromDay;
 	private Date toDay;
-	private ConstStaticType stype;
+	private ConstStatisticType stype;
 	
 	public HourToDayDataComputeThread(HourRecordService hourDataService, DayHisRecordService dayHisRecordService,
 			DayStaticService dayStaticService, String cityId, Date fromDay, Date toDay) {
@@ -42,7 +42,7 @@ public class HourToDayDataComputeThread implements Runnable {
 	}
 
 	public HourToDayDataComputeThread(HourRecordService hourDataService, DayHisRecordService dayHisRecordService,
-			DayStaticService dayStaticService, String cityId, Date fromDay, Date toDay, ConstStaticType stype) {
+			DayStaticService dayStaticService, String cityId, Date fromDay, Date toDay, ConstStatisticType stype) {
 		super();
 		this.hourDataService = hourDataService;
 		this.dayHisRecordService = dayHisRecordService;
@@ -54,7 +54,7 @@ public class HourToDayDataComputeThread implements Runnable {
 	}
 	
 	public HourToDayDataComputeThread(HourRecordService hourDataService, DayHisRecordService dayHisRecordService,
-			DayStaticService dayStaticService, Set<String> cityIds, Date fromDay, Date toDay, ConstStaticType stype) {
+			DayStaticService dayStaticService, Set<String> cityIds, Date fromDay, Date toDay, ConstStatisticType stype) {
 		super();
 		this.hourDataService = hourDataService;
 		this.dayHisRecordService = dayHisRecordService;

+ 2 - 2
src/main/java/com/persagy/functions/weather/thread/HourToDayMaxDataComputeThread.java

@@ -13,7 +13,7 @@ import org.apache.log4j.Logger;
 import com.persagy.ems.pojo.wz.HourRecordData;
 import com.persagy.framework.util.ConfigUtil;
 import com.persagy.framework.util.DateUtils;
-import com.persagy.functions.weather.constant.ConstStaticType;
+import com.persagy.functions.weather.constant.ConstStatisticType;
 import com.persagy.functions.weather.service.DayStaticService;
 import com.persagy.functions.weather.service.HourRecordService;
 
@@ -90,7 +90,7 @@ public class HourToDayMaxDataComputeThread implements Runnable {
 					}
 					
 					try {
-						dayStaticService.restaticHourToDay(cid, dayDate_list, ConstStaticType.Max);
+						dayStaticService.restaticHourToDay(cid, dayDate_list, ConstStatisticType.Max);
 						LOGGER.info("hourDataToDayMaxData, cityNow:" + cindex + "/" + hourCites.size() + ", time:" + DateUtils.date2Str(sdate, "yyyy-MM-dd"));
 					} catch (Exception e) {
 						LOGGER.info("hourDataToDayMaxData Error, City=" + cid + ", msg=" + e.getMessage()); 

BIN
src/main/resources/config/research/CmsBranchPointInfo.xlsx


BIN
src/main/resources/config/research/CmsItemBranch.xlsx


BIN
src/main/resources/config/research/branch.xlsx


BIN
src/main/resources/config/research/calculateUnit.xlsx


BIN
src/main/resources/config/research/energyModel.xlsx


BIN
src/main/resources/config/research/meter.xlsx


BIN
src/main/resources/config/research/pointInfo.xlsx


BIN
src/main/resources/config/research/projectInfo.xlsx


BIN
src/main/resources/config/research/relation.xlsx


BIN
src/main/resources/config/research/researchUse.xlsx


+ 0 - 220
src/main/resources/config/research/survey2.json

@@ -1,220 +0,0 @@
-{
-	"defaultFunctionIdArray": [
-		{
-			"energyType": "1",
-			"funcid": 0
-		}
-	],
-	"projectSign": "4419000001",
-	"reportMeterArray": [
-		{
-			"sign": "2001",
-			"funcid": 0,
-			"dataType": "Acc",
-			"timeType": "1h"
-		},
-		{
-			"sign": "2002",
-			"funcid": 0,
-			"dataType": "Acc",
-			"timeType": "1h"
-		}
-	],
-	"branchArray": [
-		{
-			"sign": "10101",
-			"name": "冷机"
-		},
-		{
-			"sign": "10102",
-			"name": "冷冻泵"
-		},
-		{
-			"sign": "10201",
-			"name": "电梯"
-		},
-		{
-			"sign": "10202",
-			"name": "生活水泵"
-		}
-	],
-	"energyModelArray": [
-		{
-			"sign": "101",
-			"name": "电模型1",
-			"buildingSign": "4419000001001",
-			"energyType": "1",
-			"energyItemArray": [
-				{
-					"sign": "1",
-					"name": "总",
-					"parentSign": null
-				},
-				{
-					"sign": "101",
-					"name": "空调",
-					"parentSign": "1",
-					"formula": "[2001.0]"
-				},
-				{
-					"sign": "102",
-					"name": "动力",
-					"parentSign": "1"
-				},
-				{
-					"sign": "10101",
-					"name": "冷机",
-					"parentSign": "101"
-				},
-				{
-					"sign": "10102",
-					"name": "冷冻泵",
-					"parentSign": "101"
-				},
-				{
-					"sign": "10201",
-					"name": "电梯",
-					"parentSign": "102"
-				},
-				{
-					"sign": "10202",
-					"name": "生活水泵",
-					"parentSign": "102"
-				}
-			]
-		},
-		{
-			"sign": "102",
-			"name": "电模型2",
-			"buildingSign": "4419000001001",
-			"energyType": "1",
-			"energyItemArray": [
-				{
-					"sign": "1",
-					"name": "总",
-					"parentSign": null
-				},
-				{
-					"sign": "101",
-					"name": "空调",
-					"parentSign": "1",
-					"formula": "[2002.0]"
-				},
-				{
-					"sign": "102",
-					"name": "动力",
-					"parentSign": "1"
-				},
-				{
-					"sign": "10101",
-					"name": "冷机",
-					"parentSign": "101"
-				},
-				{
-					"sign": "10102",
-					"name": "冷冻泵",
-					"parentSign": "101"
-				},
-				{
-					"sign": "10201",
-					"name": "电梯",
-					"parentSign": "102"
-				},
-				{
-					"sign": "10202",
-					"name": "生活水泵",
-					"parentSign": "102"
-				}
-			]
-		}
-	],
-	"calculateUnitArray": [
-		{
-			"sign": "10101",
-			"name": "冷机",
-			"calculateUnit2EnergyItemArray": [
-				{
-					"energyModelSign": "101",
-					"energyItemSign": "10101"
-				},
-				{
-					"energyModelSign": "102",
-					"energyItemSign": "10101"
-				}
-			]
-		},
-		{
-			"sign": "10102",
-			"name": "冷冻泵",
-			"calculateUnit2EnergyItemArray": [
-				{
-					"energyModelSign": "101",
-					"energyItemSign": "10102"
-				},
-				{
-					"energyModelSign": "102",
-					"energyItemSign": "10102"
-				}
-			]
-		},
-		{
-			"sign": "10201",
-			"name": "电梯",
-			"calculateUnit2EnergyItemArray": [
-				{
-					"energyModelSign": "101",
-					"energyItemSign": "10201"
-				},
-				{
-					"energyModelSign": "102",
-					"energyItemSign": "10201"
-				}
-			]
-		}
-	],
-	"configUseArray": [
-		{
-			"startDate": "20180101000000",
-			"endDate": "20180201000000",
-			"energyType": "1",
-			"itemArray": [
-				{
-					"branchSign": "10101",
-					"meterSign": "1001",
-					"meterCT": 10.0,
-					"formula": null,
-					"energyModelSign": null,
-					"energyItemSign": null,
-					"calculateUnitSign": "10101"
-				},
-				{
-					"branchSign": "10102",
-					"meterSign": "1002",
-					"meterCT": 10.0,
-					"formula": null,
-					"energyModelSign": null,
-					"energyItemSign": null,
-					"calculateUnitSign": "10102"
-				},
-				{
-					"branchSign": "10201",
-					"meterSign": null,
-					"meterCT": null,
-					"formula": "[1003.0]*10",
-					"energyModelSign": null,
-					"energyItemSign": null,
-					"calculateUnitSign": "10201"
-				},
-				{
-					"branchSign": "10202",
-					"meterSign": null,
-					"meterCT": null,
-					"formula": "[1004.0]*10",
-					"energyModelSign": "101",
-					"energyItemSign": "10202",
-					"calculateUnitSign": null
-				}
-			]
-		}
-	]
-}