فهرست منبع

台区停电周报

tudc 4 سال پیش
والد
کامیت
395f681a52

+ 11 - 1
src/main/java/com/minpay/branchReportType/action/BranchReportTypeAction.java

@@ -50,6 +50,7 @@ public class BranchReportTypeAction implements IMINAction {
      */
     @MINAction(value = BRANCH_REPORTTYPE_QUERY)
     public MINActionResult branchReportTypeQuery(
+    	@MINParam(key = "timeType") String timeType,
         MINSession session
     ) throws MINBusinessException{
         MINActionResult res = new MINActionResult();
@@ -61,7 +62,16 @@ public class BranchReportTypeAction implements IMINAction {
         // 管理员
         DwBranchReportTypeExample branchReportTypeExample = new DwBranchReportTypeExample();
         if (!Constant.SYSTEM_BRANCH_ID.equals(branchId)) {
-        	branchReportTypeExample.createCriteria().andBranchidEqualTo(branchId);
+        	// 日报周报月报搜索
+        	if (!CommonUtil.isEmpty(timeType)) {
+        		branchReportTypeExample.createCriteria().andBranchidEqualTo(branchId).andTimeTypeEqualTo(timeType);
+        	} else {
+        		branchReportTypeExample.createCriteria().andBranchidEqualTo(branchId);
+        	}
+        } else {
+        	if (!CommonUtil.isEmpty(timeType)) {
+        		branchReportTypeExample.createCriteria().andBranchidEqualTo(branchId).andTimeTypeEqualTo(timeType);
+        	}
         }
 		List<DwBranchReportType> branchFileType = db.selectByExample(DwBranchReportTypeMapper.class, branchReportTypeExample);
 		// 设置返回值

+ 2 - 1
src/main/java/com/minpay/common/service/IDianwangService.java

@@ -5,6 +5,7 @@ import java.util.List;
 import java.util.Map;
 
 import com.startup.minpay.frame.exception.MINBusinessException;
+import com.startup.minpay.frame.jdbc.MINRowBounds;
 import com.startup.minpay.frame.service.base.IMINLocalService;
 
 /**
@@ -13,5 +14,5 @@ import com.startup.minpay.frame.service.base.IMINLocalService;
  *
  */
 public interface IDianwangService extends IMINLocalService {
-	public List queryFileInfDetail(Map<String, String> param) throws MINBusinessException;
+	public List queryFileInfDetail(Map<String, String> param, MINRowBounds rows) throws MINBusinessException;
 }

+ 3 - 2
src/main/java/com/minpay/common/service/impl/DianwangServiceImpl.java

@@ -13,6 +13,7 @@ import com.minpay.db.table.model.DwFileDetail00;
 import com.minpay.db.table.model.DwFileDetail00Example;
 import com.startup.minpay.frame.constant.IMINBusinessConstant;
 import com.startup.minpay.frame.exception.MINBusinessException;
+import com.startup.minpay.frame.jdbc.MINRowBounds;
 import com.startup.minpay.frame.service.base.IMINDataBaseService;
 import com.startup.minpay.frame.service.base.Service;
 import com.startup.minpay.frame.target.MINComponent;
@@ -29,7 +30,7 @@ public class DianwangServiceImpl implements IDianwangService {
 	private IMINDataBaseService db;
 
 	@Override
-	public List queryFileInfDetail(Map<String, String> param) throws MINBusinessException {
+	public List queryFileInfDetail(Map<String, String> param, MINRowBounds rows) throws MINBusinessException {
 		db = Service.lookup(IMINDataBaseService.class);
 		
 		String fileType = param.get("fileType");
@@ -48,7 +49,7 @@ public class DianwangServiceImpl implements IDianwangService {
     		}
     		
     		fileDetail00Example.setOrderByClause("CAST(DFD0_NUMBER AS SIGNED)");
-    		List<DwFileDetail00> resList = db.selectByExample(DwFileDetail00Mapper.class, fileDetail00Example);
+    		List<DwFileDetail00> resList = db.selectByExample(DwFileDetail00Mapper.class, fileDetail00Example, rows);
     		
     		resList = Service.lookup(IFormatService.class).formatDate(resList, "date");
     		resList = Service.lookup(IFormatService.class).formatDateTime(resList, "startTime", "endTime");

+ 303 - 27
src/main/java/com/minpay/common/service/impl/ReportServiceImpl.java

@@ -3,6 +3,7 @@ package com.minpay.common.service.impl;
 
 import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -42,19 +43,23 @@ public class ReportServiceImpl implements IReportService {
 		String reportTypeId = param.get("reportTypeId");
 		
 		Map<String, Object> resMap = new HashMap<String, Object>();
-    	// 台区停电
+    	// 台区停电
     	if (Constant.REPORT_TYPE_00.equals(reportTypeId)) {
     		String monthNum = param.get("monthNum");
     		String countNum = param.get("countNum");
     		
-    		List<List<String>> resList = reportType00(range, timeRange, monthNum, countNum);
+    		List<List<String>> resList = reportTypeTQTDRB(range, timeRange, monthNum, countNum);
+    		resMap.put("resList", resList);
+    	// 台区停电周报
+    	} else if (Constant.REPORT_TYPE_01.equals(reportTypeId)) {
+    		List<List<String>> resList = reportTypeTQTDZB(range, timeRange);
     		resMap.put("resList", resList);
     	}
 		return resMap;
 	}
 	
 	/**
-	 * 台区停电日报生成
+	 * 台区停电日报
 	 * @param range			日期范围
 	 * @param timeRange		时间段范围
 	 * @param monthNum		几个月内停电
@@ -63,17 +68,18 @@ public class ReportServiceImpl implements IReportService {
 	 * @throws MINBusinessException
 	 * @throws ParseException 
 	 */
-	public List<List<String>> reportType00(String range, String timeRange, String monthNum, String countNum) throws MINBusinessException, ParseException {
+	public List<List<String>> reportTypeTQTDRB(String range, String timeRange, String monthNum, String countNum) throws MINBusinessException, ParseException {
 		IMINDataBaseService db = Service.lookup(IMINDataBaseService.class);
 		List<List<String>> resList = new ArrayList<List<String>>();
 		Map<String, Object> param = new HashMap<String, Object>();
 		String beginTime = null;
 		String endTime = null;
+		range = range.replaceAll(" ", "");
 		String[] rangeArray = range.split("-");
 		timeRange = timeRange.replaceAll(" ", "");
 		if (CommonUtil.isEmpty(timeRange)) {
 			beginTime = rangeArray[0] + "000000";
-			endTime = rangeArray[1] + "000000";
+			endTime = rangeArray[1] + "235959";
 		} else {
 			String[] timeRangeArray = timeRange.split("-");
 			beginTime = rangeArray[0] + timeRangeArray[0];
@@ -269,32 +275,302 @@ public class ReportServiceImpl implements IReportService {
 		return resList;
 	}
 	
-	public void countTaiqu(Map<String, Object> taiQuMap, Object taiQuObj, String addressNum) {
-		Map<String, Object> taiQu;
-		// 第一次统计
-		if (taiQuObj == null) {
-			taiQu = new HashMap<String, Object>();
-			taiQu.put(addressNum, 1);
-			return;
+	/**
+	 * 台区停电周报
+	 * @param range
+	 * @param timeRange
+	 * @return
+	 * @throws MINBusinessException
+	 * @throws ParseException
+	 */
+	public List<List<String>> reportTypeTQTDZB(String range, String timeRange) throws MINBusinessException, ParseException {
+		IMINDataBaseService db = Service.lookup(IMINDataBaseService.class);
+		Map<String, Object> param = new HashMap<String, Object>();
+		String beginTime = null;
+		String endTime = null;
+		range = range.replaceAll(" ", "");
+		String[] rangeArray = range.split("-");
+		timeRange = timeRange.replaceAll(" ", "");
+		if (CommonUtil.isEmpty(timeRange)) {
+			beginTime = rangeArray[0] + "000000";
+			endTime = rangeArray[1] + "235959";
+		} else {
+			String[] timeRangeArray = timeRange.split("-");
+			beginTime = rangeArray[0] + timeRangeArray[0];
+			endTime = rangeArray[1] + timeRangeArray[1];
+		}
+		param.put("beginTime", beginTime);
+		param.put("endTime", endTime);
+		
+		
+		List<List<String>> resList = new ArrayList<List<String>>();
+		List<String> title = new ArrayList<String>();
+		title.add("单位\\分类");
+		title.add("管理台区总数");
+		title.add("1个月内累计停电台次");
+		title.add("上月累计停电台次");
+		title.add("去年同期累计停电台次");
+		title.add("1个月内平均停电频次");
+		title.add("平均停电频次排名");
+		title.add("1个月内平均停电时长");
+		title.add("平均停电时长排名");
+		resList.add(title);
+		List<String> xintai = new ArrayList<String>();
+		xintai.add("新泰");
+		xintai.add(totalMap.get("xintai"));
+		List<String> daiyue = new ArrayList<String>();
+		daiyue.add("岱岳");
+		daiyue.add(totalMap.get("daiyue"));
+		List<String> ningyang = new ArrayList<String>();
+		ningyang.add("宁阳");
+		ningyang.add(totalMap.get("ningyang"));
+		List<String> taishan = new ArrayList<String>();
+		taishan.add("泰山");
+		taishan.add(totalMap.get("taishan"));
+		List<String> dongping = new ArrayList<String>();
+		dongping.add("东平");
+		dongping.add(totalMap.get("dongping"));
+		List<String> feicheng = new ArrayList<String>();
+		feicheng.add("肥城");
+		feicheng.add(totalMap.get("feicheng"));
+		List<String> taishanjingqu = new ArrayList<String>();
+		taishanjingqu.add("泰山景区");
+		taishanjingqu.add(totalMap.get("taishanjingqu"));
+		List<String> gaoxin = new ArrayList<String>();
+		gaoxin.add("高新");
+		gaoxin.add(totalMap.get("gaoxin"));
+		List<String> heji = new ArrayList<String>();
+		heji.add("合计");
+		heji.add(totalMap.get("heji"));
+
+		
+		resList.add(xintai);
+		resList.add(daiyue);
+		resList.add(ningyang);
+		resList.add(taishan);
+		resList.add(dongping);
+		resList.add(feicheng);
+		resList.add(taishanjingqu);
+		resList.add(gaoxin);
+		resList.add(heji);
+		
+		//本月停电次数
+		List<Map<String, String>> areaCountList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param);
+		String totalCount = "0";
+		for (Map<String, String> map : areaCountList) {
+			String area = map.get("area");
+			String count = map.get("count");
+			if ("新泰".equals(area)) {
+				xintai.add(count);
+			} else if ("岱岳".equals(area)) {
+				daiyue.add(count);
+			} else if ("宁阳".equals(area)) {
+				ningyang.add(count);
+			} else if ("泰山".equals(area)) {
+				taishan.add(count);
+			} else if ("东平".equals(area)) {
+				dongping.add(count);
+			} else if ("肥城".equals(area)) {
+				feicheng.add(count);
+			} else if ("泰山景区".equals(area)) {
+				taishanjingqu.add(count);
+			} else if ("高新".equals(area)) {
+				gaoxin.add(count);
+			}
+			totalCount = CommonUtil.add(totalCount, count);
 		}
-		// 重复统计次数+1
-		taiQu = (Map<String, Object>)taiQuObj;
-		for(Map.Entry<String, Object> entry : taiQu.entrySet()){
-			int itemVal = (Integer)entry.getValue();
-			String key = entry.getKey();
-			if (addressNum == key) {
-				taiQu.put(key, (itemVal + 1));
-				if ((itemVal + 1) >= 3) {
-					Object countObj = taiQu.get(key);
-					if (countObj == null) {
-						taiQu.put("count", 1);
-					} else {
-						taiQu.put("count", (Integer)countObj + 1);
+		heji.add(totalCount);
+		// 没有数据的区域数值为0
+		for (List<String> list : resList) {
+			if (list.size() == 2) {
+				list.add("0");
+			}
+		}
+		//上个与月停电次数
+		beginTime = DateUtil.dateAddMonth(rangeArray[0], -1);
+		endTime = DateUtil.dateAddMonth(rangeArray[1], -1);
+		if (CommonUtil.isEmpty(timeRange)) {
+			beginTime = beginTime + "000000";
+			endTime = endTime + "235959";
+		} else {
+			String[] timeRangeArray = timeRange.split("-");
+			beginTime = beginTime + timeRangeArray[0];
+			endTime = endTime + timeRangeArray[1];
+		}
+		param.put("beginTime", beginTime);
+		param.put("endTime", endTime);
+		List<Map<String, String>> lastMonthAreaCountList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param);
+		String lastMonthtotalCount = "0";
+		for (Map<String, String> map : lastMonthAreaCountList) {
+			String area = map.get("area");
+			String count = map.get("count");
+			if ("新泰".equals(area)) {
+				xintai.add(count);
+			} else if ("岱岳".equals(area)) {
+				daiyue.add(count);
+			} else if ("宁阳".equals(area)) {
+				ningyang.add(count);
+			} else if ("泰山".equals(area)) {
+				taishan.add(count);
+			} else if ("东平".equals(area)) {
+				dongping.add(count);
+			} else if ("肥城".equals(area)) {
+				feicheng.add(count);
+			} else if ("泰山景区".equals(area)) {
+				taishanjingqu.add(count);
+			} else if ("高新".equals(area)) {
+				gaoxin.add(count);
+			}
+			lastMonthtotalCount = CommonUtil.add(lastMonthtotalCount, count);
+		}
+		heji.add(lastMonthtotalCount);
+		// 没有数据的区域数值为0
+		for (List<String> list : resList) {
+			if (list.size() == 3) {
+				list.add("0");
+			}
+		}
+		//去年同期停电次数
+		beginTime = DateUtil.dateAddYear(rangeArray[0], -1);
+		endTime = DateUtil.dateAddYear(rangeArray[1], -1);
+		if (CommonUtil.isEmpty(timeRange)) {
+			beginTime = beginTime + "000000";
+			endTime = endTime + "235959";
+		} else {
+			String[] timeRangeArray = timeRange.split("-");
+			beginTime = beginTime + timeRangeArray[0];
+			endTime = endTime + timeRangeArray[1];
+		}
+		param.put("beginTime", beginTime);
+		param.put("endTime", endTime);
+		List<Map<String, String>> lastYearAreaCountList = db.getMybatisMapper(ReportServiceMapper.class).selectDetail00ByArea(param);
+		String lastYeartotalCount = "0";
+		for (Map<String, String> map : lastYearAreaCountList) {
+			String area = map.get("area");
+			String count = map.get("count");
+			if ("新泰".equals(area)) {
+				xintai.add(count);
+			} else if ("岱岳".equals(area)) {
+				daiyue.add(count);
+			} else if ("宁阳".equals(area)) {
+				ningyang.add(count);
+			} else if ("泰山".equals(area)) {
+				taishan.add(count);
+			} else if ("东平".equals(area)) {
+				dongping.add(count);
+			} else if ("肥城".equals(area)) {
+				feicheng.add(count);
+			} else if ("泰山景区".equals(area)) {
+				taishanjingqu.add(count);
+			} else if ("高新".equals(area)) {
+				gaoxin.add(count);
+			}
+			lastYeartotalCount = CommonUtil.add(lastYeartotalCount, count);
+		}
+		heji.add(lastYeartotalCount);
+		// 没有数据的区域数值为0
+		for (List<String> list : resList) {
+			if (list.size() == 4) {
+				list.add("0");
+			}
+		}
+		
+		// 1个月内平均停电频次
+		for (int i = 1; i < resList.size(); i ++) {
+			List<String> list = resList.get(i);
+			String totalNum = list.get(1);
+			String tingdianNum = list.get(2);
+			String pinci = "0";
+			if (!(CommonUtil.compare(totalNum, "0") == 0)) {
+				pinci = CommonUtil.divide(tingdianNum, totalNum, 2);
+			}
+			list.add(pinci);
+		}
+		
+		List<Integer> pinciPaiming = new ArrayList<Integer>();
+		// 平均停电频次排名,合计不参与排名
+		for (int i = 1; i < resList.size() - 1; i ++) {
+			String pinci = resList.get(i).get(5);
+			// 排名
+			int num = 1;
+			for (int j = 1; j < resList.size() - 1; j ++) {
+				// 不和本次作对比
+				if (i != j) {
+					String comparePinci = resList.get(j).get(5);
+					// 不比对比频次大
+					if (CommonUtil.compare(comparePinci, pinci) == -1) {
+						num ++;
 					}
-					// 合计次数累计
-					taiQuMap.put("heji", (Integer)taiQuMap.get("heji") + 1);
 				}
 			}
+			// 相同次数的往后排
+			while (pinciPaiming.contains(num)) {
+				num ++;
+			}
+			pinciPaiming.add(num);
+			resList.get(i).add(String.valueOf(num));
+		}
+		heji.add("");
+		
+		String totalTimeMinute = "0";
+		for (Map<String, String> map : areaCountList) {
+			String area = map.get("area");
+			String timeMinute = map.get("timeMinute");
+			String count = map.get("count");
+			if ("新泰".equals(area)) {
+				xintai.add(CommonUtil.divide(CommonUtil.divide(timeMinute, "60", 4), count, 2));
+			} else if ("岱岳".equals(area)) {
+				daiyue.add(CommonUtil.divide(CommonUtil.divide(timeMinute, "60", 4), count, 2));
+			} else if ("宁阳".equals(area)) {
+				ningyang.add(CommonUtil.divide(CommonUtil.divide(timeMinute, "60", 4), count, 2));
+			} else if ("泰山".equals(area)) {
+				taishan.add(CommonUtil.divide(CommonUtil.divide(timeMinute, "60", 4), count, 2));
+			} else if ("东平".equals(area)) {
+				dongping.add(CommonUtil.divide(CommonUtil.divide(timeMinute, "60", 4), count, 2));
+			} else if ("肥城".equals(area)) {
+				feicheng.add(CommonUtil.divide(CommonUtil.divide(timeMinute, "60", 4), count, 2));
+			} else if ("泰山景区".equals(area)) {
+				taishanjingqu.add(CommonUtil.divide(CommonUtil.divide(timeMinute, "60", 4), count, 2));
+			} else if ("高新".equals(area)) {
+				gaoxin.add(CommonUtil.divide(CommonUtil.divide(timeMinute, "60", 4), count, 2));
+			}
+			totalTimeMinute = CommonUtil.add(totalTimeMinute, timeMinute);
 		}
+		heji.add(CommonUtil.divide(CommonUtil.divide(totalTimeMinute, "60", 4), heji.get(2), 2));
+		
+		// 没有数据的区域数值为0
+		for (List<String> list : resList) {
+			if (list.size() == 7) {
+				list.add("0");
+			}
+		}
+		
+		List<Integer> shichangPaiming = new ArrayList<Integer>();
+		// 平均停电频次排名,合计不参与排名
+		for (int i = 1; i < resList.size() - 1; i ++) {
+			String shichang = resList.get(i).get(7);
+			// 排名
+			int num = 1;
+			for (int j = 1; j < resList.size() - 1; j ++) {
+				// 不和本次作对比
+				if (i != j) {
+					String compareshichang = resList.get(j).get(7);
+					// 不比对比频次大
+					if (CommonUtil.compare(compareshichang, shichang) == -1) {
+						num ++;
+					}
+				}
+			}
+			// 相同次数的往后排
+			while (shichangPaiming.contains(num)) {
+				num ++;
+			}
+			shichangPaiming.add(num);
+			resList.get(i).add(String.valueOf(num));
+		}
+		heji.add("");
+		
+		
+		return resList;
 	}
 }

+ 16 - 0
src/main/java/com/minpay/common/util/DateUtil.java

@@ -752,6 +752,22 @@ public class DateUtil {
 			cal.add(Calendar.MONTH, month);
 			return format.format(cal.getTime());
 		}
+		/**
+		 * 增加年份
+		 * @param time
+		 * @param day
+		 * @return
+		 * @throws ParseException
+		 */
+		public static String dateAddYear(String time,int year) throws ParseException{
+			SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
+			Date d = format.parse(time);
+			format.format(d);
+			Calendar cal=Calendar.getInstance();
+			cal.setTime(d);
+			cal.add(Calendar.YEAR, year);
+			return format.format(cal.getTime());
+		}
 		
 		
 }

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

@@ -14,4 +14,6 @@ public interface ReportServiceMapper extends IMINMybatisEntityMapper {
 
 	List<Map<String, String>> queryYesterdayDetail(Map<String, Object> param);
 
+	List<Map<String, String>> selectDetail00ByArea(Map<String, Object> param);
+
 }

+ 14 - 6
src/main/java/com/minpay/dianwang/system/action/MenuAction.java

@@ -7,6 +7,8 @@ import java.util.Map;
 
 import com.minpay.common.bean.Menu;
 import com.minpay.common.bean.User;
+import com.minpay.common.service.IPublicService;
+import com.minpay.common.util.CommonUtil;
 import com.minpay.db.table.model.ImRoleItemRel;
 import com.minpay.db.table.own.mapper.UserMapper;
 import com.startup.minpay.frame.business.IMINAction;
@@ -71,7 +73,12 @@ public class MenuAction implements IMINAction {
 		String menuid = null;//新增变量menuid,代替以前判断1的方式来限制一级菜单的显示
 		for (Map m : ms) {
 			if (menuid == null || !menuid.equals(m.get("MENUID").toString())) {//20140624,过滤掉1以外的数据会导致181行空指针异常
-				Menu menu = createMenu((String) m.get("MENUID"), Lang.get((String)m.get("MENUNAME")), (String) m.get("SERIALNO"), null, (String) m.get("ICON"));
+				String url = (String) m.get("ITEMURL");
+				Menu menu = createMenu((String) m.get("MENUID"),
+						Lang.get((String)m.get("MENUNAME")),
+						(String) m.get("SERIALNO"),
+						null,
+						(String) m.get("ICON"));
 				root.addSubMenu(menu);
 				mm.put((String) m.get("MENUID"), menu);
 				menuid = (String) m.get("MENUID");
@@ -79,13 +86,17 @@ public class MenuAction implements IMINAction {
 		}
 		List<ImRoleItemRel> imRoleItemRelList  = new ArrayList<ImRoleItemRel>();
 		for (Map m : ms) {
-			mm.get(m.get("MENUID")).addSubMenu(createMenu((String) m.get("ITEMID"), Lang.get((String)m.get("ITEMNAME")),  (String) m.get("SERIALNO"), (String) m.get("ITEMURL"),(String) m.get("ICON")));
+			String url = (String) m.get("ITEMURL");
+			mm.get(m.get("MENUID")).addSubMenu(createMenu((String) m.get("ITEMID"),
+					Lang.get((String)m.get("ITEMNAME")),
+					(String) m.get("SERIALNO"),
+					(String) m.get("ITEMURL"),
+					(String) m.get("ICON")));
 			ImRoleItemRel iri = new ImRoleItemRel();
 			iri.setItemid((String) m.get("ITEMID"));
 			imRoleItemRelList.add(iri);
 		}
 		
-//		itemIdU.setImRoleItemRelList(imRoleItemRelList);
 		u.setImRoleItemRelList(imRoleItemRelList);
 		res.set("menu", root);
 
@@ -102,14 +113,11 @@ public class MenuAction implements IMINAction {
 		}
 		res.set("itemAuth", itemAuth);
 		
-		
 		//超过密码有效期强制修改
 		boolean requireChangePassword = "0".equals(initpwd);
 		res.set("requireChangePassword", String.valueOf(requireChangePassword));
 		//授权密码为初始密码强制修改
 		res.set("requireChangeAuthorizationPassword", String.valueOf(false));
-
-		
 		return res;
 	}
 	

+ 79 - 47
src/main/java/com/minpay/dianwang/system/action/RoleManageAction.java

@@ -18,8 +18,11 @@ import com.minpay.common.exception.BusinessCodeException;
 import com.minpay.common.format.IFormatService;
 import com.minpay.common.service.ILogService;
 import com.minpay.common.service.IPublicService;
+import com.minpay.common.util.CommonUtil;
 import com.minpay.db.table.mapper.ImBranchMapper;
 import com.minpay.db.table.mapper.ImItemMapper;
+import com.minpay.db.table.mapper.ImMenuItemRelMapper;
+import com.minpay.db.table.mapper.ImMenuMapper;
 import com.minpay.db.table.mapper.ImRoleAuthMapper;
 import com.minpay.db.table.mapper.ImRoleItemRelMapper;
 import com.minpay.db.table.mapper.ImRoleMapper;
@@ -28,6 +31,10 @@ import com.minpay.db.table.model.ImBranch;
 import com.minpay.db.table.model.ImBranchExample;
 import com.minpay.db.table.model.ImItem;
 import com.minpay.db.table.model.ImItemExample;
+import com.minpay.db.table.model.ImMenu;
+import com.minpay.db.table.model.ImMenuExample;
+import com.minpay.db.table.model.ImMenuItemRelExample;
+import com.minpay.db.table.model.ImMenuItemRelKey;
 import com.minpay.db.table.model.ImRole;
 import com.minpay.db.table.model.ImRoleAuthExample;
 import com.minpay.db.table.model.ImRoleAuthKey;
@@ -465,55 +472,80 @@ public class RoleManageAction implements IMINAction {
 	public MINActionResult roleAuthQueryWithoutPwd(@MINParam(key = "id") String id, MINSession session)
 			throws MINBusinessException {
 		MINActionResult res = new MINActionResult();
-		Map<String, String> map = new HashMap<String, String>();
-		map.put("roleid", id);
-		List<Map<String, String>> ls = null;
-		if (id == null || "".equals(id)) {// 新增角色时使用
-//			ls = Service.lookup(IMINDataBaseService.class).getMybatisMapper(RoleMapper.class).roleMenuWithOutPwd(id);
-			ls = Service.lookup(IMINDataBaseService.class).getMybatisMapper(RoleMapper.class)
-					.roleMenuWithAuthForAdd(map);
-		} else {// 查看角色使用
-//			ls = Service.lookup(IMINDataBaseService.class).getMybatisMapper(RoleMapper.class).roleMenuWithOutPwdByTemp(map);
-			ls = Service.lookup(IMINDataBaseService.class).getMybatisMapper(RoleMapper.class)
-					.roleMenuWithAuthForDetail(map);
-		}
-
-		Map<String, Map<String, String>> menu = new HashMap<String, Map<String, String>>();
-		for (Map<String, String> m : ls) {
-			menu.put(m.get("menuid"), m);
-			String s = m.get("authrole");
-			if (s != null) {
-				((Map) m).put("authrole", s.split(","));
-			}
-		}
-		for (Map<String, String> s : menu.values()) {
-			Map<String, String> m = new HashMap<String, String>();
-			m.put("menuid", s.get("menuid"));
-			m.put("lv1", s.get("lv1"));
-			m.put("menserialno", s.get("menserialno"));
-			m.put("menuparentid", s.get("menuparentid"));
-			ls.add(m);
-		}
-		Collections.sort(ls, new Comparator<Map<String, String>>() {
-
-			public int compare(Map<String, String> o1, Map<String, String> o2) {
-				String x1 = Str.nvl(o1.get("menserialno"));
-				String x2 = Str.nvl(o2.get("menserialno"));
-				String s1 = Str.nvl(o1.get("itmserialno"));
-				String s2 = Str.nvl(o2.get("itmserialno"));
-				String m1 = Str.nvl(o1.get("menuparentid"));
-				String m2 = Str.nvl(o2.get("menuparentid"));
-				if (m1.equals(m2)) {
-					return x1.equals(x2) ? s1.compareTo(s2) : x1.compareTo(x2);
+		ImMenuExample menuExam = new ImMenuExample();
+		menuExam.createCriteria().andIdLike("F%");
+		menuExam.setOrderByClause("MEU_SERIALNO");
+		// 查询所有系统
+		List<ImMenu> xitongList = Service.lookup(IMINDataBaseService.class)
+										.selectByExample(ImMenuMapper.class, menuExam);
+		
+		List<Map<String, Object>> menuList = new ArrayList<Map<String, Object>>();
+		for (ImMenu imMenu : xitongList) {
+			Map<String, Object> menuMap = new HashMap<String, Object>();
+			
+			// 加入系统菜单
+			Map<String, Object> imMenuMap = new HashMap<String, Object>();
+			imMenuMap.put("id", imMenu.getId());
+			imMenuMap.put("name", imMenu.getName());
+			menuMap.put("xitong", imMenuMap);
+			
+			ImMenuExample menuExam2 = new ImMenuExample();
+			menuExam2.createCriteria().andParentidEqualTo(imMenu.getId());
+			menuExam2.setOrderByClause("MEU_SERIALNO");
+			// 查询系统的一级菜单
+			List<ImMenu> yijiMenu = Service.lookup(IMINDataBaseService.class)
+										.selectByExample(ImMenuMapper.class, menuExam2);
+			List<Object> yijjList = new ArrayList<Object>();
+			for (ImMenu imMenu2 : yijiMenu) {
+				// 加入一级菜单
+				Map<String, Object> yijiMap = new HashMap<String, Object>();
+				yijiMap.put("id", imMenu2.getId());
+				yijiMap.put("name", imMenu2.getName());
+				yijjList.add(yijiMap);
+				
+				ImMenuItemRelExample menuItemRelExam = new ImMenuItemRelExample();
+				menuItemRelExam.createCriteria().andMenuidEqualTo(imMenu2.getId());
+				// im_menu_item_rel 数据
+				List<ImMenuItemRelKey> imMenuItemRelList = Service.lookup(IMINDataBaseService.class)
+															.selectByExample(ImMenuItemRelMapper.class, menuItemRelExam);
+				List<String> itemIdList = new ArrayList<String>();
+				for (ImMenuItemRelKey imMenuItemRelKey : imMenuItemRelList) {
+					itemIdList.add(imMenuItemRelKey.getItemid());
 				}
-				return m1.compareTo(m2);
+				// 查询一级菜单下所有二级菜单
+				ImItemExample itemExam = new ImItemExample();
+				itemExam.createCriteria().andIdIn(itemIdList);
+				itemExam.setOrderByClause("ITM_SERIALNO");
+				List<ImItem> ImItemList = Service.lookup(IMINDataBaseService.class)
+											.selectByExample(ImItemMapper.class, itemExam);
+				// 返回list
+				List<Map<String, Object>> imItemMapList = new ArrayList<Map<String, Object>>();
+				for (ImItem imItem : ImItemList) {
+					Map<String, Object> imItemMap = new HashMap<String, Object>();
+					imItemMap.put("id", imItem.getId());
+					imItemMap.put("name", imItem.getName());
+					// 编辑
+					if (!CommonUtil.isEmpty(id)) {
+						ImRoleItemRelKey roleItemRelKey= new ImRoleItemRelKey();
+						roleItemRelKey.setItemid(imItem.getId());
+						roleItemRelKey.setRoleid(id);
+						// 查看是否已选中
+						ImRoleItemRel roleItemRel = Service.lookup(IMINDataBaseService.class)
+										.selectByPrimaryKey(ImRoleItemRelMapper.class, roleItemRelKey);
+						if (roleItemRel != null) {
+							imItemMap.put("checked", true);
+						}
+					}
+					
+					imItemMapList.add(imItemMap);
+				}
+				
+				yijiMap.put("erjiMenu", imItemMapList);
 			}
-		});
-
-		ls = new MINCopyFormat("{authtype:'authtypeDesc',authshape:'authshapeDesc'}").format(ls);
-//		ls = Service.lookup(IFormatService.class).formatEnum(ls, "{authtypeDesc:'IM_AUTH_TYPE',authshapeDesc:'IM_AUTH_SHAPE'}");
-
-		res.set(IMINBusinessConstant.F_QUERY_RESULT, ls);
+			imMenuMap.put("yijiMenu", yijjList);
+			menuList.add(menuMap);
+		}
+		res.set(IMINBusinessConstant.F_QUERY_RESULT, menuList);
 		return res;
 	}
 

+ 7 - 2
src/main/java/com/minpay/reportManage/action/DataWareManageAction.java

@@ -304,18 +304,23 @@ public class DataWareManageAction implements IMINAction {
     public MINActionResult fileInfDetail(
     		@MINParam(key = "fileId") String fileId,
     		@MINParam(key = "fileIdListStr") String fileIdListStr,
-    		@MINParam(key = "fileType") String fileType
+    		@MINParam(key = "fileType") String fileType,
+    		@MINParam(key = "page", defaultValue = "1") int page,
+            @MINParam(key = "limit", defaultValue = "100") int limit
     		) throws MINBusinessException {
     	MINActionResult res = new MINActionResult();
     	db = Service.lookup(IMINDataBaseService.class);
+    	MINRowBounds rows = new MINRowBounds(page, limit);
+		rows.setSeparateSql(true);
     	
     	Map<String, String> param = new HashMap<String, String>();
     	param.put("fileId", fileId);
     	param.put("fileIdListStr", fileIdListStr);
     	param.put("fileType", fileType);
     	// 查询明细信息
-    	List fileInfDetailList = Service.lookup(IDianwangService.class).queryFileInfDetail(param);
+    	List fileInfDetailList = Service.lookup(IDianwangService.class).queryFileInfDetail(param, rows);
     	res.set(IMINBusinessConstant.F_PAGING_LAY, fileInfDetailList);
+    	res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
     	return res;
     }
 }

+ 10 - 34
src/main/java/com/minpay/reportManage/action/ReportManageAction.java

@@ -18,27 +18,12 @@ import com.minpay.common.constant.Constant;
 import com.minpay.common.format.IFormatService;
 import com.minpay.common.service.IDianwangService;
 import com.minpay.common.service.IReportService;
-import com.minpay.common.service.impl.ReportServiceImpl;
-import com.minpay.common.util.CommonUtil;
-import com.minpay.common.util.ListUtil;
-import com.minpay.db.table.mapper.DwAlgorithmInfMapper;
 import com.minpay.db.table.mapper.DwBranchReportTypeMapper;
 import com.minpay.db.table.mapper.DwReportDataMapper;
-import com.minpay.db.table.mapper.DwReportFileRelMapper;
 import com.minpay.db.table.mapper.DwReportInfMapper;
-import com.minpay.db.table.mapper.DwReporttypeFiletypeRelMapper;
-import com.minpay.db.table.mapper.DwUtilDataInfMapper;
-import com.minpay.db.table.model.DwAlgorithmInf;
-import com.minpay.db.table.model.DwAlgorithmInfExample;
 import com.minpay.db.table.model.DwBranchReportType;
-import com.minpay.db.table.model.DwBranchReportTypeExample;
 import com.minpay.db.table.model.DwReportData;
-import com.minpay.db.table.model.DwReportFileRelKey;
 import com.minpay.db.table.model.DwReportInf;
-import com.minpay.db.table.model.DwReporttypeFiletypeRelExample;
-import com.minpay.db.table.model.DwReporttypeFiletypeRelKey;
-import com.minpay.db.table.model.DwUtilDataInf;
-import com.minpay.db.table.model.DwUtilDataInfExample;
 import com.minpay.db.table.own.mapper.ReportManageMapper;
 import com.minpay.db.table.own.mapper.SequenceMapper;
 import com.minpay.dianwang.util.ReportExcelUtil;
@@ -113,8 +98,9 @@ public class ReportManageAction implements IMINAction {
         @MINParam(key = "limit", defaultValue = "10") int limit,
         @MINParam(key = "date") String date,
         @MINParam(key = "fileName") String fileName,
+        @MINParam(key = "timeType") String timeType,
         MINSession session
-    ) throws MINBusinessException, NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, InstantiationException {
+    ) throws MINBusinessException {
         MINActionResult res = new MINActionResult();
         db = Service.lookup(IMINDataBaseService.class);
 		//分页
@@ -124,6 +110,7 @@ public class ReportManageAction implements IMINAction {
 		
 		param.put("date", date);
 		param.put("fileName", fileName);
+		param.put("timeType", timeType);
 		
 		User user = session.getUser();
 		String roleId = user.getRoleId();
@@ -134,22 +121,6 @@ public class ReportManageAction implements IMINAction {
 		}
 		
 		List<Map<String, String>> list = db.getMybatisMapper(ReportManageMapper.class).selectReportInf(param, rows);
-		
-		if (list.size() == 0) {
-			return res;
-		}
-		
-		// 查找文件类型
-		List<String> typeIdList = CommonUtil.getIdFromList(list, "typeId");
-		DwBranchReportTypeExample branchReportTypeExample = new DwBranchReportTypeExample();
-		branchReportTypeExample.createCriteria().andIdIn(typeIdList);
-		List<DwBranchReportType> branchReportTypeList = db.selectByExample(DwBranchReportTypeMapper.class, branchReportTypeExample);
-		String[] str1 = {"typeId"};
-		String[] str2 = {"id"};
-		String[] str3 = {"type"};
-		String[] str4 = {"type"};
-		list = ListUtil.mergeList(list, branchReportTypeList, str1, str2, str3, str4);
-		
 		list = Service.lookup(IFormatService.class).formatDate(list, "uploadDate");
 		// 设置返回值
 		res.set(IMINBusinessConstant.F_PAGING_LAY, list);
@@ -167,9 +138,13 @@ public class ReportManageAction implements IMINAction {
     @MINAction(value = FILE_INF_REPORT_QUERY)
     public MINActionResult fileInfReportQuery(
     		@MINParam(key = "chooseFileListStr") String chooseFileListStr,
+    		@MINParam(key = "page", defaultValue = "1") int page,
+            @MINParam(key = "limit", defaultValue = "200") int limit,
     		MINSession session
     		) throws MINBusinessException {
     	MINActionResult res = new MINActionResult();
+    	MINRowBounds rows = new MINRowBounds(page, limit);
+		rows.setSeparateSql(true);
     	
     	JSONArray chooseFileList = JSONArray.fromObject(chooseFileListStr);
     	
@@ -205,12 +180,13 @@ public class ReportManageAction implements IMINAction {
 			Map<String, String> param = new HashMap<String, String>();
 			param.put("fileType", type);
 			param.put("fileIdListStr", JSONArray.fromObject(fileIdList).toString());
-			List fileInfDetailList = Service.lookup(IDianwangService.class).queryFileInfDetail(param);
+			List fileInfDetailList = Service.lookup(IDianwangService.class).queryFileInfDetail(param, rows);
 			fileType.put("fileInfDetailList", fileInfDetailList);
 		}
  
     	// 设置返回值
     	res.set(IMINBusinessConstant.F_PAGING_LAY, fileTypeList);
+    	res.set(IMINBusinessConstant.F_PAGING_COUNT, rows.getCount());
     	return res;
     }
     
@@ -289,7 +265,7 @@ public class ReportManageAction implements IMINAction {
     	report.setBranch(user.getBranchid());
     	report.setType(reportTypeId);
     	
-    	report.setDayInterval(range);							// 日期时间段
+    	report.setDayInterval(range.replaceAll(" ", ""));		// 日期时间段
     	report.setTimeInterval(timeRange.replaceAll(" ", ""));	// 时分秒时间段
     	db.insertSelective(DwReportInfMapper.class, report);