|
@@ -4,22 +4,22 @@ import com.welampiot.common.BaseResult;
|
|
|
import com.welampiot.common.InterfaceResultEnum;
|
|
|
import com.welampiot.dto.*;
|
|
|
import com.welampiot.service.*;
|
|
|
+import com.welampiot.utils.ExcelUtil;
|
|
|
import com.welampiot.utils.ToolUtils;
|
|
|
import com.welampiot.vo.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-//import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.text.DecimalFormat;
|
|
|
+import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.time.YearMonth;
|
|
|
+import java.util.*;
|
|
|
|
|
|
@RestController
|
|
|
@CrossOrigin
|
|
@@ -45,6 +45,9 @@ public class DataController {
|
|
|
private ProReviewerService proReviewerService;
|
|
|
@Autowired
|
|
|
private RepairPersonnelService repairPersonnelService;
|
|
|
+ @Autowired
|
|
|
+ private LampInfoCacheByDayService lampInfoCacheByDayService;
|
|
|
+
|
|
|
@RequestMapping(value = "/info",method = RequestMethod.POST)
|
|
|
public BaseResult<InfoResponseVO> info(HttpServletRequest request){
|
|
|
Integer version = request.getParameter("version") == null ? 0 : Integer.parseInt(request.getParameter("version"));
|
|
@@ -244,4 +247,397 @@ public class DataController {
|
|
|
return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,vo);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 能源监控数据
|
|
|
+ * @param request 日期类型
|
|
|
+ * @return 能源监控数据
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/energyMoniData", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> energyMoniData(HttpServletRequest request) throws ParseException {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
+ Integer dateType = (Integer) toolUtils.getRequestContent(request,"dateType",1);
|
|
|
+
|
|
|
+ long l = System.currentTimeMillis();
|
|
|
+ Date date1 = new Date(l);
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date1);
|
|
|
+ int year = calendar.get(Calendar.YEAR); // 获取年份
|
|
|
+ int month = calendar.get(Calendar.MONTH) + 1; // 获取月份
|
|
|
+
|
|
|
+ long startTime;
|
|
|
+ long endTime;
|
|
|
+ String startDate;
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
|
|
|
+ String endDate = simpleDateFormat.format(l);
|
|
|
+ if (dateType == 0) { // 当月
|
|
|
+ if (month < 10) {
|
|
|
+ startDate = year + "-0" + month + "-01";
|
|
|
+ } else {
|
|
|
+ startDate = year + "-" + month + "-01";
|
|
|
+ }
|
|
|
+ startTime = simpleDateFormat.parse(startDate).getTime();
|
|
|
+ endTime = simpleDateFormat.parse(endDate).getTime();
|
|
|
+ } else if (dateType == 1) { // 当年
|
|
|
+ month = 1;
|
|
|
+ startDate = year + "-0" + month + "-01";
|
|
|
+ endDate = simpleDateFormat.format(l);
|
|
|
+ startTime = simpleDateFormat.parse(startDate).getTime();
|
|
|
+ endTime = simpleDateFormat.parse(endDate).getTime();
|
|
|
+ } else if (dateType == 2) { // 具体月份
|
|
|
+ String date = (String) toolUtils.getRequestContent(request, "date", 2);
|
|
|
+ if (date.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_DATE_ERROR, version);
|
|
|
+ List<String> list = Arrays.asList(date.split("-"));
|
|
|
+ int yearNum = Integer.parseInt(list.get(0));
|
|
|
+ int monthNum = Integer.parseInt(list.get(1));
|
|
|
+ int daysInMonth = YearMonth.of(yearNum, monthNum).lengthOfMonth();
|
|
|
+ if (yearNum == year && monthNum == month) {
|
|
|
+ if (month < 10) {
|
|
|
+ startDate = year + "-" + "0" + month + "-01";
|
|
|
+ } else {
|
|
|
+ startDate = year + "-" + month + "-01";
|
|
|
+ }
|
|
|
+ startTime = simpleDateFormat.parse(startDate).getTime();
|
|
|
+ endTime = simpleDateFormat.parse(endDate).getTime();
|
|
|
+ } else if ((yearNum == year && monthNum > month) || (yearNum > year)) {
|
|
|
+ return toolUtils.response(InterfaceResultEnum.DATE_CHOOSE_ERROR,version);
|
|
|
+ } else {
|
|
|
+ startTime = simpleDateFormat.parse(date + "-01").getTime();
|
|
|
+ endTime = simpleDateFormat.parse(date + "-" + daysInMonth).getTime();
|
|
|
+ startDate = simpleDateFormat.format(startTime);
|
|
|
+ endDate = simpleDateFormat.format(endTime);
|
|
|
+ }
|
|
|
+ } else { // 全部
|
|
|
+ startDate = "2020-01-01";
|
|
|
+ startTime = simpleDateFormat.parse(startDate).getTime();
|
|
|
+ endTime = simpleDateFormat.parse(endDate).getTime();
|
|
|
+ month = 1;
|
|
|
+ year = 2020;
|
|
|
+ }
|
|
|
+
|
|
|
+ HashMap<String, Integer> objectObjectHashMap = new HashMap<>();
|
|
|
+ long timeT = startTime;
|
|
|
+ int i = 0;
|
|
|
+ List<Object> dateList = new ArrayList<>();
|
|
|
+ List<Object> valueList1 = new ArrayList<>();
|
|
|
+ List<Object> valueList2 = new ArrayList<>();
|
|
|
+ List<Object> valueList3 = new ArrayList<>();
|
|
|
+ List<Object> valueList4 = new ArrayList<>();
|
|
|
+ List<LampInfoCacheByDayDTO> conSumList;
|
|
|
+ LampInfoCacheByDayDTO dayDTO = new LampInfoCacheByDayDTO();
|
|
|
+ dayDTO.setAreaId(areaId);
|
|
|
+ dayDTO.setSectionId(sectionId);
|
|
|
+ dayDTO.setStartDate(startDate);
|
|
|
+ dayDTO.setEndDate(endDate);
|
|
|
+ dayDTO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+
|
|
|
+ if (dateType == 0 || dateType == 2) { // 当月和具体日期
|
|
|
+ conSumList = lampInfoCacheByDayService.getSectionOfMonthConSum(dayDTO);
|
|
|
+ } else { // 当年和全部
|
|
|
+ conSumList = lampInfoCacheByDayService.getSectionOfYearConSum(dayDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (LampInfoCacheByDayDTO dto1 : conSumList) {
|
|
|
+ if (dto1.getConSum() != null) {
|
|
|
+ float v = Float.parseFloat(dto1.getConSum());
|
|
|
+ String format = decimalFormat.format(v);
|
|
|
+ dto1.setConSum(format);
|
|
|
+ float v1 = v * 0.75f;
|
|
|
+ String format1 = decimalFormat.format(v1);
|
|
|
+ dto1.setEleFree(format1);
|
|
|
+ } else {
|
|
|
+ dto1.setConSum("0");
|
|
|
+ dto1.setEleFree("0");
|
|
|
+ }
|
|
|
+ if (dto1.getPowerSave() != null) {
|
|
|
+ float v = Float.parseFloat(dto1.getPowerSave());
|
|
|
+ String format = decimalFormat.format(v);
|
|
|
+ dto1.setPowerSave(format);
|
|
|
+ float v1 = v * 0.75f;
|
|
|
+ String format1 = decimalFormat.format(v1);
|
|
|
+ dto1.setSaveEleFree(format1);
|
|
|
+ } else {
|
|
|
+ dto1.setPowerSave("0");
|
|
|
+ dto1.setSaveEleFree("0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 折线统计数据
|
|
|
+ if (dateType == 0 || dateType == 2) { // 当月和具体日期
|
|
|
+ while (timeT <= endTime) {
|
|
|
+ objectObjectHashMap.put(simpleDateFormat.format(new Date(timeT)),i);
|
|
|
+ dateList.add(simpleDateFormat.format(new Date(timeT)));
|
|
|
+ valueList1.add(0);
|
|
|
+ valueList2.add(0);
|
|
|
+ valueList3.add(0);
|
|
|
+ valueList4.add(0);
|
|
|
+ timeT += 3600 * 1000 * 24;
|
|
|
+ i ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (LampInfoCacheByDayDTO dto : conSumList) {
|
|
|
+ Date date = new Date(simpleDateFormat.parse(dto.getUpdateTime()).getTime());
|
|
|
+ String s = simpleDateFormat.format(date);
|
|
|
+ Integer integer = null;
|
|
|
+ if (objectObjectHashMap.containsKey(s)) {
|
|
|
+ integer = objectObjectHashMap.get(s);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 用电量和电费
|
|
|
+ if (dto.getConSum() != null && !dto.getConSum().equals("0") && integer != null) {
|
|
|
+ float conSum = Float.parseFloat(dto.getConSum());
|
|
|
+ float eleFree = conSum * 0.75f;
|
|
|
+ String formatConSum = decimalFormat.format(conSum);
|
|
|
+ String formatEleFree = decimalFormat.format(eleFree);
|
|
|
+ valueList1.set(integer, Float.parseFloat(formatConSum)); // 当月和具体月份的用电量折线数据
|
|
|
+ valueList2.set(integer,Float.parseFloat(formatEleFree)); // 当月和具体月份的电费折线数据
|
|
|
+ }
|
|
|
+ // 省电量和省电费
|
|
|
+ if (dto.getPowerSave() != null && !dto.getPowerSave().equals("0") && integer != null) {
|
|
|
+ float powerSave = Float.parseFloat(dto.getPowerSave());
|
|
|
+ float eleFree = powerSave * 0.75f;
|
|
|
+ String formatConSum = decimalFormat.format(powerSave);
|
|
|
+ String formatEleFree = decimalFormat.format(eleFree);
|
|
|
+ valueList3.set(integer, Float.parseFloat(formatConSum)); // 当月和具体月份的用电量折线数据
|
|
|
+ valueList4.set(integer,Float.parseFloat(formatEleFree)); // 当月和具体月份的电费折线数据
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else { // 当年和全部
|
|
|
+ String dateStr;
|
|
|
+ while (timeT <= endTime) {
|
|
|
+ objectObjectHashMap.put(dateFormat.format(new Date(timeT)),i);
|
|
|
+ dateList.add(dateFormat.format(new Date(timeT)));
|
|
|
+ valueList1.add(0);
|
|
|
+ valueList2.add(0);
|
|
|
+ valueList3.add(0);
|
|
|
+ valueList4.add(0);
|
|
|
+ month ++;
|
|
|
+ if (month == 13) {
|
|
|
+ month = 1;
|
|
|
+ year ++;
|
|
|
+ }
|
|
|
+ if (month < 10) {
|
|
|
+ dateStr = year + "-0" + month;
|
|
|
+ } else {
|
|
|
+ dateStr = year + "-" + month;
|
|
|
+ }
|
|
|
+ timeT = dateFormat.parse(dateStr).getTime();
|
|
|
+ i ++;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (LampInfoCacheByDayDTO dto : conSumList) {
|
|
|
+ Date date = new Date(dateFormat.parse(dto.getUpdateTime()).getTime());
|
|
|
+ String s = dateFormat.format(date);
|
|
|
+ dto.setUpdateTime(s);
|
|
|
+ Integer integer = null;
|
|
|
+ if (objectObjectHashMap.containsKey(s)) {
|
|
|
+ integer = objectObjectHashMap.get(s);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 用电量和电费
|
|
|
+ if (dto.getConSum() != null && !dto.getConSum().equals("0") && integer != null) {
|
|
|
+ float conSum = Float.parseFloat(dto.getConSum());
|
|
|
+ float eleFree = conSum * 0.75f;
|
|
|
+ String formatConSum = decimalFormat.format(conSum);
|
|
|
+ String formatEleFree = decimalFormat.format(eleFree);
|
|
|
+ valueList1.set(integer, Float.parseFloat(formatConSum)); // 当年和全部的用电量折线数据
|
|
|
+ valueList2.set(integer,Float.parseFloat(formatEleFree)); // 当年和全部的电费折线数据
|
|
|
+ }
|
|
|
+ // 省电量和省电费
|
|
|
+ if (dto.getPowerSave() != null && !dto.getPowerSave().equals("0") && integer != null) {
|
|
|
+ float powerSave = Float.parseFloat(dto.getPowerSave());
|
|
|
+ float eleFree = powerSave * 0.75f;
|
|
|
+ String formatConSum = decimalFormat.format(powerSave);
|
|
|
+ String formatEleFree = decimalFormat.format(eleFree);
|
|
|
+ valueList3.set(integer, Float.parseFloat(formatConSum)); // 当年和全部的用电量折线数据
|
|
|
+ valueList4.set(integer,Float.parseFloat(formatEleFree)); // 当年和全部的电费折线数据
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ LampInfoCacheByDayDTO dto = lampInfoCacheByDayService.getAreaOrSectionOfConSum(dayDTO);
|
|
|
+ String conSum,powerSave,eleFree,save;
|
|
|
+ if (dto == null) {
|
|
|
+ conSum = "0";
|
|
|
+ powerSave = "0";
|
|
|
+ eleFree = "0";
|
|
|
+ save = "0";
|
|
|
+ } else {
|
|
|
+ conSum = dto.getConSum();
|
|
|
+ powerSave = dto.getPowerSave();
|
|
|
+ conSum = decimalFormat.format(Float.parseFloat(conSum));
|
|
|
+ powerSave = decimalFormat.format(Float.parseFloat(powerSave));
|
|
|
+ eleFree = String.valueOf(Float.parseFloat(conSum) * 0.75f);
|
|
|
+ save = String.valueOf(Float.parseFloat(powerSave) * 0.75f);
|
|
|
+ }
|
|
|
+ List<LampInfoCacheByDayDTO> dataList = lampInfoCacheByDayService.getConSumListBySection(dayDTO);
|
|
|
+ for (LampInfoCacheByDayDTO dto1 : dataList) {
|
|
|
+ if (dto1.getConSum() != null) {
|
|
|
+ float v = Float.parseFloat(dto1.getConSum());
|
|
|
+ String format = decimalFormat.format(v);
|
|
|
+ dto1.setConSum(format);
|
|
|
+ float v1 = v * 0.75f;
|
|
|
+ String format1 = decimalFormat.format(v1);
|
|
|
+ dto1.setEleFree(format1);
|
|
|
+ } else {
|
|
|
+ dto1.setConSum("0");
|
|
|
+ dto1.setEleFree("0");
|
|
|
+ }
|
|
|
+ if (dto1.getPowerSave() != null) {
|
|
|
+ float v = Float.parseFloat(dto1.getPowerSave());
|
|
|
+ String format = decimalFormat.format(v);
|
|
|
+ dto1.setPowerSave(format);
|
|
|
+ float v1 = v * 0.75f;
|
|
|
+ String format1 = decimalFormat.format(v1);
|
|
|
+ dto1.setSaveEleFree(format1);
|
|
|
+ } else {
|
|
|
+ dto1.setPowerSave("0");
|
|
|
+ dto1.setSaveEleFree("0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ LampInfoCacheByDayVO lampInfoCacheByDayVO = new LampInfoCacheByDayVO();
|
|
|
+ lampInfoCacheByDayVO.setSaveEleFree(save);
|
|
|
+ lampInfoCacheByDayVO.setTotalEleFree(eleFree);
|
|
|
+ lampInfoCacheByDayVO.setTotalConSum(conSum);
|
|
|
+ lampInfoCacheByDayVO.setTotalPowerSave(powerSave);
|
|
|
+ lampInfoCacheByDayVO.setConSumList(valueList1);
|
|
|
+ lampInfoCacheByDayVO.setEleFreeList(valueList2);
|
|
|
+ lampInfoCacheByDayVO.setPowerSaveList(valueList3);
|
|
|
+ lampInfoCacheByDayVO.setSaveEleFreeList(valueList4);
|
|
|
+ lampInfoCacheByDayVO.setUpdateTimeList(dateList);
|
|
|
+ lampInfoCacheByDayVO.setDataList(dataList);
|
|
|
+ lampInfoCacheByDayVO.setList(conSumList);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampInfoCacheByDayVO);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出列表数据
|
|
|
+ * @param request 日期类型
|
|
|
+ * @return 导出列表数据
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/inputEnergyMoniData", method = RequestMethod.POST)
|
|
|
+ public BaseResult<?> inputEnergyMoniData(HttpServletRequest request) throws ParseException {
|
|
|
+ Integer version = (Integer) toolUtils.getRequestContent(request,"version",1);
|
|
|
+ Integer areaId = (Integer) toolUtils.getRequestContent(request,"areaId",1);
|
|
|
+ Integer sectionId = (Integer) toolUtils.getRequestContent(request,"sectionId",1);
|
|
|
+ Integer dateType = (Integer) toolUtils.getRequestContent(request,"dateType",1);
|
|
|
+
|
|
|
+ long l = System.currentTimeMillis();
|
|
|
+ Date date1 = new Date(l);
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(date1);
|
|
|
+ int year = calendar.get(Calendar.YEAR); // 获取年份
|
|
|
+ int month = calendar.get(Calendar.MONTH) + 1; // 获取月份
|
|
|
+
|
|
|
+ long startTime;
|
|
|
+ long endTime;
|
|
|
+ String startDate;
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("0.00");
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ String endDate = simpleDateFormat.format(l);
|
|
|
+ if (dateType == 0) { // 当月
|
|
|
+ if (month < 10) {
|
|
|
+ startDate = year + "-0" + month + "-01";
|
|
|
+ } else {
|
|
|
+ startDate = year + "-" + month + "-01";
|
|
|
+ }
|
|
|
+ } else if (dateType == 1) { // 当年
|
|
|
+ month = 1;
|
|
|
+ startDate = year + "-0" + month + "-01";
|
|
|
+ endDate = simpleDateFormat.format(l);
|
|
|
+ } else if (dateType == 2) { // 具体月份
|
|
|
+ String date = (String) toolUtils.getRequestContent(request, "date", 2);
|
|
|
+ if (date.length() == 0) return toolUtils.response(InterfaceResultEnum.LACK_DATE_ERROR, version);
|
|
|
+ List<String> list = Arrays.asList(date.split("-"));
|
|
|
+ int yearNum = Integer.parseInt(list.get(0));
|
|
|
+ int monthNum = Integer.parseInt(list.get(1));
|
|
|
+ int daysInMonth = YearMonth.of(yearNum, monthNum).lengthOfMonth();
|
|
|
+ if (yearNum == year && monthNum == month) {
|
|
|
+ if (month < 10) {
|
|
|
+ startDate = year + "-" + "0" + month + "-01";
|
|
|
+ } else {
|
|
|
+ startDate = year + "-" + month + "-01";
|
|
|
+ }
|
|
|
+ } else if ((yearNum == year && monthNum > month) || (yearNum > year)) {
|
|
|
+ return toolUtils.response(InterfaceResultEnum.DATE_CHOOSE_ERROR,version);
|
|
|
+ } else {
|
|
|
+ startTime = simpleDateFormat.parse(date + "-01").getTime();
|
|
|
+ endTime = simpleDateFormat.parse(date + "-" + daysInMonth).getTime();
|
|
|
+ startDate = simpleDateFormat.format(startTime);
|
|
|
+ endDate = simpleDateFormat.format(endTime);
|
|
|
+ }
|
|
|
+ } else { // 全部
|
|
|
+ startDate = "2020-01-01";
|
|
|
+ }
|
|
|
+ List<LampInfoCacheByDayDTO> conSumList;
|
|
|
+ LampInfoCacheByDayDTO dayDTO = new LampInfoCacheByDayDTO();
|
|
|
+ dayDTO.setAreaId(areaId);
|
|
|
+ dayDTO.setSectionId(sectionId);
|
|
|
+ dayDTO.setStartDate(startDate);
|
|
|
+ dayDTO.setEndDate(endDate);
|
|
|
+ dayDTO.setSectionList(toolUtils.getSectionList(request));
|
|
|
+
|
|
|
+ if (dateType == 0 || dateType == 2) { // 当月和具体日期
|
|
|
+ conSumList = lampInfoCacheByDayService.getSectionOfMonthConSum(dayDTO);
|
|
|
+ } else { // 当年和全部
|
|
|
+ conSumList = lampInfoCacheByDayService.getSectionOfYearConSum(dayDTO);
|
|
|
+ }
|
|
|
+
|
|
|
+ for (LampInfoCacheByDayDTO dto1 : conSumList) {
|
|
|
+ if (dto1.getConSum() != null) {
|
|
|
+ float v = Float.parseFloat(dto1.getConSum());
|
|
|
+ String format = decimalFormat.format(v);
|
|
|
+ dto1.setConSum(format);
|
|
|
+ float v1 = v * 0.75f;
|
|
|
+ String format1 = decimalFormat.format(v1);
|
|
|
+ dto1.setEleFree(format1);
|
|
|
+ } else {
|
|
|
+ dto1.setConSum("0");
|
|
|
+ dto1.setEleFree("0");
|
|
|
+ }
|
|
|
+ if (dto1.getPowerSave() != null) {
|
|
|
+ float v = Float.parseFloat(dto1.getPowerSave());
|
|
|
+ String format = decimalFormat.format(v);
|
|
|
+ dto1.setPowerSave(format);
|
|
|
+ float v1 = v * 0.75f;
|
|
|
+ String format1 = decimalFormat.format(v1);
|
|
|
+ dto1.setSaveEleFree(format1);
|
|
|
+ } else {
|
|
|
+ dto1.setPowerSave("0");
|
|
|
+ dto1.setSaveEleFree("0");
|
|
|
+ }
|
|
|
+ if (dateType == 1 || dateType == 3) {
|
|
|
+ String dateTime = dto1.getDateTime();
|
|
|
+ dto1.setUpdateTime(dateTime);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String title;
|
|
|
+ if (version == 0) {
|
|
|
+ title = "用电量,省电量,电费,节省电费,更新时间";
|
|
|
+ } else if (version == 1) {
|
|
|
+ title = "Electricity Consumption,Electricity Saving,Electricity Cost,Electricity Saving,Update Time";
|
|
|
+ } else {
|
|
|
+ title = "Потребление электроэнергии,экономия электроэнергии,экономия электричества,время обновления";
|
|
|
+ }
|
|
|
+ List<String> titleList = Arrays.asList(title.split(","));
|
|
|
+ List<List<String>> contentList = new ArrayList<>();
|
|
|
+ for (LampInfoCacheByDayDTO dto : conSumList) {
|
|
|
+ List<String> newString = new ArrayList<>();
|
|
|
+ newString.add(0,dto.getConSum());
|
|
|
+ newString.add(1,dto.getPowerSave());
|
|
|
+ newString.add(2,dto.getEleFree());
|
|
|
+ newString.add(3,dto.getSaveEleFree());
|
|
|
+ newString.add(4,dto.getUpdateTime());
|
|
|
+ contentList.add(conSumList.indexOf(dto),newString);
|
|
|
+ }
|
|
|
+ String path = ExcelUtil.outExcel(titleList, contentList);
|
|
|
+ LampInfoCacheByDayVO lampInfoCacheByDayVO = new LampInfoCacheByDayVO();
|
|
|
+ lampInfoCacheByDayVO.setPath(path);
|
|
|
+ return toolUtils.response(InterfaceResultEnum.OPERATION_SUCCESS,version,lampInfoCacheByDayVO);
|
|
|
+ }
|
|
|
}
|