199 lines
6.6 KiB
Java
199 lines
6.6 KiB
Java
package com.tenwa.apzl.saveunioncar;
|
|
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
|
|
import jbo.app.tenwa.customer.LM_DISTRIBUTOR_TO_CAR;
|
|
import jbo.app.tenwa.customer.LM_DISTRIBUTOR_TO_PRODUCT;
|
|
import jbo.app.tenwa.customer.LM_PORTAL_TO_CAR;
|
|
import jbo.com.tenwa.limit.LA_LIMIT_ELEMENT;
|
|
|
|
import com.amarsoft.are.jbo.BizObject;
|
|
import com.amarsoft.are.jbo.BizObjectManager;
|
|
import com.amarsoft.are.jbo.JBOFactory;
|
|
import com.amarsoft.are.jbo.JBOTransaction;
|
|
|
|
public class saveUnionCarUtil {
|
|
private String CarBrandId;
|
|
private String unionId;
|
|
public String getUnionId() {
|
|
return unionId;
|
|
}
|
|
|
|
public void setUnionId(String unionId) {
|
|
this.unionId = unionId;
|
|
}
|
|
|
|
public String getCarBrandId() {
|
|
return CarBrandId;
|
|
}
|
|
|
|
public void setCarBrandId(String carBrandId) {
|
|
CarBrandId = carBrandId;
|
|
}
|
|
/**
|
|
* 将选择对话框穿过来的id截取并存储到渠道车型关联表中
|
|
* @param tx
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String saveLmPortalToCar(JBOTransaction tx)throws Exception {
|
|
String[] params = CarBrandId.split("@~");
|
|
String updateUserID = params[0];
|
|
String updateOrgId = params[1];
|
|
String updateTime = params[2];
|
|
String ordId = params[3];
|
|
int i;
|
|
int lle=0;
|
|
try{
|
|
for(i=4;i<params.length;i++){
|
|
String PortalToCarId=UUID.randomUUID().toString().replaceAll("-", "");
|
|
String brandid = params[i];
|
|
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_PORTAL_TO_CAR.CLASS_NAME,tx);
|
|
BizObject NewLmpc = Lmpc.newObject();
|
|
NewLmpc.setAttributeValue("id", PortalToCarId);
|
|
NewLmpc.setAttributeValue("carbrandseries_id", brandid);
|
|
NewLmpc.setAttributeValue("orgid", ordId);
|
|
NewLmpc.setAttributeValue("inputUserID", updateUserID);
|
|
NewLmpc.setAttributeValue("inputOrgId", updateOrgId);
|
|
NewLmpc.setAttributeValue("inputTime", updateTime);
|
|
NewLmpc.setAttributeValue("updateUserID", updateUserID);
|
|
NewLmpc.setAttributeValue("updateOrgId", updateOrgId);
|
|
NewLmpc.setAttributeValue("updateTime", updateTime);
|
|
Lmpc.saveObject(NewLmpc);
|
|
}
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
tx.rollback();
|
|
}
|
|
if(lle>=0){
|
|
return "success";
|
|
}
|
|
return "error";
|
|
}
|
|
/**
|
|
* 将选择对话框穿过来的id截取并存储到经销商车型关联表中
|
|
* @param tx
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String saveLmDistributorToCar(JBOTransaction tx)throws Exception {
|
|
/*
|
|
CarBrandId=admin@~
|
|
8009002@~
|
|
2018/06/12 15:03:50@~
|
|
7c7624a558594bff8387ca6949982b21@~
|
|
00303ba448074b0792bd465dd2359b7c@
|
|
*/
|
|
String[] params = CarBrandId.split("@~");
|
|
String updateUserID = params[0];
|
|
String updateOrgId = params[1];
|
|
String updateTime = params[2];
|
|
String distributorId = params[3];
|
|
int i;
|
|
int lle=0;
|
|
try{
|
|
for(i=4;i<params.length;i++){
|
|
String PortalToCarId=UUID.randomUUID().toString().replaceAll("-", "");
|
|
String brandid = params[i];
|
|
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_DISTRIBUTOR_TO_CAR.CLASS_NAME,tx);
|
|
BizObject NewLmpc = Lmpc.newObject();
|
|
NewLmpc.setAttributeValue("id", PortalToCarId);
|
|
NewLmpc.setAttributeValue("carbrandseries_id", brandid);
|
|
NewLmpc.setAttributeValue("distributor_id", distributorId);
|
|
NewLmpc.setAttributeValue("inputUserID", updateUserID);
|
|
NewLmpc.setAttributeValue("inputOrgId", updateOrgId);
|
|
NewLmpc.setAttributeValue("inputTime", updateTime);
|
|
NewLmpc.setAttributeValue("updateUserID", updateUserID);
|
|
NewLmpc.setAttributeValue("updateOrgId", updateOrgId);
|
|
NewLmpc.setAttributeValue("updateTime", updateTime);
|
|
Lmpc.saveObject(NewLmpc);
|
|
}
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
tx.rollback();
|
|
}
|
|
if(lle>=0){
|
|
return "success";
|
|
}
|
|
return "error";
|
|
}
|
|
|
|
|
|
public String saveLmDistributorToProduct(JBOTransaction tx)throws Exception {
|
|
/*
|
|
CarBrandId=admin@~
|
|
8009002@~
|
|
2018/06/12 15:03:50@~
|
|
7c7624a558594bff8387ca6949982b21@~
|
|
00303ba448074b0792bd465dd2359b7c@
|
|
*/
|
|
String[] params = CarBrandId.split("@~");
|
|
String updateUserID = params[0];
|
|
String updateOrgId = params[1];
|
|
String updateTime = params[2];
|
|
String distributorId = params[3];
|
|
String productid=params[4];
|
|
int lle=0;
|
|
BizObjectManager Lmcheck = JBOFactory.getBizObjectManager(LM_DISTRIBUTOR_TO_PRODUCT.CLASS_NAME,tx);
|
|
BizObject obcheck=Lmcheck.createQuery("DISTRIBUTOR_ID=:DISTRIBUTOR_ID and PRODUCT_ID=:PRODUCT_ID")
|
|
.setParameter("DISTRIBUTOR_ID", distributorId).setParameter("PRODUCT_ID",productid).getSingleResult(false);
|
|
if(obcheck!=null){
|
|
return "error";
|
|
}
|
|
int i;
|
|
try{
|
|
for(i=4;i<params.length;i++){
|
|
String PortalToCarId=UUID.randomUUID().toString().replaceAll("-", "");
|
|
String brandid = params[i];
|
|
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_DISTRIBUTOR_TO_PRODUCT.CLASS_NAME,tx);
|
|
BizObject NewLmpc = Lmpc.newObject();
|
|
NewLmpc.setAttributeValue("id", PortalToCarId);
|
|
NewLmpc.setAttributeValue("product_id", brandid);
|
|
NewLmpc.setAttributeValue("distributor_id", distributorId);
|
|
NewLmpc.setAttributeValue("inputUserID", updateUserID);
|
|
NewLmpc.setAttributeValue("inputOrgId", updateOrgId);
|
|
NewLmpc.setAttributeValue("inputTime", updateTime);
|
|
NewLmpc.setAttributeValue("updateUserID", updateUserID);
|
|
NewLmpc.setAttributeValue("updateOrgId", updateOrgId);
|
|
NewLmpc.setAttributeValue("updateTime", updateTime);
|
|
Lmpc.saveObject(NewLmpc);
|
|
}
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
tx.rollback();
|
|
}
|
|
if(lle>=0){
|
|
return "success";
|
|
}
|
|
return "error";
|
|
}
|
|
/**
|
|
* 删除经销商车型关联表的关联
|
|
* @param tx
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String deleteLmDistributorToCar(JBOTransaction tx)throws Exception {
|
|
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_DISTRIBUTOR_TO_CAR.CLASS_NAME,tx);
|
|
Lmpc.createQuery("delete from o where id = :id").setParameter("id",unionId).executeUpdate();
|
|
return "success";
|
|
}
|
|
public String deleteLmDistributorToProduct(JBOTransaction tx)throws Exception {
|
|
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_DISTRIBUTOR_TO_PRODUCT.CLASS_NAME,tx);
|
|
Lmpc.createQuery("delete from o where id = :id").setParameter("id",unionId).executeUpdate();
|
|
return "success";
|
|
}
|
|
/**
|
|
* 删除渠道机构车型关联表的关联
|
|
* @param tx
|
|
* @return
|
|
* @throws Exception
|
|
*/
|
|
public String deletePortalToCar(JBOTransaction tx)throws Exception {
|
|
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_PORTAL_TO_CAR.CLASS_NAME,tx);
|
|
Lmpc.createQuery("delete from o where id = :id").setParameter("id",unionId).executeUpdate();
|
|
return "success";
|
|
}
|
|
}
|