72 lines
2.0 KiB
Java
72 lines
2.0 KiB
Java
package com.tenwa.apzl.commission;
|
|
|
|
import java.sql.ResultSet;
|
|
import java.sql.ResultSetMetaData;
|
|
import java.sql.SQLException;
|
|
|
|
import jbo.app.LB_PRODUCT_SALVAGE;
|
|
|
|
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.awe.util.ASResultSet;
|
|
import com.amarsoft.awe.util.SqlObject;
|
|
import com.amarsoft.awe.util.Transaction;
|
|
|
|
public class commissionSet {
|
|
|
|
public String effectStart;
|
|
public String leasForm;
|
|
|
|
public String getEffectStart() {
|
|
return effectStart;
|
|
}
|
|
|
|
public void setEffectStart(String effectStart) {
|
|
this.effectStart = effectStart;
|
|
}
|
|
|
|
public String getLeasForm() {
|
|
return leasForm;
|
|
}
|
|
|
|
public void setLeasForm(String leasForm) {
|
|
this.leasForm = leasForm;
|
|
}
|
|
|
|
public String commissionSet() throws Exception{
|
|
JBOTransaction tx=null;
|
|
Transaction Sqlca=null;
|
|
tx= JBOFactory.createJBOTransaction();
|
|
Sqlca=Transaction.createTransaction(tx);
|
|
|
|
/*BizObjectManager lpsManager = JBOFactory.getBizObjectManager(LB_PRODUCT_SALVAGE.CLASS_NAME);
|
|
BizObject lpsObject = lpsManager.createQuery("id=:id").setParameter("id", this.getId()).getSingleResult(false);
|
|
String leasForm = lpsObject.getAttribute("product_id").toString();*/
|
|
int end = 0;
|
|
String sql="SELECT MAX(effect_end) AS effect_end FROM LB_PRODUCT_SALVAGE where product_id=:product_id";
|
|
SqlObject asql = new SqlObject(sql).setParameter("product_id", leasForm);
|
|
try {
|
|
ASResultSet rs = Sqlca.getResultSet(asql);
|
|
if(rs.next()){
|
|
String effectEnd = rs.getString(1);
|
|
effectEnd = effectEnd.replaceAll("/", "");
|
|
end = Integer.parseInt(effectEnd);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
String startE = this.getEffectStart();
|
|
startE = startE.replaceAll("/", "");
|
|
int start = Integer.parseInt(startE);
|
|
|
|
if(start<=end){
|
|
return "fail";
|
|
}else{
|
|
return "success";
|
|
}
|
|
}
|
|
}
|