436 lines
18 KiB
Java
436 lines
18 KiB
Java
package com.tenwa.flow.fund.fundcollection;
|
||
|
||
import java.math.BigDecimal;
|
||
import java.sql.SQLException;
|
||
import java.util.HashMap;
|
||
import java.util.List;
|
||
import java.util.Map;
|
||
|
||
import jbo.app.tenwa.calc.LC_EBANK_PROCESS;
|
||
import jbo.app.tenwa.calc.LC_EBANK_TEMP;
|
||
import jbo.app.tenwa.calc.LC_FUND_INCOME;
|
||
import jbo.app.tenwa.calc.LC_FUND_INCOME_TEMP;
|
||
import jbo.app.tenwa.calc.LC_FUND_PLAN;
|
||
import jbo.app.tenwa.calc.VI_LC_FUND_PLAN;
|
||
import jbo.com.tenwa.entity.comm.own.OWN_ACCOUNT;
|
||
|
||
import com.amarsoft.are.jbo.BizObject;
|
||
import com.amarsoft.are.jbo.BizObjectManager;
|
||
import com.amarsoft.are.jbo.JBOException;
|
||
import com.amarsoft.are.jbo.JBOFactory;
|
||
import com.amarsoft.are.jbo.JBOTransaction;
|
||
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;
|
||
|
||
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;
|
||
|
||
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 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("ID").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", boEb.getAttribute("FACT_DATE").getString());
|
||
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{
|
||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>
|
||
BizObject boOA = JBOFactory.getBizObjectManager(OWN_ACCOUNT.CLASS_NAME,tx)
|
||
.createQuery("account_purpose='default' and state_='0010'").getSingleResult(false);
|
||
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){
|
||
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", boOA.getAttribute("ACC_BANK").getString());
|
||
otherProperty.put("ACCOUNT", boOA.getAttribute("ACC_NAME").getString());
|
||
otherProperty.put("ACC_NUMBER", boOA.getAttribute("ACC_NUMBER").getString());
|
||
otherProperty.put("INCOME_ID", bo.getAttribute("ID").getString());
|
||
otherProperty.put(LC_FUND_INCOME.EBANK_STATUS, "03");
|
||
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()+"";
|
||
}
|
||
}
|