|
|
@@ -1,27 +1,24 @@
|
|
|
package com.uas.kanban.service.impl;
|
|
|
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
-
|
|
|
-import org.mongodb.morphia.query.Query;
|
|
|
-import org.mongodb.morphia.query.UpdateOperations;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
import com.uas.kanban.annotation.NotEmpty;
|
|
|
import com.uas.kanban.base.BaseService;
|
|
|
import com.uas.kanban.dao.DataSourceDao;
|
|
|
import com.uas.kanban.dao.GlobalParameterDao;
|
|
|
+import com.uas.kanban.dao.ResourcePointDao;
|
|
|
import com.uas.kanban.dao.TemplateDao;
|
|
|
import com.uas.kanban.exception.OperationException;
|
|
|
-import com.uas.kanban.model.DataSource;
|
|
|
-import com.uas.kanban.model.GlobalParameter;
|
|
|
-import com.uas.kanban.model.Template;
|
|
|
-import com.uas.kanban.model.TemplateParameter;
|
|
|
+import com.uas.kanban.model.*;
|
|
|
import com.uas.kanban.service.TemplateService;
|
|
|
import com.uas.kanban.util.CollectionUtils;
|
|
|
import com.uas.kanban.util.StringUtils;
|
|
|
+import org.mongodb.morphia.query.Query;
|
|
|
+import org.mongodb.morphia.query.UpdateOperations;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.HashSet;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* 模版
|
|
|
@@ -41,6 +38,9 @@ public class TemplateServiceImpl extends BaseService<Template> implements Templa
|
|
|
@Autowired
|
|
|
private GlobalParameterDao globalParameterDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ResourcePointDao resourePointDao;
|
|
|
+
|
|
|
@Override
|
|
|
public Template save(@NotEmpty("json") String json) {
|
|
|
Template template = templateDao.parse(json);
|
|
|
@@ -142,6 +142,20 @@ public class TemplateServiceImpl extends BaseService<Template> implements Templa
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Template> getByResourcePointCode(@NotEmpty("resourcePointCode") String resourcePointCode) {
|
|
|
+ ResourcePoint resourcePoint = resourePointDao.findOne(resourcePointCode);
|
|
|
+ if (resourcePoint == null) {
|
|
|
+ throw new IllegalStateException("资源点不存在:" + resourcePointCode);
|
|
|
+ }
|
|
|
+ // 资源点所能查看的模版
|
|
|
+ List<String> resourcePointCodes = resourcePoint.getTemplateCodes();
|
|
|
+ if(CollectionUtils.isEmpty(resourcePointCodes)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return templateDao.findListBy("code", resourcePointCodes);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public int addParameter(@NotEmpty("code") String code, @NotEmpty("parameter") TemplateParameter parameter) {
|
|
|
parameter.init();
|