281 lines
9.8 KiB
Java
281 lines
9.8 KiB
Java
package com.tenwa.lease.util;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT;
|
|
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
|
|
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP;
|
|
import jbo.sys.CODE_LIBRARY;
|
|
|
|
import com.amarsoft.app.util.ProductParamUtil;
|
|
import com.amarsoft.are.jbo.BizObject;
|
|
import com.amarsoft.are.jbo.JBOFactory;
|
|
import com.tenwa.flow.treeview.action.BaseInitTreeView;
|
|
import com.tenwa.flow.treeview.action.TreeItemData;
|
|
|
|
public class FlowViewUtil {
|
|
|
|
/**
|
|
* 根据产品修改树
|
|
* @param tv
|
|
* @throws Exception
|
|
*/
|
|
public static void updateTreeView(BaseInitTreeView tv) throws Exception{
|
|
tv.addLastNodeByCode("11190");
|
|
List<TreeItemData> list2=tv.getTreeItem();
|
|
List<TreeItemData> list=new ArrayList<TreeItemData>();
|
|
list.addAll(list2);
|
|
for(int i=0;i<list.size();i++){
|
|
if(list.get(i).getItemNo().equals("11020")){//租赁物明细
|
|
updateEquipView(tv);
|
|
}
|
|
if(list.get(i).getItemNo().equals("11490")){//租赁物明细变更
|
|
updateEquipViewChange(tv);
|
|
}
|
|
if(list.get(i).getItemNo().equals("11060")){//方案信息
|
|
updatePlanView(tv);
|
|
}
|
|
if(list.get(i).getItemNo().equals("11530")){//方案信息 正式表
|
|
updatePlanViewFormal(tv);
|
|
}
|
|
if(list.get(i).getItemNo().equals("11040")){//担保单位
|
|
updateGuarantyView(tv);
|
|
}
|
|
if(list.get(i).getItemNo().equals("11470")){
|
|
updatecondition(tv);
|
|
}
|
|
if(list.get(i).getItemName().equals("项目其他商务条件")){
|
|
tv.updateNodeName("项目其他商务条件", "其他商务条件");
|
|
}
|
|
if(list.get(i).getItemName().equals("合同其他商务条件")){
|
|
tv.updateNodeName("合同其他商务条件", "其他商务条件");
|
|
}
|
|
if(list.get(i).getParentNo().equals("11560")){//开票信息变更
|
|
updateInvoiceViewChange(tv);
|
|
}
|
|
}
|
|
}
|
|
private static void updatecondition(BaseInitTreeView tv) throws Exception {
|
|
//String planinformation=ProductParamUtil.getProductParameterValue("0001", "PRD0314", "planinformation");//方案类型
|
|
String flowunid=tv.getFlowFixedParam().get("FlowUnid");
|
|
BizObject flow=JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO_TEMP.CLASS_NAME, "flowunid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
|
|
String rent_method="";
|
|
if(flow!=null){
|
|
rent_method=flow.getAttribute("RENT_METHOD").toString();
|
|
}
|
|
if("010".equals(rent_method)){
|
|
tv.deleteNode("投放方案列表");
|
|
tv.addChildrenNodeByCode("产权转移单","11430");
|
|
tv.addChildrenNodeByCode("资金收付款计划页面","11440");
|
|
tv.addChildrenNodeByCode("资金收付款历史页面","11450");
|
|
tv.addChildrenNodeByCode("租金回笼计划页面","11460");
|
|
}
|
|
}
|
|
/**
|
|
* 根据产品修改验证节点
|
|
* @param checkNode
|
|
* @param flowunid
|
|
* @throws Exception
|
|
*/
|
|
public static void updateTreeCheck(List<String> checkNode,String flowunid) throws Exception{
|
|
for(int i=0;i<checkNode.size();i++){
|
|
if(checkNode.get(i).equals("11020")){
|
|
checkNode.remove(i);
|
|
updateEquipCheck(checkNode, flowunid);
|
|
}
|
|
if(checkNode.get(i).equals("11060")){
|
|
//updatePlanView(null);
|
|
}
|
|
|
|
}
|
|
}
|
|
/**
|
|
* 开票信息变更(起租后合同变更)
|
|
* @param tv
|
|
* @throws Exception
|
|
*/
|
|
public static void updateInvoiceViewChange(BaseInitTreeView tv) throws Exception{
|
|
|
|
for(int i=0;i<tv.getTreeItem().size();i++){
|
|
if(tv.getTreeItem().get(i).getItemNo().equals("11254")){
|
|
tv.updateNodeUrl(tv.getTreeItem().get(i).getItemName(),"/Tenwa/Lease/Flow/Contract/ContractOnhireChange/LBContractInvoiceType.jsp@");
|
|
}else if(tv.getTreeItem().get(i).getItemNo().equals("11255")){
|
|
tv.updateNodeUrl(tv.getTreeItem().get(i).getItemName(),"/Tenwa/Lease/Flow/Contract/ContractOnhireChange/LBContractInvoiceObject.jsp@");
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* 租赁物明细变更根据产品显示
|
|
* @param tv 要处理的树
|
|
* @throws Exception
|
|
*/
|
|
public static void updateEquipViewChange(BaseInitTreeView tv) throws Exception{
|
|
|
|
for(int i=0;i<tv.getTreeItem().size();i++){
|
|
if(tv.getTreeItem().get(i).getParentNo().equals("11490")){
|
|
tv.updateNodeUrl(tv.getTreeItem().get(i).getItemName(),"/Tenwa/Lease/Flow/Contract/ContractOnhireChange/LBEquipment.jsp@");
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* 租赁物明细根据产品显示
|
|
* @param tv 要处理的树
|
|
* @throws Exception
|
|
*/
|
|
public static void updateEquipView(BaseInitTreeView tv) throws Exception{
|
|
|
|
String productId="";
|
|
if(tv.getFlowFixedParam().containsKey("ProductId")){
|
|
productId=tv.getFlowFixedParam().get("ProductId");
|
|
}else{
|
|
String flowunid=tv.getFlowFixedParam().get("FlowUnid");
|
|
BizObject flow=JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
|
|
productId=flow.getAttribute("productId").getString();
|
|
}
|
|
|
|
// 安鹏要求 :去掉租赁物类型,默认一般
|
|
// String value=ProductParamUtil.getProductParameterValue(productId, "PRD0312", "equip_type");
|
|
String value="normal";
|
|
List<BizObject> list=JBOFactory.createBizObjectQuery(CODE_LIBRARY.CLASS_NAME,"codeno=:codeno").setParameter("codeno","equip_type").getResultList(false);
|
|
String[] values=value.split(",");
|
|
Boolean flag=false;
|
|
for(int i=0;i<list.size();i++){
|
|
flag=false;
|
|
for(int y=0;y<values.length;y++){
|
|
if(values[y].equals(list.get(i).getAttribute("itemno").getString())){
|
|
flag=true;
|
|
break;
|
|
}
|
|
}
|
|
if(!flag){
|
|
tv.deleteNodeByItemno(list.get(i).getAttribute("itemattribute").getString());
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* 根据产品 修改检查节点
|
|
* @param checkNode
|
|
* @param flowunid
|
|
* @throws Exception
|
|
*/
|
|
public static void updateEquipCheck(List<String> checkNode,String flowunid) throws Exception{
|
|
|
|
BizObject flow=JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
|
|
|
|
String productId=flow.getAttribute("productId").getString();
|
|
// 安鹏要求 :去掉租赁物类型,默认一般
|
|
// String value=ProductParamUtil.getProductParameterValue(productId, "PRD0312", "equip_type");
|
|
String value="normal";
|
|
String[] equipTypes=value.split(",");
|
|
List<BizObject> list=JBOFactory.createBizObjectQuery(CODE_LIBRARY.CLASS_NAME,"codeno=:codeno").setParameter("codeno","equip_type").getResultList(false);
|
|
int flag=0;
|
|
for(int i=0;i<list.size();i++){
|
|
flag=0;
|
|
for(int y=0;y<equipTypes.length;y++){
|
|
if(list.get(i).getAttribute("itemno").getString().equals(equipTypes[y])){
|
|
flag=1;
|
|
break;
|
|
}
|
|
}
|
|
if(flag==0){
|
|
for(int k=0;k<checkNode.size();k++){
|
|
if(list.get(i).getAttribute("itemattribute").getString().equals(checkNode.get(k))){
|
|
checkNode.remove(k);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
* 根据产品修改方案信息
|
|
* @param tv
|
|
* @throws Exception
|
|
*/
|
|
public static void updatePlanView(BaseInitTreeView tv) throws Exception{
|
|
|
|
|
|
String productId="";
|
|
String flowname="";
|
|
if(tv.getFlowFixedParam().containsKey("ProductId")&&!(tv.getFlowFixedParam().containsKey("FlowUnid"))){
|
|
productId=tv.getFlowFixedParam().get("ProductId");
|
|
}else{
|
|
String flowunid=tv.getFlowFixedParam().get("FlowUnid");
|
|
BizObject flow=JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
|
|
productId=flow.getAttribute("productId").getString();
|
|
flowname=flow.getAttribute("flow_name").getString();
|
|
}
|
|
|
|
String value=ProductParamUtil.getProductParameterValue(productId, "PRD0314", "planinformation");
|
|
|
|
if(value.length()==0){
|
|
tv.deleteNode("方案信息");
|
|
}else if("SinglePlan".equals(value)){
|
|
tv.updateNodeUrl("方案信息", "/Accounting/LoanSimulation/LoanBasicInfo.jsp@");
|
|
tv.updateNodeName("方案信息","商务条件");
|
|
if("项目立项流程".equals(flowname)||"项目变更流程".equals(flowname)||"项目撤销流程".equals(flowname)){
|
|
tv.addLastNodeByCode("11190");
|
|
}
|
|
}
|
|
}
|
|
/**
|
|
* 根据产品修改方案信息
|
|
* @param tv
|
|
* @throws Exception
|
|
*/
|
|
public static void updatePlanViewFormal(BaseInitTreeView tv) throws Exception{
|
|
|
|
|
|
String productId="";
|
|
if(tv.getFlowFixedParam().containsKey("ProductId")){
|
|
productId=tv.getFlowFixedParam().get("ProductId");
|
|
}else{
|
|
String flowunid=tv.getFlowFixedParam().get("FlowUnid");
|
|
BizObject flow=JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
|
|
productId=flow.getAttribute("productId").getString();
|
|
}
|
|
|
|
String value=ProductParamUtil.getProductParameterValue(productId, "PRD0314", "planinformation");
|
|
|
|
if(value.length()==0){
|
|
tv.deleteNode("方案信息");
|
|
}else if("SinglePlan".equals(value)){
|
|
tv.updateNodeUrl("方案信息", "/Accounting/LoanSimulation_formal/LoanBasicInfo.jsp@");
|
|
tv.updateNodeName("方案信息","商务条件");
|
|
if(tv.getFlowFixedParam().containsKey("ContractId")){
|
|
String contractid=tv.getFlowFixedParam().get("ContractId");
|
|
BizObject contract=JBOFactory.createBizObjectQuery(LB_CONTRACT_INFO.CLASS_NAME,"id=:id").setParameter("id", contractid).getSingleResult(false);
|
|
if(contract!=null&&contract.getAttribute("RENT_METHOD").getString().equals("010")){
|
|
tv.updateNodeUrl("投放信息", "/Accounting/LoanSimulation_formal/LoanBasicInfo.jsp@");
|
|
tv.updateNodeName("投放信息","回笼情况");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
public static void updateGuarantyView(BaseInitTreeView tv) throws Exception{
|
|
|
|
|
|
tv.updateNodeName("担保单位", "担保单位");
|
|
String productId="";
|
|
if(tv.getFlowFixedParam().containsKey("ProductId")){
|
|
productId=tv.getFlowFixedParam().get("ProductId");
|
|
}else{
|
|
String flowunid=tv.getFlowFixedParam().get("FlowUnid");
|
|
BizObject flow=JBOFactory.createBizObjectQuery(FLOW_BUSSINESS_OBJECT.CLASS_NAME, "flow_unid=:flowunid").setParameter("flowunid", flowunid).getSingleResult(false);
|
|
productId=flow.getAttribute("productId").getString();
|
|
}
|
|
Map<String,Map<String,String>> map=new HashMap<String,Map<String,String>>();
|
|
map=ProductParamUtil.getProductComponentType(productId, "PRD0105");
|
|
|
|
if(map.size()==0||map==null){
|
|
tv.deleteNode("担保单位");
|
|
|
|
}
|
|
}
|
|
}
|