瀏覽代碼

数据仓库查询功能修复BUG

zmy18710171902 4 年之前
父節點
當前提交
e90f55bb6d

+ 29 - 3
src/main/java/com/minpay/common/service/impl/Report95598ServiceImpl.java

@@ -7,9 +7,11 @@ import com.minpay.common.service.IReportService;
 import com.minpay.common.util.*;
 import com.minpay.db.table.mapper.*;
 import com.minpay.db.table.model.*;
+import com.minpay.db.table.own.mapper.ICommMapper;
 import com.minpay.db.table.own.mapper.IReportBatchMapper;
 import com.minpay.db.table.own.mapper.IZb95598ReportMapper;
 import com.minpay.db.table.own.mapper.ReportServiceMapper;
+import com.minpay.reportManage.action.r95598.Util95598zb;
 import com.startup.minpay.frame.business.MINHttpServletRequestContext;
 import com.startup.minpay.frame.exception.MINBusinessException;
 import com.startup.minpay.frame.jdbc.MINRowBounds;
@@ -85,12 +87,36 @@ public class Report95598ServiceImpl implements IReport95598Service {
 		String end = StringUtil.getStartAndEndDatetime(range,timeRange,"2");
 		mm.put("start",start);
 		mm.put("end",end);
+		//单位别名翻译
+		List<Map<String,String>> unitMapp = db.getMybatisMapper(ICommMapper.class).selectUnitMapps(mm);
+		mm.put("DICT_GCODE","95598GDLX");
+		//查询工单业务类型
+		List<Map<String,String>> gdMapp = db.getMybatisMapper(ICommMapper.class).selectGdType(mm);
 		//95598业务受理情况
-		//户数数据
+		//单位维度数据
 		List<Map<String,String>> list = db.getMybatisMapper(IZb95598ReportMapper.class).selectBeforeIndex(mm);
-		//分类汇总数据
+		//分类明细汇总数据
 		List<Map<String,String>> list2 = db.getMybatisMapper(IZb95598ReportMapper.class).selectFltjYwsl(mm);
-		return null;
+		Map<String,String> temp = new HashMap<>();
+		Map<String,String> temp2 = new HashMap<>();
+
+		if(list != null){
+			for (int i = 0; i < list.size(); i++) {
+				temp = list.get(i);
+				Util95598zb.operateData(temp,list2,unitMapp,gdMapp);//按单位统计
+			}
+		}
+		if(list != null){
+			for (int i = 0; i < list.size(); i++) {
+				Util95598zb.operateDescData(temp2,list2,unitMapp,gdMapp);//按单位统计
+			}
+		}
+		Map<String,Object> rstMap = new HashMap<>();
+		rstMap.put("list1",list);
+		for (int i = 0; i < list.size(); i++) {
+			System.out.println(list.get(i).toString());
+		}
+		return rstMap;
 	}
 
 	@Override

+ 19 - 0
src/main/java/com/minpay/db/table/own/mapper/ICommMapper.java

@@ -0,0 +1,19 @@
+package com.minpay.db.table.own.mapper;
+import com.minpay.db.table.model.DwFileDetail27;
+import com.startup.minpay.frame.jdbc.IMINMybatisMapper;
+import com.startup.minpay.frame.jdbc.MINRowBounds;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+public interface ICommMapper extends IMINMybatisMapper {
+    /**
+     * 查询单位名称映射
+     * @param mm
+     * @return
+     */
+    List<Map<String, String>> selectUnitMapps(Map<String, Object> mm);
+
+    List<Map<String, String>> selectGdType(Map<String, Object> mm);
+}

+ 64 - 0
src/main/java/com/minpay/reportManage/action/r95598/Util95598zb.java

@@ -0,0 +1,64 @@
+package com.minpay.reportManage.action.r95598;
+
+import com.minpay.common.util.ArithUtils;
+import com.minpay.common.util.StringUtil;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 95598工单周报工具类
+ */
+public class Util95598zb {
+
+    /**
+     * 统计某单位下数据
+     * @param temp      维度数据
+     * @param list2     明细汇总数据
+     * @param unitMapp  单位名称映射关系表
+     * @param gdMapp    工单类型
+     */
+    public static void operateData(Map<String, String> temp, List<Map<String, String>> list2, List<Map<String, String>> unitMapp, List<Map<String, String>> gdMapp) {
+        String unitName = temp.get("ORZ_NAME");
+        Map<String,String> tempList = new HashMap<>();
+        int sum = 0;
+        for (int j = 0; j < gdMapp.size(); j++) {
+            for (int i = 0; i < list2.size(); i++) {
+                Map<String,String> tempRank = new HashMap<>();
+                tempList = list2.get(i);
+                if(unitName.equals(getUnitName(tempList.get("DFD33_GDDW"),unitMapp))){
+                    if(gdMapp.get(j).get("DICT_CNAME").equals(tempList.get("DFD33_YWLX"))){//业务类型相同
+                        sum = StringUtil.ObjToInt(tempList.get("COU2"));
+                        temp.put(gdMapp.get(j).get("DICT_CODE"), tempList.get("COU1"));
+                    }
+                }
+            }
+        }
+        temp.put("TOTAL",sum + "");
+    }
+
+    private static String getUnitName(String gddw, List<Map<String, String>> unitMapp) {
+        for (int i = 0; i < unitMapp.size(); i++) {
+            if(gddw.equals(unitMapp.get(i).get("SUB_NAME"))){
+                return unitMapp.get(i).get("MAIN_NAME");
+            }
+        }
+        return "其他";
+    }
+
+    public static void operateDescData(Map<String, String> temp, List<Map<String, String>> list2, List<Map<String, String>> unitMapp, List<Map<String, String>> gdMapp) {
+        Map<String,String> tempList = new HashMap<>();
+        int sum = 0;
+        for (int j = 0; j < gdMapp.size(); j++) {
+            for (int i = 0; i < list2.size(); i++) {
+                Map<String,String> tempRank = new HashMap<>();
+                tempList = list2.get(i);
+                if(gdMapp.get(j).get("DICT_CNAME").equals(tempList.get("DFD33_YWLX"))){//业务类型相同
+                    sum = StringUtil.ObjToInt(tempList.get("COU2"));
+                    temp.put(gdMapp.get(j).get("DICT_CODE"), tempList.get("COU1"));
+                }
+            }
+        }
+    }
+}

+ 10 - 0
src/main/resources/com/minpay/db/table/own/mapper/ICommMapper.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.minpay.db.table.own.mapper.ICommMapper">
+	<select id="selectUnitMapps" parameterType="map" resultType="map">
+		SELECT MAIN_CODE,MAIN_NAME,SUB_NAME FROM PUB_BASE_ORZNAMES_MAPP ORDER BY MAIN_CODE
+	</select>
+	<select id="selectGdType" parameterType="map" resultType="map">
+		SELECT DICT_CODE,DICT_CNAME FROM PUB_BASE_DICT WHERE DICT_GCODE = #{DICT_GCODE}
+	</select>
+</mapper>

+ 11 - 9
src/main/resources/com/minpay/db/table/own/mapper/IZb95598ReportMapper.xml

@@ -7,12 +7,10 @@
 			A.ORZ_NAME,
 			A.ORZ_SHORT_NAME,
 			A.ORZ_SORT,
-			B.HS_NUM,
-			C.DICT_CNAME
+			B.HS_NUM
 		FROM
 			PUB_BASE_ORZ A
 			LEFT JOIN PUB_BASE_HS B ON A.ORZ_SHORT_NAME = B.HS_ORZ_NAME
-			LEFT JOIN ( SELECT DICT_CNAME FROM PUB_BASE_DICT WHERE DICT_GCODE = '95598GDLX' ) C ON 1 = 1
 		WHERE
 			A.ORZ_LEVEL = '3'
 		ORDER BY
@@ -23,26 +21,30 @@
 		SELECT
 			A.DFD33_GDDW,
 			A.DFD33_YWLX,
+			A.DFD33_YWZL,
 			A.COU COU1,
-			B.COU COU2
+			B.COU COU2,
+			C.MAIN_NAME
 		FROM
-			( SELECT DFD33_GDDW, DFD33_YWLX, COUNT( 1 ) COU FROM DW_FILE_DETAIL_33
+			(SELECT DFD33_GDDW, DFD33_YWLX,DFD33_YWZL, COUNT(1) COU FROM DW_FILE_DETAIL_33
 			WHERE 1=1
 			<include refid="sqlWhere"></include>
-			GROUP BY DFD33_GDDW, DFD33_YWLX ) A
-			LEFT JOIN ( SELECT DFD33_GDDW, COUNT( 1 ) COU FROM DW_FILE_DETAIL_33
+			GROUP BY DFD33_GDDW, DFD33_YWLX,DFD33_YWZL ) A
+			LEFT JOIN (SELECT DFD33_GDDW, COUNT(1) COU FROM DW_FILE_DETAIL_33
 			WHERE 1=1
 			<include refid="sqlWhere"></include>
 			GROUP BY DFD33_GDDW ) B ON A.DFD33_GDDW = B.DFD33_GDDW
+			LEFT JOIN (SELECT MAIN_CODE,MAIN_NAME,SUB_NAME FROM PUB_BASE_ORZNAMES_MAPP) C ON  C.SUB_NAME = A.DFD33_GDDW
 		ORDER BY
 			A.DFD33_GDDW
 	</select>
 	<sql id="sqlWhere">
 		<if test="start != null and start != ''">
-			AND DFD33_SLSJ &gt; #{start}
+			AND DFD33_SLSJ &gt;= #{start}
 		</if>
 		<if test="end != null and end != ''">
-			AND DFD33_SLSJ &lt; #{end}
+			AND DFD33_SLSJ &lt;= #{end}
 		</if>
+
 	</sql>
 </mapper>

+ 30 - 7
src/main/webapp/admin/95598/zb/report95598zbProduce.html

@@ -92,13 +92,13 @@
 					<br>
 					<p id ="desc11" class="desc_label"></p>
 					<br>
-					<p class="desc_label" style="color: #ff0000;">注:线路负载率持续1小时在70%-100%为重载,持续1小时在100%以上为过载。</p>
+					<p class="desc_label" style="color: #ff0000;"></p>
 					<br>
 					<table id="demo1" lay-filter="test"></table>
 				</div>
 				<!--线路过载-->
 				<div class="layui-tab-item">
-					<table id="demo1x" lay-filter="test"></table>
+					<table id="demo2" lay-filter="test"></table>
 				</div>
 				<!--配变重载-->
 				<div class="layui-tab-item">
@@ -106,19 +106,19 @@
 					<br>
 					<p id ="desc22" class="desc_label"></p>
 					<br>
-					<p  class="desc_label"  style="color: #ff0000;">注:配变负载率连续2小时在80%-100%之间为重载,连续2小时在100%以上为过载。</p>
+					<p  class="desc_label"  style="color: #ff0000;"></p>
 					<br>
-					<table id="demo2" lay-filter="test"></table>
+					<table id="demo3" lay-filter="test"></table>
 				</div>
 				<!--配变过载-->
 				<div class="layui-tab-item">
-					<table id="demo2x" lay-filter="test"></table>
+					<table id="demo4" lay-filter="test"></table>
 				</div>
 				<!--抢修类工单-->
 				<div class="layui-tab-item">
 					<p  id ="desc3"  class="desc_label"></p>
 					<br>
-					<table id="demo3" lay-filter="test"></table>
+					<table id="demo5" lay-filter="test"></table>
 				</div>
 
 			</div>
@@ -340,7 +340,7 @@
 		// 报表返回数据
 		var resJsonStr = null;
 		// 预览
-		function tableYulan() {debugger
+		function tableYulan() {
 			var reportInf = $("#reportTypeDiv").find("select option:selected").val();//所选报表类型
 			var dayRange = $("#dayRange").val();//日报-年月日
 			var dateRange = $("#dateRange").val();//周报-年月日-年月日
@@ -382,6 +382,29 @@
 							$("#gongjubiao").hide();
 
 						}
+						console.log(data)
+						$table.render({
+							elem: '#demo1'
+							,limit:100
+							,cols: [[ //表头
+								{field: 'ORZ_NAME',title:'单位',width:150,rowspan:2}
+								,{field: 'TOTAL', title: '工单数',rowspan:2}
+								,{field: 'HS_NUM', title: '万户工单数',width:150,rowspan:2}
+								,{field: '', title: '其中',colspan:8}
+							],
+							[
+								{field: 'A000001', title: '投诉'}
+								,{field: 'A000002', title: '举报'}
+								,{field: 'A000003', title: '意见'}
+								,{field: 'A000004', title: '建议'}
+								,{field: 'A000005', title: '表扬'}
+								,{field: 'A000006', title: '咨询'}
+								,{field: 'A000008', title: '故障报修'}
+								,{field: 'A000007', title: '服务申请'}
+							]
+							],
+							data:data.data.resList.list1
+						});
 						goStep(3);
 			    	} else {
 			    		$.ErrorAlert(res.MINErrorMessage);