2021-10-13 17:50:32 +08:00

706 lines
28 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.tenwa.flow.fund.fundcollection;
import com.amarsoft.are.jbo.*;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.util.ASResultSet;
import com.amarsoft.awe.util.SqlObject;
import com.amarsoft.awe.util.Transaction;
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
import com.tenwa.flow.bussinessapprove.BussinessStatusAndDetailAction;
import com.tenwa.util.MultiSubjectUtil;
import jbo.app.tenwa.calc.*;
import jbo.com.tenwa.entity.comm.own.OWN_ACCOUNT;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class FundIncomeMethod {
private String planIDs;
private String flowunid;
private String overMoneys;
private String balance;
private String portionCollectionID;
private String portionMoney;
private String oldFactMoney;
private String newFactMoney;
private String isChanged;
private String CONTRACT_ID;
private String contractIds;
private String userId;
private String orgId;
private String status;
private String payType;
private String contract_number;
private String channel_name;
private String product_id;
private String customer_name;
private String fact_object;
private String fact_money;
private String CLIENT_BANK;
private String CLIENT_ACCOUNT;
private String CLIENT_ACCNUMBER;
private String username;
public String getIsChanged() {
return isChanged;
}
public void setIsChanged(String isChanged) {
this.isChanged = isChanged;
}
public String getFlowunid() {
return flowunid;
}
public void setFlowunid(String flowunid) {
this.flowunid = flowunid;
}
public String getPlanIDs() {
return planIDs;
}
public void setPlanIDs(String planIDs) {
this.planIDs = planIDs;
}
public String getOverMoneys() {
return overMoneys;
}
public void setOverMoneys(String overMoneys) {
this.overMoneys = overMoneys;
}
public String getBalance() {
return balance;
}
public void setBalance(String balance) {
this.balance = balance;
}
public String getPortionCollectionID() {
return portionCollectionID;
}
public void setPortionCollectionID(String portionCollectionID) {
this.portionCollectionID = portionCollectionID;
}
public String getPortionMoney() {
return portionMoney;
}
public void setPortionMoney(String portionMoney) {
this.portionMoney = portionMoney;
}
public String getOldFactMoney() {
return oldFactMoney;
}
public void setOldFactMoney(String oldFactMoney) {
this.oldFactMoney = oldFactMoney;
}
public String getNewFactMoney() {
return newFactMoney;
}
public void setNewFactMoney(String newFactMoney) {
this.newFactMoney = newFactMoney;
}
public String getCONTRACT_ID() {
return CONTRACT_ID;
}
public void setCONTRACT_ID(String cONTRACT_ID) {
CONTRACT_ID = cONTRACT_ID;
}
public String getContractIds() {
return contractIds;
}
public void setContractIds(String contractIds) {
this.contractIds = contractIds;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getOrgId() {
return orgId;
}
public void setOrgId(String orgId) {
this.orgId = orgId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getPayType() {
return payType;
}
public void setPayType(String payType) {
this.payType = payType;
}
public String getContract_number() {
return contract_number;
}
public void setContract_number(String contract_number) {
this.contract_number = contract_number;
}
public String getChannel_name() {
return channel_name;
}
public void setChannel_name(String channel_name) {
this.channel_name = channel_name;
}
public String getProduct_id() {
return product_id;
}
public void setProduct_id(String product_id) {
this.product_id = product_id;
}
public String getCustomer_name() {
return customer_name;
}
public void setCustomer_name(String customer_name) {
this.customer_name = customer_name;
}
public String getFact_object() {
return fact_object;
}
public void setFact_object(String fact_object) {
this.fact_object = fact_object;
}
public String getFact_money() {
return fact_money;
}
public void setFact_money(String fact_money) {
this.fact_money = fact_money;
}
public String getCLIENT_BANK() {
return CLIENT_BANK;
}
public void setCLIENT_BANK(String cLIENT_BANK) {
CLIENT_BANK = cLIENT_BANK;
}
public String getCLIENT_ACCOUNT() {
return CLIENT_ACCOUNT;
}
public void setCLIENT_ACCOUNT(String cLIENT_ACCOUNT) {
CLIENT_ACCOUNT = cLIENT_ACCOUNT;
}
public String getCLIENT_ACCNUMBER() {
return CLIENT_ACCNUMBER;
}
public void setCLIENT_ACCNUMBER(String cLIENT_ACCNUMBER) {
CLIENT_ACCNUMBER = cLIENT_ACCNUMBER;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getContactId(JBOTransaction tx) throws SQLException, Exception{
SqlObject s = new SqlObject("select customertype,contract_number,customer_id,"
+ "LC_FUND_INCOME_TEMP.project_id,Product_Id from LC_FUND_INCOME_TEMP "
+ "left join LB_CONTRACT_INFO lpi on lpi.ID=LC_FUND_INCOME_TEMP.CONTRACT_ID "
+ "left join LB_UNION_LESSEE ul on LC_FUND_INCOME_TEMP.contract_id=ul.contract_id and ul.is_main='Y' "
+ "left join CUSTOMER_INFO cu on ul.customer_id=cu.customerid where LC_FUND_INCOME_TEMP.contract_id = '" + CONTRACT_ID+"'");
Transaction sqlTran = Transaction.createTransaction(tx);
ASResultSet rs = sqlTran.getResultSet(s);
String customertype = null;
String contract_number = null;
String customer_id = null;
String project_id = null;
String Product_Id = null;
if(rs.next()){
customertype = rs.getString("customertype");
contract_number = rs.getString("contract_number");
customer_id = rs.getString("customer_id");
project_id = rs.getString("project_id");
Product_Id = rs.getString("Product_Id");
}
return customertype+"@"+contract_number+"@"+customer_id+"@"+project_id+"@"+Product_Id;
}
public String delTemp(JBOTransaction tx) throws JBOException {
try {
for(String contractId : contractIds.split("@")){
BussinessStatusAndDetailAction.CancelRun(tx, userId, contractId, "30");
}
} catch (Exception e) {
e.printStackTrace();
tx.rollback();
return "ERROR";
}
return "SUCCESS";
}
public String updateTemp(JBOTransaction tx) throws JBOException {
try {
Transaction sqlTran = Transaction.createTransaction(tx);
ASResultSet rs = sqlTran.getResultSet(new SqlObject("select count(1) contract_count,IFNULL(sum(fact_money),0) total_money from lc_fund_income_temp where flowunid='"+flowunid+"' and pay_status='apply_pass' group by flowunid"));
if(rs.next()){
BigDecimal totalMoney = new BigDecimal(rs.getString("total_money"));
int contractCount = Integer.parseInt(rs.getString("contract_count"));
SqlObject so = new SqlObject("update lb_actual_payment_info_temp set contract_count='"+contractCount+"',total_money='"+totalMoney+"',updateuserid='"+userId+"',updateorgid='"+orgId+"',updatetime='"+StringFunction.getTodayNow().replaceAll(":", "@")+"' where flowunid='"+flowunid+"'");
so.setDebugSql(so.getDebugSql().replaceAll("@", ":"));
so.setOriginalSql(so.getOriginalSql().replaceAll("@", ":"));
so.setRunSql(so.getRunSql().replaceAll("@", ":"));
sqlTran.executeSQL(so);
so = new SqlObject("update flow_bussiness_object set proj_name=CONCAT(substr(proj_name,1,instr(proj_name,'ʵ<>ʸ<EFBFBD><CAB8><EFBFBD>')-1),'ʵ<>ʸ<EFBFBD><CAB8><EFBFBD><EEA3AC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>"+totalMoney+"') where flow_unid='"+flowunid+"'");
sqlTran.executeSQL(so);
}else{
BigDecimal totalMoney = new BigDecimal("0");
int contractCount = 0;
SqlObject so = new SqlObject("update lb_actual_payment_info_temp set contract_count='"+contractCount+"',total_money='"+totalMoney+"',updateuserid='"+userId+"',updateorgid='"+orgId+"',updatetime='"+StringFunction.getTodayNow().replaceAll(":", "@")+"' where flowunid='"+flowunid+"'");
so.setDebugSql(so.getDebugSql().replaceAll("@", ":"));
so.setOriginalSql(so.getOriginalSql().replaceAll("@", ":"));
so.setRunSql(so.getRunSql().replaceAll("@", ":"));
sqlTran.executeSQL(so);
so = new SqlObject("update flow_bussiness_object set proj_name=CONCAT(substr(proj_name,1,instr(proj_name,'ʵ<>ʸ<EFBFBD><CAB8><EFBFBD>')-1),'ʵ<>ʸ<EFBFBD><CAB8><EFBFBD><EEA3AC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>"+totalMoney+"') where flow_unid='"+flowunid+"'");
sqlTran.executeSQL(so);
}
} catch (Exception e) {
e.printStackTrace();
tx.rollback();
return "ERROR";
}
return "SUCCESS";
}
public String setFundDataToFundIncome(JBOTransaction tx) throws JBOException{
try{
boolean flag = false;
if("Y".equals(isChanged)){
flag = true;
}
BigDecimal bel = new BigDecimal(balance);
BigDecimal allFactMoney = bel;
BigDecimal zero = new BigDecimal(0);
BizObjectManager bomEb = JBOFactory.getBizObjectManager(LC_EBANK_TEMP.CLASS_NAME);
tx.join(bomEb);
BizObject boEb = bomEb.createQuery("FLOWUNID=:FLOWUNID")
.setParameter("FLOWUNID", flowunid).getSingleResult(true);
if(flag){
bel = new BigDecimal(boEb.getAttribute("MAYOPE_MONEY").getString());
allFactMoney = bel;
}
String[] moneys = overMoneys.split("@");
String[] ids = planIDs.split("@");
for(int i=0;i<ids.length;i++){
if(bel.compareTo(zero) == 0){
break;
}
BizObject boVLF = JBOFactory.createBizObjectQuery(LC_FUND_PLAN.CLASS_NAME, "ID=:ID").setParameter("ID", ids[i])
.getSingleResult(false);
BizObject boVLFP = JBOFactory.createBizObjectQuery(VI_LC_FUND_PLAN.CLASS_NAME, "ID=:ID").setParameter("ID", ids[i])
.getSingleResult(false);
BizObjectManager boLFI = JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME);
tx.join(boLFI);
BizObject boLFIT = boLFI.newObject();
boLFIT.setAttributeValue("QUOT_ID", boVLF.getAttribute("QUOT_ID").getString());
boLFIT.setAttributeValue("CUST_ID", boVLF.getAttribute("CUST_ID").getString());
boLFIT.setAttributeValue("PROJECT_ID", boVLF.getAttribute("PROJECT_ID").getString());
boLFIT.setAttributeValue("PROJECT_PLAN_NUMBER", boVLF.getAttribute("PROJECT_PLAN_NUMBER").getString());
boLFIT.setAttributeValue("CONTRACT_ID", boVLF.getAttribute("CONTRACT_ID").getString());
boLFIT.setAttributeValue("CONTRACT_PLAN_NUMBER", boVLF.getAttribute("CONTRACT_PLAN_NUMBER").getString());
boLFIT.setAttributeValue("PAYMENT_NUMBER", boVLF.getAttribute("PAYMENT_NUMBER").getString());
boLFIT.setAttributeValue("PLAN_ID", ids[i]);
boLFIT.setAttributeValue("PLAN_LIST", boVLF.getAttribute("PLAN_LIST").getString());
boLFIT.setAttributeValue("PAY_TYPE", boVLF.getAttribute("PAY_TYPE").getString());
boLFIT.setAttributeValue("FEE_TYPE", boVLF.getAttribute("FEE_TYPE").getString());
boLFIT.setAttributeValue("SETTLE_METHOD", "settlemethod6");
List<BizObject> boLCFI = JBOFactory.createBizObjectQuery(LC_FUND_INCOME.CLASS_NAME, "PLAN_ID=:PLAN_ID and ROLL_BACK='0'").setParameter("PLAN_ID", ids[i])
.getResultList(false);
List<BizObject> boLCFIT = JBOFactory.createBizObjectQuery(LC_FUND_INCOME_TEMP.CLASS_NAME, "PLAN_ID=:PLAN_ID and IS_FLOWING = 0 and ROLL_BACK='0'").setParameter("PLAN_ID", ids[i])
.getResultList(false);
boLFIT.setAttributeValue("CHARGE_LIST", boLCFI.size()+boLCFIT.size()+1);
boLFIT.setAttributeValue("FACT_DATE", boEb.getAttribute("FACT_DATE").getString());
if(!flag){
if(!ids[i].equals(portionCollectionID) && bel.subtract(new BigDecimal(moneys[i])).compareTo(new BigDecimal(0)) >= 0){
bel = bel.subtract(new BigDecimal(moneys[i]));
boLFIT.setAttributeValue("FACT_MONEY", new BigDecimal(moneys[i]));
}else{
boLFIT.setAttributeValue("FACT_MONEY", new BigDecimal(portionMoney));
bel = bel.subtract(new BigDecimal(portionMoney));
}
}else{
moneys[i] = boVLFP.getAttribute("OVERMONEY").getString();
if(bel.subtract(new BigDecimal(moneys[i])).compareTo(new BigDecimal(0)) >= 0){
bel = bel.subtract(new BigDecimal(moneys[i]));
boLFIT.setAttributeValue("FACT_MONEY", new BigDecimal(moneys[i]));
}else{
boLFIT.setAttributeValue("FACT_MONEY",bel);
bel = zero;
}
}
boLFIT.setAttributeValue("FEE_ADJUST", 0);
boLFIT.setAttributeValue("FACT_OBJECT", boVLF.getAttribute("PAY_OBJ").getString());
boLFIT.setAttributeValue("EBANK_NUMBER", boEb.getAttribute("EBANK_NUMBER").getString());
boLFIT.setAttributeValue("BANK", boEb.getAttribute("OWN_BANK").getString());
boLFIT.setAttributeValue("ACCOUNT", boEb.getAttribute("OWN_ACCOUNT").getString());
boLFIT.setAttributeValue("ACC_NUMBER", boEb.getAttribute("OWNACC_NUMBER").getString());
boLFIT.setAttributeValue("CLIENT_BANK", boEb.getAttribute("CLIENT_BANK").getString());
boLFIT.setAttributeValue("CLIENT_ACCOUNT", boEb.getAttribute("CLIENT_ACCOUNT").getString());
boLFIT.setAttributeValue("CLIENT_ACCNUMBER", boEb.getAttribute("CLIENT_ACC_NUMBER").getString());
boLFIT.setAttributeValue("ACCOUNTING_DATE", StringFunction.getToday());
boLFIT.setAttributeValue("ROLL_BACK", 0);
boLFIT.setAttributeValue("COIN", boVLF.getAttribute("COIN").getString());
boLFIT.setAttributeValue("IS_FLOWING", 0);
boLFIT.setAttributeValue("FLOWUNID", flowunid);
boLFI.saveObject(boLFIT);
}
if(bel.compareTo(new BigDecimal(0)) > 0){
allFactMoney = allFactMoney.subtract(bel);//һ<><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5>ʣ<EFBFBD><CAA3><EFBFBD>ٵ<EFBFBD><D9B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˶<EFBFBD><CBB6><EFBFBD>
}
BizObjectManager bomLEP = JBOFactory.getBizObjectManager(LC_EBANK_PROCESS.CLASS_NAME);
tx.join(bomLEP);
BizObject boLEP = bomLEP.createQuery("FLOWUNID=:FLOWUNID").setParameter("FLOWUNID", flowunid).getSingleResult(true);
BigDecimal processMoney = new BigDecimal(boLEP.getAttribute("PROCESS_MONEY").getDouble());
boLEP.setAttributeValue("PROCESS_MONEY", processMoney.add(allFactMoney));
bomLEP.saveObject(boLEP);
BigDecimal hadMoney = new BigDecimal(boEb.getAttribute("HAD_MONEY").getDouble()).add(allFactMoney);
BigDecimal factMoney = new BigDecimal(boEb.getAttribute("FACT_MONEY").getDouble());
boEb.setAttributeValue("HAD_MONEY", hadMoney);
boEb.setAttributeValue("MAYOPE_MONEY", factMoney.subtract(hadMoney));
bomEb.saveObject(boEb);
}catch(Exception e){
e.printStackTrace();
return "ERROR";
}
return "SUCCESS";
}
public String updateEbankAndEbankProcess(JBOTransaction tx){
try{
BizObjectManager bomEb = JBOFactory.getBizObjectManager(LC_EBANK_TEMP.CLASS_NAME);
tx.join(bomEb);
BizObject boEb = bomEb.createQuery("FLOWUNID=:FLOWUNID")
.setParameter("FLOWUNID", flowunid).getSingleResult(true);
BigDecimal hadMoney = new BigDecimal(boEb.getAttribute("HAD_MONEY").getDouble())
.subtract(new BigDecimal(oldFactMoney)).add(new BigDecimal(newFactMoney));
BigDecimal factMoney = new BigDecimal(boEb.getAttribute("FACT_MONEY").getDouble());
boEb.setAttributeValue("HAD_MONEY", hadMoney);
boEb.setAttributeValue("MAYOPE_MONEY", factMoney.subtract(hadMoney));
BizObjectManager bomLEP = JBOFactory.getBizObjectManager(LC_EBANK_PROCESS.CLASS_NAME);
tx.join(bomLEP);
bomLEP.createQuery("update O set process_money=:allFactMoney where flowunid=:flowUnid")
.setParameter("allFactMoney", newFactMoney).setParameter("flowUnid", flowunid).executeUpdate();
bomEb.saveObject(boEb);
}catch(Exception e){
e.printStackTrace();
return "ERROR";
}
return "SUCCESS";
}
public String createActualPayment(JBOTransaction tx) throws JBOException{
try{
BizObject boOAT = JBOFactory.getBizObjectManager(OWN_ACCOUNT.CLASS_NAME,tx)
.createQuery("account_purpose='default' and state_='0010' and FbSdk='Y' and own_id='807001003' ").getSingleResult(false);
if (boOAT == null) {
throw new RuntimeException("δ<EFBFBD><EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>");
}
for(String contractId : contractIds.split("@")){
@SuppressWarnings("unchecked")
List<BizObject> bos = JBOFactory.getBizObjectManager(LC_FUND_INCOME.CLASS_NAME)
.createQuery("contract_id='"+contractId+"' and pay_type='pay_type_out' and pay_status='apply_pass'")
.getResultList(false);
BigDecimal totalMoney = new BigDecimal("0");
int contractCount = 0;
if(bos.size() > 0){
BizObject lci = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME,tx)
.createQuery(" id=:id ").setParameter("id", contractId).getSingleResult(false);
Map<String,String> fromCondition = new HashMap<String,String>();
Map<String,String> otherProperty = new HashMap<String,String>();
for(BizObject bo:bos){
fromCondition.clear();
fromCondition.put("ID", bo.getAttribute("ID").getString());
fromCondition.put(LC_FUND_INCOME.SETTLE_METHOD, "settlemethod6");
otherProperty.clear();
otherProperty.put("FlowUnid", flowunid);
otherProperty.put("IS_FLOWING", "0");
otherProperty.put("ACCOUNTING_DATE", StringFunction.getTodayNow().split(" ")[0]);
otherProperty.put("BANK", boOAT.getAttribute("ACC_BANK").getString());
otherProperty.put("ACCOUNT", boOAT.getAttribute("ACC_NAME").getString());
otherProperty.put("ACC_NUMBER", boOAT.getAttribute("ACC_NUMBER").getString());
otherProperty.put("INCOME_ID", bo.getAttribute("ID").getString());
otherProperty.put(LC_FUND_INCOME.EBANK_STATUS, "03");
if("0020".equals(payType)||"0030".equals(payType)){
otherProperty.put(LC_FUND_INCOME.EBANK_STATUS, "05");
}
if("0030".equals(payType)){
otherProperty.put(LC_FUND_INCOME.SETTLE_METHOD, "settlemethod13");
}
if("0010"!=payType){
otherProperty.put("FACT_DATE", StringFunction.getToday());
}
DataOperatorUtil.copySingleJBO(LC_FUND_INCOME.CLASS_NAME, fromCondition,LC_FUND_INCOME_TEMP.CLASS_NAME, null, otherProperty,tx);
}
}
Transaction sqlTran = Transaction.createTransaction(tx);
ASResultSet rs = sqlTran.getResultSet(new SqlObject("select count(1) contract_count,sum(fact_money) total_money from lc_fund_income_temp where flowunid='"+flowunid+"' and pay_status<>'apply_return' group by flowunid"));
if(rs.next()){
totalMoney = new BigDecimal(rs.getString("total_money"));
contractCount = Integer.parseInt(rs.getString("contract_count"));
SqlObject so = new SqlObject("update lb_actual_payment_info_temp set contract_count='"+contractCount+"',total_money='"+totalMoney+"',updateuserid='"+userId+"',updateorgid='"+orgId+"',updatetime='"+StringFunction.getTodayNow().replaceAll(":", "@")+"' where flowunid='"+flowunid+"'");
so.setDebugSql(so.getDebugSql().replaceAll("@", ":"));
so.setOriginalSql(so.getOriginalSql().replaceAll("@", ":"));
so.setRunSql(so.getRunSql().replaceAll("@", ":"));
sqlTran.executeSQL(so);
so = new SqlObject("update flow_bussiness_object set proj_name=CONCAT(substr(proj_name,1,instr(proj_name,'ʵ<>ʸ<EFBFBD><CAB8><EFBFBD>')-1),'ʵ<>ʸ<EFBFBD><CAB8><EFBFBD><EEA3AC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>"+totalMoney+"') where flow_unid='"+flowunid+"'");
sqlTran.executeSQL(so);
}
}
}catch(Exception e){
e.printStackTrace();
tx.rollback();
return "ERROR";
}
return "SUCCESS";
}
public String updateFundIncomeStatus(JBOTransaction tx) throws JBOException{//target
try{
for(String contractId : contractIds.split("@")){
JBOFactory.getBizObjectManager(LC_FUND_INCOME_TEMP.CLASS_NAME,tx).createQuery("update O set "+("cancel".equals(status)?"pay_status='apply_return'":"pay_status=null")+" where flowunid='"+flowunid+"' and contract_id='"+contractId+"'").executeUpdate();
}
Transaction sqlTran = Transaction.createTransaction(tx);
ASResultSet rs = sqlTran.getResultSet(new SqlObject("select count(1) contract_count,IFNULL(sum(fact_money),0) total_money from lc_fund_income_temp where flowunid='"+flowunid+"' and pay_status<>'apply_return' group by flowunid"));
if(rs.next()){
BigDecimal totalMoney = new BigDecimal(rs.getString("total_money"));
int contractCount = Integer.parseInt(rs.getString("contract_count"));
SqlObject so = new SqlObject("update lb_actual_payment_info_temp set contract_count='"+contractCount+"',total_money='"+totalMoney+"',updateuserid='"+userId+"',updateorgid='"+orgId+"',updatetime='"+StringFunction.getTodayNow().replaceAll(":", "@")+"' where flowunid='"+flowunid+"'");
so.setDebugSql(so.getDebugSql().replaceAll("@", ":"));
so.setOriginalSql(so.getOriginalSql().replaceAll("@", ":"));
so.setRunSql(so.getRunSql().replaceAll("@", ":"));
sqlTran.executeSQL(so);
so = new SqlObject("update flow_bussiness_object set proj_name=CONCAT(substr(proj_name,1,instr(proj_name,'ʵ<>ʸ<EFBFBD><CAB8><EFBFBD>')-1),'ʵ<>ʸ<EFBFBD><CAB8><EFBFBD><EEA3AC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>"+totalMoney+"') where flow_unid='"+flowunid+"'");
sqlTran.executeSQL(so);
}
}catch(Exception e){
e.printStackTrace();
tx.rollback();
return "ERROR";
}
return "SUCCESS";
}
public static String setCerificationMoney(String corpus,String interest,String penalty){
BigDecimal c = new BigDecimal(corpus);
BigDecimal i = new BigDecimal(interest);
BigDecimal p = new BigDecimal(penalty);
c=c.add(i).add(p);
// double CerificationMoney= Double.valueOf(corpus)+Double.valueOf(interest)+Double.valueOf(penalty);
return c.doubleValue()+"";
}
public String check(JBOTransaction tx) throws Exception{
String sql = "SELECT lfit.project_id,lpi.product_id,psl.paytype AS payType FROM "+
"lc_fund_income_temp lfit "+
"LEFT JOIN lb_project_info lpi ON lfit.project_id=lpi.id "+
"LEFT JOIN PRD_SPECIFIC_LIBRARY psl ON psl.productid=lpi.product_id "+
"WHERE lfit.flowunid=:flowunid";
Map<String,String> params=new HashMap<String,String>();
params.put("flowunid", flowunid);
List<Map<String, String>> payTypeList = DataOperatorUtil.getDataBySql(tx,sql,params);
if(payTypeList.size()<1){
return "0";
}
for(Map<String, String> payType:payTypeList){
String paytype = payType.get("payType");
if(this.payType.equals(paytype)){
return "0";
}
return "1";
}
return "1";
}
public String paymentReturn(JBOTransaction tx){
try {
Transaction sqlTran = Transaction.createTransaction(tx);
sqlTran.executeSQL(new SqlObject("delete from lc_fund_income where CONTRACT_ID='"+CONTRACT_ID+"'"));
BizObjectManager lplManage = JBOFactory.getBizObjectManager(LB_PAYMENTRETURN_LOG.CLASS_NAME,tx);
BizObject lpl = lplManage.newObject();
lpl.setAttributeValue("contract_no",contract_number);
lpl.setAttributeValue("distributor_name",channel_name);
lpl.setAttributeValue("product_name",product_id);
lpl.setAttributeValue("person_name",customer_name);
lpl.setAttributeValue("pay_object",fact_object);
lpl.setAttributeValue("pay_number",fact_money);
lpl.setAttributeValue("distributor_bank_name",CLIENT_BANK);
lpl.setAttributeValue("distributor_Account_name",CLIENT_ACCOUNT);
lpl.setAttributeValue("distributor_bank_number",CLIENT_ACCNUMBER);
lpl.setAttributeValue("loan_type",payType);
lpl.setAttributeValue("INPUTUSERNAME",username);
lpl.setAttributeValue("INPUTUSERID",userId);
lpl.setAttributeValue("INPUTORGID",orgId);
lpl.setAttributeValue("INPUTTIME",StringFunction.getTodayNow());
lplManage.saveObject(lpl);
sqlTran.commit();
return "success";
} catch (Exception e) {
e.printStackTrace();
return "ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
}
public String checkManySubject(JBOTransaction tx){
String meaage = "";
Transaction sqlTran;
try {
sqlTran = Transaction.createTransaction(tx);
contractIds= contractIds.substring(contractIds.indexOf("@")+1).replaceAll("@", "','");
String selectSql = "SELECT subjectId AS subjectuid FROM lb_contract_info WHERE id IN ('"+contractIds+"') GROUP BY subjectId";
List<Map<String, String>> results = DataOperatorUtil.getDataBySql(selectSql);
if(results.size()==0){
meaage="û<EFBFBD>в<EFBFBD>ѯ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ĺ<EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>";
}else if(results.size()==1){
String subjectuid = results.get(0).get("subjectuid");
String flowSql = "select lci.subjectId as subjectuid from LC_FUND_INCOME_TEMP lfit left join lb_contract_info lci on lci.id=lfit.contract_id where lfit.flowUnid='"+flowunid+"' group by lci.subjectId";
List<Map<String, String>> flowSubjectIds = DataOperatorUtil.getDataBySql(flowSql);
if(flowSubjectIds.size()==0){
meaage="true";
}else if(subjectuid.equals(flowSubjectIds.get(0).get("subjectuid"))){
meaage="true";
}else{
meaage="<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵı<EFBFBD><EFBFBD>θ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϸ<EFBFBD>к<EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϢĬ<CFA2>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD>˻<EFBFBD>
if ("true".equals(meaage)) {
String subjectName = "";
if (MultiSubjectUtil.SZSUBJECTID.equals(subjectuid)) {
subjectName = MultiSubjectUtil.SZSUBJECTNAME;
} else if (MultiSubjectUtil.TJSUBJECTID.equals(subjectuid)) {
subjectName = MultiSubjectUtil.TJSUBJECTNAME;
}
BizObjectManager bm_own = JBOFactory.getBizObjectManager("jbo.com.tenwa.entity.comm.own.OWN_ACCOUNT", tx);
BizObject bo_own = bm_own.createQuery("acc_name =:accName and account_purpose = 'default' and account_type = 'out_account' and state_ = '0010'")
.setParameter("accName", subjectName).getSingleResult(false);
String payMode = "cgb";
String bankName = bo_own.getAttribute("acc_bank").getString();
if (bankName.indexOf("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>") > -1) {
payMode = "cmb";
}
JBOFactory.createBizObjectQuery("jbo.app.tenwa.calc.LB_ACTUAL_PAYMENT_INFO_TEMP","update o set bank=:bank,account=:account,acc_number=:acc_number where flowunid = :flowunid ")
.setParameter("bank",bankName)
.setParameter("account",bo_own.getAttribute("acc_name").getString())
.setParameter("acc_number",bo_own.getAttribute("acc_number").getString())
.setParameter("pay_mode",payMode)
.setParameter("flowunid",flowunid)
.executeUpdate();
}
}else{
meaage="<EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
}
} catch (Exception e) {
meaage="<EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
e.printStackTrace();
}
return meaage;
}
//<2F>ſ<EFBFBD>ǰУ<C7B0>鱣֤<E9B1A3><D6A4><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>
public String checkDeposit(JBOTransaction tx){
String meaage = "";
Transaction sqlTran;
try {
sqlTran = Transaction.createTransaction(tx);
contractIds= contractIds.substring(contractIds.indexOf("@")+1).replaceAll("@", "','");
String selectSql = "SELECT lul.customer_name,lfp.plan_money,lpi.product_data,vlfp.fact_money,vlfp.overmoney"+
" FROM LC_FUND_PLAN lfp LEFT JOIN vi_lc_fund_plan vlfp ON lfp.id = vlfp.id"+
" LEFT JOIN LB_CONTRACT_INFO lci ON lfp.contract_id = lci.id"+
" LEFT JOIN LB_UNION_LESSEE lul ON lul.contract_id = lci.id AND lul.is_main = 'Y' join lb_product_info lpi on lpi.PRODUCT_ID=lci.PRODUCT_ID "+
" WHERE lci.businesstype = '1' and lfp.fee_type='feetype2' and lfp.pay_type='pay_type_in' and vlfp.overmoney>0 "+//and vlfp.overmoney>0
" and lci.id IN ('"+contractIds+"') ";
List<Map<String, String>> results = DataOperatorUtil.getDataBySql(selectSql);
if(results.size()==0){
meaage="true";
}else {
int alertCount=0;
String alertName="";
for (int i = 0; i < results.size(); i++) {
String pData = results.get(i).get("product_data");
if("".equals(pData)){
}else{
JSONArray jsonArray = JSONArray.fromObject(pData);
Iterator<JSONObject> it = jsonArray.iterator();
while(it.hasNext()){
JSONObject component=(JSONObject)it.next().get("jbo.sample.Component");
if("<EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>".equals(component.getString("NAME"))){
JSONArray parameters=component.getJSONArray("Parameter");
for (int j = 0; j <parameters.size() ; j++) {
JSONObject parameter=parameters.getJSONObject(j).getJSONObject("jbo.sample.Parameter");
if ("<EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>".equals(parameter.getString("PARAMETERNAME"))&&"no".equals(parameter.getString("VALUE"))){
alertName+=results.get(i).get("customer_name")+",";
alertCount++;
break;
}
}
break;
}
}
}
}
if(alertCount>0){
meaage="["+alertName+"]<5D><>"+alertCount+"<EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><EFBFBD><EFBFBD>֤<EFBFBD><EFBFBD>û<EFBFBD>к<EFBFBD><EFBFBD><EFBFBD>";
}
}
//meaage="true22";
} catch (Exception e) {
meaage="<EFBFBD>޷<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
e.printStackTrace();
}
return meaage;
}
}