NutzCN Logo
问答 请问为什么同样的语句就得不到对象呢?
发布于 2558天前 作者 qq_152b6ff2 1726 次浏览 复制 上一个帖子 下一个帖子
标签:

保存的时候oldProjectInfo就能取得 但是为什么提交的时候就为null呢。。。

/**
	 * 保存建设情况
	 * @param projectInfo 项目总表
	 * @param designRequire 规划要求
	 * @param session
	 * @return
	 */
	@At("/saveCS")
	@Ok("jsp:jsp.work.designRequire.constructionSituation")
	public View saveConstructionSituation(@Param("::projectInfo.")QfgProjectInfo projectInfo,@Param("::designRequire.")QfgDesignRequire designRequire,HttpSession session){
		NutMap map = new NutMap();
		QfgProjectInfo oldProjectInfo = dao.fetch(QfgProjectInfo.class,projectInfo.getNmSqbId());
		QfgDesignRequire oldDesignRequire = dao.fetch(QfgDesignRequire.class,designRequire.getNmSqbId());
		try {
			if(oldProjectInfo==null){
				//土地类型
				projectInfo.setStLandType("3");
				//默认未生成xml
				projectInfo.setStIfGenXml("0");
				//业务类型
				projectInfo.setStBusCode("WD_TJ_XB");
				wondersDao.fastInsert(projectInfo, session);//此处使用fastInsert方法,避免报件主键被自动生成的序列覆盖
			}else{
				projectInfo.setDtUpdateDate(new Date());
				projectInfo.setNmUpdateUser(UserUtils.getUserIdFromSession(session));
				Daos.ext(dao, FieldFilter.locked(QfgProjectInfo.class, 
						"^stIfGenXml|stApproveNode|stIfFinish|stReservationNum|stBusCode|stLandType|stProjectId|dtInsertDate|nmInsertUser$")).update(projectInfo);
				//wondersDao.update(projectInfo, session);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		try {
			if(oldDesignRequire==null){
				wondersDao.insert(designRequire, session);
			}else{
				wondersDao.update(designRequire, session);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return new ServerRedirectView("/designRequire/constructionSituation?nmSqbId=" + projectInfo.getNmSqbId());
	}
	
	/**
	 * 提交建设情况
	 * @param projectInfo 项目总表
	 * @param designRequire 规划要求
	 * @param session
	 * @return
	 */
	@At("/subCS")
	@Ok("jsp:jsp.work.designRequire.applyComplete")
	public View subConstructionSituation(@Param("::projectInfo.")QfgProjectInfo projectInfo,@Param("::designRequire.")QfgDesignRequire designRequire,HttpSession session){
		NutMap map = new NutMap();
		QfgProjectInfo oldProjectInfo = dao.fetch(QfgProjectInfo.class,projectInfo.getNmSqbId());
		QfgDesignRequire oldDesignRequire = dao.fetch(QfgDesignRequire.class,designRequire.getNmSqbId());
		try {
			if(oldProjectInfo==null){
				projectInfo.setStLandType("3");
				projectInfo.setStIfGenXml("0");
				projectInfo.setStBusCode("WD_TJ_XB");
				projectInfo.setDtSubmitDate(new Date());
				wondersDao.fastInsert(projectInfo, session);
			}else{
				projectInfo.setDtUpdateDate(new Date());
				projectInfo.setNmUpdateUser(UserUtils.getUserIdFromSession(session));
				projectInfo.setDtSubmitDate(new Date());
				Daos.ext(dao, FieldFilter.locked(QfgProjectInfo.class, 
						"^stIfGenXml|stApproveNode|stIfFinish|stReservationNum|stBusCode|stLandType|stProjectId|dtInsertDate|nmInsertUser$")).update(projectInfo);
				//wondersDao.update(projectInfo, session);
			}
		} catch (Exception e) {
			e.printStackTrace();
			return map.setv("ok", false);
		}
		try {
			if(oldDesignRequire==null){
				wondersDao.insert(designRequire, session);
			}else{
				wondersDao.update(designRequire, session);
			}
		} catch (Exception e) {
			e.printStackTrace();
			return map.setv("ok", false);
		}
		List<DicBusMaterial> busMaterialList = dao.query(DicBusMaterial.class, Cnd.where("stBusCode", "=", oldProjectInfo.getStBusCode()));
		return new ServerRedirectView("/designRequire/constructionSituation?nmSqbId=" + projectInfo.getNmSqbId());
	}
10 回复

=-=就是我点提交的时候走完try {
if(oldProjectInfo==null){
projectInfo.setStLandType("3");
projectInfo.setStIfGenXml("0");
projectInfo.setStBusCode("WD_TJ_XB");
projectInfo.setDtSubmitDate(new Date());
wondersDao.fastInsert(projectInfo, session);
}之后oldproject是空的、、、

就因为空的才会走到里面去啊,里面又没赋值出来当然还是空的

@qq_4f9057d2 可是我走保存的时候出来是有值的呀

=-=不对。。是没值 那就是应该取List busMaterialList = dao.query(DicBusMaterial.class, Cnd.where("stBusCode", "=",projectInfo.getStBusCode()));

保存和提交分别指啥??

@wendal 都是存到数据库中 只是提交多了一个submit_time和页面的跳转。。

好吧, 我依然不知道你说的是啥

心疼我自己。。。。

就没把问题说清楚:

得不到对象 -- 得不到什么对象???

保存的时候oldProjectInfo就能取得 但是为什么提交的时候就为null呢 -- 什么是保存的时候,什么是提交的时候? 这是两个入口方法吗? 分别对应啥入口方法?

就为null呢 -- 啥东西是null? 什么语句的返回值是null??? 或者啥判断条件为null了???

添加回复
请先登陆
回到顶部