2018-06-03 22:26:41 +08:00

163 lines
4.2 KiB
Java

package com.tenwa.customer.controller.tell;
import jbo.app.tenwa.customer.CUSTOMER_TEL;
import com.amarsoft.are.jbo.BizObjectManager;
import com.amarsoft.are.jbo.BizObjectQuery;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.jbo.JBOTransaction;
public class CustomerTelAction {
private String customerid="";
private String customerId="";
private String id="";
private String teltype="";
public String getCustomerId() {
return customerId;
}
public void setCustomerId(String customerId) {
this.customerId = customerId;
}
public String getTeltype() {
return teltype;
}
public void setTeltype(String teltype) {
this.teltype = teltype;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCustomerid() {
return customerid;
}
public void setCustomerid(String customerid) {
this.customerid = customerid;
}
/**
*
* @param tx
* @return
* @throws Exception
*/
public String areValid(JBOTransaction tx)throws Exception {
BizObjectManager bm = JBOFactory.getBizObjectManager(CUSTOMER_TEL.CLASS_NAME);
tx.join(bm);
BizObjectQuery boq = bm.createQuery("update O set isnew = 'yes' where id=:id ");
boq.setParameter("id", id);
boq.executeUpdate();
BizObjectQuery bq2 = bm.createQuery("update O set isnew = 'no' where id<>:id ").setParameter("id", id);
bq2.executeUpdate();
return "true";
}
/**
*
* @param tx
* @return
* @throws Exception
*/
public String checkNoNew(JBOTransaction tx)throws Exception {
BizObjectManager bm = JBOFactory.getBizObjectManager(CUSTOMER_TEL.CLASS_NAME);
tx.join(bm);
BizObjectQuery bq2 = bm.createQuery("update O set isnew = 'no' where id=:id ").setParameter("id", id);
int i = bq2.executeUpdate();
String s = "";
if(i == 1){
s = "true";
}
return s;
}
/**
* ¸üÐÂÊÇ·ñĬÈϵ绰
* @param tx
* @return
* @throws Exception
*/
public void updateisadd(JBOTransaction tx)throws Exception {
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_TEL.CLASS_NAME);
tx.join(bom);
//ÏȽ«ËùÓе绰ÉèΪ·Ç×îÐÂ
BizObjectQuery boq1 = bom.createQuery("update O set isnew = 'no' where customerid=:customerid and teltype=:teltype");
boq1.setParameter("customerid", customerId).setParameter("teltype",teltype);
boq1.executeUpdate();
//½«´ËÁªÏµµç»°ÉèΪ×îÐÂ
BizObjectQuery boq2 = bom.createQuery("update O set isnew = 'yes' where id=:id ").setParameter("id", id);
boq2.executeUpdate();
}
/**
* ¸üÐÂÊÇ·ñ×îÐÂ
* @param tx
* @return
* @throws Exception
*/
public void updateisnew(JBOTransaction tx)throws Exception {
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_TEL.CLASS_NAME);
tx.join(bom);
//ÏȽ«ËùÓÐÁªÏµµç»°ÉèΪ·Ç×îÐÂ
BizObjectQuery boq1 = bom.createQuery("update O set isnew = 'no' where customerid=:customerid and teltype=:teltype");
boq1.setParameter("customerid", customerId).setParameter("teltype",teltype);
boq1.executeUpdate();
//½«´ËÁªÏµµç»°ÉèΪ×îÐÂ
BizObjectQuery boq2 = bom.createQuery("update O set isnew = 'yes' where id=:id ").setParameter("id", id);
boq2.executeUpdate();
}
/**
* È¡Ïû×îÐÂ
* @param tx
* @return
* @throws Exception
*/
public String cancelNew(JBOTransaction tx)throws Exception {
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_TEL.CLASS_NAME);
tx.join(bom);
//½«´ËÁªÏµµç»°¸üÐÂΪ·Ç×îÐÂ
BizObjectQuery boq = bom.createQuery("update O set isnew = 'no' where id=:id ").setParameter("id", id);
int i = boq.executeUpdate();
String s = "";
if(i == 1){
s = "yes";
}
return s;
}
public String setNew(JBOTransaction tx)throws Exception {
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_TEL.CLASS_NAME);
tx.join(bom);
//ÏȽ«´ËÀàÁªÏµµç»°ÆäËüÁªÏµµç»°ÉèΪ·Ç×îÐÂ
BizObjectQuery boq1 = bom.createQuery("update O set isnew = 'no' where customerid=:customerid and teltype=:teltype");
boq1.setParameter("customerid", customerId).setParameter("teltype",teltype);
boq1.executeUpdate();
//½«´ËÁªÏµµç»°ÉèΪ×îÐÂ
BizObjectQuery boq2 = bom.createQuery("update O set isnew = 'yes' where id=:id ").setParameter("id", id);
int i = boq2.executeUpdate();
String s = "";
if(i == 1){
s = "yes";
}
return s;
}
}