ZHGYL_GKPT 4 年 前
コミット
a5fc1e7b2f

+ 16 - 9
src/main/java/com/minpay/common/service/impl/ReportServiceImpl.java

@@ -911,9 +911,9 @@ public class ReportServiceImpl implements IReportService {
 		param.put("yesterday", rangeArray[1]);
 		param.put("yesterday", rangeArray[1]);
 		List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
 		List<Map<String, String>> yesterdayList = db.getMybatisMapper(ReportServiceMapper.class).queryYesterdayDetail(param);
 
 
-		param.put("yesterdayDetail", yesterdayList);
 		List<Map<String, String>> yesterdayAndTDData = null;
 		List<Map<String, String>> yesterdayAndTDData = null;
 		if (yesterdayList.size() != 0) {
 		if (yesterdayList.size() != 0) {
+			param.put("yesterdayDetail", yesterdayList);
 			yesterdayAndTDData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
 			yesterdayAndTDData = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
 		} else {
 		} else {
 			yesterdayAndTDData = new ArrayList<Map<String, String>>();
 			yesterdayAndTDData = new ArrayList<Map<String, String>>();
@@ -1325,9 +1325,10 @@ public class ReportServiceImpl implements IReportService {
 				liangyueMostAddressNumDesc += addressName + "、";
 				liangyueMostAddressNumDesc += addressName + "、";
 			}
 			}
 		}
 		}
-		// 去除最后一个符号
-		liangyueMostAddressNumDesc = liangyueMostAddressNumDesc.substring(0, liangyueMostAddressNumDesc.length() - 1);
-
+		if(!"".equals(liangyueMostAddressNumDesc)){
+			// 去除最后一个符号
+			liangyueMostAddressNumDesc = liangyueMostAddressNumDesc.substring(0, liangyueMostAddressNumDesc.length() - 1);
+		}
 		// 环比
 		// 环比
 		String huanbi = "0";
 		String huanbi = "0";
 		String huanbiBegin = DateUtil.dateAddMonth(rangeArray[0], -2);		// 环比周开始时间
 		String huanbiBegin = DateUtil.dateAddMonth(rangeArray[0], -2);		// 环比周开始时间
@@ -1723,8 +1724,9 @@ public class ReportServiceImpl implements IReportService {
 		for (Map.Entry<String, Integer> entry : taiQuMapTwice.entrySet()) {
 		for (Map.Entry<String, Integer> entry : taiQuMapTwice.entrySet()) {
 			totalCountTwiceDesc += entry.getKey() + entry.getValue()+"台,占比"+CommonUtil.multiply(CommonUtil.divide(entry.getValue().toString(), totalCountTwice, 4), "100", 2)+"%;";
 			totalCountTwiceDesc += entry.getKey() + entry.getValue()+"台,占比"+CommonUtil.multiply(CommonUtil.divide(entry.getValue().toString(), totalCountTwice, 4), "100", 2)+"%;";
 		}
 		}
-		totalCountTwiceDesc = totalCountTwiceDesc.substring(0,totalCountTwiceDesc.length() - 1) + "。";
-
+		if(!"".equals(totalCountTwiceDesc)){
+			totalCountTwiceDesc = totalCountTwiceDesc.substring(0,totalCountTwiceDesc.length() - 1) + "。";
+		}
 		Map<String, Integer> countMapTwice = new HashMap<String, Integer>();
 		Map<String, Integer> countMapTwice = new HashMap<String, Integer>();
 		for (Map<String, String> map : twiceMountCountList) {
 		for (Map<String, String> map : twiceMountCountList) {
 			String num = map.get("num");
 			String num = map.get("num");
@@ -1739,8 +1741,9 @@ public class ReportServiceImpl implements IReportService {
 		for (Map.Entry<String, Integer> entry : countMapTwice.entrySet()) {
 		for (Map.Entry<String, Integer> entry : countMapTwice.entrySet()) {
 			countMapTwiceDesc += "停电" + entry.getKey() + "次的" + entry.getValue() + "台,占比" + CommonUtil.multiply(CommonUtil.divide(entry.getValue().toString(), totalCountTwice, 4), "100", 2)+"%;";
 			countMapTwiceDesc += "停电" + entry.getKey() + "次的" + entry.getValue() + "台,占比" + CommonUtil.multiply(CommonUtil.divide(entry.getValue().toString(), totalCountTwice, 4), "100", 2)+"%;";
 		}
 		}
-		countMapTwiceDesc = countMapTwiceDesc.substring(0,countMapTwiceDesc.length() - 1) + "。";
-
+		if(!"".equals(countMapTwiceDesc)){
+			countMapTwiceDesc = countMapTwiceDesc.substring(0,countMapTwiceDesc.length() - 1) + "。";
+		}
 		// 两个月内停电3次以上的数据
 		// 两个月内停电3次以上的数据
 		param.put("countNum", "3");
 		param.put("countNum", "3");
 		List<Map<String, String>> thipleMountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
 		List<Map<String, String>> thipleMountCountList = db.getMybatisMapper(ReportServiceMapper.class).selectMountCount00(param);
@@ -2056,7 +2059,11 @@ public class ReportServiceImpl implements IReportService {
 		resMap.put("count", rows.getCount());
 		resMap.put("count", rows.getCount());
 		//取所有用户ID
 		//取所有用户ID
 		List<String> yhidList = CommonUtil.getIdFromList(DDYZLFXBList, "yhid");
 		List<String> yhidList = CommonUtil.getIdFromList(DDYZLFXBList, "yhid");
-
+		//如果用户ID为空,添加默认用户XXXXXXXX
+		if(yhidList == null || yhidList.isEmpty()){
+			yhidList = new ArrayList<String>();
+			yhidList.add("XXXXXXXX");
+		}
 		DwFileDetail03Example example03 = new DwFileDetail03Example();
 		DwFileDetail03Example example03 = new DwFileDetail03Example();
 		example03.createCriteria().andSjrqBetween(beginTime, endTime).andYhidIn(yhidList);
 		example03.createCriteria().andSjrqBetween(beginTime, endTime).andYhidIn(yhidList);
 		example03.setOrderByClause("DFD3_YHID,DFD3_SJRQ desc");
 		example03.setOrderByClause("DFD3_YHID,DFD3_SJRQ desc");

+ 4 - 2
src/main/java/com/minpay/dianwang/util/ReportExcelUtil.java

@@ -71,8 +71,10 @@ public class ReportExcelUtil {
 			  row.setHeight((short)1000);
 			  row.setHeight((short)1000);
 			  HSSFCell dataCell = row.createCell(0);
 			  HSSFCell dataCell = row.createCell(0);
 			  dataCell.setCellValue(reportDesc);
 			  dataCell.setCellValue(reportDesc);
-			  CellRangeAddress region = new CellRangeAddress(0, 0, 0, dataList.get(0).size() - 1);
-			  sheet.addMergedRegion(region);
+			  if( dataList!= null && dataList.size() > 0){
+				  CellRangeAddress region = new CellRangeAddress(0, 0, 0, dataList.get(0).size() - 1);
+				  sheet.addMergedRegion(region);
+			  }
 			  index ++;
 			  index ++;
 		  }
 		  }
 		  for (Object dataChild : dataList) {
 		  for (Object dataChild : dataList) {

+ 42 - 15
src/main/java/com/minpay/reportManage/action/ReportManageAction.java

@@ -14,6 +14,7 @@ import java.util.Map;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 
 
+import com.alibaba.fastjson.JSON;
 import com.minpay.common.util.StringUtil;
 import com.minpay.common.util.StringUtil;
 import com.minpay.db.table.mapper.*;
 import com.minpay.db.table.mapper.*;
 import com.minpay.db.table.model.*;
 import com.minpay.db.table.model.*;
@@ -396,22 +397,45 @@ public class ReportManageAction implements IMINAction {
 		DwBranchReportType branchReportType = db.selectByPrimaryKey(DwBranchReportTypeMapper.class, reportInf.getType());
 		DwBranchReportType branchReportType = db.selectByPrimaryKey(DwBranchReportTypeMapper.class, reportInf.getType());
 
 
 		DwReportData reportDataInf = db.selectByPrimaryKey(DwReportDataMapper.class, reportId);
 		DwReportData reportDataInf = db.selectByPrimaryKey(DwReportDataMapper.class, reportId);
-
-		Map<String, Object> dataJSONMap = JSONObject.fromObject(reportDataInf.getData());
-		List<List<String>> dataList = (List<List<String>>)dataJSONMap.get("excelList");
-
-		String descStr = (String)dataJSONMap.get("descStr");
-		descStr = descStr.replaceAll("<p>", "");
-		descStr = descStr.replaceAll("</p>", System.getProperty("line.separator"));
-		if (dataJSONMap.get("dataMap") != null) {
-			Map<String, Object> dataMap = (Map<String, Object>)dataJSONMap.get("dataMap");
-			for(Map.Entry<String, Object> entry : dataMap.entrySet()){
-				String mapKey = entry.getKey();
-				Object mapValue = entry.getValue();
-				descStr = descStr.replaceAll("\\$\\{" + mapKey + "\\}", String.valueOf(mapValue));
+		Map<String, Object> dataJSONMap = new HashMap<String,Object>();
+		List<List<String>> dataList = new ArrayList<List<String>>();
+		String descStr = "";
+		try {
+			dataJSONMap = JSONObject.fromObject(reportDataInf.getData());//数据格式不对应
+			dataList =  (List<List<String>>)dataJSONMap.get("excelList");
+			descStr = (String)dataJSONMap.get("descStr");
+			descStr = descStr.replaceAll("<p>", "");
+			descStr = descStr.replaceAll("</p>", System.getProperty("line.separator"));
+			if (dataJSONMap.get("dataMap") != null) {
+				Map<String, Object> dataMap = (Map<String, Object>)dataJSONMap.get("dataMap");
+				for(Map.Entry<String, Object> entry : dataMap.entrySet()){
+					String mapKey = entry.getKey();
+					Object mapValue = entry.getValue();
+					descStr = descStr.replaceAll("\\$\\{" + mapKey + "\\}", String.valueOf(mapValue));
+				}
+			}
+		} catch (Exception e){
+			try {
+				String[][] temp = JSON.parseObject(reportDataInf.getData(),String[][].class);
+				String[] temp2 = null;
+				List<String> tempList = null;
+				if (temp != null) {
+					for (int i = 0; i < temp.length; i++) {
+						tempList = new ArrayList<String>();
+						temp2 = temp[i];
+						for (int j = 0; j < temp2.length; j++) {
+							tempList.add(temp2[j]);
+						}
+						dataList.add(tempList);
+					}
+				}
+			} catch (Exception ee){
+				dataList = new ArrayList<List<String>>();
 			}
 			}
 		}
 		}
-
+		if( dataList == null){
+			dataList = new ArrayList<List<String>>();
+		}
 		// excel类型
 		// excel类型
 		if ("00".equals(branchReportType.getType())) {
 		if ("00".equals(branchReportType.getType())) {
 			//导出Excel
 			//导出Excel
@@ -637,7 +661,10 @@ public class ReportManageAction implements IMINAction {
 		List<DwDdyFxb> ddyFxbList = db.selectByExample(DwDdyFxbMapper.class, ddyFxbExample, rows);
 		List<DwDdyFxb> ddyFxbList = db.selectByExample(DwDdyFxbMapper.class, ddyFxbExample, rows);
 
 
 		List<String> fxbIdList = CommonUtil.getIdFromList(ddyFxbList, "id");
 		List<String> fxbIdList = CommonUtil.getIdFromList(ddyFxbList, "id");
-
+		if(fxbIdList == null || fxbIdList.isEmpty()){
+			fxbIdList = new ArrayList<String>();
+			fxbIdList.add("XXXXXXXX");
+		}
 		DwDdyFxbDetailExample ddyFxbDetailExample = new DwDdyFxbDetailExample();
 		DwDdyFxbDetailExample ddyFxbDetailExample = new DwDdyFxbDetailExample();
 		ddyFxbDetailExample.createCriteria().andFxbIdIn(fxbIdList);
 		ddyFxbDetailExample.createCriteria().andFxbIdIn(fxbIdList);
 		ddyFxbDetailExample.setOrderByClause("DDFD_FXB_ID");
 		ddyFxbDetailExample.setOrderByClause("DDFD_FXB_ID");

+ 8 - 2
src/main/java/com/minpay/reportManage/action/XlgzzReportAction.java

@@ -193,7 +193,8 @@ public class XlgzzReportAction implements IMINAction {
 
 
     @MINAction(value = REPORT_NEED_DATA_DETAIL2)
     @MINAction(value = REPORT_NEED_DATA_DETAIL2)
     public MINActionResult reportNeedDataDetail2(
     public MINActionResult reportNeedDataDetail2(
-            @MINParam(key = "reportId") String reportId
+            @MINParam(key = "reportId") String reportId,
+            @MINParam(key = "reportType") String reportType
     ) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InvalidFormatException, IOException {
     ) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InvalidFormatException, IOException {
         MINActionResult res = new MINActionResult();
         MINActionResult res = new MINActionResult();
         db = Service.lookup(IMINDataBaseService.class);
         db = Service.lookup(IMINDataBaseService.class);
@@ -201,7 +202,12 @@ public class XlgzzReportAction implements IMINAction {
         // 报表类型id
         // 报表类型id
         Map<String, Object> param = new HashMap<String, Object>();
         Map<String, Object> param = new HashMap<String, Object>();
         param.put("reportId", reportId);
         param.put("reportId", reportId);
-        param.put("reportTypeId","XLGZZRB");
+        param.put("reportTypeId",reportType);
+        if("XLGZZRB".equals(reportType)){
+            param.put("timeType","00");
+        }else{
+            param.put("timeType","01");
+        }
         String fileName = "";
         String fileName = "";
         List<Map<String,String>> list = db.getMybatisMapper(IReportBatchMapper.class).selectReportInfo(param);
         List<Map<String,String>> list = db.getMybatisMapper(IReportBatchMapper.class).selectReportInfo(param);
         if(list != null && !list.isEmpty()){
         if(list != null && !list.isEmpty()){

+ 1 - 1
src/main/resources/com/minpay/db/table/own/mapper/ReportBatchMapper.xml

@@ -155,7 +155,7 @@
         WHERE
         WHERE
             A.DRI_STATE = '0'
             A.DRI_STATE = '0'
             AND A.DRI_TYPE = B.DBRT_ID
             AND A.DRI_TYPE = B.DBRT_ID
-            AND B.DBRT_TIME_TYPE = '00'
+            AND B.DBRT_TIME_TYPE = #{timeType}
             AND B.DBRT_ID = #{reportTypeId}
             AND B.DBRT_ID = #{reportTypeId}
             AND DRI_ID = #{reportId}
             AND DRI_ID = #{reportId}
     </select>
     </select>

+ 1 - 1
src/main/webapp/admin/ddy/reportManageDdy.html

@@ -54,7 +54,7 @@
 			"<i class='iconfont up iconSelect_drop-down'/></i>");
 			"<i class='iconfont up iconSelect_drop-down'/></i>");
 		$("#content").slideToggle();
 		$("#content").slideToggle();
 	});
 	});
-	var pageId = "240000";
+	var pageId = "250000";
 	// 报表类型
 	// 报表类型
 	var reportType = getQueryString("reportType")
 	var reportType = getQueryString("reportType")
 	
 	

+ 1 - 1
src/main/webapp/admin/ddy/reportManageDdyRb.html

@@ -53,7 +53,7 @@
 			"<i class='iconfont up iconSelect_drop-down'/></i>");
 			"<i class='iconfont up iconSelect_drop-down'/></i>");
 		$("#content").slideToggle();
 		$("#content").slideToggle();
 	});
 	});
-	var pageId = "240000";
+	var pageId = "250001";
 	// 报表类型
 	// 报表类型
 	var reportType = getQueryString("reportType")
 	var reportType = getQueryString("reportType")
 	
 	

+ 1 - 0
src/main/webapp/admin/ddy/reportProduceDdy.html

@@ -86,6 +86,7 @@
 	
 	
     <script>
     <script>
 		var pageId = getQueryString("pageId");
 		var pageId = getQueryString("pageId");
+		alert(pageId)
 		var reportType = getQueryString("reportType");// 00日报01周报02月报
 		var reportType = getQueryString("reportType");// 00日报01周报02月报
 		
 		
 		var $step;
 		var $step;

+ 18 - 9
src/main/webapp/admin/reprotManage/dataWareDetail.html

@@ -35,15 +35,24 @@
 	// 终端投托运
 	// 终端投托运
 	} else if ("1000002" == fileType) {
 	} else if ("1000002" == fileType) {
 		cols = [[ 
 		cols = [[ 
-			      {field: 'excelId', title: 'ID'}
-			      ,{field: 'excelTname', title: 'TNAME'}
-			      ,{field: 'excelCmode', title: 'CMODE'}
-			      ,{field: 'excelValue', title: 'VALUE'}
-			      ,{field: 'excelFacname', title: 'facname'}
-			      ,{field: 'excelType', title: 'type'}
-			      ,{field: 'excelFdid', title: 'fdid'}
-			      ,{field: 'excelYxstatus', title: 'yxstatus'}
-			      ,{field: 'excelTytime', title: 'tytime'}
+			      // {field: 'excelId', title: 'ID'}
+			      // ,{field: 'excelTname', title: 'TNAME'}
+			      // ,{field: 'excelCmode', title: 'CMODE'}
+			      // ,{field: 'excelValue', title: 'VALUE'}
+			      // ,{field: 'excelFacname', title: 'facname'}
+			      // ,{field: 'excelType', title: 'type'}
+			      // ,{field: 'excelFdid', title: 'fdid'}
+			      // ,{field: 'excelYxstatus', title: 'yxstatus'}
+			      // ,{field: 'excelTytime', title: 'tytime'}
+                {field: 'excelId', title: '编号'}
+                ,{field: 'excelTname', title: '名称'}
+                ,{field: 'excelCmode', title: '台区名称'}
+                ,{field: 'excelValue', title: '数据日期'}
+                ,{field: 'excelFacname', title: '单位'}
+                ,{field: 'excelType', title: '供电所名称'}
+                ,{field: 'excelFdid', title: '终端名称'}
+                ,{field: 'excelYxstatus', title: '终端编号'}
+                ,{field: 'excelTytime', title: '时间'}
 			    ]];
 			    ]];
 	} else if ("1000003" == fileType) {
 	} else if ("1000003" == fileType) {
 		cols = [[ 
 		cols = [[ 

+ 5 - 1
src/main/webapp/admin/tqtd/reportManageTqtd.html

@@ -58,7 +58,11 @@
 	var reportType = getQueryString("reportType")
 	var reportType = getQueryString("reportType")
 	
 	
 	var timeType = getQueryString("timeType");// 00日报01周报02月报
 	var timeType = getQueryString("timeType");// 00日报01周报02月报
-	
+	if(timeType == "01"){
+		pageId = "220001";
+	} else if(timeType == "02"){
+		pageId = "220002";
+	}
      var table;
      var table;
      var form;
      var form;
      layui.use(['table','laydate','form'], function(){
      layui.use(['table','laydate','form'], function(){

+ 3 - 3
src/main/webapp/admin/xlgzz/reportManageDetailXlgzz.html

@@ -71,8 +71,7 @@
         var type = getQueryString("type");				//报告类型00:excel 01:word
         var type = getQueryString("type");				//报告类型00:excel 01:word
         var typeId = getQueryString("typeId");			//报告类型id XLGZZRB
         var typeId = getQueryString("typeId");			//报告类型id XLGZZRB
         var reportType = getQueryString("reportType");	//报告类型 XLGZZRB
         var reportType = getQueryString("reportType");	//报告类型 XLGZZRB
-        var $element;
-        var $table;
+        var $element,$table;
         $("#fileName").text(fileName);
         $("#fileName").text(fileName);
         layui.use(['element','table'], function(){
         layui.use(['element','table'], function(){
             $element= layui.element;
             $element= layui.element;
@@ -85,7 +84,8 @@
             $.request({
             $.request({
                 action : 'XlgzzReportAction/reportNeedDataDetail2',
                 action : 'XlgzzReportAction/reportNeedDataDetail2',
                 data : {
                 data : {
-                    reportId : reportId
+                    reportId : reportId,
+                    reportType:reportType
                 },
                 },
                 success : function(data) {
                 success : function(data) {
                     if (data.code == 0) {//查询结果集成功
                     if (data.code == 0) {//查询结果集成功