Browse Source

修改导出报错 的问题

luobo 4 years ago
parent
commit
7d736f0275

+ 3 - 3
src/config/jdbc.properties

@@ -1,13 +1,13 @@
 jdbc.driverClassName=com.mysql.jdbc.Driver
 jdbc.driverClassName=com.mysql.jdbc.Driver
-jdbc.url=jdbc:mysql://39.101.216.213:3306/gxwss?useUnicode=true&characterEncoding=utf-8
+jdbc.url=jdbc:mysql://192.168.2.118:3306/gxwss?useUnicode=true&characterEncoding=utf-8
 
 
-jdbc.url.mysql=jdbc:mysql://39.101.216.213:3306/gxwss?user=root&password=root&useUnicode=true&characterEncoding=utf-8
+jdbc.url.mysql=jdbc:mysql://127.0.0.1:3306/gxwss?user=root&password=root&useUnicode=true&characterEncoding=utf-8
 
 
 #jdbc.url=jdbc:mysql://localhost:3306/gxaah_test05?useUnicode=true&characterEncoding=utf-8
 #jdbc.url=jdbc:mysql://localhost:3306/gxaah_test05?useUnicode=true&characterEncoding=utf-8
 hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
 hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
 #hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
 #hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
 jdbc.username=root
 jdbc.username=root
-jdbc.password=LuoBo@9527!
+jdbc.password=root
 
 
 
 
 oracledriver=oracle.jdbc.OracleDriver
 oracledriver=oracle.jdbc.OracleDriver

+ 21 - 0
src/java/com/bus/service/impl/BusOrgServiceImpl.java

@@ -141,6 +141,11 @@ public class BusOrgServiceImpl extends GenericServiceImpl<BusOrg, Long> implemen
 		//用户类型全部为自来水户
 		//用户类型全部为自来水户
 		String _baseUserTypeId = "1";
 		String _baseUserTypeId = "1";
 
 
+
+
+
+
+
 		//插入用户信息表
 		//插入用户信息表
 		for (int i = 1;i<dataList.size();i++){
 		for (int i = 1;i<dataList.size();i++){
 			String[] item = dataList.get(i);
 			String[] item = dataList.get(i);
@@ -149,7 +154,16 @@ public class BusOrgServiceImpl extends GenericServiceImpl<BusOrg, Long> implemen
 			String _address = item[2];
 			String _address = item[2];
 			String _properties = item[3];
 			String _properties = item[3];
 
 
+			//判断单位是否已经存在
+
+
+
+
+
+
+
 			String _waterPriceStr = item[4];
 			String _waterPriceStr = item[4];
+
 			if (StringUtils.isBlank(_waterPriceStr)){
 			if (StringUtils.isBlank(_waterPriceStr)){
 				_waterPriceStr = "0";
 				_waterPriceStr = "0";
 			}
 			}
@@ -195,6 +209,13 @@ public class BusOrgServiceImpl extends GenericServiceImpl<BusOrg, Long> implemen
 			busOrg.setPostalAddress(_address);
 			busOrg.setPostalAddress(_address);
 			//保存到数据
 			//保存到数据
 			busOrg =busOrgDao.save(busOrg);
 			busOrg =busOrgDao.save(busOrg);
+
+
+
+
+
+
+
 			if (_properties!=null && !_properties.equalsIgnoreCase("")){
 			if (_properties!=null && !_properties.equalsIgnoreCase("")){
 				//当前用水性质是否存在
 				//当前用水性质是否存在
 				BaseWaterProperties baseWaterProperties =null;
 				BaseWaterProperties baseWaterProperties =null;

+ 39 - 20
src/java/com/bus/web/BusInitController.java

@@ -222,10 +222,6 @@ public class BusInitController extends BaseController {
 
 
     /**
     /**
      * 导入年计划
      * 导入年计划
-     * @param ids
-     * @param startTime
-     * @param endTime
-     * @param param
      * @return
      * @return
      * @throws ParseException
      * @throws ParseException
      */
      */
@@ -1390,13 +1386,25 @@ public class BusInitController extends BaseController {
             sheet.addCell(new Label(4, 0, "水表户号"));
             sheet.addCell(new Label(4, 0, "水表户号"));
             sheet.addCell(new Label(5, 0, "年度"));
             sheet.addCell(new Label(5, 0, "年度"));
             sheet.addCell(new Label(6, 0, "上一年度实际用水量(m³)"));
             sheet.addCell(new Label(6, 0, "上一年度实际用水量(m³)"));
-            sheet.addCell(new Label(7, 0, "一季度计划"));
-            sheet.addCell(new Label(8, 0, "二季度计划"));
-            sheet.addCell(new Label(9, 0, "三季度计划"));
-            sheet.addCell(new Label(10, 0, "四季度计划"));
-            sheet.addCell(new Label(11, 0, "全年计划"));
-            sheet.addCell(new Label(12, 0, "全年批复"));
-            sheet.addCell(new Label(13, 0, "是否居民用水"));
+//            sheet.addCell(new Label(7, 0, "一季度计划"));
+//            sheet.addCell(new Label(8, 0, "二季度计划"));
+//            sheet.addCell(new Label(9, 0, "三季度计划"));
+//            sheet.addCell(new Label(10, 0, "四季度计划"));
+            sheet.addCell(new Label(7, 0, "全年计划"));
+            sheet.addCell(new Label(8, 0, "全年批复"));
+            sheet.addCell(new Label(9, 0, "是否居民用水"));
+            sheet.addCell(new Label(10, 0, "一月份计划"));
+            sheet.addCell(new Label(11, 0, "二月份计划"));
+            sheet.addCell(new Label(12, 0, "三月份计划"));
+            sheet.addCell(new Label(13, 0, "四月份计划"));
+            sheet.addCell(new Label(14, 0, "五月份计划"));
+            sheet.addCell(new Label(15, 0, "六月份计划"));
+            sheet.addCell(new Label(16, 0, "七月份计划"));
+            sheet.addCell(new Label(17, 0, "八月份计划"));
+            sheet.addCell(new Label(18, 0, "九月份计划"));
+            sheet.addCell(new Label(19, 0, "十月份计划"));
+            sheet.addCell(new Label(20, 0, "十一月份计划"));
+            sheet.addCell(new Label(21, 0, "十二月份计划"));
         } catch (Exception e) {
         } catch (Exception e) {
             // TODO: handle exception
             // TODO: handle exception
         }
         }
@@ -1417,15 +1425,26 @@ public class BusInitController extends BaseController {
                 sheet.addCell(new Label(3, row, plan.getPostCode()));//邮编
                 sheet.addCell(new Label(3, row, plan.getPostCode()));//邮编
                 sheet.addCell(new Label(4, row, plan.getOrgMeterNumber()));//水表户号
                 sheet.addCell(new Label(4, row, plan.getOrgMeterNumber()));//水表户号
                 sheet.addCell(new Label(5, row, plan.getYear()));//年度
                 sheet.addCell(new Label(5, row, plan.getYear()));//年度
-                sheet.addCell(new Label(6, row, Math.round(plan.getPriYearUseWater()) + ""));//上一年实际用水量
-                sheet.addCell(new Label(7, row, Math.round(plan.getFirstQuarterReply()) + ""));//一季度
-                sheet.addCell(new Label(8, row, Math.round(plan.getSecondQuarterReply()) + ""));//二季度
-                sheet.addCell(new Label(9, row, Math.round(plan.getThirdQuarterReply()) + ""));//三季度
-                sheet.addCell(new Label(10, row, Math.round(plan.getFourthQuarterReply()) + ""));//四季度
-                sheet.addCell(new Label(11, row, Math.round(plan.getPlanOfWater()) + ""));//全年计划
-                sheet.addCell(new Label(12, row, Math.round(plan.getReplyOfWater()) + ""));//全年批复
-                sheet.addCell(new Label(13, row, plan.getOrgType()));//用户类型
-
+                sheet.addCell(new Label(6, row, (plan.getPriYearUseWater()!=null?Math.round(plan.getPriYearUseWater()):0) + ""));//上一年实际用水量
+//                sheet.addCell(new Label(7, row, Math.round(plan.getFirstQuarterReply()) + ""));//一季度
+//                sheet.addCell(new Label(8, row, Math.round(plan.getSecondQuarterReply()) + ""));//二季度
+//                sheet.addCell(new Label(9, row, Math.round(plan.getThirdQuarterReply()) + ""));//三季度
+//                sheet.addCell(new Label(10, row, Math.round(plan.getFourthQuarterReply()) + ""));//四季度
+                sheet.addCell(new Label(7, row, (plan.getPlanOfWater()!=null?Math.round(plan.getPlanOfWater()):0)+ ""));//全年计划
+                sheet.addCell(new Label(8, row, (plan.getReplyOfWater()!=null?Math.round(plan.getReplyOfWater()):0) + ""));//全年批复
+                sheet.addCell(new Label(9, row, plan.getOrgType()));//用户类型
+                sheet.addCell(new Label(10, row, (plan.getJanPlan()!=null?Math.round(plan.getJanPlan()):0)+""));//一月份计划
+                sheet.addCell(new Label(11, row, (plan.getFebPlan()!=null?Math.round(plan.getFebPlan()):0)+""));//二月份计划
+                sheet.addCell(new Label(12, row, (plan.getMarPlan()!=null?Math.round(plan.getMarPlan()):0)+""));//三月份计划
+                sheet.addCell(new Label(13, row, (plan.getAprPlan()!=null?Math.round(plan.getAprPlan()):0)+""));//四月份计划
+                sheet.addCell(new Label(14, row, (plan.getMayPlan()!=null?Math.round(plan.getMayPlan()):0)+""));//五月份计划
+                sheet.addCell(new Label(15, row, (plan.getJunPlan()!=null?Math.round(plan.getJunPlan()):0)+""));//六月份计划
+                sheet.addCell(new Label(16, row, (plan.getJulPlan()!=null?Math.round(plan.getJulPlan()):0)+""));//七月份计划
+                sheet.addCell(new Label(17, row, (plan.getAugPlan()!=null?Math.round(plan.getAugPlan()):0)+""));//八月份计划
+                sheet.addCell(new Label(18, row, (plan.getSeptPlan()!=null?Math.round(plan.getSeptPlan()):0)+""));//九月份计划
+                sheet.addCell(new Label(19, row, (plan.getOctPlan()!=null?Math.round(plan.getOctPlan()):0)+""));//十月份计划
+                sheet.addCell(new Label(20, row, (plan.getNovPlan()!=null?Math.round(plan.getNovPlan()):0)+""));//十一月份计划
+                sheet.addCell(new Label(21, row, (plan.getDecPlan()!=null?Math.round(plan.getDecPlan()):0)+""));//十二月份计划
                 row += 1;
                 row += 1;
             }
             }
             if (this.page.hasNextPage()) {
             if (this.page.hasNextPage()) {

+ 21 - 6
src/java/com/bus/web/BusMeterReadInfoController.java

@@ -149,9 +149,18 @@ public class BusMeterReadInfoController extends BaseController{
 				}
 				}
 			}
 			}
 		}else if(flag!=null&&flag.equals("query")){
 		}else if(flag!=null&&flag.equals("query")){
-			orgName = new String(orgName.getBytes("ISO8859-1"),"UTF-8");
-			address = new String(address.getBytes("ISO8859-1"),"UTF-8");
-			orgTypeId = new String(orgTypeId.getBytes("ISO8859-1"),"UTF-8");
+			if (orgName!=null){
+				orgName = new String(orgName.getBytes("ISO8859-1"),"UTF-8");
+			}
+
+			if (address!=null){
+				address = new String(address.getBytes("ISO8859-1"),"UTF-8");
+			}
+
+			if (orgTypeId!=null){
+				orgTypeId = new String(orgTypeId.getBytes("ISO8859-1"),"UTF-8");
+			}
+
 			//modify by llq	2015-01-23	去掉客户号
 			//modify by llq	2015-01-23	去掉客户号
 			this.page =busMeterReadInfoService.getMonthWaterConsumptionList(orgIds, orgNumber, orgName, orgTypeId, meterNumber, year, address, isPlanUser, userType,minWater,maxWater, pageNo, pageSize);
 			this.page =busMeterReadInfoService.getMonthWaterConsumptionList(orgIds, orgNumber, orgName, orgTypeId, meterNumber, year, address, isPlanUser, userType,minWater,maxWater, pageNo, pageSize);
 			list= (List<UnitMonthWaterConsumptionTemp>) this.page.getResult();
 			list= (List<UnitMonthWaterConsumptionTemp>) this.page.getResult();
@@ -235,9 +244,15 @@ public class BusMeterReadInfoController extends BaseController{
 				}
 				}
 			}
 			}
 		}else if(flag!=null&&flag.equals("query")){
 		}else if(flag!=null&&flag.equals("query")){
-			orgName = new String(orgName.getBytes("ISO8859-1"),"UTF-8");
-			address = new String(address.getBytes("ISO8859-1"),"UTF-8");
-			orgTypeId = new String(orgTypeId.getBytes("ISO8859-1"),"UTF-8");
+		    if (orgName!=null){
+                orgName = new String(orgName.getBytes("ISO8859-1"),"UTF-8");
+            }
+		    if (address!=null){
+                address = new String(address.getBytes("ISO8859-1"),"UTF-8");
+            }
+			if (orgTypeId!=null){
+                orgTypeId = new String(orgTypeId.getBytes("ISO8859-1"),"UTF-8");
+            }
 			//modify by llq	2015-01-23	去掉客户号
 			//modify by llq	2015-01-23	去掉客户号
 			this.page =busMeterReadInfoService.getMonthWaterConsumptionList(orgIds, orgNumber, orgName, orgTypeId, meterNumber, year, address, isPlanUser, userType,minWater,maxWater, pageNo, pageSize);
 			this.page =busMeterReadInfoService.getMonthWaterConsumptionList(orgIds, orgNumber, orgName, orgTypeId, meterNumber, year, address, isPlanUser, userType,minWater,maxWater, pageNo, pageSize);
 			list= (List<UnitMonthWaterConsumptionTemp>) this.page.getResult();
 			list= (List<UnitMonthWaterConsumptionTemp>) this.page.getResult();