Commit fd65819c by gechengyang

A

parent 0e1e726e
package com.brilliance.eibs.etrade;
import static org.sss.common.impl.Constants.*;
import static org.sss.common.impl.Constants.CALLER;
import static org.sss.common.impl.Constants.EQ;
import static org.sss.common.impl.Constants.LIKE;
import static org.sss.common.impl.Constants.NO_ERROR;
import static org.sss.common.impl.Constants.VIEW_CHECK;
import static org.sss.common.impl.Constants.VIEW_LABEL;
import java.util.ArrayList;
import java.util.List;
import log.Log;
import log.LogFactory;
import java.util.*;
import org.sss.common.model.*;
import org.sss.common.impl.*;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.math.BigDecimal;
import java.io.Serializable;
import org.sss.util.ContainerUtils;
import org.sss.common.impl.AbstractModule;
import org.sss.common.impl.AttributeValue;
import org.sss.common.impl.DatafieldImpl;
import org.sss.common.impl.PanelImpl;
import org.sss.common.impl.RuleUtils;
import org.sss.common.impl.StreamGrid;
import org.sss.common.impl.StreamImpl;
import org.sss.common.model.Argument;
import org.sss.common.model.Event;
import org.sss.common.model.EventType;
import org.sss.common.model.IAttributeValue;
import org.sss.common.model.IContext;
import org.sss.common.model.IDatafield;
import org.sss.common.model.IEventRule;
import org.sss.common.model.IModule;
import org.sss.common.model.IPanel;
import org.sss.common.model.IParent;
import org.sss.common.model.IRule;
import org.sss.common.model.IStream;
import org.sss.common.model.MessageType;
import org.sss.util.ContainerUtils;
@SuppressWarnings("unused")
public class Pxip
extends AbstractModule
{
static final Log log = LogFactory.getLog(Pxip.class);
final protected ProxyPxigrp _pxigrp = new ProxyPxigrp(this);
final protected ElstPxi _pxilst = new ElstPxi(this,0);
final protected IDatafield<String> _sav = new DatafieldImpl<String>(this,String.class,null);
final protected IDatafield<String> _sel = new DatafieldImpl<String>(this,String.class,null);
final protected IDatafield<String> _nam = new DatafieldImpl<String>(this,String.class,null);
final protected IDatafield<String> _sex = new DatafieldImpl<String>(this,String.class,null);
final protected IDatafield<String> _univer = new DatafieldImpl<String>(this,String.class,null);
final protected IDatafield<String> _major = new DatafieldImpl<String>(this,String.class,null);
final protected IDatafield<String> _del = new DatafieldImpl<String>(this,String.class,null);
final protected IDatafield<IStream> _upload = new DatafieldImpl<IStream>(this,IStream.class,new StreamImpl());
final protected IDatafield<StreamGrid> _tree = new DatafieldImpl<StreamGrid>(this,StreamGrid.class,new StreamGrid());
final protected IDatafield<String> _sogou = new DatafieldImpl<String>(this,String.class,null);
final protected IDatafield<String> _pinittest = new DatafieldImpl<String>(this,String.class,null);
final transient protected IPanel _edtp = new PanelImpl(this,"edtp","PD000000");
final transient protected IPanel _pxiaddmp = new PanelImpl(this,"pxiaddmp","PD000007");
final transient protected IPanel _pxiselp = new PanelImpl(this,"pxiselp","PD000013");
final transient protected IPanel _argp = new PanelImpl(this,"argp","PD000014");
final transient protected IPanel _infp = new PanelImpl(this,"infp","PD000025");
final transient protected IPanel _pxidelp = new PanelImpl(this,"pxidelp","PD000035");
final transient protected IPanel _grdemp = new PanelImpl(this,"grdemp","PD000041");
final transient protected IPanel _centerp = new PanelImpl(this,"centerp","PD000042");
final transient protected IPanel _btnp = new PanelImpl(this,"btnp","PD000049");
final transient protected IPanel _savp = new PanelImpl(this,"savp","PD000051");
public Pxip(IParent parent)
{
super(parent);
}
@Override
public final void copyValue(IModule module)
{
Pxip eibsObject=(Pxip)module;
_sav.setValue(eibsObject._sav.getValue());
_sel.setValue(eibsObject._sel.getValue());
_nam.setValue(eibsObject._nam.getValue());
_sex.setValue(eibsObject._sex.getValue());
_univer.setValue(eibsObject._univer.getValue());
_major.setValue(eibsObject._major.getValue());
_del.setValue(eibsObject._del.getValue());
_upload.setValue(eibsObject._upload.getValue());
_tree.setValue(eibsObject._tree.getValue());
_sogou.setValue(eibsObject._sogou.getValue());
_pinittest.setValue(eibsObject._pinittest.getValue());
}
@Override
public final void copyValues(IParent parent)
{
copyValue((IModule)parent);
Pxip eibsObject=(Pxip)parent;
_pxigrp.copyValues(eibsObject._pxigrp);
_pxilst.copyValues(eibsObject._pxilst);
}
@Override
public final void clear()
{
_sav.clear();
_sel.clear();
_nam.clear();
_sex.clear();
_univer.clear();
_major.clear();
_del.clear();
_upload.clear();
_tree.clear();
_sogou.clear();
_pinittest.clear();
_pxigrp.clear();
_pxilst.clear();
}
@Override
public final IModule clone()
{
Pxip module=new Pxip(null);
module.copyValues(this);
module.addChild();
return module;
}
@Override
public final void addChild()
{
put("pxigrp",_pxigrp);
put("pxilst",_pxilst);
_pxilst.addChild();
put("sav",_sav);
put("sel",_sel);
put("nam",_nam);
put("sex",_sex);
put("univer",_univer);
put("major",_major);
put("del",_del);
put("upload",_upload);
put("tree",_tree);
put("sogou",_sogou);
put("pinittest",_pinittest);
}
@Override
public final void bindEvents(IContext ctx)
{
if(isEventBinded())
return;
getSav().addEventRule(event050_sav);
getSav().addEventRule(event03000_sav);
getSel().addEventRule(event0100_sel);
getPxilst().addEventRule(event2100_pxilst);
getDel().addEventRule(event0100_del);
getUpload().addEventRule(event5100_upload);
ctx.getRoot().addDefaultRule(init100__);
ctx.getRoot().addDefaultRule(init200__);
_pxilst.bindEvents(ctx);
super.bindEvents(ctx);
}
public Pxigrp getPxigrp()
{
return _pxigrp.getHost();
}
public void setPxigrp(Pxigrp value)
{
_pxigrp.setHost(value);
}
public ElstPxi getPxilst()
{
return _pxilst;
}
public IDatafield<String> getSav()
{
return _sav;
}
public String getEibsSav()
{
return _sav.getValue();
}
public void setEibsSav(String value)
{
_sav.setValue(value);
}
public IDatafield<String> getSel()
{
return _sel;
}
public String getEibsSel()
{
return _sel.getValue();
}
public void setEibsSel(String value)
{
_sel.setValue(value);
}
public IDatafield<String> getNam()
{
return _nam;
}
public String getEibsNam()
{
return _nam.getValue();
}
public void setEibsNam(String value)
{
_nam.setValue(value);
}
public IDatafield<String> getSex()
{
return _sex;
}
public String getEibsSex()
{
return _sex.getValue();
}
public void setEibsSex(String value)
{
_sex.setValue(value);
}
public IDatafield<String> getUniver()
{
return _univer;
}
public String getEibsUniver()
{
return _univer.getValue();
}
public void setEibsUniver(String value)
{
_univer.setValue(value);
}
public IDatafield<String> getMajor()
{
return _major;
}
public String getEibsMajor()
{
return _major.getValue();
}
public void setEibsMajor(String value)
{
_major.setValue(value);
}
public IDatafield<String> getDel()
{
return _del;
}
public String getEibsDel()
{
return _del.getValue();
}
public void setEibsDel(String value)
{
_del.setValue(value);
}
public IDatafield<IStream> getUpload()
{
return _upload;
}
public IStream getEibsUpload()
{
return _upload.getValue();
}
public void setEibsUpload(IStream value)
{
_upload.setValue(value);
}
public IDatafield<StreamGrid> getTree()
{
return _tree;
}
public StreamGrid getEibsTree()
{
return _tree.getValue();
}
public void setEibsTree(StreamGrid value)
{
_tree.setValue(value);
}
public IDatafield<String> getSogou()
{
return _sogou;
}
public String getEibsSogou()
{
return _sogou.getValue();
}
public void setEibsSogou(String value)
{
_sogou.setValue(value);
}
public IDatafield<String> getPinittest()
{
return _pinittest;
}
public String getEibsPinittest()
{
return _pinittest.getValue();
}
public void setEibsPinittest(String value)
{
_pinittest.setValue(value);
}
public IPanel getEdtp()
{
return _edtp;
}
public IPanel getPxiaddmp()
{
return _pxiaddmp;
}
public IPanel getPxiselp()
{
return _pxiselp;
}
public IPanel getArgp()
{
return _argp;
}
public IPanel getInfp()
{
return _infp;
}
public IPanel getPxidelp()
{
return _pxidelp;
}
public IPanel getGrdemp()
{
return _grdemp;
}
public IPanel getCenterp()
{
return _centerp;
}
public IPanel getBtnp()
{
return _btnp;
}
public IPanel getSavp()
{
return _savp;
}
private final transient IRule init100__=new IRule()
{
public final int getOrder()
{
return 100;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx,IAttributeValue evt)
{
buildTree();
return true;
}
};
private final transient IRule init200__=new IRule()
{
public final int getOrder()
{
return 200;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx,IAttributeValue evt)
{
Pxip.this.setEibsPinittest("999");
return true;
}
};
private final transient IEventRule event050_sav=new IEventRule()
{
public final int getOrder()
{
return 50;
}
public final EventType getType()
{
return EventType.ON_CLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx,Event evt)
{
if(!ctx.getSession().checkAll(Pxip.this.getPxigrp().getRec()))
{
return false;
}
ctx.getSupport().begin();
return true;
}
};
private final transient IEventRule event03000_sav=new IEventRule()
{
public final int getOrder()
{
return 3000;
}
public final EventType getType()
{
return EventType.ON_CLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx,Event evt)
{
if(ctx.getError() == NO_ERROR)
{
ctx.getSupport().commit();
ctx.getGui().message(MessageType.INFORMATION,ctx.getGui().getI18nValue("pxip","CT000009"),ctx.getGui().getI18nValue("pxip","CT000010"));
String trnsnam = ctx.getSession().getTransName();
if("pxiadd".equals(trnsnam) || "pxidel".equals(trnsnam))
{
ctx.getGui().chain(CALLER);
}
}
else
{
ctx.getSupport().rollback();
ctx.getGui().message(MessageType.INFORMATION,ctx.getGui().getI18nValue("pxip","CT000011"),ctx.getGui().getI18nValue("pxip","CT000012"));
}
return true;
}
};
private final transient IEventRule event0100_sel=new IEventRule()
{
public final int getOrder()
{
return 100;
}
public final EventType getType()
{
return EventType.ON_CLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx,Event evt)
{
Argument arg = new Argument();
if(!ContainerUtils.isEmpty(Pxip.this.getNam()))
{
arg = arg.and("nam",LIKE,"%"+Pxip.this.getEibsNam()+"%");
}
if(!ContainerUtils.isEmpty(Pxip.this.getUniver()))
{
arg = arg.and("univer",LIKE,"%"+Pxip.this.getEibsUniver()+"%");
}
if(!ContainerUtils.isEmpty(Pxip.this.getMajor()))
{
arg = arg.and("major",LIKE,"%"+Pxip.this.getEibsMajor()+"%");
}
if(!ContainerUtils.isEmpty(Pxip.this.getSex()))
{
arg = arg.and("sex",EQ,"%"+Pxip.this.getEibsSex()+"%");
}
ctx.getSupport().find(Pxip.this.getPxilst(),arg);
ctx.getGui().setModified(Pxip.this.getPxilst());
return true;
}
};
private final transient IEventRule event2100_pxilst=new IEventRule()
{
public final int getOrder()
{
return 100;
}
public final EventType getType()
{
return EventType.ON_DBLCLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx,Event evt)
{
int idx = ctx.getGui().getSelectedRowIndex(Pxip.this.getPxilst());
if(idx < 0)
{
return true;
}
String selInr = Pxip.this.getPxilst().get(idx).getEibsInr();
ctx.getSession().storeData("pxiinr",selInr);
ctx.getGui().chain("pxiame");
return true;
}
};
private final transient IEventRule event0100_del=new IEventRule()
{
public final int getOrder()
{
return 100;
}
public final EventType getType()
{
return EventType.ON_CLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx,Event evt)
{
int idx = ctx.getGui().getSelectedRowIndex(Pxip.this.getPxilst());
if(idx < 0)
{
return true;
}
String selInr = Pxip.this.getPxilst().get(idx).getEibsInr();
ctx.getSession().storeData("pxiinr",selInr);
ctx.getGui().chain("pxidel");
return true;
}
};
private final transient IEventRule event5100_upload=new IEventRule()
{
public final int getOrder()
{
return 100;
}
public final EventType getType()
{
return EventType.ON_STREAM_UPLOAD;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx,Event evt)
{
//准备目录
String relativeFolder = "header";
String path = ContainerUtils.catPath(ctx.getGui().getRootPath(),relativeFolder);
log.info(getOrder(),"file path="+path);
if(!ContainerUtils.fileExists(path))
{
ContainerUtils.fileMkdirs(path);
}
//准备服务器端文件名
int seq = ctx.getSupport().count("headerImage");
String fileName = seq+".jpg";
String relPath = "header/"+fileName;
//处理上传文件
IStream stream = Pxip.this.getEibsUpload();
ContainerUtils.streamSave(stream,ContainerUtils.catPath(path,fileName));
Pxip.this.getPxigrp().getRec().setEibsHeadimg(relPath);
ctx.getGui().setModified(Pxip.this.getPxigrp().getRec());
return true;
}
};
@SuppressWarnings(value = "unchecked")
public final void buildTree()
{
IContext ctx=RuleUtils.ctx.get();
StreamGrid grid = Pxip.this.getEibsTree();
//设置Grid空表头,固定列表宽度
AttributeValue h01 = new AttributeValue("");
ctx.getGui().setViewType(h01,VIEW_LABEL,50);
AttributeValue h02 = new AttributeValue();
ctx.getGui().setViewType(h02,VIEW_LABEL,100);
grid.setHeaders(new AttributeValue[]{h01,h02});
//----------------------------------------------
AttributeValue row00 = new AttributeValue();
ctx.getGui().setViewType(row00,VIEW_CHECK,100);
AttributeValue row01 = new AttributeValue("研发中心");
AttributeValue row02 = new AttributeValue();
AttributeValue[] row0 = new AttributeValue[]{row00,row02,row01};
grid.add(row0);
//----------------------------------------------
List<AttributeValue[]> subrows = new ArrayList<AttributeValue[]>();
row02.setValue(subrows);
//----------------------------------------------
AttributeValue srow02 = new AttributeValue("");
ctx.getGui().setViewType(srow02,VIEW_LABEL,50);
AttributeValue srow00 = new AttributeValue();
ctx.getGui().setViewType(srow00,VIEW_CHECK,100);
AttributeValue srow01 = new AttributeValue("武汉");
subrows.add(new AttributeValue[]{srow02,srow00,srow01});
//----------------------------------------------
AttributeValue srow12 = new AttributeValue("");
ctx.getGui().setViewType(srow12,VIEW_LABEL,50);
AttributeValue srow10 = new AttributeValue();
ctx.getGui().setViewType(srow10,VIEW_CHECK,100);
AttributeValue srow11 = new AttributeValue("天津");
subrows.add(new AttributeValue[]{srow12,srow10,srow11});
}
public class Pxip extends AbstractModule {
static final Log log = LogFactory.getLog(Pxip.class);
final protected ProxyPxigrp _pxigrp = new ProxyPxigrp(this);
final protected ElstPxi _pxilst = new ElstPxi(this, 0);
final protected IDatafield<String> _sav = new DatafieldImpl<String>(this, String.class, null);
final protected IDatafield<String> _sel = new DatafieldImpl<String>(this, String.class, null);
final protected IDatafield<String> _nam = new DatafieldImpl<String>(this, String.class, null);
final protected IDatafield<String> _sex = new DatafieldImpl<String>(this, String.class, null);
final protected IDatafield<String> _univer = new DatafieldImpl<String>(this, String.class, null);
final protected IDatafield<String> _major = new DatafieldImpl<String>(this, String.class, null);
final protected IDatafield<String> _del = new DatafieldImpl<String>(this, String.class, null);
final protected IDatafield<IStream> _upload = new DatafieldImpl<IStream>(this, IStream.class, new StreamImpl());
final protected IDatafield<StreamGrid> _tree = new DatafieldImpl<StreamGrid>(this, StreamGrid.class, new StreamGrid());
final protected IDatafield<String> _sogou = new DatafieldImpl<String>(this, String.class, null);
final protected IDatafield<String> _pinittest = new DatafieldImpl<String>(this, String.class, null);
final transient protected IPanel _edtp = new PanelImpl(this, "edtp", "PD000000");
final transient protected IPanel _pxiaddmp = new PanelImpl(this, "pxiaddmp", "PD000007");
final transient protected IPanel _pxiselp = new PanelImpl(this, "pxiselp", "PD000013");
final transient protected IPanel _argp = new PanelImpl(this, "argp", "PD000014");
final transient protected IPanel _infp = new PanelImpl(this, "infp", "PD000025");
final transient protected IPanel _pxidelp = new PanelImpl(this, "pxidelp", "PD000035");
final transient protected IPanel _grdemp = new PanelImpl(this, "grdemp", "PD000041");
final transient protected IPanel _centerp = new PanelImpl(this, "centerp", "PD000042");
final transient protected IPanel _btnp = new PanelImpl(this, "btnp", "PD000049");
final transient protected IPanel _savp = new PanelImpl(this, "savp", "PD000051");
public Pxip(IParent parent) {
super(parent);
}
@Override
public final void copyValue(IModule module) {
Pxip eibsObject = (Pxip) module;
_sav.setValue(eibsObject._sav.getValue());
_sel.setValue(eibsObject._sel.getValue());
_nam.setValue(eibsObject._nam.getValue());
_sex.setValue(eibsObject._sex.getValue());
_univer.setValue(eibsObject._univer.getValue());
_major.setValue(eibsObject._major.getValue());
_del.setValue(eibsObject._del.getValue());
_upload.setValue(eibsObject._upload.getValue());
_tree.setValue(eibsObject._tree.getValue());
_sogou.setValue(eibsObject._sogou.getValue());
_pinittest.setValue(eibsObject._pinittest.getValue());
}
@Override
public final void copyValues(IParent parent) {
copyValue((IModule) parent);
Pxip eibsObject = (Pxip) parent;
_pxigrp.copyValues(eibsObject._pxigrp);
_pxilst.copyValues(eibsObject._pxilst);
}
@Override
public final void clear() {
_sav.clear();
_sel.clear();
_nam.clear();
_sex.clear();
_univer.clear();
_major.clear();
_del.clear();
_upload.clear();
_tree.clear();
_sogou.clear();
_pinittest.clear();
_pxigrp.clear();
_pxilst.clear();
}
@Override
public final IModule clone() {
Pxip module = new Pxip(null);
module.copyValues(this);
module.addChild();
return module;
}
@Override
public final void addChild() {
put("pxigrp", _pxigrp);
put("pxilst", _pxilst);
_pxilst.addChild();
put("sav", _sav);
put("sel", _sel);
put("nam", _nam);
put("sex", _sex);
put("univer", _univer);
put("major", _major);
put("del", _del);
put("upload", _upload);
put("tree", _tree);
put("sogou", _sogou);
put("pinittest", _pinittest);
}
@Override
public final void bindEvents(IContext ctx) {
if (isEventBinded())
return;
getSav().addEventRule(event050_sav);
getSav().addEventRule(event03000_sav);
getSel().addEventRule(event0100_sel);
getPxilst().addEventRule(event2100_pxilst);
getDel().addEventRule(event0100_del);
getUpload().addEventRule(event5100_upload);
ctx.getRoot().addDefaultRule(init100__);
ctx.getRoot().addDefaultRule(init200__);
_pxilst.bindEvents(ctx);
super.bindEvents(ctx);
}
public Pxigrp getPxigrp() {
return _pxigrp.getHost();
}
public void setPxigrp(Pxigrp value) {
_pxigrp.setHost(value);
}
public ElstPxi getPxilst() {
return _pxilst;
}
public IDatafield<String> getSav() {
return _sav;
}
public String getEibsSav() {
return _sav.getValue();
}
public void setEibsSav(String value) {
_sav.setValue(value);
}
public IDatafield<String> getSel() {
return _sel;
}
public String getEibsSel() {
return _sel.getValue();
}
public void setEibsSel(String value) {
_sel.setValue(value);
}
public IDatafield<String> getNam() {
return _nam;
}
public String getEibsNam() {
return _nam.getValue();
}
public void setEibsNam(String value) {
_nam.setValue(value);
}
public IDatafield<String> getSex() {
return _sex;
}
public String getEibsSex() {
return _sex.getValue();
}
public void setEibsSex(String value) {
_sex.setValue(value);
}
public IDatafield<String> getUniver() {
return _univer;
}
public String getEibsUniver() {
return _univer.getValue();
}
public void setEibsUniver(String value) {
_univer.setValue(value);
}
public IDatafield<String> getMajor() {
return _major;
}
public String getEibsMajor() {
return _major.getValue();
}
public void setEibsMajor(String value) {
_major.setValue(value);
}
public IDatafield<String> getDel() {
return _del;
}
public String getEibsDel() {
return _del.getValue();
}
public void setEibsDel(String value) {
_del.setValue(value);
}
public IDatafield<IStream> getUpload() {
return _upload;
}
public IStream getEibsUpload() {
return _upload.getValue();
}
public void setEibsUpload(IStream value) {
_upload.setValue(value);
}
public IDatafield<StreamGrid> getTree() {
return _tree;
}
public StreamGrid getEibsTree() {
return _tree.getValue();
}
public void setEibsTree(StreamGrid value) {
_tree.setValue(value);
}
public IDatafield<String> getSogou() {
return _sogou;
}
public String getEibsSogou() {
return _sogou.getValue();
}
public void setEibsSogou(String value) {
_sogou.setValue(value);
}
public IDatafield<String> getPinittest() {
return _pinittest;
}
public String getEibsPinittest() {
return _pinittest.getValue();
}
public void setEibsPinittest(String value) {
_pinittest.setValue(value);
}
public IPanel getEdtp() {
return _edtp;
}
public IPanel getPxiaddmp() {
return _pxiaddmp;
}
public IPanel getPxiselp() {
return _pxiselp;
}
public IPanel getArgp() {
return _argp;
}
public IPanel getInfp() {
return _infp;
}
public IPanel getPxidelp() {
return _pxidelp;
}
public IPanel getGrdemp() {
return _grdemp;
}
public IPanel getCenterp() {
return _centerp;
}
public IPanel getBtnp() {
return _btnp;
}
public IPanel getSavp() {
return _savp;
}
private final transient IRule init100__ = new IRule() {
public final int getOrder() {
return 100;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx, IAttributeValue evt) {
buildTree();
return true;
}
};
private final transient IRule init200__ = new IRule() {
public final int getOrder() {
return 200;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx, IAttributeValue evt) {
Pxip.this.setEibsPinittest("999");
return true;
}
};
private final transient IEventRule event050_sav = new IEventRule() {
public final int getOrder() {
return 50;
}
public final EventType getType() {
return EventType.ON_CLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx, Event evt) {
if (!ctx.getSession().checkAll(Pxip.this.getPxigrp().getRec())) {
return false;
}
ctx.getSupport().begin();
return true;
}
};
private final transient IEventRule event03000_sav = new IEventRule() {
public final int getOrder() {
return 3000;
}
public final EventType getType() {
return EventType.ON_CLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx, Event evt) {
if (ctx.getError() == NO_ERROR) {
ctx.getSupport().commit();
ctx.getGui().message(MessageType.INFORMATION, ctx.getGui().getI18nValue("pxip", "CT000009"),
ctx.getGui().getI18nValue("pxip", "CT000010"));
String trnsnam = ctx.getSession().getTransName();
if ("pxiadd".equals(trnsnam) || "pxidel".equals(trnsnam)) {
ctx.getGui().chain(CALLER);
}
} else {
ctx.getSupport().rollback();
ctx.getGui().message(MessageType.INFORMATION, ctx.getGui().getI18nValue("pxip", "CT000011"),
ctx.getGui().getI18nValue("pxip", "CT000012"));
}
return true;
}
};
private final transient IEventRule event0100_sel = new IEventRule() {
public final int getOrder() {
return 100;
}
public final EventType getType() {
return EventType.ON_CLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx, Event evt) {
Argument arg = new Argument();
if (!ContainerUtils.isEmpty(Pxip.this.getNam())) {
arg = arg.and("nam", LIKE, "%" + Pxip.this.getEibsNam() + "%");
}
if (!ContainerUtils.isEmpty(Pxip.this.getUniver())) {
arg = arg.and("univer", LIKE, "%" + Pxip.this.getEibsUniver() + "%");
}
if (!ContainerUtils.isEmpty(Pxip.this.getMajor())) {
arg = arg.and("major", LIKE, "%" + Pxip.this.getEibsMajor() + "%");
}
if (!ContainerUtils.isEmpty(Pxip.this.getSex())) {
arg = arg.and("sex", EQ, "%" + Pxip.this.getEibsSex() + "%");
}
ctx.getSupport().find(Pxip.this.getPxilst(), arg);
ctx.getGui().setModified(Pxip.this.getPxilst());
System.out.println(Pxip.this.getPxilst().size());
return true;
}
};
private final transient IEventRule event2100_pxilst = new IEventRule() {
public final int getOrder() {
return 100;
}
public final EventType getType() {
return EventType.ON_DBLCLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx, Event evt) {
int idx = ctx.getGui().getSelectedRowIndex(Pxip.this.getPxilst());
if (idx < 0) {
return true;
}
String selInr = Pxip.this.getPxilst().get(idx).getEibsInr();
ctx.getSession().storeData("pxiinr", selInr);
ctx.getGui().chain("pxiame");
return true;
}
};
private final transient IEventRule event0100_del = new IEventRule() {
public final int getOrder() {
return 100;
}
public final EventType getType() {
return EventType.ON_CLICK;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx, Event evt) {
int idx = ctx.getGui().getSelectedRowIndex(Pxip.this.getPxilst());
if (idx < 0) {
return true;
}
String selInr = Pxip.this.getPxilst().get(idx).getEibsInr();
ctx.getSession().storeData("pxiinr", selInr);
ctx.getGui().chain("pxidel");
return true;
}
};
private final transient IEventRule event5100_upload = new IEventRule() {
public final int getOrder() {
return 100;
}
public final EventType getType() {
return EventType.ON_STREAM_UPLOAD;
}
@SuppressWarnings(value = "unchecked")
public final boolean invoke(IContext ctx, Event evt) {
// 准备目录
String relativeFolder = "header";
String path = ContainerUtils.catPath(ctx.getGui().getRootPath(), relativeFolder);
log.info(getOrder(), "file path=" + path);
if (!ContainerUtils.fileExists(path)) {
ContainerUtils.fileMkdirs(path);
}
// 准备服务器端文件名
int seq = ctx.getSupport().count("headerImage");
String fileName = seq + ".jpg";
String relPath = "header/" + fileName;
// 处理上传文件
IStream stream = Pxip.this.getEibsUpload();
ContainerUtils.streamSave(stream, ContainerUtils.catPath(path, fileName));
Pxip.this.getPxigrp().getRec().setEibsHeadimg(relPath);
ctx.getGui().setModified(Pxip.this.getPxigrp().getRec());
return true;
}
};
@SuppressWarnings(value = "unchecked")
public final void buildTree() {
IContext ctx = RuleUtils.ctx.get();
StreamGrid grid = Pxip.this.getEibsTree();
// 设置Grid空表头,固定列表宽度
AttributeValue h01 = new AttributeValue("");
ctx.getGui().setViewType(h01, VIEW_LABEL, 50);
AttributeValue h02 = new AttributeValue();
ctx.getGui().setViewType(h02, VIEW_LABEL, 100);
grid.setHeaders(new AttributeValue[] { h01, h02 });
// ----------------------------------------------
AttributeValue row00 = new AttributeValue();
ctx.getGui().setViewType(row00, VIEW_CHECK, 100);
AttributeValue row01 = new AttributeValue("研发中心");
AttributeValue row02 = new AttributeValue();
AttributeValue[] row0 = new AttributeValue[] { row00, row02, row01 };
grid.add(row0);
// ----------------------------------------------
List<AttributeValue[]> subrows = new ArrayList<AttributeValue[]>();
row02.setValue(subrows);
// ----------------------------------------------
AttributeValue srow02 = new AttributeValue("");
ctx.getGui().setViewType(srow02, VIEW_LABEL, 50);
AttributeValue srow00 = new AttributeValue();
ctx.getGui().setViewType(srow00, VIEW_CHECK, 100);
AttributeValue srow01 = new AttributeValue("武汉");
subrows.add(new AttributeValue[] { srow02, srow00, srow01 });
// ----------------------------------------------
AttributeValue srow12 = new AttributeValue("");
ctx.getGui().setViewType(srow12, VIEW_LABEL, 50);
AttributeValue srow10 = new AttributeValue();
ctx.getGui().setViewType(srow10, VIEW_CHECK, 100);
AttributeValue srow11 = new AttributeValue("天津");
subrows.add(new AttributeValue[] { srow12, srow10, srow11 });
}
}
......@@ -6,7 +6,13 @@ public class ErrorCodes {
public static final String SUCCESS_INFO = "success";
public static final String NOT_LOGIN = "R0001";
// public static final String NO_SESSION = "R0002";
public static final String LOGIN_ERROR = "R0003";
public static final String LOGIN_ID_ISNULL = "L0001";
public static final String LOGIN_TOKEN_ISNULL = "L0002";
public static final String LOGIN_TOKEN_CHECKERROR = "L0003";
public static final String LOGIN_TIMEOUT = "L0004";
public static final String LOGIN_ERROR = "L0005";
public static final String NOT_FOUND_DATA = "R0004";
public static final String DATA_TYPE_ERROR = "R0005";
public static final String CHAIN_ERROR = "R0006";
......
package org.sss.presentation.noui.controller;
import java.io.ByteArrayOutputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
......@@ -105,9 +107,10 @@ public class AbstractCommonController {
redisLoginInfo.setSysmod(sysmodBytes);
RedisUtil.set(StringUtil.userUniqueId(noUiRequest), redisLoginInfo);
return ResultUtil.result(ErrorCodes.SUCCESS, NoUiPresentationUtil.retMsg(context),
handleReturnData(eventType, context, noUiRequest, alias), NoUiPresentationUtil.handleErrorReturnData(context, alias),
NoUiPresentationUtil.handleCodeTableReturnData(context, alias));
Map<String, Object> afterReturnData = handleReturnData(eventType, context, noUiRequest, alias);
return ResultUtil.result(ErrorCodes.SUCCESS, NoUiPresentationUtil.retMsg(context), afterReturnData,
NoUiPresentationUtil.handleErrorReturnData(context, alias), NoUiPresentationUtil.handleCodeTableReturnData(context, alias));
} catch (Exception e) {
log.error("OnClick command error", e);
}
......@@ -141,6 +144,7 @@ public class AbstractCommonController {
NoUiPresentation gui = (NoUiPresentation) context.getGui();
Map<String, Object> modifyMap = gui.getModifyMap();
List<String> containsKeys = new ArrayList<String>();
for (Map.Entry<String, Object> modifyEntry : modifyMap.entrySet()) {
for (Map.Entry<String, String> aliasEntry : alias.getRel().entrySet()) {
String aliasKey = aliasEntry.getKey();
......@@ -148,10 +152,18 @@ public class AbstractCommonController {
if (aliasPath.startsWith(modifyEntry.getKey())) {
Object val = modifyEntry.getValue();
data.put(aliasKey, NoUiPresentationUtil.handIBaseObject(context, val, aliasEntry.getValue()));
containsKeys.add(modifyEntry.getKey());
}
}
}
for (String key : modifyMap.keySet()) {
if (!containsKeys.contains(key)) {
data.put(key, modifyMap.get(key));
}
}
return data;
}
}
......@@ -34,35 +34,35 @@ public class TokenInterceptor implements HandlerInterceptor {
String terminalType = noUiRequest.getTerminalType(); // APP WEB
// token不存在
if (StringUtil.isEmpty(token)) {
Result rt = new Result(ErrorCodes.ERROR, "登录token不能为空", null);
Result rt = new Result(ErrorCodes.LOGIN_TOKEN_ISNULL, "登录token不能为空", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
// userId不存在
if (StringUtil.isEmpty(userId)) {
Result rt = new Result(ErrorCodes.ERROR, "用户id不能为空", null);
Result rt = new Result(ErrorCodes.LOGIN_ID_ISNULL, "用户id不能为空", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
JwtLogin login = JWT.unsign(token, JwtLogin.class);
if (login == null || (!userId.equals((login.getUserId())))) {
Result rt = new Result(ErrorCodes.ERROR, "用户token或ID验证不通过", null);
Result rt = new Result(ErrorCodes.LOGIN_TOKEN_CHECKERROR, "用户token或ID验证不通过", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
RedisLoginInfo redisLoginInfo = (RedisLoginInfo) RedisUtil.get(StringUtil.userUniqueId(noUiRequest));
if (redisLoginInfo == null) {
Result rt = new Result(ErrorCodes.ERROR, "登陆异常", null);
Result rt = new Result(ErrorCodes.LOGIN_ERROR, "登陆异常", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
// 验证登录时间
if (System.currentTimeMillis() > redisLoginInfo.getExpiredTime()) {
Result rt = new Result(ErrorCodes.ERROR, "登录时间超长,请重新登录", null);
Result rt = new Result(ErrorCodes.LOGIN_TIMEOUT, "登录时间超长,请重新登录", null);
responseMessage(response, response.getWriter(), rt);
return false;
}
......
......@@ -236,6 +236,8 @@ public class NoUiPresentationUtil {
String realKey = alias.getRevertRel().get(key);
if (!StringUtils.isEmpty(realKey))
errorMap.put(realKey, errorEntity.getValue());
else
errorMap.put(key, errorEntity.getValue());
}
return errorMap;
}
......
......@@ -8,10 +8,11 @@
<property name="hibernate.connection.autocommit">false</property>
<property name="use_outer_join">false</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="connection.url">jdbc:oracle:thin:@172.17.2.108:1521:xe</property>
<property name="connection.url">jdbc:oracle:thin:@172.17.2.4:1521:ORCL</property>
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.username">pxi</property>
<property name="connection.password">pxi</property>
<property name="connection.username">gcy</property>
<property name="connection.password">gcy</property>
<property name="connection.autocommit">false</property>
<property name="connection.autoReconnect">true</property>
<property name="connection.autoReconnectForPools">true</property>
......
......@@ -20,8 +20,8 @@ public class HttpTest {
Map<String, Object> map2 = (Map<String, Object>) map1.get("data");
String token = (String) map2.get("token");
pxiadd(token, userId, terminalType);
// pxisel(token, userId, terminalType);
// pxiadd(token, userId, terminalType);
pxisel(token, userId, terminalType);
// pxiame(token, userId, terminalType);
// check(token, userId, terminalType);
// upload(token, userId, terminalType);
......@@ -179,7 +179,7 @@ public class HttpTest {
try {
// "http://172.17.2.100:8080/oauth/token?username=user_1&password=123456&grant_type=password&client_id=client&client_secret=123456"
URL realUrl = new URL("http://localhost:8080/business/service/pxisel/_sel");
URL realUrl = new URL("http://localhost:8080/business/service/pxisel/sel");
// URL realUrl = new
// URL("http://localhost:8080/healthServer/getMacSeq");
......@@ -341,14 +341,15 @@ public class HttpTest {
out = new PrintWriter(conn.getOutputStream());
// 发送请求参数
Map<String, Object> map = new HashMap<String, Object>();
map.put("nam", "2121");
map.put("nam", "gggeeeccc");
map.put("sex", "");
map.put("univer", "2121");
map.put("major", "2121");
map.put("headimg", "");
map.put("age", "21212");
map.put("tel", "1212");
map.put("tel", "12999998899");
map.put("balance", "");
map.put("balance1", "");
Map<String, Object> map2 = new HashMap<String, Object>();
map2.put("data", map);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment