起租后客户信息变更开发

This commit is contained in:
lichaojie 2019-08-29 10:00:20 +08:00
parent 9e51cabae2
commit 5596960649
2 changed files with 251 additions and 14 deletions

View File

@ -0,0 +1,196 @@
package com.tenwa.platform.controller;
import com.amarsoft.are.jbo.*;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import jbo.app.tenwa.customer.*;
import jbo.com.tenwa.lease.carbrand.BUSINESS_STATUS;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO_TEMP;
import jbo.com.tenwa.lease.comm.LB_PROJECT_INFO;
import jbo.com.tenwa.lease.comm.LB_UNION_LESSEE;
import jbo.sys.*;
import org.codehaus.jackson.map.ObjectMapper;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
public class CustomerInfoController {
public String serial;
public String currUserId;
public String channel;
public String sourcetype;
public String operationType;
public String applicationNo;
public String customerType;
// 自然人类型字典值
private String CUSTOMER_TYPE_PERSON = "03";
// 法人类型字典值
private String CUSTOMER_TYPE_COMPANY = "01";
// 合同起租状态字典值
private String BUSINESS_STATUS_31 = "31";
public String change(JBOTransaction tx) {
Map<String, Object> result = new HashMap<>();
try {
BizObjectManager pfProjectInfoManager = JBOFactory.getBizObjectManager(PF_PROJECT_INFO.CLASS_NAME, tx);
BizObject pfProjectInfo = pfProjectInfoManager.createQuery(" APPLICATION_NO=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
String isNetCar = pfProjectInfo.getAttribute(PF_PROJECT_INFO.IS_NETCAR).getString();
BizObjectManager lbUnionLesseeManager = JBOFactory.getBizObjectManager(LB_UNION_LESSEE.CLASS_NAME, tx);
BizObject lbUnionLessee = lbUnionLesseeManager.createQuery(" CONTRACT_NUMBER=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
String customerId = lbUnionLessee.getAttribute(LB_UNION_LESSEE.CUSTOMER_ID).getString();
if (CUSTOMER_TYPE_PERSON.equals(customerType)) {
// 自然人客户
BizObjectManager customerPersonManager = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME, tx);
BizObject customerPerson = customerPersonManager.createQuery(" CUSTOMER_ID=:customerId").setParameter("customerId", customerId).getSingleResult(false);
BizObjectManager customerAddressManager = JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS.CLASS_NAME, tx);
BizObject customerAddress = customerAddressManager.createQuery(" CUSTOMER_ID=:customerId").setParameter("customerId", customerId).getSingleResult(false);
BizObjectManager customerFamilyManager = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY.CLASS_NAME, tx);
BizObject customerFamily = customerFamilyManager.createQuery(" CUSTOMER_ID=:customerId").setParameter("customerId", customerId).getSingleResult(false);
BizObjectManager contractInfoManager = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME, tx);
BizObject contractInfo = contractInfoManager.createQuery(" CONTRACT_NUMBER=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
BizObjectManager pfCustomerPersonManager = JBOFactory.getBizObjectManager(PF_CUSTOMER_PERSON.CLASS_NAME, tx);
BizObject pfCustomerPerson = pfCustomerPersonManager.createQuery(" APPLICATION_NO=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
BizObjectManager pfCustomerAddressManager = JBOFactory.getBizObjectManager(PF_CUSTOMER_ADDRESS.CLASS_NAME, tx);
BizObject pfCustomerAddress = pfCustomerAddressManager.createQuery(" APPLICATION_NO=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
BizObjectManager pfCustomerFamilyManager = JBOFactory.getBizObjectManager(PF_CUSTOMER_FAMILY.CLASS_NAME, tx);
BizObject pfCustomerFamily = pfCustomerFamilyManager.createQuery(" APPLICATION_NO=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
BizObjectManager customerPersonTempManager = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME, tx);
BizObject customerPersonTemp = customerPersonTempManager.newObject();
BizObjectManager customerAddressTempManager = JBOFactory.getBizObjectManager(CUSTOMER_ADDRESS_TEMP.CLASS_NAME, tx);
BizObject customerAddressTemp = customerAddressTempManager.newObject();
BizObjectManager customerFamilyTempManager = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME, tx);
BizObject customerFamilyTemp = customerFamilyTempManager.newObject();
BizObjectManager contractInfoTempManager = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO_TEMP.CLASS_NAME, tx);
BizObject contractInfoTemp = contractInfoTempManager.newObject();
DataOperatorUtil.coptyJBOPropertyNoKey(pfCustomerPerson, customerPerson);
DataOperatorUtil.coptyJBOPropertyNoKey(pfCustomerAddress, customerAddress);
DataOperatorUtil.coptyJBOPropertyNoKey(pfCustomerFamily, customerFamily);
DataOperatorUtil.coptyJBOPropertyNoKey(customerPerson, customerPersonTemp);
DataOperatorUtil.coptyJBOPropertyNoKey(customerAddress, customerAddressTemp);
DataOperatorUtil.coptyJBOPropertyNoKey(customerFamily, customerFamilyTemp);
DataOperatorUtil.coptyJBOPropertyNoKey(contractInfo, contractInfoTemp);
contractInfoTemp.setAttributeValue(LB_CONTRACT_INFO_TEMP.IS_NETCAR, isNetCar);
customerPersonTempManager.saveObject(customerPersonTemp);
customerAddressTempManager.saveObject(customerAddressTemp);
customerFamilyTempManager.saveObject(customerFamilyTemp);
contractInfoTempManager.saveObject(contractInfoTemp);
} else {
// 法人客户
BizObjectManager customerPersonManager = JBOFactory.getBizObjectManager(CUSTOMER_PERSON.CLASS_NAME, tx);
BizObject customerPerson = customerPersonManager.createQuery(" CUSTOMER_ID=:customerId").setParameter("customerId", customerId).getSingleResult(false);
BizObjectManager customerFamilyManager = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY.CLASS_NAME, tx);
BizObject customerFamily = customerFamilyManager.createQuery(" CUSTOMER_ID=:customerId").setParameter("customerId", customerId).getSingleResult(false);
BizObjectManager contractInfoManager = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME, tx);
BizObject contractInfo = contractInfoManager.createQuery(" CONTRACT_NUMBER=:customerId").setParameter("customerId", customerId).getSingleResult(false);
BizObjectManager pfCustomerPersonManager = JBOFactory.getBizObjectManager(PF_CUSTOMER_PERSON.CLASS_NAME, tx);
BizObject pfCustomerPerson = pfCustomerPersonManager.createQuery(" APPLICATION_NO=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
BizObjectManager pfCustomerFamilyManager = JBOFactory.getBizObjectManager(PF_CUSTOMER_FAMILY.CLASS_NAME, tx);
BizObject pfCustomerFamily = pfCustomerFamilyManager.createQuery(" APPLICATION_NO=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
BizObjectManager customerPersonTempManager = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME, tx);
BizObject customerPersonTemp = customerPersonTempManager.newObject();
BizObjectManager customerFamilyTempManager = JBOFactory.getBizObjectManager(CUSTOMER_FAMILY_TEMP.CLASS_NAME, tx);
BizObject customerFamilyTemp = customerFamilyTempManager.newObject();
BizObjectManager contractInfoTempManager = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO_TEMP.CLASS_NAME, tx);
BizObject contractInfoTemp = contractInfoTempManager.newObject();
DataOperatorUtil.coptyJBOPropertyNoKey(pfCustomerPerson, customerPerson);
DataOperatorUtil.coptyJBOPropertyNoKey(pfCustomerFamily, customerFamily);
DataOperatorUtil.coptyJBOPropertyNoKey(customerPerson, customerPersonTemp);
DataOperatorUtil.coptyJBOPropertyNoKey(customerFamily, customerFamilyTemp);
DataOperatorUtil.coptyJBOPropertyNoKey(contractInfo, contractInfoTemp);
contractInfoTemp.setAttributeValue(LB_CONTRACT_INFO_TEMP.IS_NETCAR, isNetCar);
customerPersonTempManager.saveObject(customerPersonTemp);
customerFamilyTempManager.saveObject(customerFamilyTemp);
contractInfoTempManager.saveObject(contractInfoTemp);
}
// 发起起租后客户信息变更流程
result.put("success", true);
result.put("msg", "发起起租后客户信息变更流程成功");
} catch (JBOException e) {
result.put("success", false);
result.put("msg", "发起起租后客户信息变更出现异常");
e.printStackTrace();
} finally {
try {
return new ObjectMapper().writeValueAsString(result);
} catch (IOException e) {
e.printStackTrace();
return "{'success': false, 'msg': '发起起租后客户信息变更出现异常'}";
}
}
}
public String getSerial() {
return serial;
}
public void setSerial(String serial) {
this.serial = serial;
}
public String getCurrUserId() {
return currUserId;
}
public void setCurrUserId(String currUserId) {
this.currUserId = currUserId;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getSourcetype() {
return sourcetype;
}
public void setSourcetype(String sourcetype) {
this.sourcetype = sourcetype;
}
public String getOperationType() {
return operationType;
}
public void setOperationType(String operationType) {
this.operationType = operationType;
}
public String getApplicationNo() {
return applicationNo;
}
public void setApplicationNo(String applicationNo) {
this.applicationNo = applicationNo;
}
public String getCustomerType() {
return customerType;
}
public void setCustomerType(String customerType) {
this.customerType = customerType;
}
}

View File

@ -1,8 +1,6 @@
package com.tenwa.controller;
package com.tenwa.platform.controller;
import com.amarsoft.are.jbo.*;
import com.amarsoft.awe.util.Transaction;
import com.base.util.JsonUtil;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT;
import jbo.app.tenwa.customer.CUSTOMER_ACCOUNT_TEMP;
@ -24,18 +22,19 @@ public class CustomrAccountController {
public String operationType;
public String applicationNo;
private String BUSINESS_STATUS_31 = "31";
public String change(JBOTransaction tx) {
Map<String, Object> result = new HashMap<>();
try {
// 查询合同信息
// 查询合同信息
BizObjectManager contractInfoManager = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME, tx);
BizObject contractInfo = contractInfoManager.createQuery("CONTRACT_NUMBER=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
String contractId = contractInfo.getAttribute(LB_CONTRACT_INFO.ID).toString();
// 新的扣款卡信息
// 新的扣款卡信息
BizObjectManager pfCustomerAccountManager = JBOFactory.getBizObjectManager(PF_CUSTOMER_ACCOUNT.CLASS_NAME, tx);
BizObject pfCustomerAccount = pfCustomerAccountManager.createQuery("SERIAL=:serial").setParameter("serial", serial).getSingleResult(false);
String newAccount = pfCustomerAccount.getAttribute(PF_CUSTOMER_ACCOUNT.account).toString();
@ -43,14 +42,14 @@ public class CustomrAccountController {
String newBankName = pfCustomerAccount.getAttribute(PF_CUSTOMER_ACCOUNT.bank_name).toString();
String newMobile = pfCustomerAccount.getAttribute(PF_CUSTOMER_ACCOUNT.MOBILE).toString();
// 查询合同状态
// 查询合同状态
BizObjectManager businessStatusManager = JBOFactory.getBizObjectManager(BUSINESS_STATUS.CLASS_NAME, tx);
BizObject businessStatus = businessStatusManager.createQuery("CONTRACT_NUMBER=:applicationNo").setParameter("applicationNo", applicationNo).getSingleResult(false);
if (businessStatus != null & BUSINESS_STATUS_31.equals(businessStatus.getAttribute(BUSINESS_STATUS.business_status).toString())) {
// TODO 查询流程状态处于扣款卡变更流程中返回错误
// TODO 查询流程状态处于扣款卡变更流程中返回错误
// 发起扣款卡信息变更流程
// 发起扣款卡信息变更流程
Map<String, String> otherProperty = new HashMap<>();
otherProperty.put(CUSTOMER_ACCOUNT_TEMP.account, newAccount);
otherProperty.put(CUSTOMER_ACCOUNT_TEMP.acc_number, newAccNumber);
@ -61,12 +60,12 @@ public class CustomrAccountController {
fromCondition.put(CUSTOMER_ACCOUNT.contract_id, contractId);
DataOperatorUtil.copySingleJBO(CUSTOMER_ACCOUNT.CLASS_NAME, fromCondition, CUSTOMER_ACCOUNT_TEMP.CLASS_NAME, null, otherProperty, tx);
// TODO 发起扣款卡变更流程
// TODO 发起扣款卡变更流程
result.put("success", true);
result.put("msg", "发起扣款卡信息变更流程成功");
result.put("msg", "发起扣款卡信息变更流程成功");
} else {
// 直接变更扣款卡信息
// 直接变更扣款卡信息
BizObjectManager custmerAccountManager = JBOFactory.getBizObjectManager(CUSTOMER_ACCOUNT.CLASS_NAME, tx);
BizObject customerAccount = custmerAccountManager.createQuery("contract_id=:contractId").setParameter("contractId", contractId).getSingleResult(false);
customerAccount.setAttributeValue(CUSTOMER_ACCOUNT.account, newAccount);
@ -75,19 +74,61 @@ public class CustomrAccountController {
customerAccount.setAttributeValue(CUSTOMER_ACCOUNT.MOBILE, newMobile);
custmerAccountManager.saveObject(customerAccount);
result.put("success", true);
result.put("msg", "扣款卡信息变更成功");
result.put("msg", "扣款卡信息变更成功");
}
} catch (JBOException e) {
result.put("success", false);
result.put("msg", "扣款卡信息变更出现异常");
result.put("msg", "扣款卡信息变更出现异常");
e.printStackTrace();
} finally {
try {
return new ObjectMapper().writeValueAsString(result);
} catch (IOException e) {
e.printStackTrace();
return "{'success': false, 'msg': '扣款卡信息变更出现异常'}";
return "{'success': false, 'msg': '扣款卡信息变更出现异常'}";
}
}
}
public String getCurrUserId() {
return currUserId;
}
public void setCurrUserId(String currUserId) {
this.currUserId = currUserId;
}
public String getChannel() {
return channel;
}
public void setChannel(String channel) {
this.channel = channel;
}
public String getSourcetype() {
return sourcetype;
}
public void setSourcetype(String sourcetype) {
this.sourcetype = sourcetype;
}
public String getOperationType() {
return operationType;
}
public void setOperationType(String operationType) {
this.operationType = operationType;
}
public String getApplicationNo() {
return applicationNo;
}
public void setApplicationNo(String applicationNo) {
this.applicationNo = applicationNo;
}
}