233 lines
10 KiB
Plaintext
233 lines
10 KiB
Plaintext
<%@page import="com.tenwa.httpclient.resources.QuartzPropertiesUtil"%>
|
||
<%@ page contentType="text/html; charset=GBK"%><%@
|
||
include file="/IncludeBeginMD.jsp"%><%
|
||
/*
|
||
* Content: 查看审批详情
|
||
* Input Param:
|
||
* ObjectType: 对象类型
|
||
* CreditApply: 申请
|
||
* ApproveApply: 最终审批意见
|
||
* PutOutApply: 出帐
|
||
* ObjectNo: 对象编号
|
||
* FlowNo:流程号
|
||
* PhaseNo:阶段号
|
||
* History Log: zywei 2006/02/22 增加查看自己签署的意见(背靠背签署)
|
||
*/
|
||
//获取页面参数
|
||
String sObjectType = CurPage.getParameter("ObjectType");
|
||
String sObjectNo= CurPage.getParameter("ObjectNo");
|
||
String sCurFlowNo = CurPage.getParameter("FlowNo");
|
||
String sCurPhaseNo = CurPage.getParameter("PhaseNo");
|
||
//将空值转化为空字符串
|
||
if(sObjectType==null)sObjectType="";
|
||
if(sObjectNo==null)sObjectNo="";
|
||
if(sCurFlowNo==null)sCurFlowNo="";
|
||
if(sCurPhaseNo==null)sCurPhaseNo="";
|
||
|
||
//control distributor(temporary)
|
||
boolean flag = false;
|
||
List<String> sRoles = CurUser.getRoleTable();
|
||
String distributorRole = QuartzPropertiesUtil.get("distributor_role");
|
||
distributorRole = distributorRole == null ? "" : distributorRole;
|
||
for(String role : sRoles) {
|
||
if(distributorRole.indexOf(role) != -1) {
|
||
flag = true;
|
||
break;
|
||
}
|
||
}
|
||
|
||
String sSql,sOpinionRightType="",sOpinionRightPhases="",sOpinionRightRoles="",sTempPrivilegePhases="",sPhaseAction="";
|
||
boolean bRolePrivilege = false; //哪些阶段能看
|
||
boolean bPhasePrivilege = false;//
|
||
boolean bPhaseMatch = false;//判断当前意见所处阶段是否在对应的特权阶段
|
||
|
||
String sFlowNo = "", sPhaseNo = "";
|
||
String sSelfOpinionPhase = "", sSelfOpinion = "";
|
||
String sPhaseName = "", sUserName = "", sOrgName = "";
|
||
String sBeginTime = "", sEndTime = "";
|
||
int iCountRecord=0;//用于判断记录是否有审批意见
|
||
|
||
BizObjectManager fmManager = JBOFactory.getBizObjectManager("jbo.sys.FLOW_MODEL");
|
||
BizObjectManager foManager = JBOFactory.getBizObjectManager("jbo.sys.FLOW_OPINION");
|
||
BizObjectManager ftManager = JBOFactory.getBizObjectManager("jbo.sys.FLOW_TASK");
|
||
//获取仅查看自己签署的意见所对应的阶段
|
||
BizObject fmBo = fmManager.createQuery(" select Attribute6 from O where FlowNo =:FlowNo and PhaseNo =:PhaseNo ")
|
||
.setParameter("FlowNo",sCurFlowNo).setParameter("PhaseNo",sCurPhaseNo).getSingleResult(false);
|
||
if(fmBo!=null) sSelfOpinionPhase = fmBo.getAttribute("Attribute6").getString();
|
||
//获取仅查看自己签署的意见信息
|
||
if(!StringX.isEmpty(sSelfOpinionPhase)){
|
||
sSql = " select FO.PhaseOpinion,O.PhaseName,O.UserName, O.OrgName,O.BeginTime,O.EndTime "+
|
||
" from O,jbo.sys.FLOW_OPINION FO where O.Serialno=FO.SerialNo "+
|
||
" and (FO.PhaseOpinion is not null) and FO.InputUser =:InputUser "+
|
||
" and O.ObjectNo=:ObjectNo and O.ObjectType=:ObjectType"+
|
||
" and O.FlowNo =:FlowNo and O.PhaseNo=:PhaseNo order by O.BeginTime desc ";
|
||
BizObject opinion = ftManager.createQuery(sSql).setParameter("InputUser",CurUser.getUserID()).setParameter("ObjectNo",sObjectNo)
|
||
.setParameter("ObjectType",sObjectType).setParameter("FlowNo",sCurFlowNo).setParameter("PhaseNo",sCurPhaseNo)
|
||
.getSingleResult(false);
|
||
if(opinion!=null){
|
||
sSelfOpinion = opinion.getAttribute("PhaseOpinion").getString();
|
||
sPhaseName = opinion.getAttribute("PhaseName").getString();
|
||
sUserName = opinion.getAttribute("UserName").getString();
|
||
sOrgName = opinion.getAttribute("OrgName").getString();
|
||
sBeginTime = opinion.getAttribute("BeginTime").getString();
|
||
sEndTime = opinion.getAttribute("EndTime").getString();
|
||
iCountRecord = iCountRecord + 1;
|
||
}
|
||
}
|
||
|
||
//各级人员意见保存在 FLOW_OPINION 中 ,如果需要显示一些其他意见需要修改签署意见界面进行配套
|
||
//FLOW_MODEL添加的读于意见查看权限的判断,通过 Attribute2,
|
||
sSql = " select O.serialno,O.FlowNo,O.PhaseNo,O.PhaseName,O.UserName,O.OrgName,O.PhaseAction,O.BeginTime, "+
|
||
" O.EndTime,O.PhaseChoice,FO.PhaseOpinion,FO.PhaseOpinion1,FO.PhaseOpinion2,FO.PhaseOpinion3, "+
|
||
" FM.Attribute3 as v.OpinionRightType,FM.Attribute4 as v.OpinionRightPhases,FM.Attribute5 as v.OpinionRightRoles "+
|
||
" ,v.getUserName(fo.inputuser) as v.optionUser,v.getOrgName(fo.inputorg) as v.optionOrg,fo.inputtime from O,jbo.sys.FLOW_OPINION FO,jbo.sys.FLOW_MODEL FM "+
|
||
" where O.Serialno=FO.SerialNo and O.FlowNo=FM.FlowNo and O.PhaseNo=FM.PhaseNo "+
|
||
" and (FO.PhaseOpinion is not null) and O.ObjectNo=:ObjectNo and O.ObjectType=:ObjectType ";
|
||
if(flag) { //经销商约束审批意见查看权限
|
||
String sRole = "";
|
||
for(String s : sRoles) {
|
||
if("800".equals(s)) {
|
||
continue;
|
||
}
|
||
if(sRole.length() != 0) {
|
||
sRole += ",";
|
||
}
|
||
sRole += "'" + s + "'";
|
||
}
|
||
|
||
sSql += " and (exists (select 1 from jbo.sys.USER_ROLE ur where O.userid = ur.userid and ur.roleid in (" + sRole + ")) or exists (select 1 from jbo.sys.FLOW_TASK FT left join jbo.sys.USER_ROLE U on FT.userid = U.userid where FT.relativeserialno = O.serialno and U.roleid in (" + sRole + ")))";
|
||
}
|
||
|
||
if(sSelfOpinionPhase.equals("")){
|
||
sSql += " ORDER BY O.BeginTime desc, O.SerialNo ";
|
||
}else{
|
||
sSql += " and O.PhaseNo <> :PhaseNo ORDER BY O.BeginTime desc,O.SerialNo";
|
||
}
|
||
List<BizObject> opinionList = ftManager.createQuery(sSql).setParameter("ObjectNo",sObjectNo)
|
||
.setParameter("ObjectType",sObjectType).setParameter("PhaseNo",sSelfOpinionPhase).getResultList(false);
|
||
|
||
%>
|
||
<html>
|
||
<head>
|
||
<title>审批详情</title>
|
||
</head>
|
||
<body leftmargin="0" topmargin="0" class="pagebackground" style="overflow-y: auto; height: 100%;">
|
||
<table width="99.5%" cellpadding="3" cellspacing="0" border="0" align="right">
|
||
<%
|
||
for (BizObject opinionBo : opinionList){
|
||
sOpinionRightType = opinionBo.getAttribute("OpinionRightType").getString(); //查看意见方式 all_except(排除一些阶段) none_except(选择一些阶段)
|
||
sOpinionRightPhases = opinionBo.getAttribute("OpinionRightPhases").getString();//不同查看意见方式对应的阶段
|
||
sOpinionRightRoles = opinionBo.getAttribute("OpinionRightRoles").getString(); //意见查看特权角色
|
||
sPhaseAction = opinionBo.getAttribute("PhaseAction").getString();
|
||
//将空值转化为空字符串
|
||
if(sOpinionRightType == null) sOpinionRightType = "";
|
||
if(sOpinionRightType.length()==0){sOpinionRightType="all_except";}
|
||
if(sOpinionRightPhases == null) sOpinionRightPhases = "";
|
||
if(sOpinionRightRoles == null) sOpinionRightRoles = "";
|
||
if(sPhaseAction == null) sPhaseAction = "";
|
||
|
||
//1、判断该用户是否拥有特权角色
|
||
if(sOpinionRightRoles.equals("")) bRolePrivilege = false;
|
||
else{
|
||
ArrayList<String> roles = CurUser.getRoleTable();
|
||
for(int i=0;i<roles.size();i++){
|
||
if(sOpinionRightRoles.indexOf(roles.get(i))>=0){
|
||
bRolePrivilege = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
//2、判断当前意见所处阶段是否在模型对应的特权阶段
|
||
if(sOpinionRightPhases.equals("")) bPhaseMatch = false;
|
||
else{
|
||
int iCountPhases = StringFunction.getSeparateSum(sOpinionRightPhases,",");
|
||
|
||
String sTempFlowPhase,sTempFlow,sTempPhase;
|
||
for(int i=0;i<iCountPhases;i++){
|
||
sTempFlowPhase = StringFunction.getSeparate(sOpinionRightPhases,",",i+1);
|
||
if(sTempFlowPhase.indexOf(".")<0) sTempFlowPhase = sCurFlowNo + "." + sTempFlowPhase;
|
||
if(sTempFlowPhase.equals(sCurFlowNo+"."+sCurPhaseNo)){
|
||
bPhaseMatch = true;
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
//3、根据查看意见方式的不同,判断是否可以显示
|
||
if(sOpinionRightType.equals("") || sOpinionRightType.equals("none_except")){
|
||
bPhasePrivilege = bPhaseMatch;
|
||
}else{
|
||
bPhasePrivilege = !bPhaseMatch;
|
||
}
|
||
|
||
//4、最终判断是否显示意见,如果不需要显示,则继续判断下一条意见
|
||
//该用户是否具有特权角色、该阶段意见是否属于该意见可查看阶段、该阶段是否属于
|
||
if(!bPhasePrivilege && !bRolePrivilege && sPhaseAction.indexOf("补充资料")<0) continue;
|
||
iCountRecord++;
|
||
%>
|
||
<tr>
|
||
<td>
|
||
<table width=100% cellpadding="4" cellspacing="0" border="1" bordercolorlight="#666666" bordercolordark="#FFFFFF" >
|
||
<tr bgcolor="#CCCCCC" height="35px">
|
||
<td colspan=2 >
|
||
<b width=30% >步骤名称:</b><span style="text-decoration:underline;" onclick="showTaskView('<%=opinionBo.getAttribute("serialno").getString() %>')"><%=DataConvert.toString(opinionBo.getAttribute("PhaseName").getString())%> </span>
|
||
<% if(flag) {%>
|
||
<b width=30% >处理人所属机构:</b>安鹏租赁
|
||
<%} else {%>
|
||
<b width=30% >处理人:</b><%=DataConvert.toString(opinionBo.getAttribute("optionUser").getString())%>
|
||
<b width=30% >处理人所属机构:</b><%=DataConvert.toString(opinionBo.getAttribute("optionOrg").getString())%>
|
||
<%}%>
|
||
<b width=30% >意见填写时间:</b><%=DataConvert.toString(opinionBo.getAttribute("inputtime").getString())%>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td width=50% height="25px"><b>收到时间:</b><%=DataConvert.toString(opinionBo.getAttribute("BeginTime").getString())%>
|
||
<td width=50% height="25px"><b>完成时间:</b><%=DataConvert.toString(opinionBo.getAttribute("EndTime").getString())%></td>
|
||
</tr>
|
||
<tr>
|
||
<td colspan=2 align=center>
|
||
<textarea readonly style="background-color:#FDFDF3; width:100%;height:170px;resize: none;">
|
||
<%="\r\n【意见】"+ StringFunction.replace(DataConvert.toString(opinionBo.getAttribute("PhaseOpinion").getString()).trim(),"\\r\\n","\r\n")%>
|
||
</textarea>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td>
|
||
</td>
|
||
</tr>
|
||
<%
|
||
}
|
||
%>
|
||
</table>
|
||
</body>
|
||
</html>
|
||
<%
|
||
//如果没有意见或者没有找到对应的对象,则自动关闭
|
||
if (iCountRecord==0||sObjectNo.equals("")){
|
||
%>
|
||
<body style={color:red}>目前此业务还没有您可以查看的审批意见!</body>
|
||
<%
|
||
}
|
||
%>
|
||
<script language="javascript">
|
||
function showTaskView(taskno){
|
||
//获得申请类型、申请流水号
|
||
var sTaskNo = taskno;
|
||
var sObjectType ="<%=sObjectType%>";
|
||
var sObjectNo = "<%=sObjectNo%>";
|
||
if(typeof parent.viewTaskViewByParam=="function"){
|
||
parent.viewTaskViewByParam(sTaskNo,sObjectType,sObjectNo);
|
||
}else{
|
||
viewTaskViewByParam(sTaskNo,sObjectType,sObjectNo);
|
||
}
|
||
|
||
}
|
||
function viewTaskViewByParam(sTaskNo,sObjectType,sObjectNo){
|
||
AsTaskView.flowApprovetaskView(sTaskNo,sObjectType,sObjectNo,"001");
|
||
}
|
||
</script>
|
||
<%@ include file="/IncludeEnd.jsp"%> |