Browse Source

低电压周报

tudc 4 năm trước cách đây
mục cha
commit
a44f43e6da

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

@@ -362,6 +362,10 @@ public class Constant implements IMINBusinessConstant{
 	 * 报表类型  DDYZRXZ 低电压昨日新增考核
 	 */
 	public static final String REPORT_TYPE_10 = "DDYZRXZ";
+	/**
+	 * 报表类型  DDYZRXZ 低电压昨日新增考核
+	 */
+	public static final String REPORT_TYPE_11 = "DDYZB";
 	
 	/**
 	 * 原始文件状态 0正常

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

@@ -10,6 +10,8 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import org.apache.poi.hssf.record.CommonObjectDataSubRecord;
+
 import com.minpay.common.constant.Constant;
 import com.minpay.common.service.IReportService;
 import com.minpay.common.util.CommonUtil;
@@ -107,6 +109,7 @@ public class ReportServiceImpl implements IReportService {
 	public Map<String, Object> reportNeedDetail(Map<String, String> param)
 			throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
 		String range = param.get("range");
+		String monthChoose = param.get("monthChoose");
 		String timeRange = param.get("timeRange");
 		String reportTypeId = param.get("reportTypeId");
 		String firstFileId = param.get("firstFileId");
@@ -156,10 +159,13 @@ public class ReportServiceImpl implements IReportService {
     	} else if (Constant.REPORT_TYPE_09.equals(reportTypeId)) {
     		List<List<String>> resList = reportTypeDDYWZL(ddyFxbId);
     		resMap.put("resList", resList);
+    	// 低电压昨日新增
     	} else if (Constant.REPORT_TYPE_10.equals(reportTypeId)) {
     		List<List<String>> resList = reportTypeDDYZRXZ(ddyFxbId);
     		resMap.put("resList", resList);
-    	}
+		} else if (Constant.REPORT_TYPE_11.equals(reportTypeId)) {
+			return reportTypeDDYZB(yearChoose, monthChoose, range);
+		}
 		return resMap;
 	}
 
@@ -2308,4 +2314,277 @@ public class ReportServiceImpl implements IReportService {
 		
 		return resList;
 	}
+	
+	/**
+	 * 低电压周报
+	 * @param yearChoose		年范围
+	 * @param monthChoose		月范围
+	 * @param range				周范围
+	 * @return
+	 * @throws MINBusinessException
+	 * @throws ParseException
+	 * @throws InvocationTargetException 
+	 * @throws IllegalArgumentException 
+	 * @throws IllegalAccessException 
+	 * @throws SecurityException 
+	 * @throws NoSuchMethodException 
+	 */
+	public Map<String, Object> reportTypeDDYZB(String yearChoose, String monthChoose, String range) throws MINBusinessException, ParseException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException{
+		IMINDataBaseService db = Service.lookup(IMINDataBaseService.class);
+		
+		Map<String, Object> resMap = new HashMap<String, Object>();
+		// 全年开始时间和结束时间
+		yearChoose = yearChoose.replaceAll(" ", "");
+		String yearBegin = yearChoose.split("-")[0];
+//		String yearEnd = yearChoose.split("-")[1];
+		
+		// 当月开始时间和结束时间
+		monthChoose = monthChoose.replaceAll(" ", "");
+		String monthBegin = monthChoose.split("-")[0];
+//		String monthEnd = monthChoose.split("-")[1];
+		
+		// 本周开始时间和结束时间
+		range = range.replaceAll(" ", "");
+		String weekBegin = range.split("-")[0];
+		String weekEnd = range.split("-")[1];
+		
+		// 全年累计考核数
+		Map<String, String> param = new HashMap<String, String>();
+		param.put("beginTime", yearBegin);
+		param.put("endTime", weekEnd);
+		List<Map<String, String>> yearTotal = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(param);
+		
+		// 本月之前全年考核数
+		param.put("beginTime", yearBegin);
+		param.put("endTime", DateUtil.dateAddDay(monthBegin, -1));
+		List<Map<String, String>> yearTotalNoBenyue = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(param);
+		
+		// 本周之前全年考核数
+		param.put("beginTime", yearBegin);
+		param.put("endTime", DateUtil.dateAddDay(weekBegin, -1));
+		List<Map<String, String>> yearTotalNoBenzhou = db.getMybatisMapper(ReportServiceMapper.class).selectDetail03ByDDYRB(param);
+		
+		// 本月新增考核数
+		int benyueXZ = yearTotal.size() - yearTotalNoBenyue.size();
+		// 本周新增考核数
+		int benzhouXZ = yearTotal.size() - yearTotalNoBenzhou.size();
+		
+		// 本周之前用户编号集合
+		List<String> bzzqYhbhList = CommonUtil.getIdFromList(yearTotalNoBenzhou, "yhid");
+		
+		// 本周新增明细
+		List<Map<String, String>> bzzxmxDescList = new ArrayList<Map<String, String>>();
+		for (int i = 0; i < yearTotal.size(); i ++) {
+			String yhbh = yearTotal.get(i).get("yhid");
+			String xgsmc = yearTotal.get(i).get("xgsmc");
+			// 本周新增数据
+			if (!bzzqYhbhList.contains(yhbh)) {
+				boolean isContain = false;
+				for (int j = 0; j < bzzxmxDescList.size(); j ++) {
+					String name = bzzxmxDescList.get(j).get("name");
+					String num = bzzxmxDescList.get(j).get("num");
+					// 数量+1
+					if (xgsmc.contains(name)) {
+						isContain = true;
+						bzzxmxDescList.get(j).put("num", CommonUtil.add(num, "1"));
+					}
+				}
+				if (!isContain) {
+					Map<String, String> descMap = new HashMap<String, String>();
+					if (xgsmc.contains("新泰")) {
+						descMap.put("name", "新泰");
+					} else if (xgsmc.contains("高新")) {
+						descMap.put("name", "高新");
+					} else if (xgsmc.contains("岱岳")) {
+						descMap.put("name", "岱岳");
+					} else if (xgsmc.contains("泰山")) {
+						descMap.put("name", "泰山");
+					} else if (xgsmc.contains("宁阳")) {
+						descMap.put("name", "宁阳");
+					} else if (xgsmc.contains("东平")) {
+						descMap.put("name", "东平");
+					} else if (xgsmc.contains("景区")) {
+						descMap.put("name", "景区");
+					} else if (xgsmc.contains("肥城")) {
+						descMap.put("name", "肥城");
+					}
+					descMap.put("num", "1");
+					bzzxmxDescList.add(descMap);
+				}
+			}
+		}
+		String danweiDesc = "";
+		
+		for (int j = 0; j < bzzxmxDescList.size(); j ++) {
+			String name = bzzxmxDescList.get(j).get("name");
+			String num = bzzxmxDescList.get(j).get("num");
+			if (j == bzzxmxDescList.size() - 1) {
+				danweiDesc += (name + num + "户。");
+			} else {
+				danweiDesc += (name + num + "户,");
+			}
+		}
+		String desc = "本月新增受考核低电压客户${benyueXZ}户,其中本周新增${benzhouXZ}户,按单位分${danweiDesc}";
+		
+		Map<String, String> reportMap = new HashMap<String, String>();
+		reportMap.put("benyueXZ", String.valueOf(benyueXZ));
+		reportMap.put("benzhouXZ", String.valueOf(benzhouXZ));
+		reportMap.put("danweiDesc", danweiDesc);
+		resMap.put("reportMap", reportMap);
+		resMap.put("descStr", desc);
+		
+		List<List<String>> excelList = new ArrayList<List<String>>();
+		
+		// 表头
+		List<String> titleList = new ArrayList<String>();
+		titleList.add("分类\\单位");
+		titleList.add("新泰");
+		titleList.add("高新");
+		titleList.add("岱岳");
+		titleList.add("泰山");
+		titleList.add("宁阳");
+		titleList.add("东平");
+		titleList.add("景区");
+		titleList.add("肥城");
+		titleList.add("合计");
+		excelList.add(titleList);
+		
+		// 合计栏
+		List<String> child0 = new ArrayList<String>();
+		child0.add("管理客户总数");
+		child0.add(customerMap.get("xintai"));
+		child0.add(customerMap.get("gaoxin"));
+		child0.add(customerMap.get("daiyue"));
+		child0.add(customerMap.get("taishan"));
+		child0.add(customerMap.get("ningyang"));
+		child0.add(customerMap.get("dongping"));
+		child0.add(customerMap.get("jingqu"));
+		child0.add(customerMap.get("feicheng"));
+		child0.add(customerMap.get("heji"));
+		excelList.add(child0);
+		
+		// 本月之前用户编号集合
+		List<String> byzqYhbhList = CommonUtil.getIdFromList(yearTotalNoBenyue, "yhid");
+		
+		// 本月新增明细
+		List<Map<String, String>> byzxmxDescList = new ArrayList<Map<String, String>>();
+		Map<String, String> byzxTaian = new HashMap<String, String>();
+		byzxTaian.put("name", "新泰");
+		byzxTaian.put("num", "0");
+		byzxmxDescList.add(byzxTaian);
+		Map<String, String> byzxGaoxin = new HashMap<String, String>();
+		byzxGaoxin.put("name", "高新");
+		byzxGaoxin.put("num", "0");
+		byzxmxDescList.add(byzxGaoxin);
+		Map<String, String> byzxDaiyue = new HashMap<String, String>();
+		byzxDaiyue.put("name", "岱岳");
+		byzxDaiyue.put("num", "0");
+		byzxmxDescList.add(byzxDaiyue);
+		Map<String, String> byzxTaishan = new HashMap<String, String>();
+		byzxTaishan.put("name", "泰山");
+		byzxTaishan.put("num", "0");
+		byzxmxDescList.add(byzxTaishan);
+		Map<String, String> byzxNingyang = new HashMap<String, String>();
+		byzxNingyang.put("name", "宁阳");
+		byzxNingyang.put("num", "0");
+		byzxmxDescList.add(byzxNingyang);
+		Map<String, String> byzxDongping = new HashMap<String, String>();
+		byzxDongping.put("name", "东平");
+		byzxDongping.put("num", "0");
+		byzxmxDescList.add(byzxDongping);
+		Map<String, String> byzxJingqu = new HashMap<String, String>();
+		byzxJingqu.put("name", "景区");
+		byzxJingqu.put("num", "0");
+		byzxmxDescList.add(byzxJingqu);
+		Map<String, String> byzxFeicheng = new HashMap<String, String>();
+		byzxFeicheng.put("name", "肥城");
+		byzxFeicheng.put("num", "0");
+		byzxmxDescList.add(byzxFeicheng);
+
+		for (int i = 0; i < yearTotal.size(); i ++) {
+			String yhbh = yearTotal.get(i).get("yhid");
+			String xgsmc = yearTotal.get(i).get("xgsmc");
+			// 本月新增数据
+			if (!byzqYhbhList.contains(yhbh)) {
+				
+				for (int j = 0; j < byzxmxDescList.size(); j ++) {
+					String name = byzxmxDescList.get(j).get("name");
+					String num = byzxmxDescList.get(j).get("num");
+					// 数量+1
+					if (xgsmc.contains(name)) {
+						byzxmxDescList.get(j).put("num", CommonUtil.add(num, "1"));
+					} 
+				}
+			}
+		}
+		
+		List<String> child1 = new ArrayList<String>();
+		child1.add("本月新增受考核客户数");
+		for (int j = 0; j < byzxmxDescList.size(); j ++) {
+			String num = byzxmxDescList.get(j).get("num");
+			child1.add(num);
+		}
+		child1.add(String.valueOf(benyueXZ));
+		excelList.add(child1);
+		
+		// 全年数据
+		List<Map<String, String>> quanianDetailList = new ArrayList<Map<String, String>>();
+		Map<String, String> quannianTaian = new HashMap<String, String>();
+		quannianTaian.put("name", "新泰");
+		quannianTaian.put("num", "0");
+		quanianDetailList.add(quannianTaian);
+		Map<String, String> quannianGaoxin = new HashMap<String, String>();
+		quannianGaoxin.put("name", "高新");
+		quannianGaoxin.put("num", "0");
+		quanianDetailList.add(quannianGaoxin);
+		Map<String, String> quannianDaiyue = new HashMap<String, String>();
+		quannianDaiyue.put("name", "岱岳");
+		quannianDaiyue.put("num", "0");
+		quanianDetailList.add(quannianDaiyue);
+		Map<String, String> quannianTaishan = new HashMap<String, String>();
+		quannianTaishan.put("name", "泰山");
+		quannianTaishan.put("num", "0");
+		quanianDetailList.add(quannianTaishan);
+		Map<String, String> quannianNingyang = new HashMap<String, String>();
+		quannianNingyang.put("name", "宁阳");
+		quannianNingyang.put("num", "0");
+		quanianDetailList.add(quannianNingyang);
+		Map<String, String> quannianDongping = new HashMap<String, String>();
+		quannianDongping.put("name", "东平");
+		quannianDongping.put("num", "0");
+		quanianDetailList.add(quannianDongping);
+		Map<String, String> quannianJingqu = new HashMap<String, String>();
+		quannianJingqu.put("name", "景区");
+		quannianJingqu.put("num", "0");
+		quanianDetailList.add(quannianJingqu);
+		Map<String, String> quannianFeicheng = new HashMap<String, String>();
+		quannianFeicheng.put("name", "肥城");
+		quannianFeicheng.put("num", "0");
+		quanianDetailList.add(quannianFeicheng);
+		
+		for (int i = 0; i < yearTotal.size(); i ++) {
+			String xgsmc = yearTotal.get(i).get("xgsmc");
+			for (int j = 0; j < quanianDetailList.size(); j ++) {
+				String name = quanianDetailList.get(j).get("name");
+				String num = quanianDetailList.get(j).get("num");
+				// 数量+1
+				if (xgsmc.contains(name)) {
+					quanianDetailList.get(j).put("num", CommonUtil.add(num, "1"));
+				} 
+			}
+		}
+		
+		List<String> child2 = new ArrayList<String>();
+		child2.add("全年累计受考核客户数");
+		for (int j = 0; j < quanianDetailList.size(); j ++) {
+			String num = quanianDetailList.get(j).get("num");
+			child2.add(num);
+		}
+		child2.add(String.valueOf(yearTotal.size()));
+		excelList.add(child2);
+		
+		resMap.put("excelList", excelList);
+		
+		return resMap;
+	}
 }

+ 64 - 0
src/main/java/com/minpay/db/table/model/DwReportInf.java

@@ -108,6 +108,22 @@ public class DwReportInf extends AbstractMINBean {
     private String ddyFxbId;
 
     /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column dw_report_inf.DRI_YEAR_INTERVAL
+     *
+     * @mbggenerated
+     */
+    private String yearInterval;
+
+    /**
+     * This field was generated by MyBatis Generator.
+     * This field corresponds to the database column dw_report_inf.DRI_MONTH_INTERVAL
+     *
+     * @mbggenerated
+     */
+    private String monthInterval;
+
+    /**
      * This method was generated by MyBatis Generator.
      * This method returns the value of the database column dw_report_inf.DRI_ID
      *
@@ -418,4 +434,52 @@ public class DwReportInf extends AbstractMINBean {
     public void setDdyFxbId(String ddyFxbId) {
         this.ddyFxbId = ddyFxbId == null ? null : ddyFxbId.trim();
     }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column dw_report_inf.DRI_YEAR_INTERVAL
+     *
+     * @return the value of dw_report_inf.DRI_YEAR_INTERVAL
+     *
+     * @mbggenerated
+     */
+    public String getYearInterval() {
+        return yearInterval;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column dw_report_inf.DRI_YEAR_INTERVAL
+     *
+     * @param yearInterval the value for dw_report_inf.DRI_YEAR_INTERVAL
+     *
+     * @mbggenerated
+     */
+    public void setYearInterval(String yearInterval) {
+        this.yearInterval = yearInterval == null ? null : yearInterval.trim();
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method returns the value of the database column dw_report_inf.DRI_MONTH_INTERVAL
+     *
+     * @return the value of dw_report_inf.DRI_MONTH_INTERVAL
+     *
+     * @mbggenerated
+     */
+    public String getMonthInterval() {
+        return monthInterval;
+    }
+
+    /**
+     * This method was generated by MyBatis Generator.
+     * This method sets the value of the database column dw_report_inf.DRI_MONTH_INTERVAL
+     *
+     * @param monthInterval the value for dw_report_inf.DRI_MONTH_INTERVAL
+     *
+     * @mbggenerated
+     */
+    public void setMonthInterval(String monthInterval) {
+        this.monthInterval = monthInterval == null ? null : monthInterval.trim();
+    }
 }

+ 156 - 0
src/main/java/com/minpay/db/table/model/DwReportInfExample.java

@@ -1203,6 +1203,162 @@ public class DwReportInfExample {
             addCriterion("DRI_DDY_FXB_ID not between", value1, value2, "ddyFxbId");
             return (Criteria) this;
         }
+
+        public Criteria andYearIntervalIsNull() {
+            addCriterion("DRI_YEAR_INTERVAL is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalIsNotNull() {
+            addCriterion("DRI_YEAR_INTERVAL is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalEqualTo(String value) {
+            if(value == null ){
+                andYearIntervalIsNull();
+            } else {
+                addCriterion("DRI_YEAR_INTERVAL =", value, "yearInterval");
+            }
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalNotEqualTo(String value) {
+            if(value == null ){
+                andYearIntervalIsNotNull();
+            } else {
+                addCriterion("DRI_YEAR_INTERVAL <>", value, "yearInterval");
+            }
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalGreaterThan(String value) {
+            addCriterion("DRI_YEAR_INTERVAL >", value, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalGreaterThanOrEqualTo(String value) {
+            addCriterion("DRI_YEAR_INTERVAL >=", value, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalLessThan(String value) {
+            addCriterion("DRI_YEAR_INTERVAL <", value, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalLessThanOrEqualTo(String value) {
+            addCriterion("DRI_YEAR_INTERVAL <=", value, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalLike(String value) {
+            addCriterion("DRI_YEAR_INTERVAL like", value, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalNotLike(String value) {
+            addCriterion("DRI_YEAR_INTERVAL not like", value, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalIn(List<String> values) {
+            addCriterion("DRI_YEAR_INTERVAL in", values, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalNotIn(List<String> values) {
+            addCriterion("DRI_YEAR_INTERVAL not in", values, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalBetween(String value1, String value2) {
+            addCriterion("DRI_YEAR_INTERVAL between", value1, value2, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andYearIntervalNotBetween(String value1, String value2) {
+            addCriterion("DRI_YEAR_INTERVAL not between", value1, value2, "yearInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalIsNull() {
+            addCriterion("DRI_MONTH_INTERVAL is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalIsNotNull() {
+            addCriterion("DRI_MONTH_INTERVAL is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalEqualTo(String value) {
+            if(value == null ){
+                andMonthIntervalIsNull();
+            } else {
+                addCriterion("DRI_MONTH_INTERVAL =", value, "monthInterval");
+            }
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalNotEqualTo(String value) {
+            if(value == null ){
+                andMonthIntervalIsNotNull();
+            } else {
+                addCriterion("DRI_MONTH_INTERVAL <>", value, "monthInterval");
+            }
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalGreaterThan(String value) {
+            addCriterion("DRI_MONTH_INTERVAL >", value, "monthInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalGreaterThanOrEqualTo(String value) {
+            addCriterion("DRI_MONTH_INTERVAL >=", value, "monthInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalLessThan(String value) {
+            addCriterion("DRI_MONTH_INTERVAL <", value, "monthInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalLessThanOrEqualTo(String value) {
+            addCriterion("DRI_MONTH_INTERVAL <=", value, "monthInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalLike(String value) {
+            addCriterion("DRI_MONTH_INTERVAL like", value, "monthInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalNotLike(String value) {
+            addCriterion("DRI_MONTH_INTERVAL not like", value, "monthInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalIn(List<String> values) {
+            addCriterion("DRI_MONTH_INTERVAL in", values, "monthInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalNotIn(List<String> values) {
+            addCriterion("DRI_MONTH_INTERVAL not in", values, "monthInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalBetween(String value1, String value2) {
+            addCriterion("DRI_MONTH_INTERVAL between", value1, value2, "monthInterval");
+            return (Criteria) this;
+        }
+
+        public Criteria andMonthIntervalNotBetween(String value1, String value2) {
+            addCriterion("DRI_MONTH_INTERVAL not between", value1, value2, "monthInterval");
+            return (Criteria) this;
+        }
     }
 
     /**

+ 7 - 0
src/main/java/com/minpay/reportManage/action/ReportManageAction.java

@@ -212,6 +212,7 @@ public class ReportManageAction implements IMINAction {
     
     /**
      * 报表信息组装
+     * @param monthChoose	月范围
      * @param range			日期范围
      * @param timeRange		时分秒范围
      * @param reportInf		报表信息 
@@ -234,6 +235,7 @@ public class ReportManageAction implements IMINAction {
      */
     @MINAction(value = REPORT_NEED_DATA_DETAIL)
     public MINActionResult reportNeedDataDetail(
+    		@MINParam(key = "monthChoose") String monthChoose,
     		@MINParam(key = "range") String range,
     		@MINParam(key = "timeRange") String timeRange,
     		@MINParam(key = "reportInf") String reportInf,
@@ -252,6 +254,7 @@ public class ReportManageAction implements IMINAction {
     	String reportTypeId = reportInf.split("_")[0];
     	
     	Map<String, String> param = new HashMap<String, String>();
+    	param.put("monthChoose", monthChoose);
     	param.put("range", range);
     	param.put("timeRange", timeRange);
     	param.put("reportTypeId", reportTypeId);
@@ -295,6 +298,8 @@ public class ReportManageAction implements IMINAction {
     		@MINParam(key = "firstFileId") String firstFileId,
     		@MINParam(key = "secondFileId") String secondFileId,
     		@MINParam(key = "ddyFxbId") String ddyFxbId,
+    		@MINParam(key = "yearChoose") String yearChoose,
+    		@MINParam(key = "monthChoose") String monthChoose,
     		MINSession session
     		) throws MINBusinessException {
     	db = Service.lookup(IMINDataBaseService.class);
@@ -327,6 +332,8 @@ public class ReportManageAction implements IMINAction {
     	
     	report.setDayInterval(range.replaceAll(" ", ""));		// 日期时间段
     	report.setTimeInterval(timeRange.replaceAll(" ", ""));	// 时分秒时间段
+    	report.setYearInterval(yearChoose.replaceAll(" ", ""));
+    	report.setMonthInterval(monthChoose.replaceAll(" ", ""));
     	db.insertSelective(DwReportInfMapper.class, report);
     	
     	return res;

+ 37 - 5
src/main/resources/com/minpay/db/table/mapper/DwReportInfMapper.xml

@@ -19,6 +19,8 @@
     <result column="DRI_TIME_INTERVAL" jdbcType="VARCHAR" property="timeInterval" />
     <result column="DRI_ZDTTY_COMPARE_ID" jdbcType="VARCHAR" property="zdttyCompareId" />
     <result column="DRI_DDY_FXB_ID" jdbcType="VARCHAR" property="ddyFxbId" />
+    <result column="DRI_YEAR_INTERVAL" jdbcType="VARCHAR" property="yearInterval" />
+    <result column="DRI_MONTH_INTERVAL" jdbcType="VARCHAR" property="monthInterval" />
   </resultMap>
   <sql id="Example_Where_Clause">
     <!--
@@ -93,7 +95,7 @@
     -->
     DRI_ID, DRI_UPLOAD_DATE, DRI_FILE_NAME, DRI_CREAT_USER, DRI_BRANCH, DRI_TYPE, DRI_STATE, 
     DRI_TQTD_MONTH, DRI_TQTD_COUNT, DRI_DAY_INTERVAL, DRI_TIME_INTERVAL, DRI_ZDTTY_COMPARE_ID, 
-    DRI_DDY_FXB_ID
+    DRI_DDY_FXB_ID, DRI_YEAR_INTERVAL, DRI_MONTH_INTERVAL
   </sql>
   <select id="selectByExample" parameterType="com.minpay.db.table.model.DwReportInfExample" resultMap="BaseResultMap">
     <!--
@@ -150,12 +152,14 @@
       DRI_CREAT_USER, DRI_BRANCH, DRI_TYPE, 
       DRI_STATE, DRI_TQTD_MONTH, DRI_TQTD_COUNT, 
       DRI_DAY_INTERVAL, DRI_TIME_INTERVAL, DRI_ZDTTY_COMPARE_ID, 
-      DRI_DDY_FXB_ID)
+      DRI_DDY_FXB_ID, DRI_YEAR_INTERVAL, DRI_MONTH_INTERVAL
+      )
     values (#{id,jdbcType=VARCHAR}, #{uploadDate,jdbcType=VARCHAR}, #{fileName,jdbcType=VARCHAR}, 
       #{creatUser,jdbcType=VARCHAR}, #{branch,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, 
       #{state,jdbcType=VARCHAR}, #{tqtdMonth,jdbcType=VARCHAR}, #{tqtdCount,jdbcType=VARCHAR}, 
       #{dayInterval,jdbcType=VARCHAR}, #{timeInterval,jdbcType=VARCHAR}, #{zdttyCompareId,jdbcType=VARCHAR}, 
-      #{ddyFxbId,jdbcType=VARCHAR})
+      #{ddyFxbId,jdbcType=VARCHAR}, #{yearInterval,jdbcType=VARCHAR}, #{monthInterval,jdbcType=VARCHAR}
+      )
   </insert>
   <insert id="insertSelective" parameterType="com.minpay.db.table.model.DwReportInf">
     <!--
@@ -203,6 +207,12 @@
       <if test="ddyFxbId != null">
         DRI_DDY_FXB_ID,
       </if>
+      <if test="yearInterval != null">
+        DRI_YEAR_INTERVAL,
+      </if>
+      <if test="monthInterval != null">
+        DRI_MONTH_INTERVAL,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="id != null">
@@ -244,6 +254,12 @@
       <if test="ddyFxbId != null">
         #{ddyFxbId,jdbcType=VARCHAR},
       </if>
+      <if test="yearInterval != null">
+        #{yearInterval,jdbcType=VARCHAR},
+      </if>
+      <if test="monthInterval != null">
+        #{monthInterval,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <select id="countByExample" parameterType="com.minpay.db.table.model.DwReportInfExample" resultType="java.lang.Integer">
@@ -302,6 +318,12 @@
       <if test="record.ddyFxbId != null">
         DRI_DDY_FXB_ID = #{record.ddyFxbId,jdbcType=VARCHAR},
       </if>
+      <if test="record.yearInterval != null">
+        DRI_YEAR_INTERVAL = #{record.yearInterval,jdbcType=VARCHAR},
+      </if>
+      <if test="record.monthInterval != null">
+        DRI_MONTH_INTERVAL = #{record.monthInterval,jdbcType=VARCHAR},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -325,7 +347,9 @@
       DRI_DAY_INTERVAL = #{record.dayInterval,jdbcType=VARCHAR},
       DRI_TIME_INTERVAL = #{record.timeInterval,jdbcType=VARCHAR},
       DRI_ZDTTY_COMPARE_ID = #{record.zdttyCompareId,jdbcType=VARCHAR},
-      DRI_DDY_FXB_ID = #{record.ddyFxbId,jdbcType=VARCHAR}
+      DRI_DDY_FXB_ID = #{record.ddyFxbId,jdbcType=VARCHAR},
+      DRI_YEAR_INTERVAL = #{record.yearInterval,jdbcType=VARCHAR},
+      DRI_MONTH_INTERVAL = #{record.monthInterval,jdbcType=VARCHAR}
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
     </if>
@@ -373,6 +397,12 @@
       <if test="ddyFxbId != null">
         DRI_DDY_FXB_ID = #{ddyFxbId,jdbcType=VARCHAR},
       </if>
+      <if test="yearInterval != null">
+        DRI_YEAR_INTERVAL = #{yearInterval,jdbcType=VARCHAR},
+      </if>
+      <if test="monthInterval != null">
+        DRI_MONTH_INTERVAL = #{monthInterval,jdbcType=VARCHAR},
+      </if>
     </set>
     where DRI_ID = #{id,jdbcType=VARCHAR}
   </update>
@@ -393,7 +423,9 @@
       DRI_DAY_INTERVAL = #{dayInterval,jdbcType=VARCHAR},
       DRI_TIME_INTERVAL = #{timeInterval,jdbcType=VARCHAR},
       DRI_ZDTTY_COMPARE_ID = #{zdttyCompareId,jdbcType=VARCHAR},
-      DRI_DDY_FXB_ID = #{ddyFxbId,jdbcType=VARCHAR}
+      DRI_DDY_FXB_ID = #{ddyFxbId,jdbcType=VARCHAR},
+      DRI_YEAR_INTERVAL = #{yearInterval,jdbcType=VARCHAR},
+      DRI_MONTH_INTERVAL = #{monthInterval,jdbcType=VARCHAR}
     where DRI_ID = #{id,jdbcType=VARCHAR}
   </update>
 </mapper>

+ 5 - 4
src/main/resources/com/minpay/db/table/own/mapper/ReportServiceMapper.xml

@@ -223,19 +223,20 @@
 	</select>
 	<select id="selectDetail03ByDDYRB" resultType="hashmap" parameterType="java.util.Map">
 		SELECT
-		  DFD3_YHID    		yhid,
-		  SUM(DFD3_DYSC)    dysc
+			DFD3_XGSMC			xgsmc,
+			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}
+			 AND DFD3_SJRQ &gt;= #{beginTime,jdbcType=VARCHAR} and DFD3_SJRQ &lt;= #{endTime,jdbcType=VARCHAR}
 		</if>
 		   
 		GROUP BY DFD3_YHID
-		HAVING dysc &gt; 47
+		HAVING dysc &gt;= 48
 	</select>
 	<select id="selectDetail04ByGDYZLFXB" resultType="hashmap" parameterType="java.util.Map">
 		SELECT 	DFD4_XGSMC 'xgsmc',

+ 219 - 0
src/main/webapp/admin/common/chooseDdyFxb.html

@@ -0,0 +1,219 @@
+<!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="chooseComplete()">确定</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="choose">选择</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 = getQueryString("pageId");
+	// 报表类型
+	var reportType = "DDYZLFXB";
+	
+     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", 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 === 'algorithmDetail'){ // 算法查看
+		    	algorithmDetail(data);
+		    } else if (layEvent === "choose") {
+		    	chooseComplete(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 showDetail(data){
+    	  var openPageId = pageId + "-02";
+    	  openMainTabPage(openPageId, "详情查看", "ddy/reportManageDetailDdy.html?pageId="+openPageId+"&reportId="+data.id+"&type="+data.type+"&typeId="+data.typeId+"&fileName="+chineseUrlEncode(data.fileName), '', pageId, null);
+      }
+      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();
+		}
+	}
+	
+	// 选择完成
+	function chooseComplete(data) {
+		setTempVal("fxbReport", data);
+		deleteTabPageParent(pageId);
+	}
+    </script>
+</body>
+
+</html>

+ 4 - 4
src/main/webapp/admin/ddy/reportManageDdyZb.html

@@ -40,8 +40,8 @@
 	</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="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">
@@ -154,12 +154,12 @@
       
       function uploadExcel(){
     	  var openPageId = pageId + "-01";
-    	  openMainTabPage(openPageId, "报表生成", "ddy/reportProduceRb.html?pageId="+openPageId+"&timeType="+timeType+"&reportType="+reportType, '', pageId, reloadSearch);
+    	  openMainTabPage(openPageId, "报表生成", "ddy/reportProduceZb.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);
+    	  openMainTabPage(openPageId, "详情查看", "ddy/reportManageDetailDdyZb.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";

+ 25 - 67
src/main/webapp/admin/ddy/reportManageDetailDdyZb.html

@@ -9,95 +9,53 @@
 <body class="content">
 	<div class="shadow-content" style="margin:1.5rem; text-align: center;">
 		<p id = "reportTitle" style="margin:15px; font-size : 20px"></p>
+		<p id = "reportDiv"></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);
+	$("#reportTitle").html(fileName);
+	$.request({
+		action : 'ReportManageAction/reportInfDetail',
+		data : {
+			reportId : reportId
+		},
+		success : function(data) {
+			var reportDataJsonStr = data.data.data;
+			var reportData = eval('(' + reportDataJsonStr + ')');
+			var reportMap = reportData.reportMap;
+			var descStr = reportData.descStr;
+			for(var key in reportMap){
+				var replaceStr = "${" + key + "}";
+				descStr = descStr.replace(replaceStr, reportMap[key]);
 			}
-	  	});
-	// word
-	} else {
-		
-	}
+			
+			$("#reportDiv").html(descStr);
+			reportTable(reportData.excelList, typeId, false);
+		},
+		error : function(data2) {
+			$.ErrorAlert(data2.MINErrorMessage);
+		}
+  	});
 	
-	function reportTable(excelList, typeId,isType,isEdit) {
+	function reportTable(excelList, typeId,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 += '<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>
 

+ 388 - 0
src/main/webapp/admin/ddy/reportProduceZb.html

@@ -0,0 +1,388 @@
+<!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="请选择年范围" style = "display: inline-block;">
+				<input type="text" class="layui-input" id="monthChoose" placeholder="请选择月范围" style = "display: inline-block;">
+				<input type="text"  class="layui-input" id="weekRange" placeholder="请选择周范围" style = "display: inline-block;">
+			</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>
+		  <p id = "reportDiv"></p>
+		  <table id = "reportTable" class="layui-table">
+		  </table>
+		</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 myDate = new Date();
+			var nowYear = myDate.getFullYear();
+			var initYearRange = (nowYear-1) + "1226" + " - " + nowYear + "1225";
+			
+			var laydate = layui.laydate;
+			laydate.render({
+				elem: '#yearChoose'
+				,format : 'yyyyMMdd'
+				,value: initYearRange
+				,range : true
+				,trigger: 'click' //采用click弹出
+				,done: function(value, date, endDate){
+					var minDate = value.replace(" ", "").replace(" ", "").split("-")[0];
+					var maxDate = value.replace(" ", "").replace(" ", "").split("-")[1];
+					$("#monthChoose").val('');
+					monthChoose.config.min = {
+							year : minDate.substring(0,4),
+							month : parseInt(minDate.substring(4, 6)) - 1,
+							date : minDate.substring(6, 8),
+							hours : 0,
+							minutes : 0,
+							seconds : 0
+					}
+					monthChoose.config.max = {
+							year : maxDate.substring(0,4),
+							month : parseInt(maxDate.substring(4, 6)) - 1,
+							date : maxDate.substring(6, 8),
+							hours : 0,
+							minutes : 0,
+							seconds : 0
+					}
+				}
+			});
+			
+			var monthChoose = laydate.render({
+				elem: '#monthChoose'
+				,format : 'yyyyMMdd'
+				,range : true
+				,trigger: 'click' //采用click弹出
+				,done: function(value, date, endDate){
+					var minDate = value.replace(" ", "").replace(" ", "").split("-")[0];
+					var maxDate = value.replace(" ", "").replace(" ", "").split("-")[1];
+					$("#weekRange").val('');
+					weekChoose.config.min = {
+							year : minDate.substring(0,4),
+							month : parseInt(minDate.substring(4, 6)) - 1,
+							date : minDate.substring(6, 8),
+							hours : 0,
+							minutes : 0,
+							seconds : 0
+					}
+					weekChoose.config.max = {
+							year : maxDate.substring(0,4),
+							month : parseInt(maxDate.substring(4, 6)) - 1,
+							date : maxDate.substring(6, 8),
+							hours : 0,
+							minutes : 0,
+							seconds : 0
+					}
+				}
+				,min : (nowYear-1) + "-12-26"
+				,max : nowYear + "-12-25"
+			});
+			
+			var weekChoose = laydate.render({
+				elem: '#weekRange'
+				,format : 'yyyyMMdd'
+				,range : true
+				,trigger: 'click' //采用click弹出
+			});
+		})
+		// 范围类型
+		layui.use('form', function(){
+			var form = layui.form;
+			
+			$.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 yearChoose = $("#yearChoose").val();
+				var monthChoose = $("#monthChoose").val();
+				var weekRange = $("#weekRange").val();
+				if (isEmpty(yearChoose)) {
+					$.ErrorAlert("请选择年范围!");
+					return;
+				}
+				if (isEmpty(monthChoose)) {
+					$.ErrorAlert("请选择月范围!");
+					return;
+				}
+				if (isEmpty(weekRange)) {
+					$.ErrorAlert("请选择周范围!");
+					return;
+				}
+				$.request({
+					action : 'ReportManageAction/fileInfReportSubmit',
+					data : {
+						reportData : JSON.stringify(reportData),
+						reportInf : reportInf,
+						fileName : fileName,
+						range : weekRange,
+						yearChoose : yearChoose,
+						monthChoose : monthChoose
+					},
+					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); 
+		}
+		
+		// 报表excel
+		var reportData = null;
+		// 预览
+		function tableYulan() {
+			var reportInf = $("#reportTypeDiv").find("select option:selected").val();
+			var yearChoose = $("#yearChoose").val();
+			var monthChoose = $("#monthChoose").val();
+			var weekRange = $("#weekRange").val();
+			if (isEmpty(yearChoose)) {
+				$.ErrorAlert("请选择年范围!");
+				return;
+			}
+			if (isEmpty(monthChoose)) {
+				$.ErrorAlert("请选择月范围!");
+				return;
+			}
+			if (isEmpty(weekRange)) {
+				$.ErrorAlert("请选择周范围!");
+				return;
+			}
+			
+			// 查询符合条件的明细数据,生成预览数据
+			$.request({
+				action : 'ReportManageAction/reportNeedDataDetail',
+				data : {
+					reportInf : reportInf,
+					yearChoose : yearChoose,
+					range : weekRange,
+					monthChoose : monthChoose
+				},
+				success : function(data) {
+					if (data.code == 0) {
+						reportData = data.data;
+						
+						var reportMap = data.data.reportMap;
+						var descStr = data.data.descStr;
+						for(var key in reportMap){
+							var replaceStr = "${" + key + "}";
+							descStr = descStr.replace(replaceStr, reportMap[key]);
+						}
+						
+						$("#reportDiv").html(descStr);
+						initExcelData(reportData.excelList, "reportTable", false);
+						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>