提交 92803bd7 编写于 作者: R Ray

修正注释

上级 7e97ef43
{
"enable": false,
"host": "",
"port": 25.0,
"sslEnable": false,
"from": "",
"user": "",
"pass": "",
"###enable": "是否启用###",
"###host": "SMTP主机地址###",
"###port": "SMTP发送端口###",
"###sslEnable": "是否启用ssl###",
"###from": "发送人###",
"###user": "用户名###",
"###pass": "密码###"
}
\ No newline at end of file
{
"appId": "100016851",
"appSecret": "b3ad9287e8d1d16d0aad8fde66e59118",
"###appId": "华为推送应用的appId###",
"###appSecret": "华为推送应用的appSecret###"
}
\ No newline at end of file
{
"enable": false,
"enablePublish": false,
"appid": "",
"appSecret": "",
"token": "",
"encodingAesKey": "",
"portalId": "",
"messageEnable": false,
"tempMessageId": "",
"fieldList": [
{
"name": "",
"tempName": "",
"###name": "流程字段名###",
"###tempName": "模版字段名###"
}
],
"###enable": "是否启用.###",
"###enablePublish": "是否启用发布.###",
"###appid": "微信开放平台appid###",
"###appSecret": "微信开放平台appSecret###",
"###token": "微信公众号配的token###",
"###encodingAesKey": "微信公众号配的encodingAesKey###",
"###portalId": "微信公众号测试菜单的门户地址###",
"###messageEnable": "是否启用公众号模版消息###",
"###tempMessageId": "公众号模版消息id###",
"###fieldList": "模版字段###"
}
\ No newline at end of file
{
"enable": false,
"mq": "kafka",
"###enable": "是否启用.###",
"###mq": "消息服务类型###",
"###kafka": "Kafka服务器配置###",
"kafka": {
"bootstrap_servers": "localhost:9092",
"topic": "topic-test",
"acks": "all",
"retries": 0.0,
"batch_size": 16384.0,
"linger_ms": 1.0,
"buffer_memory": 3.3554432E7,
"key_deserializer": "org.apache.kafka.common.serialization.StringDeserializer",
"value_deserializer": "org.apache.kafka.common.serialization.StringDeserializer",
"###bootstrap_servers": "服务器地址###",
"###topic": "主题###",
"###acks": "指定必须有多少个分区副本接收消息,生产者才认为消息写入成功###",
"###retries": "错误的次数###",
"###batch_size": "批次可以使用的内存大小###",
"###linger_ms": "等待更多消息加入批次的时间###",
"###buffer_memory": "生产者内存缓冲区的大小###",
"###key_deserializer": "key值的序列化类###",
"###value_deserializer": "value的序列化类###"
},
"###activeMQ": "ActiveMQ服务器配置###",
"activeMQ": {
"url": "tcp://127.0.0.1:61616",
"queueName": "queue-test",
"###url": "服务器地址###",
"###queueName": "消息队列名###",
"###keyStore": "密钥文件存储路径###",
"###trustStore": "证书文件存储路径###",
"###keyStorePassword": "密钥密码###"
}
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ import com.google.gson.JsonElement;
import com.x.attendance.assemble.control.jaxrs.ExceptionAttendanceProcess;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
......@@ -59,7 +60,7 @@ public class AttendanceSelfHolidaySimpleAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void deleteByWfDocId(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("docId") String docId) {
@JaxrsParameterDescribe("文档标识") @PathParam("docId") String docId) {
ActionResult<ActionDeleteByWfDocId.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
Boolean check = true;
......
......@@ -3,67 +3,67 @@ package com.x.attendance.assemble.control.service;
import com.x.attendance.assemble.control.Business;
import com.x.attendance.entity.AttendanceSelfHoliday;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.entity.tools.JpaObjectTools;
import com.x.base.core.project.cache.CacheManager;
import com.x.base.core.project.cache.Cache.CacheCategory;
import com.x.base.core.project.cache.Cache.CacheKey;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public class AttendanceSelfHolidayService {
private CacheCategory cache_AttendanceSelfHoliday = new CacheCategory( AttendanceSelfHoliday.class);
private CacheCategory cache_AttendanceSelfHoliday = new CacheCategory(AttendanceSelfHoliday.class);
public AttendanceSelfHoliday get( EntityManagerContainer emc, String id ) throws Exception {
if( id == null || id.isEmpty() ){
public AttendanceSelfHoliday get(EntityManagerContainer emc, String id) throws Exception {
if (id == null || id.isEmpty()) {
return null;
}
return emc.find(id, AttendanceSelfHoliday.class);
}
public List<AttendanceSelfHoliday> list(EntityManagerContainer emc, List<String> ids) throws Exception {
if( ids == null || ids.isEmpty() ){
if (ids == null || ids.isEmpty()) {
return null;
}
Business business = new Business( emc );
return business.getAttendanceSelfHolidayFactory().list( ids );
Business business = new Business(emc);
return business.getAttendanceSelfHolidayFactory().list(ids);
}
public List<String> listAll(EntityManagerContainer emc) throws Exception {
Business business = new Business( emc );
Business business = new Business(emc);
return business.getAttendanceSelfHolidayFactory().listAll();
}
public List<AttendanceSelfHoliday> listWithPersonFromCache( EntityManagerContainer emc, String person, boolean debugger) throws Exception {
//String cacheKey = ApplicationCache.concreteCacheKey( "list#" + person );
//Element element = cache_AttendanceSelfHoliday.get(cacheKey);
CacheKey cacheKey = new CacheKey(this.getClass(),"list" , person);
public List<AttendanceSelfHoliday> listWithPersonFromCache(EntityManagerContainer emc, String person,
boolean debugger) throws Exception {
// String cacheKey = ApplicationCache.concreteCacheKey( "list#" + person );
// Element element = cache_AttendanceSelfHoliday.get(cacheKey);
CacheKey cacheKey = new CacheKey(this.getClass(), "list", person);
Optional<?> optional = CacheManager.get(cache_AttendanceSelfHoliday, cacheKey);
if (optional.isPresent()) {
return ((List<AttendanceSelfHoliday>)optional.get());
}else{
List<String> ids = getByPersonName( emc, person );
List<AttendanceSelfHoliday> list = list( emc, ids );
CacheManager.put(cache_AttendanceSelfHoliday, cacheKey,list);
return ((List<AttendanceSelfHoliday>) optional.get());
} else {
List<String> ids = getByPersonName(emc, person);
List<AttendanceSelfHoliday> list = list(emc, ids);
// detach
JpaObjectTools.detach(emc.get(AttendanceSelfHoliday.class), list);
CacheManager.put(cache_AttendanceSelfHoliday, cacheKey, list);
return list;
}
}
public List<String> getByPersonName(EntityManagerContainer emc, String personName) throws Exception {
Business business = new Business( emc );
return business.getAttendanceSelfHolidayFactory().getByPersonName( personName );
Business business = new Business(emc);
return business.getAttendanceSelfHolidayFactory().getByPersonName(personName);
}
public List<AttendanceSelfHoliday> listWithBatchFlag(EntityManagerContainer emc, String batchFlag) throws Exception {
public List<AttendanceSelfHoliday> listWithBatchFlag(EntityManagerContainer emc, String batchFlag)
throws Exception {
Business business = new Business(emc);
return business.getAttendanceSelfHolidayFactory().listWithBatchFlag( batchFlag );
return business.getAttendanceSelfHolidayFactory().listWithBatchFlag(batchFlag);
}
}
package com.x.base.core.entity.tools;
import java.lang.reflect.Field;
import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
......@@ -8,6 +9,7 @@ import java.util.Objects;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.EntityManager;
import javax.persistence.MappedSuperclass;
import javax.persistence.criteria.Path;
......@@ -18,19 +20,19 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.tools.StringTools;
public class JpaObjectTools {
public static boolean isList(Path<?> path) throws Exception {
public static boolean isList(Path<?> path) {
return List.class.isAssignableFrom(path.getJavaType());
}
public static <T extends JpaObject> Integer definedLength(Class<T> clz, String attribute) throws Exception {
public static <T extends JpaObject> Integer definedLength(Class<T> clz, String attribute) {
Field field = FieldUtils.getField(clz, attribute, true);
return definedLength(clz, field);
}
public static <T extends JpaObject> Integer definedLength(Class<T> clz, Field field) throws Exception {
public static <T extends JpaObject> Integer definedLength(Class<T> clz, Field field) throws IllegalStateException {
if (null == field) {
throw new Exception(
throw new IllegalStateException(
"can not find field with Class:" + clz + ", attribute:" + Objects.toString(field) + ".");
}
Integer length = null;
......@@ -46,28 +48,26 @@ public class JpaObjectTools {
}
}
if (null == length) {
throw new Exception("can not find @Column or @ElementColumn with Class:" + clz + ", attribute:"
throw new IllegalStateException("can not find @Column or @ElementColumn with Class:" + clz + ", attribute:"
+ Objects.toString(field) + ".");
}
return length;
}
public static <T extends JpaObject> boolean withinDefinedLength(String value, Class<T> clz, Field field)
throws Exception {
public static <T extends JpaObject> boolean withinDefinedLength(String value, Class<T> clz, Field field) {
return StringTools.utf8Length(value) < definedLength(clz, field);
}
public static <T extends JpaObject> boolean withinDefinedLength(String value, Class<T> clz, String attribute)
throws Exception {
public static <T extends JpaObject> boolean withinDefinedLength(String value, Class<T> clz, String attribute) {
return StringTools.utf8Length(value) < definedLength(clz, attribute);
}
public static Date confirm(Date date) throws Exception {
public static Date confirm(Date date) {
return (date == null) ? null : new Date(date.getTime());
}
public static Set<Class<?>> scanMappedSuperclass(Class<?> clz) throws Exception {
Set<Class<?>> set = new HashSet<Class<?>>();
public static Set<Class<?>> scanMappedSuperclass(Class<?> clz) {
Set<Class<?>> set = new HashSet<>();
set.add(clz);
Class<?> s = clz.getSuperclass();
while (null != s) {
......@@ -79,4 +79,28 @@ public class JpaObjectTools {
return set;
}
/**
* 将entity对象detach
*
* @param em
* @param objects
*/
public static <T extends JpaObject> void detach(EntityManager em, Collection<T> objects) {
for (JpaObject o : objects) {
em.detach(o);
}
}
/**
* 将entity对象detach
*
* @param em
* @param objects
*/
public static void detach(EntityManager em, JpaObject... objects) {
for (JpaObject o : objects) {
em.detach(o);
}
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.base.core.entity.annotation.CheckRemoveType;
import com.x.base.core.entity.tools.JpaObjectTools;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
......@@ -16,155 +17,163 @@ import com.x.bbs.entity.BBSUserInfo;
/**
* 用户信息管理服务类
*
* @author LIYI
*
*/
public class BBSUserInfoService {
private static Logger logger = LoggerFactory.getLogger( BBSUserInfoService.class );
private static Logger logger = LoggerFactory.getLogger(BBSUserInfoService.class);
/**
* 根据传入的ID从数据库查询BBSUserInfo对象
*
* @param id
* @return
* @throws Exception
*/
public BBSUserInfo get( String id ) throws Exception {
if( id == null || id.isEmpty() ){
throw new Exception( "id is null, return null!" );
public BBSUserInfo get(String id) throws Exception {
if (id == null || id.isEmpty()) {
throw new Exception("id is null, return null!");
}
try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
return emc.find( id, BBSUserInfo.class );
}catch( Exception e ){
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
return emc.find(id, BBSUserInfo.class);
} catch (Exception e) {
throw e;
}
}
/**
* 根据传入的用户姓名从数据库查询BBSUserInfo对象
*
* @param id
* @return
* @throws Exception
*/
public BBSUserInfo getByUserName( String userName ) throws Exception {
if( userName == null || userName.isEmpty() ){
throw new Exception( "userName is null, return null!" );
public BBSUserInfo getByUserName(String userName) throws Exception {
if (userName == null || userName.isEmpty()) {
throw new Exception("userName is null, return null!");
}
Business business = null;
List<BBSUserInfo> userInfoList = null;
try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
business = new Business( emc );
userInfoList = business.userInfoFactory().listByUserName( userName );
if( ListTools.isNotEmpty( userInfoList ) ){
return userInfoList.get( 0 );
}else{
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business(emc);
userInfoList = business.userInfoFactory().listByUserName(userName);
if (ListTools.isNotEmpty(userInfoList)) {
BBSUserInfo o = userInfoList.get(0);
JpaObjectTools.detach(emc.get(BBSUserInfo.class), o);
return o;
} else {
return null;
}
}catch( Exception e ){
} catch (Exception e) {
throw e;
}
}
/**
* 向数据库保存BBSUserInfo对象
*
* @param wrapIn
*/
public BBSUserInfo save( BBSUserInfo _bBSUserInfo ) throws Exception {
if( _bBSUserInfo.getId() == null ){
_bBSUserInfo.setId( BBSUserInfo.createId() );
public BBSUserInfo save(BBSUserInfo _bBSUserInfo) throws Exception {
if (_bBSUserInfo.getId() == null) {
_bBSUserInfo.setId(BBSUserInfo.createId());
}
if( _bBSUserInfo.getUserName() == null ){
throw new Exception( "username is null!" );
if (_bBSUserInfo.getUserName() == null) {
throw new Exception("username is null!");
}
if( _bBSUserInfo.getPermissionContent() == null || _bBSUserInfo.getPermissionContent().isEmpty() ){
_bBSUserInfo.setPermissionContent( "{}" );
if (_bBSUserInfo.getPermissionContent() == null || _bBSUserInfo.getPermissionContent().isEmpty()) {
_bBSUserInfo.setPermissionContent("{}");
}
Business business = null;
BBSUserInfo userInfo = null;
List<BBSUserInfo> userInfoList = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business(emc);
userInfoList = business.userInfoFactory().listByUserName( _bBSUserInfo.getUserName() );
emc.beginTransaction( BBSUserInfo.class );
if( userInfoList == null || userInfoList.isEmpty() ){
logger.info( "userInfoList is null, persist new user info......" );
emc.persist( _bBSUserInfo, CheckPersistType.all);
}else{
logger.info( "userInfoList is not null, update user info......" );
for( int i=0; i< userInfoList.size(); i++ ){
userInfo = userInfoList.get( i );
if( i == 0 ){
_bBSUserInfo.copyTo( userInfo, JpaObject.FieldsUnmodify );//第一条更新,其他删除
emc.check( userInfo, CheckPersistType.all );
}else{
logger.info( "user info more than 1, remove one......" );
emc.remove( userInfo, CheckRemoveType.all );
userInfoList = business.userInfoFactory().listByUserName(_bBSUserInfo.getUserName());
emc.beginTransaction(BBSUserInfo.class);
if (userInfoList == null || userInfoList.isEmpty()) {
logger.info("userInfoList is null, persist new user info......");
emc.persist(_bBSUserInfo, CheckPersistType.all);
} else {
logger.info("userInfoList is not null, update user info......");
for (int i = 0; i < userInfoList.size(); i++) {
userInfo = userInfoList.get(i);
if (i == 0) {
_bBSUserInfo.copyTo(userInfo, JpaObject.FieldsUnmodify);// 第一条更新,其他删除
emc.check(userInfo, CheckPersistType.all);
} else {
logger.info("user info more than 1, remove one......");
emc.remove(userInfo, CheckRemoveType.all);
}
}
}
emc.commit();
}catch( Exception e ){
logger.warn( "system find BBSUserInfo{'id':'"+_bBSUserInfo.getId()+"'} got an exception!" );
emc.commit();
} catch (Exception e) {
logger.warn("system find BBSUserInfo{'id':'" + _bBSUserInfo.getId() + "'} got an exception!");
throw e;
}
return _bBSUserInfo;
}
/**
* 向数据库保存BBSUserInfo对象
*
* @param wrapIn
*/
public BBSUserInfo updatePermissionAndVisit( BBSUserInfo _bBSUserInfo ) throws Exception {
if( _bBSUserInfo.getId() == null ){
_bBSUserInfo.setId( BBSUserInfo.createId() );
public BBSUserInfo updatePermissionAndVisit(BBSUserInfo _bBSUserInfo) throws Exception {
if (_bBSUserInfo.getId() == null) {
_bBSUserInfo.setId(BBSUserInfo.createId());
}
if( _bBSUserInfo.getUserName() == null ){
throw new Exception( "username is null!" );
if (_bBSUserInfo.getUserName() == null) {
throw new Exception("username is null!");
}
if( _bBSUserInfo.getPermissionContent() == null || _bBSUserInfo.getPermissionContent().isEmpty() ){
_bBSUserInfo.setPermissionContent( "{}" );
if (_bBSUserInfo.getPermissionContent() == null || _bBSUserInfo.getPermissionContent().isEmpty()) {
_bBSUserInfo.setPermissionContent("{}");
}
Business business = null;
BBSUserInfo userInfo = null;
List<BBSUserInfo> userInfoList = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business(emc);
userInfoList = business.userInfoFactory().listByUserName( _bBSUserInfo.getUserName() );
emc.beginTransaction( BBSUserInfo.class );
if( userInfoList == null || userInfoList.isEmpty() ){
_bBSUserInfo.setOnline( true );
_bBSUserInfo.setLastVisitTime( new Date() );
emc.persist( _bBSUserInfo, CheckPersistType.all );
}else{
for( int i=0; i< userInfoList.size(); i++ ){
userInfo = userInfoList.get( i );
if( i == 0 ){
userInfo.setOnline( true );
userInfo.setLastVisitTime( new Date() );
userInfo.setPermissionContent( _bBSUserInfo.getPermissionContent() );//第一条更新,其他删除
emc.check( userInfo, CheckPersistType.all );
}else{
emc.remove( userInfo, CheckRemoveType.all );
userInfoList = business.userInfoFactory().listByUserName(_bBSUserInfo.getUserName());
emc.beginTransaction(BBSUserInfo.class);
if (userInfoList == null || userInfoList.isEmpty()) {
_bBSUserInfo.setOnline(true);
_bBSUserInfo.setLastVisitTime(new Date());
emc.persist(_bBSUserInfo, CheckPersistType.all);
} else {
for (int i = 0; i < userInfoList.size(); i++) {
userInfo = userInfoList.get(i);
if (i == 0) {
userInfo.setOnline(true);
userInfo.setLastVisitTime(new Date());
userInfo.setPermissionContent(_bBSUserInfo.getPermissionContent());// 第一条更新,其他删除
emc.check(userInfo, CheckPersistType.all);
} else {
emc.remove(userInfo, CheckRemoveType.all);
}
}
}
emc.commit();
}catch( Exception e ){
logger.warn( "system find BBSUserInfo{'id':'"+_bBSUserInfo.getId()+"'} got an exception!" );
emc.commit();
} catch (Exception e) {
logger.warn("system find BBSUserInfo{'id':'" + _bBSUserInfo.getId() + "'} got an exception!");
throw e;
}
return _bBSUserInfo;
}
/**
* 向数据库保存BBSUserInfo对象
*
* @param wrapIn
*/
public Boolean updatePermission( String userName, String permissionContent ) throws Exception {
if( userName == null ){
throw new Exception( "username is null!" );
public Boolean updatePermission(String userName, String permissionContent) throws Exception {
if (userName == null) {
throw new Exception("username is null!");
}
if( permissionContent == null || permissionContent.isEmpty() ){
if (permissionContent == null || permissionContent.isEmpty()) {
permissionContent = "{}";
}
Business business = null;
......@@ -172,162 +181,164 @@ public class BBSUserInfoService {
List<BBSUserInfo> userInfoList = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business(emc);
userInfoList = business.userInfoFactory().listByUserName( userName );
emc.beginTransaction( BBSUserInfo.class );
if( ListTools.isNotEmpty( userInfoList ) ){
for( int i=0; i< userInfoList.size(); i++ ){
userInfo = userInfoList.get( i );
if( i == 0 ){
userInfo.setPermissionContent( permissionContent );
emc.check( userInfo, CheckPersistType.all );
}else{
emc.remove( userInfo, CheckRemoveType.all );
userInfoList = business.userInfoFactory().listByUserName(userName);
emc.beginTransaction(BBSUserInfo.class);
if (ListTools.isNotEmpty(userInfoList)) {
for (int i = 0; i < userInfoList.size(); i++) {
userInfo = userInfoList.get(i);
if (i == 0) {
userInfo.setPermissionContent(permissionContent);
emc.check(userInfo, CheckPersistType.all);
} else {
emc.remove(userInfo, CheckRemoveType.all);
}
}
}
emc.commit();
return true;
}catch( Exception e ){
} catch (Exception e) {
throw e;
}
}
/**
* 根据ID从数据库中删除BBSUserInfo对象
*
* @param id
* @throws Exception
*/
public void delete( String id ) throws Exception {
public void delete(String id) throws Exception {
BBSUserInfo bBSUserInfo = null;
if( id == null || id.isEmpty() ){
throw new Exception( "id is null, system can not delete any object." );
if (id == null || id.isEmpty()) {
throw new Exception("id is null, system can not delete any object.");
}
try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
//先判断需要操作的应用信息是否存在,根据ID进行一次查询,如果不存在不允许继续操作
bBSUserInfo = emc.find( id, BBSUserInfo.class );
emc.beginTransaction( BBSUserInfo.class );
if ( null == bBSUserInfo ) {
throw new Exception( "object is not exist {'id':'"+ id +"'}" );
}else{
emc.remove( bBSUserInfo, CheckRemoveType.all );
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
// 先判断需要操作的应用信息是否存在,根据ID进行一次查询,如果不存在不允许继续操作
bBSUserInfo = emc.find(id, BBSUserInfo.class);
emc.beginTransaction(BBSUserInfo.class);
if (null == bBSUserInfo) {
throw new Exception("object is not exist {'id':'" + id + "'}");
} else {
emc.remove(bBSUserInfo, CheckRemoveType.all);
}
emc.commit();
} catch ( Exception e ) {
} catch (Exception e) {
throw e;
}
}
/**
* 根据userName从数据库中删除BBSUserInfo对象
*
* @param userName
* @throws Exception
*/
public void deleteByUserName( String userName ) throws Exception {
public void deleteByUserName(String userName) throws Exception {
List<BBSUserInfo> bBSUserInfoList = null;
Business business = null;
if( userName == null || userName.isEmpty() ){
throw new Exception( "userName is null, system can not delete any object." );
if (userName == null || userName.isEmpty()) {
throw new Exception("userName is null, system can not delete any object.");
}
try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business( emc );
//先判断需要操作的应用信息是否存在,根据ID进行一次查询,如果不存在不允许继续操作
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business(emc);
// 先判断需要操作的应用信息是否存在,根据ID进行一次查询,如果不存在不允许继续操作
bBSUserInfoList = business.userInfoFactory().listByUserName(userName);
if( ListTools.isNotEmpty( bBSUserInfoList ) ){
emc.beginTransaction( BBSUserInfo.class );
for( BBSUserInfo userInfo : bBSUserInfoList ){
emc.remove( userInfo, CheckRemoveType.all );
if (ListTools.isNotEmpty(bBSUserInfoList)) {
emc.beginTransaction(BBSUserInfo.class);
for (BBSUserInfo userInfo : bBSUserInfoList) {
emc.remove(userInfo, CheckRemoveType.all);
}
emc.commit();
}
} catch ( Exception e ) {
} catch (Exception e) {
throw e;
}
}
public void save(String userName, Long subjectCount, Long replyCount, Long subjectCountToday, Long replyCountToday,
Long creamCount, Long originalCount, Long fansCount, Long popularity, Long credit,
String permissionContent ) throws Exception {
if( userName == null ){
throw new Exception( "userName is null, system can not save any object." );
Long creamCount, Long originalCount, Long fansCount, Long popularity, Long credit, String permissionContent)
throws Exception {
if (userName == null) {
throw new Exception("userName is null, system can not save any object.");
}
List<BBSUserInfo> userInfoList = null;
BBSUserInfo userInfo = null;
Business business = null;
try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business(emc);
userInfoList = business.userInfoFactory().listByUserName( userName );
emc.beginTransaction( BBSUserInfo.class );
if( ListTools.isNotEmpty( userInfoList ) ){
for( int i=0; i< userInfoList.size(); i++ ){
userInfoList = business.userInfoFactory().listByUserName(userName);
emc.beginTransaction(BBSUserInfo.class);
if (ListTools.isNotEmpty(userInfoList)) {
for (int i = 0; i < userInfoList.size(); i++) {
userInfo = userInfoList.get(i);
if( i == 0 ){
userInfo.setSubjectCount( subjectCount );
if (i == 0) {
userInfo.setSubjectCount(subjectCount);
userInfo.setReplyCount(replyCount);
userInfo.setSubjectCountToday( subjectCountToday );
userInfo.setSubjectCountToday(subjectCountToday);
userInfo.setReplyCountToday(replyCountToday);
userInfo.setCreamCount(creamCount);
userInfo.setOriginalCount(originalCount);
userInfo.setFansCount(fansCount);
if( permissionContent == null || permissionContent.isEmpty() ){
if (permissionContent == null || permissionContent.isEmpty()) {
permissionContent = "{}";
}
userInfo.setPermissionContent( permissionContent );
userInfo.setPermissionContent(permissionContent);
userInfo.setPopularity(popularity);
userInfo.setCredit( credit );
if( userInfo.getLastVisitTime() == null ) {
userInfo.setLastVisitTime( userInfo.getUpdateTime() );
userInfo.setCredit(credit);
if (userInfo.getLastVisitTime() == null) {
userInfo.setLastVisitTime(userInfo.getUpdateTime());
}
emc.check( userInfo, CheckPersistType.all );
}else{
emc.remove( userInfo, CheckRemoveType.all );
emc.check(userInfo, CheckPersistType.all);
} else {
emc.remove(userInfo, CheckRemoveType.all);
}
}
}else{
} else {
permissionContent = "{}";
userInfo = new BBSUserInfo();
userInfo.setUserName( userName );
userInfo.setNickName( userName );
userInfo.setUserName(userName);
userInfo.setNickName(userName);
userInfo.setMobile("");
userInfo.setSubjectCount( subjectCount );
userInfo.setSubjectCount(subjectCount);
userInfo.setReplyCount(replyCount);
userInfo.setSubjectCountToday( subjectCountToday );
userInfo.setSubjectCountToday(subjectCountToday);
userInfo.setReplyCountToday(replyCountToday);
userInfo.setCreamCount(creamCount);
userInfo.setOriginalCount(originalCount);
userInfo.setFansCount(fansCount);
userInfo.setPermissionContent( permissionContent );
userInfo.setPermissionContent(permissionContent);
userInfo.setPopularity(popularity);
userInfo.setCredit( credit );
emc.persist( userInfo, CheckPersistType.all );
userInfo.setCredit(credit);
emc.persist(userInfo, CheckPersistType.all);
}
emc.commit();
}catch( Exception e ){
} catch (Exception e) {
throw e;
}
}
public void logout( String userName ) throws Exception {
public void logout(String userName) throws Exception {
List<BBSUserInfo> userInfoList = null;
BBSUserInfo userInfo = null;
Business business = null;
try ( EntityManagerContainer emc = EntityManagerContainerFactory.instance().create() ) {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
business = new Business(emc);
userInfoList = business.userInfoFactory().listByUserName( userName );
emc.beginTransaction( BBSUserInfo.class );
if( ListTools.isNotEmpty( userInfoList ) ){
for( int i=0; i< userInfoList.size(); i++ ){
userInfoList = business.userInfoFactory().listByUserName(userName);
emc.beginTransaction(BBSUserInfo.class);
if (ListTools.isNotEmpty(userInfoList)) {
for (int i = 0; i < userInfoList.size(); i++) {
userInfo = userInfoList.get(i);
if( i == 0 ){
userInfo.setOnline( false );
emc.check( userInfo, CheckPersistType.all );
}else{//删除一个以上的同名用户信息
emc.remove( userInfo, CheckRemoveType.all );
if (i == 0) {
userInfo.setOnline(false);
emc.check(userInfo, CheckPersistType.all);
} else {// 删除一个以上的同名用户信息
emc.remove(userInfo, CheckRemoveType.all);
}
}
}
emc.commit();
}catch( Exception e ){
} catch (Exception e) {
throw e;
}
}
......
......@@ -71,7 +71,6 @@ public class ActionQueryViewDocument extends BaseAction {
if (optional.isPresent()) {
result = (ActionResult<Wo>) optional.get();
} else {
logger.debug(">>>>>>>>>>>>>view document '"+id+"' in database!" );
//继续进行数据查询
result = getDocumentQueryResult( id, request, effectivePerson, isManager );
CacheManager.put(cacheCategory, cacheKey, result );
......
......@@ -61,7 +61,7 @@ public class ActionListByApp extends BaseAction {
private static final long serialVersionUID = -5076990764713538973L;
public static List<String> excludes = new ArrayList<String>();
public static List<String> excludes = new ArrayList<>();
public static final WrapCopier<Form, Wo> copier = WrapCopierFactory.wo(Form.class, Wo.class, null, JpaObject.FieldsInvisible);
......
......@@ -19,6 +19,7 @@ import javax.ws.rs.core.MediaType;
import com.google.gson.JsonElement;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
......@@ -56,7 +57,7 @@ public class ComponentAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("flag") String flag) {
@JaxrsParameterDescribe("标识") @PathParam("flag") String flag) {
ActionResult<ActionGet.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -91,7 +92,7 @@ public class ComponentAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void edit(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("flag") String flag, JsonElement jsonElement) {
@JaxrsParameterDescribe("标识") @PathParam("flag") String flag, JsonElement jsonElement) {
ActionResult<ActionEdit.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -109,7 +110,7 @@ public class ComponentAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("flag") String flag) {
@JaxrsParameterDescribe("标识") @PathParam("flag") String flag) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......
......@@ -22,13 +22,14 @@ import java.util.List;
public class HotPictureInfoAction extends StandardJaxrsAction {
private Logger logger = LoggerFactory.getLogger(HotPictureInfoAction.class);
@JaxrsMethodDescribe(value = "检查所有的热点新闻还在不在", action= ActionCheck.class )
@JaxrsMethodDescribe(value = "检查所有的热点新闻还在不在", action = ActionCheck.class)
@GET
@Path("exists/check")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void existsCheck(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionCheck.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -39,9 +40,8 @@ public class HotPictureInfoAction extends StandardJaxrsAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "查询指定的图片的base64编码", action= ActionGet.class )
@JaxrsMethodDescribe(value = "查询指定的图片的base64编码", action = ActionGet.class)
@GET
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
......@@ -51,7 +51,7 @@ public class HotPictureInfoAction extends StandardJaxrsAction {
ActionResult<ActionGet.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionGet().execute(effectivePerson,id);
result = new ActionGet().execute(effectivePerson, id);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
......@@ -59,122 +59,127 @@ public class HotPictureInfoAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据应用类型以及信息ID查询热图信息", action= ActionGetList.class )
@JaxrsMethodDescribe(value = "根据应用类型以及信息ID查询热图信息", action = ActionGetList.class)
@GET
@Path("{application}/{infoId}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listByApplicationAndInfoId(@Suspended final AsyncResponse asyncResponse,@Context HttpServletRequest request,
public void listByApplicationAndInfoId(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request,
@JaxrsParameterDescribe("应用名称:CMS|BBS等等.") @PathParam("application") String application,
@JaxrsParameterDescribe("信息id") @PathParam("infoId") String infoId) {
ActionResult<List<ActionGetList.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionGetList().execute(effectivePerson,application,infoId);
} catch (Exception e) {
result = new ActionGetList().execute(effectivePerson, application, infoId);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示根据过滤条件的HotPictureInfo,下一页", action= ActionGetListForPage.class )
@JaxrsMethodDescribe(value = "列示根据过滤条件的HotPictureInfo,下一页", action = ActionGetListForPage.class)
@PUT
@Path("filter/list/page/{page}/count/{count}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listForPage(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("当前页码") @PathParam("page") Integer page,
@JaxrsParameterDescribe("当前页码") @PathParam("page") Integer page,
@JaxrsParameterDescribe("每页数量") @PathParam("count") Integer count, JsonElement jsonElement) {
ActionResult<List<ActionGetListForPage.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionGetListForPage().execute(effectivePerson,page,count,jsonElement);
} catch (Exception e) {
result = new ActionGetListForPage().execute(effectivePerson, page, count, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
/**
* 保存热图信息,登录用户访问
*
* @param request
* @return
*/
@JaxrsMethodDescribe(value = "创建新的热图信息或者更新热图信息", action= ActionSave.class )
@JaxrsMethodDescribe(value = "创建新的热图信息或者更新热图信息", action = ActionSave.class)
@POST
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void save(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,JsonElement jsonElement) {
public void save(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
JsonElement jsonElement) {
ActionResult<ActionSave.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionSave().execute(effectivePerson,jsonElement);
} catch (Exception e) {
result = new ActionSave().execute(effectivePerson, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
/**
* 修改已经存在的热点图片的标题信息
*
* @param request
* @return
*/
@JaxrsMethodDescribe(value = "修改已经存在的热点图片的标题信息", action= ActionChangeTitle.class )
@JaxrsMethodDescribe(value = "修改已经存在的热点图片的标题信息", action = ActionChangeTitle.class)
@Path("changeTitle")
@POST
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void changeTitle(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,JsonElement jsonElement) {
public void changeTitle(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
JsonElement jsonElement) {
ActionResult<ActionChangeTitle.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionChangeTitle().execute(effectivePerson,jsonElement);
} catch (Exception e) {
result = new ActionChangeTitle().execute(effectivePerson, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据ID删除指定的热图信息", action= ActionDeleteById.class )
@JaxrsMethodDescribe(value = "根据ID删除指定的热图信息", action = ActionDeleteById.class)
@DELETE
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("信息ID") @PathParam("id") String id) {
@JaxrsParameterDescribe("信息标识") @PathParam("id") String id) {
ActionResult<ActionDeleteById.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionDeleteById().execute(effectivePerson,id);
} catch (Exception e) {
result = new ActionDeleteById().execute(effectivePerson, id);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "根据应用类型以及信息ID删除热图信息", action= ActionDelete.class )
@JaxrsMethodDescribe(value = "根据应用类型以及信息ID删除热图信息", action = ActionDelete.class)
@DELETE
@Path("{application}/{infoId}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("application") String application, @PathParam("infoId") String infoId) {
@JaxrsParameterDescribe("应用标识") @PathParam("application") String application,
@JaxrsParameterDescribe("信息标识") @PathParam("infoId") String infoId) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionDelete().execute(effectivePerson,application,infoId);
} catch (Exception e) {
result = new ActionDelete().execute(effectivePerson, application, infoId);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
\ No newline at end of file
......@@ -19,6 +19,7 @@ import javax.ws.rs.core.MediaType;
import com.google.gson.JsonElement;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
......@@ -39,7 +40,7 @@ public class BuildingAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionGet.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -74,8 +75,8 @@ public class BuildingAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listWithStartCompleted(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @PathParam("start") String start,
@PathParam("completed") String completed) {
@Context HttpServletRequest request, @JaxrsParameterDescribe("开始时间") @PathParam("start") String start,
@JaxrsParameterDescribe("结束时间") @PathParam("completed") String completed) {
ActionResult<List<ActionListWithStartCompleted.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -93,19 +94,21 @@ public class BuildingAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listWithStartCompletedRoom(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @PathParam("start") String start,
@PathParam("completed") String completed , @PathParam("room") String room , @PathParam("meeting") String meetingId) {
@Context HttpServletRequest request, @JaxrsParameterDescribe("开始时间") @PathParam("start") String start,
@JaxrsParameterDescribe("结束时间") @PathParam("completed") String completed,
@JaxrsParameterDescribe("会议室标识") @PathParam("room") String room,
@JaxrsParameterDescribe("会议标识") @PathParam("meeting") String meetingId) {
ActionResult<List<ActionListWithStartCompletedRoom.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListWithStartCompletedRoom().execute(effectivePerson, start, completed,room,meetingId);
result = new ActionListWithStartCompletedRoom().execute(effectivePerson, start, completed, room, meetingId);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "创建Building.", action = ActionCreate.class)
@POST
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
......@@ -129,7 +132,7 @@ public class BuildingAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void put(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, JsonElement jsonElement) {
@JaxrsParameterDescribe("建筑标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionEdit.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -147,7 +150,7 @@ public class BuildingAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("建筑标识") @PathParam("id") String id) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -165,7 +168,7 @@ public class BuildingAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listPinyinInitial(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("key") String key) {
@JaxrsParameterDescribe("拼音首字母") @PathParam("key") String key) {
ActionResult<List<ActionListPinyinInitial.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -183,7 +186,7 @@ public class BuildingAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listLike(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("key") String key) {
@JaxrsParameterDescribe("拼音首字母") @PathParam("key") String key) {
ActionResult<List<ActionListLike.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -201,7 +204,7 @@ public class BuildingAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listLikePinyin(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("key") String key) {
@JaxrsParameterDescribe("拼音首字母") @PathParam("key") String key) {
ActionResult<List<ActionListLikePinyin.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......
......@@ -39,7 +39,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id) {
ActionResult<ActionGet.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -74,7 +74,7 @@ public class MeetingAction extends BaseAction {
@Consumes(MediaType.APPLICATION_JSON)
@Path("{id}")
public void edit(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, JsonElement jsonElement) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionEdit.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -85,14 +85,14 @@ public class MeetingAction extends BaseAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "修改会议、标题、说明、邀请人", action = ActionModify.class)
@POST
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
@Path("{id}")
public void modify(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, JsonElement jsonElement) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionModify.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -103,7 +103,6 @@ public class MeetingAction extends BaseAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "会议提前开始,修改开始时间", action = ActionEditStartTime.class)
@PUT
......@@ -111,7 +110,7 @@ public class MeetingAction extends BaseAction {
@Consumes(MediaType.APPLICATION_JSON)
@Path("{id}/modify/starttime")
public void editStartTime(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, JsonElement jsonElement) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionEditStartTime.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -122,14 +121,14 @@ public class MeetingAction extends BaseAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "会议提前结束,修改结束时间", action = ActionEditCompleteTime.class)
@PUT
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
@Path("{id}/modify/completedtime")
public void editCompletedTime(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, JsonElement jsonElement) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionEditCompleteTime.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -140,14 +139,14 @@ public class MeetingAction extends BaseAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "删除会议.", action = ActionDelete.class)
@DELETE
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -165,7 +164,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void confirmAllow(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id) {
ActionResult<ActionConfirmAllow.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -183,7 +182,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void confirmDeny(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id) {
ActionResult<ActionConfirmDeny.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -201,7 +200,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void accpet(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id) {
ActionResult<ActionAccept.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -212,14 +211,14 @@ public class MeetingAction extends BaseAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "删除会议邀请人.", action = ActionDeleteInvite.class)
@PUT
@Path("{id}/delete/invite")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void deleteInvite(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, JsonElement jsonElement) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionDeleteInvite.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -230,15 +229,14 @@ public class MeetingAction extends BaseAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "会议签到", action = ActionCheckIn.class)
@GET
@Path("{id}/checkin")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void checkin(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id) {
ActionResult<ActionCheckIn.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -249,14 +247,14 @@ public class MeetingAction extends BaseAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "会议签到二维码", action = ActionCheckInCode.class)
@GET
@Path("{id}/checkin/code")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void checkInBindCode(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id) {
ActionResult<ActionCheckInCode.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -274,7 +272,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void reject(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id) {
ActionResult<ActionReject.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -292,7 +290,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void manualCompleted(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id) {
ActionResult<ActionManualCompleted.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -310,7 +308,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void addInvite(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, JsonElement jsonElement) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionAddInvite.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -328,7 +326,8 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listNext(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, @PathParam("count") Integer count) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionListNext.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -346,7 +345,8 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listPrev(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, @PathParam("count") Integer count) {
@JaxrsParameterDescribe("会议标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionListPrev.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -364,7 +364,8 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listMeetingPaging(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("page") Integer page , @PathParam("size") Integer size, JsonElement jsonElement) {
@JaxrsParameterDescribe("分页") @PathParam("page") Integer page,
@JaxrsParameterDescribe("数量") @PathParam("size") Integer size, JsonElement jsonElement) {
ActionResult<List<ActionPaging.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -375,14 +376,15 @@ public class MeetingAction extends BaseAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "管理员,分页列示Meeing对象", action = ActionPagingManage.class)
@POST
@Path("list/{page}/size/{size}/manage")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listMeetingPagingManage(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("page") Integer page , @PathParam("size") Integer size , JsonElement jsonElement) {
public void listMeetingPagingManage(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @JaxrsParameterDescribe("页面") @PathParam("page") Integer page,
@JaxrsParameterDescribe("数量") @PathParam("size") Integer size, JsonElement jsonElement) {
ActionResult<List<ActionPagingManage.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -393,14 +395,14 @@ public class MeetingAction extends BaseAction {
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示我参与从当前日期开始指定月份范围的会议,或者被邀请,或者是申请人,或者是审核人,管理员可以看到所有.", action = ActionListComingMonth.class)
@GET
@Path("list/coming/month/{count}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listComingMonth(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("count") Integer count) {
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionListComingMonth.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -418,7 +420,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listComingDay(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("count") Integer count) {
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionListComingDay.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -436,7 +438,8 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listOnMonth(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("year") Integer year, @PathParam("month") Integer month) {
@JaxrsParameterDescribe("年") @PathParam("year") Integer year,
@JaxrsParameterDescribe("月") @PathParam("month") Integer month) {
ActionResult<List<ActionListOnMonth.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -454,7 +457,8 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listOnMonthAll(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("year") Integer year, @PathParam("month") Integer month) {
@JaxrsParameterDescribe("年") @PathParam("year") Integer year,
@JaxrsParameterDescribe("月") @PathParam("month") Integer month) {
ActionResult<List<ActionListOnMonthAll.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -472,7 +476,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listForwardMonth(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("monthCount") Integer monthCount) {
@JaxrsParameterDescribe("制定月数") @PathParam("monthCount") Integer monthCount) {
ActionResult<List<ActionListForwardMonth.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -490,7 +494,7 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listForwardMonthAll(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("monthCount") Integer monthCount) {
@JaxrsParameterDescribe("制定月数") @PathParam("monthCount") Integer monthCount) {
ActionResult<List<ActionListForwardMonthAll.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -508,7 +512,9 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listOnDay(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("year") Integer year, @PathParam("month") Integer month, @PathParam("day") Integer day) {
@JaxrsParameterDescribe("年") @PathParam("year") Integer year,
@JaxrsParameterDescribe("月") @PathParam("month") Integer month,
@JaxrsParameterDescribe("日") @PathParam("day") Integer day) {
ActionResult<List<ActionListOnDay.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -526,7 +532,9 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listOnDayAll(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("year") Integer year, @PathParam("month") Integer month, @PathParam("day") Integer day) {
@JaxrsParameterDescribe("年") @PathParam("year") Integer year,
@JaxrsParameterDescribe("月") @PathParam("month") Integer month,
@JaxrsParameterDescribe("日") @PathParam("day") Integer day) {
ActionResult<List<ActionListOnDayAll.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -544,18 +552,21 @@ public class MeetingAction extends BaseAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listOnDayByRoomID(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("年份") @PathParam("year") Integer year,@JaxrsParameterDescribe("月份") @PathParam("month") Integer month, @JaxrsParameterDescribe("日") @PathParam("day") Integer day, @JaxrsParameterDescribe("会议室记录ID") @PathParam("roomId") String roomId) {
@JaxrsParameterDescribe("年") @PathParam("year") Integer year,
@JaxrsParameterDescribe("月") @PathParam("month") Integer month,
@JaxrsParameterDescribe("日") @PathParam("day") Integer day,
@JaxrsParameterDescribe("会议室记录ID") @PathParam("roomId") String roomId) {
ActionResult<List<ActionListOnDayByRoomID.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListOnDayByRoomID().execute(effectivePerson, year, month, day,roomId);
result = new ActionListOnDayByRoomID().execute(effectivePerson, year, month, day, roomId);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示等待我确认的会议.", action = ActionWaitConfirm.class)
@GET
@Path("list/wait/confirm")
......
......@@ -60,7 +60,7 @@ public class RoomAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议室标识") @PathParam("id") String id) {
ActionResult<ActionGet.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -95,7 +95,7 @@ public class RoomAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void edit(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, JsonElement jsonElement) {
@JaxrsParameterDescribe("会议室标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionEdit.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -113,7 +113,7 @@ public class RoomAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("会议室标识") @PathParam("id") String id) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -131,7 +131,7 @@ public class RoomAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listPinyinInitial(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("key") String key) {
@JaxrsParameterDescribe("拼音首字母") @PathParam("key") String key) {
ActionResult<List<ActionListPinyinInitial.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -149,7 +149,7 @@ public class RoomAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listLike(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("key") String key) {
@JaxrsParameterDescribe("拼音首字母") @PathParam("key") String key) {
ActionResult<List<ActionListLike.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -167,7 +167,7 @@ public class RoomAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listLikePinyin(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("key") String key) {
@JaxrsParameterDescribe("拼音首字母") @PathParam("key") String key) {
ActionResult<List<ActionListLike.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......
......@@ -94,8 +94,8 @@ public class OauthAction extends StandardJaxrsAction {
@GET
@Path("token")
public void getToken(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response, @QueryParam("code") String code,
@QueryParam("grant_type") String grant_type,
@Context HttpServletResponse response, @JaxrsParameterDescribe("code") @QueryParam("code") String code,
@JaxrsParameterDescribe("grant_type") @QueryParam("grant_type") String grant_type,
@JaxrsParameterDescribe("response CONTENT_TYPE 设置 默认为text/plain; charset=UTF-8") @QueryParam("contentType") String contentType) {
ActionResult<ActionToken.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
......@@ -113,7 +113,8 @@ public class OauthAction extends StandardJaxrsAction {
@Path("info")
@Consumes({ MediaType.MULTIPART_FORM_DATA, MediaType.APPLICATION_FORM_URLENCODED })
public void postInfo(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response, @FormParam("access_token") String access_token,
@Context HttpServletResponse response,
@JaxrsParameterDescribe("access_token") @FormParam("access_token") String access_token,
@JaxrsParameterDescribe("response CONTENT_TYPE 设置 默认为text/plain; charset=UTF-8") @FormParam("contentType") String contentType) {
ActionResult<ActionInfo.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
......@@ -149,7 +150,8 @@ public class OauthAction extends StandardJaxrsAction {
@Path("info")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void getInfo(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response, @QueryParam("access_token") String access_token,
@Context HttpServletResponse response,
@JaxrsParameterDescribe("access_token") @QueryParam("access_token") String access_token,
@JaxrsParameterDescribe("response CONTENT_TYPE 设置 默认为text/plain; charset=UTF-8") @QueryParam("contentType") String contentType) {
ActionResult<ActionInfo.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
......@@ -168,7 +170,8 @@ public class OauthAction extends StandardJaxrsAction {
@Consumes({ MediaType.MULTIPART_FORM_DATA, MediaType.APPLICATION_FORM_URLENCODED })
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
public void getInfoJira(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response, @QueryParam("access_token") String access_token) {
@Context HttpServletResponse response,
@JaxrsParameterDescribe("access_token") @QueryParam("access_token") String access_token) {
ActionResult<ActionInfo.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......
......@@ -207,14 +207,8 @@ public class UnitFactory extends AbstractFactory {
/** 级别从1开始 */
o.setLevel(list.size() + 1);
List<String> names = ListTools.extractProperty(list, "name", String.class, false, false);
// Collections.reverse(names);
names.add(o.getName());
o.setLevelName(StringUtils.join(names, PersistenceProperties.Unit.levelNameSplit));
// List<String> inheritControllerList = new ArrayList<>();
// for (Unit u : list) {
// inheritControllerList.addAll(u.getControllerList());
// }
// o.setInheritedControllerList(ListTools.trim(inheritControllerList, true, true));
}
}
......
......@@ -16,6 +16,7 @@ import javax.ws.rs.core.MediaType;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
......@@ -106,8 +107,10 @@ public class ExmailAction extends StandardJaxrsAction {
@JaxrsMethodDescribe(value = "接收腾讯企业邮回调Get方法.", action = ActionGet.class)
@GET
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@QueryParam("msg_signature") String msg_signature, @QueryParam("timestamp") String timestamp,
@QueryParam("nonce") String nonce, @QueryParam("echostr") String echostr) {
@JaxrsParameterDescribe("msg_signature") @QueryParam("msg_signature") String msg_signature,
@JaxrsParameterDescribe("timestamp") @QueryParam("timestamp") String timestamp,
@JaxrsParameterDescribe("nonce") @QueryParam("nonce") String nonce,
@JaxrsParameterDescribe("echostr") @QueryParam("echostr") String echostr) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<ActionGet.Wo> result = new ActionResult<>();
try {
......@@ -132,8 +135,9 @@ public class ExmailAction extends StandardJaxrsAction {
@JaxrsMethodDescribe(value = "接收腾讯企业邮回调Post方法.", action = ActionCallback.class)
@POST
public void callback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@QueryParam("msg_signature") String msg_signature, @QueryParam("timestamp") String timestamp,
@QueryParam("nonce") String nonce, String body) {
@JaxrsParameterDescribe("msg_signature") @QueryParam("msg_signature") String msg_signature,
@JaxrsParameterDescribe("timestamp") @QueryParam("timestamp") String timestamp,
@JaxrsParameterDescribe("nonce") @QueryParam("nonce") String nonce, String body) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<ActionCallback.Wo> result = new ActionResult<>();
try {
......
......@@ -16,6 +16,7 @@ import javax.ws.rs.core.MediaType;
import com.google.gson.JsonElement;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
......@@ -37,7 +38,7 @@ public class ResetAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void checkCredential(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("credential") String credential) {
@JaxrsParameterDescribe("用户标识") @PathParam("credential") String credential) {
ActionResult<WrapOutBoolean> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -55,7 +56,7 @@ public class ResetAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void checkPassword(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("password") String password) {
@JaxrsParameterDescribe("密码") @PathParam("password") String password) {
ActionResult<ActionCheckPassword.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -73,7 +74,7 @@ public class ResetAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void code(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("credential") String credential) {
@JaxrsParameterDescribe("用户标识") @PathParam("credential") String credential) {
ActionResult<WrapOutBoolean> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......
......@@ -774,7 +774,8 @@ public class PeriodAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listCountExpiredWorkByApplication(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @PathParam("unit") String unit, @PathParam("person") String person) {
@Context HttpServletRequest request, @JaxrsParameterDescribe("组织标识") @PathParam("unit") String unit,
@JaxrsParameterDescribe("用户标识") @PathParam("person") String person) {
ActionResult<ActionListCountExpiredWorkByApplication.Wo> result = new ActionResult<>();
try {
result = new ActionListCountExpiredWorkByApplication().execute(unit, person);
......
......@@ -15,6 +15,7 @@ import javax.ws.rs.core.MediaType;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
......@@ -51,8 +52,9 @@ public class CaptchaAction extends StandardJaxrsAction {
@Path("v2/create/width/{width}/height/{height}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void V2Create(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("width") Integer width, @PathParam("height") Integer height) {
public void v2Create(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("像素宽度") @PathParam("width") Integer width,
@JaxrsParameterDescribe("像素高度") @PathParam("height") Integer height) {
ActionResult<V2Create.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -70,7 +72,8 @@ public class CaptchaAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void validate(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, @PathParam("answer") String answer) {
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("验证码") @PathParam("answer") String answer) {
ActionResult<ActionValidate.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......
......@@ -32,7 +32,7 @@ public class CollectAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void code(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("mobile") String mobile) {
@JaxrsParameterDescribe("手机号") @PathParam("mobile") String mobile) {
ActionResult<ActionCode.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -168,8 +168,8 @@ public class CollectAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
@JaxrsMethodDescribe(value = "验证短信验证码是否正确.", action = ActionValidateCodeAnswer.class)
public void validateCodeAnswer(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, JsonElement jsonElement) {
public void validateCodeAnswer(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
JsonElement jsonElement) {
ActionResult<ActionValidateCodeAnswer.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -205,7 +205,7 @@ public class CollectAction extends StandardJaxrsAction {
@Consumes(MediaType.APPLICATION_JSON)
@JaxrsMethodDescribe(value = "测试用户名是否可用.", action = ActionExist.class)
public void exist(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("name") String name) {
@JaxrsParameterDescribe("用户名称") @PathParam("name") String name) {
ActionResult<ActionExist.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -223,7 +223,8 @@ public class CollectAction extends StandardJaxrsAction {
@Consumes(MediaType.APPLICATION_JSON)
@JaxrsMethodDescribe(value = "测试手机号码是否在管理手机列表中", action = ActionControllerMobile.class)
public void controllerMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("name") String name, @PathParam("mobile") String mobile) {
@JaxrsParameterDescribe("用户名称") @PathParam("name") String name,
@JaxrsParameterDescribe("手机号") @PathParam("mobile") String mobile) {
ActionResult<ActionControllerMobile.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -310,9 +311,9 @@ public class CollectAction extends StandardJaxrsAction {
@Consumes(MediaType.APPLICATION_JSON)
@JaxrsMethodDescribe(value = "删除collect上的unit.", action = ActionDelete.class)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("组织名称") @PathParam("name") String name,
@JaxrsParameterDescribe("手机号") @PathParam("mobile") String mobile,
@JaxrsParameterDescribe("短信认证码") @PathParam("code") String code) {
@JaxrsParameterDescribe("组织名称") @PathParam("name") String name,
@JaxrsParameterDescribe("手机号") @PathParam("mobile") String mobile,
@JaxrsParameterDescribe("短信认证码") @PathParam("code") String code) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -330,7 +331,7 @@ public class CollectAction extends StandardJaxrsAction {
@Consumes(MediaType.APPLICATION_JSON)
@JaxrsMethodDescribe(value = "更新在collect服务器上的unit.", action = ActionUpdateUnit.class)
public void updateUnit(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
JsonElement jsonElement) {
JsonElement jsonElement) {
ActionResult<ActionUpdateUnit.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -348,7 +349,7 @@ public class CollectAction extends StandardJaxrsAction {
@Consumes(MediaType.APPLICATION_JSON)
@JaxrsMethodDescribe(value = "登录collect服务", action = ActionLogin.class)
public void login(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@Context HttpServletResponse response) {
@Context HttpServletResponse response) {
ActionResult<ActionLogin.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -383,11 +384,11 @@ public class CollectAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void updateUrlMapping(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
WrapInUrlMapping wrapIn) {
WrapInUrlMapping wrapIn) {
ActionResult<ActionUpdateUnitUrlMapping.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionUpdateUnitUrlMapping().execute(effectivePerson,wrapIn);
result = new ActionUpdateUnitUrlMapping().execute(effectivePerson, wrapIn);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
......
......@@ -65,19 +65,18 @@ public class DingdingAction extends StandardJaxrsAction {
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "获取钉钉回调的EncodingAESKey.", action = ActionCallbackAESKey.class)
@GET
@Path("get/callback/aes")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void syncOrganizationCallbackEncodingAESKeyGet(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request) {
@Context HttpServletRequest request) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<ActionCallbackAESKey.Wo> result = new ActionResult<>();
try {
result = new ActionCallbackAESKey().execute(effectivePerson);
}catch (Exception e) {
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
......@@ -89,8 +88,9 @@ public class DingdingAction extends StandardJaxrsAction {
@Path("sync/organization/register/callback/{enable}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void registerSyncOrgCallbackUrl(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("注册回调地址还是更新") @PathParam("enable") boolean enable) {
public void registerSyncOrgCallbackUrl(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request,
@JaxrsParameterDescribe("注册回调地址还是更新") @PathParam("enable") boolean enable) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<ActionSyncOrganizationCallbackUrlRegister.Wo> result = new ActionResult<>();
try {
......@@ -104,6 +104,7 @@ public class DingdingAction extends StandardJaxrsAction {
/**
* 钉钉回调用的post接口 需要返回固定格式的json字符串
*
* @param asyncResponse
* @param request
* @param signature
......@@ -116,12 +117,15 @@ public class DingdingAction extends StandardJaxrsAction {
@Path("sync/organization/callback")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void syncOrganizationCallback(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@QueryParam("signature") String signature, @QueryParam("timestamp") String timestamp,
@QueryParam("nonce") String nonce, JsonElement jsonElement) {
public void syncOrganizationCallback(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request,
@JaxrsParameterDescribe("signature") @QueryParam("signature") String signature,
@JaxrsParameterDescribe("timestamp") @QueryParam("timestamp") String timestamp,
@JaxrsParameterDescribe("nonce") @QueryParam("nonce") String nonce, JsonElement jsonElement) {
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
Map<String, String> json = new ActionSyncOrganizationCallbackPost().execute(effectivePerson, signature, timestamp, nonce, jsonElement);
Map<String, String> json = new ActionSyncOrganizationCallbackPost().execute(effectivePerson, signature,
timestamp, nonce, jsonElement);
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
asyncResponse.resume(Response.ok(gson.toJson(json)).build());
} catch (Exception e) {
......@@ -129,8 +133,6 @@ public class DingdingAction extends StandardJaxrsAction {
asyncResponse.resume(Response.serverError().entity("fail").build());
}
// asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
......
......@@ -13,28 +13,35 @@ import javax.ws.rs.core.MediaType;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
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("distribute")
@JaxrsDescribe("分配模块")
public class DistributeAction extends StandardJaxrsAction {
private static final Logger LOGGER = LoggerFactory.getLogger(DistributeAction.class);
@GET
@Path("assemble/source/{source}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
@JaxrsMethodDescribe(value = "为用户分派应用主机。", action = ActionAssemble.class)
public void assemble(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("source") String source) {
@JaxrsParameterDescribe("访问主机名") @PathParam("source") String source) {
ActionResult<ActionAssemble.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionAssemble().execute(request, source);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
} catch (Exception e) {
LOGGER.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
......@@ -45,13 +52,14 @@ public class DistributeAction extends StandardJaxrsAction {
@Consumes(MediaType.APPLICATION_JSON)
@JaxrsMethodDescribe(value = "为用户分派应用主机和Web主机。", action = ActionAssembleWithWebServer.class)
public void assembleWithWebServer(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("source") String source) {
@JaxrsParameterDescribe("访问主机名") @PathParam("source") String source) {
ActionResult<ActionAssembleWithWebServer.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionAssembleWithWebServer().execute(request, source);
} catch (Throwable th) {
th.printStackTrace();
result.error(th);
} catch (Exception e) {
LOGGER.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
......
......@@ -3,6 +3,7 @@ package com.x.program.center.jaxrs.mpweixin;
import com.google.gson.JsonElement;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
......@@ -20,154 +21,151 @@ import javax.ws.rs.core.MediaType;
import java.io.InputStream;
/**
* 微信公众号接口
* Created by fancyLou on 3/8/21.
* Copyright © 2021 O2. All rights reserved.
* 微信公众号接口 Created by fancyLou on 3/8/21. Copyright © 2021 O2. All rights
* reserved.
*/
@Path("mpweixin")
@JaxrsDescribe("微信公众号接口")
public class MPWeixinAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(MPWeixinAction.class);
@JaxrsMethodDescribe(value = "给微信公众号后台检测服务器配置.", action = ActionCheckMPWeixin.class)
@GET
@Path("check")
public void check(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @QueryParam("signature") String signature,
@QueryParam("timestamp") Long timestamp, @QueryParam("nonce") String nonce,
@QueryParam("echostr") String echostr) {
ActionResult<ActionCheckMPWeixin.Wo> result = new ActionResult<>();
try {
result = new ActionCheckMPWeixin().execute(signature, timestamp, nonce, echostr);
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "微信公众号接收消息.", action = ActionReceiveMsg.class)
@POST
@Path("check")
public void receiveMsg(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @QueryParam("signature") String signature,
@QueryParam("timestamp") Long timestamp, @QueryParam("nonce") String nonce,
@QueryParam("echostr") String echostr, InputStream inputStream) {
ActionResult<ActionReceiveMsg.Wo> result = new ActionResult<>();
try {
result = new ActionReceiveMsg().execute(signature, timestamp, nonce, echostr, inputStream);
}catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
// /menu/* 需要管理员权限
@JaxrsMethodDescribe(value = "微信菜单列表查看.", action = ActionListAllMenu.class)
@GET
@Path("menu/list/weixin")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuWeixinList(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionListAllMenu.Wo> result = new ActionResult<>();
try {
result = new ActionListAllMenu().execute();
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "微信公众号关注回复的菜单对象.", action = ActionSubscribeMenu.class)
@GET
@Path("menu/subscribe")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuWeixinSubscribe(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionSubscribeMenu.WoMenu> result = new ActionResult<>();
try {
result = new ActionSubscribeMenu().execute();
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "给微信公众号创建菜单,【注意这个接口会把公众号菜单全部替换掉!】.", action = ActionCreateMenu.class)
@GET
@Path("menu/create/to/weixin")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuCreate2Weixin(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionCreateMenu.Wo> result = new ActionResult<>();
try {
result = new ActionCreateMenu().execute();
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "创建一个菜单项.", action = ActionAddMenu.class)
@POST
@Path("menu/add")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuAdd(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
JsonElement jsonElement) {
ActionResult<ActionAddMenu.Wo> result = new ActionResult<>();
try {
result = new ActionAddMenu().execute(jsonElement);
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "更新一个菜单项.", action = ActionUpdateMenu.class)
@POST
@Path("menu/update/{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuUpdate(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request, @PathParam("id") String id,
JsonElement jsonElement) {
ActionResult<ActionUpdateMenu.Wo> result = new ActionResult<>();
try {
result = new ActionUpdateMenu().execute(id, jsonElement);
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "删除一个菜单项.", action = ActionDeleteMenu.class)
@DELETE
@Path("menu/delete/{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuDelete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
ActionResult<ActionDeleteMenu.Wo> result = new ActionResult<>();
try {
result = new ActionDeleteMenu().execute(id);
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
private static Logger logger = LoggerFactory.getLogger(MPWeixinAction.class);
@JaxrsMethodDescribe(value = "给微信公众号后台检测服务器配置.", action = ActionCheckMPWeixin.class)
@GET
@Path("check")
public void check(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("signature") @QueryParam("signature") String signature,
@JaxrsParameterDescribe("timestamp") @QueryParam("timestamp") Long timestamp,
@JaxrsParameterDescribe("nonce") @QueryParam("nonce") String nonce,
@JaxrsParameterDescribe("echostr") @QueryParam("echostr") String echostr) {
ActionResult<ActionCheckMPWeixin.Wo> result = new ActionResult<>();
try {
result = new ActionCheckMPWeixin().execute(signature, timestamp, nonce, echostr);
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "微信公众号接收消息.", action = ActionReceiveMsg.class)
@POST
@Path("check")
public void receiveMsg(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("signature") @QueryParam("signature") String signature,
@JaxrsParameterDescribe("timestamp") @QueryParam("timestamp") Long timestamp,
@JaxrsParameterDescribe("nonce") @QueryParam("nonce") String nonce,
@JaxrsParameterDescribe("echostr") @QueryParam("echostr") String echostr, InputStream inputStream) {
ActionResult<ActionReceiveMsg.Wo> result = new ActionResult<>();
try {
result = new ActionReceiveMsg().execute(signature, timestamp, nonce, echostr, inputStream);
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
// /menu/* 需要管理员权限
@JaxrsMethodDescribe(value = "微信菜单列表查看.", action = ActionListAllMenu.class)
@GET
@Path("menu/list/weixin")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuWeixinList(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionListAllMenu.Wo> result = new ActionResult<>();
try {
result = new ActionListAllMenu().execute();
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "微信公众号关注回复的菜单对象.", action = ActionSubscribeMenu.class)
@GET
@Path("menu/subscribe")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuWeixinSubscribe(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionSubscribeMenu.WoMenu> result = new ActionResult<>();
try {
result = new ActionSubscribeMenu().execute();
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "给微信公众号创建菜单,【注意这个接口会把公众号菜单全部替换掉!】.", action = ActionCreateMenu.class)
@GET
@Path("menu/create/to/weixin")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuCreate2Weixin(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request) {
ActionResult<ActionCreateMenu.Wo> result = new ActionResult<>();
try {
result = new ActionCreateMenu().execute();
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "创建一个菜单项.", action = ActionAddMenu.class)
@POST
@Path("menu/add")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuAdd(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
JsonElement jsonElement) {
ActionResult<ActionAddMenu.Wo> result = new ActionResult<>();
try {
result = new ActionAddMenu().execute(jsonElement);
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "更新一个菜单项.", action = ActionUpdateMenu.class)
@POST
@Path("menu/update/{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuUpdate(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionUpdateMenu.Wo> result = new ActionResult<>();
try {
result = new ActionUpdateMenu().execute(id, jsonElement);
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "删除一个菜单项.", action = ActionDeleteMenu.class)
@DELETE
@Path("menu/delete/{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void menuDelete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionDeleteMenu.Wo> result = new ActionResult<>();
try {
result = new ActionDeleteMenu().execute(id);
} catch (Exception e) {
logger.error(e);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
......@@ -38,7 +38,7 @@ public class PromptErrorLogAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("错误标识") @PathParam("id") String id) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<ActionGet.Wo> result = new ActionResult<>();
try {
......
......@@ -38,7 +38,7 @@ public class UnexpectedErrorLogAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<ActionGet.Wo> result = new ActionResult<>();
try {
......
......@@ -35,7 +35,7 @@ class ActionGetSystemLog extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String tag) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
if (BooleanUtils.isFalse(Config.logLevel().getWebLogEnable())){
if (BooleanUtils.isFalse(Config.logLevel().getWebLogEnable())) {
throw new Exception("web log console not enable!");
}
......@@ -43,12 +43,12 @@ class ActionGetSystemLog extends BaseAction {
String key = effectivePerson.getDistinguishedName();
if (key.indexOf("@") > -1) {
key = key.split("@")[1] + tag;
}else{
} else {
key = key + tag;
}
if (Config.node().equals(Config.resource_node_centersPirmaryNode())) {
//控制台最长展现日志时间为30分钟
// 控制台最长展现日志时间为30分钟
CacheCategory cacheCategory = new CacheCategory(CacheLogObject.class);
CacheKey cacheKey = new CacheKey(key, "time");
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
......@@ -58,10 +58,10 @@ class ActionGetSystemLog extends BaseAction {
clo = (CacheLogObject) optional.get();
startTime = clo.getStartTime();
long curTime = new Date().getTime();
if((curTime - startTime) < durationTime){
if ((curTime - startTime) < durationTime) {
woList = getSystemLog(key);
}
}else{
} else {
woList = getSystemLog(key);
}
clo.setStartTime(startTime);
......@@ -107,9 +107,6 @@ class ActionGetSystemLog extends BaseAction {
dos.writeLong(lastPoint);
dos.flush();
// logger.debug("socket dispatch getSystemLog to {}:{} lastPoint={}", node,
// nodes.get(node).nodeAgentPort(), lastPoint);
String result = dis.readUTF();
if (StringUtils.isNotEmpty(result) && result.startsWith("[")) {
List<Wo> list = gson.fromJson(result, new TypeToken<List<Wo>>() {
......
......@@ -34,7 +34,7 @@ class ActionSelect extends BaseAction {
ActionResult<Wo> result = new ActionResult<>();
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
Business business = new Business(emc);
Query query = emc.flag(queryFlag, Query.class );
Query query = emc.flag(queryFlag, Query.class);
if (null == query) {
throw new ExceptionQueryNotExist(queryFlag);
}
......@@ -61,70 +61,15 @@ class ActionSelect extends BaseAction {
wo.setStatList(WrapStat.outCopier.copy(business.entityManagerContainer().list(Stat.class, wi.listStatId())));
wo.setRevealList(
WrapReveal.outCopier.copy(business.entityManagerContainer().list(Reveal.class, wi.listRevealId())));
wo.setTableList(WrapTable.outCopier.copy(business.entityManagerContainer().list(Table.class, wi.listTableId())));
wo.setStatementList(WrapStatement.outCopier.copy(business.entityManagerContainer().list(Statement.class, wi.listStatementId())));
wo.setImportModelList(WrapImportModel.outCopier.copy(business.entityManagerContainer().list(ImportModel.class, wi.listImportModelId())));
wo.setTableList(
WrapTable.outCopier.copy(business.entityManagerContainer().list(Table.class, wi.listTableId())));
wo.setStatementList(WrapStatement.outCopier
.copy(business.entityManagerContainer().list(Statement.class, wi.listStatementId())));
wo.setImportModelList(WrapImportModel.outCopier
.copy(business.entityManagerContainer().list(ImportModel.class, wi.listImportModelId())));
return wo;
}
// private List<WrapView> listView(Business business, Query query, Wi wi) throws
// Exception {
// List<WrapView> wos = new ArrayList<>();
// for (WrapView wrap : wi.getViewList()) {
// View o = business.entityManagerContainer().find(wrap.getId(), View.class);
// if (null == o) {
// throw new ExceptionViewNotExist(wrap.getId());
// }
// wos.add(WrapView.outCopier.copy(o));
// }
//
// // List<String> ids = business.view().listWithQuery(query.getId());
// // if (!StringUtils.equals("*", wi.getViewList().get(0))) {
// // ids = ListUtils.intersection(ids, wi.getViewList());
// // }
// // for (String id : ListTools.trim(ids, true, true)) {
// // View o = business.entityManagerContainer().find(id, View.class);
// // if (null == o) {
// // throw new ExceptionViewNotExist(id);
// // }
// // wos.add(WrapView.outCopier.copy(o));
// // }
// return wos;
// }
//
// private List<WrapStat> listStat(Business business, Query query, Wi wi) throws
// Exception {
// List<WrapStat> wos = new ArrayList<>();
// for (String id : ListTools.trim(ids, true, true)) {
// Stat o = business.entityManagerContainer().find(id, Stat.class);
// if (null == o) {
// throw new ExceptionStatNotExist(id);
// }
// wos.add(WrapStat.outCopier.copy(o));
// }
// return wos;
// }
//
// private List<WrapReveal> listReveal(Business business, Query query, Wi wi)
// throws Exception {
// List<WrapReveal> wos = new ArrayList<>();
// if (ListTools.isEmpty(wi.getRevealList())) {
// return wos;
// }
// List<String> ids = business.reveal().listWithQuery(query.getId());
// if (!StringUtils.equals("*", wi.getRevealList().get(0))) {
// ids = ListUtils.intersection(ids, wi.getRevealList());
// }
// for (String id : ListTools.trim(ids, true, true)) {
// Reveal o = business.entityManagerContainer().find(id, Reveal.class);
// if (null == o) {
// throw new ExceptionRevealNotExist(id);
// }
// wos.add(WrapReveal.outCopier.copy(o));
// }
// return wos;
// }
public static class Wi extends WrapQuery {
private static final long serialVersionUID = -5670907699997607096L;
......
......@@ -58,7 +58,8 @@ public class RevealAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listNext(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, @PathParam("count") Integer count) {
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionListNext.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -76,7 +77,8 @@ public class RevealAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listPrev(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, @PathParam("count") Integer count) {
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionListPrev.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -94,7 +96,7 @@ public class RevealAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionGet.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -129,7 +131,7 @@ public class RevealAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void update(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id, JsonElement jsonElement) {
@JaxrsParameterDescribe("标识") @PathParam("id") String id, JsonElement jsonElement) {
ActionResult<ActionEdit.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......@@ -147,7 +149,7 @@ public class RevealAction extends StandardJaxrsAction {
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@PathParam("id") String id) {
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册