transactionaction.java

来自「spring+hibernate+struts开发的校务oa系统」· Java 代码 · 共 492 行 · 第 1/2 页

JAVA
492
字号
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		SessionObj sessionObj=(SessionObj) request.getSession().getAttribute(ConstantVO.SessionObj);
		int pageIndex=PageTool.getPageIndex("list", request, response);
		int pageResultSize=getItranService().findSegmentBelongIsCheckWithMe(sessionObj.getOperatorVO()).size();

		List tranList=getItranService().findSegmentBelongIsCheckWithMe(sessionObj.getOperatorVO(),
				pageIndex*5,
				ConstantVO.pageSize);
		PageList pageList=new PageList();
		pageList.setFullListSize(pageResultSize);
		pageList.setObjectsPerPage(ConstantVO.pageSize);
		pageList.setPageNumber(pageIndex);
		pageList.setList(tranList);

		request.setAttribute(Property.TRANLIST, tranList);
		request.setAttribute(Property.PAGELIST, pageList);
		return mapping.findForward(ForwardType.TRAN_APPLYIEW);

	}


	public ActionForward toApply(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		List operatorList=getIoperatorService().query(new OperatorVO());
		request.setAttribute(Property.OPERATORLIST, operatorList);
		return mapping.findForward(ForwardType.TRAN_TOAPPLY);
	}
	public ActionForward doApply(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		log.info("doApply");
		IGreensysparamService greensysparamService=getIgreenSysparamService();
		IOperatorService operatorService=getIoperatorService();
		SessionObj sessionObj=(SessionObj) request.getSession().getAttribute(ConstantVO.SessionObj);
		TransactionAF af=(TransactionAF) form;
		String recevieop=af.getRecevieop();
		String []usercount=StringUtils.split(recevieop, ",");

		GreensysparamVO ischeck=greensysparamService
		.findGCODEAndMCODE(SysParamLib.CHECK, SysParamLib.CHECK_NOT);
		GreensysparamVO isread=greensysparamService
		.findGCODEAndMCODE(SysParamLib.READ, SysParamLib.READ_NOT);
		log.info("doApply2");
		for(int i=0;i<usercount.length;i++){
			OperatorVO operatorVO=operatorService.findByUsername(usercount[i]);
			TransactionVO transactionVO=new TransactionVO();
			transactionVO.setTitle(af.getTitle());
			transactionVO.setContent(af.getContent());
			transactionVO.setTranbegintime(DateUtil.parseDate(af.getTranbegintime()));
			transactionVO.setTranendtime(DateUtil.parseDate(af.getTranendtime()));
			transactionVO.setIscheck(greensysparamService.convertPojo(ischeck));
			transactionVO.setIsread(greensysparamService.convertPojo(isread));
			transactionVO.setSendop(operatorService.convertPojo(sessionObj.getOperatorVO()));
			transactionVO.setRecevieop(operatorService.convertPojo(operatorVO));
			getItranService().save(transactionVO);
		}
		return mapping.findForward(ForwardType.TRAN_DOAPPLY);
	}

	/**
	 * 查看内容
	 * @param mapping
	 * @param form
	 * @param request
	 * @param response
	 * @return
	 * @throws Exception
	 */
	public ActionForward content(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		ITransactionService tranService=getItranService();
		String trantype=request.getParameter(Property.TRAN_TYPE);
		String pid=request.getParameter(Property.P_ID);
		TransactionVO transactionVO=tranService.findById(Long.parseLong(pid));
		request.setAttribute(Property.TRANSACTIONVO, transactionVO);
		
		
		IGreensysparamService service=getIgreenSysparamService();
		GreensysparamVO isread=service.findGCODEAndMCODE(SysParamLib.READ, SysParamLib.READ_IS);
		
		if(trantype.equals(Property.TRAN_ARRANGE)){
			return mapping.findForward(ForwardType.TRAN_ARRANGECONTENT);
			
		}else if(trantype.equals(Property.TRAN_APPLY)){
			return mapping.findForward(ForwardType.TRAN_APPLYCONTENT);
			
		}else if(trantype.equals(Property.TRAN_CHECK)){
			transactionVO.setIsread(service.convertPojo(isread));
			tranService.attachDirty(transactionVO);
			return mapping.findForward(ForwardType.TRAN_CHECKCONTENT);
			
		}else if(trantype.equals(Property.TRAN_JOB)){
			transactionVO.setIsread(service.convertPojo(isread));
			tranService.attachDirty(transactionVO);
			return mapping.findForward(ForwardType.TRAN_JOBCONTENT);
		}else{
			return null;
		}

	}

	public ActionForward doCheck(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		IGreensysparamService greensysparamService=getIgreenSysparamService();
		String pid=request.getParameter(Property.P_ID);

		String pass=request.getParameter(SysParamLib.PASS);
		GreensysparamVO ischeck=greensysparamService.findGCODEAndMCODE(SysParamLib.CHECK, SysParamLib.CHECK_IS);
		GreensysparamVO ispass=new GreensysparamVO();

		if(pass.equals(SysParamLib.PASS_IS)){
			ispass=greensysparamService
			.findGCODEAndMCODE(SysParamLib.PASS, SysParamLib.PASS_IS);
		}
		if(pass.equals(SysParamLib.PASS_NOT)){
			ispass=greensysparamService
			.findGCODEAndMCODE(SysParamLib.PASS, SysParamLib.PASS_NOT);
		}
		TransactionVO transactionVO=getItranService().findById(Long.parseLong(pid));

		transactionVO.setIscheck(greensysparamService.convertPojo(ischeck));
		transactionVO.setIspass(greensysparamService.convertPojo(ispass));
		getItranService().attachDirty(transactionVO);
		return mapping.findForward(ForwardType.TRAN_DOCHECK);
	}

	public ActionForward doFinish(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String pid=request.getParameter(Property.P_ID);
		getItranService().dofinish(Long.parseLong(pid));
		
		return mapping.findForward(ForwardType.TRAN_DOFINISH);
	}
	
	public ActionForward revert(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		IGreensysparamService sysparamService=getIgreenSysparamService();
		String pid=request.getParameter(Property.P_ID);
		TransactionAF af=(TransactionAF) form;
		TransactionVO transactionVO=getItranService().findById(Long.parseLong(pid));
		log.info("revert0");
		GreensysparamVO isread=sysparamService
					.findGCODEAndMCODE(SysParamLib.READ, SysParamLib.READ_IS);
		log.info("revert1");
		GreensysparamVO isfinish=sysparamService
					.findGCODEAndMCODE(SysParamLib.FINISH, SysParamLib.FINISH_IS);
		transactionVO.setIscheck(sysparamService.convertPojo(isread));
		transactionVO.setIsfinish(sysparamService.convertPojo(isfinish));
		log.info("revert1");
		transactionVO.setRemark(af.getRemark());
		log.info("revert2");
		getItranService().attachDirty(transactionVO);
		
		log.info("revert3");
		return mapping.findForward(ForwardType.TRAN_REVERT);
	}
	
	
	public ActionForward turnJob(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		IGreensysparamService greensysparamService=getIgreenSysparamService();
		SessionObj sessionObj=(SessionObj)request.getSession().getAttribute(ConstantVO.SessionObj);
		
		GreensysparamVO isfinish=greensysparamService
					.findGCODEAndMCODE(SysParamLib.FINISH, SysParamLib.FINISH_NOT);
		GreensysparamVO isread=greensysparamService
					.findGCODEAndMCODE(SysParamLib.READ, SysParamLib.READ_NOT);
		GreensysparamVO isread2=greensysparamService
					.findGCODEAndMCODE(SysParamLib.READ, SysParamLib.READ_IS);
//		GreensysparamVO sfalg_s=sysparamService
//					.findGCODEAndMCODE(SysParamLib.SFALG, SysParamLib.SFALG_S);
//		GreensysparamVO sfalg_r=sysparamService
//					.findGCODEAndMCODE(SysParamLib.SFALG, SysParamLib.SFALG_R);
		
		TransactionAF af=(TransactionAF) (form);
		
		TransactionVO old_tranVO=getItranService().findById(af.getTransactionid());
		
		old_tranVO.setIsread(greensysparamService.convertPojo(isread2));
		getItranService().attachDirty(old_tranVO);
		
		OperatorVO operatorVO=getIoperatorService().findById(Long.parseLong(af.getRecevieop()));
		
		TransactionVO transactionVO=new TransactionVO();
		transactionVO.setTitle(af.getTitle());
		transactionVO.setContent(af.getContent());
		transactionVO.setTranbegintime(DateUtil.parseDate(af.getTranbegintime()));
		transactionVO.setTranendtime(DateUtil.parseDate(af.getTranendtime()));
		transactionVO.setSendop(getIoperatorService().convertPojo(sessionObj.getOperatorVO()));
		transactionVO.setRecevieop(getIoperatorService().convertPojo(operatorVO));
		transactionVO.setIsread(greensysparamService.convertPojo(isread));
		transactionVO.setIsfinish(greensysparamService.convertPojo(isfinish));
		transactionVO.setPreid(af.getTransactionid());
		//transactionVO.setSflag(sysparamService.convertPojo(sfalg_r));
		getItranService().save(transactionVO);
		return mapping.findForward(ForwardType.TRAN_TURNJOB);
	}
	public ActionForward toTurn(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		String pid=request.getParameter(Property.P_ID);
		TransactionVO transactionVO=getItranService().findById(Long.parseLong(pid));
		List operatorList=getIoperatorService().query(new OperatorVO());
		request.setAttribute(Property.OPERATORLIST, operatorList);
		request.setAttribute(Property.TRANSACTIONVO, transactionVO);
		return mapping.findForward(ForwardType.TRAN_TOTURN);
	}

	public ActionForward isRead(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		
		return null;
	}
	
	public ActionForward isExistTran(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return null;
	}

	public ActionForward isFinishTran(ActionMapping mapping,
			ActionForm form,
			HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		return null;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?