|
|
@@ -1,6 +1,7 @@
|
|
|
package com.awspaas.user.apps.donenow_crm.controller;
|
|
|
|
|
|
import com.actionsoft.bpms.bo.engine.BO;
|
|
|
+import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
|
|
|
import com.actionsoft.bpms.commons.database.RowMap;
|
|
|
import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate;
|
|
|
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
|
|
@@ -598,4 +599,50 @@ public class accountController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Mapping(value = "com.awspaas.user.apps.donenow_crm.saveOrUpdateBankAccount")
|
|
|
+ public ResponseObject saveOrUpdateBankAccount(UserContext uc, String accountId, String bank, String bankAccount) {
|
|
|
+ try {
|
|
|
+ // 1. 查询是否存在该银行账号记录
|
|
|
+ String checkSql = "SELECT id " +
|
|
|
+ "FROM BO_EU_DNCRM_ACCOUNT_BANK " +
|
|
|
+ "WHERE BANK_ACCOUNT = ?";
|
|
|
+ Map<String, Object> existingAccount = DBSql.getMap(checkSql, new Object[]{bankAccount});
|
|
|
+
|
|
|
+ Map<String, Object> result = new HashMap<>(2);
|
|
|
+ boolean isCreated = false;
|
|
|
+ String recordId = null;
|
|
|
+
|
|
|
+ if (existingAccount == null) {
|
|
|
+ ProcessInstance processInstance = SDK.getProcessAPI().createProcessInstance("obj_516bbf920a1c444eb35938fcfa1f70e2", uc.getUID(), "客户开户银行及账号");
|
|
|
+
|
|
|
+ BO bankAccountBO = new BO();
|
|
|
+ bankAccountBO.setBindId(processInstance.getId());
|
|
|
+
|
|
|
+ bankAccountBO.set("ACCOUNT_ID", accountId);
|
|
|
+ bankAccountBO.set("BANK", bank);
|
|
|
+ bankAccountBO.set("BANK_ACCOUNT", bankAccount);
|
|
|
+
|
|
|
+ SDK.getBOAPI().create("BO_EU_DNCRM_ACCOUNT_BANK", bankAccountBO,processInstance, uc);
|
|
|
+
|
|
|
+ recordId = bankAccountBO.getId();
|
|
|
+ isCreated = true;
|
|
|
+ } else {
|
|
|
+ // 3. 存在则用update语句更新记录
|
|
|
+ recordId = existingAccount.get("id").toString();
|
|
|
+ String updateSql = "UPDATE BO_EU_DNCRM_ACCOUNT_BANK " +
|
|
|
+ "SET ACCOUNT_ID = ?, BANK = ? " +
|
|
|
+ "WHERE id = ?";
|
|
|
+ DBSql.update(updateSql, new Object[]{accountId, bank, recordId});
|
|
|
+ }
|
|
|
+
|
|
|
+ result.put("isCreated", isCreated);
|
|
|
+ result.put("recordId", recordId);
|
|
|
+ ResponseObject responseObject = ResponseObject.newOkResponse();
|
|
|
+ responseObject.setData(result);
|
|
|
+ return responseObject;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ return ResponseObject.newErrResponse("银行账户操作失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|