package com.tenwa.lease.flow.riskalert; import java.util.Map; import jbo.com.tenwa.entity.comm.flow.FLOW_BUSSINESS_OBJECT; import com.amarsoft.app.lc.workflow.action.GetFlowAction; import com.amarsoft.are.jbo.BizObject; import com.amarsoft.are.jbo.BizObjectKey; import com.amarsoft.are.jbo.BizObjectManager; import com.amarsoft.are.jbo.JBOFactory; import com.amarsoft.are.jbo.JBOTransaction; import com.amarsoft.awe.dw.handler.impl.CommonHandler; import com.amarsoft.dict.als.manage.NameManager; import com.tenwa.comm.util.date.DateAssistant; public class RiskAlertTempInfoHandler extends CommonHandler{ @Override protected void initDisplayForAdd(BizObject bo) throws Exception { String flowUnid = this.asPage.getParameter("FlowUnid"); Map flowParam = GetFlowAction.getFlowParamByFlowUnid(flowUnid); String AlertNo = flowParam.get("AlertNo"); bo.setAttributeValue("FLOWUNID", flowUnid); bo.setAttributeValue("ALERT_NO", AlertNo); bo.setAttributeValue("APPLY_PERSON", this.curUser.getUserID()); bo.setAttributeValue("ALERT_DATE", DateAssistant.getToday()); bo.setAttributeValue("APPLY_DEPT", this.curUser.getOrgID()); bo.setAttributeValue("ALERT_STATUS", "valid"); bo.setAttributeValue("ALERT_PROPERTY", "alert_property01"); super.initDisplayForAdd(bo); } @Override protected void beforeInsert(JBOTransaction tx, BizObject bo) throws Exception { String alertObject =bo.getAttribute("ALERT_OBJECT").toString(); if(alertObject.equals("alert_object01")){ String customername = NameManager.getCustomerName(bo.getAttribute("ALERT_CUSTOMER").toString()); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警客户:"+customername); }else if(alertObject.equals("alert_object02")){ String alertIndustryName = NameManager.getItemName("cust_kind",bo.getAttribute("ALERT_INDUSTRY").toString()); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警行业:"+alertIndustryName); }else if(alertObject.equals("alert_object03")){ String alertCity = bo.getAttribute("ALERT_CITY").toString(); if(alertCity== null || alertCity.equals("")){ String alertProvinceName = NameManager.getItemName("AreaCode",bo.getAttribute("ALERT_PROVINCE").toString()); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警省份:"+alertProvinceName); }else{ String alertCityName = NameManager.getItemName("AreaCode",alertCity); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警城市:"+alertCityName); } }else{ String alertCity = bo.getAttribute("ALERT_CITY").toString(); String alertIndustryName = NameManager.getItemName("cust_kind",bo.getAttribute("ALERT_INDUSTRY").toString()); if(alertCity== null || alertCity.equals("")){ String alertProvinceName = NameManager.getItemName("AreaCode",bo.getAttribute("ALERT_PROVINCE").toString()); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警行业+区域:"+alertIndustryName+"+"+alertProvinceName); }else{ String alertCityName = NameManager.getItemName("AreaCode",alertCity); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警行业+区域:"+alertIndustryName+"+"+alertCityName); } } super.beforeInsert(tx, bo); } @Override protected void beforeUpdate(JBOTransaction tx, BizObject bo) throws Exception { String alertObject =bo.getAttribute("ALERT_OBJECT").toString(); if(alertObject.equals("alert_object01")){ String customername = NameManager.getCustomerName(bo.getAttribute("ALERT_CUSTOMER").toString()); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警客户:"+customername); }else if(alertObject.equals("alert_object02")){ String alertIndustryName = NameManager.getItemName("cust_kind",bo.getAttribute("ALERT_INDUSTRY").toString()); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警行业:"+alertIndustryName); }else if(alertObject.equals("alert_object03")){ String alertCity = bo.getAttribute("ALERT_CITY").toString(); if(alertCity== null || alertCity.equals("")){ String alertProvinceName = NameManager.getItemName("AreaCode",bo.getAttribute("ALERT_PROVINCE").toString()); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警省份:"+alertProvinceName); }else{ String alertCityName = NameManager.getItemName("AreaCode",alertCity); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警城市:"+alertCityName); } }else{ String alertCity = bo.getAttribute("ALERT_CITY").toString(); String alertIndustryName = NameManager.getItemName("cust_kind",bo.getAttribute("ALERT_INDUSTRY").toString()); if(alertCity== null || alertCity.equals("")){ String alertProvinceName = NameManager.getItemName("AreaCode",bo.getAttribute("ALERT_PROVINCE").toString()); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警行业+区域:"+alertIndustryName+"+"+alertProvinceName); }else{ String alertCityName = NameManager.getItemName("AreaCode",alertCity); bo.setAttributeValue("ALERT_OBJECT_INFO", "预警行业+区域:"+alertIndustryName+"+"+alertCityName); } } super.beforeUpdate(tx, bo); } @Override protected void afterInsert(JBOTransaction tx, BizObject bo) throws Exception { BizObjectManager manager = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME); BizObject flowBuessinessObject=manager.newObject(); BizObjectKey key=manager.getKey(); key.setAttributeValue("flow_unid", bo.getAttribute("FLOWUNID").toString()); flowBuessinessObject=manager.getObject(key); flowBuessinessObject.setAttributeValue("flow_key", bo.getAttribute("ALERT_OBJECT_INFO").toString()); tx.join(manager); manager.saveObject(flowBuessinessObject); super.afterInsert(tx, bo); } @Override protected void afterUpdate(JBOTransaction tx, BizObject bo) throws Exception { BizObjectManager manager = JBOFactory.getBizObjectManager(FLOW_BUSSINESS_OBJECT.CLASS_NAME); BizObject flowBuessinessObject=manager.newObject(); BizObjectKey key=manager.getKey(); key.setAttributeValue("flow_unid", bo.getAttribute("FLOWUNID").toString()); flowBuessinessObject=manager.getObject(key); flowBuessinessObject.setAttributeValue("flow_key", bo.getAttribute("ALERT_OBJECT_INFO").toString()); tx.join(manager); manager.saveObject(flowBuessinessObject); super.afterUpdate(tx, bo); } }