提交 ac4d9c17 编写于 作者: R roo00

修改增强阶段至process-classes

上级 c640ba76
......@@ -43,7 +43,6 @@
</java>
</target>
<target name="default" depends="createConfigSample,createLocalSample,createManifestCfg">
<delete dir="target" />
<mkdir dir="target/o2server" />
......
......@@ -63,9 +63,11 @@
path:'${basedir}/src/main/resources/META-INF/x_persistence.xml'
}" />
</java>
<echo>${project} create persistence xml: ${basedir}/src/main/resources/META-INF/x_persistence.xml</echo>
</target>
<target name="describe">
<echo>describe project:${project}</echo>
<mkdir dir="${basedir}/src/main/webapp/describe" />
<delete includeemptydirs="true">
<fileset dir="${basedir}/src/main/webapp/describe" includes="**/*" />
......@@ -112,6 +114,7 @@
path:'${basedir}/src/main/resources/META-INF/persistence.xml'
}" />
</java>
<sleep seconds="1" />
</target>
</project>
\ No newline at end of file
......@@ -529,7 +529,7 @@
</execution>
<execution>
<id>enhance</id>
<!-- <phase>prepare-package</phase> -->
<!-- <phase>process-classes</phase> -->
<phase>none</phase>
<configuration>
<target>
......
......@@ -40,7 +40,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -34,7 +34,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -317,6 +317,16 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return t;
}
public <T extends JpaObject> List<T> listAll(Class<T> cls) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<T> cq = cb.createQuery(cls);
Root<T> root = cq.from(cls);
List<T> os = em.createQuery(cq.select(root)).getResultList();
List<T> list = new ArrayList<>(os);
return list;
}
public <T extends JpaObject> List<T> list(Class<T> cls, String... ids) throws Exception {
return this.list(cls, false, ListTools.toList(ids));
}
......@@ -376,6 +386,18 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return new TreeList<T>(os);
}
public <T extends JpaObject> List<T> listEqualAndNotEqual(Class<T> cls, String equalAttribute, Object equalValue,
String notEqualAttribute, Object notEqualValue) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<T> cq = cb.createQuery(cls);
Root<T> root = cq.from(cls);
cq.select(root).where(cb.and(cb.equal(root.get(equalAttribute), equalValue),
cb.notEqual(root.get(notEqualAttribute), notEqualValue)));
List<T> os = em.createQuery(cq).getResultList();
return new TreeList<T>(os);
}
public <T extends JpaObject, W extends Object> List<T> listEqualAndIn(Class<T> cls, String attribute, Object value,
String otherAttribute, Collection<W> otherValues) throws Exception {
EntityManager em = this.get(cls);
......@@ -398,14 +420,14 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return em.createQuery(cq).getSingleResult();
}
public <T extends JpaObject> Long countEqual(Class<T> cls, String attribute, Object value, String otherAttribute,
Object otherValue) throws Exception {
public <T extends JpaObject> Long countEqualAndEqual(Class<T> cls, String euqalAttribute, Object equalValue,
String notEqualAttribute, Object notEqualValue) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<T> root = cq.from(cls);
cq.select(cb.count(root))
.where(cb.and(cb.equal(root.get(attribute), value), cb.equal(root.get(otherAttribute), otherValue)));
cq.select(cb.count(root)).where(cb.and(cb.equal(root.get(euqalAttribute), equalValue),
cb.equal(root.get(notEqualAttribute), notEqualValue)));
return em.createQuery(cq).getSingleResult();
}
......@@ -454,16 +476,6 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return list;
}
public <T extends JpaObject> List<T> listAll(Class<T> cls) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<T> cq = cb.createQuery(cls);
Root<T> root = cq.from(cls);
List<T> os = em.createQuery(cq.select(root)).getResultList();
List<T> list = new ArrayList<>(os);
return list;
}
public <T extends JpaObject> List<String> ids(Class<T> cls) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
......@@ -500,6 +512,20 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return list;
}
public <T extends JpaObject> List<String> idsEqualAndNotEqual(Class<T> cls, String equalAttribute,
Object equalValue, String notEqualAttribute, Object notEqualValue) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<T> root = cq.from(cls);
Predicate p = cb.equal(root.get(equalAttribute), equalValue);
p = cb.and(p, cb.notEqual(root.get(notEqualAttribute), notEqualValue));
cq.select(root.get(JpaObject.id_FIELDNAME)).where(p);
List<String> os = em.createQuery(cq).getResultList();
List<String> list = new ArrayList<>(os);
return list;
}
public <T extends JpaObject> List<String> idsNotEqual(Class<T> cls, String attribute, Object value)
throws Exception {
EntityManager em = this.get(cls);
......@@ -536,7 +562,7 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return list;
}
public <T extends JpaObject, W extends Object> List<String> idsNotInAndEqual(Class<T> cls, String attribute,
public <T extends JpaObject, W extends Object> List<String> idsEqualAndNotIn(Class<T> cls, String attribute,
Collection<W> values, String otherAttribute, Object otherValue) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
......
......@@ -9,7 +9,6 @@ import java.util.Objects;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
......@@ -46,7 +45,8 @@ public class DataItemConverter<T extends DataItem> {
if (t.getItemType() == ItemType.o) {
T next = list.get(i + 1);
/** 是一个数字的值,说明是数组中的一个 */
if (NumberUtils.isNumber(next.paths().get(next.paths().size() - 1))) {
if (StringUtils.isNumeric(next.paths().get(next.paths().size() - 1))) {
// if (NumberUtils.isNumber(next.paths().get(next.paths().size() - 1))) {
/** 说明上一个T应该是一个Array */
t.setItemType(ItemType.a);
}
......@@ -149,13 +149,15 @@ public class DataItemConverter<T extends DataItem> {
JsonElement o = root;
for (int i = 0; i < paths.size() - 1; i++) {
String path = paths.get(i);
if (!NumberUtils.isNumber(path)) {
if (!StringUtils.isNumeric(path)) {
// if (!NumberUtils.isNumber(path)) {
o = o.getAsJsonObject().get(path);
} else {
o = o.getAsJsonArray().get(Integer.parseInt(path));
}
}
if (!NumberUtils.isNumber(name)) {
if (!StringUtils.isNumeric(name)) {
// if (!NumberUtils.isNumber(name)) {
o.getAsJsonObject().add(name, jsonElement);
} else {
o.getAsJsonArray().add(jsonElement);
......
......@@ -34,14 +34,6 @@ public class EnhancePersistenceXmlWriter {
private static void write(Argument arg) throws Exception {
try {
Document document = DocumentHelper.createDocument();
// Element persistence = document.addElement("persistence",
// "http://java.sun.com/xml/ns/persistence");
// persistence.addAttribute(QName.get("schemaLocation", "xsi",
// "http://www.w3.org/2001/XMLSchema-instance"),
// "http://java.sun.com/xml/ns/persistence
// http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd");
// persistence.addAttribute("version", "2.0");
Element persistence = document.addElement("persistence", "http://java.sun.com/xml/ns/persistence");
persistence.addAttribute(QName.get("schemaLocation", "xsi", "http://www.w3.org/2001/XMLSchema-instance"),
"http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd");
......
......@@ -17,7 +17,9 @@ public abstract class AbstractQueue<T> {
private LinkedBlockingQueue<Object> queue = new LinkedBlockingQueue<>();
private volatile boolean turn = true;
private volatile boolean turn = false;
private Integer fixedSize = 1;
private String className = this.getClass().getName();
......@@ -28,7 +30,7 @@ public abstract class AbstractQueue<T> {
/**
* 将创建一个定长线程池,可控制线程最大并发数,超出的线程会在队列中等待
*/
private ExecutorService fixedThreadPool = null;
private ExecutorService executorService = null;
/**
* 初始化一个定长线程池
......@@ -37,15 +39,12 @@ public abstract class AbstractQueue<T> {
* @throws Exception
*/
public void initFixedThreadPool(Integer count) throws Exception {
if (fixedThreadPool != null) {
throw new Exception("fixedThreadPool has init already, fixedThreadPool can not change!");
}
//modify by O2LEE 2017-07-28: check validity for parameter 'count'
if( count == null || count < 1 ) {
count = 1;
if (count == null || count < 1) {
fixedSize = 1;
} else {
fixedSize = count;
}
fixedThreadPool = Executors.newFixedThreadPool( count );
logger.info( className + " new fixed thread pool with max thread count : " + count );
logger.info(className + " new fixed thread pool with max thread count : " + count);
}
public void send(T t) throws Exception {
......@@ -53,9 +52,11 @@ public abstract class AbstractQueue<T> {
}
public void start() {
if (fixedThreadPool == null) {
fixedThreadPool = Executors.newFixedThreadPool(1);
if (turn) {
return;
}
turn = true;
executorService = Executors.newFixedThreadPool(fixedSize);
new Thread() {
public void run() {
Object o = null;
......@@ -64,11 +65,12 @@ public abstract class AbstractQueue<T> {
o = queue.take();
if (null != o) {
if (o instanceof StopSignal) {
turn = false;
break;
}
logger.debug("queue class: {} execute on message: {}.", className, gson.toJson(o));
// 从线程池中获取空闲线程执行QueueProcessThread操作
fixedThreadPool.execute(new QueueProcessThread(abstractQueue, o));
executorService.execute(new QueueProcessThread(abstractQueue, o));
}
} catch (Exception e) {
e.printStackTrace();
......@@ -84,16 +86,14 @@ public abstract class AbstractQueue<T> {
public void stop() {
try {
this.turn = false;
this.queue.clear();
queue.put(new StopSignal());
logger.info("queue class: {} stop.", className);
} catch (Exception e) {
e.printStackTrace();
} finally {
//modify by O2LEE 2017-07-28: add fixed thread pool shut down on queue stop
if( fixedThreadPool != null ) {
fixedThreadPool.shutdown();
fixedThreadPool = null;
if (executorService != null) {
executorService.shutdown();
}
}
}
......
......@@ -14,7 +14,6 @@ public class QueueProcessThread<T> implements Runnable {
@Override
public void run() {
try {
// 执行OkrAbstractQueue对象的execute方法
queue.execute(o);
} catch (Exception e) {
e.printStackTrace();
......
......@@ -69,14 +69,12 @@ public class ScriptHelper {
public Object eval(String scriptText) throws Exception {
StringBuffer sb = new StringBuffer();
try {
sb.append("(function(){").append(SystemUtils.LINE_SEPARATOR);
sb.append("(function(){").append(System.lineSeparator());
if (StringUtils.isNotEmpty(scriptText)) {
sb.append(scriptText).append(SystemUtils.LINE_SEPARATOR);
sb.append(scriptText).append(System.lineSeparator());
}
sb.append("})();");
// return this.engine.eval(sb.toString(), scriptContext);
Object obj = this.engine.eval(sb.toString());
//logger.debug("eval return:{}.", obj);
return obj;
} catch (Exception e) {
throw new ExceptionScriptEval(e, sb.toString());
......
......@@ -5,7 +5,7 @@ import javax.script.ScriptEngineManager;
public class Scripting {
public static final String ENGINE_NAME = "nashorn";
public static final String ENGINE_NAME = "JavaScript";
private static ScriptEngineManager scriptEngineManager;
......
......@@ -28,7 +28,7 @@ import org.slf4j.helpers.MessageFormatter;
public class StringTools {
public static final Pattern MOBILE_REGEX = Pattern
.compile("(^(\\+)?0{0,2}852\\d{8}$)|(^(\\+)?0{0,2}853\\d{8}$)|(^1(3|4|5|7|8|9)\\d{9}$)");
.compile("(^(\\+)?0{0,2}852\\d{8}$)|(^(\\+)?0{0,2}853\\d{8}$)|(^1(3|4|5|6|7|8|9)\\d{9}$)");
/** 中文,英文,数字,-,. 【】() */
public static final Pattern SIMPLY_REGEX = Pattern
.compile("^[\u4e00-\u9fa5a-zA-Z0-9\\_\\(\\)\\-\\ \\.\\【\\】\\(\\)]*$");
......
......@@ -5,9 +5,25 @@ import java.util.Date;
public class TimeStamp {
private Date start;
private Date last;
public TimeStamp() {
start = new Date();
last = start;
}
public String stampSeconds() {
Date date = new Date();
String value = ((date.getTime() - last.getTime()) / 1000) + "sec";
last = date;
return value;
}
public String stampMilliseconds() {
Date date = new Date();
String value = (date.getTime() - last.getTime()) + "ms";
last = date;
return value;
}
public String consumingSeconds() {
......
......@@ -36,7 +36,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -44,7 +44,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -56,7 +56,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -124,22 +124,28 @@ public class BaseAction extends StandardJaxrsAction {
//三、根据栏目和目录的限制查询可访问的分类列表
if( manager ){
List<String> categoryIds_result = new ArrayList<>();
//如果是管理员权限,则在所有的分类信息中进行过滤,可以忽略权限
if( ListTools.isEmpty( inFilterAppIdList )) {//并没有指定栏目
if( ListTools.isNotEmpty( inFilterCategoryIdList )) {
//未指定栏目,但指定了分类,那么直接使用指定的分类
categoryIds = inFilterCategoryIdList;
categoryIds_result = inFilterCategoryIdList;
}else {
categoryIds = categoryInfoServiceAdv.listAllIds();
categoryIds_result = categoryInfoServiceAdv.listAllIds();
}
}else {//指定了栏目,则需要在栏目的限制下获取的分类信息ID列表
categoryIds = categoryInfoServiceAdv.listCategoryIdsWithAppIds( inFilterAppIdList, documentType, manager, maxCount );
for( String id : categoryIds ){
if( !categoryIds_result.contains( id )){
categoryIds_result.add( id );
}
}
if( ListTools.isNotEmpty( inFilterCategoryIdList )) {
//如果指定了栏目又指定了分类, 取交集即可(管理员)
categoryIds.retainAll(inFilterCategoryIdList );
categoryIds_result.retainAll(inFilterCategoryIdList );
}
}
return categoryIds;
return categoryIds_result;
}else{
//如果不是管理员,则需要根据权限来获取可访问的分类
//获取用户可以访问到的所有分类列表
......
......@@ -42,7 +42,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -45,7 +45,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -44,7 +44,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -40,7 +40,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -44,7 +44,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -10,6 +10,6 @@ import com.x.base.core.entity.JpaObject;
*/
public enum ReferenceType {
processPlatformJob, processPlatformForm, portalPage, cmsDocument, forumDocument, forumReply;
processPlatformJob, processPlatformForm, portalPage, cmsDocument, forumDocument, forumReply, component;
public static final int length = JpaObject.length_64B;
}
......@@ -40,7 +40,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -48,7 +48,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -44,7 +44,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -40,7 +40,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -40,7 +40,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -44,7 +44,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -36,7 +36,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -11,7 +11,6 @@ import com.x.organization.assemble.authentication.jaxrs.dingding.DingdingAction;
import com.x.organization.assemble.authentication.jaxrs.oauth.OauthAction;
import com.x.organization.assemble.authentication.jaxrs.qiyeweixin.QiyeweixinAction;
import com.x.organization.assemble.authentication.jaxrs.sso.SsoAction;
import com.x.organization.assemble.authentication.jaxrs.test.TestAction;
import com.x.organization.assemble.authentication.jaxrs.zhengwudingding.ZhengwuDingdingAction;
@ApplicationPath("jaxrs")
......@@ -25,7 +24,6 @@ public class ActionApplication extends AbstractActionApplication {
classes.add(QiyeweixinAction.class);
classes.add(DingdingAction.class);
classes.add(ZhengwuDingdingAction.class);
classes.add(TestAction.class);
return classes;
}
......
package com.x.organization.assemble.authentication.jaxrs;
import javax.servlet.annotation.WebFilter;
import com.x.base.core.project.jaxrs.AnonymousCipherManagerUserJaxrsFilter;
@WebFilter(urlPatterns = "/jaxrs/test/*" ,asyncSupported=true)
public class TestJaxrsFilter extends AnonymousCipherManagerUserJaxrsFilter {
}
......@@ -40,11 +40,14 @@ class ActionCaptchaLogin extends BaseAction {
if (StringUtils.isEmpty(password)) {
throw new ExceptionPasswordEmpty();
}
if (StringUtils.isEmpty(captcha) || StringUtils.isEmpty(captchaAnswer)) {
throw new ExceptionCaptchaEmpty();
}
if (!business.instrument().captcha().validate(captcha, captchaAnswer)) {
throw new ExceptionInvalidCaptcha();
/* 可以通过设置跳过图片验证码. */
if (Config.person().getCaptchaLogin()) {
if (StringUtils.isEmpty(captcha) || StringUtils.isEmpty(captchaAnswer)) {
throw new ExceptionCaptchaEmpty();
}
if (!business.instrument().captcha().validate(captcha, captchaAnswer)) {
throw new ExceptionInvalidCaptcha();
}
}
if (Config.token().isInitialManager(credential)) {
if (!StringUtils.equals(Config.token().getPassword(), password)) {
......
......@@ -30,12 +30,18 @@ class ActionMode extends BaseAction {
} else {
wo.setFaceLogin(false);
}
if (BooleanUtils.isTrue(Config.person().getCaptchaLogin())) {
wo.setCaptchaLogin(true);
} else {
wo.setCaptchaLogin(false);
}
result.setData(wo);
return result;
}
public static class Wo extends GsonPropertyObject {
private Boolean captchaLogin = true;
private Boolean codeLogin = false;
private Boolean bindLogin = false;
private Boolean faceLogin = false;
......@@ -64,6 +70,14 @@ class ActionMode extends BaseAction {
this.faceLogin = faceLogin;
}
public Boolean getCaptchaLogin() {
return captchaLogin;
}
public void setCaptchaLogin(Boolean captchaLogin) {
this.captchaLogin = captchaLogin;
}
}
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.test;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapString;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
class ActionTest1 extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTest1.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = new Wo();
wo.setValue(Config.zhengwuDingding().getJsapiTicket());
result.setData(wo);
return result;
}
public static class Wo extends WrapString {
}
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.test;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapString;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
class ActionTest2 extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTest2.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = new Wo();
wo.setValue(Config.zhengwuDingding().getCorpSecret());
result.setData(wo);
return result;
}
public static class Wo extends WrapString {
}
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.test;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapString;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
class ActionTest3 extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTest3.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = new Wo();
wo.setValue(Config.zhengwuDingding().appAccessToken());
result.setData(wo);
return result;
}
public static class Wo extends WrapString {
}
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.test;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapString;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.organization.assemble.authentication.ThisApplication;
import com.x.organization.assemble.authentication.schedule.TestJob;
class ActionTest4 extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTest4.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = new Wo();
ThisApplication.context().scheduleLocal(TestJob.class);
result.setData(wo);
return result;
}
public static class Wo extends WrapString {
}
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.test;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.ZhengwuDingding.AppAccessTokenResp;
import com.x.base.core.project.connection.HttpConnection;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapString;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
class ActionTest5 extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTest5.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
String body = "{\r\n" + " \"title\":\"大学生运动会\",\r\n" + " \"sponsorUserId\":\"10001461928\",\r\n"
+ " \"level\":\"0\",\r\n" + " \"startTime\":\"1504840278000\",\r\n"
+ " \"endTime\":\"1504840278000\",\r\n" + " \"handleUserIdList\":[10001461928],\r\n"
+ " \"callbackUrl\":\"sport/sport-manage\"\r\n" + ",\"agentId\":\"184707353\"}";
String address = Config.zhengwuDingding().getOapiAddress() + "/backlog/publish?access_token="
+ Config.zhengwuDingding().appAccessToken();
AppAccessTokenResp resp = HttpConnection.postAsObject(address, null, body, AppAccessTokenResp.class);
if (resp.getRetCode() != 0) {
System.out.println("err" + resp.getRetCode() + ", message:" + resp.getRetMessage());
}
Wo wo = new Wo();
wo.setValue(resp.getRetMessage());
result.setData(wo);
return result;
}
// {
// "agentId":"XXXXX",
// "name":"中小企业服务",
// "type":"0",
// "urlPrefix":"www.zjszw.com"
// }
public static class Wo extends WrapString {
}
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.test;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.config.ZhengwuDingding.AppAccessTokenResp;
import com.x.base.core.project.connection.HttpConnection;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapString;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
class ActionTest6 extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTest6.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
String body = " {\r\n" + " \"agentId\":\"184707353\",\r\n" + " \"name\":\"用车管理\",\r\n"
+ " \"type\":\"0\",\r\n" + " \"urlPrefix\":\"http://60.190.253.249:8001/x_desktop/zhengwuDingdingSso.html\"\r\n" + " }";
String address = Config.zhengwuDingding().getOapiAddress() + "/backlog/register?access_token="
+ Config.zhengwuDingding().appAccessToken();
AppAccessTokenResp resp = HttpConnection.postAsObject(address, null, body, AppAccessTokenResp.class);
if (resp.getRetCode() != 0) {
System.out.println("err" + resp.getRetCode() + ", message:" + resp.getRetMessage());
}
Wo wo = new Wo();
wo.setValue(resp.getRetMessage());
result.setData(wo);
return result;
}
public static class Wo extends WrapString {
}
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.test;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoText;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
class ActionTest7 extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTest7.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
String name = "张三你好";
Wo wo = new Wo();
wo.setText(name);
result.setData(wo);
return result;
}
public static class Wo extends WoText {
}
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.test;
import java.util.Arrays;
import java.util.List;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
abstract class BaseAction extends StandardJaxrsAction {
protected static List<String> genderTypeFemaleItems = Arrays.asList(new String[] { "f", "女", "female" });
protected static List<String> genderTypeMaleItems = Arrays.asList(new String[] { "m", "男", "male" });
}
\ No newline at end of file
package com.x.organization.assemble.authentication.jaxrs.test;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.ResponseFactory;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
@Path("test")
@JaxrsDescribe("测试")
public class TestAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(TestAction.class);
@JaxrsMethodDescribe(value = "Test1", action = ActionTest1.class)
@GET
@Path("1")
public void test1(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
ActionResult<ActionTest1.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTest1().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "Test2", action = ActionTest2.class)
@GET
@Path("2")
public void test2(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
ActionResult<ActionTest2.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTest2().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "Test3", action = ActionTest3.class)
@GET
@Path("3")
public void test3(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
ActionResult<ActionTest3.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTest3().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "Test4", action = ActionTest4.class)
@GET
@Path("4")
public void test4(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
ActionResult<ActionTest4.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTest4().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "Test5", action = ActionTest5.class)
@GET
@Path("5")
public void test5(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
ActionResult<ActionTest5.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTest5().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "Test6", action = ActionTest6.class)
@GET
@Path("6")
public void test6(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
ActionResult<ActionTest6.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTest6().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "Test7", action = ActionTest6.class)
@GET
@Path("7")
public void test7(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
ActionResult<ActionTest7.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTest7().execute(effectivePerson);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
}
\ No newline at end of file
package x_organization_assemble_authentication.test;
import java.util.List;
import java.net.URLEncoder;
import java.security.SecureRandom;
import java.util.Date;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import org.apache.commons.codec.binary.Base64;
import org.junit.Test;
import com.x.base.core.project.message.Message;
import com.x.base.core.project.tools.Crypto;
import com.x.organization.assemble.authentication.ThisApplication;
public class TestClient {
@Test
public void test3() throws Exception {
String val = "蔡艳红#10000";
byte[] bb = val.getBytes("utf8");
byte[] cb = Crypto.encrypt(bb, "xplatform".getBytes());
// String data = new String(cb, "utf-8");
String data = new String(Base64.encodeBase64(cb), "utf-8");
System.out.println("!!!!!!!!!@" + data);
byte[] bs = Crypto.decrypt(Base64.decodeBase64(data), "xplatform".getBytes());
String content = new String(bs, "utf-8");
System.out.println(content);
public static String encrypt(String data, String key) throws Exception {
byte[] bt = encrypt(data.getBytes(), key.getBytes());
String str = Base64.encodeBase64URLSafeString(bt);
return URLEncoder.encode(str, "UTF-8");
}
public static byte[] encrypt(byte[] data, byte[] key) throws Exception {
// 生成一个可信任的随机数源
SecureRandom sr = new SecureRandom();
// 从原始密钥数据创建DESKeySpec对象
DESKeySpec dks = new DESKeySpec(key);
// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey securekey = keyFactory.generateSecret(dks);
// Cipher对象实际完成加密操作
Cipher cipher = Cipher.getInstance("DES");
// 用密钥初始化Cipher对象
cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
return cipher.doFinal(data);
}
@Test
public void test4() throws Exception {
System.out.println(Crypto.decrypt("3L583HhoElKrsx%2BqOLOeiWanrYdDRjwM", "strmgtuat"));
public void test() throws Exception {
String text = "张三" + "#" + (new Date()).getTime();
String key = "12345678";
System.out.println(encrypt(text, key));
}
}
......@@ -32,7 +32,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -110,122 +110,71 @@ public class PersonFactory extends AbstractFactory {
}
public String getWithName(String name, String excludeId) throws Exception {
if (StringUtils.isEmpty(name) || (!JpaObjectTools.withinDefinedLength(name, Person.class, "name"))) {
if (StringUtils.isEmpty(name)
|| (!JpaObjectTools.withinDefinedLength(name, Person.class, Person.name_FIELDNAME))) {
return null;
}
EntityManager em = this.entityManagerContainer().get(Person.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Person> root = cq.from(Person.class);
Predicate p = cb.equal(root.get(Person_.name), name);
if (StringUtils.isNotEmpty(excludeId)) {
p = cb.and(p, cb.notEqual(root.get(Person_.id), excludeId));
}
cq.select(root.get(Person_.id)).where(p);
List<String> list = em.createQuery(cq).getResultList();
List<String> list = this.entityManagerContainer().idsEqualAndNotEqual(Person.class, Person.name_FIELDNAME, name,
Person.id_FIELDNAME, excludeId);
return this.returnNotDuplicateId(list);
}
public String getWithMobile(String mobile, String excludeId) throws Exception {
if (StringUtils.isEmpty(mobile) || (!JpaObjectTools.withinDefinedLength(mobile, Person.class, "mobile"))) {
if (StringUtils.isEmpty(mobile)
|| (!JpaObjectTools.withinDefinedLength(mobile, Person.class, Person.mobile_FIELDNAME))) {
return null;
}
EntityManager em = this.entityManagerContainer().get(Person.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Person> root = cq.from(Person.class);
Predicate p = cb.equal(root.get(Person_.mobile), mobile);
if (StringUtils.isNotEmpty(excludeId)) {
p = cb.and(p, cb.notEqual(root.get(Person_.id), excludeId));
}
cq.select(root.get(Person_.id)).where(p);
List<String> list = em.createQuery(cq).getResultList();
List<String> list = this.entityManagerContainer().idsEqualAndNotEqual(Person.class, Person.mobile_FIELDNAME,
mobile, Person.id_FIELDNAME, excludeId);
return this.returnNotDuplicateId(list);
}
public String getWithEmployee(String employee, String excludeId) throws Exception {
if (StringUtils.isEmpty(employee)
|| (!JpaObjectTools.withinDefinedLength(employee, Person.class, "employee"))) {
|| (!JpaObjectTools.withinDefinedLength(employee, Person.class, Person.employee_FIELDNAME))) {
return null;
}
EntityManager em = this.entityManagerContainer().get(Person.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Person> root = cq.from(Person.class);
Predicate p = cb.equal(root.get(Person_.employee), employee);
if (StringUtils.isNotEmpty(excludeId)) {
p = cb.and(p, cb.notEqual(root.get(Person_.id), excludeId));
}
cq.select(root.get(Person_.id)).where(p);
List<String> list = em.createQuery(cq).getResultList();
List<String> list = this.entityManagerContainer().idsEqualAndNotEqual(Person.class, Person.employee_FIELDNAME,
employee, Person.id_FIELDNAME, excludeId);
return this.returnNotDuplicateId(list);
}
public String getWithUnique(String unique, String excludeId) throws Exception {
if (StringUtils.isEmpty(unique) || (!JpaObjectTools.withinDefinedLength(unique, Person.class, "unique"))) {
if (StringUtils.isEmpty(unique)
|| (!JpaObjectTools.withinDefinedLength(unique, Person.class, Person.unique_FIELDNAME))) {
return null;
}
EntityManager em = this.entityManagerContainer().get(Person.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Person> root = cq.from(Person.class);
Predicate p = cb.equal(root.get(Person_.unique), unique);
if (StringUtils.isNotEmpty(excludeId)) {
p = cb.and(p, cb.notEqual(root.get(Person_.id), excludeId));
}
cq.select(root.get(Person_.id)).where(p);
List<String> list = em.createQuery(cq).getResultList();
List<String> list = this.entityManagerContainer().idsEqualAndNotEqual(Person.class, Person.unique_FIELDNAME,
unique, Person.id_FIELDNAME, excludeId);
return this.returnNotDuplicateId(list);
}
public String getWithQq(String qq, String excludeId) throws Exception {
if (StringUtils.isEmpty(qq) || (!JpaObjectTools.withinDefinedLength(qq, Person.class, "qq"))) {
if (StringUtils.isEmpty(qq) || (!JpaObjectTools.withinDefinedLength(qq, Person.class, Person.qq_FIELDNAME))) {
return null;
}
EntityManager em = this.entityManagerContainer().get(Person.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Person> root = cq.from(Person.class);
Predicate p = cb.equal(root.get(Person_.qq), qq);
if (StringUtils.isNotEmpty(excludeId)) {
p = cb.and(p, cb.notEqual(root.get(Person_.id), excludeId));
}
cq.select(root.get(Person_.id)).where(p);
List<String> list = em.createQuery(cq).getResultList();
List<String> list = this.entityManagerContainer().idsEqualAndNotEqual(Person.class, Person.qq_FIELDNAME, qq,
Person.id_FIELDNAME, excludeId);
return this.returnNotDuplicateId(list);
}
public String getWithMail(String mail, String excludeId) throws Exception {
if (StringUtils.isEmpty(mail) || (!JpaObjectTools.withinDefinedLength(mail, Person.class, "mail"))) {
if (StringUtils.isEmpty(mail)
|| (!JpaObjectTools.withinDefinedLength(mail, Person.class, Person.mail_FIELDNAME))) {
return null;
}
EntityManager em = this.entityManagerContainer().get(Person.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Person> root = cq.from(Person.class);
Predicate p = cb.equal(root.get(Person_.mail), mail);
if (StringUtils.isNotEmpty(excludeId)) {
p = cb.and(p, cb.notEqual(root.get(Person_.id), excludeId));
}
cq.select(root.get(Person_.id)).where(p);
List<String> list = em.createQuery(cq).getResultList();
List<String> list = this.entityManagerContainer().idsEqualAndNotEqual(Person.class, Person.mail_FIELDNAME, mail,
Person.id_FIELDNAME, excludeId);
return this.returnNotDuplicateId(list);
}
public String getWithWeixin(String weixin, String excludeId) throws Exception {
if (StringUtils.isEmpty(weixin) || (!JpaObjectTools.withinDefinedLength(weixin, Person.class, "weixin"))) {
if (StringUtils.isEmpty(weixin)
|| (!JpaObjectTools.withinDefinedLength(weixin, Person.class, Person.weixin_FIELDNAME))) {
return null;
}
EntityManager em = this.entityManagerContainer().get(Person.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Person> root = cq.from(Person.class);
Predicate p = cb.equal(root.get(Person_.weixin), weixin);
if (StringUtils.isNotEmpty(excludeId)) {
p = cb.and(p, cb.notEqual(root.get(Person_.id), excludeId));
}
cq.select(root.get(Person_.id)).where(p);
List<String> list = em.createQuery(cq).getResultList();
List<String> list = this.entityManagerContainer().idsEqualAndNotEqual(Person.class, Person.mail_FIELDNAME,
weixin, Person.id_FIELDNAME, excludeId);
return this.returnNotDuplicateId(list);
}
......@@ -251,31 +200,31 @@ public class PersonFactory extends AbstractFactory {
}
}
public Person getWithDingdingIdObject(String dingdingId) throws Exception {
EntityManager em = this.entityManagerContainer().get(Person.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Person> cq = cb.createQuery(Person.class);
Root<Person> root = cq.from(Person.class);
Predicate p = cb.equal(root.get(Person_.dingdingId), dingdingId);
List<Person> os = em.createQuery(cq.select(root).where(p)).setMaxResults(1).getResultList();
if (os.isEmpty()) {
return null;
} else {
return os.get(0);
}
}
public Person getWithQiyeweixinIdObject(String dingdingId) throws Exception {
EntityManager em = this.entityManagerContainer().get(Person.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Person> cq = cb.createQuery(Person.class);
Root<Person> root = cq.from(Person.class);
Predicate p = cb.equal(root.get(Person_.qiyeweixinId), dingdingId);
List<Person> os = em.createQuery(cq.select(root).where(p)).setMaxResults(1).getResultList();
if (os.isEmpty()) {
return null;
} else {
return os.get(0);
}
}
// public Person getWi1thDingdingIdObject(String dingdingId) throws Exception {
// EntityManager em = this.entityManagerContainer().get(Person.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Person> cq = cb.createQuery(Person.class);
// Root<Person> root = cq.from(Person.class);
// Predicate p = cb.equal(root.get(Person_.dingdingId), dingdingId);
// List<Person> os = em.createQuery(cq.select(root).where(p)).setMaxResults(1).getResultList();
// if (os.isEmpty()) {
// return null;
// } else {
// return os.get(0);
// }
// }
//
// public Person getWithQiyeweixinIdObject(String dingdingId) throws Exception {
// EntityManager em = this.entityManagerContainer().get(Person.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Person> cq = cb.createQuery(Person.class);
// Root<Person> root = cq.from(Person.class);
// Predicate p = cb.equal(root.get(Person_.qiyeweixinId), dingdingId);
// List<Person> os = em.createQuery(cq.select(root).where(p)).setMaxResults(1).getResultList();
// if (os.isEmpty()) {
// return null;
// } else {
// return os.get(0);
// }
// }
}
\ No newline at end of file
......@@ -11,7 +11,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
......@@ -33,6 +32,7 @@ import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.scripting.Scripting;
import com.x.base.core.project.tools.Crypto;
import com.x.base.core.project.tools.DateTools;
import com.x.base.core.project.tools.StringTools;
......@@ -58,7 +58,7 @@ class ActionInput extends BaseAction {
Business business = new Business(emc);
ActionResult<Wo> result = new ActionResult<>();
this.scan(business, workbook);
String name = "person_result_" + DateTools.formatDate(new Date()) + ".xls";
String name = "person_" + DateTools.formatDate(new Date()) + ".xlsx";
workbook.write(os);
CacheInputResult cacheInputResult = new CacheInputResult();
cacheInputResult.setName(name);
......@@ -79,20 +79,18 @@ class ActionInput extends BaseAction {
private void scan(Business business, XSSFWorkbook workbook) throws Exception {
Sheet sheet = workbook.getSheetAt(0);
List<PersonItem> people = new ArrayList<>();
PersonSheetConfigurator configurator = new PersonSheetConfigurator(workbook, sheet);
this.scanPerson(configurator, sheet, people);
List<PersonItem> people = this.scanPerson(configurator, sheet);
this.concretePassword(people);
this.persist(business, workbook, configurator, people);
}
private void concretePassword(List<PersonItem> people) throws Exception {
Pattern pattern = Pattern.compile(com.x.base.core.project.config.Person.RegularExpression_Script);
Pattern pattern = Pattern.compile(com.x.base.core.project.config.Person.REGULAREXPRESSION_SCRIPT);
Matcher matcher = pattern.matcher(Config.person().getPassword());
if (matcher.matches()) {
String eval = matcher.group(1);
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName("nashorn");
ScriptEngine engine = Scripting.getEngine();
for (PersonItem o : people) {
engine.put("person", o);
String pass = engine.eval(eval).toString();
......@@ -108,14 +106,14 @@ class ActionInput extends BaseAction {
}
}
private void scanPerson(PersonSheetConfigurator configurator, Sheet sheet, List<PersonItem> people)
throws Exception {
private List<PersonItem> scanPerson(PersonSheetConfigurator configurator, Sheet sheet) throws Exception {
if (null == configurator.getNameColumn()) {
throw new ExceptionNameColumnEmpty();
}
if (null == configurator.getMobileColumn()) {
throw new ExceptionMobileColumnEmpty();
}
List<PersonItem> people = new ArrayList<>();
for (int i = configurator.getFirstRow(); i <= configurator.getLastRow(); i++) {
Row row = sheet.getRow(i);
if (null != row) {
......@@ -162,8 +160,10 @@ class ActionInput extends BaseAction {
}
}
people.add(personItem);
logger.debug("scan person:{}.", personItem);
}
}
return people;
}
private void persist(Business business, XSSFWorkbook workbook, PersonSheetConfigurator configurator,
......@@ -191,121 +191,112 @@ class ActionInput extends BaseAction {
}
}
if (validate) {
List<String> cannotDuplicateList = new ArrayList<>();
for (PersonItem o : people) {
if (cannotDuplicateList.contains(o.getName())) {
this.setMemo(workbook, configurator, o, "姓名冲突.");
validate = false;
continue;
} else {
cannotDuplicateList.add(o.getName());
}
if (cannotDuplicateList.contains(o.getMobile())) {
this.setMemo(workbook, configurator, o, "手机号冲突.");
validate = false;
continue;
} else {
cannotDuplicateList.add(o.getMobile());
}
if (StringUtils.isNotEmpty(o.getMail())) {
if (cannotDuplicateList.contains(o.getMail())) {
this.setMemo(workbook, configurator, o, "邮件地址冲突.");
validate = false;
continue;
} else {
cannotDuplicateList.add(o.getMail());
}
}
if (StringUtils.isNotEmpty(o.getEmployee())) {
if (cannotDuplicateList.contains(o.getEmployee())) {
this.setMemo(workbook, configurator, o, "员工编号冲突.");
validate = false;
continue;
} else {
cannotDuplicateList.add(o.getEmployee());
}
}
if (StringUtils.isNotEmpty(o.getUnique())) {
if (cannotDuplicateList.contains(o.getUnique())) {
this.setMemo(workbook, configurator, o, "唯一编码冲突.");
validate = false;
continue;
} else {
cannotDuplicateList.add(o.getUnique());
for (PersonItem item : people) {
if (o != item) {
if (StringUtils.equals(o.getName(), item.getName())) {
this.setMemo(workbook, configurator, o, "姓名冲突.");
validate = false;
continue;
}
if (StringUtils.equals(o.getMobile(), item.getMobile())) {
this.setMemo(workbook, configurator, o, "手机号冲突,本次导入中不唯一.");
validate = false;
continue;
}
if (StringUtils.isNotEmpty(o.getMail()) && StringUtils.equals(o.getMail(), item.getMail())) {
this.setMemo(workbook, configurator, o, "邮件地址冲突,本次导入中不唯一.");
validate = false;
continue;
}
if (StringUtils.isNotEmpty(o.getEmployee())
&& StringUtils.equals(o.getEmployee(), item.getEmployee())) {
this.setMemo(workbook, configurator, o, "员工编号冲突,本次导入中不唯一.");
validate = false;
continue;
}
if (StringUtils.isNotEmpty(o.getUnique())
&& StringUtils.equals(o.getUnique(), item.getUnique())) {
this.setMemo(workbook, configurator, o, "唯一编码冲突,本次导入中不唯一.");
validate = false;
continue;
}
}
}
}
}
if (validate) {
for (PersonItem o : people) {
p = emc.flag(o.getName(), Person.class);
if (null != p) {
this.setMemo(workbook, configurator, o, "姓名: " + o.getName() + " 与已经存在用户: " + p.getName() + " 冲突.");
validate = false;
continue;
}
p = emc.flag(o.getMobile(), Person.class);
if (null != p) {
this.setMemo(workbook, configurator, o,
"手机号: " + o.getMobile() + " 与已经存在用户: " + p.getName() + " 冲突.");
continue;
}
if (StringUtils.isNotEmpty(o.getUnique())) {
p = emc.flag(o.getUnique(), Person.class);
if (validate) {
for (PersonItem o : people) {
p = emc.flag(o.getName(), Person.class);
if (null != p) {
this.setMemo(workbook, configurator, o,
"唯一编码: " + o.getUnique() + " 与已经存在用户: " + p.getName() + " 冲突.");
"姓名: " + o.getName() + " 与已经存在用户: " + p.getName() + " 冲突.");
validate = false;
continue;
}
}
if (StringUtils.isNotEmpty(o.getEmployee())) {
p = emc.flag(o.getEmployee(), Person.class);
p = emc.flag(o.getMobile(), Person.class);
if (null != p) {
this.setMemo(workbook, configurator, o,
"员工编号: " + o.getEmployee() + " 与已经存在用户: " + p.getName() + " 冲突.");
"手机号: " + o.getMobile() + " 与已经存在用户: " + p.getName() + " 冲突.");
validate = false;
continue;
}
}
if (StringUtils.isNotEmpty(o.getMail())) {
if (!StringTools.isMail(o.getMail())) {
this.setMemo(workbook, configurator, o, "邮件地址格式错误.");
validate = false;
continue;
if (StringUtils.isNotEmpty(o.getMail())) {
if (!StringTools.isMail(o.getMail())) {
this.setMemo(workbook, configurator, o, "邮件地址格式错误.");
validate = false;
continue;
}
p = emc.flag(o.getMail(), Person.class);
if (null != p) {
this.setMemo(workbook, configurator, o,
"邮件地址: " + o.getMail() + " 与已经存在用户: " + p.getName() + " 冲突.");
validate = false;
continue;
}
}
p = emc.flag(o.getMail(), Person.class);
if (null != p) {
this.setMemo(workbook, configurator, o,
"邮件地址: " + o.getMail() + " 与已经存在用户: " + p.getName() + " 冲突.");
validate = false;
continue;
if (StringUtils.isNotEmpty(o.getUnique())) {
p = emc.flag(o.getUnique(), Person.class);
if (null != p) {
this.setMemo(workbook, configurator, o,
"唯一编码: " + o.getUnique() + " 与已经存在用户: " + p.getName() + " 冲突.");
validate = false;
continue;
}
}
if (StringUtils.isNotEmpty(o.getEmployee())) {
p = emc.flag(o.getEmployee(), Person.class);
if (null != p) {
this.setMemo(workbook, configurator, o,
"员工编号: " + o.getEmployee() + " 与已经存在用户: " + p.getName() + " 冲突.");
validate = false;
continue;
}
}
this.setMemo(workbook, configurator, o, "校验通过.");
}
this.setMemo(workbook, configurator, o, "校验成功");
}
}
if (validate) {
emc.beginTransaction(Person.class);
emc.beginTransaction(PersonAttribute.class);
for (PersonItem o : people) {
Person person = new Person();
o.copyTo(person);
emc.persist(person, CheckPersistType.all);
for (Entry<String, String> en : o.getAttributes().entrySet()) {
if (StringUtils.isNotEmpty(en.getValue())) {
PersonAttribute personAttribute = new PersonAttribute();
personAttribute.setName(en.getKey());
personAttribute.setAttributeList(new ArrayList<String>());
personAttribute.getAttributeList().add(en.getValue());
personAttribute.setPerson(person.getId());
emc.persist(personAttribute);
if (validate) {
emc.beginTransaction(Person.class);
emc.beginTransaction(PersonAttribute.class);
for (PersonItem o : people) {
Person person = new Person();
o.copyTo(person);
emc.persist(person, CheckPersistType.all);
for (Entry<String, String> en : o.getAttributes().entrySet()) {
if (StringUtils.isNotEmpty(en.getValue())) {
PersonAttribute personAttribute = new PersonAttribute();
personAttribute.setName(en.getKey());
personAttribute.setAttributeList(new ArrayList<String>());
personAttribute.getAttributeList().add(en.getValue());
personAttribute.setPerson(person.getId());
emc.persist(personAttribute);
}
}
this.setMemo(workbook, configurator, o, "已导入.");
}
emc.commit();
}
emc.commit();
}
}
private void setMemo(XSSFWorkbook workbook, PersonSheetConfigurator configurator, PersonItem personItem,
......
......@@ -19,13 +19,12 @@ public class ActionTemplate extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTemplate.class);
private static String name = "input_person_template.xls";
private static String name = "input_person_template.xlsx";
protected ActionResult<Wo> execute(EffectivePerson effectivePerson) throws Exception {
try (XSSFWorkbook workbook = new XSSFWorkbook(); ByteArrayOutputStream os = new ByteArrayOutputStream()) {
ActionResult<Wo> result = new ActionResult<>();
this.template(workbook);
workbook.write(os);
Wo wo = new Wo(os.toByteArray(), this.contentType(true, name), this.contentDisposition(true, name));
result.setData(wo);
......
......@@ -22,12 +22,16 @@ import com.x.base.core.project.config.Config;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.organization.assemble.control.Business;
import com.x.organization.core.entity.Person;
class ActionCreate extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionCreate.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
......
......@@ -155,9 +155,6 @@ abstract class BaseAction extends StandardJaxrsAction {
}
protected void checkEmployee(Business business, String employee, String excludeId) throws Exception {
// if (StringUtils.isEmpty(employee) || (!StringTools.isSimply(employee))) {
// throw new ExceptionInvalidEmployee(employee);
// }
if (StringUtils.isNotEmpty(business.person().getWithEmployee(employee, excludeId))) {
throw new ExceptionEmployeeDuplicate(employee, "员工号");
}
......@@ -182,7 +179,7 @@ abstract class BaseAction extends StandardJaxrsAction {
protected String initPassword(Business business, Person person) throws Exception {
String str = Config.person().getPassword();
Pattern pattern = Pattern.compile(com.x.base.core.project.config.Person.RegularExpression_Script);
Pattern pattern = Pattern.compile(com.x.base.core.project.config.Person.REGULAREXPRESSION_SCRIPT);
Matcher matcher = pattern.matcher(str);
if (matcher.matches()) {
String eval = matcher.group(1);
......
......@@ -44,8 +44,8 @@ class ActionCreate extends BaseAction {
}
}
unit.setControllerList(ListTools.extractProperty(
business.person().pick(ListTools.trim(unit.getControllerList(), true, true)), JpaObject.id_FIELDNAME,
String.class, true, true));
business.person().pick(ListTools.trim(unit.getControllerList(), true, true)),
JpaObject.id_FIELDNAME, String.class, true, true));
/** 如果唯一标识不为空,要检查唯一标识是否唯一 */
if (this.duplicateUniqueWhenNotEmpty(business, unit)) {
throw new ExceptionDuplicateUnique(unit.getName(), unit.getUnique());
......@@ -74,8 +74,9 @@ class ActionCreate extends BaseAction {
private static final long serialVersionUID = -6314932919066148113L;
static WrapCopier<Wi, Unit> copier = WrapCopierFactory.wi(Wi.class, Unit.class, null,
ListTools.toList(JpaObject.FieldsUnmodify, "pinyin", "pinyinInitial", "level", "levelName",
"inheritedControllerList"));
ListTools.toList(JpaObject.FieldsUnmodify, Unit.superior_FIELDNAME, Unit.pinyin_FIELDNAME,
Unit.pinyinInitial_FIELDNAME, Unit.level_FIELDNAME, Unit.levelName_FIELDNAME,
Unit.inheritedControllerList_FIELDNAME));
}
}
......@@ -160,18 +160,4 @@ class ActionDelete extends BaseAction {
o.getUnitList().remove(unit.getId());
}
}
// private void removeIdentity(Business business, Unit unit) throws
// Exception {
// EntityManager em = business.entityManagerContainer().get(Identity.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Identity> cq = cb.createQuery(Identity.class);
// Root<Identity> root = cq.from(Identity.class);
// Predicate p = cb.equal(root.get(Identity_.unit), unit.getId());
// List<Identity> os =
// em.createQuery(cq.select(root).where(p)).getResultList();
// for (Identity o : os) {
// business.entityManagerContainer().remove(o, CheckRemoveType.all);
// }
// }
}
\ No newline at end of file
......@@ -39,8 +39,8 @@ class ActionEdit extends BaseAction {
emc.beginTransaction(Unit.class);
unit = emc.find(unit.getId(), Unit.class);
unit.setControllerList(ListTools.extractProperty(
business.person().pick(ListTools.trim(unit.getControllerList(), true, true)), JpaObject.id_FIELDNAME,
String.class, true, true));
business.person().pick(ListTools.trim(unit.getControllerList(), true, true)),
JpaObject.id_FIELDNAME, String.class, true, true));
Wi.copier.copy(wi, unit);
/** 如果唯一标识不为空,要检查唯一标识是否唯一 */
if (this.duplicateUniqueWhenNotEmpty(business, unit)) {
......@@ -69,8 +69,9 @@ class ActionEdit extends BaseAction {
private static final long serialVersionUID = -7527954993386512109L;
static WrapCopier<Wi, Unit> copier = WrapCopierFactory.wi(Wi.class, Unit.class, null,
ListTools.toList(JpaObject.FieldsUnmodify, "superior", "pinyin", "pinyinInitial", "level",
"levelName", "inheritedControllerList"));
ListTools.toList(JpaObject.FieldsUnmodify, Unit.superior_FIELDNAME, Unit.pinyin_FIELDNAME,
Unit.pinyinInitial_FIELDNAME, Unit.level_FIELDNAME, Unit.levelName_FIELDNAME,
Unit.inheritedControllerList_FIELDNAME));
}
}
......@@ -58,9 +58,6 @@ class ActionGet extends BaseAction {
private static final long serialVersionUID = -125007357898871894L;
// @FieldDescribe("直接下级组织对象")
// private List<Wo> woSubDirectUnitList;
@FieldDescribe("直接上级组织对象")
private Wo woSupDirectUnit;
......
package com.x.organization.assemble.control.jaxrs.unit;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.organization.assemble.control.Business;
import com.x.organization.core.entity.Identity;
import com.x.organization.core.entity.Unit;
import net.sf.ehcache.Element;
class ActionGetSupDirect extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), flag);
Element element = business.cache().get(cacheKey);
if (null != element && (null != element.getObjectValue())) {
result.setData((Wo) element.getObjectValue());
} else {
Wo wo = this.get(business, flag);
business.cache().put(new Element(cacheKey, wo));
result.setData(wo);
}
this.updateControl(effectivePerson, business, result.getData());
return result;
}
}
public static class Wo extends WoAbstractUnit {
private static final long serialVersionUID = -125007357898871894L;
@FieldDescribe("直接下级组织数量")
private Long subDirectUnitCount = 0L;
@FieldDescribe("直接下级身份数量")
private Long subDirectIdentityCount = 0L;
static WrapCopier<Unit, Wo> copier = WrapCopierFactory.wo(Unit.class, Wo.class, null,
JpaObject.FieldsInvisible);
public Long getSubDirectUnitCount() {
return subDirectUnitCount;
}
public void setSubDirectUnitCount(Long subDirectUnitCount) {
this.subDirectUnitCount = subDirectUnitCount;
}
public Long getSubDirectIdentityCount() {
return subDirectIdentityCount;
}
public void setSubDirectIdentityCount(Long subDirectIdentityCount) {
this.subDirectIdentityCount = subDirectIdentityCount;
}
}
private Wo get(Business business, String flag) throws Exception {
Unit unit = business.unit().pick(flag);
if (null == unit) {
throw new ExceptionUnitNotExist(flag);
}
Unit sup = business.unit().getSupDirectObject(unit);
Wo wo = Wo.copier.copy(sup);
wo.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, wo.getId()));
wo.setSubDirectIdentityCount(
business.entityManagerContainer().countEqual(Identity.class, Identity.unit_FIELDNAME, wo.getId()));
return wo;
}
}
\ No newline at end of file
......@@ -316,4 +316,4 @@ class ActionGetWithIdentityWithType extends BaseAction {
}
}
}
}
\ No newline at end of file
......@@ -163,31 +163,13 @@ class ActionListLike extends BaseAction {
wos = Wo.copier.copy(os);
for (Wo wo : wos) {
wo.setWoSupNestedUnitList(Wo.copier.copy(business.unit().listSupNestedObject(wo)));
wo.setSubDirectUnitCount(this.countSubDirectUnit(business, wo));
wo.setSubDirectIdentityCount(this.countSubDirectIdentity(business, wo));
wo.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, wo.getId()));
wo.setSubDirectIdentityCount(
business.entityManagerContainer().countEqual(Identity.class, Identity.unit_FIELDNAME, wo.getId()));
}
wos = business.unit().sort(wos);
return wos;
}
private Long countSubDirectUnit(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Unit.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Unit> root = cq.from(Unit.class);
Predicate p = cb.equal(root.get(Unit_.superior), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
private Long countSubDirectIdentity(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Identity.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Identity> root = cq.from(Identity.class);
Predicate p = cb.equal(root.get(Identity_.unit), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
}
\ No newline at end of file
......@@ -137,8 +137,8 @@ class ActionListLikePinyin extends BaseAction {
}
List<String> unitIds = business.expendUnitToUnit(wi.getUnitList());
/** 去掉指定范围本身,仅包含下级 */
unitIds.removeAll(ListTools.extractProperty(business.unit().pick(wi.getUnitList()), JpaObject.id_FIELDNAME, String.class,
true, true));
unitIds.removeAll(ListTools.extractProperty(business.unit().pick(wi.getUnitList()), JpaObject.id_FIELDNAME,
String.class, true, true));
String str = wi.getKey().replaceAll("_", "\\\\_");
str = str.replaceAll("%", "\\\\%");
str = str.toLowerCase();
......@@ -158,31 +158,13 @@ class ActionListLikePinyin extends BaseAction {
wos = Wo.copier.copy(os);
for (Wo wo : wos) {
wo.setWoSupNestedUnitList(Wo.copier.copy(business.unit().listSupNestedObject(wo)));
wo.setSubDirectUnitCount(this.countSubDirectUnit(business, wo));
wo.setSubDirectIdentityCount(this.countSubDirectIdentity(business, wo));
wo.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, wo.getId()));
wo.setSubDirectIdentityCount(
business.entityManagerContainer().countEqual(Identity.class, Identity.unit_FIELDNAME, wo.getId()));
}
wos = business.unit().sort(wos);
return wos;
}
private Long countSubDirectUnit(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Unit.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Unit> root = cq.from(Unit.class);
Predicate p = cb.equal(root.get(Unit_.superior), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
private Long countSubDirectIdentity(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Identity.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Identity> root = cq.from(Identity.class);
Predicate p = cb.equal(root.get(Identity_.unit), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
}
\ No newline at end of file
......@@ -137,8 +137,8 @@ class ActionListPinyinInitial extends BaseAction {
}
List<String> unitIds = business.expendUnitToUnit(wi.getUnitList());
/** 去掉指定范围本身,仅包含下级 */
unitIds.removeAll(ListTools.extractProperty(business.unit().pick(wi.getUnitList()), JpaObject.id_FIELDNAME, String.class,
true, true));
unitIds.removeAll(ListTools.extractProperty(business.unit().pick(wi.getUnitList()), JpaObject.id_FIELDNAME,
String.class, true, true));
String str = wi.getKey().replaceAll("_", "\\\\_");
str = str.replaceAll("%", "\\\\%");
str = str.toLowerCase();
......@@ -157,31 +157,13 @@ class ActionListPinyinInitial extends BaseAction {
wos = Wo.copier.copy(os);
for (Wo wo : wos) {
wo.setWoSupNestedUnitList(Wo.copier.copy(business.unit().listSupNestedObject(wo)));
wo.setSubDirectUnitCount(this.countSubDirectUnit(business, wo));
wo.setSubDirectIdentityCount(this.countSubDirectIdentity(business, wo));
wo.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, wo.getId()));
wo.setSubDirectIdentityCount(
business.entityManagerContainer().countEqual(Identity.class, Identity.unit_FIELDNAME, wo.getId()));
}
wos = business.unit().sort(wos);
return wos;
}
private Long countSubDirectUnit(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Unit.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Unit> root = cq.from(Unit.class);
Predicate p = cb.equal(root.get(Unit_.superior), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
private Long countSubDirectIdentity(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Identity.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Identity> root = cq.from(Identity.class);
Predicate p = cb.equal(root.get(Identity_.unit), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
}
\ No newline at end of file
......@@ -84,31 +84,13 @@ class ActionListSubDirect extends BaseAction {
List<Unit> os = business.unit().listSubDirectObject(unit);
List<Wo> wos = Wo.copier.copy(os);
for (Wo wo : wos) {
wo.setSubDirectUnitCount(this.countSubDirectUnit(business, wo));
wo.setSubDirectIdentityCount(this.countSubDirectIdentity(business, wo));
wo.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, wo.getId()));
wo.setSubDirectIdentityCount(
business.entityManagerContainer().countEqual(Identity.class, Identity.unit_FIELDNAME, wo.getId()));
}
wos = business.unit().sort(wos);
return wos;
}
private Long countSubDirectUnit(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Unit.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Unit> root = cq.from(Unit.class);
Predicate p = cb.equal(root.get(Unit_.superior), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
private Long countSubDirectIdentity(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Identity.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Identity> root = cq.from(Identity.class);
Predicate p = cb.equal(root.get(Identity_.unit), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
}
\ No newline at end of file
......@@ -92,31 +92,13 @@ class ActionListSubDirectWithType extends BaseAction {
}).collect(Collectors.toList());
}
for (Wo wo : wos) {
wo.setSubDirectUnitCount(this.countSubDirectUnit(business, wo));
wo.setSubDirectIdentityCount(this.countSubDirectIdentity(business, wo));
wo.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, wo.getId()));
wo.setSubDirectIdentityCount(
business.entityManagerContainer().countEqual(Identity.class, Identity.unit_FIELDNAME, wo.getId()));
}
wos = business.unit().sort(wos);
return wos;
}
private Long countSubDirectUnit(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Unit.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Unit> root = cq.from(Unit.class);
Predicate p = cb.equal(root.get(Unit_.superior), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
private Long countSubDirectIdentity(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Identity.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Identity> root = cq.from(Identity.class);
Predicate p = cb.equal(root.get(Identity_.unit), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
}
\ No newline at end of file
......@@ -5,12 +5,14 @@ import java.util.List;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.organization.assemble.control.Business;
import com.x.organization.core.entity.Identity;
import com.x.organization.core.entity.Unit;
import net.sf.ehcache.Element;
......@@ -37,11 +39,31 @@ class ActionListSubNested extends BaseAction {
public static class Wo extends WoAbstractUnit {
private static final long serialVersionUID = -125007357898871894L;
@FieldDescribe("直接下级组织数量")
private Long subDirectUnitCount = 0L;
@FieldDescribe("直接下级身份数量")
private Long subDirectIdentityCount = 0L;
static WrapCopier<Unit, Wo> copier = WrapCopierFactory.wo(Unit.class, Wo.class, null,
JpaObject.FieldsInvisible);
public Long getSubDirectUnitCount() {
return subDirectUnitCount;
}
public void setSubDirectUnitCount(Long subDirectUnitCount) {
this.subDirectUnitCount = subDirectUnitCount;
}
public Long getSubDirectIdentityCount() {
return subDirectIdentityCount;
}
public void setSubDirectIdentityCount(Long subDirectIdentityCount) {
this.subDirectIdentityCount = subDirectIdentityCount;
}
}
private List<Wo> list(Business business, String flag) throws Exception {
......@@ -52,6 +74,12 @@ class ActionListSubNested extends BaseAction {
List<Unit> os = business.unit().listSubNestedObject(unit);
List<Wo> wos = Wo.copier.copy(os);
wos = business.unit().sort(wos);
for (Wo wo : wos) {
wo.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, wo.getId()));
wo.setSubDirectIdentityCount(
business.entityManagerContainer().countEqual(Identity.class, Identity.unit_FIELDNAME, wo.getId()));
}
return wos;
}
......
package com.x.organization.assemble.control.jaxrs.unit;
import java.util.List;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.organization.assemble.control.Business;
import com.x.organization.core.entity.Identity;
import com.x.organization.core.entity.Unit;
import net.sf.ehcache.Element;
class ActionListSupNested extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String flag) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<List<Wo>> result = new ActionResult<>();
Business business = new Business(emc);
String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), flag);
Element element = business.cache().get(cacheKey);
if (null != element && (null != element.getObjectValue())) {
result.setData((List<Wo>) element.getObjectValue());
} else {
List<Wo> wos = this.list(business, flag);
business.cache().put(new Element(cacheKey, wos));
result.setData(wos);
}
this.updateControl(effectivePerson, business, result.getData());
return result;
}
}
public static class Wo extends WoAbstractUnit {
@FieldDescribe("直接下级组织数量")
private Long subDirectUnitCount = 0L;
@FieldDescribe("直接下级身份数量")
private Long subDirectIdentityCount = 0L;
static WrapCopier<Unit, Wo> copier = WrapCopierFactory.wo(Unit.class, Wo.class, null,
JpaObject.FieldsInvisible);
public Long getSubDirectUnitCount() {
return subDirectUnitCount;
}
public void setSubDirectUnitCount(Long subDirectUnitCount) {
this.subDirectUnitCount = subDirectUnitCount;
}
public Long getSubDirectIdentityCount() {
return subDirectIdentityCount;
}
public void setSubDirectIdentityCount(Long subDirectIdentityCount) {
this.subDirectIdentityCount = subDirectIdentityCount;
}
}
private List<Wo> list(Business business, String flag) throws Exception {
Unit unit = business.unit().pick(flag);
if (null == unit) {
throw new ExceptionUnitNotExist(flag);
}
List<Unit> os = business.unit().listSupNestedObject(unit);
List<Wo> wos = Wo.copier.copy(os);
wos = business.unit().sort(wos);
for (Wo wo : wos) {
wo.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, wo.getId()));
wo.setSubDirectIdentityCount(
business.entityManagerContainer().countEqual(Identity.class, Identity.unit_FIELDNAME, wo.getId()));
}
return wos;
}
}
\ No newline at end of file
package com.x.organization.assemble.control.jaxrs.unit;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.organization.assemble.control.Business;
import com.x.organization.core.entity.Identity;
import com.x.organization.core.entity.Unit;
import net.sf.ehcache.Element;
class ActionListSupNestedWithType extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String flag, String type) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<List<Wo>> result = new ActionResult<>();
Business business = new Business(emc);
String cacheKey = ApplicationCache.concreteCacheKey(this.getClass(), flag, type);
Element element = business.cache().get(cacheKey);
if (null != element && (null != element.getObjectValue())) {
result.setData((List<Wo>) element.getObjectValue());
} else {
List<Wo> wos = this.list(business, flag, type);
business.cache().put(new Element(cacheKey, wos));
result.setData(wos);
}
this.updateControl(effectivePerson, business, result.getData());
return result;
}
}
public static class Wo extends WoAbstractUnit {
private static final long serialVersionUID = -125007357898871894L;
@FieldDescribe("直接下级组织数量")
private Long subDirectUnitCount = 0L;
@FieldDescribe("直接下级身份数量")
private Long subDirectIdentityCount = 0L;
static WrapCopier<Unit, Wo> copier = WrapCopierFactory.wo(Unit.class, Wo.class, null,
JpaObject.FieldsInvisible);
public Long getSubDirectUnitCount() {
return subDirectUnitCount;
}
public void setSubDirectUnitCount(Long subDirectUnitCount) {
this.subDirectUnitCount = subDirectUnitCount;
}
public Long getSubDirectIdentityCount() {
return subDirectIdentityCount;
}
public void setSubDirectIdentityCount(Long subDirectIdentityCount) {
this.subDirectIdentityCount = subDirectIdentityCount;
}
}
private List<Wo> list(Business business, String flag, String type) throws Exception {
Unit unit = business.unit().pick(flag);
if (null == unit) {
throw new ExceptionUnitNotExist(flag);
}
List<Unit> os = business.unit().listSupNestedObject(unit);
List<Wo> wos = Wo.copier.copy(os);
if (StringUtils.isNotEmpty(type)) {
wos = wos.stream().filter(o -> {
return o.getTypeList().contains(type);
}).collect(Collectors.toList());
}
for (Wo wo : wos) {
wo.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, wo.getId()));
wo.setSubDirectIdentityCount(
business.entityManagerContainer().countEqual(Identity.class, Identity.unit_FIELDNAME, wo.getId()));
}
wos = business.unit().sort(wos);
return wos;
}
}
\ No newline at end of file
......@@ -86,8 +86,10 @@ class ActionListTop extends BaseAction {
List<Wo> wos = Wo.copier.copy(os);
wos.stream().forEach(o -> {
try {
o.setSubDirectUnitCount(this.countSubDirectUnit(business, o));
o.setSubDirectIdentityCount(this.countSubDirectIdentity(business, o));
o.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, o.getId()));
o.setSubDirectIdentityCount(business.entityManagerContainer().countEqual(Identity.class,
Identity.unit_FIELDNAME, o.getId()));
} catch (Exception e) {
e.printStackTrace();
}
......@@ -96,23 +98,4 @@ class ActionListTop extends BaseAction {
return wos;
}
private Long countSubDirectUnit(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Unit.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Unit> root = cq.from(Unit.class);
Predicate p = cb.equal(root.get(Unit_.superior), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
private Long countSubDirectIdentity(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Identity.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Identity> root = cq.from(Identity.class);
Predicate p = cb.equal(root.get(Identity_.unit), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
}
\ No newline at end of file
......@@ -19,7 +19,6 @@ import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.organization.assemble.control.Business;
import com.x.organization.core.entity.Identity;
import com.x.organization.core.entity.Identity_;
import com.x.organization.core.entity.Unit;
import com.x.organization.core.entity.Unit_;
......@@ -88,8 +87,10 @@ class ActionListTopWithType extends BaseAction {
List<Wo> wos = Wo.copier.copy(os);
wos.stream().forEach(o -> {
try {
o.setSubDirectUnitCount(this.countSubDirectUnit(business, o));
o.setSubDirectIdentityCount(this.countSubDirectIdentity(business, o));
o.setSubDirectUnitCount(
business.entityManagerContainer().countEqual(Unit.class, Unit.superior_FIELDNAME, o.getId()));
o.setSubDirectIdentityCount(business.entityManagerContainer().countEqual(Identity.class,
Identity.unit_FIELDNAME, o.getId()));
} catch (Exception e) {
e.printStackTrace();
}
......@@ -98,23 +99,4 @@ class ActionListTopWithType extends BaseAction {
return wos;
}
private Long countSubDirectUnit(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Unit.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Unit> root = cq.from(Unit.class);
Predicate p = cb.equal(root.get(Unit_.superior), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
private Long countSubDirectIdentity(Business business, Wo wo) throws Exception {
EntityManager em = business.entityManagerContainer().get(Identity.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Identity> root = cq.from(Identity.class);
Predicate p = cb.equal(root.get(Identity_.unit), wo.getId());
Long count = em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
return count;
}
}
\ No newline at end of file
......@@ -92,15 +92,6 @@ class ActionListWithUnitWithType extends BaseAction {
@FieldDescribe("直接下级组织组织对象")
private List<Wo> woSubDirectUnitList = new ArrayList<>();
// @FieldDescribe("直接下级身份对象")
// private List<WoIdentity> woSubDirectIdentityList = new ArrayList<>();
// @FieldDescribe("直接下级组织数量")
// private Long countSubDirectUnit = 0L;
// @FieldDescribe("直接下级身份数量")
// private Long subDirectIdentityCount = 0L;
static WrapCopier<Unit, Wo> copier = WrapCopierFactory.wo(Unit.class, Wo.class, null,
JpaObject.FieldsInvisible);
......@@ -201,67 +192,4 @@ class ActionListWithUnitWithType extends BaseAction {
return null;
}
// private void format(List<Wo> tree, Wo wo) {
// if (wo.getLevel() == 1) {
// tree.add(wo);
// } else {
// Wo o = this.find(tree, wo.getSuperior());
// if (null != o) {
// o.getWoSubDirectUnitList().add(wo);
// }
// }
// }
//
// private Wo find(List<Wo> tree, String id) {
// for (Wo o : tree) {
// if (StringUtils.equalsIgnoreCase(id, o.getId())) {
// return o;
// } else if (ListTools.isNotEmpty(o.getWoSubDirectUnitList())) {
// Wo wo = find(o.getWoSubDirectUnitList(), id);
// if (null != wo) {
// return wo;
// }
// }
// }
// return null;
// }
// private void referenceSubDirectIdentity(Business business, Wo wo) throws
// Exception {
// EntityManager em = business.entityManagerContainer().get(Identity.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Identity> cq = cb.createQuery(Identity.class);
// Root<Identity> root = cq.from(Identity.class);
// Predicate p = cb.equal(root.get(Identity_.unit), wo.getId());
// List<Identity> os =
// em.createQuery(cq.select(root).where(p)).getResultList();
// List<WoIdentity> wos = WoIdentity.copier.copy(os);
// wos = business.identity().sort(wos);
// wo.setWoSubDirectIdentityList(wos);
// }
// private Long countSubDirectUnit(Business business, Wo wo) throws
// Exception {
// EntityManager em = business.entityManagerContainer().get(Unit.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Long> cq = cb.createQuery(Long.class);
// Root<Unit> root = cq.from(Unit.class);
// Predicate p = cb.equal(root.get(Unit_.superior), wo.getId());
// Long count =
// em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
// return count;
// }
// private Long countSubDirectIdentity(Business business, Wo wo) throws
// Exception {
// EntityManager em = business.entityManagerContainer().get(Identity.class);
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Long> cq = cb.createQuery(Long.class);
// Root<Identity> root = cq.from(Identity.class);
// Predicate p = cb.equal(root.get(Identity_.unit), wo.getId());
// Long count =
// em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
// return count;
// }
}
\ No newline at end of file
......@@ -354,4 +354,59 @@ public class UnitAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "直接上级组织.", action = ActionGetSupDirect.class)
@GET
@Path("{flag}/sup/direct")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void getSupDirect(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("组织标识") @PathParam("flag") String flag) {
ActionResult<ActionGetSupDirect.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionGetSupDirect().execute(effectivePerson, flag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "递归上级组织.", action = ActionListSupNested.class)
@GET
@Path("list/{flag}/sup/nested")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listSupNested(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("组织标识") @PathParam("flag") String flag) {
ActionResult<List<ActionListSupNested.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListSupNested().execute(effectivePerson, flag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
@JaxrsMethodDescribe(value = "查找递归上级组织中符合type值的对象.", action = ActionListSupNestedWithType.class)
@GET
@Path("list/{flag}/sup/nested/type/{type}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listSupNestedWithType(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("组织标识") @PathParam("flag") String flag,
@JaxrsParameterDescribe("组织的type属性值,匹配多值中的某一个") @PathParam("type") String type) {
ActionResult<List<ActionListSupNestedWithType.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListSupNestedWithType().execute(effectivePerson, flag, type);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getDefaultActionResultResponse(result));
}
}
\ No newline at end of file
......@@ -32,7 +32,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>o2oa</groupId>
<artifactId>o2server</artifactId>
<version>4.0.5</version>
</parent>
<artifactId>x_organization_assemble_express</artifactId>
<packaging>war</packaging>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>o2oa</groupId>
<artifactId>o2server</artifactId>
<version>4.0.5</version>
</parent>
<artifactId>x_organization_assemble_express</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>o2oa</groupId>
......@@ -30,7 +32,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -32,7 +32,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -28,4 +28,13 @@ public class TestClient {
System.out.println(list.subList(list.indexOf("bbb"), list.size()));
}
@Test
public void test1() throws Exception {
Double d = 111.11;
Long l = d.longValue();
System.out.println(Double.parseDouble(l.toString()));
System.out.println(l.doubleValue() == d);
}
}
......@@ -36,7 +36,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -36,7 +36,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -38,7 +38,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -48,7 +48,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -48,7 +48,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -48,7 +48,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -729,7 +729,7 @@ abstract class BaseAction extends StandardJaxrsAction {
CompletableFuture<Long> future_reviewCount = CompletableFuture.supplyAsync(() -> {
Long o = 0L;
try {
o = business.entityManagerContainer().countEqual(Review.class, Review.person_FIELDNAME,
o = business.entityManagerContainer().countEqualAndEqual(Review.class, Review.person_FIELDNAME,
effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, work.getJob());
} catch (Exception e) {
logger.error(e);
......
......@@ -453,7 +453,7 @@ abstract class BaseAction extends StandardJaxrsAction {
CompletableFuture<Long> future_reviewCount = CompletableFuture.supplyAsync(() -> {
Long o = 0L;
try {
o = business.entityManagerContainer().countEqual(Review.class, Review.person_FIELDNAME,
o = business.entityManagerContainer().countEqualAndEqual(Review.class, Review.person_FIELDNAME,
effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, workCompleted.getJob());
} catch (Exception e) {
logger.error(e);
......
package com.x.processplatform.assemble.surface.jaxrs.workcompleted;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.dataitem.DataItemConverter;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.assemble.surface.WorkCompletedControl;
import com.x.processplatform.core.entity.content.Attachment;
import com.x.processplatform.core.entity.content.Data;
import com.x.processplatform.core.entity.content.ProcessingType;
import com.x.processplatform.core.entity.content.Read;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.TaskCompleted;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.content.WorkCompleted_;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.core.entity.element.Application;
import com.x.processplatform.core.entity.element.Form;
import com.x.query.core.entity.Item;
import com.x.query.core.entity.Item_;
abstract class BaseAction2 extends StandardJaxrsAction {
static DataItemConverter<Item> itemConverter = new DataItemConverter<>(Item.class);
String getApplicationName(Business business, EffectivePerson effectivePerson, String id) throws Exception {
Application application = business.application().pick(id);
if (null != application) {
return application.getName();
}
EntityManagerContainer emc = business.entityManagerContainer();
EntityManager em = emc.get(WorkCompleted.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<WorkCompleted> root = cq.from(WorkCompleted.class);
Predicate p = cb.equal(root.get(WorkCompleted_.creatorPerson), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(WorkCompleted_.application), id));
cq.select(root.get(WorkCompleted_.applicationName)).where(p);
List<String> list = em.createQuery(cq).setMaxResults(1).getResultList();
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
Data loadData(Business business, WorkCompleted workCompleted) throws Exception {
EntityManager em = business.entityManagerContainer().get(Item.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Item> cq = cb.createQuery(Item.class);
Root<Item> root = cq.from(Item.class);
Predicate p = cb.equal(root.get(Item_.bundle), workCompleted.getJob());
List<Item> list = em.createQuery(cq.where(p)).getResultList();
if (list.isEmpty()) {
return new Data();
} else {
JsonElement jsonElement = itemConverter.assemble(list);
if (jsonElement.isJsonObject()) {
return gson.fromJson(jsonElement, Data.class);
} else {
/* 如果不是Object强制返回一个Map对象 */
return new Data();
}
}
}
protected <T extends AbstractWo> T get(Business business, EffectivePerson effectivePerson,
WorkCompleted workCompleted, Class<T> cls) throws Exception {
T t = cls.newInstance();
t.setWorkCompleted(WoWorkCompleted.copier.copy(workCompleted));
t.setAttachmentList(this.listAttachment(business, workCompleted));
t.setWorkLogList(this.referenceWorkLog(business, workCompleted));
t.setData(this.loadData(business, workCompleted));
WoControl control = business.getControl(effectivePerson, workCompleted, WoControl.class);
t.setControl(control);
t.setReadList(this.listRead(business, workCompleted));
return t;
}
private List<WoAttachment> listAttachment(Business business, WorkCompleted workCompleted) throws Exception {
List<WoAttachment> list = new ArrayList<>();
List<Attachment> os = business.entityManagerContainer().list(Attachment.class,
business.attachment().listWithJob(workCompleted.getJob()));
list = WoAttachment.copier.copy(os);
list = business.attachment().sort(list);
return list;
}
private List<WoWorkLog> referenceWorkLog(Business business, WorkCompleted workCompleted) throws Exception {
List<WoWorkLog> os = WoWorkLog.copier.copy(business.workLog().listWithJobObject(workCompleted.getJob()));
List<WoTaskCompleted> _taskCompleteds = WoTaskCompleted.copier
.copy(business.taskCompleted().listWithJobObject(workCompleted.getJob()));
List<WoTask> _tasks = WoTask.copier.copy(business.task().listWithJobObject(workCompleted.getJob()));
os = business.workLog().sort(os);
Map<String, List<WoTaskCompleted>> _map_taskCompleteds = _taskCompleteds.stream()
.collect(Collectors.groupingBy(o -> o.getActivityToken()));
Map<String, List<WoTask>> _map_tasks = _tasks.stream()
.collect(Collectors.groupingBy(o -> o.getActivityToken()));
for (WoWorkLog o : os) {
List<WoTaskCompleted> _parts_taskCompleted = _map_taskCompleteds.get(o.getFromActivityToken());
o.setTaskCompletedList(new ArrayList<WoTaskCompleted>());
if (!ListTools.isEmpty(_parts_taskCompleted)) {
for (WoTaskCompleted _taskCompleted : business.taskCompleted().sort(_parts_taskCompleted)) {
o.getTaskCompletedList().add(_taskCompleted);
if (_taskCompleted.getProcessingType().equals(ProcessingType.retract)) {
TaskCompleted _retract = new TaskCompleted();
o.copyTo(_retract);
_retract.setRouteName("撤回");
_retract.setOpinion("撤回");
_retract.setStartTime(_retract.getRetractTime());
_retract.setCompletedTime(_retract.getRetractTime());
o.getTaskCompletedList().add(WoTaskCompleted.copier.copy(_retract));
}
}
}
List<WoTask> _parts_tasks = _map_tasks.get(o.getFromActivityToken());
o.setTaskList(new ArrayList<WoTask>());
if (!ListTools.isEmpty(_parts_tasks)) {
o.setTaskList(business.task().sort(_parts_tasks));
}
//
// o.setTaskList(WoTask.copier.copy(business.task().listTask(o)));
// o.setTaskCompletedList(WoTaskCompleted.copier.copy(business.taskCompleted().listTaskCompleted(o)));
}
return os;
}
private List<WoRead> listRead(Business business, WorkCompleted workCompleted) throws Exception {
List<Read> os = business.read().listWithWorkCompletedObject(workCompleted);
os = os.stream().sorted(Comparator.comparing(Read::getStartTime, Comparator.nullsLast(Date::compareTo)))
.collect(Collectors.toList());
return WoRead.copier.copy(os);
}
public static class AbstractWo extends GsonPropertyObject {
@FieldDescribe("业务数据")
private Data data;
@FieldDescribe("已完成工作")
private WoWorkCompleted workCompleted;
@FieldDescribe("待阅")
private List<WoRead> readList = new ArrayList<>();
@FieldDescribe("附件")
private List<WoAttachment> attachmentList = new ArrayList<>();
@FieldDescribe("工作日志")
private List<WoWorkLog> workLogList = new ArrayList<>();
@FieldDescribe("权限")
private WoControl control;
@FieldDescribe("表单")
private WoForm form;
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public WoWorkCompleted getWorkCompleted() {
return workCompleted;
}
public void setWorkCompleted(WoWorkCompleted workCompleted) {
this.workCompleted = workCompleted;
}
public List<WoAttachment> getAttachmentList() {
return attachmentList;
}
public void setAttachmentList(List<WoAttachment> attachmentList) {
this.attachmentList = attachmentList;
}
public List<WoWorkLog> getWorkLogList() {
return workLogList;
}
public void setWorkLogList(List<WoWorkLog> workLogList) {
this.workLogList = workLogList;
}
public WoForm getForm() {
return form;
}
public void setForm(WoForm form) {
this.form = form;
}
public List<WoRead> getReadList() {
return readList;
}
public void setReadList(List<WoRead> readList) {
this.readList = readList;
}
public WoControl getControl() {
return control;
}
public void setControl(WoControl control) {
this.control = control;
}
}
public static class WoWorkCompleted extends WorkCompleted {
private static final long serialVersionUID = 2620843025774912687L;
static WrapCopier<WorkCompleted, WoWorkCompleted> copier = WrapCopierFactory.wo(WorkCompleted.class,
WoWorkCompleted.class, null, JpaObject.FieldsInvisible);
}
public static class WoAttachment extends Attachment {
private static final long serialVersionUID = -5308138678076613506L;
static WrapCopier<Attachment, WoAttachment> copier = WrapCopierFactory.wo(Attachment.class, WoAttachment.class,
null, JpaObject.FieldsInvisible);
}
public static class WoWorkLog extends WorkLog {
private List<WoTask> taskList;
private List<WoTaskCompleted> taskCompletedList;
private static final long serialVersionUID = -8169472016302098902L;
static WrapCopier<WorkLog, WoWorkLog> copier = WrapCopierFactory.wo(WorkLog.class, WoWorkLog.class, null,
JpaObject.FieldsInvisible);
public List<WoTask> getTaskList() {
return taskList;
}
public void setTaskList(List<WoTask> taskList) {
this.taskList = taskList;
}
public List<WoTaskCompleted> getTaskCompletedList() {
return taskCompletedList;
}
public void setTaskCompletedList(List<WoTaskCompleted> taskCompletedList) {
this.taskCompletedList = taskCompletedList;
}
}
public static class WoTask extends Task {
private static final long serialVersionUID = 813720809948190092L;
static WrapCopier<Task, WoTask> copier = WrapCopierFactory.wo(Task.class, WoTask.class, null,
ListTools.toList(JpaObject.FieldsInvisible, Task.opinionLob_FIELDNAME));
public void setOpinion(String opinion) {
this.opinion = opinion;
}
}
public static class WoTaskCompleted extends TaskCompleted {
private static final long serialVersionUID = 850727404260313692L;
static WrapCopier<TaskCompleted, WoTaskCompleted> copier = WrapCopierFactory.wo(TaskCompleted.class,
WoTaskCompleted.class, null,
ListTools.toList(JpaObject.FieldsInvisible, TaskCompleted.opinionLob_FIELDNAME));
public void setOpinion(String opinion) {
this.opinion = opinion;
}
}
public static class WoRead extends Read {
private static final long serialVersionUID = -8067704098385000667L;
public static WrapCopier<Read, WoRead> copier = WrapCopierFactory.wo(Read.class, WoRead.class, null,
ListTools.toList(JpaObject.FieldsInvisible, Read.opinionLob_FIELDNAME));
public void setOpinion(String opinion) {
this.opinion = opinion;
}
}
public static class WoControl extends WorkCompletedControl {
}
public static class WoForm extends Form {
private static final long serialVersionUID = 8714459358196550018L;
public static WrapCopier<Form, WoForm> copier = WrapCopierFactory.wo(Form.class, WoForm.class,
JpaObject.singularAttributeField(Form.class, true, true), null);
}
}
......@@ -729,7 +729,7 @@ abstract class BaseAction extends StandardJaxrsAction {
CompletableFuture<Long> future_reviewCount = CompletableFuture.supplyAsync(() -> {
Long o = 0L;
try {
o = business.entityManagerContainer().countEqual(Review.class, Review.person_FIELDNAME,
o = business.entityManagerContainer().countEqualAndEqual(Review.class, Review.person_FIELDNAME,
effectivePerson.getDistinguishedName(), Review.job_FIELDNAME, work.getJob());
} catch (Exception e) {
logger.error(e);
......
......@@ -42,7 +42,7 @@
<executions>
<execution>
<id>enhancer</id>
<phase>prepare-package</phase>
<phase>process-classes</phase>
</execution>
</executions>
</plugin>
......
......@@ -48,7 +48,7 @@
</execution>
<execution>
<id>describe</id>
<phase>generate-sources</phase>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
......
......@@ -105,33 +105,33 @@ public class Reorganize implements Job {
List<String> ids_none_application = emc.idsNotIn(Task.class, Task.application_FIELDNAME,
emc.ids(Application.class));
List<String> ids_none_process = emc.idsNotIn(Task.class, Task.process_FIELDNAME, emc.ids(Process.class));
List<String> ids_none_agent = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Agent.class),
List<String> ids_none_agent = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Agent.class),
Task.activityType_FIELDNAME, ActivityType.agent);
List<String> ids_none_begin = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Begin.class),
List<String> ids_none_begin = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Begin.class),
Task.activityType_FIELDNAME, ActivityType.begin);
List<String> ids_none_cancel = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Cancel.class),
List<String> ids_none_cancel = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Cancel.class),
Task.activityType_FIELDNAME, ActivityType.cancel);
List<String> ids_none_choice = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Choice.class),
List<String> ids_none_choice = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Choice.class),
Task.activityType_FIELDNAME, ActivityType.choice);
List<String> ids_none_delay = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Delay.class),
List<String> ids_none_delay = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Delay.class),
Task.activityType_FIELDNAME, ActivityType.delay);
List<String> ids_none_embed = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Embed.class),
List<String> ids_none_embed = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Embed.class),
Task.activityType_FIELDNAME, ActivityType.embed);
List<String> ids_none_end = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(End.class),
List<String> ids_none_end = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(End.class),
Task.activityType_FIELDNAME, ActivityType.end);
List<String> ids_none_invoke = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Invoke.class),
List<String> ids_none_invoke = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Invoke.class),
Task.activityType_FIELDNAME, ActivityType.invoke);
List<String> ids_none_manual = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Manual.class),
List<String> ids_none_manual = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Manual.class),
Task.activityType_FIELDNAME, ActivityType.manual);
List<String> ids_none_merge = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Merge.class),
List<String> ids_none_merge = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Merge.class),
Task.activityType_FIELDNAME, ActivityType.merge);
List<String> ids_none_message = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME,
List<String> ids_none_message = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME,
emc.ids(Message.class), Task.activityType_FIELDNAME, ActivityType.message);
List<String> ids_none_parallel = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME,
List<String> ids_none_parallel = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME,
emc.ids(Parallel.class), Task.activityType_FIELDNAME, ActivityType.parallel);
List<String> ids_none_service = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME,
List<String> ids_none_service = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME,
emc.ids(Service.class), Task.activityType_FIELDNAME, ActivityType.service);
List<String> ids_none_split = emc.idsNotInAndEqual(Task.class, Task.activity_FIELDNAME, emc.ids(Split.class),
List<String> ids_none_split = emc.idsEqualAndNotIn(Task.class, Task.activity_FIELDNAME, emc.ids(Split.class),
Task.activityType_FIELDNAME, ActivityType.split);
List<String> ids = ListUtils
.sum(ListUtils
......@@ -193,33 +193,33 @@ public class Reorganize implements Job {
private Integer rerouteWorkActivityNotExisted(Business business) throws Exception {
TimeStamp stamp = new TimeStamp();
EntityManagerContainer emc = business.entityManagerContainer();
List<String> ids_none_agent = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Agent.class),
List<String> ids_none_agent = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Agent.class),
Work.activityType_FIELDNAME, ActivityType.agent);
List<String> ids_none_begin = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Begin.class),
List<String> ids_none_begin = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Begin.class),
Work.activityType_FIELDNAME, ActivityType.begin);
List<String> ids_none_cancel = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Cancel.class),
List<String> ids_none_cancel = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Cancel.class),
Work.activityType_FIELDNAME, ActivityType.cancel);
List<String> ids_none_choice = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Choice.class),
List<String> ids_none_choice = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Choice.class),
Work.activityType_FIELDNAME, ActivityType.choice);
List<String> ids_none_delay = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Delay.class),
List<String> ids_none_delay = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Delay.class),
Work.activityType_FIELDNAME, ActivityType.delay);
List<String> ids_none_embed = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Embed.class),
List<String> ids_none_embed = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Embed.class),
Work.activityType_FIELDNAME, ActivityType.embed);
List<String> ids_none_end = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(End.class),
List<String> ids_none_end = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(End.class),
Work.activityType_FIELDNAME, ActivityType.end);
List<String> ids_none_invoke = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Invoke.class),
List<String> ids_none_invoke = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Invoke.class),
Work.activityType_FIELDNAME, ActivityType.invoke);
List<String> ids_none_manual = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Manual.class),
List<String> ids_none_manual = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Manual.class),
Work.activityType_FIELDNAME, ActivityType.manual);
List<String> ids_none_merge = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Merge.class),
List<String> ids_none_merge = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Merge.class),
Work.activityType_FIELDNAME, ActivityType.merge);
List<String> ids_none_message = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME,
List<String> ids_none_message = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME,
emc.ids(Message.class), Work.activityType_FIELDNAME, ActivityType.message);
List<String> ids_none_parallel = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME,
List<String> ids_none_parallel = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME,
emc.ids(Parallel.class), Work.activityType_FIELDNAME, ActivityType.parallel);
List<String> ids_none_service = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME,
List<String> ids_none_service = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME,
emc.ids(Service.class), Work.activityType_FIELDNAME, ActivityType.service);
List<String> ids_none_split = emc.idsNotInAndEqual(Work.class, Work.activity_FIELDNAME, emc.ids(Split.class),
List<String> ids_none_split = emc.idsEqualAndNotIn(Work.class, Work.activity_FIELDNAME, emc.ids(Split.class),
Work.activityType_FIELDNAME, ActivityType.split);
List<String> ids = ListUtils
.sum(ListUtils.sum(
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册