From ebaddfaaca7cdad8597f9bea1be6fc24352e2120 Mon Sep 17 00:00:00 2001 From: tangfutang Date: Wed, 7 Aug 2019 15:04:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=95=E4=BA=BA=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E9=A2=9D=E5=BA=A6=E6=B1=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Lessee/Company/CustomerCompany.jsp | 2 + WebContent/WEB-INF/etc/jbo/jbo_app.xml | 29 ++++++- .../company/NewCustomerCompanyHandler.java | 85 +++++++++++++------ 3 files changed, 88 insertions(+), 28 deletions(-) diff --git a/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompany.jsp b/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompany.jsp index 957c2b407..d692e0f2d 100644 --- a/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompany.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompany.jsp @@ -41,6 +41,8 @@ // $("#STATUS_0").prop("checked", true); init(); changeOtherRequired(); + $("#STARTTIME").attr("ReadOnly","true"); + $("#ENDTIME").attr("ReadOnly","true"); }) function init(){//根据国别确定省和城市是否必填 var custtypes = $("input[name='CUSTTYPE']").length; diff --git a/WebContent/WEB-INF/etc/jbo/jbo_app.xml b/WebContent/WEB-INF/etc/jbo/jbo_app.xml index 895bdb1cb..2f1d5a6b5 100644 --- a/WebContent/WEB-INF/etc/jbo/jbo_app.xml +++ b/WebContent/WEB-INF/etc/jbo/jbo_app.xml @@ -4674,7 +4674,7 @@ - + @@ -4779,8 +4779,31 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src_tenwa/com/tenwa/customer/handler/company/NewCustomerCompanyHandler.java b/src_tenwa/com/tenwa/customer/handler/company/NewCustomerCompanyHandler.java index 547b51a0d..f69f93976 100644 --- a/src_tenwa/com/tenwa/customer/handler/company/NewCustomerCompanyHandler.java +++ b/src_tenwa/com/tenwa/customer/handler/company/NewCustomerCompanyHandler.java @@ -1,5 +1,6 @@ package com.tenwa.customer.handler.company; +import jbo.app.CUSTOMER_QUOTA_MONEY; import jbo.app.tenwa.customer.CUSTOMER_INFO; import jbo.app.tenwa.customer.CUSTOMER_TYPE; @@ -80,31 +81,42 @@ public class NewCustomerCompanyHandler extends CommonHandler{ protected void afterInsert(JBOTransaction tx, BizObject bo) throws Exception { //同步更新customer_info custkind字段和customer_type custstatus字段 - String customerId=this.asPage.getAttribute("customerId").toString(); - String custkind=bo.getAttribute("custkind").toString(); - BizObjectManager custManager = JBOFactory.getBizObjectManager(CUSTOMER_INFO.CLASS_NAME); - BizObject cust = custManager.createQuery("customerid=:customerid ").setParameter("customerid",customerId).getSingleResult(true); - BizObjectManager custtypeManager = JBOFactory.getBizObjectManager(CUSTOMER_TYPE.CLASS_NAME); - BizObject custtype=custtypeManager.createQuery("customerid=:customerid and custtype='cust_type.cust'") - .setParameter("customerid",customerId).getSingleResult(true); - if(!custtype.getAttribute("custstatus").getString().equals(bo.getAttribute("status").getString())){ - BizObjectQuery custtypebq = custtypeManager.createQuery("update O set custstatus=:custstatus,updateuserid=:updateuserid,updatetime=:updatetime,updateorgid=:updateorgid where customerid= :customerid and custtype='cust_type.cust'"); - custtypebq.setParameter("custstatus",bo.getAttribute("status").getString()); - custtypebq.setParameter("customerid",customerId); - custtypebq.setParameter("updateuserid", curUser.getUserID()); - custtypebq.setParameter("updatetime",DateAssistant.getTodayNow()); - custtypebq.setParameter("updateorgid",curUser.getOrgID()); - custtypebq.executeUpdate(); - } - if(!cust.getAttribute("custkind").getString().equals(bo.getAttribute("custkind").getString())){ - BizObjectQuery custbq = custManager.createQuery("update O set custkind=:custkind,updateuserid=:updateuserid,updatetime=:updatetime,updateorgid=:updateorgid where customerid= :customerid "); - custbq.setParameter("customerid",customerId); - custbq.setParameter("updateuserid", curUser.getUserID()); - custbq.setParameter("updatetime",DateAssistant.getTodayNow()); - custbq.setParameter("updateorgid",curUser.getOrgID()); - custbq.setParameter("custkind",custkind); - custbq.executeUpdate(); - } + String customerId=this.asPage.getAttribute("customerId").toString(); + String custkind=bo.getAttribute("custkind").toString(); + BizObjectManager custManager = JBOFactory.getBizObjectManager(CUSTOMER_INFO.CLASS_NAME); + BizObject cust = custManager.createQuery("customerid=:customerid ").setParameter("customerid",customerId).getSingleResult(true); + BizObjectManager custtypeManager = JBOFactory.getBizObjectManager(CUSTOMER_TYPE.CLASS_NAME); + BizObject custtype=custtypeManager.createQuery("customerid=:customerid and custtype='cust_type.cust'") + .setParameter("customerid",customerId).getSingleResult(true); + if(!custtype.getAttribute("custstatus").getString().equals(bo.getAttribute("status").getString())){ + BizObjectQuery custtypebq = custtypeManager.createQuery("update O set custstatus=:custstatus,updateuserid=:updateuserid,updatetime=:updatetime,updateorgid=:updateorgid where customerid= :customerid and custtype='cust_type.cust'"); + custtypebq.setParameter("custstatus",bo.getAttribute("status").getString()); + custtypebq.setParameter("customerid",customerId); + custtypebq.setParameter("updateuserid", curUser.getUserID()); + custtypebq.setParameter("updatetime",DateAssistant.getTodayNow()); + custtypebq.setParameter("updateorgid",curUser.getOrgID()); + custtypebq.executeUpdate(); + } + if(!cust.getAttribute("custkind").getString().equals(bo.getAttribute("custkind").getString())){ + BizObjectQuery custbq = custManager.createQuery("update O set custkind=:custkind,updateuserid=:updateuserid,updatetime=:updatetime,updateorgid=:updateorgid where customerid= :customerid "); + custbq.setParameter("customerid",customerId); + custbq.setParameter("updateuserid", curUser.getUserID()); + custbq.setParameter("updatetime",DateAssistant.getTodayNow()); + custbq.setParameter("updateorgid",curUser.getOrgID()); + custbq.setParameter("custkind",custkind); + custbq.executeUpdate(); + } + //更新客户额度信息 + BizObjectManager cqmManager = JBOFactory.getBizObjectManager(CUSTOMER_QUOTA_MONEY.CLASS_NAME,tx); + BizObject cqm = cqmManager.createQuery("customerid=:customerid ").setParameter("customerid",customerId).getSingleResult(true); + if( null == cqm){ + BizObject cqmn = cqmManager.newObject(); + cqmn.setAttributeValue("customerid",customerId); + cqmn.setAttributeValue("INPUTUSERID", curUser.getUserID()); + cqmn.setAttributeValue("INPUTTIME",DateAssistant.getTodayNow()); + cqmn.setAttributeValue("INPUTORGID",curUser.getOrgID()); + cqmManager.saveObject(cqmn); + } } @Override protected void afterUpdate(JBOTransaction tx, BizObject bo) @@ -155,5 +167,28 @@ public class NewCustomerCompanyHandler extends CommonHandler{ custbq.setParameter("updateorgid",curUser.getOrgID()); custbq.executeUpdate(); } + //更新客户额度信息 + BizObjectManager cqmManager = JBOFactory.getBizObjectManager(CUSTOMER_QUOTA_MONEY.CLASS_NAME,tx); + BizObject cqm = cqmManager.createQuery("customerid=:customerid ").setParameter("customerid",customerId).getSingleResult(true); + if( null != cqm){ + cqm.setAttributeValue("starttime",bo.getAttribute("starttime")); + cqm.setAttributeValue("endtime",bo.getAttribute("endtime")); + cqm.setAttributeValue("quotamoney",bo.getAttribute("quotamoney")); + cqm.setAttributeValue("updateuserid", curUser.getUserID()); + cqm.setAttributeValue("updatetime",DateAssistant.getTodayNow()); + cqm.setAttributeValue("updateorgid",curUser.getOrgID()); + cqmManager.saveObject(cqm); + }else{ + BizObject cqmn = cqmManager.newObject(); + cqmn.setAttributeValue("starttime",bo.getAttribute("starttime")); + cqmn.setAttributeValue("endtime",bo.getAttribute("endtime")); + cqmn.setAttributeValue("quotamoney",bo.getAttribute("quotamoney")); + + cqmn.setAttributeValue("customerid",customerId); + cqmn.setAttributeValue("INPUTUSERID", curUser.getUserID()); + cqmn.setAttributeValue("INPUTTIME",DateAssistant.getTodayNow()); + cqmn.setAttributeValue("INPUTORGID",curUser.getOrgID()); + cqmManager.saveObject(cqmn); + } } } \ No newline at end of file