汽车4S客户合并修改
类名:CustomerConfirmList 修改的方法: 1、afterTableFillData
protected void afterTableFillData(KDTDataRequestEvent e)
{
logger.info("afterTableFillData ::");
super.afterTableFillData(e);
long startMili = System.currentTimeMillis();
String customerId = "";
int k = 0;
int j = 0;
Map map = new HashMap();
logger.info("afterTableFillData start row:" + e.getFirstRow() + " ; end row:" + e.getLastRow());
for (int i = e.getFirstRow(); i < e.getLastRow() + 1; ++i) {
this.tblMain.getRow(i).getCell("selected").setValue(Boolean.valueOf(false));
String id = this.tblMain.getRow(i).getCell("id").getValue().toString();
map.put(id, Integer.valueOf(i));
if (customerId.equals("")) {
customerId = id;
k = i;
}
j = i;
if (!customerId.equals(id))
{
KDTMergeManager mm = this.tblMain.getMergeManager();
mm.mergeBlock(k, 1, j - 1, 1, 4);
mm.mergeBlock(k, 2, j - 1, 2, 4);
mm.mergeBlock(k, 4, j - 1, 4, 4);
mm.mergeBlock(k, 5, j - 1, 5, 4);
mm.mergeBlock(k, 6, j - 1, 6, 4);
mm.mergeBlock(k, 7, j - 1, 7, 4);
mm.mergeBlock(k, 8, j - 1, 8, 4);
mm.mergeBlock(k, 9, j - 1, 9, 4);
mm.mergeBlock(k, 10, j - 1, 10, 4);
mm.mergeBlock(k, 11, j - 1, 11, 4);
mm.mergeBlock(k, 12, j - 1, 12, 4);
mm.mergeBlock(k, 13, j - 1, 13, 4);
mm.mergeBlock(k, 14, j - 1, 14, 4);
mm.mergeBlock(k, 15, j - 1, 15, 4);
mm.mergeBlock(k, 16, j - 1, 16, 4);
k = i;
customerId = id;
} else if ((i == e.getLastRow()) && (customerId.equals(id))) {
j = i + 1;
KDTMergeManager mm = this.tblMain.getMergeManager();
mm.mergeBlock(k, 1, j - 1, 1, 4);
mm.mergeBlock(k, 2, j - 1, 2, 4);
mm.mergeBlock(k, 4, j - 1, 4, 4);
mm.mergeBlock(k, 5, j - 1, 5, 4);
mm.mergeBlock(k, 6, j - 1, 6, 4);
mm.mergeBlock(k, 7, j - 1, 7, 4);
mm.mergeBlock(k, 8, j - 1, 8, 4);
mm.mergeBlock(k, 9, j - 1, 9, 4);
mm.mergeBlock(k, 10, j - 1, 10, 4);
mm.mergeBlock(k, 11, j - 1, 11, 4);
mm.mergeBlock(k, 12, j - 1, 12, 4);
mm.mergeBlock(k, 13, j - 1, 13, 4);
mm.mergeBlock(k, 14, j - 1, 14, 4);
mm.mergeBlock(k, 15, j - 1, 15, 4);
mm.mergeBlock(k, 16, j - 1, 16, 4);
}
CustomerInfo info = new CustomerInfo();
info.setId(BOSUuid.read(this.tblMain.getCell(i, "id").getValue().toString()));
info.setNumber(this.tblMain.getCell(i, "customerNumber").getValue().toString());
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "customerType").getValue())) {
BizEnumValueDTO cusType = (BizEnumValueDTO)this.tblMain.getCell(i, "customerType").getValue();
info.setCustType(CustomerTypeEnum.getEnum(cusType.getString()));
}
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "custClass").getValue())) {
BizEnumValueDTO custClass = (BizEnumValueDTO)this.tblMain.getCell(i, "custClass").getValue();
info.setCustClass(CustomerClassifyEnum.getEnum(custClass.getString()));
}
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "phone").getValue())) {
info.setPhone(this.tblMain.getCell(i, "phone").getValue().toString());
}
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "phone2").getValue())) {
info.setPhone2(this.tblMain.getCell(i, "phone2").getValue().toString());
}
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "phone3").getValue())) {
info.setPhone3(this.tblMain.getCell(i, "phone3").getValue().toString());
}
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "papersType").getValue())) {
BizEnumValueDTO papersType = (BizEnumValueDTO)this.tblMain.getCell(i, "papersType").getValue();
info.setPapersType(CertificateTypeEnum.getEnum(papersType.getString()));
}
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "papersNum").getValue())) {
info.setPapersNum(this.tblMain.getCell(i, "papersNum").getValue().toString());
}
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "customerName").getValue())) {
info.setName(this.tblMain.getCell(i, "customerName").getValue().toString());
}
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "orgNum").getValue())) {
info.setOrgNum(this.tblMain.getCell(i, "orgNum").getValue().toString());
}
if (UIRuleUtil.isNotNull(this.tblMain.getCell(i, "taxNum").getValue())) {
info.setTaxNum(this.tblMain.getCell(i, "taxNum").getValue().toString());
}
//注释掉之前的自动检索代码
//update cjw 2013-12-16
//begin
/*
String idString = info.getId().toString();
Map customermap = null;
try
{
if (checkRepeat(info))
this.tblMain.getRow(i).getCell("merged").setValue("是");
}
catch (BOSException e1) {
e1.printStackTrace();
}*/
//end
}
}
2、actionConfirmOwner_actionPerformed
/**
* 点击批量确认客户信息
* update cjw 2013-12-16
*/
public void actionConfirmOwner_actionPerformed(ActionEvent e)
throws Exception
{
//修改日期 2013-12-16
super.actionConfirmOwner_actionPerformed(e);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (confirmAudit()) {
EntityViewInfo evi = new EntityViewInfo();
FilterInfo filter = new FilterInfo();
filter.getFilterItems().add(new FilterItemInfo("id", this.idSet, CompareType.INCLUDE));
evi.setFilter(filter);
int k = 0;
try {
CustomerCollection customerColl = CustomerFactory.getRemoteInstance().getCustomerCollection(evi);
for (int i = 0; i < customerColl.size(); ++i) {
++k;
CustomerInfo customerInfo = customerColl.get(i);
String idString = customerInfo.getId().toString();
String numberString = customerInfo.getNumber();
Map map = CustomerFacadeFactory.getRemoteInstance().checkRepeat(customerInfo);
if(map == null){
customerInfo.setServiceVerify(true);
customerInfo.setIsLock(true);
Date now = new Date();
customerInfo.put("serviceVerifyTime", sdf.format(now));
customerInfo.put("verifyPerson", SysContext.getSysContext().getCurrentUserInfo().getName());
customerInfo.put("saleOrgUnit", SysContext.getSysContext().getCurrentSaleUnit());
CustomerFactory.getRemoteInstance().update(new ObjectUuidPK(customerInfo.getId()), customerInfo);
this.idSet.remove(customerInfo.getId().toString());
}else{
CustomerCollection coll = (CustomerCollection) map.get("CustomerCollection");
CustomerInfo info = null;
for(int j = 0 ; j< coll.size() ; j++){
CustomerInfo info1 = coll.get(j);
if(UIRuleUtil.isNotNull(info1.get("serviceVerify"))){
boolean serviceVerify = Boolean.valueOf(info1.get("serviceVerify").toString());
if(serviceVerify){
info = info1;
}
}
}
if(info != null){
UIContext uiContext = new UIContext(this);
uiContext.put("unConfirmCustomerNumber", numberString);
uiContext.put("confirmCustomerNumber", info.getNumber());
IUIWindow uiWindow = UIFactory.createUIFactory(UIFactoryName.NEWTAB).create(MergeCustomerEditUI.class.getName(), uiContext, null, OprtState.ADDNEW);
uiWindow.show();
}else{
customerInfo.setServiceVerify(true);
customerInfo.setIsLock(true);
Date now = new Date();
customerInfo.put("serviceVerifyTime", sdf.format(now));
customerInfo.put("verifyPerson", SysContext.getSysContext().getCurrentUserInfo().getName());
customerInfo.put("saleOrgUnit", SysContext.getSysContext().getCurrentSaleUnit());
CustomerFactory.getRemoteInstance().update(new ObjectUuidPK(customerInfo.getId()), customerInfo);
this.idSet.remove(customerInfo.getId().toString());
}
}
/* if (UIRuleUtil.isNotNull(this.idMap.get(idString))) {
String confirmCustomerNumber = this.idMap.get(idString).toString();
UIContext uiContext = new UIContext(this);
uiContext.put("unConfirmCustomerNumber", numberString);
uiContext.put("confirmCustomerNumber", confirmCustomerNumber);
IUIWindow uiWindow = UIFactory.createUIFactory(UIFactoryName.NEWTAB).create(MergeCustomerEditUI.class.getName(), uiContext, null, OprtState.ADDNEW);
uiWindow.show();
}*/
/* if (UIRuleUtil.isNotNull(this.idMap.get(idString))) {
String confirmCustomerNumber = this.idMap.get(idString).toString();
UIContext uiContext = new UIContext(this);
uiContext.put("unConfirmCustomerNumber", numberString);
uiContext.put("confirmCustomerNumber", confirmCustomerNumber);
IUIWindow uiWindow = UIFactory.createUIFactory(UIFactoryName.NEWTAB).create(MergeCustomerEditUI.class.getName(), uiContext, null, OprtState.ADDNEW);
uiWindow.show();
} else {
customerInfo.setServiceVerify(true);
customerInfo.setIsLock(true);
Date now = new Date();
customerInfo.put("serviceVerifyTime", sdf.format(now));
customerInfo.put("verifyPerson", SysContext.getSysContext().getCurrentUserInfo().getName());
customerInfo.put("saleOrgUnit", SysContext.getSysContext().getCurrentSaleUnit());
CustomerFactory.getRemoteInstance().update(new ObjectUuidPK(customerInfo.getId()), customerInfo);
this.idSet.remove(customerInfo.getId().toString());
if ((customerInfo.getCustClass() != null) && (customerInfo.getCustClass().getValue().equals("4")))
{
if ((customerInfo.getCustType() != null) && (customerInfo.getCustType().getValue().equals("1"))) {
if (UIRuleUtil.isNotNull(customerInfo.getPhone())) {
((Map)this.map.get("grby")).put(customerInfo.getName() + ";" + customerInfo.getPhone() + ";1;", customerInfo.getNumber());
}
if (UIRuleUtil.isNotNull(customerInfo.getPhone2())) {
((Map)this.map.get("grby")).put(customerInfo.getName() + ";" + customerInfo.getPhone2() + ";2;", customerInfo.getNumber());
}
if (UIRuleUtil.isNotNull(customerInfo.getPhone3())) {
((Map)this.map.get("grby")).put(customerInfo.getName() + ";" + customerInfo.getPhone3() + ";3;", customerInfo.getNumber());
}
if ((UIRuleUtil.isNotNull(customerInfo.getPapersType())) || (UIRuleUtil.isNotNull(customerInfo.getPapersNum()))) {
((Map)this.map.get("grby")).put(customerInfo.getPapersType().getValue() + ";" + customerInfo.getPapersNum(), customerInfo.getNumber());
}
}
else if (customerInfo.getCustType() != null) {
((Map)this.map.get("qyby")).put(customerInfo.getName() + ";" + customerInfo.getPhone() + ";1;", customerInfo.getNumber());
((Map)this.map.get("qyby")).put(customerInfo.getName() + ";" + customerInfo.getPhone2() + ";2;", customerInfo.getNumber());
((Map)this.map.get("qyby")).put(customerInfo.getName() + ";" + customerInfo.getPhone3() + ";3;", customerInfo.getNumber());
((Map)this.map.get("qyby")).put(customerInfo.getOrgNum() + ";" + customerInfo.getTaxNum(), customerInfo.getNumber());
}
}
else if (customerInfo.getCustClass() != null) {
if ((customerInfo.getCustType() != null) && (customerInfo.getCustType().getValue().equals("1"))) {
((Map)this.map.get("grfby")).put(customerInfo.getPhone() + ";1;", customerInfo.getNumber());
((Map)this.map.get("grfby")).put(customerInfo.getPhone2() + ";2;", customerInfo.getNumber());
((Map)this.map.get("grfby")).put(customerInfo.getPhone3() + ";3;", customerInfo.getNumber());
((Map)this.map.get("grfby")).put(customerInfo.getPapersType().getValue() + ";" + customerInfo.getPapersNum(), customerInfo.getNumber());
} else if (customerInfo.getCustType() != null) {
((Map)this.map.get("qyfby")).put(customerInfo.getPhone() + ";1;", customerInfo.getNumber());
((Map)this.map.get("qyfby")).put(customerInfo.getPhone2() + ";2;", customerInfo.getNumber());
((Map)this.map.get("qyfby")).put(customerInfo.getPhone3() + ";3;", customerInfo.getNumber());
((Map)this.map.get("qyfby")).put(customerInfo.getOrgNum() + ";" + customerInfo.getTaxNum(), customerInfo.getNumber());
}
}
++k;
init();
}*/
}
setMessageText("已确认成功" + k + " 条!");
} catch (BOSException e1) {
e1.printStackTrace();
}
}
refreshList();
//end
}