149 lines
4.4 KiB
Java
149 lines
4.4 KiB
Java
package com.tenwa.customer.controller.group;
|
|
|
|
import jbo.app.tenwa.customer.CUSTOMER_GROUP_COMPANY;
|
|
import jbo.app.tenwa.customer.DISTRIBUTOR_GROUP_COMPANY;
|
|
import jbo.app.tenwa.customer.DISTRIBUTOR_GROUP_RELATION;
|
|
import jbo.com.tenwa.entity.comm.own.COUNTRY_DISTRICT_INFO;
|
|
|
|
import com.amarsoft.are.jbo.BizObject;
|
|
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 CustomerGroupCompanyController {
|
|
private String id = "";
|
|
private String group_name = "";
|
|
private String group_no = "";
|
|
|
|
public String getGroup_name() {
|
|
return group_name;
|
|
}
|
|
|
|
public void setGroup_name(String group_name) {
|
|
this.group_name = group_name;
|
|
}
|
|
|
|
public String getId() {
|
|
return id;
|
|
}
|
|
|
|
public void setId(String id) {
|
|
this.id = id;
|
|
}
|
|
|
|
public String getGroup_no() {
|
|
return group_no;
|
|
}
|
|
|
|
public void setGroup_no(String group_no) {
|
|
this.group_no = group_no;
|
|
}
|
|
|
|
/**
|
|
* 废弃
|
|
* @param tx
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String del(JBOTransaction tx)throws Exception{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_GROUP_COMPANY.CLASS_NAME);
|
|
tx.join(bom);
|
|
//将此集团信息设置为废弃状态
|
|
BizObjectQuery boq = bom.createQuery("update O set status = 'status03' where id=:id ");
|
|
boq.setParameter("id",id);
|
|
int i = boq.executeUpdate();
|
|
if(i == 1){
|
|
return "true";
|
|
}
|
|
return "false";
|
|
}
|
|
|
|
public String dis_del(JBOTransaction tx)throws Exception{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_COMPANY.CLASS_NAME);
|
|
tx.join(bom);
|
|
//将此集团信息设置为废弃状态
|
|
BizObjectQuery boq = bom.createQuery("update O set status = 'status03' where id=:id ");
|
|
boq.setParameter("id",id);
|
|
int i = boq.executeUpdate();
|
|
if(i == 1){
|
|
return "true";
|
|
}
|
|
return "false";
|
|
}
|
|
public String deleterelation(JBOTransaction tx)throws Exception{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_RELATION.CLASS_NAME);
|
|
tx.join(bom);
|
|
//将此集团信息设置为废弃状态
|
|
BizObjectQuery boq = bom.createQuery("delete from O where id=:id ");
|
|
boq.setParameter("id",id);
|
|
int i = boq.executeUpdate();
|
|
if(i == 1){
|
|
return "true";
|
|
}
|
|
return "false";
|
|
}
|
|
|
|
/**
|
|
* 集团名称不可重复
|
|
* @param tx
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String group_name(JBOTransaction tx)throws Exception{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(CUSTOMER_GROUP_COMPANY.CLASS_NAME);
|
|
tx.join(bom);
|
|
//查询该集团名称是否已存在
|
|
BizObject CUSTOMER_GROUP_COMPANY = bom.createQuery("group_name=:group_name").setParameter("group_name",group_name).getSingleResult(false);
|
|
if(CUSTOMER_GROUP_COMPANY != null){
|
|
return CUSTOMER_GROUP_COMPANY.getAttribute("status").toString();
|
|
}else{
|
|
return "false";
|
|
}
|
|
}
|
|
|
|
public String distributor_group_name(JBOTransaction tx)throws Exception{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_COMPANY.CLASS_NAME);
|
|
tx.join(bom);
|
|
//查询该集团名称是否已存在
|
|
BizObject CUSTOMER_GROUP_COMPANY = bom.createQuery("group_name=:group_name").setParameter("group_name",group_name).getSingleResult(false);
|
|
if(CUSTOMER_GROUP_COMPANY != null){
|
|
return CUSTOMER_GROUP_COMPANY.getAttribute("status").toString();
|
|
}else{
|
|
return "false";
|
|
}
|
|
}
|
|
|
|
public String checkCode(JBOTransaction tx)throws Exception{
|
|
BizObjectManager bom = JBOFactory.getBizObjectManager(COUNTRY_DISTRICT_INFO.CLASS_NAME);
|
|
tx.join(bom);
|
|
//查询该区域编号是否已存在
|
|
BizObject CUSTOMER_GROUP_COMPANY = bom.createQuery("district_code=:district_code").setParameter("district_code",group_name).getSingleResult(false);
|
|
if(CUSTOMER_GROUP_COMPANY != null){
|
|
return "false";
|
|
}else{
|
|
return "success";
|
|
}
|
|
}
|
|
|
|
public String distributor_group_no(JBOTransaction tx) throws Exception{
|
|
BizObjectManager dgcm = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_COMPANY.CLASS_NAME);
|
|
BizObject dgc = dgcm.createQuery("group_no=:group_no").setParameter("group_no", group_no).getSingleResult(false);
|
|
if(dgc == null){
|
|
return "true";
|
|
}else{
|
|
return "false";
|
|
}
|
|
}
|
|
|
|
public String getNewId(JBOTransaction tx) throws Exception{
|
|
String id="";
|
|
BizObjectManager dgcm = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_COMPANY.CLASS_NAME);
|
|
BizObject dgc = dgcm.createQuery("group_no=:group_no").setParameter("group_no", group_no).getSingleResult(false);
|
|
if(dgc != null){
|
|
id= dgc.getAttribute("ID").getString();
|
|
}
|
|
return id;
|
|
}
|
|
} |