提交 0fd9848d 编写于 作者: R roo00

bug fix

上级 8d5824ff
......@@ -11,6 +11,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import com.x.base.core.entity.AbstractPersistenceProperties;
......@@ -103,6 +105,7 @@ public class AttendanceAppealInfo extends SliceJpaObject {
private String recordDateString;
@FieldDescribe("记录日期")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xrecordDate")
@CheckPersist(allowEmpty = true)
private Date recordDate;
......@@ -176,6 +179,7 @@ public class AttendanceAppealInfo extends SliceJpaObject {
private String opinion1;
@FieldDescribe("审批日期一")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xprocessTime1")
@CheckPersist(allowEmpty = true)
private Date processTime1;
......@@ -201,6 +205,7 @@ public class AttendanceAppealInfo extends SliceJpaObject {
private String opinion2;
@FieldDescribe("审批日期二")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xprocessTime2")
@CheckPersist(allowEmpty = true)
private Date processTime2;
......
......@@ -11,6 +11,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -101,6 +103,7 @@ public class AttendanceDetail extends SliceJpaObject {
private String recordDateString;
@FieldDescribe("打卡记录日期")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xrecordDate")
@CheckPersist(allowEmpty = true)
private Date recordDate;
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -77,6 +79,7 @@ public class AttendanceDetailMobile extends SliceJpaObject {
private String recordDateString;
@FieldDescribe("打卡记录日期")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xrecordDate")
@CheckPersist(allowEmpty = true)
private Date recordDate;
......
......@@ -13,6 +13,8 @@ import javax.persistence.Lob;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -74,6 +76,7 @@ public class AttendanceImportFileInfo extends SliceJpaObject {
*/
@FieldDescribe("最后更新时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xlastUpdateTime")
@Index(name = TABLE + "_lastUpdateTime")
@CheckPersist(allowEmpty = false)
......@@ -170,10 +173,12 @@ public class AttendanceImportFileInfo extends SliceJpaObject {
private Long processCount = 0L;
@FieldDescribe("数据开始日期")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xstartDate")
private Date startDate = null;
@FieldDescribe("数据结束日期")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xendDate")
private Date endDate = null;
......
......@@ -10,6 +10,8 @@ import javax.persistence.InheritanceType;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -103,11 +105,13 @@ public class AttendanceSelfHoliday extends SliceJpaObject {
private String leaveType;
@FieldDescribe("开始时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xstartTime")
@CheckPersist(allowEmpty = false)
private Date startTime;
@FieldDescribe("结束时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xendTime")
@CheckPersist(allowEmpty = false)
private Date endTime;
......
......@@ -11,6 +11,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import com.x.base.core.entity.JpaObject;
......@@ -90,6 +92,7 @@ public class AttendanceStatisticRequireLog extends SliceJpaObject {
private String statisticDay = "";
@FieldDescribe("处理时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xprocessTime")
@CheckPersist(allowEmpty = true)
private Date processTime = null;
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import com.x.base.core.entity.AbstractPersistenceProperties;
......@@ -91,11 +93,13 @@ public class AttendanceStatisticalCycle extends SliceJpaObject {
private String cycleEndDateString;
@FieldDescribe("月周期开始日期")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xcycleStartDate")
@CheckPersist(allowEmpty = true)
private Date cycleStartDate;
@FieldDescribe("月周期结束日期")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xcycleEndDate")
@CheckPersist(allowEmpty = true)
private Date cycleEndDate;
......
......@@ -412,6 +412,16 @@ public class EntityManagerContainer extends EntityManagerContainerBasic {
return list;
}
public <T extends JpaObject, W extends Object> List<T> listEqualAndGreaterThanOrEqualTo(Class<T> cls,
String attribute, Object value, String otherAttribute, Object otherValue) throws Exception {
EntityManager em = this.get(cls);
Query query = em.createQuery("select o from " + cls.getName() + " o where ((o." + attribute + " = ?1) and (o."
+ otherAttribute + " >= ?2))");
query.setParameter(1, value);
query.setParameter(2, otherValue);
return new ArrayList<T>(query.getResultList());
}
public <T extends JpaObject> Long count(Class<T> cls) throws Exception {
EntityManager em = this.get(cls);
CriteriaBuilder cb = em.getCriteriaBuilder();
......
......@@ -2,6 +2,7 @@ package com.x.base.core.entity.dynamic;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang3.StringUtils;
......@@ -15,33 +16,27 @@ public class DynamicEntity extends GsonPropertyObject {
public static final String FIELDNAME_SUFFIX = "_FIELDNAME";
public static final String JAR_NAME = "x_query_dynamic_entity";
public static final String TYPE_string = "string";
public static final String TYPE_integer = "integer";
public static final String TYPE_long = "long";
public static final String TYPE_double = "double";
public static final String TYPE_boolean = "boolean";
public static final String TYPE_date = "date";
public static final String TYPE_time = "time";
public static final String TYPE_dateTime = "dateTime";
public static final String TYPE_stringList = "stringList";
public static final String TYPE_integerList = "integerList";
public static final String TYPE_longList = "longList";
public static final String TYPE_doubleList = "doubleList";
public static final String TYPE_booleanList = "booleanList";
public static final String TYPE_stringLob = "stringLob";
public static final String TYPE_stringMap = "stringMap";
private String name;
private List<StringField> stringFieldList;
private List<IntegerField> integerFieldList;
private List<LongField> longFieldList;
private List<DoubleField> doubleFieldList;
private List<BooleanField> booleanFieldList;
private List<DateField> dateFieldList;
private List<TimeField> timeFieldList;
private List<DateTimeField> dateTimeFieldList;
private List<StringField> listStringFieldList;
private List<IntegerField> listIntegerFieldList;
private List<LongField> listLongFieldList;
private List<DoubleField> listDoubleFieldList;
private List<BooleanField> listBooleanFieldList;
private List<DateTimeField> listDateTimeFieldList;
private List<StringLobField> stringLobFieldList;
private List<StringMapField> stringMapFieldList;
public void addStringField(String name, String description) {
StringField field = new StringField();
field.setName(name);
field.setDescription(description);
this.stringFieldList.add(field);
}
private List<Field> fieldList = new ArrayList<>();
public String tableName() throws Exception {
if (StringUtils.isEmpty(name)) {
......@@ -70,24 +65,7 @@ public class DynamicEntity extends GsonPropertyObject {
}
public DynamicEntity() {
this.stringFieldList = new ArrayList<>();
this.integerFieldList = new ArrayList<>();
this.longFieldList = new ArrayList<>();
this.doubleFieldList = new ArrayList<>();
this.booleanFieldList = new ArrayList<>();
this.dateFieldList = new ArrayList<>();
this.timeFieldList = new ArrayList<>();
this.dateTimeFieldList = new ArrayList<>();
this.listStringFieldList = new ArrayList<>();
this.listIntegerFieldList = new ArrayList<>();
this.listLongFieldList = new ArrayList<>();
this.listDoubleFieldList = new ArrayList<>();
this.listBooleanFieldList = new ArrayList<>();
this.listDateTimeFieldList = new ArrayList<>();
this.stringLobFieldList = new ArrayList<>();
this.stringMapFieldList = new ArrayList<>();
this.fieldList = new ArrayList<>();
}
public DynamicEntity(String name) {
......@@ -95,195 +73,129 @@ public class DynamicEntity extends GsonPropertyObject {
this.name = name;
}
public static abstract class Field {
private String name;
private String description;
public String fieldName() {
return this.name + FIELDNAME_SUFFIX;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
public static class StringField extends Field {
}
public static class IntegerField extends Field {
}
public static class LongField extends Field {
}
public static class DoubleField extends Field {
}
public static class BooleanField extends Field {
}
public static class DateField extends Field {
}
public static class TimeField extends Field {
}
public static class DateTimeField extends Field {
}
public static class StringLobField extends Field {
}
public static class StringMapField extends Field {
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<StringField> getStringFieldList() {
return stringFieldList;
}
public void setStringFieldList(List<StringField> stringFieldList) {
this.stringFieldList = stringFieldList;
}
public List<IntegerField> getIntegerFieldList() {
return integerFieldList;
public List<Field> stringFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_string))
.collect(Collectors.toList());
}
public void setIntegerFieldList(List<IntegerField> integerFieldList) {
this.integerFieldList = integerFieldList;
public List<Field> integerFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_integer))
.collect(Collectors.toList());
}
public List<LongField> getLongFieldList() {
return longFieldList;
public List<Field> longFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_long))
.collect(Collectors.toList());
}
public void setLongFieldList(List<LongField> longFieldList) {
this.longFieldList = longFieldList;
public List<Field> doubleFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_double))
.collect(Collectors.toList());
}
public List<DoubleField> getDoubleFieldList() {
return doubleFieldList;
public List<Field> booleanFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_boolean))
.collect(Collectors.toList());
}
public void setDoubleFieldList(List<DoubleField> doubleFieldList) {
this.doubleFieldList = doubleFieldList;
public List<Field> dateFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_date))
.collect(Collectors.toList());
}
public List<BooleanField> getBooleanFieldList() {
return booleanFieldList;
public List<Field> timeFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_time))
.collect(Collectors.toList());
}
public void setBooleanFieldList(List<BooleanField> booleanFieldList) {
this.booleanFieldList = booleanFieldList;
public List<Field> dateTimeFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_dateTime))
.collect(Collectors.toList());
}
public List<DateField> getDateFieldList() {
return dateFieldList;
public List<Field> stringListFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_stringList))
.collect(Collectors.toList());
}
public void setDateFieldList(List<DateField> dateFieldList) {
this.dateFieldList = dateFieldList;
public List<Field> integerListFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_integerList))
.collect(Collectors.toList());
}
public List<TimeField> getTimeFieldList() {
return timeFieldList;
public List<Field> longListFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_longList))
.collect(Collectors.toList());
}
public void setTimeFieldList(List<TimeField> timeFieldList) {
this.timeFieldList = timeFieldList;
public List<Field> doubleListFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_doubleList))
.collect(Collectors.toList());
}
public List<DateTimeField> getDateTimeFieldList() {
return dateTimeFieldList;
public List<Field> booleanListFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_booleanList))
.collect(Collectors.toList());
}
public void setDateTimeFieldList(List<DateTimeField> dateTimeFieldList) {
this.dateTimeFieldList = dateTimeFieldList;
public List<Field> stringLobFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_stringLob))
.collect(Collectors.toList());
}
public List<StringField> getListStringFieldList() {
return listStringFieldList;
public List<Field> stringMapFields() {
return this.fieldList.stream().filter(o -> StringUtils.equals(o.getType(), TYPE_stringMap))
.collect(Collectors.toList());
}
public void setListStringFieldList(List<StringField> listStringFieldList) {
this.listStringFieldList = listStringFieldList;
}
public List<IntegerField> getListIntegerFieldList() {
return listIntegerFieldList;
}
public void setListIntegerFieldList(List<IntegerField> listIntegerFieldList) {
this.listIntegerFieldList = listIntegerFieldList;
}
public List<LongField> getListLongFieldList() {
return listLongFieldList;
}
public static class Field {
private String name;
private String description;
private String type;
public void setListLongFieldList(List<LongField> listLongFieldList) {
this.listLongFieldList = listLongFieldList;
}
public String fieldName() {
return this.name + FIELDNAME_SUFFIX;
}
public List<DoubleField> getListDoubleFieldList() {
return listDoubleFieldList;
}
public String getName() {
return name;
}
public void setListDoubleFieldList(List<DoubleField> listDoubleFieldList) {
this.listDoubleFieldList = listDoubleFieldList;
}
public void setName(String name) {
this.name = name;
}
public List<BooleanField> getListBooleanFieldList() {
return listBooleanFieldList;
}
public String getDescription() {
return description;
}
public void setListBooleanFieldList(List<BooleanField> listBooleanFieldList) {
this.listBooleanFieldList = listBooleanFieldList;
}
public void setDescription(String description) {
this.description = description;
}
public List<DateTimeField> getListDateTimeFieldList() {
return listDateTimeFieldList;
}
public String getType() {
return type;
}
public void setListDateTimeFieldList(List<DateTimeField> listDateTimeFieldList) {
this.listDateTimeFieldList = listDateTimeFieldList;
public void setType(String type) {
this.type = type;
}
}
public List<StringLobField> getStringLobFieldList() {
return stringLobFieldList;
public String getName() {
return name;
}
public void setStringLobFieldList(List<StringLobField> stringLobFieldList) {
this.stringLobFieldList = stringLobFieldList;
public void setName(String name) {
this.name = name;
}
public List<StringMapField> getStringMapFieldList() {
return stringMapFieldList;
public List<Field> getFieldList() {
return fieldList;
}
public void setStringMapFieldList(List<StringMapField> stringMapFieldList) {
this.stringMapFieldList = stringMapFieldList;
public void setFieldList(List<Field> fieldList) {
this.fieldList = fieldList;
}
}
......@@ -39,17 +39,7 @@ import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.entity.dynamic.DynamicEntity.BooleanField;
import com.x.base.core.entity.dynamic.DynamicEntity.DateField;
import com.x.base.core.entity.dynamic.DynamicEntity.DateTimeField;
import com.x.base.core.entity.dynamic.DynamicEntity.DoubleField;
import com.x.base.core.entity.dynamic.DynamicEntity.Field;
import com.x.base.core.entity.dynamic.DynamicEntity.IntegerField;
import com.x.base.core.entity.dynamic.DynamicEntity.LongField;
import com.x.base.core.entity.dynamic.DynamicEntity.StringField;
import com.x.base.core.entity.dynamic.DynamicEntity.StringLobField;
import com.x.base.core.entity.dynamic.DynamicEntity.StringMapField;
import com.x.base.core.entity.dynamic.DynamicEntity.TimeField;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.ListTools;
......@@ -111,7 +101,6 @@ public class DynamicEntityBuilder {
this.createListLongFields(builder);
this.createListDoubleFields(builder);
this.createListBooleanFields(builder);
this.createListDateTimeFields(builder);
this.createStringLobFields(builder);
this.createStringMapFields(builder);
......@@ -155,31 +144,31 @@ public class DynamicEntityBuilder {
}
private void createStringFields(Builder builder) {
for (StringField field : ListTools.trim(dynamicEntity.getStringFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.stringFields(), true, true)) {
this.createField(builder, field, String.class);
}
}
private void createIntegerFields(Builder builder) {
for (IntegerField field : ListTools.trim(dynamicEntity.getIntegerFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.integerFields(), true, true)) {
this.createField(builder, field, Integer.class);
}
}
private void createLongFields(Builder builder) {
for (LongField field : ListTools.trim(dynamicEntity.getLongFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.longFields(), true, true)) {
this.createField(builder, field, Long.class);
}
}
private void createDoubleFields(Builder builder) {
for (DoubleField field : ListTools.trim(dynamicEntity.getDoubleFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.doubleFields(), true, true)) {
this.createField(builder, field, Double.class);
}
}
private void createBooleanFields(Builder builder) {
for (BooleanField field : ListTools.trim(dynamicEntity.getBooleanFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.booleanFields(), true, true)) {
this.createField(builder, field, Boolean.class);
}
}
......@@ -214,12 +203,12 @@ public class DynamicEntityBuilder {
}
private void createDateFields(Builder builder) {
for (DateField field : ListTools.trim(dynamicEntity.getDateFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.dateFields(), true, true)) {
this.createDateField(builder, field);
}
}
private void createDateField(Builder builder, DateField field) {
private void createDateField(Builder builder, Field field) {
AnnotationSpec column = AnnotationSpec.builder(Column.class)
.addMember("name", "ColumnNamePrefix + " + field.fieldName()).build();
......@@ -240,12 +229,12 @@ public class DynamicEntityBuilder {
}
private void createTimeFields(Builder builder) {
for (TimeField field : ListTools.trim(dynamicEntity.getTimeFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.timeFields(), true, true)) {
this.createTimeField(builder, field);
}
}
private void createTimeField(Builder builder, TimeField field) {
private void createTimeField(Builder builder, Field field) {
AnnotationSpec column = AnnotationSpec.builder(Column.class)
.addMember("name", "ColumnNamePrefix + " + field.fieldName()).build();
......@@ -267,12 +256,12 @@ public class DynamicEntityBuilder {
}
private void createDateTimeFields(Builder builder) {
for (DateTimeField field : ListTools.trim(dynamicEntity.getDateTimeFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.dateTimeFields(), true, true)) {
this.createDateTimeField(builder, field);
}
}
private void createDateTimeField(Builder builder, DateTimeField field) {
private void createDateTimeField(Builder builder, Field field) {
AnnotationSpec column = AnnotationSpec.builder(Column.class)
.addMember("name", "ColumnNamePrefix + " + field.fieldName()).build();
......@@ -294,41 +283,35 @@ public class DynamicEntityBuilder {
}
private void createListStringFields(Builder builder) {
for (StringField field : ListTools.trim(dynamicEntity.getListStringFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.stringListFields(), true, true)) {
this.createListFields(builder, field, String.class);
}
}
private void createListIntegerFields(Builder builder) {
for (IntegerField field : ListTools.trim(dynamicEntity.getListIntegerFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.integerListFields(), true, true)) {
this.createListFields(builder, field, Integer.class);
}
}
private void createListLongFields(Builder builder) {
for (LongField field : ListTools.trim(dynamicEntity.getListLongFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.longListFields(), true, true)) {
this.createListFields(builder, field, Long.class);
}
}
private void createListDoubleFields(Builder builder) {
for (DoubleField field : ListTools.trim(dynamicEntity.getListDoubleFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.doubleListFields(), true, true)) {
this.createListFields(builder, field, Double.class);
}
}
private void createListBooleanFields(Builder builder) {
for (BooleanField field : ListTools.trim(dynamicEntity.getListBooleanFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.booleanListFields(), true, true)) {
this.createListFields(builder, field, Boolean.class);
}
}
private void createListDateTimeFields(Builder builder) {
for (DateTimeField field : ListTools.trim(dynamicEntity.getListDateTimeFieldList(), true, true)) {
this.createListFields(builder, field, Date.class);
}
}
private void createListFields(Builder builder, Field field, Class<?> typeClass) {
// public static final String groupList_FIELDNAME = "groupList";
......@@ -385,12 +368,12 @@ public class DynamicEntityBuilder {
}
private void createStringLobFields(Builder builder) {
for (StringLobField field : ListTools.trim(dynamicEntity.getStringLobFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.stringLobFields(), true, true)) {
this.createStringLobField(builder, field);
}
}
private void createStringLobField(Builder builder, StringLobField field) {
private void createStringLobField(Builder builder, Field field) {
// public static final String stringLobValue_FIELDNAME = "stringLobValue";
// @FieldDescribe("长文本.")
......@@ -420,12 +403,12 @@ public class DynamicEntityBuilder {
}
private void createStringMapFields(Builder builder) {
for (StringMapField field : ListTools.trim(dynamicEntity.getStringMapFieldList(), true, true)) {
for (Field field : ListTools.trim(dynamicEntity.stringMapFields(), true, true)) {
this.createStringMapField(builder, field);
}
}
private void createStringMapField(Builder builder, StringMapField field) {
private void createStringMapField(Builder builder, Field field) {
// @FieldDescribe("Map类型.")
// @CheckPersist(allowEmpty = true)
......
......@@ -61,6 +61,7 @@ public class Config {
public static final String PATH_CONFIG_ZHENGWUDINGDING = "config/zhengwuDingding.json";
public static final String PATH_CONFIG_QIYEWEIXIN = "config/qiyeweixin.json";
public static final String PATH_CONFIG_LOGLEVEL = "config/logLevel.json";
public static final String PATH_CONFIG_BINDLOGO = "config/bindLogo.png";
public static final String PATH_COMMONS_INITIALSCRIPTTEXT = "commons/initialScriptText.js";
public static final String PATH_COMMONS_MOOTOOLSSCRIPTTEXT = "commons/mooToolsScriptText.js";
......@@ -102,6 +103,48 @@ public class Config {
private static final String DEFAULT_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCWcVZIS57VeOUzi8c01WKvwJK9uRe6hrGTUYmF6J/pI6/UvCbdBWCoErbzsBZOElOH8Sqal3vsNMVLjPYClfoDyYDaUlakP3ldfnXJzAFJVVubF53KadG+fwnh9ZMvxdh7VXVqRL3IQBDwGgzX4rmSK+qkUJjc3OkrNJPB7LLD8QIDAQAB";
private static final String DEFAULT_PRIVATE_KEY = "MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBAJZxVkhLntV45TOLxzTVYq/Akr25F7qGsZNRiYXon+kjr9S8Jt0FYKgStvOwFk4SU4fxKpqXe+w0xUuM9gKV+gPJgNpSVqQ/eV1+dcnMAUlVW5sXncpp0b5/CeH1ky/F2HtVdWpEvchAEPAaDNfiuZIr6qRQmNzc6Ss0k8HsssPxAgMBAAECgYAWtRy05NUgm5Lc6Og0jVDL/mEnydxPBy2ectwzHh2k7wIHNi8XhUxFki2TMqzrM9Dv3/LySpMl4AE3mhs34LNPy6F+MwyF5X7j+2Y6MflJyeb9HNyT++viysQneoOEiOk3ghxF2/GPjpiEF79wSp+1YKTxRAyq7ypV3t35fGOOEQJBANLDPWl8b5c3lrcz/dTamMjHbVamEyX43yzQOphzkhYsz4pruATzTxU+z8/zPdEqHcWWV39CP3xu3EYNcAhxJW8CQQC2u7PF5Xb1xYRCsmIPssFxil64vvdUadSxl7GLAgjQ9ULyYWB24KObCEzLnPcT8Pf2Q0YQOixxa/78FuzmgbyfAkA7ZFFV/H7lugB6t+f7p24OhkRFep9CwBMD6dnZRBgSr6X8d8ZvfrD2Z7DgBMeSva+OEoOtlNmXExZ3lynO9zN5AkAVczEmIMp3DSl6XtAuAZC9kD2QODJ2QToLYsAfjiyUwsWKCC43piTuVOoW2KUUPSwOR1VZIEsJQWEcHGDQqhgHAkAeZ7a6dVRZFdBwKA0ADjYCufAW2cIYiVDQBJpgB+kiLQflusNOCBK0FT3lg8BdUSy2D253Ih6l3lbaM/4M7DFQ";
private static final byte[] DEFAULT_BINDLOGO = new byte[] { -119, 80, 78, 71, 13, 10, 26, 10, 0, 0, 0, 13, 73, 72,
68, 82, 0, 0, 0, 64, 0, 0, 0, 64, 8, 6, 0, 0, 0, -86, 105, 113, -34, 0, 0, 0, 4, 103, 65, 77, 65, 0, 0, -79,
-113, 11, -4, 97, 5, 0, 0, 0, 32, 99, 72, 82, 77, 0, 0, 122, 38, 0, 0, -128, -124, 0, 0, -6, 0, 0, 0, -128,
-24, 0, 0, 117, 48, 0, 0, -22, 96, 0, 0, 58, -104, 0, 0, 23, 112, -100, -70, 81, 60, 0, 0, 0, 6, 98, 75, 71,
68, 0, 0, 0, 0, 0, 0, -7, 67, -69, 127, 0, 0, 0, 9, 112, 72, 89, 115, 0, 0, 11, 18, 0, 0, 11, 18, 1, -46,
-35, 126, -4, 0, 0, 3, 36, 73, 68, 65, 84, 120, -38, -19, -101, -51, 79, 19, 65, 24, -58, -97, 89, 49, -107,
-125, -75, 74, 37, 86, 69, 18, 67, -62, 87, -119, 7, 77, -76, -127, -58, -125, 127, 0, -31, 35, 106, 60,
-101, 72, 52, 24, 14, 4, 57, 122, -82, 112, -63, 24, 76, -4, 7, -60, -92, -59, -60, -77, 94, 10, 42, 28,
-107, 34, 120, 48, -126, 32, 6, -86, -108, 30, -124, 30, -24, 122, 104, 119, 83, 118, 27, 29, 103, 63, -34,
118, 119, 127, -57, -39, -39, -23, -13, 60, -23, -68, -99, -66, -39, 101, 40, 65, -106, -27, 65, 0, 93, 0,
-94, 0, 66, 112, 22, 27, 0, -110, 0, 102, 24, 99, -113, -107, 65, 86, 52, 30, 0, -16, 20, -64, 13, 106,
-107, 54, 49, 5, 96, -128, 49, -106, 81, 2, 120, -18, 34, -13, 106, 8, -116, -79, -101, -84, -8, -75, -97,
-96, 86, 67, -60, -3, 26, 20, -10, -68, -54, -20, -89, 77, -116, 37, 82, 72, 103, 115, -44, -30, 76, 37,
-24, -9, 97, -72, -73, 29, -99, -83, -11, -91, -61, 93, 18, 10, 5, 79, -59, -119, -26, 1, 32, -99, -51, 97,
44, -111, -46, 14, 71, 37, 104, -86, -67, 19, -51, -1, -59, 91, 72, -94, 22, 69, -115, 23, 0, -75, 0, 106,
106, 120, 39, 62, 27, -116, -96, -27, -20, 49, 106, -67, 92, 44, -81, 103, 113, 123, -30, 45, -41, 92, -18,
111, 64, -75, -104, 7, -128, -26, 51, 126, -18, -71, -82, -33, 2, -36, 1, 124, -8, -70, 77, -83, -43, 18,
-72, 107, -64, -67, -55, 57, 106, -83, 101, 9, -6, 125, 24, -23, 11, 35, -46, 114, 82, -24, -2, -86, -33, 2,
-23, 108, 14, -79, -8, -126, -16, -3, 85, 31, -128, 18, -126, -85, 3, 48, -126, -124, 66, -89, 68, 37, -24,
-9, 81, 107, -78, 61, -128, 100, -23, -64, 104, 127, 7, 66, 39, 106, -87, 117, -39, 70, 13, -128, 25, 0,
-41, -107, -127, -53, -51, 65, -68, 120, 112, -107, 90, 87, 89, 22, 87, 51, -72, -13, -28, -67, -87, 107,
74, -59, 6, -31, 20, -75, 57, 30, -38, -50, 5, 76, 95, -45, 43, -126, -59, -98, -96, -37, 26, -94, 42, -70,
-98, -32, -69, -91, 45, 60, 74, -92, -80, -75, -77, 7, 0, 56, 117, -68, 22, -93, -3, 97, 92, 108, -86, -125,
118, -34, -40, 116, 10, -101, -103, 61, -31, 15, -105, 36, -122, 75, 77, 117, 120, 120, -21, 2, -114, -42,
30, 46, -67, 116, -115, 49, -10, 6, 0, 100, 89, -106, -83, 12, 64, -41, 19, -116, -59, 23, 84, -13, 0, -16,
99, 123, -73, 92, 47, 13, -79, -8, -126, 33, -13, 0, -112, -49, -53, -104, -1, -100, 70, 124, 118, 69, 123,
41, 42, -78, -98, 104, 0, -1, -20, 9, -82, -3, -4, -83, 27, 51, -77, 119, -8, -3, -41, -82, 118, -24, -68,
-99, 1, -72, 26, -31, 0, -22, 3, 71, -88, -75, -45, 6, 48, -46, 27, 118, -60, -119, -111, -69, 31, -96, -27,
127, 79, -116, -5, 121, 25, -29, -45, -117, 120, 53, -1, -115, -38, -13, 1, 108, -85, 1, -121, 36, -122,
-114, -58, 0, -75, 95, -70, 0, 42, 21, -37, 2, -40, -49, -53, -8, -72, -110, -95, -10, -85, 67, -72, 6, -52,
45, -89, 49, -2, 50, -123, 13, -3, 111, 120, 85, 33, 28, 64, 44, 97, -4, 36, 88, 9, 8, 111, 1, 39, -104, 55,
20, -128, 83, -88, -120, 0, 78, -21, 15, 84, 95, -20, -6, 108, -31, 26, 96, 6, -54, -33, -31, -66, -50, 70,
-19, -91, -92, -56, 122, 21, 17, -64, -28, -35, 43, 8, 27, 63, -16, -68, -74, -72, 13, -96, 98, -6, 22, 48,
-63, -68, -83, 84, 68, 13, 112, 84, 0, -117, -85, 25, -53, -60, 90, -79, -74, -23, 53, -64, -20, -66, -67,
-43, 120, 91, -128, 90, 0, 53, 94, 0, -62, 55, 50, 70, -83, -35, 20, 45, -62, 1, -12, 68, 26, 42, 34, 4,
-119, 49, -12, 68, 26, -124, -17, 23, -2, 21, 24, -22, 110, -61, 80, 119, 27, -75, 127, -61, 120, 53, -128,
90, 0, 53, -36, 1, 44, -81, 103, -87, -75, 114, -77, -76, -74, -61, 61, -105, -69, 6, -16, 62, 123, 91, 109,
120, 91, -128, 90, 0, 53, 94, 0, 112, -47, 115, -126, 101, -68, 109, -24, -98, 19, 28, -18, 109, 119, 100,
8, -54, 107, 115, 26, -110, -82, 127, 113, -46, -11, -81, -50, 42, 69, 112, 0, 85, -14, -80, -92, 89, -26,
-117, -98, 113, -32, -17, -100, 27, 95, -97, -1, 3, 15, 32, -32, 95, -60, -127, 21, 87, 0, 0, 0, 0, 73, 69,
78, 68, -82, 66, 96, -126 };
public static File dir_commons() throws Exception {
return new File(base(), DIR_COMMONS);
}
......@@ -1045,4 +1088,22 @@ public class Config {
return instance().logLevel;
}
private byte[] bindLogo;
public static byte[] bindLogo() throws Exception {
if (null == instance().bindLogo) {
synchronized (Config.class) {
if (null == instance().bindLogo) {
File file = new File(Config.base(), PATH_CONFIG_BINDLOGO);
if (file.exists() && file.isFile()) {
instance().bindLogo = FileUtils.readFileToByteArray(file);
} else {
instance().bindLogo = DEFAULT_BINDLOGO;
}
}
}
}
return instance().bindLogo;
}
}
\ No newline at end of file
......@@ -48,6 +48,7 @@ public class Dingding extends ConfigObject {
public static final Boolean default_enable = false;
public static final String default_appKey = "";
public static final String default_corpId = "";
public static final String default_appSecret = "";
public static final String default_agentId = "";
public static final String default_syncCron = "10 0/10 * * * ?";
......@@ -57,6 +58,7 @@ public class Dingding extends ConfigObject {
public Dingding() {
this.enable = default_enable;
this.corpId = default_corpId;
this.appKey = default_appKey;
this.appSecret = default_appSecret;
this.agentId = default_agentId;
......@@ -192,4 +194,40 @@ public class Dingding extends ConfigObject {
FileUtils.write(file, XGsonBuilder.toJson(this), DefaultCharset.charset);
}
public void setEnable(Boolean enable) {
this.enable = enable;
}
public void setCorpId(String corpId) {
this.corpId = corpId;
}
public void setAgentId(String agentId) {
this.agentId = agentId;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public void setAppSecret(String appSecret) {
this.appSecret = appSecret;
}
public void setSyncCron(String syncCron) {
this.syncCron = syncCron;
}
public void setForceSyncCron(String forceSyncCron) {
this.forceSyncCron = forceSyncCron;
}
public void setOapiAddress(String oapiAddress) {
this.oapiAddress = oapiAddress;
}
public void setMessageEnable(Boolean messageEnable) {
this.messageEnable = messageEnable;
}
}
......@@ -10,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.connection.HttpConnection;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.gson.XGsonBuilder;
import com.x.base.core.project.tools.DefaultCharset;
......@@ -141,7 +142,7 @@ public class Qiyeweixin extends ConfigObject {
this.apiAddress = oapiAddress;
}
public static class CorpAccessTokenResp {
public static class CorpAccessTokenResp extends GsonPropertyObject {
// {"":7200,"":"ok","":"1601c97b17893fbfa4218ce2151a0692","":0}
......
......@@ -130,6 +130,14 @@ public class XGsonBuilder {
return null;
}
public static <T> T extract(JsonElement jsonElement, String name, Class<T> cls, T defaultValue) {
JsonElement element = extract(jsonElement, name);
if (element == null || element.isJsonNull()) {
return defaultValue;
}
return instance().fromJson(element, cls);
}
public static boolean isJson(String json) {
if (StringUtils.isBlank(json)) {
return false;
......
......@@ -28,13 +28,10 @@ public class x_cms_assemble_control extends AssembleA {
dependency.containerEntities.add("com.x.cms.core.entity.element.File");
dependency.containerEntities.add("com.x.cms.core.entity.FileInfo");
dependency.containerEntities.add("com.x.cms.core.entity.Log");
dependency.containerEntities.add("com.x.cms.core.entity.Review");
dependency.containerEntities.add("com.x.processplatform.core.entity.content.Attachment");
dependency.containerEntities.add("com.x.query.core.entity.Item");
dependency.containerEntities.add("com.x.query.core.entity.View");
dependency.containerEntities.add("com.x.cms.core.entity.AppCategoryAdmin");
dependency.containerEntities.add("com.x.cms.core.entity.AppCategoryPermission");
dependency.containerEntities.add("com.x.cms.core.entity.DocumentPermission");
dependency.containerEntities.add("com.x.cms.core.entity.ReadRemind");
dependency.storageTypes.add(StorageType.cms.toString());
dependency.storageTypes.add(StorageType.processPlatform.toString());
......
......@@ -8,6 +8,8 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -59,6 +61,7 @@ public class BBSSubjectAttachment extends StorageObject {
}
@FieldDescribe("最后更新时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "xlastUpdateTime")
@Index(name = TABLE + "_lastUpdateTime")
@CheckPersist(allowEmpty = false)
......
......@@ -12,6 +12,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
......@@ -145,6 +147,7 @@ public class BBSSubjectInfo extends SliceJpaObject {
public static final String latestReplyTime_FIELDNAME = "latestReplyTime";
@FieldDescribe("最新回复时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + latestReplyTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date latestReplyTime = null;
......@@ -199,6 +202,7 @@ public class BBSSubjectInfo extends SliceJpaObject {
public static final String bBSIndexSetterTime_FIELDNAME = "bBSIndexSetterTime";
@FieldDescribe("首页推荐时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + bBSIndexSetterTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date bBSIndexSetterTime = null;
......@@ -217,6 +221,7 @@ public class BBSSubjectInfo extends SliceJpaObject {
public static final String forumIndexSetterTime_FIELDNAME = "forumIndexSetterTime";
@FieldDescribe("论坛推荐时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + forumIndexSetterTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date forumIndexSetterTime = null;
......@@ -277,6 +282,7 @@ public class BBSSubjectInfo extends SliceJpaObject {
public static final String screamSetterTime_FIELDNAME = "screamSetterTime";
@FieldDescribe("精华设置时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + screamSetterTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date screamSetterTime = null;
......@@ -295,6 +301,7 @@ public class BBSSubjectInfo extends SliceJpaObject {
public static final String originalSetterTime_FIELDNAME = "originalSetterTime";
@FieldDescribe("原创设置时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + originalSetterTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date originalSetterTime = null;
......@@ -313,6 +320,7 @@ public class BBSSubjectInfo extends SliceJpaObject {
public static final String recommendTime_FIELDNAME = "recommendTime";
@FieldDescribe("推荐时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + recommendTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date recommendTime = null;
......@@ -343,6 +351,7 @@ public class BBSSubjectInfo extends SliceJpaObject {
public static final String voteLimitTime_FIELDNAME = "voteLimitTime";
@FieldDescribe("投票截止时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + voteLimitTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date voteLimitTime = null;
......
......@@ -11,6 +11,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.jdbc.Index;
......@@ -176,12 +178,14 @@ public class BBSUserInfo extends SliceJpaObject {
public static final String lastVisitTime_FIELDNAME = "lastVisitTime";
@FieldDescribe("上次访问时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + lastVisitTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
private Date lastVisitTime = null;
public static final String lastOperationTime_FIELDNAME = "lastOperationTime";
@FieldDescribe("最近一次操作时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + lastOperationTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
private Date lastOperationTime = null;
......
......@@ -33,7 +33,7 @@ public class ActionListWithCondition extends BaseAction {
List<Wo> wraps = null;
List<Calendar> calendarList = null;
Boolean check = true;
Boolean manager = false;
//Boolean manager = false;
List<String> unitNames = null;
List<String> groupNames = null;
String personName = effectivePerson.getDistinguishedName();
......
......@@ -14,6 +14,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
......@@ -197,6 +199,7 @@ public class Calendar_Event extends SliceJpaObject implements Cloneable, Compara
public static final String startTime_FIELDNAME = "startTime";
@FieldDescribe("事件开始时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + startTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + startTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
......@@ -211,6 +214,7 @@ public class Calendar_Event extends SliceJpaObject implements Cloneable, Compara
public static final String endTime_FIELDNAME = "endTime";
@FieldDescribe("事件结束时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + endTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + endTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
......@@ -261,6 +265,7 @@ public class Calendar_Event extends SliceJpaObject implements Cloneable, Compara
public static final String alarmTime_FIELDNAME = "alarmTime";
@FieldDescribe("当前事件提醒时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + alarmTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date alarmTime = null;
......
......@@ -14,6 +14,8 @@ import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
......@@ -201,6 +203,7 @@ public class Calendar_EventRepeatMaster extends SliceJpaObject implements Clonea
public static final String startTime_FIELDNAME = "startTime";
@FieldDescribe("事件开始时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + startTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + startTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
......@@ -208,6 +211,7 @@ public class Calendar_EventRepeatMaster extends SliceJpaObject implements Clonea
public static final String endTime_FIELDNAME = "endTime";
@FieldDescribe("事件结束时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + endTime_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + endTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
......@@ -233,6 +237,7 @@ public class Calendar_EventRepeatMaster extends SliceJpaObject implements Clonea
public static final String recurrenceStartTime_FIELDNAME = "recurrenceStartTime";
@FieldDescribe("重复开始时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + recurrenceStartTime_FIELDNAME)
@CheckPersist(allowEmpty = false)
private Date recurrenceStartTime = null;
......@@ -257,6 +262,7 @@ public class Calendar_EventRepeatMaster extends SliceJpaObject implements Clonea
public static final String alarmTime_FIELDNAME = "alarmTime";
@FieldDescribe("当前事件提醒时间")
@Temporal(TemporalType.TIMESTAMP)
@Column(name = ColumnNamePrefix + alarmTime_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date alarmTime = null;
......
......@@ -24,10 +24,6 @@ import com.x.cms.assemble.control.factory.FormFactory;
import com.x.cms.assemble.control.factory.FormFieldFactory;
import com.x.cms.assemble.control.factory.ItemFactory;
import com.x.cms.assemble.control.factory.LogFactory;
import com.x.cms.assemble.control.factory.RescissoryClass_AppCategoryAdminFactory;
import com.x.cms.assemble.control.factory.RescissoryClass_AppCategoryPermissionFactory;
import com.x.cms.assemble.control.factory.RescissoryClass_DocumentPermissionFactory;
import com.x.cms.assemble.control.factory.ReviewFactory;
import com.x.cms.assemble.control.factory.ScriptFactory;
import com.x.cms.assemble.control.factory.SearchFactory;
import com.x.cms.assemble.control.factory.TemplateFormFactory;
......@@ -72,7 +68,6 @@ public class Business {
private Organization organization;
private ItemFactory itemFactory;
private FormFieldFactory formFieldFactory;
private ReviewFactory reviewFactory;
public FileFactory fileFactory() throws Exception {
if (null == this.fileFactory) {
......@@ -81,13 +76,6 @@ public class Business {
return fileFactory;
}
public ReviewFactory reviewFactory() throws Exception {
if (null == this.reviewFactory) {
this.reviewFactory = new ReviewFactory(this);
}
return reviewFactory;
}
public FormFieldFactory formFieldFactory() throws Exception {
if (null == this.formFieldFactory) {
this.formFieldFactory = new FormFieldFactory(this);
......@@ -519,32 +507,4 @@ public class Business {
}
return result;
}
//********************************************************************************************************
//******************* 废除的属性和方法 ,使用新的数据结构来控制权限 ***************
//********************************************************************************************************
private RescissoryClass_AppCategoryPermissionFactory appCategoryPermissionFactory;
private RescissoryClass_AppCategoryAdminFactory appCategoryAdminFactory;
private RescissoryClass_DocumentPermissionFactory documentPermissionFactory;
public RescissoryClass_DocumentPermissionFactory documentPermissionFactory() throws Exception {
if (null == this.documentPermissionFactory) {
this.documentPermissionFactory = new RescissoryClass_DocumentPermissionFactory(this);
}
return documentPermissionFactory;
}
public RescissoryClass_AppCategoryPermissionFactory getAppCategoryPermissionFactory() throws Exception {
if (null == this.appCategoryPermissionFactory) {
this.appCategoryPermissionFactory = new RescissoryClass_AppCategoryPermissionFactory(this);
}
return appCategoryPermissionFactory;
}
public RescissoryClass_AppCategoryAdminFactory getAppCategoryAdminFactory() throws Exception {
if (null == this.appCategoryAdminFactory) {
this.appCategoryAdminFactory = new RescissoryClass_AppCategoryAdminFactory(this);
}
return appCategoryAdminFactory;
}
}
......@@ -7,7 +7,6 @@ import com.x.cms.assemble.control.queue.DataImportStatus;
import com.x.cms.assemble.control.queue.QueueDataRowImport;
import com.x.cms.assemble.control.queue.QueueDocumentDelete;
import com.x.cms.assemble.control.queue.QueueDocumentUpdate;
import com.x.cms.assemble.control.timertask.Timertask_DocumentReviewTask;
import com.x.cms.assemble.control.timertask.Timertask_LogRecordCheckTask;
public class ThisApplication {
......@@ -33,8 +32,6 @@ public class ThisApplication {
context().startQueue( queueDocumentUpdate );
// 每天凌晨2点执行一次
context.schedule( Timertask_LogRecordCheckTask.class, "0 0 2 * * ?" );
//每2分钟执行一次
context.schedule(Timertask_DocumentReviewTask.class, "0 */2 * * * ?");
}
public static void destroy() {
......
......@@ -150,16 +150,6 @@ public class AppInfoFactory extends AbstractFactory {
p = cb.or(p, root.get(AppInfo_.appName).in(appAliases));
return em.createQuery(cq.where(p)).getResultList();
}
public List<AppInfo> listInReviewAppInfoList() throws Exception {
EntityManager em = this.entityManagerContainer().get(AppInfo.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<AppInfo> cq = cb.createQuery(AppInfo.class);
Root<AppInfo> root = cq.from(AppInfo.class);
Predicate p = cb.equal( root.get(AppInfo_.documentType), "信息");
p = cb.and(p, cb.or(cb.isFalse( root.get(AppInfo_.reviewed ) ), cb.isNull(root.get(AppInfo_.reviewed ))));
return em.createQuery(cq.where(p)).getResultList();
}
public <T extends AppInfo> List<T> sort(List<T> list) {
list = list.stream()
......
......@@ -73,17 +73,7 @@ public class CategoryInfoFactory extends AbstractFactory {
cq.select(root.get( CategoryInfo_.id));
return em.createQuery( cq.where(p) ).setMaxResults(1000).getResultList();
}
public List<CategoryInfo> listInReviewCategoryInfoList() throws Exception {
EntityManager em = this.entityManagerContainer().get(CategoryInfo.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<CategoryInfo> cq = cb.createQuery(CategoryInfo.class);
Root<CategoryInfo> root = cq.from(CategoryInfo.class);
Predicate p = cb.equal( root.get(CategoryInfo_.documentType), "信息");
p = cb.and(p, cb.or(cb.isFalse( root.get(CategoryInfo_.reviewed ) ), cb.isNull(root.get(CategoryInfo_.reviewed ))));
return em.createQuery(cq.where(p)).getResultList();
}
public List<String> listByAppIds( List<String> appIds, String documentType, Boolean manager, Integer maxCount ) throws Exception {
EntityManager em = this.entityManagerContainer().get( CategoryInfo.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
......
......@@ -50,16 +50,6 @@ public class DocumentFactory<T> extends AbstractFactory {
return em.createQuery(cq).getResultList();
}
//@MethodDescribe("列示指定Id的Document信息列表")
// public List<Document> list(List<String> ids) throws Exception {
// EntityManager em = this.entityManagerContainer().get( Document.class );
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Document> cq = cb.createQuery( Document.class );
// Root<Document> root = cq.from( Document.class );
// Predicate p = root.get( Document_.id).in( ids );
// return em.createQuery(cq.where(p)).getResultList();
// }
//@MethodDescribe("根据应用ID列示所有的Document信息列表")
public List<String> listByAppId( String appId, String documentType, Integer maxCount ) throws Exception {
EntityManager em = this.entityManagerContainer().get( Document.class );
......@@ -96,19 +86,6 @@ public class DocumentFactory<T> extends AbstractFactory {
return em.createQuery(cq).getSingleResult();
}
// public Long countWithDocIds(List<String> viewAbleDocIds) throws Exception {
// if( viewAbleDocIds == null || viewAbleDocIds.isEmpty() ){
// return 0L;
// }
// EntityManager em = this.entityManagerContainer().get( Document.class );
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Long> cq = cb.createQuery( Long.class );
// Root<Document> root = cq.from( Document.class );
// Predicate p = root.get( Document_.id ).in( viewAbleDocIds );
// cq.select( cb.count( root ) );
// return em.createQuery(cq.where(p)).getSingleResult();
// }
public List<Document> listInReviewDocumentList( Integer maxCount ) throws Exception {
EntityManager em = this.entityManagerContainer().get(Document.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
......
package com.x.cms.assemble.control.factory;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.base.core.project.exception.ExceptionWhen;
import com.x.cms.assemble.control.AbstractFactory;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.AppCategoryAdmin;
import com.x.cms.core.entity.AppCategoryAdmin_;
/**
* 应用分类管理员配置管理表基础功能服务类
*
* @author O2LEE
*/
public class RescissoryClass_AppCategoryAdminFactory extends AbstractFactory {
public RescissoryClass_AppCategoryAdminFactory( Business business ) throws Exception {
super(business);
}
/**
* @param id
* @return AppCategoryAdmin
* @throws Exception
*/
//@MethodDescribe("获取指定Id的AppCategoryAdmin应用分类管理员配置信息对象")
public AppCategoryAdmin get( String id ) throws Exception {
return this.entityManagerContainer().find( id, AppCategoryAdmin.class, ExceptionWhen.none );
}
/**
* @return List:String
* @throws Exception
*/
@SuppressWarnings("unused")
//@MethodDescribe("列示全部的AppCategoryAdmin应用分类管理员配置信息ID列表")
public List<AppCategoryAdmin> listAll() throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryAdmin.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<AppCategoryAdmin> cq = cb.createQuery(AppCategoryAdmin.class);
Root<AppCategoryAdmin> root = cq.from(AppCategoryAdmin.class);
return em.createQuery(cq).getResultList();
}
/**
*
* @param ids 需要查询的ID列表
* @return List:AppCategoryAdmin
* @throws Exception
*/
//@MethodDescribe("列示指定Id的AppCategoryAdmin应用分类管理员配置信息列表")
public List<AppCategoryAdmin> list( List<String> ids ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryAdmin.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<AppCategoryAdmin> cq = cb.createQuery( AppCategoryAdmin.class );
Root<AppCategoryAdmin> root = cq.from( AppCategoryAdmin.class );
Predicate p = root.get( AppCategoryAdmin_.id ).in(ids);
return em.createQuery(cq.where(p)).getResultList();
}
/**
* 列示指定目录相关的所有管理员配置信息ID列表
* @param person 用户UID
* @return List:String (AppCategoryAdmin_.id)
* @throws Exception
*/
//@MethodDescribe("列示指定目录相关的所有管理员配置信息ID列表")
public List<String> listAppCategoryIdByCategoryId( String categoryId ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryAdmin.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryAdmin> root = cq.from( AppCategoryAdmin.class );
Predicate p = cb.equal(root.get( AppCategoryAdmin_.objectId ), categoryId );
p = cb.and( p, cb.equal(root.get( AppCategoryAdmin_.objectType ), "CATEGORY" ) );
cq.select( root.get( AppCategoryAdmin_.id ) );
return em.createQuery( cq.where(p) ).getResultList();
}
/**
* 列示指定应用栏目相关的所有管理员配置信息ID列表
* @param person 用户UID
* @return List:String (AppCategoryAdmin_.id)
* @throws Exception
*/
//@MethodDescribe("列示指定应用栏目相关的所有管理员配置信息ID列表")
public List<String> listAppCategoryIdByAppId( String appId ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryAdmin.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryAdmin> root = cq.from( AppCategoryAdmin.class );
Predicate p = cb.equal(root.get( AppCategoryAdmin_.objectId ), appId );
p = cb.and( p, cb.equal(root.get( AppCategoryAdmin_.objectType ), "APPINFO" ) );
cq.select( root.get( AppCategoryAdmin_.id ) );
return em.createQuery( cq.where(p) ).getResultList();
}
/**
* 列示指定应用栏目相关的所有管理员配置信息ID列表
* @param person 用户UID
* @return List:String (AppCategoryAdmin_.id)
* @throws Exception
*/
//@MethodDescribe("列示指定应用栏目相关的所有管理员配置信息ID列表")
public List<String> listAppCategoryIdByAppId( String appId, String personName ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryAdmin.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryAdmin> root = cq.from( AppCategoryAdmin.class );
Predicate p = cb.equal(root.get( AppCategoryAdmin_.objectId ), appId );
p = cb.and( p, cb.equal(root.get( AppCategoryAdmin_.objectType ), "APPINFO" ) );
p = cb.and( p, cb.equal(root.get( AppCategoryAdmin_.adminName ), personName ) );
cq.select( root.get( AppCategoryAdmin_.id ) );
return em.createQuery( cq.where(p) ).getResultList();
}
/**
* 列示指定应用栏目相关的所有管理员配置信息ID列表
* @param person 用户UID
* @return List:String (AppCategoryAdmin_.id)
* @throws Exception
*/
//@MethodDescribe("列示指定应用栏目相关的所有管理员配置信息ID列表")
public List<String> listAppCategoryIdByUser( String uid ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryAdmin.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryAdmin> root = cq.from( AppCategoryAdmin.class );
Predicate p = cb.equal(root.get( AppCategoryAdmin_.adminUid ), uid );
cq.select( root.get( AppCategoryAdmin_.id ) );
return em.createQuery( cq.where(p) ).getResultList();
}
/**
* 列示指定用户可以管理的全部的对象信息ID列表
* @param person 用户UID
* @param objectType 对象类别 ( ALL | APP | CATEGORY )
* @return List:String (AppCategoryAdmin_.objectId)
* @throws Exception
*/
//@MethodDescribe("列示指定用户可以管理的全部的对象信息ID列表")
public List<String> listAppCategoryIdByAdminName( String person, String objectType ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryAdmin.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryAdmin> root = cq.from( AppCategoryAdmin.class );
Predicate p = null;
//如果需要查询指定用户的权限
if( person != null && !person.isEmpty() ){
p = cb.equal(root.get( AppCategoryAdmin_.adminUid ), person );
}
//如果需要查询指定类别的权限
if( p != null ){//说明前面有用户的查询条件
if( !"ALL".equalsIgnoreCase( objectType )){
//查询指定用户所有的指定类别的配置信息
p = cb.and(p, cb.equal(root.get( AppCategoryAdmin_.objectType ), objectType ) );
}
}else{
//没有用户查询条件
if( !"ALL".equalsIgnoreCase( objectType )){
//查询指定用户所有的指定类别的配置信息
p = cb.equal(root.get( AppCategoryAdmin_.objectType ), objectType );
}
}
cq.select( root.get( AppCategoryAdmin_.id ) );
if( p != null ){
return em.createQuery( cq.where( p ) ).getResultList();
}else{
return em.createQuery( cq ).getResultList();
}
}
/**
* 判断用户是否是指定的应用或者分类的管理员
* @param person 用户UID
* @param objectType 对象类别 ( ALL | APP | CATEGORY )
* @param objectId
* @return List:String (AppCategoryAdmin_.objectId)
* @throws Exception
*/
//@MethodDescribe("列示指定用户可以管理的全部的对象信息ID列表")
public boolean isAdmin( String person, String objectType, String objectId ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryAdmin.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryAdmin> root = cq.from( AppCategoryAdmin.class );
Predicate p = cb.equal(root.get( AppCategoryAdmin_.adminUid ), person );
if( objectType == null || person == null || objectId == null ){
return false;
}else{
//查询指定用户所有的指定类别的配置信息
p = cb.and( p,
cb.equal(root.get( AppCategoryAdmin_.objectType ), objectType ),
cb.equal(root.get( AppCategoryAdmin_.objectId ), objectId ),
cb.equal(root.get( AppCategoryAdmin_.adminLevel ), "ADMIN" )
);
}
cq.select( root.get( AppCategoryAdmin_.id ) );
List<String> ids = em.createQuery( cq.where(p) ).getResultList();
if( ids == null || ids.size() == 0 ){
return false;
}else{
return true;
}
}
/**
* 根据人员姓名获取用户可以管理的分类目ID列表
* @param personName
* @return
* @throws Exception
*/
public List<String> listCategoryInfoIdsByAdminName( String personName ) throws Exception {
EntityManager em = this.entityManagerContainer().get(AppCategoryAdmin.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryAdmin> root = cq.from(AppCategoryAdmin.class);
Predicate p = cb.isNotNull( root.get(AppCategoryAdmin_.objectId ) );
p = cb.and( p, cb.equal( root.get(AppCategoryAdmin_.adminName ), personName ) );
p = cb.and( p, cb.equal( root.get(AppCategoryAdmin_.objectType ), "CATEGORY" ) );
cq.select(root.get(AppCategoryAdmin_.objectId ));
return em.createQuery(cq.where(p)).getResultList();
}
public List<String> listAppCategoryIdByCondition( String objectType, String objectId, String personName ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryAdmin.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryAdmin> root = cq.from(AppCategoryAdmin.class);
Predicate p = cb.isNotNull( root.get(AppCategoryAdmin_.objectId ) );
if( objectType != null && !objectType.isEmpty() ){
p = cb.and( p, cb.equal( root.get(AppCategoryAdmin_.objectType ), objectType ) );
}
if( personName != null && !personName.isEmpty() ){
p = cb.and( p, cb.equal( root.get(AppCategoryAdmin_.adminName ), personName ) );
}
if( objectId != null && !objectId.isEmpty() ){
p = cb.and( p, cb.equal( root.get(AppCategoryAdmin_.objectId ), objectId ) );
}
cq.select(root.get(AppCategoryAdmin_.objectId ));
return em.createQuery(cq.where(p)).getResultList();
}
}
\ No newline at end of file
package com.x.cms.assemble.control.factory;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.base.core.project.exception.ExceptionWhen;
import com.x.cms.assemble.control.AbstractFactory;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.AppCategoryPermission;
import com.x.cms.core.entity.AppCategoryPermission_;
/**
* 应用分类权限管理表基础功能服务类
*
* @author O2LEE
*/
public class RescissoryClass_AppCategoryPermissionFactory extends AbstractFactory {
public RescissoryClass_AppCategoryPermissionFactory( Business business ) throws Exception {
super(business);
}
//@MethodDescribe("获取指定Id的AppCategoryPermission应用分类权限配置信息对象")
public AppCategoryPermission get( String id ) throws Exception {
return this.entityManagerContainer().find( id, AppCategoryPermission.class, ExceptionWhen.none );
}
@SuppressWarnings("unused")
//@MethodDescribe("列示全部的AppCategoryPermission应用分类权限配置信息列表")
public List<AppCategoryPermission> listAll() throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<AppCategoryPermission> cq = cb.createQuery(AppCategoryPermission.class);
Root<AppCategoryPermission> root = cq.from(AppCategoryPermission.class);
return em.createQuery(cq).getResultList();
}
//@MethodDescribe("列示指定Id的AppCategoryPermission应用分类权限配置信息列表")
public List<AppCategoryPermission> list(List<String> ids) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<AppCategoryPermission> cq = cb.createQuery( AppCategoryPermission.class );
Root<AppCategoryPermission> root = cq.from( AppCategoryPermission.class );
Predicate p = root.get(AppCategoryPermission_.id).in(ids);
return em.createQuery(cq.where(p)).getResultList();
}
/**
* 列示指定应用栏目的所有权限配置信息
* @param appId
* @param permission
* @return
* @throws Exception
*/
//@MethodDescribe("列示指定应用栏目的所有权限配置信息")
public List<String> listPermissionByAppInfo( String appId, String permission ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryPermission> root = cq.from( AppCategoryPermission.class );
Predicate p = cb.equal(root.get( AppCategoryPermission_.objectType ), "APPINFO");
p = cb.and(p, cb.equal(root.get( AppCategoryPermission_.objectId ),appId) );
if( permission != null && !permission.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.permission ),permission ) );
}
cq.select( root.get( AppCategoryPermission_.id ) );
return em.createQuery( cq.where(p) ).getResultList();
}
/**
* 列示指定分类的所有权限配置信息
* @param categoryId
* @param permission
* @return
* @throws Exception
*/
//@MethodDescribe("列示指定分类的所有权限配置信息")
public List<String> listPermissionByCataogry( String categoryId, String permission ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryPermission> root = cq.from( AppCategoryPermission.class );
Predicate p = cb.equal(root.get( AppCategoryPermission_.objectType ), "CATEGORY");
p = cb.and(p, cb.equal(root.get( AppCategoryPermission_.objectId ),categoryId) );
if( permission != null && !permission.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.permission ),permission ) );
}
cq.select( root.get( AppCategoryPermission_.id ) );
return em.createQuery( cq.where(p) ).getResultList();
}
/**
* 根据对象类别以及权限类别查询涉及权限的所有栏目ID列表
*
* @param type
* @param permission
* @return
* @throws Exception
*/
//@MethodDescribe("根据对象类别以及权限类别查询涉及权限的所有栏目ID列表")
public List<String> listAllAppInfoIds( String type, String permission ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery( String.class );
Root<AppCategoryPermission> root = cq.from( AppCategoryPermission.class );
Predicate p = cb.isNotNull( root.get( AppCategoryPermission_.id ) );
if( type != null && !type.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.objectType ), type ) );
}
if( permission != null && !permission.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.permission ), permission ) );
}
cq.distinct(true).select( root.get( AppCategoryPermission_.appId ) );
return em.createQuery(cq.where(p)).getResultList();
}
/**
* 根据权限类别查询涉及权限的所有分类ID列表
*
* @param permission
* @return
* @throws Exception
*/
//@MethodDescribe("根据权限类别查询涉及权限的所有分类ID列表")
public List<String> listAllCategoryInfoIds( String permission ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryPermission> root = cq.from(AppCategoryPermission.class);
Predicate p = cb.equal(root.get( AppCategoryPermission_.objectType ), "CATEGORY");
if( permission != null && !permission.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.permission ),permission ) );
}
cq.distinct(true).select( root.get( AppCategoryPermission_.objectId ) );
return em.createQuery(cq.where(p)).getResultList();
}
/**
* 根据权限类别查询涉及权限的所有分类ID列表
*
* @param permission
* @return
* @throws Exception
*/
//@MethodDescribe("根据权限类别查询涉及权限的所有分类ID列表")
public List<String> listAllCategoryInfoIds( String appId, String permission ) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryPermission> root = cq.from(AppCategoryPermission.class);
Predicate p = cb.equal(root.get( AppCategoryPermission_.objectType ), "CATEGORY");
if( appId != null && !appId.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.appId ),appId ) );
}
if( permission != null && !permission.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.permission ),permission ) );
}
cq.distinct(true).select( root.get( AppCategoryPermission_.objectId ) );
return em.createQuery(cq.where(p)).getResultList();
}
/**
* 根据用户姓名以及用户所在的顶层组织和组织列表以及权限类别查询该用户可以访问到的所有应用栏目ID列表
* @param name
* @param unitNames
* @param topUnitNames
* @param groupNames
* @param permission
* @return
* @throws Exception
*/
//@MethodDescribe("根据用户姓名以及用户所在的顶层组织和组织列表以及权限类别查询该用户可以访问到的所有应用栏目ID列表")
public List<String> listAppInfoIdsByPermission( String name, List<String> unitNames, List<String> groupNames, String appId, String permission ) throws Exception {
if( ( name == null || name.isEmpty() )
&& ( unitNames == null || unitNames.isEmpty() )
){
throw new Exception( "name and unitNames can not be all null, query needs one condition." );
}
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryPermission> root = cq.from(AppCategoryPermission.class);
Predicate p = cb.equal(root.get( AppCategoryPermission_.objectType ), "APPINFO");
Predicate p_or = null;
Predicate p_or_user = null;
Predicate p_or_dept = null;
Predicate p_or_grop = null;
if( appId != null && !appId.isEmpty() ){
p = cb.and( p, cb.equal( root.get( AppCategoryPermission_.appId ), appId) );
}
if( permission != null && !permission.isEmpty() ){
p = cb.and( p, cb.equal( root.get( AppCategoryPermission_.permission ), permission) );
}
if( name != null && !name.isEmpty() ){
p_or_user = cb.equal(root.get( AppCategoryPermission_.usedObjectType ), "USER");
p_or_user = cb.and( p_or_user, cb.equal(root.get( AppCategoryPermission_.usedObjectName ), name ) );
p_or = p_or_user;
}
if( unitNames != null && !unitNames.isEmpty() ){
p_or_dept = cb.equal(root.get( AppCategoryPermission_.usedObjectType ), "UNIT");
p_or_dept = cb.and( p_or_dept, root.get( AppCategoryPermission_.usedObjectName ).in( unitNames ) );
if( p_or == null ){
p_or = p_or_dept;
}else{
p_or = cb.or( p_or, p_or_dept );
}
}
if( groupNames != null && !groupNames.isEmpty() ){
p_or_grop = cb.equal(root.get( AppCategoryPermission_.usedObjectType ), "GROUP");
p_or_grop = cb.and( p_or_grop, root.get( AppCategoryPermission_.usedObjectName ).in( groupNames ) );
if( p_or == null ){
p_or = p_or_grop;
}else{
p_or = cb.or( p_or, p_or_grop );
}
}
p = cb.and( p, p_or );
cq.distinct(true).select( root.get( AppCategoryPermission_.objectId ) );
return em.createQuery(cq.where(p)).getResultList();
}
/**
* 根据用户姓名以及用户所在的顶层组织和组织列表以及权限类别查询该用户可以访问到的所有分类ID列表
* @param name
* @param unitNames
* @param topUnitNames
* @param groupNames
* @param appId
* @param permission
* @return
* @throws Exception
*/
//@MethodDescribe("根据用户姓名以及用户所在的顶层组织和组织列表以及权限类别查询该用户可以访问到的所有分类ID列表")
public List<String> listCategoryIdsByPermission( String name, List<String> unitNames, List<String> groupNames, String appId, String permission ) throws Exception {
if( ( name == null || name.isEmpty() )
&& ( unitNames == null || unitNames.isEmpty() )
){
throw new Exception( "name, unitNames can not be all null, query needs one condition." );
}
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<AppCategoryPermission> root = cq.from(AppCategoryPermission.class);
Predicate p = cb.equal(root.get( AppCategoryPermission_.objectType ), "CATEGORY");
Predicate p_or = null;
Predicate p_or_user = null;
Predicate p_or_dept = null;
Predicate p_or_grop = null;
if( appId != null && !appId.isEmpty() ){
p = cb.and( p, cb.equal( root.get( AppCategoryPermission_.appId ), appId) );
}
if( permission != null && !permission.isEmpty() ){
p = cb.and( p, cb.equal( root.get( AppCategoryPermission_.permission ), permission) );
}
if( name != null && !name.isEmpty() ){
p_or_user = cb.equal(root.get( AppCategoryPermission_.usedObjectType ), "USER");
p_or_user = cb.and( p_or_user, cb.equal(root.get( AppCategoryPermission_.usedObjectName ), name ) );
p_or = p_or_user;
}
if( unitNames != null && !unitNames.isEmpty() ){
p_or_dept = cb.equal(root.get( AppCategoryPermission_.usedObjectType ), "UNIT");
p_or_dept = cb.and( p_or_dept, root.get( AppCategoryPermission_.usedObjectName ).in( unitNames ) );
if( p_or == null ){
p_or = p_or_dept;
}else{
p_or = cb.or( p_or, p_or_dept );
}
}
if( groupNames != null && !groupNames.isEmpty() ){
p_or_grop = cb.equal(root.get( AppCategoryPermission_.usedObjectType ), "GROUP");
p_or_grop = cb.and( p_or_grop, root.get( AppCategoryPermission_.usedObjectName ).in( groupNames ) );
if( p_or == null ){
p_or = p_or_grop;
}else{
p_or = cb.or( p_or, p_or_grop );
}
}
p = cb.and( p, p_or );
cq.distinct(true).select( root.get( AppCategoryPermission_.objectId ) );
return em.createQuery(cq.where(p)).getResultList();
}
public List<String> listAppCategoryIdByCondition(String objectType, String objectId, String personName, String permission) throws Exception {
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery( String.class );
Root<AppCategoryPermission> root = cq.from( AppCategoryPermission.class );
Predicate p = cb.isNotNull( root.get( AppCategoryPermission_.id ) );
if( objectType != null && !objectType.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.objectType ),objectType ) );
}
if( objectId != null && !objectId.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.objectId ),objectId ) );
}
if( personName != null && !personName.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.usedObjectName ),personName ) );
}
if( permission != null && !permission.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.permission ),permission ) );
}
cq.select( root.get( AppCategoryPermission_.id ) );
return em.createQuery( cq.where(p) ).getResultList();
}
public List<String> listAppInfoIdsByPermission( List<String> queryObjectNames, String queryObjectType, String objectType, String permission) throws Exception {
if( queryObjectNames == null || queryObjectNames.isEmpty() ){
throw new Exception( "queryObjectNames is null." );
}
EntityManager em = this.entityManagerContainer().get( AppCategoryPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery( String.class );
Root<AppCategoryPermission> root = cq.from( AppCategoryPermission.class );
Predicate p = root.get( AppCategoryPermission_.usedObjectName ).in( queryObjectNames );
if( queryObjectType != null && !queryObjectType.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.usedObjectType ),queryObjectType ) );
}
if( objectType != null && !objectType.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.objectType ),objectType ) );
}
if( permission != null && !permission.isEmpty() ){
p = cb.and(p, cb.equal( root.get( AppCategoryPermission_.permission ),permission ) );
}
cq.select( root.get( AppCategoryPermission_.objectId ) );
return em.createQuery( cq.where(p) ).getResultList();
}
}
\ No newline at end of file
package com.x.cms.assemble.control.factory;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.cms.assemble.control.AbstractFactory;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.DocumentPermission;
import com.x.cms.core.entity.DocumentPermission_;
import com.x.cms.core.entity.tools.DateOperation;
/**
* 文档权限基础功能服务类
*
* @author O2LEE
*/
public class RescissoryClass_DocumentPermissionFactory extends AbstractFactory {
public RescissoryClass_DocumentPermissionFactory(Business business) throws Exception {
super(business);
}
//@MethodDescribe("列示指定Id的DocumentPermission信息列表")
public List<DocumentPermission> list( List<String> ids ) throws Exception {
EntityManager em = this.entityManagerContainer().get( DocumentPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<DocumentPermission> cq = cb.createQuery( DocumentPermission.class );
Root<DocumentPermission> root = cq.from( DocumentPermission.class );
Predicate p = root.get( DocumentPermission_.id).in( ids );
return em.createQuery(cq.where(p)).getResultList();
}
public List<String> listIds(String docId, List<String> permissionCodes, String permission) throws Exception {
EntityManager em = this.entityManagerContainer().get( DocumentPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery( String.class );
Root<DocumentPermission> root = cq.from( DocumentPermission.class );
Predicate p = cb.equal( root.get( DocumentPermission_.documentId ), docId );
p = cb.and( p, cb.equal( root.get( DocumentPermission_.permission ), permission ) );
p = cb.and( p, root.get( DocumentPermission_.permissionObjectCode ).in( permissionCodes ) );
cq.select( root.get( DocumentPermission_.id ));
return em.createQuery(cq.where(p)).getResultList();
}
//@MethodDescribe("根据指定的信息查询文档权限记录ID列表")
public List<String> listIds( String docId, String permission, String permissionObjectType, String permissionObjectCode ) throws Exception {
EntityManager em = this.entityManagerContainer().get( DocumentPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery( String.class );
Root<DocumentPermission> root = cq.from( DocumentPermission.class );
Predicate p = cb.equal( root.get( DocumentPermission_.documentId ), docId );
p = cb.and( p, cb.equal( root.get( DocumentPermission_.permission ), permission ) );
p = cb.and( p, cb.equal( root.get( DocumentPermission_.permissionObjectType ), permissionObjectType ) );
p = cb.and( p, cb.equal( root.get( DocumentPermission_.permissionObjectCode ), permissionObjectCode ) );
cq.select( root.get( DocumentPermission_.id ));
return em.createQuery(cq.where(p)).getResultList();
}
//@MethodDescribe("根据文档ID查询文档所有的权限信息ID列表")
public List<String> listIdsByDocumentId( String docId ) throws Exception {
EntityManager em = this.entityManagerContainer().get( DocumentPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery( String.class );
Root<DocumentPermission> root = cq.from( DocumentPermission.class );
Predicate p = cb.equal( root.get( DocumentPermission_.documentId ), docId );
cq.select( root.get( DocumentPermission_.id ));
return em.createQuery(cq.where(p)).getResultList();
}
//@MethodDescribe("查询未被更新过的文档权限信息ID列表")
public List<String> listNoModifyIds(String docId, String updateFlag) throws Exception {
EntityManager em = this.entityManagerContainer().get( DocumentPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery( String.class );
Root<DocumentPermission> root = cq.from( DocumentPermission.class );
Predicate p = cb.equal( root.get( DocumentPermission_.documentId ), docId );
p = cb.and( p, cb.notEqual( root.get( DocumentPermission_.updateFlag ), updateFlag ) );
cq.select( root.get( DocumentPermission_.id ));
return em.createQuery(cq.where(p)).getResultList();
}
//@MethodDescribe("根据条件查询出用户可访问的文档ID列表,按发布时间倒排序,取前500条")
public List<String> lisViewableDocIdsWithFilter1( List<String> appIdList,
List<String> categoryIdList, List<String> publisherList, String title, List<String> createDateList,
List<String> publishDateList, List<String> statusList, List<String> permissionObjectCodeList,
List<String> viewableCategoryIds,
Integer maxResultCount ) throws Exception {
Date startDate = null;
Date endDate = null;
List<String> ids = new ArrayList<>();
List<DocumentPermission> permissions = null;
DateOperation dateOperation = new DateOperation();
EntityManager em = this.entityManagerContainer().get( DocumentPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<DocumentPermission> cq = cb.createQuery( DocumentPermission.class );
Root<DocumentPermission> root = cq.from( DocumentPermission.class );
//先圈定用户能访问的文档
Predicate permissionWhere = root.get( DocumentPermission_.permissionObjectCode ).in( permissionObjectCodeList );
//所有人可访问的文档
permissionWhere = cb.or( permissionWhere, cb.equal( root.get( DocumentPermission_.permissionObjectCode ), "所有人") );
//或者用户可管理的分类中所有的文档
permissionWhere = cb.or( permissionWhere, root.get( DocumentPermission_.categoryId ).in( viewableCategoryIds ) );
Predicate p = cb.isNotNull( root.get( DocumentPermission_.id ) );
if( appIdList != null && !appIdList.isEmpty() ){
p = cb.and( p, root.get( DocumentPermission_.appId ).in( appIdList ));
}
if( categoryIdList != null && !categoryIdList.isEmpty() ){
p = cb.and( p, root.get( DocumentPermission_.categoryId ).in( categoryIdList ));
}
if( publisherList != null && !publisherList.isEmpty() ){
p = cb.and( p, root.get( DocumentPermission_.publisher ).in( publisherList ));
}
if( title != null && !title.isEmpty() ){
p = cb.and( p, cb.like( root.get( DocumentPermission_.title ), "%" + title + "%" ));
}
if( statusList == null || statusList.isEmpty() ){
p = cb.and( p, cb.equal(root.get( DocumentPermission_.documentStatus ), "published"));
}else{
p = cb.and( p, root.get( DocumentPermission_.documentStatus ).in( statusList ));
}
if( createDateList != null && !createDateList.isEmpty() ){
if ( createDateList.size() == 1 ) {// 从开始时间(yyyy-MM-DD),到现在
startDate = dateOperation.getDateFromString( createDateList.get(0).toString() );
endDate = new Date();
}else if( createDateList.size() == 2 ){// 从开始时间到结束时间(yyyy-MM-DD)
startDate = dateOperation.getDateFromString( createDateList.get(0).toString());
endDate = dateOperation.getDateFromString( createDateList.get(1).toString());
}
p = cb.and( p, cb.between( root.get( DocumentPermission_.docCreateDate ), startDate, endDate ) );
}
if( publishDateList != null && !publishDateList.isEmpty() ){
if ( publishDateList.size() == 1 ) {
// 从开始时间(yyyy-MM-DD),到现在
startDate = dateOperation.getDateFromString( publishDateList.get(0).toString() );
endDate = new Date();
}else if( publishDateList.size() == 2 ){
// 从开始时间到结束时间(yyyy-MM-DD)
startDate = dateOperation.getDateFromString( publishDateList.get(0).toString());
endDate = dateOperation.getDateFromString( publishDateList.get(1).toString());
}
p = cb.and( p, cb.between( root.get( DocumentPermission_.publishDate ), startDate, endDate ) );
}
cq.orderBy( cb.desc( root.get( DocumentPermission_.publishDate ) ) );
if( maxResultCount == null || maxResultCount == 0 ){
maxResultCount = 500;
}
permissions = em.createQuery(cq.where( permissionWhere, p )).setMaxResults( maxResultCount ).getResultList();
if( permissions != null && !permissions.isEmpty() ){
for( DocumentPermission permission : permissions ){
if( !ids.contains( permission.getDocumentId() )){
ids.add( permission.getDocumentId() );
}
}
}
return ids;
}
public List<String> getWithNullScartchString( int maxCount ) throws Exception {
EntityManager em = this.entityManagerContainer().get( DocumentPermission.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery( String.class );
Root<DocumentPermission> root = cq.from( DocumentPermission.class );
Predicate p = cb.isNull( root.get( DocumentPermission_.scratchString ) );
cq.select( root.get( DocumentPermission_.id ));
return em.createQuery( cq.where(p) ).setMaxResults( maxCount ).getResultList();
}
}
\ No newline at end of file
package com.x.cms.assemble.control.factory;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import com.x.base.core.project.exception.ExceptionWhen;
import com.x.cms.assemble.control.AbstractFactory;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.Review;
import com.x.cms.core.entity.Review_;
/**
* Review管理表基础功能服务类
*
* @author O2LEE
*/
public class ReviewFactory extends AbstractFactory {
public ReviewFactory( Business business ) throws Exception {
super(business);
}
public Review get( String id ) throws Exception {
return this.entityManagerContainer().find( id, Review.class, ExceptionWhen.none );
}
public List<String> listWithDocument( String docId ) throws Exception {
EntityManager em = this.entityManagerContainer().get( Review.class );
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<String> cq = cb.createQuery(String.class);
Root<Review> root = cq.from(Review.class);
cq.select(root.get(Review_.id));
Predicate p = cb.equal( root.get(Review_.documentId), docId );
return em.createQuery(cq.where(p)).getResultList();
}
// public List<Review> list(List<String> ids) throws Exception {
// EntityManager em = this.entityManagerContainer().get( Review.class );
// CriteriaBuilder cb = em.getCriteriaBuilder();
// CriteriaQuery<Review> cq = cb.createQuery( Review.class );
// Root<Review> root = cq.from( Review.class );
// Predicate p = root.get(Review_.id).in(ids);
// return em.createQuery(cq.where(p)).getResultList();
// }
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import com.x.cms.assemble.control.jaxrs.appdict.AppDictAction;
import com.x.cms.assemble.control.jaxrs.appdict.AppDictAnonymousAction;
import com.x.cms.assemble.control.jaxrs.appdictdesign.AppDictDesignAction;
import com.x.cms.assemble.control.jaxrs.appinfo.AppInfoAction;
import com.x.cms.assemble.control.jaxrs.appinfo.AppInfoAnonymousAction;
import com.x.cms.assemble.control.jaxrs.categoryinfo.CategoryInfoAction;
import com.x.cms.assemble.control.jaxrs.categoryinfo.CategoryInfoAnonymousAction;
import com.x.cms.assemble.control.jaxrs.data.DataAction;
......@@ -70,6 +71,7 @@ public class ActionApplication extends AbstractActionApplication {
this.classes.add(OutputAction.class);
this.classes.add(PermissionAction.class);
this.classes.add(AppInfoAnonymousAction.class);
this.classes.add(AppDictAnonymousAction.class);
this.classes.add(CategoryInfoAnonymousAction.class);
this.classes.add(DocumentAnonymousAction.class);
......
......@@ -4,19 +4,22 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.cms.core.entity.AppInfo;
public class ActionUpdateReviewForce extends BaseAction {
import net.sf.ehcache.Element;
private static Logger logger = LoggerFactory.getLogger( ActionUpdateReviewForce.class );
public class ActionGetAnonymous extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionGetAnonymous.class );
protected ActionResult<WoId> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag ) throws Exception {
ActionResult<WoId> result = new ActionResult<>();
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = null;
AppInfo appInfo = null;
Boolean check = true;
......@@ -26,42 +29,44 @@ public class ActionUpdateReviewForce extends BaseAction {
result.error( exception );
}
if( check ){
try {
appInfo = appInfoServiceAdv.getWithFlag( flag );
if( appInfo == null ){
String cacheKey = ApplicationCache.concreteCacheKey( flag );
Element element = cache.get( cacheKey );
if (( null != element ) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
result.setData( wo );
} else {
if( check ){
try {
appInfo = appInfoServiceAdv.getWithFlag( flag );
if( appInfo == null ){
check = false;
Exception exception = new ExceptionAppInfoNotExists( flag );
result.error( exception );
}else {
if( !appInfo.getAnonymousAble() ){
check = false;
Exception exception = new ExceptionAppInfoAccessDenied("栏目信息不允许匿名访问!");
result.error( exception );
}
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoNotExists( flag );
Exception exception = new ExceptionAppInfoProcess( e, "根据指定flag查询应用栏目信息对象时发生异常。flag:" + flag );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess( e, "根据指定flag查询应用栏目信息对象时发生异常。flag:" + flag );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
try {
permissionOperateService.refreshReviewWithAppId( appInfo.getId() );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess( e, "根据指定强制更新信息存根Review信息时发生异常。ID:" + appInfo.getId() );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
try {
WoId wo = new WoId();
wo.setId( appInfo.getId() );
result.setData( wo );
} catch (Exception e) {
Exception exception = new ExceptionAppInfoProcess( e, "将查询出来的应用栏目信息对象转换为可输出的数据信息时发生异常。" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
if( check ){
try {
wo = Wo.copier.copy( appInfo );
cache.put(new Element( cacheKey, wo ));
result.setData( wo );
} catch (Exception e) {
Exception exception = new ExceptionAppInfoProcess( e, "将查询出来的应用栏目信息对象转换为可输出的数据信息时发生异常。" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
}
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.EqualsTerms;
import com.x.base.core.project.jaxrs.InTerms;
import com.x.base.core.project.jaxrs.LikeTerms;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
public class ActionListNextWithFilterAnonymous extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionListNextWithFilterAnonymous.class);
protected ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson, String id,
Integer count, JsonElement jsonElement) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
EqualsTerms equals = new EqualsTerms();
InTerms ins = new InTerms();
LikeTerms likes = new LikeTerms();
Wi wi = null;
Boolean check = true;
try {
wi = this.convertToWrapIn(jsonElement, Wi.class);
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess(e, "系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString());
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
if (check) {
if (wi == null) {
result.setCount(0L);
result.setData(new ArrayList<Wo>());
return result;
}
if (id == null) {
id = "(0)";
}
if (count == null) {
count = 20;
}
if ((null != wi.getAppIdList()) && (!wi.getAppIdList().isEmpty())) {
ins.put("id", wi.getAppIdList());
}
if ((null != wi.getCreatorList()) && (!wi.getCreatorList().isEmpty())) {
ins.put("creatorUid", wi.getCreatorList());
}
if (StringUtils.isNotEmpty(wi.getKey())) {
String key = StringUtils.trim(StringUtils.replace(wi.getKey(), "\u3000", " "));
if (StringUtils.isNotEmpty(key)) {
likes.put("appName", key);
}
}
equals.put( "anonymousAble", true );
try {
result = this.standardListNext(Wo.copier, id, count, "sequence", equals, null, likes, ins, null, null, null, null, true, DESC);
} catch (Exception e) {
result.error(e);
logger.warn("系统在分页查询栏目信息列表时发生异常。");
logger.error(e, effectivePerson, request, null);
}
}
return result;
}
public class Wi {
@FieldDescribe("作为过滤条件的CMS应用ID, 可多个, String数组.")
private List<String> appIdList;
@FieldDescribe("作为过滤条件的创建者姓名, 可多个, String数组.")
private List<String> creatorList;
@FieldDescribe("作为过滤条件的CMS应用关键字, 通常是应用名称, String, 模糊查询.")
private String key;
@FieldDescribe("文档类型:全部 | 信息 | 数据")
private String documentType = "信息";
public List<String> getAppIdList() {
return appIdList;
}
public void setAppIdList(List<String> appIdList) {
this.appIdList = appIdList;
}
public List<String> getCreatorList() {
return creatorList;
}
public void setCreatorList(List<String> creatorList) {
this.creatorList = creatorList;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getDocumentType() {
return documentType;
}
public void setDocumentType(String documentType) {
this.documentType = documentType;
}
}
}
\ No newline at end of file
......@@ -29,7 +29,6 @@ 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.jaxrs.WoId;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
......@@ -99,25 +98,6 @@ public class AppInfoAction extends StandardJaxrsAction {
}
return ResponseFactory.getDefaultActionResultResponse(result);
}
@JaxrsMethodDescribe(value = "根据标识强制更新指定的栏目Review.", action = ActionUpdateReviewForce.class)
@GET
@Path("review/{flag}/update")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public Response updateReviewForce(@Context HttpServletRequest request, @JaxrsParameterDescribe("栏目ID") @PathParam("flag") String flag) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<WoId> result = new ActionResult<>();
try {
result = new ActionUpdateReviewForce().execute( request, effectivePerson, flag );
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionAppInfoProcess(e, "根据指定ID查询应用栏目信息对象时发生异常。flag:" + flag );
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
return ResponseFactory.getDefaultActionResultResponse(result);
}
@JaxrsMethodDescribe(value = "根据别名获取信息栏目信息对象.", action = ActionGetByAlias.class)
@GET
......
package com.x.cms.assemble.control.jaxrs.appinfo;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
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;
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;
@JaxrsDescribe("匿名栏目信息访问")
@Path("anonymous/appinfo")
public class AppInfoAnonymousAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(AppInfoAnonymousAction.class);
@JaxrsMethodDescribe(value = "根据标识获取信息栏目信息对象.", action = ActionGetAnonymous.class)
@GET
@Path("{flag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public Response get(@Context HttpServletRequest request, @JaxrsParameterDescribe("栏目ID") @PathParam("flag") String flag) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<BaseAction.Wo> result = new ActionResult<>();
try {
result = new ActionGetAnonymous().execute( request, effectivePerson, flag );
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionAppInfoProcess(e, "根据指定ID查询应用栏目信息对象时发生异常。flag:" + flag );
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
return ResponseFactory.getDefaultActionResultResponse(result);
}
@JaxrsMethodDescribe(value = "列示根据过滤条件的信息栏目信息,下一页.", action = ActionListNextWithFilterAnonymous.class)
@PUT
@Path("filter/list/{id}/next/{count}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public Response listNextWithFilter(@Context HttpServletRequest request,
@JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id,
@JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count,
JsonElement jsonElement) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<List<ActionListNextWithFilterAnonymous.Wo>> result = new ActionResult<>();
try {
result = new ActionListNextWithFilterAnonymous().execute(request, effectivePerson, id, count, jsonElement );
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionAppInfoProcess(e, "查询栏目信息对象时发生异常");
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
return ResponseFactory.getDefaultActionResultResponse(result);
}
}
\ No newline at end of file
......@@ -190,6 +190,16 @@ public class BaseAction extends StandardJaxrsAction {
public static class Wo extends AppInfo {
private Long rank;
public Long getRank() {
return rank;
}
public void setRank(Long rank) {
this.rank = rank;
}
private static final long serialVersionUID = -5076990764713538973L;
public static List<String> Excludes = new ArrayList<String>();
......
......@@ -5,6 +5,10 @@ import com.x.base.core.project.exception.PromptException;
class ExceptionAppInfoAccessDenied extends PromptException {
private static final long serialVersionUID = 1859164370743532895L;
ExceptionAppInfoAccessDenied( String message ) {
super( message );
}
ExceptionAppInfoAccessDenied( Throwable e, String message ) {
super( message, e );
}
......
package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.core.entity.CategoryInfo;
import net.sf.ehcache.Element;
public class ActionGetAnonymous extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionGetAnonymous.class );
protected ActionResult<Wo> execute( HttpServletRequest request, String flag, EffectivePerson effectivePerson ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = null;
CategoryInfo categoryInfo = null;
Boolean check = true;
if( StringUtils.isEmpty( flag ) ){
check = false;
Exception exception = new ExceptionIdEmpty();
result.error( exception );
}
String cacheKey = ApplicationCache.concreteCacheKey( flag );
Element element = cache.get(cacheKey);
if ((null != element) && ( null != element.getObjectValue()) ) {
wo = ( Wo ) element.getObjectValue();
result.setData( wo );
} else {
if( check ){
try {
categoryInfo = categoryInfoServiceAdv.getWithFlag( flag );
if( categoryInfo == null ){
check = false;
Exception exception = new ExceptionCategoryInfoNotExists( flag );
result.error( exception );
}else {
if( !categoryInfo.getAnonymousAble() ){
check = false;
Exception exception = new ExceptionCategoryInfoAccessDenied("分类信息不允许匿名访问!");
result.error( exception );
}
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess( e, "根据ID查询分类信息对象时发生异常。Flag:" + flag );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
try {
wo = Wo.copier.copy( categoryInfo );
wo.setExtContent( categoryInfoServiceAdv.getExtContentWithId( wo.getId() ));
cache.put(new Element( cacheKey, wo ));
result.setData( wo );
} catch ( Exception e ) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess( e, "将查询出来的分类信息对象转换为可输出的数据信息时发生异常。" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
}
return result;
}
public static class Wo extends CategoryInfo {
private static final long serialVersionUID = -5076990764713538973L;
public static List<String> Excludes = new ArrayList<String>();
@FieldDescribe("扩展信息JSON内容")
private String extContent = null;
static WrapCopier<CategoryInfo, Wo> copier = WrapCopierFactory.wo( CategoryInfo.class, Wo.class, null, ListTools.toList(JpaObject.FieldsInvisible));
public String getExtContent() {
return extContent;
}
public void setExtContent(String extContent) {
this.extContent = extContent;
}
}
}
\ No newline at end of file
package com.x.cms.assemble.control.jaxrs.categoryinfo;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.EqualsTerms;
import com.x.base.core.project.jaxrs.InTerms;
import com.x.base.core.project.jaxrs.LikeTerms;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.core.entity.CategoryInfo;
public class ActionListNextWithFilterAnonymous extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionListNextWithFilterAnonymous.class);
protected ActionResult<List<Wo>> execute(HttpServletRequest request, EffectivePerson effectivePerson, String id,
Integer count, JsonElement jsonElement) throws Exception {
ActionResult<List<Wo>> result = new ActionResult<>();
EqualsTerms equals = new EqualsTerms();
InTerms ins = new InTerms();
LikeTerms likes = new LikeTerms();
Wi wi = null;
Boolean check = true;
try {
wi = this.convertToWrapIn(jsonElement, Wi.class);
} catch (Exception e) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess(e,
"系统在将JSON信息转换为对象时发生异常。JSON:" + jsonElement.toString());
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
if (check) {
if (null != wi.getAppIdList() && !wi.getAppIdList().isEmpty()) {
ins.put("appId", wi.getAppIdList());
}
if (null != wi.getCategoryIdList() && !wi.getCategoryIdList().isEmpty()) {
ins.put("id", wi.getCategoryIdList());
}
if (null != wi.getCreatorList() && !wi.getCreatorList().isEmpty()) {
ins.put("creatorPerson", wi.getCreatorList());
}
if (StringUtils.isNotEmpty(wi.getKey())) {
String key = StringUtils.trim(StringUtils.replace(wi.getKey(), "\u3000", " "));
if (StringUtils.isNotEmpty(key)) {
likes.put("title", key);
}
}
}
equals.put( "anonymousAble", true );
if (check) {
try {
result = this.standardListNext(Wo.copier, id, count, "sequence", equals, null, likes, ins, null, null,
null, null, true, DESC);
} catch (Exception e) {
check = false;
result.error(e);
logger.error(e, effectivePerson, request, null);
}
}
return result;
}
public static class Wo extends CategoryInfo {
private Long rank;
public Long getRank() {
return rank;
}
public void setRank(Long rank) {
this.rank = rank;
}
private static final long serialVersionUID = -5076990764713538973L;
public static List<String> Excludes = new ArrayList<String>();
static WrapCopier<CategoryInfo, Wo> copier = WrapCopierFactory.wo(CategoryInfo.class, Wo.class, null,
ListTools.toList(JpaObject.FieldsInvisible));
@FieldDescribe("扩展信息JSON内容")
private String extContent = null;
public String getExtContent() {
return extContent;
}
public void setExtContent(String extContent) {
this.extContent = extContent;
}
}
public static class Wi extends GsonPropertyObject {
@FieldDescribe("作为过滤条件的信息内容管理应用ID列表, 可多个, String数组.")
private List<String> appIdList;
@FieldDescribe("作为过滤条件的内容管理分类ID列表, 可多个, String数组.")
private List<String> categoryIdList;
@FieldDescribe("作为过滤条件的创建者姓名列表, 可多个, String数组.")
private List<String> creatorList;
@FieldDescribe("作为过滤条件的内容管理应用关键字, 通常是应用名称, String, 模糊查询.")
private String key;
@FieldDescribe("文档类型:全部 | 信息 | 数据")
private String documentType = "信息";
public List<String> getAppIdList() {
return appIdList;
}
public void setAppIdList(List<String> appIdList) {
this.appIdList = appIdList;
}
public List<String> getCategoryIdList() {
return categoryIdList;
}
public void setCategoryIdList(List<String> categoryIdList) {
this.categoryIdList = categoryIdList;
}
public List<String> getCreatorList() {
return creatorList;
}
public void setCreatorList(List<String> creatorList) {
this.creatorList = creatorList;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getDocumentType() {
return documentType;
}
public void setDocumentType(String documentType) {
this.documentType = documentType;
}
}
}
\ No newline at end of file
package com.x.cms.assemble.control.jaxrs.categoryinfo;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.cms.core.entity.CategoryInfo;
public class ActionUpdateReviewForce extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionUpdateReviewForce.class );
protected ActionResult<WoId> execute( HttpServletRequest request, EffectivePerson effectivePerson, String flag ) throws Exception {
ActionResult<WoId> result = new ActionResult<>();
CategoryInfo categoryInfo = null;
Boolean check = true;
if( StringUtils.isEmpty( flag ) ){
check = false;
Exception exception = new ExceptionIdEmpty();
result.error( exception );
}
if( check ){
try {
categoryInfo = categoryInfoServiceAdv.getWithFlag( flag );
if( categoryInfo == null ){
check = false;
Exception exception = new ExceptionCategoryInfoNotExists( flag );
result.error( exception );
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess( e, "根据ID查询分类信息对象时发生异常。Flag:" + flag );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
try {
permissionOperateService.refreshReviewWithCategoryId( categoryInfo.getId() );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess( e, "根据指定分类ID强制更新信息存根Review信息时发生异常。ID:" + categoryInfo.getId() );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
try {
WoId wo = new WoId();
wo.setId( categoryInfo.getId() );
result.setData( wo );
} catch ( Exception e ) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess( e, "将查询出来的分类信息对象转换为可输出的数据信息时发生异常。" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
return result;
}
}
\ No newline at end of file
......@@ -24,7 +24,6 @@ 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.jaxrs.WoId;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
......@@ -238,25 +237,6 @@ public class CategoryInfoAction extends StandardJaxrsAction{
return ResponseFactory.getDefaultActionResultResponse( result );
}
@JaxrsMethodDescribe(value = "根据标识强制更新指定的分类Review.", action = ActionUpdateReviewForce.class)
@GET
@Path("review/{flag}/update")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public Response updateReviewForce(@Context HttpServletRequest request, @JaxrsParameterDescribe("分类ID") @PathParam("flag") String flag) {
EffectivePerson effectivePerson = this.effectivePerson(request);
ActionResult<WoId> result = new ActionResult<>();
try {
result = new ActionUpdateReviewForce().execute( request, effectivePerson, flag );
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionCategoryInfoProcess(e, "根据指定ID查询分类栏目信息对象时发生异常。flag:" + flag );
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
return ResponseFactory.getDefaultActionResultResponse(result);
}
@JaxrsMethodDescribe(value = "根据别名获取分类信息对象.", action = ActionGet.class)
@GET
@Path("alias/{alias}")
......
......@@ -5,6 +5,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
......@@ -12,6 +13,7 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
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;
......@@ -30,6 +32,49 @@ public class CategoryInfoAnonymousAction extends StandardJaxrsAction{
private static Logger logger = LoggerFactory.getLogger( CategoryInfoAnonymousAction.class );
@JaxrsMethodDescribe(value = "根据Flag获取分类信息对象.", action = ActionGetAnonymous.class)
@GET
@Path("{flag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public Response get(@Context HttpServletRequest request,
@JaxrsParameterDescribe("栏目标识") @PathParam("flag") String flag) {
EffectivePerson effectivePerson = this.effectivePerson( request );
ActionResult<ActionGetAnonymous.Wo> result = null;
try {
result = new ActionGetAnonymous().execute( request, flag, effectivePerson );
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionCategoryInfoProcess( e, "根据ID查询分类信息对象时发生异常。flag:" + flag );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
return ResponseFactory.getDefaultActionResultResponse( result );
}
@JaxrsMethodDescribe(value = "列示根据过滤条件的信息分类,下一页.", action = ActionListNextWithFilterAnonymous.class)
@PUT
@Path("filter/list/{id}/next/{count}/app/{appId}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public Response listNextWithFilter(@Context HttpServletRequest request,
@JaxrsParameterDescribe("最后一条信息ID,如果是第一页,则可以用(0)代替") @PathParam("id") String id,
@JaxrsParameterDescribe("每页显示的条目数量") @PathParam("count") Integer count,
@JaxrsParameterDescribe("栏目ID") @PathParam("appId") String appId,
JsonElement jsonElement ) {
EffectivePerson effectivePerson = this.effectivePerson( request );
ActionResult<List<ActionListNextWithFilterAnonymous.Wo>> result = null;
try {
result = new ActionListNextWithFilterAnonymous().execute( request, effectivePerson, id, count, jsonElement);
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionCategoryInfoProcess( e, "列示根据过滤条件的信息分类时发生异常。" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
return ResponseFactory.getDefaultActionResultResponse( result );
}
@JaxrsMethodDescribe(value = "获取用户有查看访问文章信息的所有分类列表.", action = ActionListWhatICanView_Article.class)
@GET
@Path("list/view/app/{appId}")
......
package com.x.cms.assemble.control.jaxrs.categoryinfo;
import com.x.base.core.project.exception.PromptException;
class ExceptionCategoryInfoAccessDenied extends PromptException {
private static final long serialVersionUID = 1859164370743532895L;
ExceptionCategoryInfoAccessDenied( String message ) {
super( message );
}
ExceptionCategoryInfoAccessDenied( Throwable e, String message ) {
super( message, e );
}
ExceptionCategoryInfoAccessDenied(String personName, String appName, String appId) {
super("person:{} access appInfo name: {} id: {}, denied.", personName, appName, appId);
}
}
......@@ -18,7 +18,6 @@ import com.x.cms.assemble.control.service.CategoryInfoServiceAdv;
import com.x.cms.assemble.control.service.DocumentInfoServiceAdv;
import com.x.cms.assemble.control.service.UserManagerService;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.tools.LogUtil;
import com.x.query.core.entity.Item;
import net.sf.ehcache.Ehcache;
......
......@@ -42,17 +42,6 @@ public class ActionUpdateReviewForce extends BaseAction {
}
}
if( check ){
try {
permissionOperateService.refreshReview( id );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionDocumentInfoProcess( e, "根据指定分类ID强制更新信息存根Review信息时发生异常。ID:" + id );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
try {
WoId wo = new WoId();
......
......@@ -33,7 +33,6 @@ public class ActionView extends BaseAction {
@SuppressWarnings("unchecked")
protected ActionResult<Wo> execute(HttpServletRequest request, String id, EffectivePerson effectivePerson) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
Wo wo = new Wo();
Boolean isManager = false;
Boolean check = true;
Boolean isAnonymous = effectivePerson.isAnonymous();
......
package com.x.cms.assemble.control.jaxrs.permission;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.core.entity.AppCategoryAdmin;
import com.x.cms.core.entity.AppCategoryPermission;
import com.x.cms.core.entity.AppInfo;
/**
* 将所有的AppCategoryPermission对象转为新的AppInfo和CategoryInfo的对象
* @author O2LEE
*
*/
public class ActionTransferAllAppInfoPermission extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionTransferAllAppInfoPermission.class );
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
List<String> allAppInfoIds = null;
Boolean check = true;
//查询所有的栏目信息ID列表
if( check ){
try {
allAppInfoIds = appInfoServiceAdv.listAllIds("全部");
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppCategoryAdminProcess( e, "系统查询所有的栏目ID列表时发生异常!" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
if( ListTools.isNotEmpty( allAppInfoIds )) {
List<String> appInfo_managerInfoIds = null;
List<AppCategoryAdmin> appInfo_appCategoryAdminList = null;
List<String> appInfo_permissionInfoIds = null;
List<AppCategoryPermission> appInfo_appCategoryPermissionList = null;
AppInfo appInfo = null;
for( String appId : allAppInfoIds ) {
//查询栏目信息
try {
appInfo = appInfoServiceAdv.get( appId );
if( appInfo == null ){
continue;
}
} catch (Exception e) {
logger.error( e, effectivePerson, request, null);
}
System.out.println(">>>>>正在处理栏目信息:" + appInfo.getAppAlias() );
//查询栏目所有的管理员信息
try {
appInfo_managerInfoIds = appCategoryAdminServiceAdv.listAppCategoryIdByAppId(appId);
if( ListTools.isNotEmpty( appInfo_managerInfoIds )) {
appInfo_appCategoryAdminList = appCategoryAdminServiceAdv.list( appInfo_managerInfoIds );
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppCategoryAdminProcess( e, "根据栏目ID查询栏目所有的管理员信息时发生异常!" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
//查询栏目所有的发布和可见范围信息
try {
appInfo_permissionInfoIds = appCategoryPermissionServiceAdv.listPermissionByAppInfo(appId, null );
if( ListTools.isNotEmpty( appInfo_permissionInfoIds )) {
appInfo_appCategoryPermissionList = appCategoryPermissionServiceAdv.list( appInfo_permissionInfoIds );
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppCategoryAdminProcess( e, "根据栏目ID查询栏目所有的管理员信息时发生异常!" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
//组织好一个appInfo的权限信息,直接更新到数据库
List<String> viewablePersonList = new ArrayList<>();
List<String> viewableUnitList = new ArrayList<>();
List<String> viewableGroupList = new ArrayList<>();
List<String> publishablePersonList = new ArrayList<>();
List<String> publishableUnitList = new ArrayList<>();
List<String> publishableGroupList = new ArrayList<>();
List<String> manageablePersonList = new ArrayList<>();
if(ListTools.isNotEmpty( appInfo_appCategoryAdminList )) {
for( AppCategoryAdmin appCategoryAdmin : appInfo_appCategoryAdminList) {
manageablePersonList.add( appCategoryAdmin.getAdminUid());
}
}
if(ListTools.isNotEmpty( appInfo_appCategoryPermissionList )) {
for( AppCategoryPermission appCategoryPermission : appInfo_appCategoryPermissionList) {
if( "PUBLISH".equals( appCategoryPermission.getPermission() )) {
if( "USER".equals( appCategoryPermission.getUsedObjectType() )) {
publishablePersonList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "UNIT".equals( appCategoryPermission.getUsedObjectType() )) {
publishableUnitList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "DEPARTMENT".equals( appCategoryPermission.getUsedObjectType() )) {
publishableUnitList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "GROUP".equals( appCategoryPermission.getUsedObjectType() )) {
publishableGroupList.add( appCategoryPermission.getUsedObjectCode() );
}
}else if( "VIEW".equals( appCategoryPermission.getPermission() )) {
if( "USER".equals( appCategoryPermission.getUsedObjectType() )) {
viewablePersonList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "UNIT".equals( appCategoryPermission.getUsedObjectType() )) {
viewableUnitList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "DEPARTMENT".equals( appCategoryPermission.getUsedObjectType() )) {
viewableUnitList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "GROUP".equals( appCategoryPermission.getUsedObjectType() )) {
viewableGroupList.add( appCategoryPermission.getUsedObjectCode() );
}
}
}
}
appInfo.setManageablePersonList(manageablePersonList);
appInfo.setPublishablePersonList(publishablePersonList);
appInfo.setPublishableUnitList(publishableUnitList);
appInfo.setPublishableGroupList(publishableGroupList);
appInfo.setViewablePersonList(viewablePersonList);
appInfo.setViewableUnitList(viewableUnitList);
appInfo.setViewableGroupList(viewableGroupList);
try {
appInfoServiceAdv.updateAllPermission( appInfo );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppCategoryAdminProcess( e, "根据栏目ID查询栏目所有的管理员信息时发生异常!" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
}
ApplicationCache.notify( AppInfo.class );
Wo wo = new Wo();
wo.setId( "" );
result.setData( wo );
System.out.println(">>>>>栏目信息权限数据结构全部处理完成。" );
}
return result;
}
public static class Wo extends WoId {
}
}
\ No newline at end of file
package com.x.cms.assemble.control.jaxrs.permission;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.core.entity.AppCategoryAdmin;
import com.x.cms.core.entity.AppCategoryPermission;
import com.x.cms.core.entity.CategoryInfo;
/**
* 将所有的AppCategoryPermission对象转为新的CategoryInfo和CategoryInfo的对象
* @author O2LEE
*
*/
public class ActionTransferAllCategoryInfoPermission extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionTransferAllCategoryInfoPermission.class );
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
List<String> allCategoryInfoIds = null;
Boolean check = true;
//查询所有的分类信息ID列表
if( check ){
try {
allCategoryInfoIds = categoryInfoServiceAdv.listAllIds();
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppCategoryAdminProcess( e, "系统查询所有的分类ID列表时发生异常!" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
if( ListTools.isNotEmpty( allCategoryInfoIds )) {
List<String> category_managerInfoIds = null;
List<AppCategoryAdmin> category_appCategoryAdminList = null;
List<String> category_permissionInfoIds = null;
List<AppCategoryPermission> category_appCategoryPermissionList = null;
CategoryInfo categoryInfo = null;
for( String categoryId : allCategoryInfoIds ) {
//查询分类信息
try {
categoryInfo = categoryInfoServiceAdv.get( categoryId );
if( categoryInfo == null ){
continue;
}
} catch (Exception e) {
logger.error( e, effectivePerson, request, null);
}
System.out.println(">>>>>正在处理分类信息:" + categoryInfo.getCategoryAlias() );
//查询分类所有的管理员信息
try {
category_managerInfoIds = appCategoryAdminServiceAdv.listAppCategoryIdByAppId(categoryId);
if( ListTools.isNotEmpty( category_managerInfoIds )) {
category_appCategoryAdminList = appCategoryAdminServiceAdv.list( category_managerInfoIds );
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppCategoryAdminProcess( e, "根据分类ID查询分类所有的管理员信息时发生异常!" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
//查询分类所有的发布和可见范围信息
try {
category_permissionInfoIds = appCategoryPermissionServiceAdv.listPermissionByCategory(categoryId, null);
if( ListTools.isNotEmpty( category_permissionInfoIds )) {
category_appCategoryPermissionList = appCategoryPermissionServiceAdv.list( category_permissionInfoIds );
}
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppCategoryAdminProcess( e, "根据分类ID查询分类所有的管理员信息时发生异常!" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
//组织好一个categoryInfo的权限信息,直接更新到数据库
List<String> viewablePersonList = new ArrayList<>();
List<String> viewableUnitList = new ArrayList<>();
List<String> viewableGroupList = new ArrayList<>();
List<String> publishablePersonList = new ArrayList<>();
List<String> publishableUnitList = new ArrayList<>();
List<String> publishableGroupList = new ArrayList<>();
List<String> manageablePersonList = new ArrayList<>();
if(ListTools.isNotEmpty( category_appCategoryAdminList )) {
for( AppCategoryAdmin appCategoryAdmin : category_appCategoryAdminList) {
manageablePersonList.add( appCategoryAdmin.getAdminUid());
}
}
if(ListTools.isNotEmpty( category_appCategoryPermissionList )) {
for( AppCategoryPermission appCategoryPermission : category_appCategoryPermissionList) {
if( "PUBLISH".equals( appCategoryPermission.getPermission() )) {
if( "USER".equals( appCategoryPermission.getUsedObjectType() )) {
publishablePersonList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "UNIT".equals( appCategoryPermission.getUsedObjectType() )) {
publishableUnitList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "DEPARTMENT".equals( appCategoryPermission.getUsedObjectType() )) {
publishableUnitList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "GROUP".equals( appCategoryPermission.getUsedObjectType() )) {
publishableGroupList.add( appCategoryPermission.getUsedObjectCode() );
}
}else if( "VIEW".equals( appCategoryPermission.getPermission() )) {
if( "USER".equals( appCategoryPermission.getUsedObjectType() )) {
viewablePersonList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "UNIT".equals( appCategoryPermission.getUsedObjectType() )) {
viewableUnitList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "DEPARTMENT".equals( appCategoryPermission.getUsedObjectType() )) {
viewableUnitList.add( appCategoryPermission.getUsedObjectCode() );
}else if( "GROUP".equals( appCategoryPermission.getUsedObjectType() )) {
viewableGroupList.add( appCategoryPermission.getUsedObjectCode() );
}
}
}
}
categoryInfo.setManageableGroupList( new ArrayList<>() );
categoryInfo.setManageableUnitList( new ArrayList<>() );
categoryInfo.setManageablePersonList(manageablePersonList);
categoryInfo.setPublishablePersonList(publishablePersonList);
categoryInfo.setPublishableUnitList(publishableUnitList);
categoryInfo.setPublishableGroupList(publishableGroupList);
categoryInfo.setViewablePersonList(viewablePersonList);
categoryInfo.setViewableUnitList(viewableUnitList);
categoryInfo.setViewableGroupList(viewableGroupList);
try {
categoryInfoServiceAdv.updateAllPermission( categoryInfo );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppCategoryAdminProcess( e, "根据分类ID查询分类所有的管理员信息时发生异常!" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
}
ApplicationCache.notify( CategoryInfo.class );
Wo wo = new Wo();
wo.setId( "" );
result.setData( wo );
System.out.println(">>>>>分类信息权限数据结构全部处理完成。" );
}
return result;
}
public static class Wo extends WoId {
}
}
\ No newline at end of file
package com.x.cms.assemble.control.jaxrs.permission;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.x.base.core.project.cache.ApplicationCache;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.cms.core.entity.CategoryInfo;
import com.x.cms.core.entity.Document;
import com.x.cms.core.entity.DocumentPermission;
/**
* 将所有的AppCategoryPermission对象转为新的CategoryInfo和CategoryInfo的对象
* @author O2LEE
*
*/
public class ActionTransferAllDocumentInfoPermission extends BaseAction {
private static Logger logger = LoggerFactory.getLogger( ActionTransferAllDocumentInfoPermission.class );
protected ActionResult<Wo> execute( HttpServletRequest request, EffectivePerson effectivePerson ) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
List<String> allCategoryInfoIds = null;
Boolean check = true;
//查询所有的分类信息ID列表
if( check ){
try {
allCategoryInfoIds = categoryInfoServiceAdv.listAllIds();
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppCategoryAdminProcess( e, "系统查询所有的分类ID列表时发生异常!" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
if( check ){
if( ListTools.isNotEmpty( allCategoryInfoIds )) {
List<String> documentIds = null;
List<String> docPermissionIds = null;
List<DocumentPermission> documentPermissions = null;
CategoryInfo categoryInfo = null;
Document document = null;
for( String categoryId : allCategoryInfoIds ) {
//查询分类信息
try {
categoryInfo = categoryInfoServiceAdv.get( categoryId );
if( categoryInfo == null ){
continue;
}
} catch (Exception e) {
logger.error( e, effectivePerson, request, null);
}
System.out.println(">>>>>正在处理分类信息:" + categoryInfo.getCategoryAlias() );
//查询该分类下所有的文档ID列表
try {
documentIds = documentServiceAdv.listIdsByCategoryId(categoryId);
if( ListTools.isEmpty( documentIds ) ){
continue;
}
} catch (Exception e) {
logger.error( e, effectivePerson, request, null);
}
//遍历所有的文档,更新权限数据结构
for( String docId : documentIds ) {
try {
document = documentServiceAdv.get(docId);
if( document == null ){
continue;
}
} catch (Exception e) {
logger.error( e, effectivePerson, request, null);
}
System.out.println(">>>>>正在处理文档信息:" + document.getTitle() );
try {
docPermissionIds = documentPermissionServiceAdv.listPermissionIdsWithDocId(docId );
if( ListTools.isNotEmpty( docPermissionIds ) ){
documentPermissions = documentPermissionServiceAdv.list( docPermissionIds );
}
} catch (Exception e) {
logger.error( e, effectivePerson, request, null);
}
document.setAuthorPersonList( null );
document.setAuthorUnitList( null );
document.setAuthorGroupList( null );
document.setReadPersonList( null );
document.setReadUnitList( null );
document.setReadGroupList( null );
document.setManagerList( null );
if( ListTools.isNotEmpty( documentPermissions )) {
//组织权限数据结构
for( DocumentPermission documentPermission : documentPermissions ) {
if( "管理".equals( documentPermission.getPermission() )) {
document.addManagerList(documentPermission.getPermissionObjectCode());
}else if( "读者".equals( documentPermission.getPermission() )) {
if( "人员".equals( documentPermission.getPermissionObjectType() )) {
document.addReadPersonList(documentPermission.getPermissionObjectCode());
}else if( "部门".equals( documentPermission.getPermissionObjectType() )) {
document.addReadUnitList(documentPermission.getPermissionObjectCode());
}else if( "群组".equals( documentPermission.getPermissionObjectType() )) {
document.addReadGroupList(documentPermission.getPermissionObjectCode());
}else if( "所有人".equals( documentPermission.getPermissionObjectCode() )) {
document.addReadPersonList("所有人");
}
}else if( "阅读".equals( documentPermission.getPermission() )) {
if( "人员".equals( documentPermission.getPermissionObjectType() )) {
document.addReadPersonList(documentPermission.getPermissionObjectCode());
}else if( "部门".equals( documentPermission.getPermissionObjectType() )) {
document.addReadUnitList(documentPermission.getPermissionObjectCode());
}else if( "群组".equals( documentPermission.getPermissionObjectType() )) {
document.addReadGroupList(documentPermission.getPermissionObjectCode());
}else if( "所有人".equals( documentPermission.getPermissionObjectCode() )) {
document.addReadPersonList("所有人");
}
}else if( "作者".equals( documentPermission.getPermission() )) {
if( "人员".equals( documentPermission.getPermissionObjectType() )) {
document.addAuthorPersonList(documentPermission.getPermissionObjectCode());
}else if( "部门".equals( documentPermission.getPermissionObjectType() )) {
document.addAuthorUnitList(documentPermission.getPermissionObjectCode());
}else if( "群组".equals( documentPermission.getPermissionObjectType() )) {
document.addAuthorGroupList(documentPermission.getPermissionObjectCode());
}else if( "所有人".equals( documentPermission.getPermissionObjectCode() )) {
document.addAuthorPersonList("所有人");
}
}
}
}
if( ListTools.isEmpty( document.getReadPersonList() ) && ListTools.isEmpty( document.getReadUnitList() )
&& ListTools.isEmpty( document.getReadGroupList() )) {
//全部都为空,则是创建人可访问
document.addReadPersonList( "所有人" );
document.addReadPersonList( document.getCreatorPerson() );
}
if( ListTools.isEmpty( document.getAuthorPersonList() ) && ListTools.isEmpty( document.getAuthorUnitList() )
&& ListTools.isEmpty( document.getAuthorGroupList() )) {
//全部都为空,则是创建人可访问
document.addAuthorPersonList( "所有人" );
document.addAuthorPersonList( document.getCreatorPerson() );
}
if( ListTools.isEmpty( document.getManagerList() ) ) {
//全部都为空,则是创建人可以管理
document.addManagerList( document.getCreatorPerson() );
}
try {
documentServiceAdv.updateAllPermission( document );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionDocumentPermissionTransfer( e, docId );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
}
}
}
ApplicationCache.notify( Document.class );
Wo wo = new Wo();
wo.setId( "" );
result.setData( wo );
System.out.println(">>>>>文档信息权限数据结构全部处理完成。" );
}
return result;
}
public static class Wo extends WoId {
}
}
\ No newline at end of file
......@@ -4,9 +4,6 @@ import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.cms.assemble.control.service.AppInfoServiceAdv;
import com.x.cms.assemble.control.service.CategoryInfoServiceAdv;
import com.x.cms.assemble.control.service.DocumentInfoServiceAdv;
import com.x.cms.assemble.control.service.RescissoryClass_AppCategoryAdminServiceAdv;
import com.x.cms.assemble.control.service.RescissoryClass_AppCategoryPermissionServiceAdv;
import com.x.cms.assemble.control.service.RescissoryClass_DocumentPermissionServiceAdv;
import com.x.cms.assemble.control.service.UserManagerService;
public class BaseAction extends StandardJaxrsAction {
......@@ -14,11 +11,6 @@ public class BaseAction extends StandardJaxrsAction {
protected UserManagerService userManagerService = new UserManagerService();
protected AppInfoServiceAdv appInfoServiceAdv = new AppInfoServiceAdv();
protected CategoryInfoServiceAdv categoryInfoServiceAdv = new CategoryInfoServiceAdv();
//暂用于数据转换
protected RescissoryClass_AppCategoryAdminServiceAdv appCategoryAdminServiceAdv = new RescissoryClass_AppCategoryAdminServiceAdv();
protected RescissoryClass_AppCategoryPermissionServiceAdv appCategoryPermissionServiceAdv = new RescissoryClass_AppCategoryPermissionServiceAdv();
protected RescissoryClass_DocumentPermissionServiceAdv documentPermissionServiceAdv = new RescissoryClass_DocumentPermissionServiceAdv();
protected DocumentInfoServiceAdv documentServiceAdv = new DocumentInfoServiceAdv();
}
......@@ -349,63 +349,5 @@ public class PermissionAction extends StandardJaxrsAction {
}
}
return ResponseFactory.getDefaultActionResultResponse(result);
}
@JaxrsMethodDescribe(value = "转换所有栏目信息的权限数据结构.", action = ActionTransferAllAppInfoPermission.class)
@GET
@Path("appinfo/transfer/all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public Response transferAllAppInfoPermission(@Context HttpServletRequest request ) {
EffectivePerson effectivePerson = this.effectivePerson( request );
ActionResult<ActionTransferAllAppInfoPermission.Wo> result = null;
try {
result = new ActionTransferAllAppInfoPermission().execute( request, effectivePerson );
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionAppCategoryAdminProcess( e, "系统转换所有栏目信息的权限数据结构时发生异常。" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
return ResponseFactory.getDefaultActionResultResponse(result);
}
@JaxrsMethodDescribe(value = "转换所有分类信息的权限数据结构.", action = ActionTransferAllCategoryInfoPermission.class)
@GET
@Path("category/transfer/all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public Response transferAllCategoryInfoPermission(@Context HttpServletRequest request ) {
EffectivePerson effectivePerson = this.effectivePerson( request );
ActionResult<ActionTransferAllCategoryInfoPermission.Wo> result = null;
try {
result = new ActionTransferAllCategoryInfoPermission().execute( request, effectivePerson );
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionAppCategoryAdminProcess( e, "系统转换所有分类信息的权限数据结构时发生异常。" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
return ResponseFactory.getDefaultActionResultResponse(result);
}
@JaxrsMethodDescribe(value = "转换所有文档的权限数据格式.", action = ActionTransferAllDocumentInfoPermission.class)
@GET
@Path("document/transfer/all")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public Response transferAllDocumentPermission(@Context HttpServletRequest request ) {
EffectivePerson effectivePerson = this.effectivePerson( request );
ActionResult<ActionTransferAllDocumentInfoPermission.Wo> result = null;
try {
result = new ActionTransferAllDocumentInfoPermission().execute( request, effectivePerson );
} catch (Exception e) {
result = new ActionResult<>();
Exception exception = new ExceptionAppCategoryAdminProcess( e, "系统转换所有文档的权限数据格式时发生异常。" );
result.error( exception );
logger.error( e, effectivePerson, request, null);
}
return ResponseFactory.getDefaultActionResultResponse(result);
}
}
}
\ No newline at end of file
......@@ -23,27 +23,15 @@ import com.x.query.core.entity.Item;
public class AppInfoService {
// public List<AppInfo> list( EntityManagerContainer emc, List<String> ids ) throws Exception {
// if( ids == null || ids.isEmpty() ){
// return null;
// }
// return emc.list( AppInfo.class, ids );
// Business business = new Business( emc );
// return business.getAppInfoFactory().list( ids );
// }
public List<String> listAllIds(EntityManagerContainer emc, String documentType ) throws Exception {
Business business = new Business( emc );
return business.getAppInfoFactory().listAllIds(documentType);
}
public List<AppInfo> listAll(EntityManagerContainer emc, String documentType) throws Exception {
Business business = new Business( emc );
return business.getAppInfoFactory().listAll(documentType);
}
public List<AppInfo> listInReviewAppInfoList(EntityManagerContainer emc) throws Exception {
Business business = new Business( emc );
return business.getAppInfoFactory().listInReviewAppInfoList();
}
@SuppressWarnings("unchecked")
public void delete( EntityManagerContainer emc, String id, String documentType, Integer maxCount ) throws Exception {
......
......@@ -4,7 +4,6 @@ import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import com.x.base.core.project.Context;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.cms.assemble.control.service.DocumentViewRecordServiceAdv;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册