郎学彬 пре 5 година
родитељ
комит
d0d06a0600

+ 4 - 0
src/main/java/com/minpay/common/constant/Constant.java

@@ -330,6 +330,10 @@ public class Constant implements IMINBusinessConstant{
 	 * 报表类型  DDYZLFXB 低电压成效分析表
 	 */
 	public static final String REPORT_TYPE_05 = "DDYZLFXB";
+	/**
+	 * 报表类型  DDYRB 低电压日报
+	 */
+	public static final String REPORT_TYPE_06 = "DDYRB";
 	
 	/**
 	 * 原始文件状态 0正常

+ 172 - 1
src/main/java/com/minpay/common/service/impl/ReportServiceImpl.java

@@ -33,6 +33,9 @@ import com.startup.minpay.frame.target.MINComponent;
 @MINComponent
 public class ReportServiceImpl implements IReportService {
 	static Map<String, String> totalMap = new HashMap<String, String>();
+	
+	//各区客户数
+	static Map<String, String> customerMap = new HashMap<String, String>();
 	// 台区停电停电时长
 	static List<Map<String, String>> fenduanList = new ArrayList<Map<String, String>>();
 	static {
@@ -46,6 +49,17 @@ public class ReportServiceImpl implements IReportService {
 		totalMap.put("gaoxin", "1945");
 		totalMap.put("heji", "38824");
 		
+		//客户数
+		customerMap.put("xintai", "593100");
+		customerMap.put("daiyue", "323455");
+		customerMap.put("ningyang", "301682");
+		customerMap.put("taishan", "376298");
+		customerMap.put("dongping", "298683");
+		customerMap.put("feicheng", "375994");
+		customerMap.put("jingqu", "120623");
+		customerMap.put("gaoxin", "162627");
+		customerMap.put("heji", "2552462");
+		
 		// 0-1小时
 		Map<String, String> map0To60 = new HashMap<String, String>();
 		map0To60.put("start", "0");
@@ -88,6 +102,7 @@ public class ReportServiceImpl implements IReportService {
 		String secondFileId = param.get("secondFileId");
 		String FADateRange = param.get("FADateRange");
 		String yearChoose = param.get("yearChoose");
+		String DdyDateRange = param.get("DdyDateRange");
 		
 		Map<String, Object> resMap = new HashMap<String, Object>();
     	// 台区停电日报
@@ -112,10 +127,14 @@ public class ReportServiceImpl implements IReportService {
     	} else if (Constant.REPORT_TYPE_04.equals(reportTypeId)) {
     		List<List<String>> resList = reportTypeFADZBB(FADateRange, yearChoose);
     		resMap.put("resList", resList);
-    		//低电压
+    		//低电压分析表
     	}else if(Constant.REPORT_TYPE_05.equals(reportTypeId)){
     		List<List<String>> resList = reportTypeDDYZLFXB(range, reportTypeId);
     		resMap.put("resList", resList);
+    	//低电压日报	
+    	}else if(Constant.REPORT_TYPE_06.equals(reportTypeId)){
+    		List<List<String>> resList = reportTypeDDYRB(DdyDateRange,yearChoose,range, reportTypeId);
+    		resMap.put("resList", resList);
     	}
 		return resMap;
 	}
@@ -1374,4 +1393,156 @@ public class ReportServiceImpl implements IReportService {
 		
 		return resList;
 	}
+	/**
+	 * 低电压日报
+	 * @param range
+	 * @param reportTypeId
+	 * @return
+	 * @throws MINBusinessException
+	 * @throws ParseException
+	 */
+	public List<List<String>> reportTypeDDYRB(String DdyDateRange, String yearChoose,String range, String reportTypeId) throws MINBusinessException, ParseException{
+		IMINDataBaseService db = Service.lookup(IMINDataBaseService.class);
+		List<List<String>> resList = new ArrayList<List<String>>();
+		List<String> titleList = new ArrayList<String>();
+		Date beginTimeDate = DateUtil.parseDate(yearChoose + DdyDateRange.substring(0, 4), "yyyyMMdd");
+		String beginTime = DateUtil.format(beginTimeDate, "yyyyMMdd");
+		String endTime = yearChoose + DdyDateRange.substring(4, 8);
+		// 开始月份是12,年份取下一年
+		if ("12".equals(beginTime.substring(0, 2))) {
+			endTime = CommonUtil.add(yearChoose, "1") + DdyDateRange.substring(4, 8);
+		}
+		Map<String, String> countMap = new HashMap<String, String>();
+		countMap.put("xintai", "0");
+		countMap.put("daiyue", "0");
+		countMap.put("ningyang", "0");
+		countMap.put("taishan", "0");
+		countMap.put("dongping", "0");
+		countMap.put("feicheng", "0");
+		countMap.put("taishanjingqu", "0");
+		countMap.put("gaoxin", "0");
+		countMap.put("heji", "0");
+		
+		List<String> title = new ArrayList<String>();
+
+		//标题
+		List<String> childList0 = new ArrayList<String>();
+		childList0.add("分类\\单位");
+		childList0.add("岱岳");
+		childList0.add("新泰");
+		childList0.add("高新");
+		childList0.add("泰山");
+		childList0.add("宁阳");
+		childList0.add("景区");
+		childList0.add("东平");
+		childList0.add("肥城");
+		childList0.add("合计");
+//		resList.add(childList0);
+		//客户总数
+		List<String> childList1 = new ArrayList<String>();
+		childList1.add("客户总数");
+		childList1.add(customerMap.get("daiyue"));
+		childList1.add(customerMap.get("xintai"));
+		childList1.add(customerMap.get("gaoxin"));
+		childList1.add(customerMap.get("taishan"));
+		childList1.add(customerMap.get("ningyang"));
+		childList1.add(customerMap.get("jingqu"));
+		childList1.add(customerMap.get("dongping"));
+		childList1.add(customerMap.get("feicheng"));
+		childList1.add(customerMap.get("heji"));
+//		resList.add(childList1);
+		//低电压客户数
+		List<String> childList2 = new ArrayList<String>();
+		childList2.add("低电压客户数");
+		for(String name:childList0){
+			if("分类\\单位".equals(name)){
+				continue;
+			}
+			DwFileDetail03Example example03 = new DwFileDetail03Example();
+			
+			if("合计".equals(name)){
+				example03.createCriteria().andSjrqBetween(beginTime, endTime);
+			}else{
+				example03.createCriteria().andSjrqBetween(beginTime, endTime).andXgsmcLike(name+"%");
+			}
+			
+			List<DwFileDetail03> DateList = db.selectByExample(DwFileDetail03Mapper.class, example03);
+			childList2.add(DateList.size()+"");
+		}
+//		resList.add(childList2);
+		//低电压客户占比
+		List<String> childList3 = new ArrayList<String>();
+		childList3.add("低电压客户占比");
+		for(int i=1;i<childList1.size();i++){
+			//客户总数
+			String count = childList1.get(i);
+			//昨日客户数
+			String dayCount = childList2.get(i);
+			childList3.add(CommonUtil.multiply(CommonUtil.divide(dayCount, count, 4), "100", 2) + "%");
+		}
+//		resList.add(childList3);
+		//昨日新增考核数
+		List<String> childList4 = new ArrayList<String>();
+		childList4.add("昨日新增考核户数");
+		for(int i=1;i<childList0.size();i++){
+			String endTimes = DateUtil.dateAddDay(range,-1);
+			Map<String, String> map = new HashMap<String, String>();
+			if(!"合计".equals(childList0.get(i))){
+				map.put("area", childList0.get(i));
+			}
+			map.put("beginTime", beginTime);
+			map.put("endTime", endTimes);
+			List<Map<String, String>> fileList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(map);
+			map.put("endTime", endTime);
+			List<Map<String, String>> fileList1 = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(map);
+			childList4.add((fileList1.size()-fileList.size())+"");
+		}
+//		resList.add(childList4);
+		//截至目前未治理完成户数
+		List<String> childList5 = new ArrayList<String>();
+		childList5.add("截至目前未治理完成户数");
+		//用户id
+		List<String> childList6 = new ArrayList<String>();
+		for(int i=1;i<childList0.size();i++){
+			int dayCount = DateUtil.diffDate(range,beginTime);
+			String beginTimes = DateUtil.dateAddDay(range,-6);
+			DwFileDetail03Example example = new DwFileDetail03Example();
+			Map<String, String> map = new HashMap<String, String>();
+			if(!"合计".equals(childList0.get(i))){
+				map.put("area", childList0.get(i));
+			}
+			map.put("beginTime", beginTime);
+			map.put("endTime", range);
+			List<Map<String, String>> fileList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(map);
+			if(dayCount<6){
+				childList5.add(fileList.size()+"");
+			}else{
+				for(Map<String, String> maps:fileList){
+					childList6.add(maps.get("yhid"));
+				}
+				example.createCriteria().andSjrqBetween(beginTimes, range).andYhidIn(childList6);
+				List<DwFileDetail03> DateList = db.selectByExample(DwFileDetail03Mapper.class, example);
+				childList5.add(DateList.size()+"");
+			}
+			
+		}
+		String content = "昨日新增受考核低电压客户"+childList4.get(childList4.size()-1)+"户,按单位分:";
+		for(int i=1;i<childList0.size()-1;i++){
+			content=content+childList0.get(i)+childList4.get(i)+"户,";
+			if(childList0.size()-1==i){
+				content=content+childList0.get(i)+childList4.get(i)+"户。";
+			}
+		}
+		content = content+"昨日新增未治理完成客户_户,截至目前未治理完成"+childList5.get(childList5.size()-1)+"户,_户正在治理;_户治理后再次出现,其中_各_户;"
+				+ "_户未开始治理,其中__户。其中全年累计受考核30天及以上且未治理完成的_户:为_户(户号:_)。";
+		title.add(content);
+		resList.add(title);
+		resList.add(childList0);
+		resList.add(childList1);
+		resList.add(childList2);
+		resList.add(childList3);
+		resList.add(childList4);
+		resList.add(childList5);
+		return resList;
+	}
 }

+ 2 - 1
src/main/java/com/minpay/db/table/own/mapper/ReportServiceMapper.java

@@ -26,7 +26,8 @@ public interface ReportServiceMapper extends IMINMybatisEntityMapper {
 	
 	List<Map<String, String>> selectDetail03ByDDYZLFXB(Map<String, String> param);
 	
-
+	List<Map<String, String>> selectDetail03ByDDYRB(Map<String, String> param);
+	
 	// 分段时长条数
 	String selectReportType00FenDuan(Map<String, String> shiduanMap);
 	// 月报最长停电台区

+ 4 - 1
src/main/java/com/minpay/reportManage/action/ReportManageAction.java

@@ -203,6 +203,7 @@ public class ReportManageAction implements IMINAction {
      * @param secondFileId	终端投托运报表选择的对比原始数据文件
      * @param FADateRange	FA动作日期区间
      * @param yearChoose	FA动作年份
+     * @param DdyDateRange	低电压动日期区间
      * @return
      * @throws MINBusinessException
      * @throws ParseException
@@ -217,7 +218,8 @@ public class ReportManageAction implements IMINAction {
     		@MINParam(key = "firstFileId") String firstFileId,
     		@MINParam(key = "secondFileId") String secondFileId,
     		@MINParam(key = "FADateRange") String FADateRange,
-    		@MINParam(key = "yearChoose") String yearChoose
+    		@MINParam(key = "yearChoose") String yearChoose,
+    		@MINParam(key = "DdyDateRange") String DdyDateRange
     		) throws MINBusinessException, ParseException {
     	MINActionResult res = new MINActionResult();
     	
@@ -234,6 +236,7 @@ public class ReportManageAction implements IMINAction {
     	param.put("secondFileId", secondFileId);
     	param.put("FADateRange", FADateRange);
     	param.put("yearChoose", yearChoose);
+    	param.put("DdyDateRange", DdyDateRange);
     	Map<String, Object> resMap = Service.lookup(IReportService.class).reportNeedDetail(param);
     	res.set(IMINBusinessConstant.F_PAGING_LAY, resMap);
     	return res;

+ 17 - 0
src/main/resources/com/minpay/db/table/own/mapper/ReportServiceMapper.xml

@@ -221,4 +221,21 @@
 		GROUP BY DFD3_YHID
 		ORDER BY dysc DESC
 	</select>
+	<select id="selectDetail03ByDDYRB" resultType="hashmap" parameterType="java.util.Map">
+		SELECT
+		  DFD3_YHID    		yhid,
+		  SUM(DFD3_DYSC)    dysc
+		FROM dw_file_detail_03
+		WHERE 1=1
+		<if test="area != null  and area != ''">
+			and DFD3_XGSMC LIKE concat(#{area,jdbcType=VARCHAR} ,'%') 
+		</if>
+		<if test="beginTime != null  and beginTime != '' and endTime != null  and endTime != ''">
+			 AND DFD3_SJRQ BETWEEN #{beginTime,jdbcType=VARCHAR} AND #{endTime,jdbcType=VARCHAR}
+		</if>
+		   
+		GROUP BY DFD3_YHID
+		HAVING dysc > 47
+	
+	</select>
 </mapper>

+ 245 - 0
src/main/webapp/admin/ddy/reportManageDdyRb.html

@@ -0,0 +1,245 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>报表管理</title>
+    <script src="../../js/min-loader-next.js"></script>
+</head>
+<body class="content">
+	<div class="order-body">
+		<div class="order-tiaojian back-gray">
+			<div class="tiaojian-part1" id = "conditions">
+				<div class="fl f12-gray4-op">所选条件:</div>
+			</div>
+			<div class="tiaojian-part2 fr  demoTable">
+				<button class="order-bnt1 layui-btn" onclick="reloadSearch()" >查询</button>
+				<button class="layui-btn order-bnt2" onclick="reset()">重置</button>
+				<button class="order-bnt2 layui-btn" onclick="uploadExcel()">报表生成</button>
+				<a href="#" id="toggle" class="top">收起</a>
+			</div>
+		</div>
+		<form class="layui-form" action="" id = "formRole">
+			<div class="order-select back-border" id="content">
+				<div class="d-dashed" style="margin: 10px 0;"></div>
+				<div class="layui-inline">
+					<label class="f12-gray4">生成日期:</label>
+					<div class="layui-input-inline" style="position: relative;">
+						<input type="text" class="layui-input" id="date" placeholder="请选择日期" readOnly/>
+					</div>
+				</div>
+				<div class="layui-inline">
+					<label class="f12-gray4">文件名称:</label>
+					<input name="fileName"  id ="fileName" autocomplete="off" placeholder="请输入文件名称" class="search-select" onchange = "changeSelectCon(1,this,'inp')">
+				</div>
+			</div>
+		</form>
+	</div>
+	<div class="shadow-content" style="margin:1.5rem;">
+    	<table id="tableTest" lay-filter="tableFilter"></table>
+	</div>
+	<script type="text/html" id="barDemo">
+		<a class="layui-btn layui-btn-xs" lay-event="detail">详情查看</a>
+		<a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
+     	<a class="layui-btn layui-btn-xs" lay-event="downLoad">下载</a>
+		<a class="layui-btn layui-btn-xs" lay-event="delete">删除</a>
+   	</script>
+	<script type="text/html" id="algorithmBar">
+		<a class="layui-btn layui-btn-xs" lay-event="algorithmDetail">查看</a>
+   	</script>
+    <script>
+	$("#toggle").click(function() {
+		$(this).html($("#content").is(":hidden") ? "收起" + "<i class='iconfont up iconSelect_drop-down'/></i>" : "展开" +
+			"<i class='iconfont up iconSelect_drop-down'/></i>");
+		$("#content").slideToggle();
+	});
+	var pageId = "240000";
+	// 报表类型
+	var reportType = getQueryString("reportType")
+	
+	var timeType = getQueryString("timeType");// 00日报01周报02月报
+	
+     var table;
+     var form;
+     layui.use(['table','laydate','form'], function(){
+    	  var laydate = layui.laydate;
+    	  laydate.render({ 
+    		  elem: '#date'
+    		  ,type: 'date'
+    		  ,range: true
+    		  ,done: function(value, date, endDate){
+    			  changeSelectCon(0,"date",'date',value)
+  			  }
+		  });
+    	  
+		  table = layui.table;
+		  
+		  // 加载数据
+		  table.render({
+			id: 'tableTest'
+		    ,elem: '#tableTest'
+		    ,limit:10
+		    ,url: 'ReportManageAction/reportInfQuery' //数据接口
+		    ,method: 'post'
+		    ,where:{MINView:"JSON", timeType : timeType, reportType : reportType}
+		    ,page: true //开启分页
+		    ,cols: [[ //表头
+		      {field:'num', title: '序号',width:'5%', type:'numbers', align: 'center'}
+		      ,{field: 'uploadDate', title: '生成时间', width:'15%', sort: true}
+		      ,{field: 'fileName', title: '报表名称', width:'30%'}
+		      ,{field: 'algorith', title: '算法', width: '10%', toolbar: '#algorithmBar'}
+		      ,{field: 'operate', title: '操作', width: '40%', toolbar: '#barDemo', fixed : 'right'}
+		    ]]
+		    ,done: function(res, curr, count){
+		    }
+		    ,even: true //开启隔行背景
+		  });
+		  
+		 // 监听工具条(操作)
+		  table.on('tool(tableFilter)', function(obj){ //注:tool是工具条事件名,tableFilter是table原始容器的属性 lay-filter="对应的值"
+		    var data = obj.data; //获得当前行数据
+		    var layEvent = obj.event; //获得 lay-event 对应的值(也可以是表头的 event 参数对应的值)
+		    var tr = obj.tr; //获得当前行 tr 的DOM对象
+		    if (layEvent === 'detail'){ //查看
+		    	showDetail(data);
+		    } else if(layEvent === 'downLoad'){
+		    	window.open("../../ReportManageAction/reportDownLoad?reportId=" + data.id);
+		    } else if(layEvent === 'delete'){
+		    	layer.confirm('确认删除?', function(index){
+	        		layer.close(index);
+			    	$.request({
+						action : 'ReportManageAction/reportInfDelete',
+						data : {
+							reportId : data.id
+						},
+						success : function(data1) {
+							$.SuccAlert("操作成功!");
+							reloadSearch();
+						},
+						error : function(data2) {
+							$.ErrorAlert(data2.MINErrorMessage);
+						}
+		    	  	});
+	      		});
+		    } else if (layEvent === 'edit'){ // 编辑
+		    	editReport(data);
+		    } else if (layEvent === 'algorithmDetail'){ // 算法查看
+		    	algorithmDetail(data);
+		    }
+		  });
+	 });
+      
+      function reloadSearch (t) {
+	    	var fileName = $("#fileName").val();
+	    	var date = $("#date").val();
+	        //执行重载
+ 		    table.reload('tableTest', {
+ 		        page: {
+ 		        	curr: 1 //重新从第 1 页开始
+ 		        }
+ 		        ,where: {
+ 		        	date : date,
+ 		        	fileName : fileName
+ 		        }
+ 		     });
+ 		 if (t == 1) {
+     		  $.Alert("修改成功"); 
+     	 }
+      }
+      
+      function reset(){
+    	  $('#formRole')[0].reset();
+    	  $("#conditions").html('<div class="fl f12-gray4-op">所选条件:</div>');
+      }
+      
+      function uploadExcel(){
+    	  var openPageId = pageId + "-01";
+    	  openMainTabPage(openPageId, "报表生成", "ddy/reportProduceRb.html?pageId="+openPageId+"&timeType="+timeType+"&reportType="+reportType, '', pageId, reloadSearch);
+      }
+      
+      function showDetail(data){
+    	  var openPageId = pageId + "-02";
+    	  openMainTabPage(openPageId, "详情查看", "ddy/reportManageDetailDdyRb.html?pageId="+openPageId+"&reportId="+data.id+"&type="+data.type+"&typeId="+data.typeId+"&fileName="+chineseUrlEncode(data.fileName), '', pageId, null);
+      }
+      function editReport(data){
+    	  var openPageId = pageId + "-03";
+    	  openMainTabPage(openPageId, "编辑", "ddy/reportManageUpdateDdyRb.html?pageId="+openPageId+"&reportId="+data.id+"&type="+data.type+"&typeId="+data.typeId+"&fileName="+chineseUrlEncode(data.fileName), '', pageId, reloadSearch);
+      }
+      function algorithmDetail(data){
+   	  	var openPageId = pageId + "-04";
+		openMainTabPage(openPageId, "算法查看", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&reportTypeId="+data.typeId, '', pageId, null);
+      }
+      
+   	function changeSelectCon(index, t, type, dateValue){
+   		if (type == "date") {
+   			if (isEmpty(dateValue)) {
+   				$("#search" + index).remove();
+   			} else {
+   				$("#search" + index).remove();
+   				if (isEmpty($("#search" + index).attr("name"))) {
+   					$("#conditions").append(getSelectConHtml(index, t, type,dateValue));
+   				}
+   			}
+   		} else if (type == 'inp') {
+   			if (isEmpty($(t).val())) {
+   				$("#search" + index).remove();
+   			} else {
+   				$("#search" + index).remove();
+   				if (isEmpty($("#search" + index).attr("name"))) {
+   					$("#conditions").append(getSelectConHtml(index, t, type));
+   				}
+   			}
+   		} else {
+   			if (isEmpty($(t).val())) {
+   				$("#search" + index).remove();
+   			} else {
+   				$("#search" + index).remove();
+   				if (isEmpty($("#search" + index).attr("name"))) {
+   					$(t).attr("id","subjects");
+   					$("#conditions").append(getSelectConHtml(index, t, type));
+   				}
+   			}
+   		}
+   	}
+    	
+	var array = new Array('生成日期','文件名称');
+	function getSelectConHtml(index, t, type,dateValue){
+		var name;
+		if (type == "date") {
+			name = $("#"+t).attr("id");
+		} else {
+			name = $(t).attr("id");
+		}
+		var value;
+		if(type == "inp"){
+			value = t.value.substr(0,5)+"..";
+		}
+		if (type == "date") {
+			value = dateValue;
+		}
+		if(type == "sel"){
+			value = $("#stateDiv").find("option:selected").text();
+		}
+		var html = '<div class="fl xuanzhong-active" id = "search' + index + '" name = "' + name + '" onclick = "removeSearch(this)">' +
+						'<div class="fl">' + array[index] + '</div>' +
+						':<span>'+value+'</span>' +
+						'<svg class="icon" aria-hidden="true">' +
+						  '<use xlink:href="#iconicon_close1"></use>' +
+						'</svg>' +
+					'</div>';
+		return html;
+	}
+	function removeSearch(t) {
+		if ($(t).attr("name") == 'subjects') {
+			initSelect('stateDiv', "COMPANY_STATE", "state", '', true); 
+			form.render();
+			$(t).remove();
+		} else {
+			$("#"+$(t).attr("name")).val('');
+			$(t).remove();
+		}
+	}
+    </script>
+</body>
+
+</html>

+ 104 - 0
src/main/webapp/admin/ddy/reportManageDetailDdyRb.html

@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>报告详情</title>
+    <script src="../../js/min-loader-next.js"></script>
+</head>
+<body class="content">
+	<div class="shadow-content" style="margin:1.5rem; text-align: center;">
+		<p id = "reportTitle" style="margin:15px; font-size : 20px"></p>
+    	<table id="reportTable" class="layui-table"></table>
+	</div>
+    <script>
+	var pageId = getQueryString("pageId");
+	var reportId = getQueryString("reportId");		//报告id
+	var fileName = chineseUrlDecodeURI(getQueryString("fileName"));	//报告名称
+	var dayInterval = getQueryString("dayInterval");	//日区间
+	var type = getQueryString("type");		//报告类型00:excel 01:word
+	var typeId = getQueryString("typeId");	//报告类型id
+	
+	var cols = null;
+	
+	// excel
+	if ("00" == type) {
+		$("#reportTitle").html(fileName);
+		$.request({
+			action : 'ReportManageAction/reportInfDetail',
+			data : {
+				reportId : reportId
+			},
+			success : function(data) {
+				var reportDataJsonStr = data.data.data;
+				var excelList = eval('(' + reportDataJsonStr + ')');
+				reportTable(excelList, typeId,true);
+			},
+			error : function(data2) {
+				$.ErrorAlert(data2.MINErrorMessage);
+			}
+	  	});
+	// word
+	} else {
+		
+	}
+	
+	function reportTable(excelList, typeId,isType,isEdit) {
+		var html = '';
+		if(isType){
+			html = '<tr><td colspan = "'+excelList[1].length+'">'+excelList[0]+'</td></tr>';
+		}
+		for (var i = 0; i < excelList.length; i ++) {
+			if(i==0){
+				continue;
+			}
+			html += '<tr>';
+			var excelChildList = excelList[i];
+			for (var j = 0; j < excelChildList.length; j ++) {
+				// 合计列增加穿透
+				/* if (j==6) {
+					// 台区停电次数
+					if(excelChildList[7]>=15&excelChildList[7]<48){
+						html += '<td style="background: #c74141">' + excelChildList[j] + '</td>';
+					}else if(excelChildList[7]>=48){
+						html += '<td style="background: #ff8204">' + excelChildList[j] + '</td>';
+					}else{
+						html += '<td>' + excelChildList[j] + '</td>';
+					}
+					
+					// 2个月停电3次及以上台区
+				} else { */
+					html += '<td>' + excelChildList[j] + '</td>';
+				/* } */
+			}
+			html += '</tr>';
+		}
+		$("#reportTable").html(html);
+	}
+	
+	// 台区次数穿透
+	function tqtd0(){
+		var openPageId = pageId + "-01";
+		openMainTabPage(openPageId, "详情", "tqtd/reportManageDetailChuantou.html?pageId="+openPageId+"&reportId="+reportId+"&chuantouType=TQTD01", '', pageId, null);
+	}
+	// 2个月停电3次及以上台区穿透
+	function tqtd1(){
+		var openPageId = pageId + "-02";
+		openMainTabPage(openPageId, "详情", "tqtd/reportManageDetailChuantou.html?pageId="+openPageId+"&reportId="+reportId+"&chuantouType=TQTD02", '', pageId, null);
+	}
+	// month个月停电count次及以上台区且昨日停电穿透
+	function tqtd2(){
+		var openPageId = pageId + "-03";
+		openMainTabPage(openPageId, "详情", "tqtd/reportManageDetailChuantou.html?pageId="+openPageId+"&reportId="+reportId+"&chuantouType=TQTD03", '', pageId, null);
+	}
+	// 2个月停电1次及以上台区且昨日停电穿透
+	function tqtd3(){
+		var openPageId = pageId + "-04";
+		openMainTabPage(openPageId, "详情", "tqtd/reportManageDetailChuantou.html?pageId="+openPageId+"&reportId="+reportId+"&chuantouType=TQTD04", '', pageId, null);
+	}
+	
+
+    </script>
+</body>
+
+</html>

+ 80 - 0
src/main/webapp/admin/ddy/reportManageUpdateDdyRb.html

@@ -0,0 +1,80 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>报告详情</title>
+    <script src="../../js/min-loader-next.js"></script>
+    <script src="../../js/report.js"></script>
+</head>
+<body class="content">
+	<div class="shadow-content" style="margin:1.5rem; text-align: center;">
+		<p id = "reportTitle" style="margin:15px; font-size : 20px" contenteditable = "true"></p>
+    	<table id="reportTable" class="layui-table"></table>
+	</div>
+	<div class="layui-form-item box-button" style="margin-top:50px">
+          <div class="layui-input-block">
+				<button class="layui-btn" onclick = "saveReport()">保存</button>
+          </div>
+    </div>
+    <script>
+	var pageId = getQueryString("pageId");
+	var reportId = getQueryString("reportId");		//报告id
+	var fileName = chineseUrlDecodeURI(getQueryString("fileName"));	//报告名称
+	var dayInterval = chineseUrlDecodeURI(getQueryString("dayInterval"));	//日区间
+	
+	var type = getQueryString("type");		//报告类型00:excel 01:word
+	var typeId = getQueryString("typeId");	//报告类型id
+	
+	var cols = null;
+	
+	// excel
+	if ("00" == type) {
+		$("#reportTitle").html(fileName);
+		$.request({
+			action : 'ReportManageAction/reportInfDetail',
+			data : {
+				reportId : reportId
+			},
+			success : function(data) {
+				var reportDataJsonStr = data.data.data;
+				var excelList = eval('(' + reportDataJsonStr + ')');
+				reportTable(excelList, typeId,true,true);
+			},
+			error : function(data2) {
+				$.ErrorAlert(data2.MINErrorMessage);
+			}
+	  	});
+	// word
+	} else {
+		
+	}
+
+
+	function saveReport() {
+		// excel
+		if ("00" == type) {
+			var excelList = getTableToArray("reportTable");
+			$.request({
+				action : 'ReportManageAction/reportInfUpdate',
+				data : {
+					reportId : reportId,
+					excelList : JSON.stringify(excelList),
+					reportName : $("#reportTitle").html()
+				},
+				success : function(data) {
+					$.SuccAlert("保存成功!");
+					setTimeout(function(){
+						deleteTabPageParent(pageId); 
+					}, 1500)
+				},
+				error : function(data2) {
+					$.ErrorAlert(data2.MINErrorMessage);
+				}
+		  	});
+		}
+	}
+    </script>
+</body>
+
+</html>

+ 346 - 0
src/main/webapp/admin/ddy/reportProduceRb.html

@@ -0,0 +1,346 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+    <meta charset="utf-8">
+    <title>导入</title>
+    <script src="../../js/min-loader-next.js"></script>
+    <script src="../../js/report.js"></script>
+    <link rel="stylesheet" href="../../plugins/layui/lay/modules/steps/style.css"></link>
+    <style>
+    	.layui-input {
+    		width : 200px;
+    	}
+    	.layui-upload-drag .layui-icon {
+    		font-size: 18px;
+		    color: #fff;
+		}
+		.layui-btn-sm {
+		    height: 22px;
+		    line-height: 22px;
+		    padding: 0 10px;
+		    font-size: 12px;
+		}
+    </style>
+</head>
+<body class="content">
+	<div id="step_demo" class="step-body" style = "margin-top : 20px; margin-left: 10%;">
+	    <div class="step-header" style="width:80%;overflow: hidden;">
+	        <ul>
+	            <li>
+	                <span class="step-name">选择报告/报表</span>
+	            </li>
+	            <li>
+	                <span class="step-name">选择文件</span>
+	            </li>
+	            <li>
+	                <span class="step-name">数据预览</span>
+	            </li>
+	            <li>
+	                <span class="step-name">生成报告/报表</span>
+	            </li>
+	        </ul>
+	    </div>
+	</div>
+	<div class="order-body" style = "width: 80%; margin-left : 10%;height : 450px" name = "step">
+		<form class="layui-form" style = "text-align : center;">
+			<div class="order-select" id="content" style = "background: #FFFFFF;border-radius: 8px;padding: 16px 1.4rem;">
+				<div class="layui-inline" style="margin-top: 150px;">
+					<label class="f12-gray4">请选择文件类型:</label>
+					<div id = "reportTypeDiv" class="layui-inline">
+					</div>
+				</div>
+				<div style="margin-top : 200px;">
+			      <button type="button" class="layui-btn" style = "width : 214px" onclick = "goStep(2)">下一步</button>
+			    </div>
+			</div>
+		</form>
+	</div>
+	<div name = "step" style = "width: 80%; margin-left : 10%;height : 300px; display : none; text-align : center;">
+		<form class="layui-form" style = "text-align : center;">
+			<div style = "width: 80%; margin-left : 0px; height : 200px" class = "layui-upload-drag" >
+				<input type="text" class="layui-input" id="yearChoose" placeholder="yyyy" style = "display: inline-block;">
+				<div id = "DdyDateRange" class="layui-inline">
+				</div>
+				<input type="text"  class="layui-input" id="dayRange" placeholder="请选择报表日期">
+			</div>
+			<div style="margin-top : 50px;">
+		      <button type="button" class="layui-btn" style = "width : 214px" onclick = "tableYulan()">下一步</button>
+		    </div>
+	    </form>
+	</div>
+	<div name = "step" style = "width: 80%; margin-left : 10%; height : 300px; display : none; text-align : center;">
+		<div style = "width: 80%; margin-left : 0px;" class = "layui-upload-drag" >
+		  <p id = "fileName" contenteditable="true">国网泰安供电公司2020年8月份配网运行分析月报</p>
+		  <table id = "reportTable" class="layui-table">
+		  </table>
+		  <p id = "content"></p>
+		  <p>报表关联的工具表为《<a id = "utilName" onclick = "goUtilDetail(this)">2020年6月底低电压月报工具表</a>》  关联的报表算法为《<a id = "algorithmName" onclick = "goAlgorithmDetail(this)">国网泰安供电公司2020年8月份配网运行分析月报</a>》    的算法</p>
+		</div>
+		<div style="margin-top : 50px;">
+	      <button type="button" class="layui-btn" style = "width : 214px" onclick = "goStep(4)">下一步</button>
+	    </div>
+	</div>
+	<div name = "step" style = "width: 80%; margin-left : 10%;height : 300px; display : none; text-align : center; margin-top : 50px;">
+		<i class="layui-icon layui-icon-ok-circle" style="font-size: 100px; color: #009688;"></i>
+		<p style = "font-weight: 700;font-size: 25px;">报表生成成功!</p>
+		<p style = " color: #b2bbc2;">可在数据仓库-报表管理进行查看</p>
+		<div style="margin-top : 100px;">
+	      <button type="button" class="layui-btn" style = "width : 214px" onclick = "finish()">完成</button>
+	    </div>
+	</div>
+	
+    <script>
+		var pageId = getQueryString("pageId");
+		var reportType = getQueryString("reportType"); //报告类型
+		var $step;
+		layui.config({
+	        base: '../../plugins/layui/lay/modules/steps/'
+	    }).use(['steps','jquery'],function(){
+	    	var $ = layui.$;
+    	    $step = $("#step_demo").step();
+		})
+		layui.use('laydate', function(){
+			var laydate = layui.laydate;
+			laydate.render({
+				elem: '#yearChoose'
+				,type: 'year'
+				,value: new Date()
+			});
+			laydate.render({
+				elem : '#dayRange'
+				,format : 'yyyyMMdd'
+				,done: function(value, date, endDate){
+					console.log(value); //得到日期生成的值,如:2017-08-18
+					var fileName = $("#fileName").html();
+					if (fileName.indexOf("-") != -1) {
+						$("#fileName").html(fileName.split("-")[0]+value);
+					} else {
+						$("#fileName").html(fileName+"-" + value);
+					}
+				}
+			});
+		})
+		// 范围类型
+		layui.use('form', function(){
+			var form = layui.form;
+			initSelect("DdyDateRange", "DdyDateRange", "DdyDateRange", "", false);
+			
+			$.request({
+				action : 'BranchReportTypeAction/branchReportTypeQuery',
+				data : {
+					reportType : reportType
+				},
+				success : function(data) {
+					var html = '<select id = "reportType" lay-filter="reportTypeFilter"><option value = "">请选择</option>';
+					var fileTypeList = data.data;
+					for (var i = 0; i < fileTypeList.length; i ++) {
+						var fileTypeInf = fileTypeList[i];
+						html += '<option value = "' + fileTypeInf.id + '_' + fileTypeInf.type + '_' + fileTypeInf.timeType + '">' + fileTypeInf.name + '</option>';
+					}
+					html += '</select>';
+					$("#reportTypeDiv").html(html);
+					form.render();
+				},
+				error : function(data2) {
+					$.ErrorAlert(data2.MINErrorMessage);
+				}
+    	  	});
+			
+			form.on('select(reportTypeFilter)', function(data){
+				var value = data.value;
+				if (!isEmpty(value)) {
+					var reportTypeId = value.split("_")[0];
+					
+					$("#fileName").html(data.elem.selectedOptions[0].text);
+					
+					if (!isEmpty(reportTypeId)) {
+						  $.request({
+								action : 'BranchReportTypeAction/fileTypeOfReportType',
+								data : {
+									reportTypeId : reportTypeId
+								},
+								success : function(data) {
+									fileType = data.data;
+									setTempVal("fileType", fileType);
+									
+									var utilDataInf = data.utilDataInf;
+									if (!isEmpty(utilDataInf)) {
+										$("#utilName").html(utilDataInf.fileName);
+										$("#utilName").attr("fileName", utilDataInf.fileName);
+										setTempVal("utilExcelDataDetail", utilDataInf.excelData);
+										var algorithmInf = data.algorithmInf;
+										if (!isEmpty(algorithmInf)) {
+											$("#algorithmName").html(utilDataInf.fileName+"算法");
+											$("#algorithmName").attr("reportTypeId", reportTypeId);
+										}
+									}
+									
+								},
+								error : function(data2) {
+									$.ErrorAlert(data2.MINErrorMessage);
+								}
+				    	  });
+					  }
+				}
+			});      
+		})
+		
+		function goStep (step) {
+			var reportInf = $("#reportTypeDiv").find("select option:selected").val();
+			
+			if (step == 2) {
+				if (isEmpty(reportInf)) {
+					$.ErrorAlert("请选择上传文件类型!");
+					return;
+				}
+				var reportType = reportInf.split("_")[0];
+				// 台区停电日报
+				if ("TQTDRB" == reportType) {
+					$("body").find("[name='TQTDRB']").show();
+				}
+			}
+			
+			if (step == 4) {
+				var fileName = $("#fileName").html();
+				var DdyDateRange = $("#DdyDateRange").find("select option:selected").val();
+				var yearChoose = $("#yearChoose").val();
+				var dayRange = $("#dayRange").val();
+				if (isEmpty(DdyDateRange)) {
+					$.ErrorAlert("请选择日期范围!");
+					return;
+				}
+				if (isEmpty(yearChoose)) {
+					$.ErrorAlert("请选择年份!");
+					return;
+				}
+				if (isEmpty(dayRange)) {
+					$.ErrorAlert("请选择日期!");
+					return;
+				}
+				var beginTime = yearChoose + DdyDateRange.substring(0, 4);
+				var endTime = yearChoose + DdyDateRange.substring(4, 8);
+				if (beginTime.substring(0, 2) == "12") {
+					endTime = accAdd(DdyDateRange, "1") + DdyDateRange.substring(4, 8);
+				}
+				$.request({
+					action : 'ReportManageAction/fileInfReportSubmit',
+					data : {
+						reportData : JSON.stringify(excelList),
+						reportInf : reportInf,
+						fileName : fileName,
+						range : beginTime + '-' + endTime,
+						dayRange:dayRange
+					},
+					success : function(data) {
+						if (data.code == 0) {
+							$step.goStep(step);
+							var stepDiv = $("div[name = 'step']");
+							for (var i = 0; i < stepDiv.length; i ++) {
+								if (step == (i + 1)) {
+									$(stepDiv[i]).show();
+								} else {
+									$(stepDiv[i]).hide();
+								}
+							}
+				    	} else {
+				    		$.ErrorAlert(res.MINErrorMessage);
+				    	}
+					},
+					error : function(data2) {
+						$.ErrorAlert(data2.MINErrorMessage);
+					}
+	    	  	});
+				return;
+			}
+			
+			$step.goStep(step);
+			var stepDiv = $("div[name = 'step']");
+			for (var i = 0; i < stepDiv.length; i ++) {
+				if (step == (i + 1)) {
+					$(stepDiv[i]).show();
+				} else {
+					$(stepDiv[i]).hide();
+				}
+			}
+		}
+		
+		function finish() {
+			deleteTabPageParent(pageId); 
+		}
+		
+		// 查看工具表详情
+		function goUtilDetail(t) {
+			var fileName = $(t).attr("fileName");
+			var openPageId = pageId + "-01";
+			openMainTabPage(openPageId, "详情查看", "reprotManage/utilExcelDetail.html?pageId="+openPageId+"&fileName="+chineseUrlEncode(fileName), '', pageId, null);
+		}
+		// 查看算法详情
+		function goAlgorithmDetail(t) {
+			var reportTypeId = $(t).attr("reportTypeId");
+			var openPageId = pageId + "-02";
+			openMainTabPage(openPageId, "详情查看", "reprotManage/reportAlgorithm.html?pageId="+openPageId+"&reportTypeId="+reportTypeId, '', pageId, null);
+		}
+		
+		// 报表excel
+		var excelList = null;
+		// 预览
+		function tableYulan() {
+			var reportInf = $("#reportTypeDiv").find("select option:selected").val();
+			var DdyDateRange = $("#DdyDateRange").find("select option:selected").val();
+			var yearChoose = $("#yearChoose").val();
+			var dayRange = $("#dayRange").val();
+			if (isEmpty(DdyDateRange)) {
+				$.ErrorAlert("请选择日期范围!");
+				return;
+			}
+			if (isEmpty(yearChoose)) {
+				$.ErrorAlert("请选择年份!");
+				return;
+			}
+			if (isEmpty(dayRange)) {
+				$.ErrorAlert("请选择日期!");
+				return;
+			}
+			// 查询符合条件的明细数据,生成预览数据
+			$.request({
+				action : 'ReportManageAction/reportNeedDataDetail',
+				data : {
+					reportInf : reportInf,
+					DdyDateRange : DdyDateRange,
+					yearChoose : yearChoose,
+					range:dayRange
+				},
+				success : function(data) {
+					if (data.code == 0) {
+						excelList = data.data.resList;
+						initExcelData(excelList, "reportTable", false,true);
+						goStep(3);
+			    	} else {
+			    		$.ErrorAlert(res.MINErrorMessage);
+			    	}
+				},
+				error : function(data2) {
+					$.ErrorAlert(data2.MINErrorMessage);
+				}
+    	  	});
+		}
+		
+		function changeHtml(t) {
+			var initValue = $(t).html();
+			layer.prompt({
+					formType: 2,
+					value: initValue,
+					title: '请输入',
+					area: ['200px', '33px'] //自定义文本域宽高
+				}, 
+				function(value, index, elem){
+					$(t).html(value);
+					layer.close(index);
+				}
+			);
+		}
+    </script>
+</body>
+
+</html>

+ 5 - 1
src/main/webapp/js/report.js

@@ -6,7 +6,11 @@ var TQTDZB = "TQTDZB";	//台区停电周报
 function reportTable(excelList, typeId, isEdit,isType) {
 	var html = '';
 	if(isType){
-		html = '<tr><td colspan = "'+excelList[1].length+'">'+excelList[0]+'</td></tr>';
+		if(isEdit){
+			html = '<tr><td colspan = "'+excelList[1].length+'" contenteditable = "true" onblur = "reportChange(this, ' + typeId + ',' + i + ', '+ j + ')">'+excelList[0]+'</td></tr>';
+		}else{
+			html = '<tr><td colspan = "'+excelList[1].length+'">'+excelList[0]+'</td></tr>';
+		}
 	}
 	var editHtml;