122 lines
3.0 KiB
Java
122 lines
3.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;
|
|
/**
|
|
*
|
|
* @author liuzhao
|
|
*
|
|
*/
|
|
public class commissionSet {
|
|
|
|
public String effectStart;
|
|
public String leasForm;
|
|
public String endDate;
|
|
public String startDate;
|
|
|
|
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 getEndDate() {
|
|
return endDate;
|
|
}
|
|
|
|
public void setEndDate(String endDate) {
|
|
this.endDate = endDate;
|
|
}
|
|
|
|
public String getStartDate() {
|
|
return startDate;
|
|
}
|
|
|
|
public void setStartDate(String startDate) {
|
|
this.startDate = startDate;
|
|
}
|
|
|
|
public String commissionSet() throws Exception{
|
|
JBOTransaction tx=null;
|
|
Transaction Sqlca=null;
|
|
tx= JBOFactory.createJBOTransaction();
|
|
Sqlca=Transaction.createTransaction(tx);
|
|
|
|
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";
|
|
}
|
|
}
|
|
|
|
public String editEnd() throws Exception{
|
|
JBOTransaction tx=null;
|
|
Transaction Sqlca=null;
|
|
tx= JBOFactory.createJBOTransaction();
|
|
Sqlca=Transaction.createTransaction(tx);
|
|
|
|
int start = 0;
|
|
String sql="SELECT MIN(effect_start) AS effect_start FROM LB_PRODUCT_SALVAGE WHERE product_id=:product_id AND effect_start>:effect_start";
|
|
SqlObject asql = new SqlObject(sql).setParameter("product_id", leasForm).setParameter("effect_start", startDate);
|
|
try {
|
|
ASResultSet rs = Sqlca.getResultSet(asql);
|
|
if(rs.next()){
|
|
String effectStart = rs.getString(1);
|
|
effectStart = effectStart.replaceAll("/", "");
|
|
start = Integer.parseInt(effectStart);
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
String endDate = this.getEndDate();
|
|
endDate = endDate.replaceAll("/", "");
|
|
int end = Integer.parseInt(endDate);
|
|
|
|
if(end>=start){
|
|
return "fail";
|
|
}else{
|
|
return "success";
|
|
}
|
|
}
|
|
}
|