经销商车辆,产品车辆

This commit is contained in:
liuzhao 2018-06-13 09:01:15 +08:00
parent 9b41578c29
commit d34589b154
2 changed files with 229 additions and 0 deletions

View File

@ -0,0 +1,87 @@
package com.tenwa.apzl.saveunioncar;
import java.util.UUID;
import jbo.app.tenwa.customer.LM_DISTRIBUTOR_TO_CAR;
import jbo.com.tenwa.lease.comm.LM_PRODUCT_CAR;
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 saveProductAndCar {
private String carid;
private String unionId;
private String PCinfo;
public String getPCinfo() {
return PCinfo;
}
public void setPCinfo(String pCinfo) {
PCinfo = pCinfo;
}
public String getCarid() {
return carid;
}
public void setCarid(String carid) {
this.carid = carid;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
/*
* 将选择对话框弹出来的ID截取到储存到 关联表里去
* @param tx
* @return
* @throws Exception
* */
public String saveCarToProduct(JBOTransaction tx)throws Exception{
String [] params=PCinfo.split("@~");
String productid=params[3];
int i;
int lle=0;
try {
for (i = 3; i< params.length; i++) {
String carid=params[i];
String carToProduct=UUID.randomUUID().toString().replace("-", "");
BizObjectManager lmpc=JBOFactory.getBizObjectManager(LM_PRODUCT_CAR.CLASS_NAME,tx);
BizObject newlmpc=lmpc.newObject();
newlmpc.setAttributeValue("inputuserid",params[0]);
newlmpc.setAttributeValue("inputorgid",params[1]);
newlmpc.setAttributeValue("inputtime",params[2]);
newlmpc.setAttributeValue("id",carToProduct);
newlmpc.setAttributeValue("carid", carid);
newlmpc.setAttributeValue("productid", productid);
lmpc.saveObject(newlmpc);
}
} catch (Exception e) {
e.printStackTrace();
tx.rollback();
}
if(lle>=0){
return "success";
}return "error";
}
//deleteLmProductCar
/**
* 删除产品车型关联表的关联
* @param tx
* @return
* @throws Exception
*/
public String deleteLmProductCar(JBOTransaction tx)throws Exception {
BizObjectManager Lmpc = JBOFactory.getBizObjectManager(LM_PRODUCT_CAR.CLASS_NAME,tx);
Lmpc.createQuery("delete from o where id = :id").setParameter("id",unionId).executeUpdate();
return "success";
}
}

View File

@ -0,0 +1,142 @@
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_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";
}
/**
* 删除经销商车型关联表的关联
* @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";
}
/**
* 删除渠道机构车型关联表的关联
* @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";
}
}