zhsq bug修改

这篇博客详细记录了一位开发者在物业管理系统中遇到的问题和解决方案,包括房屋全名检索、时间筛选、编辑页面禁改、字典表下拉框显示、Base64照片存储、新增物业缴费、编辑保存、删除记录、接口图片链接、下载字段、房屋管理跳转、物业缴费跳转等多个功能的修复和优化。涉及到前端界面、后台逻辑、数据库操作和接口设计等多个方面。

1、房屋按全名显示(从父节点到子节点)并按全名检索

xml修改:

查询条件修改:


list.jsp修改


2按时间去筛选记录、

修改xml

3、修改编辑页面禁止修改某一项

修改edit.jsp


4、字典表下拉框显示问题(显示为空)

经检查发现,是controller和jsp前后变量名不统一  因为当时自己先写了个函数,后面复制粘贴别人的,导致变量名不一致。

5、base64编码的照片存储异常,无法打开

原因:

public List<Base64> getPHOTOLIST() {
		return PHOTOLIST;
	}
里存的photolist是List<Base64>,虽然不懂这到底什么鬼,但是经断点调试查看,里面把“["uyyhdglkhbfckjdsabvk"]”里的中括号和引号都存进去了,所以我在取出数据之后对字符串进行了处理:
String str="";
String pictures =pd.getString("PHOTOLIST").replaceAll("\\[", str).replaceAll("\\]", str).replaceAll("\"",str);
			


6、新增物业缴费 保存到数据库的动作

1、总是存不进去,经查找,数据库中表的主键没有设置自动增长,而代码里又没有添加主键id,导致没法存。

2、存进去之后,因为payType是下拉框选择的,但存进去数据库的数据依然是选择的文字。问题出在在edit页面将option标签的value设置错了,写成了dict.value,应该是dict.ZD_ID。


7、编辑物业缴费之存到数据库中

1、未设置payType下拉框

2、设置之后下拉框仍然没有数据,而新增这一块却没有问题。。。原来是在controller里,没有查询payTypeList并提交给页面。

3、是否需要发票没有设置selected。java脚本全局变量设置。

                <c:set var="invoice0Code" value="<%=propertyPayInvoiceEnum.否.getCode()%>"></c:set>
		<c:set var="invoice1Code" value="<%=propertyPayInvoiceEnum.是.getCode()%>"></c:set>
						
		<option value="<%=propertyPayInvoiceEnum.否.getCode()%>"
		                          <c:if test="${invoice0Code eq pd.invoice}">selected</c:if> ><%=propertyPayInvoiceEnum.否.getName()%>
                </option>

用c:set标签声明一个变量并从java脚本取出的值,再用el表达式去比较



5、编辑房屋之后房屋的id的保存

新增表单和修改表单虽然是一个表单,但是他们接收的参数和提交的url不一样,导致结果不一样。表单也因为修改功能提供了id而显示默认数据。

8、删除物业缴费记录 该功能ok

8.1复选框删除功能失效  原因:复选框value值写错了,写成building4Id



9、app接口返回图片链接加上上级文件夹

List<PageData> resources = (List<PageData>) dao.findForList("illegal_buildingMapper.findByIllegalBuildingIds", ids);					
for (PageData resource : resources) {	
	//在图片名称前加上上一级路径,如illegal_building/I04_0271.jpg
	String path="illegal_building/";
	String illegalImage=(String)resource.get("illegalImage");
	resource.put("illegalImage", path+illegalImage);

10、下载字段的修改

sql代码与列表查询类似,注意房屋名称是从父节点到子节点的全名称


11、房屋管理界面跳转到物业缴费系统

<td style="vertical-align:top;width:50px;">
	<a class="btn btn-small btn-success" onclick="add('${pd.parentId}','${pd.level}');">新增</a>
</td>
<c:if test="${pd.parentId != '0'}">
   <td style="vertical-align:top;" class="left">
    <a class="btn btn-small btn-info" onclick="location.href='<%=basePath%>/house.do?parentId=${pdp.parentId }';">返回</a>
   </td>
</c:if>
<td style="vertical-align:top;"class="left" >
    <a target="mainFrame" onclick="top.mainFrame.tabAddHandler('z66','物业缴费','propertypay/list.do');" class="btn btn-small btn-purple" >
    <i class="icon-arrow-right  icon-on-right">进入物业缴费系统 </i>					
</a>			
</td>



12、物业缴费功能跳转,是按房屋管理跳转。

这里数据没显示完整,原因是自己数据库录入数据错误,parentId如果为一级节点,应该为“0”而不是“000”.表中parentId字段为varchar类型,是长度可变的字符串,而“0”!=“000”,所以程序无法正确读取填入的数据。

跳转功能实现:

house_list.jsp:

			<td style="width: 68px;">
						<a class='btn btn-mini btn-info' title="编辑" onclick="edit('${var.houseId }')" ><i class='icon-edit'></i></a>
						<a class='btn btn-mini btn-danger' title="删除"  onclick="del('${var.houseId }')"><i class='icon-trash'></i></a>
					
						<c:if test="${var.level==4}">
						<a class="btn btn-mini btn-success" onclick="addPropertyPay('${var.houseId}');">新增缴费</a>					
						</c:if>
				    </td>
//新增物业缴费
		function addPropertyPay(houseId){
			 top.jzts();
			 var diag = new top.Dialog();
			 diag.Drag=true;
			 diag.Title ="新增物业缴费";
			 diag.URL = '<%=basePath%>propertypay/goAddByHouseId.do?houseId='+houseId;			
			 diag.Width = 550;
			 diag.Height = 355;
			 diag.CancelEvent = function(){ //关闭事件
				 if(diag.innerFrame.contentWindow.document.getElementById('zhongxin').style.display == 'none'){
					 if('${page.currentPage}' == '0'){
						 top.jzts();
						 setTimeout("self.location=self.location",100);
					 }else{
						 nextPage(${page.currentPage});
					 }
				}
				diag.close();
			 };
			 diag.show();
		}
propertyPayController.java

/**
	 * 去新增关联房屋的物业缴费页面
	 */
	@Resource(name="houseService")
	private houseService houseService;	
	
	@RequestMapping(value="/goAddByHouseId")
	public ModelAndView goAddByHouseId(){
		logBefore(logger, "去新增关联房屋的propertyPay页面");
		ModelAndView mv = this.getModelAndView();
		PageData pd = new PageData();
		pd = this.getPageData();
		try {					
			List<PageData>	building1List = propertypayService.building1ById(pd);
			List<PageData>	building2List = propertypayService.building2ById(pd);
			List<PageData>	building3List = propertypayService.building3ById(pd);
			List<PageData>	building4List = propertypayService.building4ById(pd);			
			pd = houseService.findBuildingByHouseId(pd);
			mv.setViewName("propertyPay/propertypay/propertypay_edit");
			mv.addObject("msg", "save");			
			mv.addObject("building1List", building1List);
			mv.addObject("building2List", building2List);
			mv.addObject("building3List", building3List);
			mv.addObject("building4List", building4List);			
			//mv.addObject("categoryList", categoryList);
			mv.addObject("pd", pd);
			setDictListForSelect(mv);			
		} catch (Exception e) {
			logger.error(e.toString(), e);
		}						
		return mv;
	}	
	

houseMapper.xml

<!-- 通过ID获取数据 -->
	<select id="findBuildingByHouseId" parameterType="pd" resultType="pd">	
	select							
				h.name as houseName,
				th3.name as building3Name,
				th2.name as building2Name,
				th1.name as building1Name,
				
				h.houseId as building4Id,
				th3.houseId as building3Id,
				th2.houseId as building2Id,
				th1.houseId as building1Id
				
		from 		
				((t_house h			
				left join t_house th3 ON th3.houseId=h.parentId)
				left join t_house th2 ON th2.houseId=th3.parentId)
				left join t_house th1 ON th1.houseId=th2.parentId
		where 
				h.houseId = #{houseId}
		
	
	</select>
13、私搭乱盖图片地址修改导致后台照片无法正常显示

前后端的地址字符串有重复,导致路径不正确,所以无法读取照片

illegal_buildingService.java

if (ids.length > 0) {			
			List<PageData> resources = (List<PageData>) dao.findForList("illegal_buildingMapper.findByIllegalBuildingIds", ids);					
			for (PageData resource : resources) {	
				//在图片名称前加上上一级路径,如illegal_building/I04_0271.jpg
				String path="illegal_building/";
				String illegalImage=(String)resource.get("illegalImage");
				resource.put("illegalImage", path+illegalImage);
				String illegalBuildingId = resource.getString("BuildingID");			
				PageData illegalBuilding = tmpMap.get(illegalBuildingId);
				if (illegalBuilding != null) {							
						List<PageData> applyResources = (List<PageData>)  illegalBuilding.get("APPLY_RESOURCES");
						applyResources.add(resource);							
					}	
				}
		}	
illegal_building_list.jsp
<td>
									<c:forEach items="${var.APPLY_RESOURCES}" var="res" varStatus="resvs">
									<c:if test="${not empty res.illegalImage}">
									<a href="<%=basePath%>uploadFiles/uploadImgs/illegal_building/${res.illegalImage}" title="违建图片" class="bwGal">查看图${resvs.index+1}</a>
									</c:if>
									</c:forEach>
</td>    
				



15、私搭乱盖接口--个人发布 userId、

<select id="datalistPage" parameterType="page" resultType="pd">
		select
				a.BuildingID  as BuildingID,
				su.username as illegalPerson,			
				a.illegalStation as illegalStation,	
				a.illegalContent as illegalContent,	
				sub.username as submitter,		
				a.submitterTEL as submitterTEL,	
				a.submitTime as submitTime,	
				a.Feedback as Feedback
		from 
				(t_illegal_building a left join sys_user su on a.illegalPersonID=su.user_id)  left join sys_user sub on a.submitterID=sub.user_id
		where 1=1
		<if test="pd.userId != null  and pd.userId != ''">
				and a.submitterID = #{pd.userId}
		</if>	

因为if标签里的and写成了or,导致一直报错,错误提示是org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: JDBC requires that the JdbcType must be specified for all nullable parameters.


16、物业缴费接口设计、
	/**
	 * 获取公告分页列表
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value="/getPropertyPayList" ,produces="application/json;charset=UTF-8")
	@ResponseBody
	public Object getPropertyPayList()throws Exception{
		Map<String,Object> map = new HashMap<String,Object>();
		PageData pd = new PageData();
		pd = this.getPageData();
		String errInfo = null;
		try{
			List<PageData>	varList=new ArrayList<PageData>();
			Page page = getAppPage(pd);
			PageData var = new PageData();
			varList =propertypayService.list(page);	//获取propertypay列表			
			map = genAppResultData(true, null, varList, page.getCurrentPage(), page.getShowCount(), page.getTotalPage());
		}catch(Exception e){
			errInfo=e.getMessage();
			map = genAppResultData(false, AppMessageEnum.toAppMessageEnum(errInfo), null, null, null);
		}
		return AppUtil.returnObject(new PageData(), map);
	}
	
	

	/**
	 * 新增
	 * POST请求method=RequestMethod.POST
	 */
	@RequestMapping(value="/savePropertyPay", produces="application/json;charset=UTF-8",method=RequestMethod.POST)
	@ResponseBody 
	public Object savePropertyPay(@RequestBody JSONObject  jsonObj) throws Exception{     
		logBefore(logger, "新增propertypay");
		Map<String,Object> map = Collections.emptyMap();
		PropertyPay propertyPayEntity = (PropertyPay)JSONObject.toBean(jsonObj,PropertyPay.class);		
		//参数:houseId、startTime、endTime、pay、payTime、payType、invoice、memo
		PageData pd=new PageData();		
		try{
			pd.put("BUILDING4_ID",propertyPayEntity.getHouseId());			
			pd.put(propertyPayConstant.startTime,propertyPayEntity.getStartTime());
			pd.put(propertyPayConstant.endTime,propertyPayEntity.getEndTime());
			pd.put(propertyPayConstant.pay,propertyPayEntity.getPay());			
			pd.put(propertyPayConstant.payTime,propertyPayEntity.getPayTime());	
			if("1".equals(propertyPayEntity.getPayType()))
			{
				pd.put(propertyPayConstant.payType,"payType01");	
			}
			else if("2".equals(propertyPayEntity.getPayType()))
			{
				pd.put(propertyPayConstant.payType,"payType02");	
			}
			else if("3".equals(propertyPayEntity.getPayType()))
			{
				pd.put(propertyPayConstant.payType,"payType03");	
			}			
			pd.put(propertyPayConstant.invoice,Integer.parseInt(propertyPayEntity.getInvoice()));	
			pd.put(propertyPayConstant.memo,propertyPayEntity.getMemo());	
			//保存信息
			propertypayService.doSave(pd);				
			PageData json=null;
			map = this.genAppResultData(true,AppMessageEnum.Property_Pay_SUBMIT_SUCCESS, json, null, null, null);
			
		} catch(Exception e){
			logger.error(e.toString(), e);
			map = getResultFailInfo();
		} finally {
			logAfter(logger);
		}		
		return AppUtil.returnObject(pd, map);
	}	

17、公告接口设计、

@RequestMapping(value="/saveNoticeByNoticeId", produces="application/json;charset=UTF-8",method=RequestMethod.POST)
	@ResponseBody 
	public Object saveIllegalBuilding(@RequestBody JSONObject  jsonObj) throws Exception{     
		logBefore(logger, "新增notice");
		Map<String,Object> map = Collections.emptyMap();
		Notice noticeEntity = (Notice)JSONObject.toBean(jsonObj,Notice.class);		
		//参数:NOTICE_ID、CATEGORY_ID、TITLE、CONTENT、CREATE_TIME、USER_ID
		PageData pd=new PageData();		
		try{	
			if(noticeEntity.getCategoryId().equals("2")){
				pd.put(NoticeConstant.CATEGORY_ID,NoticeConstant.PROPERTY);
			}
			else{
				pd.put(NoticeConstant.CATEGORY_ID,NoticeConstant.VILLAGE);
			}
			pd.put(NoticeConstant.TITLE,noticeEntity.getTitle());
			pd.put(NoticeConstant.CONTENT,noticeEntity.getContent());
			pd.put(NoticeConstant.USER_ID,noticeEntity.getUserId());			
			pd.put(NoticeConstant.NOTICE_ID,this.get32UUID());			
			pd.put(NoticeConstant.CREATE_TIME,DateUtil.getTime());	
			//保存信息
			noticeService.doSave(pd);				
			PageData json=null;
			if(noticeEntity.getCategoryId().equals("2")){
				map = this.genAppResultData(true,AppMessageEnum.PROPERTY_NOTICE_SUBMIT_SUCCESS, json, null, null, null);
			}
			else{
				map = this.genAppResultData(true,AppMessageEnum.VILLAGE_NOTICE_SUBMIT_SUCCESS, json, null, null, null);
			}
		} catch(Exception e){
			logger.error(e.toString(), e);
			map = getResultFailInfo();
		} finally {
			logAfter(logger);
		}		
		return AppUtil.returnObject(pd, map);
	}	


18、私搭乱盖里违建人的id.

19、完善代码质量。xm文件,constant里的变量整理

20、eclipse断点调试功能

14、删除功能完善,删除记录时主表删 从表不删 但是与主表相关的图片要删除(包括内存中的图片)。未完成!

                        List<PageData> resources = (List<PageData>) dao.findForList("illegal_buildingMapper.findByIllegalBuildingId", pd);//根据id获取图片资源表中的记录
			for (PageData resource : resources) {//对每一条记录进行遍历
				String path = resource.getString("illegalImage");//获取其图片路径字段
				FileUtil.delFile(FileUtil.getParentFolderPath(SysConstants.getIllegalBuildingPhotoUrl())+path);//根据图片存放地址+图片调用编写的文件删除方法删除内存中的图片
			}
			// 删除t_illegal_building——image资源表
			dao.delete("illegal_buildingMapper.deleteResourceByBuildingId", pd);			
			// 删除主表t_illegal_building	
			dao.delete("illegal_buildingMapper.delete", pd);
私搭乱盖的删除按钮失效。

21、时间选择器精确到时分秒----物业缴费新增修改3个时间

<script type="text/javascript" src="static/My97DatePicker/WdatePicker.js"></script><!-- 97日期控件 -->


<tr>
<td style="width:70px;text-align: right;padding-top: 13px;">缴费有效期结束时间:</td>
<td><input type="text" name="endTime" id="endTime" value="${pd.endTime}" onfocus="WdatePicker({isShowClear:false,readOnly:true,dateFmt:'yyyy-MM-dd HH:mm:ss'})"class="Wdate" maxlength="32" placeholder="这里输入缴费有效期结束时间" title="缴费有效期结束时间"/></td>
			</tr>
22、房屋管理节点更改了,和房屋id相关的都要改。

23、app接口参数错误,返回失败。

获取列表的参数都是系统定义好的,不会出错,所以不需要判断参数是否正确

24、运行项目报错 线程进程问题

25、在房屋管理新增完缴费之后有成功提示!!!

4、房屋修改时,如果不改变一级分类,后面的分类里只有默认的选项,没有其他的属于前一级的字。而且修改时若第一级没错误不需要修改,后面的字段无法显示。













25

















评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值