提交 926a9a43 编写于 作者: O o2sword

内容管理管理员权限修改3

上级 059b2f07
......@@ -14,6 +14,7 @@ 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.base.core.project.tools.SortTools;
import com.x.cms.assemble.control.Business;
import com.x.cms.core.entity.AppInfo;
import com.x.cms.core.entity.CategoryInfo;
......@@ -29,18 +30,10 @@ public class ActionListWhatICanManage extends BaseAction {
List<CategoryInfo> catacoryList = null;
List<WoCategory> wrapOutCatacoryList = null;
List<String> app_ids = null;
Boolean isXAdmin = false;
Business business = new Business(null);
Boolean isXAdmin = business.isManager( effectivePerson );
Boolean check = true;
String personName = effectivePerson.getDistinguishedName();
try {
isXAdmin = userManagerService.isManager( effectivePerson );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess(e, "系统在检查用户是否是平台管理员时发生异常。Name:" + personName);
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, "manage", isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
......@@ -109,7 +102,7 @@ public class ActionListWhatICanManage extends BaseAction {
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
query_categoryList = new ArrayList<>();
query_categoryList = new ArrayList<>();
if( ListTools.isNotEmpty( wo.getCategoryList() )) {
for( String categoryId : wo.getCategoryList() ) {
if( categoryId != null && !"null".equalsIgnoreCase( categoryId.trim() ) ) {
......@@ -142,4 +135,4 @@ public class ActionListWhatICanManage extends BaseAction {
}
return result;
}
}
\ No newline at end of file
}
......@@ -14,6 +14,7 @@ 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.base.core.project.tools.SortTools;
import com.x.cms.assemble.control.Business;
public class ActionListWhatICanPublish extends BaseAction {
......@@ -24,20 +25,12 @@ public class ActionListWhatICanPublish extends BaseAction {
ActionResult<List<Wo>> result = new ActionResult<>();
List<Wo> wos = new ArrayList<>();
List<Wo> wos_out = new ArrayList<>();
Boolean isXAdmin = false;
Business business = new Business(null);
Boolean isXAdmin = business.isManager( effectivePerson );
Boolean check = true;
Boolean isAnonymous = effectivePerson.isAnonymous();
String personName = effectivePerson.getDistinguishedName();
try {
isXAdmin = userManagerService.isManager( effectivePerson );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionAppInfoProcess(e, "系统在检查用户是否是平台管理员时发生异常。Name:" + personName);
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, isAnonymous, isXAdmin );
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
......@@ -80,4 +73,4 @@ public class ActionListWhatICanPublish extends BaseAction {
return result;
}
}
\ No newline at end of file
}
......@@ -6,6 +6,7 @@ import java.util.Optional;
import javax.servlet.http.HttpServletRequest;
import com.x.cms.assemble.control.Business;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.entity.JpaObject;
......@@ -38,53 +39,16 @@ public class ActionListWhatICanPublish extends BaseAction {
Boolean appPublisher = false;
Boolean isAnonymous = effectivePerson.isAnonymous();
String personName = effectivePerson.getDistinguishedName();
List<String> unitNames = null;
List<String> groupNames = null;
if ( StringUtils.isEmpty(appId)) {
check = false;
Exception exception = new ExceptionAppIdEmpty();
result.error(exception);
}
if( !isAnonymous ) {
unitNames = userManagerService.listUnitNamesWithPerson( personName );
groupNames = userManagerService.listGroupNamesByPerson( personName );
try {
manager = userManagerService.isManager( effectivePerson );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess(e, "系统在检查用户是否是平台管理员时发生异常。Name:" + personName);
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
if (check) {// 判断用户是否该栏目的管理者
try {
appManager = appInfoServiceAdv.isAppInfoManager( appId, personName, unitNames, groupNames );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess(e,
"系统在检查用户是否是平台管理员时发生异常。Name:" + personName );
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
if (check) {// 判断用户是否该栏目的发布者
try {
appPublisher = appInfoServiceAdv.isAppInfoPublisher( appId, personName, unitNames, groupNames );
} catch (Exception e) {
check = false;
Exception exception = new ExceptionCategoryInfoProcess(e,
"系统在检查用户是否是平台发布者时发生异常。Name:" + personName );
result.error(exception);
logger.error(e, effectivePerson, request, null);
}
}
Business business = new Business(null);
manager = business.isManager( effectivePerson );
appManager = appInfoServiceAdv.isAppInfoManager( appId, personName, unitNames, groupNames );
appPublisher = appInfoServiceAdv.isAppInfoPublisher( appId, personName, unitNames, groupNames );
}
Cache.CacheKey cacheKey = new Cache.CacheKey( this.getClass(), personName, appId, isAnonymous, manager, appManager, appPublisher );
......@@ -106,7 +70,11 @@ public class ActionListWhatICanPublish extends BaseAction {
} else {
if (check) {
List<String> inAppInfoIds = new ArrayList<>();
inAppInfoIds.add( appId );
inAppInfoIds.add( appId );
if(!isAnonymous){
unitNames = userManagerService.listUnitNamesWithPerson( personName );
groupNames = userManagerService.listGroupNamesByPerson( personName );
}
try {
ids = permissionQueryService.listPublishableCategoryIdByPerson(
personName, isAnonymous, unitNames, groupNames, inAppInfoIds, null,
......@@ -156,15 +124,15 @@ public class ActionListWhatICanPublish extends BaseAction {
return result;
}
public static class Wo extends CategoryInfo {
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;
......@@ -177,4 +145,4 @@ public class ActionListWhatICanPublish extends BaseAction {
}
}
}
\ No newline at end of file
}
......@@ -92,6 +92,12 @@ public class WrapInDocumentFilter {
@FieldDescribe("业务数据String值04.")
private String stringValue04;
@FieldDescribe("业务数据String值05.")
private String stringValue05;
@FieldDescribe("业务数据String值06.")
private String stringValue06;
@FieldDescribe("业务数据Long值01.")
private Long longValue01;
......@@ -107,9 +113,12 @@ public class WrapInDocumentFilter {
@FieldDescribe( "业务数据DateTime值01,可以传入1个(开始时间)或者2个(开始和结束时间), 格式:yyyy-MM-dd HH:mm:ss或者yyyy-mm-dd." )
private List<String> dataTimeValue01List;
@FieldDescribe( "业务数据DateTime值01,可以传入1个(开始时间)或者2个(开始和结束时间), 格式:yyyy-MM-dd HH:mm:ss或者yyyy-mm-dd." )
@FieldDescribe( "业务数据DateTime值02,可以传入1个(开始时间)或者2个(开始和结束时间), 格式:yyyy-MM-dd HH:mm:ss或者yyyy-mm-dd." )
private List<String> dataTimeValue02List;
@FieldDescribe( "业务数据DateTime值03,可以传入1个(开始时间)或者2个(开始和结束时间), 格式:yyyy-MM-dd HH:mm:ss或者yyyy-mm-dd." )
private List<String> dataTimeValue03List;
public String getTopFlag() {
return topFlag;
}
......@@ -350,6 +359,30 @@ public class WrapInDocumentFilter {
this.dataTimeValue02List = dataTimeValue02List;
}
public String getStringValue05() {
return stringValue05;
}
public void setStringValue05(String stringValue05) {
this.stringValue05 = stringValue05;
}
public String getStringValue06() {
return stringValue06;
}
public void setStringValue06(String stringValue06) {
this.stringValue06 = stringValue06;
}
public List<String> getDataTimeValue03List() {
return dataTimeValue03List;
}
public void setDataTimeValue03List(List<String> dataTimeValue03List) {
this.dataTimeValue03List = dataTimeValue03List;
}
/**
* 根据传入的查询参数,组织一个完整的QueryFilter对象
* @return
......@@ -498,6 +531,14 @@ public class WrapInDocumentFilter {
queryFilter.addEqualsTerm( new EqualsTerm(Document.stringValue04_FIELDNAME, this.getStringValue04() ) );
}
if( StringUtils.isNotEmpty( this.getStringValue05())) {
queryFilter.addEqualsTerm( new EqualsTerm(Document.stringValue05_FIELDNAME, this.getStringValue05() ) );
}
if( StringUtils.isNotEmpty( this.getStringValue06())) {
queryFilter.addEqualsTerm( new EqualsTerm(Document.stringValue06_FIELDNAME, this.getStringValue06() ) );
}
if( this.getLongValue01() != null) {
queryFilter.addEqualsTerm( new EqualsTerm(Document.longValue01_FIELDNAME, this.getLongValue01() ) );
}
......@@ -532,6 +573,15 @@ public class WrapInDocumentFilter {
queryFilter.addDateBetweenTerm( Document.dateTimeValue02_FIELDNAME, startDate, endDate );
}
if( ListTools.isNotEmpty( this.getDataTimeValue03List())) {
Date startDate = DateTools.parse(this.getDataTimeValue03List().get(0));
Date endDate = new Date();
if(this.getDataTimeValue03List().size() > 1){
endDate = DateTools.parse(this.getDataTimeValue03List().get(1));
}
queryFilter.addDateBetweenTerm( Document.dateTimeValue03_FIELDNAME, startDate, endDate );
}
return queryFilter;
}
......
......@@ -100,8 +100,8 @@ class V2LookupDoc extends BaseAction {
private void getDocForm(String docId) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Document document = emc.fetch(docId, Document.class, ListTools.toList(JpaObject.id_FIELDNAME,
Document.form_FIELDNAME, Document.readFormId_FIELDNAME, Document.categoryId_FIELDNAME));
Document document = emc.fetch(docId, Document.class, ListTools.toList(JpaObject.id_FIELDNAME, Document.form_FIELDNAME,
Document.readFormId_FIELDNAME, Document.categoryId_FIELDNAME, Document.ppFormId_FIELDNAME));
if (null != document) {
String formId = document.getForm();
String readFormId = document.getReadFormId();
......@@ -131,6 +131,7 @@ class V2LookupDoc extends BaseAction {
}
if(StringUtils.isNotBlank(document.getPpFormId())){
this.ppForm = business.process().form().pick(document.getPpFormId());
LOGGER.info("通过流程ID:{}获取表单:{}", this.ppForm == null? "" : this.ppForm.getName());
}
}
}
......
......@@ -98,7 +98,7 @@ class V2LookupDocMobile extends BaseAction {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Document document = emc.fetch(docId, Document.class, ListTools.toList(JpaObject.id_FIELDNAME, Document.form_FIELDNAME,
Document.readFormId_FIELDNAME, Document.categoryId_FIELDNAME));
Document.readFormId_FIELDNAME, Document.categoryId_FIELDNAME, Document.ppFormId_FIELDNAME));
if (null != document) {
String formId = document.getForm();
String readFormId = document.getReadFormId();
......
......@@ -107,7 +107,7 @@ class ActionCover extends BaseAction {
obj.setName(this.idleNameWithEntity(business, appInfo.getId(), obj.getName(), Form.class, obj.getId()));
}
}
for (WrapScript _o : wi.getScriptList()) {
Script obj = business.entityManagerContainer().find(_o.getId(), Script.class);
if (null != obj) {
......@@ -123,7 +123,7 @@ class ActionCover extends BaseAction {
obj.setName(this.idleNameWithEntity(business, appInfo.getId(), obj.getName(), Script.class, obj.getId()));
}
}
for (WrapFile _o : wi.getFileList()) {
File obj = business.entityManagerContainer().find(_o.getId(), File.class);
if (null != obj) {
......@@ -140,7 +140,7 @@ class ActionCover extends BaseAction {
}
obj.setAppId(appInfo.getId());
}
for (WrapAppDict _o : wi.getAppDictList()) {
AppDict obj = business.entityManagerContainer().find(_o.getId(), AppDict.class);
if (null != obj) {
......@@ -171,7 +171,7 @@ class ActionCover extends BaseAction {
}
obj.setAppId(appInfo.getId());
}
for ( WrapCategoryInfo wrapCategoryInfo : wi.getCategoryInfoList() ) {
CategoryInfo categoryInfo = business.entityManagerContainer().find(wrapCategoryInfo.getId(), CategoryInfo.class);
if (null != categoryInfo) {
......@@ -184,8 +184,8 @@ class ActionCover extends BaseAction {
categoryInfo.setCategoryAlias(this.idleAliasWithCategory(business, appInfo.getId(), categoryInfo.getCategoryAlias(),
CategoryInfo.class, categoryInfo.getId()));
}
if (StringUtils.isNotEmpty(categoryInfo.getCategoryAlias())) {
categoryInfo.setCategoryAlias(this.idleNameWithCategory(business, appInfo.getId(), categoryInfo.getCategoryName(),
if (StringUtils.isNotEmpty(categoryInfo.getCategoryName())) {
categoryInfo.setCategoryName(this.idleNameWithCategory(business, appInfo.getId(), categoryInfo.getCategoryName(),
CategoryInfo.class, categoryInfo.getId()));
}
......@@ -212,7 +212,7 @@ class ActionCover extends BaseAction {
}
}
}
business.entityManagerContainer().beginTransaction(File.class);
business.entityManagerContainer().beginTransaction(AppInfo.class);
business.entityManagerContainer().beginTransaction(Script.class);
......@@ -234,7 +234,7 @@ class ActionCover extends BaseAction {
for (JpaObject o : checkPersistObjects) {
business.entityManagerContainer().check(o, CheckPersistType.all);
}
business.entityManagerContainer().commit();
CacheManager.notify(CategoryInfo.class);
......@@ -445,7 +445,7 @@ class ActionCover extends BaseAction {
list = ListUtils.subtract(list, os);
return list.get(0);
}
public static class Wi extends WrapCms{
private static final long serialVersionUID = -4612391443319365035L;
......@@ -456,4 +456,4 @@ class ActionCover extends BaseAction {
}
}
\ No newline at end of file
}
......@@ -438,6 +438,20 @@ public class Document extends SliceJpaObject {
@CheckPersist(allowEmpty = true)
private String stringValue04;
public static final String stringValue05_FIELDNAME = "stringValue05";
@FieldDescribe("业务数据String值05.")
@Column(length = length_255B, name = ColumnNamePrefix + stringValue05_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + stringValue05_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String stringValue05;
public static final String stringValue06_FIELDNAME = "stringValue06";
@FieldDescribe("业务数据String值06.")
@Column(length = length_255B, name = ColumnNamePrefix + stringValue06_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + stringValue06_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String stringValue06;
public static final String longValue01_FIELDNAME = "longValue01";
@FieldDescribe("业务数据Long值01.")
@Column(name = ColumnNamePrefix + longValue01_FIELDNAME)
......@@ -482,6 +496,14 @@ public class Document extends SliceJpaObject {
@CheckPersist(allowEmpty = true)
private Date dateTimeValue02;
public static final String dateTimeValue03_FIELDNAME = "dateTimeValue03";
@Temporal(TemporalType.TIMESTAMP)
@FieldDescribe("业务数据DateTime值03.")
@Column(name = ColumnNamePrefix + dateTimeValue03_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + dateTimeValue03_FIELDNAME)
@CheckPersist(allowEmpty = true)
private Date dateTimeValue03;
public Date getModifyTime() {
return modifyTime;
}
......@@ -976,6 +998,34 @@ public class Document extends SliceJpaObject {
this.dateTimeValue02 = dateTimeValue02;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getStringValue05() {
return stringValue05;
}
public void setStringValue05(String stringValue05) {
this.stringValue05 = stringValue05;
}
public String getStringValue06() {
return stringValue06;
}
public void setStringValue06(String stringValue06) {
this.stringValue06 = stringValue06;
}
public Date getDateTimeValue03() {
return dateTimeValue03;
}
public void setDateTimeValue03(Date dateTimeValue03) {
this.dateTimeValue03 = dateTimeValue03;
}
// -------------------Reader-------------------------
// -------------------2020-06-12 改为只存储DistinguishedName后两段,第一段可能会在运行过程中修改
public void addToReadPersonList(String readPerson) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册