mirror of
https://github.com/chatopera/cosin.git
synced 2025-08-01 16:38:02 +08:00
Fix TablePropertiesRepository related class
This commit is contained in:
parent
f6a09e8c48
commit
192c664db0
@ -112,7 +112,7 @@ public class AppCtxRefreshEventListener implements ApplicationListener<ContextRe
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* 加载系统全局配置
|
* 加载系统全局配置
|
||||||
*/
|
*/
|
||||||
SystemConfigRepository systemConfigRes = event.getApplicationContext().getBean(SystemConfigRepository.class);
|
SystemConfigRepository systemConfigRes = event.getApplicationContext().getBean(SystemConfigRepository.class);
|
||||||
|
@ -29,26 +29,26 @@ import com.chatopera.cc.util.Menu;
|
|||||||
import com.chatopera.cc.util.metadata.DatabaseMetaDataHandler;
|
import com.chatopera.cc.util.metadata.DatabaseMetaDataHandler;
|
||||||
import com.chatopera.cc.util.metadata.UKColumnMetadata;
|
import com.chatopera.cc.util.metadata.UKColumnMetadata;
|
||||||
import com.chatopera.cc.util.metadata.UKTableMetaData;
|
import com.chatopera.cc.util.metadata.UKTableMetaData;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.jdbc.Work;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.BeansException;
|
import org.springframework.beans.BeansException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
import javax.persistence.EntityManager;
|
||||||
import javax.persistence.PersistenceContext;
|
import javax.persistence.PersistenceContext;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
import java.sql.Connection;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -56,43 +56,39 @@ import java.util.List;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/admin/metadata")
|
@RequestMapping("/admin/metadata")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class MetadataController extends Handler {
|
public class MetadataController extends Handler {
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private MetadataRepository metadataRes;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BaseService<?> service;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysDicRepository sysDicRes;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TablePropertiesRepository tablePropertiesRes;
|
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(MetadataController.class);
|
private static final Logger logger = LoggerFactory.getLogger(MetadataController.class);
|
||||||
|
@NonNull
|
||||||
@Autowired
|
private final MetadataRepository metadataRes;
|
||||||
|
@NonNull
|
||||||
|
private final BaseService<?> service;
|
||||||
|
@NonNull
|
||||||
|
private final SysDicRepository sysDicRes;
|
||||||
|
@NonNull
|
||||||
|
private final TablePropertiesRepository tablePropertiesRes;
|
||||||
|
@NonNull
|
||||||
@PersistenceContext
|
@PersistenceContext
|
||||||
private EntityManager em;
|
private final EntityManager em;
|
||||||
|
|
||||||
@RequestMapping("/index")
|
@RequestMapping("/index")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView index(ModelMap map, HttpServletRequest request) throws SQLException {
|
public ModelAndView index(ModelMap map, HttpServletRequest request) {
|
||||||
map.addAttribute("metadataList", metadataRes.findAll(PageRequest.of(super.getP(request), super.getPs(request))));
|
map.addAttribute("metadataList", metadataRes.findAll(PageRequest.of(super.getP(request), super.getPs(request))));
|
||||||
return request(super.createAdminTempletResponse("/admin/system/metadata/index"));
|
return request(super.createAdminTempletResponse("/admin/system/metadata/index"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView edit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
public ModelAndView edit(ModelMap map, @Valid String id) {
|
||||||
map.addAttribute("metadata", metadataRes.findById(id));
|
map.addAttribute("metadata", metadataRes.findById(id));
|
||||||
return request(super.createRequestPageTempletResponse("/admin/system/metadata/edit"));
|
return request(super.createRequestPageTempletResponse("/admin/system/metadata/edit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView update(ModelMap map, HttpServletRequest request, @Valid MetadataTable metadata) throws SQLException {
|
public ModelAndView update(@Valid MetadataTable metadata) {
|
||||||
MetadataTable table = metadataRes.findById(metadata.getId());
|
MetadataTable table = metadataRes.findById(metadata.getId());
|
||||||
table.setName(metadata.getName());
|
table.setName(metadata.getName());
|
||||||
table.setFromdb(metadata.isFromdb());
|
table.setFromdb(metadata.isFromdb());
|
||||||
@ -104,7 +100,7 @@ public class MetadataController extends Handler {
|
|||||||
|
|
||||||
@RequestMapping("/properties/edit")
|
@RequestMapping("/properties/edit")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView propertiesedit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
public ModelAndView propertiesedit(ModelMap map, @Valid String id) {
|
||||||
map.addAttribute("tp", tablePropertiesRes.findById(id));
|
map.addAttribute("tp", tablePropertiesRes.findById(id));
|
||||||
map.addAttribute("sysdicList", sysDicRes.findByParentid("0"));
|
map.addAttribute("sysdicList", sysDicRes.findByParentid("0"));
|
||||||
map.addAttribute("dataImplList", Dict.getInstance().getDic("com.dic.data.impl"));
|
map.addAttribute("dataImplList", Dict.getInstance().getDic("com.dic.data.impl"));
|
||||||
@ -114,8 +110,9 @@ public class MetadataController extends Handler {
|
|||||||
|
|
||||||
@RequestMapping("/properties/update")
|
@RequestMapping("/properties/update")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView propertiesupdate(ModelMap map, HttpServletRequest request, @Valid TableProperties tp) throws SQLException {
|
public ModelAndView propertiesupdate(@Valid TableProperties tp) {
|
||||||
TableProperties tableProperties = tablePropertiesRes.findById(tp.getId());
|
TableProperties tableProperties = tablePropertiesRes.findById(tp.getId())
|
||||||
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Table properties %s not found", tp.getId())));
|
||||||
tableProperties.setName(tp.getName());
|
tableProperties.setName(tp.getName());
|
||||||
tableProperties.setSeldata(tp.isSeldata());
|
tableProperties.setSeldata(tp.isSeldata());
|
||||||
tableProperties.setSeldatacode(tp.getSeldatacode());
|
tableProperties.setSeldatacode(tp.getSeldatacode());
|
||||||
@ -139,7 +136,7 @@ public class MetadataController extends Handler {
|
|||||||
|
|
||||||
@RequestMapping("/delete")
|
@RequestMapping("/delete")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView delete(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException {
|
public ModelAndView delete(@Valid String id) {
|
||||||
MetadataTable table = metadataRes.findById(id);
|
MetadataTable table = metadataRes.findById(id);
|
||||||
metadataRes.delete(table);
|
metadataRes.delete(table);
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
||||||
@ -147,33 +144,34 @@ public class MetadataController extends Handler {
|
|||||||
|
|
||||||
@RequestMapping("/batdelete")
|
@RequestMapping("/batdelete")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView batdelete(ModelMap map, HttpServletRequest request, @Valid String[] ids) throws SQLException {
|
public ModelAndView batdelete(@Valid String[] ids) {
|
||||||
if (ids != null && ids.length > 0) {
|
if (ids != null && ids.length > 0) {
|
||||||
metadataRes.delete(metadataRes.findAll(Arrays.asList(ids)));
|
metadataRes.deleteAll(metadataRes.findAllById(Arrays.asList(ids)));
|
||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/properties/delete")
|
@RequestMapping("/properties/delete")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView propertiesdelete(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String tbid) throws SQLException {
|
public ModelAndView propertiesdelete(@Valid String id, @Valid String tbid) {
|
||||||
TableProperties prop = tablePropertiesRes.findById(id);
|
TableProperties prop = tablePropertiesRes.findById(id)
|
||||||
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Table properties %s not found", id)));
|
||||||
tablePropertiesRes.delete(prop);
|
tablePropertiesRes.delete(prop);
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/table.html?id=" + (!StringUtils.isBlank(tbid) ? tbid : prop.getDbtableid())));
|
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/table.html?id=" + (!StringUtils.isBlank(tbid) ? tbid : prop.getDbtableid())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/properties/batdelete")
|
@RequestMapping("/properties/batdelete")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView propertiesbatdelete(ModelMap map, HttpServletRequest request, @Valid String[] ids, @Valid String tbid) throws SQLException {
|
public ModelAndView propertiesbatdelete(@Valid String[] ids, @Valid String tbid) {
|
||||||
if (ids != null && ids.length > 0) {
|
if (ids != null && ids.length > 0) {
|
||||||
tablePropertiesRes.delete(tablePropertiesRes.findAll(Arrays.asList(ids)));
|
tablePropertiesRes.deleteAll(tablePropertiesRes.findAllById(Arrays.asList(ids)));
|
||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/table.html?id=" + tbid));
|
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/table.html?id=" + tbid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/table")
|
@RequestMapping("/table")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView table(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException {
|
public ModelAndView table(ModelMap map, @Valid String id) {
|
||||||
map.addAttribute("propertiesList", tablePropertiesRes.findByDbtableid(id));
|
map.addAttribute("propertiesList", tablePropertiesRes.findByDbtableid(id));
|
||||||
map.addAttribute("tbid", id);
|
map.addAttribute("tbid", id);
|
||||||
map.addAttribute("table", metadataRes.findById(id));
|
map.addAttribute("table", metadataRes.findById(id));
|
||||||
@ -182,18 +180,16 @@ public class MetadataController extends Handler {
|
|||||||
|
|
||||||
@RequestMapping("/imptb")
|
@RequestMapping("/imptb")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView imptb(final ModelMap map, HttpServletRequest request) throws Exception {
|
public ModelAndView imptb(final ModelMap map) {
|
||||||
|
|
||||||
Session session = (Session) em.getDelegate();
|
Session session = (Session) em.getDelegate();
|
||||||
session.doWork(new Work() {
|
session.doWork(connection -> {
|
||||||
public void execute(Connection connection) throws SQLException {
|
|
||||||
try {
|
try {
|
||||||
map.addAttribute("tablesList",
|
map.addAttribute("tablesList",
|
||||||
DatabaseMetaDataHandler.getTables(connection));
|
DatabaseMetaDataHandler.getTables(connection));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("When import metadata", e);
|
logger.error("When import metadata", e);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return request(super
|
return request(super
|
||||||
@ -202,13 +198,12 @@ public class MetadataController extends Handler {
|
|||||||
|
|
||||||
@RequestMapping("/imptbsave")
|
@RequestMapping("/imptbsave")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView imptb(ModelMap map, HttpServletRequest request, final @Valid String[] tables) throws Exception {
|
public ModelAndView imptb(HttpServletRequest request, final @Valid String[] tables) {
|
||||||
final User user = super.getUser(request);
|
final User user = super.getUser(request);
|
||||||
if (tables != null && tables.length > 0) {
|
if (tables != null && tables.length > 0) {
|
||||||
Session session = (Session) em.getDelegate();
|
Session session = (Session) em.getDelegate();
|
||||||
session.doWork(
|
session.doWork(
|
||||||
new Work() {
|
connection -> {
|
||||||
public void execute(Connection connection) throws SQLException {
|
|
||||||
try {
|
try {
|
||||||
for (String table : tables) {
|
for (String table : tables) {
|
||||||
int count = metadataRes.countByTablename(table);
|
int count = metadataRes.countByTablename(table);
|
||||||
@ -231,7 +226,6 @@ public class MetadataController extends Handler {
|
|||||||
logger.error("When import metadata", e);
|
logger.error("When import metadata", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -240,7 +234,7 @@ public class MetadataController extends Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private MetadataTable processMetadataTable(UKTableMetaData metaData, MetadataTable table) {
|
private MetadataTable processMetadataTable(UKTableMetaData metaData, MetadataTable table) {
|
||||||
table.setTableproperty(new ArrayList<TableProperties>());
|
table.setTableproperty(new ArrayList<>());
|
||||||
if (metaData != null) {
|
if (metaData != null) {
|
||||||
for (UKColumnMetadata colum : metaData.getColumnMetadatas()) {
|
for (UKColumnMetadata colum : metaData.getColumnMetadatas()) {
|
||||||
TableProperties tablePorperties = new TableProperties(colum.getName().toLowerCase(), colum.getTypeName(), colum.getColumnSize(), metaData.getName().toLowerCase());
|
TableProperties tablePorperties = new TableProperties(colum.getName().toLowerCase(), colum.getTypeName(), colum.getColumnSize(), metaData.getName().toLowerCase());
|
||||||
@ -263,7 +257,7 @@ public class MetadataController extends Handler {
|
|||||||
|
|
||||||
public String getDataTypeName(String type) {
|
public String getDataTypeName(String type) {
|
||||||
String typeName = "text";
|
String typeName = "text";
|
||||||
if (type.indexOf("varchar") >= 0) {
|
if (type.contains("varchar")) {
|
||||||
typeName = "text";
|
typeName = "text";
|
||||||
} else if (type.equalsIgnoreCase("date") || type.equalsIgnoreCase("datetime")) {
|
} else if (type.equalsIgnoreCase("date") || type.equalsIgnoreCase("datetime")) {
|
||||||
typeName = type.toLowerCase();
|
typeName = type.toLowerCase();
|
||||||
@ -275,7 +269,7 @@ public class MetadataController extends Handler {
|
|||||||
|
|
||||||
@RequestMapping("/clean")
|
@RequestMapping("/clean")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView clean(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException, BeansException, ClassNotFoundException {
|
public ModelAndView clean(@Valid String id) throws BeansException, ClassNotFoundException {
|
||||||
if (!StringUtils.isBlank(id)) {
|
if (!StringUtils.isBlank(id)) {
|
||||||
MetadataTable table = metadataRes.findById(id);
|
MetadataTable table = metadataRes.findById(id);
|
||||||
if (table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
if (table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
||||||
@ -295,7 +289,7 @@ public class MetadataController extends Handler {
|
|||||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||||
@RequestMapping("/synctoes")
|
@RequestMapping("/synctoes")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView synctoes(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException, BeansException, ClassNotFoundException {
|
public ModelAndView synctoes(@Valid String id) throws BeansException, ClassNotFoundException {
|
||||||
if (!StringUtils.isBlank(id)) {
|
if (!StringUtils.isBlank(id)) {
|
||||||
MetadataTable table = metadataRes.findById(id);
|
MetadataTable table = metadataRes.findById(id);
|
||||||
if (table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
if (table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
||||||
@ -309,9 +303,7 @@ public class MetadataController extends Handler {
|
|||||||
SysDic jpaDic = Dict.getInstance().getDicItem(table.getPreviewtemplet());
|
SysDic jpaDic = Dict.getInstance().getDicItem(table.getPreviewtemplet());
|
||||||
List dataList = service.list(jpaDic.getCode());
|
List dataList = service.list(jpaDic.getCode());
|
||||||
List values = new CskefuList();
|
List values = new CskefuList();
|
||||||
for (Object object : dataList) {
|
values.addAll(dataList);
|
||||||
values.add(object);
|
|
||||||
}
|
|
||||||
if (dataList.size() > 0) {
|
if (dataList.size() > 0) {
|
||||||
jpa.save(values);
|
jpa.save(values);
|
||||||
}
|
}
|
||||||
@ -326,7 +318,7 @@ public class MetadataController extends Handler {
|
|||||||
@SuppressWarnings({"rawtypes"})
|
@SuppressWarnings({"rawtypes"})
|
||||||
@RequestMapping("/synctodb")
|
@RequestMapping("/synctodb")
|
||||||
@Menu(type = "admin", subtype = "metadata", admin = true)
|
@Menu(type = "admin", subtype = "metadata", admin = true)
|
||||||
public ModelAndView synctodb(ModelMap map, HttpServletRequest request, @Valid String id) throws SQLException, BeansException, ClassNotFoundException {
|
public ModelAndView synctodb(@Valid String id) throws BeansException, ClassNotFoundException {
|
||||||
if (!StringUtils.isBlank(id)) {
|
if (!StringUtils.isBlank(id)) {
|
||||||
MetadataTable table = metadataRes.findById(id);
|
MetadataTable table = metadataRes.findById(id);
|
||||||
if (table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
if (table.isFromdb() && !StringUtils.isBlank(table.getListblocktemplet())) {
|
||||||
|
@ -26,11 +26,14 @@ import com.chatopera.cc.persistence.repository.CubeMetadataRepository;
|
|||||||
import com.chatopera.cc.persistence.repository.DimensionRepository;
|
import com.chatopera.cc.persistence.repository.DimensionRepository;
|
||||||
import com.chatopera.cc.persistence.repository.TablePropertiesRepository;
|
import com.chatopera.cc.persistence.repository.TablePropertiesRepository;
|
||||||
import com.chatopera.cc.util.Menu;
|
import com.chatopera.cc.util.Menu;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -39,19 +42,20 @@ import java.util.List;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/apps/report/cubelevel")
|
@RequestMapping("/apps/report/cubelevel")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class CubeLevelController extends Handler {
|
public class CubeLevelController extends Handler {
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private CubeLevelRepository cubeLevelRes;
|
private final CubeLevelRepository cubeLevelRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private DimensionRepository dimensionRes;
|
private final DimensionRepository dimensionRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private TablePropertiesRepository tablePropertiesRes;
|
private final TablePropertiesRepository tablePropertiesRes;
|
||||||
|
|
||||||
@Autowired
|
@NonNull
|
||||||
private CubeMetadataRepository cubeMetadataRes;
|
private final CubeMetadataRepository cubeMetadataRes;
|
||||||
|
|
||||||
@RequestMapping("/add")
|
@RequestMapping("/add")
|
||||||
@Menu(type = "report", subtype = "cubelevel")
|
@Menu(type = "report", subtype = "cubelevel")
|
||||||
@ -77,7 +81,7 @@ public class CubeLevelController extends Handler{
|
|||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
@Menu(type = "report", subtype = "cubelevel")
|
@Menu(type = "report", subtype = "cubelevel")
|
||||||
public ModelAndView cubeLevelsave(ModelMap map , HttpServletRequest request , @Valid CubeLevel cubeLevel,@Valid String tableid) {
|
public ModelAndView cubeLevelsave(HttpServletRequest request, @Valid CubeLevel cubeLevel, @Valid String tableid) {
|
||||||
if (!StringUtils.isBlank(cubeLevel.getName())) {
|
if (!StringUtils.isBlank(cubeLevel.getName())) {
|
||||||
cubeLevel.setOrgi(super.getOrgi(request));
|
cubeLevel.setOrgi(super.getOrgi(request));
|
||||||
cubeLevel.setCreater(super.getUser(request).getId());
|
cubeLevel.setCreater(super.getUser(request).getId());
|
||||||
@ -85,7 +89,8 @@ public class CubeLevelController extends Handler{
|
|||||||
if (!StringUtils.isBlank(tableid)) {
|
if (!StringUtils.isBlank(tableid)) {
|
||||||
TableProperties tb = new TableProperties();
|
TableProperties tb = new TableProperties();
|
||||||
tb.setId(tableid);
|
tb.setId(tableid);
|
||||||
TableProperties t = tablePropertiesRes.findById(tableid);
|
TableProperties t = tablePropertiesRes.findById(tableid)
|
||||||
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Table properties %s not found", tableid)));
|
||||||
cubeLevel.setTablename(t.getTablename());
|
cubeLevel.setTablename(t.getTablename());
|
||||||
cubeLevel.setCode(t.getFieldname());
|
cubeLevel.setCode(t.getFieldname());
|
||||||
cubeLevel.setColumname(t.getFieldname());
|
cubeLevel.setColumname(t.getFieldname());
|
||||||
@ -98,17 +103,18 @@ public class CubeLevelController extends Handler{
|
|||||||
|
|
||||||
@RequestMapping("/delete")
|
@RequestMapping("/delete")
|
||||||
@Menu(type = "report", subtype = "cubelevel")
|
@Menu(type = "report", subtype = "cubelevel")
|
||||||
public ModelAndView quickreplydelete(ModelMap map , HttpServletRequest request , @Valid String id) {
|
public ModelAndView quickreplydelete(@Valid String id) {
|
||||||
CubeLevel cubeLevel = cubeLevelRes.findOne(id) ;
|
CubeLevel cubeLevel = cubeLevelRes.findById(id)
|
||||||
if(cubeLevel!=null){
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Cube level %s not found", id)));
|
||||||
cubeLevelRes.delete(cubeLevel);
|
cubeLevelRes.delete(cubeLevel);
|
||||||
}
|
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + cubeLevel.getCubeid() + "&dimensionId=" + cubeLevel.getDimid()));
|
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + cubeLevel.getCubeid() + "&dimensionId=" + cubeLevel.getDimid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
@Menu(type = "report", subtype = "cubelevel", admin = true)
|
@Menu(type = "report", subtype = "cubelevel", admin = true)
|
||||||
public ModelAndView quickreplyedit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
public ModelAndView quickreplyedit(ModelMap map, HttpServletRequest request, @Valid String id) {
|
||||||
CubeLevel cubeLevel = cubeLevelRes.findOne(id) ;
|
CubeLevel cubeLevel = cubeLevelRes.findById(id)
|
||||||
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Cube level %s not found", id)));
|
||||||
map.put("cubeLevel", cubeLevel);
|
map.put("cubeLevel", cubeLevel);
|
||||||
Dimension dim = dimensionRes.findByIdAndOrgi(cubeLevel.getDimid(), super.getOrgi(request));
|
Dimension dim = dimensionRes.findByIdAndOrgi(cubeLevel.getDimid(), super.getOrgi(request));
|
||||||
if (dim != null) {
|
if (dim != null) {
|
||||||
@ -129,18 +135,17 @@ public class CubeLevelController extends Handler{
|
|||||||
|
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
@Menu(type = "report", subtype = "cubelevel", admin = true)
|
@Menu(type = "report", subtype = "cubelevel", admin = true)
|
||||||
public ModelAndView quickreplyupdate(ModelMap map , HttpServletRequest request , @Valid CubeLevel cubeLevel,@Valid String tableid) {
|
public ModelAndView quickreplyupdate(HttpServletRequest request, @Valid CubeLevel cubeLevel, @Valid String tableid) {
|
||||||
if (!StringUtils.isBlank(cubeLevel.getId())) {
|
if (!StringUtils.isBlank(cubeLevel.getId())) {
|
||||||
CubeLevel temp = cubeLevelRes.findOne(cubeLevel.getId()) ;
|
|
||||||
cubeLevel.setOrgi(super.getOrgi(request));
|
cubeLevel.setOrgi(super.getOrgi(request));
|
||||||
cubeLevel.setCreater(super.getUser(request).getId());
|
cubeLevel.setCreater(super.getUser(request).getId());
|
||||||
if(temp!=null){
|
cubeLevelRes.findById(cubeLevel.getId())
|
||||||
cubeLevel.setCreatetime(temp.getCreatetime());
|
.ifPresent(it -> cubeLevel.setCreatetime(it.getCreatetime()));
|
||||||
}
|
|
||||||
if (!StringUtils.isBlank(tableid)) {
|
if (!StringUtils.isBlank(tableid)) {
|
||||||
TableProperties tb = new TableProperties();
|
TableProperties tb = new TableProperties();
|
||||||
tb.setId(tableid);
|
tb.setId(tableid);
|
||||||
TableProperties t = tablePropertiesRes.findById(tableid);
|
TableProperties t = tablePropertiesRes.findById(tableid)
|
||||||
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Table properties %s not found", tableid)));
|
||||||
cubeLevel.setTablename(t.getTablename());
|
cubeLevel.setTablename(t.getTablename());
|
||||||
cubeLevel.setCode(t.getFieldname());
|
cubeLevel.setCode(t.getFieldname());
|
||||||
cubeLevel.setColumname(t.getFieldname());
|
cubeLevel.setColumname(t.getFieldname());
|
||||||
@ -150,9 +155,10 @@ public class CubeLevelController extends Handler{
|
|||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + cubeLevel.getCubeid() + "&dimensionId=" + cubeLevel.getDimid()));
|
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + cubeLevel.getCubeid() + "&dimensionId=" + cubeLevel.getDimid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/fktableid")
|
@RequestMapping("/fktableid")
|
||||||
@Menu(type = "report", subtype = "cubelevel", admin = true)
|
@Menu(type = "report", subtype = "cubelevel", admin = true)
|
||||||
public ModelAndView fktableid(ModelMap map , HttpServletRequest request , @Valid String tableid) {
|
public ModelAndView fktableid(ModelMap map, @Valid String tableid) {
|
||||||
if (!StringUtils.isBlank(tableid)) {
|
if (!StringUtils.isBlank(tableid)) {
|
||||||
map.put("fktableidList", tablePropertiesRes.findByDbtableid(tableid));
|
map.put("fktableidList", tablePropertiesRes.findByDbtableid(tableid));
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,13 @@ import com.chatopera.cc.persistence.repository.CubeMeasureRepository;
|
|||||||
import com.chatopera.cc.persistence.repository.CubeMetadataRepository;
|
import com.chatopera.cc.persistence.repository.CubeMetadataRepository;
|
||||||
import com.chatopera.cc.persistence.repository.TablePropertiesRepository;
|
import com.chatopera.cc.persistence.repository.TablePropertiesRepository;
|
||||||
import com.chatopera.cc.util.Menu;
|
import com.chatopera.cc.util.Menu;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -36,20 +38,21 @@ import java.util.List;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/apps/report/cubemeasure")
|
@RequestMapping("/apps/report/cubemeasure")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class CubeMeasureController extends Handler {
|
public class CubeMeasureController extends Handler {
|
||||||
|
|
||||||
@Autowired
|
@org.springframework.lang.NonNull
|
||||||
private CubeMeasureRepository cubeMeasureRes;
|
private final CubeMeasureRepository cubeMeasureRes;
|
||||||
|
|
||||||
@Autowired
|
@org.springframework.lang.NonNull
|
||||||
private TablePropertiesRepository tablePropertiesRes;
|
private final TablePropertiesRepository tablePropertiesRes;
|
||||||
|
|
||||||
@Autowired
|
@org.springframework.lang.NonNull
|
||||||
private CubeMetadataRepository cubeMetadataRes;
|
private final CubeMetadataRepository cubeMetadataRes;
|
||||||
|
|
||||||
@RequestMapping("/add")
|
@RequestMapping("/add")
|
||||||
@Menu(type = "report", subtype = "cubemeasure")
|
@Menu(type = "report", subtype = "cubemeasure")
|
||||||
public ModelAndView cubeMeasureadd(ModelMap map , HttpServletRequest request , @Valid String cubeid) {
|
public ModelAndView cubeMeasureadd(ModelMap map, @Valid String cubeid) {
|
||||||
map.addAttribute("cubeid", cubeid);
|
map.addAttribute("cubeid", cubeid);
|
||||||
List<CubeMetadata> cmList = cubeMetadataRes.findByCubeidAndMtype(cubeid, "0");
|
List<CubeMetadata> cmList = cubeMetadataRes.findByCubeidAndMtype(cubeid, "0");
|
||||||
if (!cmList.isEmpty() && cmList.get(0) != null) {
|
if (!cmList.isEmpty() && cmList.get(0) != null) {
|
||||||
@ -61,7 +64,7 @@ public class CubeMeasureController extends Handler{
|
|||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
@Menu(type = "report", subtype = "cubemeasure")
|
@Menu(type = "report", subtype = "cubemeasure")
|
||||||
public ModelAndView cubeMeasuresave(ModelMap map , HttpServletRequest request , @Valid CubeMeasure cubeMeasure) {
|
public ModelAndView cubeMeasuresave(HttpServletRequest request, @Valid CubeMeasure cubeMeasure) {
|
||||||
if (!StringUtils.isBlank(cubeMeasure.getName())) {
|
if (!StringUtils.isBlank(cubeMeasure.getName())) {
|
||||||
cubeMeasure.setOrgi(super.getOrgi(request));
|
cubeMeasure.setOrgi(super.getOrgi(request));
|
||||||
cubeMeasure.setCreater(super.getUser(request).getId());
|
cubeMeasure.setCreater(super.getUser(request).getId());
|
||||||
@ -73,17 +76,17 @@ public class CubeMeasureController extends Handler{
|
|||||||
|
|
||||||
@RequestMapping("/delete")
|
@RequestMapping("/delete")
|
||||||
@Menu(type = "report", subtype = "cubemeasure")
|
@Menu(type = "report", subtype = "cubemeasure")
|
||||||
public ModelAndView quickreplydelete(ModelMap map , HttpServletRequest request , @Valid String id) {
|
public ModelAndView quickreplydelete(@Valid String id) {
|
||||||
CubeMeasure cubeMeasure = cubeMeasureRes.findOne(id) ;
|
cubeMeasureRes.deleteById(id);
|
||||||
if(cubeMeasure!=null){
|
CubeMeasure cubeMeasure = cubeMeasureRes.findById(id)
|
||||||
cubeMeasureRes.delete(cubeMeasure);
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Cube measure %s not found", id)));
|
||||||
}
|
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?dimensionId=cubemeasure&id=" + cubeMeasure.getCubeid()));
|
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?dimensionId=cubemeasure&id=" + cubeMeasure.getCubeid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
@Menu(type = "report", subtype = "cubemeasure", admin = true)
|
@Menu(type = "report", subtype = "cubemeasure", admin = true)
|
||||||
public ModelAndView quickreplyedit(ModelMap map , HttpServletRequest request , @Valid String id) {
|
public ModelAndView quickreplyedit(ModelMap map, @Valid String id) {
|
||||||
CubeMeasure cubeMeasure = cubeMeasureRes.findOne(id) ;
|
CubeMeasure cubeMeasure = cubeMeasureRes.findById(id).orElse(null);
|
||||||
map.put("cubemeasure", cubeMeasure);
|
map.put("cubemeasure", cubeMeasure);
|
||||||
if (cubeMeasure != null) {
|
if (cubeMeasure != null) {
|
||||||
List<CubeMetadata> cmList = cubeMetadataRes.findByCubeidAndMtype(cubeMeasure.getCubeid(), "0");
|
List<CubeMetadata> cmList = cubeMetadataRes.findByCubeidAndMtype(cubeMeasure.getCubeid(), "0");
|
||||||
@ -97,22 +100,20 @@ public class CubeMeasureController extends Handler{
|
|||||||
|
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
@Menu(type = "report", subtype = "cubemeasure", admin = true)
|
@Menu(type = "report", subtype = "cubemeasure", admin = true)
|
||||||
public ModelAndView quickreplyupdate(ModelMap map , HttpServletRequest request , @Valid CubeMeasure cubeMeasure) {
|
public ModelAndView quickreplyupdate(HttpServletRequest request, @Valid CubeMeasure cubeMeasure) {
|
||||||
if (!StringUtils.isBlank(cubeMeasure.getId())) {
|
if (!StringUtils.isBlank(cubeMeasure.getId())) {
|
||||||
CubeMeasure temp = cubeMeasureRes.findOne(cubeMeasure.getId()) ;
|
|
||||||
cubeMeasure.setOrgi(super.getOrgi(request));
|
cubeMeasure.setOrgi(super.getOrgi(request));
|
||||||
cubeMeasure.setCreater(super.getUser(request).getId());
|
cubeMeasure.setCreater(super.getUser(request).getId());
|
||||||
if(temp!=null){
|
cubeMeasureRes.findById(cubeMeasure.getId()).ifPresent(temp -> cubeMeasure.setCreatetime(temp.getCreatetime()));
|
||||||
cubeMeasure.setCreatetime(temp.getCreatetime());
|
|
||||||
}
|
|
||||||
cubeMeasure.setCode(cubeMeasure.getColumname());
|
cubeMeasure.setCode(cubeMeasure.getColumname());
|
||||||
cubeMeasureRes.save(cubeMeasure);
|
cubeMeasureRes.save(cubeMeasure);
|
||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?dimensionId=cubemeasure&id=" + cubeMeasure.getCubeid()));
|
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?dimensionId=cubemeasure&id=" + cubeMeasure.getCubeid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/fktableid")
|
@RequestMapping("/fktableid")
|
||||||
@Menu(type = "report", subtype = "cubemeasure", admin = true)
|
@Menu(type = "report", subtype = "cubemeasure", admin = true)
|
||||||
public ModelAndView fktableid(ModelMap map , HttpServletRequest request , @Valid String tableid) {
|
public ModelAndView fktableid(ModelMap map, @Valid String tableid) {
|
||||||
if (!StringUtils.isBlank(tableid)) {
|
if (!StringUtils.isBlank(tableid)) {
|
||||||
map.put("fktableidList", tablePropertiesRes.findByDbtableid(tableid));
|
map.put("fktableidList", tablePropertiesRes.findByDbtableid(tableid));
|
||||||
}
|
}
|
||||||
|
@ -25,11 +25,13 @@ import com.chatopera.cc.persistence.repository.CubeMetadataRepository;
|
|||||||
import com.chatopera.cc.persistence.repository.DimensionRepository;
|
import com.chatopera.cc.persistence.repository.DimensionRepository;
|
||||||
import com.chatopera.cc.persistence.repository.TablePropertiesRepository;
|
import com.chatopera.cc.persistence.repository.TablePropertiesRepository;
|
||||||
import com.chatopera.cc.util.Menu;
|
import com.chatopera.cc.util.Menu;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.server.ResponseStatusException;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@ -38,23 +40,24 @@ import java.util.List;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/apps/report/dimension")
|
@RequestMapping("/apps/report/dimension")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class DimensionController extends Handler {
|
public class DimensionController extends Handler {
|
||||||
|
|
||||||
@Autowired
|
@org.springframework.lang.NonNull
|
||||||
private DimensionRepository dimensionRes;
|
private final DimensionRepository dimensionRes;
|
||||||
|
|
||||||
@Autowired
|
@org.springframework.lang.NonNull
|
||||||
private CubeLevelRepository cubeLevelRes;
|
private final CubeLevelRepository cubeLevelRes;
|
||||||
|
|
||||||
@Autowired
|
@org.springframework.lang.NonNull
|
||||||
private CubeMetadataRepository cubeMetadataRes;
|
private final CubeMetadataRepository cubeMetadataRes;
|
||||||
|
|
||||||
@Autowired
|
@org.springframework.lang.NonNull
|
||||||
private TablePropertiesRepository tablePropertiesRes;
|
private final TablePropertiesRepository tablePropertiesRes;
|
||||||
|
|
||||||
@RequestMapping("/add")
|
@RequestMapping("/add")
|
||||||
@Menu(type = "report", subtype = "dimension")
|
@Menu(type = "report", subtype = "dimension")
|
||||||
public ModelAndView dimensionadd(ModelMap map , HttpServletRequest request , @Valid String cubeid) {
|
public ModelAndView dimensionadd(ModelMap map, @Valid String cubeid) {
|
||||||
map.addAttribute("cubeid", cubeid);
|
map.addAttribute("cubeid", cubeid);
|
||||||
map.addAttribute("fkfieldList", cubeMetadataRes.findByCubeidAndMtype(cubeid, "0"));
|
map.addAttribute("fkfieldList", cubeMetadataRes.findByCubeidAndMtype(cubeid, "0"));
|
||||||
map.addAttribute("fktableList", cubeMetadataRes.findByCubeidAndMtypeNot(cubeid, "0"));
|
map.addAttribute("fktableList", cubeMetadataRes.findByCubeidAndMtypeNot(cubeid, "0"));
|
||||||
@ -63,7 +66,7 @@ public class DimensionController extends Handler{
|
|||||||
|
|
||||||
@RequestMapping("/save")
|
@RequestMapping("/save")
|
||||||
@Menu(type = "report", subtype = "dimension")
|
@Menu(type = "report", subtype = "dimension")
|
||||||
public ModelAndView dimensionsave(ModelMap map , HttpServletRequest request , @Valid Dimension dimension) {
|
public ModelAndView dimensionsave(HttpServletRequest request, @Valid Dimension dimension) {
|
||||||
if (!StringUtils.isBlank(dimension.getName())) {
|
if (!StringUtils.isBlank(dimension.getName())) {
|
||||||
dimension.setOrgi(super.getOrgi(request));
|
dimension.setOrgi(super.getOrgi(request));
|
||||||
dimension.setCreater(super.getUser(request).getId());
|
dimension.setCreater(super.getUser(request).getId());
|
||||||
@ -74,21 +77,22 @@ public class DimensionController extends Handler{
|
|||||||
|
|
||||||
@RequestMapping("/delete")
|
@RequestMapping("/delete")
|
||||||
@Menu(type = "report", subtype = "dimension")
|
@Menu(type = "report", subtype = "dimension")
|
||||||
public ModelAndView quickreplydelete(ModelMap map , HttpServletRequest request , @Valid String id) {
|
public ModelAndView quickreplydelete(HttpServletRequest request, @Valid String id) {
|
||||||
Dimension dimension = dimensionRes.findOne(id) ;
|
Dimension dimension = dimensionRes.findById(id)
|
||||||
if(dimension!=null){
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Dimension %s not found", id)));
|
||||||
dimensionRes.delete(dimension);
|
dimensionRes.delete(dimension);
|
||||||
List<CubeLevel> cubeLevelList = cubeLevelRes.findByOrgiAndDimid(super.getOrgi(request), id);
|
List<CubeLevel> cubeLevelList = cubeLevelRes.findByOrgiAndDimid(super.getOrgi(request), id);
|
||||||
if (!cubeLevelList.isEmpty()) {
|
if (!cubeLevelList.isEmpty()) {
|
||||||
cubeLevelRes.delete(cubeLevelList);
|
cubeLevelRes.deleteAll(cubeLevelList);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + dimension.getCubeid()));
|
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + dimension.getCubeid()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/edit")
|
@RequestMapping("/edit")
|
||||||
@Menu(type = "report", subtype = "dimension", admin = true)
|
@Menu(type = "report", subtype = "dimension", admin = true)
|
||||||
public ModelAndView quickreplyedit(ModelMap map , HttpServletRequest request , @Valid String id) {
|
public ModelAndView quickreplyedit(ModelMap map, @Valid String id) {
|
||||||
Dimension dimension = dimensionRes.findOne(id) ;
|
Dimension dimension = dimensionRes.findById(id)
|
||||||
|
.orElseThrow(() -> new ResponseStatusException(HttpStatus.NOT_FOUND, String.format("Dimension %s not found", id)));
|
||||||
map.put("dimension", dimension);
|
map.put("dimension", dimension);
|
||||||
String cubeid = dimension.getCubeid();
|
String cubeid = dimension.getCubeid();
|
||||||
map.addAttribute("cubeid", cubeid);
|
map.addAttribute("cubeid", cubeid);
|
||||||
@ -101,21 +105,19 @@ public class DimensionController extends Handler{
|
|||||||
|
|
||||||
@RequestMapping("/update")
|
@RequestMapping("/update")
|
||||||
@Menu(type = "report", subtype = "dimension", admin = true)
|
@Menu(type = "report", subtype = "dimension", admin = true)
|
||||||
public ModelAndView quickreplyupdate(ModelMap map , HttpServletRequest request , @Valid Dimension dimension) {
|
public ModelAndView quickreplyupdate(HttpServletRequest request, @Valid Dimension dimension) {
|
||||||
if (!StringUtils.isBlank(dimension.getId())) {
|
if (!StringUtils.isBlank(dimension.getId())) {
|
||||||
Dimension temp = dimensionRes.findOne(dimension.getId()) ;
|
|
||||||
dimension.setOrgi(super.getOrgi(request));
|
dimension.setOrgi(super.getOrgi(request));
|
||||||
dimension.setCreater(super.getUser(request).getId());
|
dimension.setCreater(super.getUser(request).getId());
|
||||||
if(temp!=null){
|
dimensionRes.findById(dimension.getId()).ifPresent(it -> dimension.setCreatetime(it.getCreatetime()));
|
||||||
dimension.setCreatetime(temp.getCreatetime());
|
|
||||||
}
|
|
||||||
dimensionRes.save(dimension);
|
dimensionRes.save(dimension);
|
||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + dimension.getCubeid() + "&dimensionId=" + dimension.getId()));
|
return request(super.createRequestPageTempletResponse("redirect:/apps/report/cube/detail.html?id=" + dimension.getCubeid() + "&dimensionId=" + dimension.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/fktableid")
|
@RequestMapping("/fktableid")
|
||||||
@Menu(type = "report", subtype = "dimension", admin = true)
|
@Menu(type = "report", subtype = "dimension", admin = true)
|
||||||
public ModelAndView fktableid(ModelMap map , HttpServletRequest request , @Valid String tableid) {
|
public ModelAndView fktableid(ModelMap map, @Valid String tableid) {
|
||||||
if (!StringUtils.isBlank(tableid)) {
|
if (!StringUtils.isBlank(tableid)) {
|
||||||
map.put("fktableidList", tablePropertiesRes.findByDbtableid(tableid));
|
map.put("fktableidList", tablePropertiesRes.findByDbtableid(tableid));
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,12 @@ import com.chatopera.cc.model.*;
|
|||||||
import com.chatopera.cc.persistence.repository.*;
|
import com.chatopera.cc.persistence.repository.*;
|
||||||
import com.chatopera.cc.util.Menu;
|
import com.chatopera.cc.util.Menu;
|
||||||
import com.chatopera.cc.util.bi.ReportData;
|
import com.chatopera.cc.util.bi.ReportData;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.commons.lang.exception.ExceptionUtils;
|
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.ModelMap;
|
import org.springframework.ui.ModelMap;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -40,47 +41,36 @@ import java.util.*;
|
|||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@RequestMapping("/apps/report/design")
|
@RequestMapping("/apps/report/design")
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class ReportDesignController extends Handler {
|
public class ReportDesignController extends Handler {
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private final TemplateRepository templateRes;
|
||||||
|
@NonNull
|
||||||
|
private final ReportRepository reportRes;
|
||||||
|
@NonNull
|
||||||
|
private final ReportModelRepository reportModelRes;
|
||||||
|
@NonNull
|
||||||
|
private final PublishedCubeRepository publishedCubeRepository;
|
||||||
|
@NonNull
|
||||||
|
private final ColumnPropertiesRepository columnPropertiesRepository;
|
||||||
|
@NonNull
|
||||||
|
private final ReportFilterRepository reportFilterRepository;
|
||||||
|
@NonNull
|
||||||
|
private final ReportCubeService reportCubeService;
|
||||||
|
@NonNull
|
||||||
|
private final TablePropertiesRepository tablePropertiesRes;
|
||||||
|
@NonNull
|
||||||
|
private final PublishedReportRepository publishedReportRes;
|
||||||
|
@NonNull
|
||||||
|
private final SysDicRepository sysDicRes;
|
||||||
|
@NonNull
|
||||||
|
private final MetadataRepository metadataRes;
|
||||||
@Value("${web.upload-path}")
|
@Value("${web.upload-path}")
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
@Value("${uk.im.server.port}")
|
@Value("${uk.im.server.port}")
|
||||||
private Integer port;
|
private Integer port;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TemplateRepository templateRes;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ReportRepository reportRes;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ReportModelRepository reportModelRes;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PublishedCubeRepository publishedCubeRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ColumnPropertiesRepository columnPropertiesRepository;
|
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ReportFilterRepository reportFilterRepository;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ReportCubeService reportCubeService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private TablePropertiesRepository tablePropertiesRes;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PublishedReportRepository publishedReportRes;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private SysDicRepository sysDicRes;
|
|
||||||
@Autowired
|
|
||||||
private MetadataRepository metadataRes;
|
|
||||||
|
|
||||||
@RequestMapping("/index")
|
@RequestMapping("/index")
|
||||||
@Menu(type = "report", subtype = "reportdesign")
|
@Menu(type = "report", subtype = "reportdesign")
|
||||||
public ModelAndView index(ModelMap map, HttpServletRequest request, @Valid String q, @Valid String id) throws Exception {
|
public ModelAndView index(ModelMap map, HttpServletRequest request, @Valid String q, @Valid String id) throws Exception {
|
||||||
@ -162,12 +152,6 @@ public class ReportDesignController extends Handler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求 报表的模板组件, 请求的时候,生成个报表组件,报表组件 需要存放在列的对应关系中
|
* 请求 报表的模板组件, 请求的时候,生成个报表组件,报表组件 需要存放在列的对应关系中
|
||||||
*
|
|
||||||
* @param map
|
|
||||||
* @param request
|
|
||||||
* @param template
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/element")
|
@RequestMapping("/element")
|
||||||
@Menu(type = "report", subtype = "reportdesign")
|
@Menu(type = "report", subtype = "reportdesign")
|
||||||
@ -223,6 +207,7 @@ public class ReportDesignController extends Handler {
|
|||||||
|
|
||||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/layout"));
|
return request(super.createRequestPageTempletResponse("/apps/business/report/design/layout"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求 过滤器的模板组件, 请求的时候,生成个过滤器组件
|
* 请求 过滤器的模板组件, 请求的时候,生成个过滤器组件
|
||||||
*
|
*
|
||||||
@ -262,6 +247,7 @@ public class ReportDesignController extends Handler {
|
|||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/filter"));
|
return request(super.createRequestPageTempletResponse("/apps/business/report/design/filter"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除模板组件
|
* 删除模板组件
|
||||||
*
|
*
|
||||||
@ -277,7 +263,7 @@ public class ReportDesignController extends Handler {
|
|||||||
if (model != null) {
|
if (model != null) {
|
||||||
List<ReportModel> childsList = reportModelRes.findByParentidAndOrgi(model.getId(), super.getOrgi(request));
|
List<ReportModel> childsList = reportModelRes.findByParentidAndOrgi(model.getId(), super.getOrgi(request));
|
||||||
if (!childsList.isEmpty()) {
|
if (!childsList.isEmpty()) {
|
||||||
reportModelRes.delete(childsList);
|
reportModelRes.deleteAll(childsList);
|
||||||
}
|
}
|
||||||
reportModelRes.delete(model);
|
reportModelRes.delete(model);
|
||||||
}
|
}
|
||||||
@ -309,7 +295,7 @@ public class ReportDesignController extends Handler {
|
|||||||
map.addAttribute("reportModel", model);
|
map.addAttribute("reportModel", model);
|
||||||
map.addAttribute("element", model);
|
map.addAttribute("element", model);
|
||||||
if (model != null && !StringUtils.isBlank(model.getPublishedcubeid())) {
|
if (model != null && !StringUtils.isBlank(model.getPublishedcubeid())) {
|
||||||
PublishedCube cube = publishedCubeRepository.findOne(model.getPublishedcubeid());
|
PublishedCube cube = publishedCubeRepository.findById(model.getPublishedcubeid());
|
||||||
map.addAttribute("cube", cube);
|
map.addAttribute("cube", cube);
|
||||||
if (canGetReportData(model, cube.getCube())) {
|
if (canGetReportData(model, cube.getCube())) {
|
||||||
ReportData reportData = null;
|
ReportData reportData = null;
|
||||||
@ -325,9 +311,11 @@ public class ReportDesignController extends Handler {
|
|||||||
map.addAttribute("tabid", tabid);
|
map.addAttribute("tabid", tabid);
|
||||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign"));
|
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canGetReportData(ReportModel model, Cube cube) {
|
private boolean canGetReportData(ReportModel model, Cube cube) {
|
||||||
return !model.getProperties().isEmpty() || !model.getColproperties().isEmpty() || !model.getMeasures().isEmpty();
|
return !model.getProperties().isEmpty() || !model.getColproperties().isEmpty() || !model.getMeasures().isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReportModel getModel(String id, String orgi) {
|
private ReportModel getModel(String id, String orgi) {
|
||||||
ReportModel model = reportModelRes.findByIdAndOrgi(id, orgi);
|
ReportModel model = reportModelRes.findByIdAndOrgi(id, orgi);
|
||||||
if (model != null) {
|
if (model != null) {
|
||||||
@ -368,12 +356,10 @@ public class ReportDesignController extends Handler {
|
|||||||
ReportModel model = this.getModel(mid, super.getOrgi(request));
|
ReportModel model = this.getModel(mid, super.getOrgi(request));
|
||||||
if (!StringUtils.isBlank(cubeid)) {
|
if (!StringUtils.isBlank(cubeid)) {
|
||||||
model.setPublishedcubeid(cubeid);
|
model.setPublishedcubeid(cubeid);
|
||||||
if(model!=null) {
|
columnPropertiesRepository.deleteAll(model.getProperties());
|
||||||
columnPropertiesRepository.delete(model.getProperties());
|
columnPropertiesRepository.deleteAll(model.getColproperties());
|
||||||
columnPropertiesRepository.delete(model.getColproperties());
|
columnPropertiesRepository.deleteAll(model.getMeasures());
|
||||||
columnPropertiesRepository.delete(model.getMeasures());
|
reportFilterRepository.deleteAll(model.getFilters());
|
||||||
reportFilterRepository.delete(model.getFilters());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
reportModelRes.save(model);
|
reportModelRes.save(model);
|
||||||
map.put("reportModel", model);
|
map.put("reportModel", model);
|
||||||
@ -402,8 +388,10 @@ public class ReportDesignController extends Handler {
|
|||||||
map.addAttribute("dtype", dtype);
|
map.addAttribute("dtype", dtype);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加过滤器
|
* 添加过滤器
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param request
|
* @param request
|
||||||
* @return
|
* @return
|
||||||
@ -432,6 +420,7 @@ public class ReportDesignController extends Handler {
|
|||||||
map.addAttribute("dtype", dtype);
|
map.addAttribute("dtype", dtype);
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存过滤器
|
* 保存过滤器
|
||||||
*
|
*
|
||||||
@ -469,6 +458,7 @@ public class ReportDesignController extends Handler {
|
|||||||
return request(super.createRequestPageTempletResponse(
|
return request(super.createRequestPageTempletResponse(
|
||||||
"redirect:/apps/report/design/modeldesign.html?id=" + modelId + "&tabid=filter"));
|
"redirect:/apps/report/design/modeldesign.html?id=" + modelId + "&tabid=filter"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/gettableid")
|
@RequestMapping("/gettableid")
|
||||||
@Menu(type = "report", subtype = "reportdesign")
|
@Menu(type = "report", subtype = "reportdesign")
|
||||||
public ModelAndView gettableid(ModelMap map, HttpServletRequest request, @Valid String tableid) {
|
public ModelAndView gettableid(ModelMap map, HttpServletRequest request, @Valid String tableid) {
|
||||||
@ -477,6 +467,7 @@ public class ReportDesignController extends Handler {
|
|||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/fktableid"));
|
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/fktableid"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/values")
|
@RequestMapping("/values")
|
||||||
@Menu(type = "report", subtype = "reportdesign")
|
@Menu(type = "report", subtype = "reportdesign")
|
||||||
public ModelAndView values(ModelMap map, HttpServletRequest request, @Valid String mid, @Valid String dsid,
|
public ModelAndView values(ModelMap map, HttpServletRequest request, @Valid String mid, @Valid String dsid,
|
||||||
@ -633,7 +624,6 @@ public class ReportDesignController extends Handler {
|
|||||||
*
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @param request
|
* @param request
|
||||||
* @param template
|
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@ -668,6 +658,7 @@ public class ReportDesignController extends Handler {
|
|||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/elementajax"));
|
return request(super.createRequestPageTempletResponse("/apps/business/report/design/elementajax"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ReportModel getModel(String id, String orgi, String publishedid) {
|
private ReportModel getModel(String id, String orgi, String publishedid) {
|
||||||
if (!StringUtils.isBlank(publishedid)) {
|
if (!StringUtils.isBlank(publishedid)) {
|
||||||
PublishedReport publishedReport = publishedReportRes.findById(publishedid);
|
PublishedReport publishedReport = publishedReportRes.findById(publishedid);
|
||||||
@ -718,6 +709,7 @@ public class ReportDesignController extends Handler {
|
|||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/filteredit"));
|
return request(super.createRequestPageTempletResponse("/apps/business/report/design/filteredit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑过滤器
|
* 编辑过滤器
|
||||||
*
|
*
|
||||||
@ -777,6 +769,7 @@ public class ReportDesignController extends Handler {
|
|||||||
return request(super.createRequestPageTempletResponse(
|
return request(super.createRequestPageTempletResponse(
|
||||||
"redirect:/apps/report/design/index.html?id=" + reportId));
|
"redirect:/apps/report/design/index.html?id=" + reportId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑模型过滤器
|
* 编辑模型过滤器
|
||||||
*
|
*
|
||||||
@ -818,6 +811,7 @@ public class ReportDesignController extends Handler {
|
|||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/filteredit"));
|
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/filteredit"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑过滤器
|
* 编辑过滤器
|
||||||
*
|
*
|
||||||
@ -877,6 +871,7 @@ public class ReportDesignController extends Handler {
|
|||||||
return request(super.createRequestPageTempletResponse(
|
return request(super.createRequestPageTempletResponse(
|
||||||
"redirect:/apps/report/design/modeldesign.html?id=" + modelId + "&tabid=filter"));
|
"redirect:/apps/report/design/modeldesign.html?id=" + modelId + "&tabid=filter"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/fktableid")
|
@RequestMapping("/fktableid")
|
||||||
@Menu(type = "report", subtype = "reportdesign", admin = true)
|
@Menu(type = "report", subtype = "reportdesign", admin = true)
|
||||||
public ModelAndView fktableid(ModelMap map, HttpServletRequest request, @Valid String fid, @Valid String fkId) {
|
public ModelAndView fktableid(ModelMap map, HttpServletRequest request, @Valid String fid, @Valid String fkId) {
|
||||||
@ -894,6 +889,7 @@ public class ReportDesignController extends Handler {
|
|||||||
}
|
}
|
||||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/fktableiddiv"));
|
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/fktableiddiv"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑过滤器
|
* 编辑过滤器
|
||||||
*
|
*
|
||||||
@ -915,6 +911,7 @@ public class ReportDesignController extends Handler {
|
|||||||
return request(super.createRequestPageTempletResponse(
|
return request(super.createRequestPageTempletResponse(
|
||||||
"redirect:/apps/report/design/modeldesign.html?id=" + modelId + "&tabid=filter"));
|
"redirect:/apps/report/design/modeldesign.html?id=" + modelId + "&tabid=filter"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑过滤器
|
* 编辑过滤器
|
||||||
*
|
*
|
||||||
@ -936,6 +933,7 @@ public class ReportDesignController extends Handler {
|
|||||||
return request(super.createRequestPageTempletResponse(
|
return request(super.createRequestPageTempletResponse(
|
||||||
"redirect:/apps/report/design/index.html?id=" + reportId));
|
"redirect:/apps/report/design/index.html?id=" + reportId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
*
|
*
|
||||||
@ -1103,7 +1101,7 @@ public class ReportDesignController extends Handler {
|
|||||||
map.addAttribute("eltemplet", templateRes.findByIdAndOrgi(model.getTempletid(), super.getOrgi(request)));
|
map.addAttribute("eltemplet", templateRes.findByIdAndOrgi(model.getTempletid(), super.getOrgi(request)));
|
||||||
map.addAttribute("element", model);
|
map.addAttribute("element", model);
|
||||||
map.addAttribute("reportModel", model);
|
map.addAttribute("reportModel", model);
|
||||||
if (model != null && !StringUtils.isBlank(model.getPublishedcubeid())) {
|
if (!StringUtils.isBlank(model.getPublishedcubeid())) {
|
||||||
PublishedCube cube = publishedCubeRepository.findOne(model.getPublishedcubeid());
|
PublishedCube cube = publishedCubeRepository.findOne(model.getPublishedcubeid());
|
||||||
map.addAttribute("cube", cube);
|
map.addAttribute("cube", cube);
|
||||||
if (!model.getMeasures().isEmpty()) {
|
if (!model.getMeasures().isEmpty()) {
|
||||||
@ -1183,6 +1181,7 @@ public class ReportDesignController extends Handler {
|
|||||||
|
|
||||||
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/filter"));
|
return request(super.createRequestPageTempletResponse("/apps/business/report/design/modeldesign/filter"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/editmodelname")
|
@RequestMapping("/editmodelname")
|
||||||
@Menu(type = "report", subtype = "reportdesign")
|
@Menu(type = "report", subtype = "reportdesign")
|
||||||
public ModelAndView editmodelname(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String name) {
|
public ModelAndView editmodelname(ModelMap map, HttpServletRequest request, @Valid String id, @Valid String name) {
|
||||||
@ -1191,6 +1190,7 @@ public class ReportDesignController extends Handler {
|
|||||||
return request(super.createRequestPageTempletResponse(
|
return request(super.createRequestPageTempletResponse(
|
||||||
"/apps/business/report/design/modeldesign/editmodelname"));
|
"/apps/business/report/design/modeldesign/editmodelname"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/updatemodelname")
|
@RequestMapping("/updatemodelname")
|
||||||
@Menu(type = "report", subtype = "reportdesign")
|
@Menu(type = "report", subtype = "reportdesign")
|
||||||
public ModelAndView updatemodelname(ModelMap map, HttpServletRequest request, @Valid String name, @Valid String id) {
|
public ModelAndView updatemodelname(ModelMap map, HttpServletRequest request, @Valid String name, @Valid String id) {
|
||||||
@ -1202,10 +1202,11 @@ public class ReportDesignController extends Handler {
|
|||||||
return request(super.createRequestPageTempletResponse(
|
return request(super.createRequestPageTempletResponse(
|
||||||
"redirect:/apps/report/design/modeldesign.html?id=" + model.getId() + "&tabid=data"));
|
"redirect:/apps/report/design/modeldesign.html?id=" + model.getId() + "&tabid=data"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报表发布页面加载
|
* 报表发布页面加载
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param cubeid
|
|
||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@ -1218,6 +1219,7 @@ public class ReportDesignController extends Handler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 报表发布
|
* 报表发布
|
||||||
|
*
|
||||||
* @param request
|
* @param request
|
||||||
* @param reportid
|
* @param reportid
|
||||||
* @return
|
* @return
|
||||||
@ -1256,7 +1258,7 @@ public class ReportDesignController extends Handler {
|
|||||||
publishedReport.setDataversion(maxVersion + 1);
|
publishedReport.setDataversion(maxVersion + 1);
|
||||||
publishedReportRes.save(publishedReport);
|
publishedReportRes.save(publishedReport);
|
||||||
} else {
|
} else {
|
||||||
publishedReportRes.delete(pbReportList);
|
publishedReportRes.deleteAll(pbReportList);
|
||||||
publishedReport.setDataversion(1);
|
publishedReport.setDataversion(1);
|
||||||
publishedReportRes.save(publishedReport);
|
publishedReportRes.save(publishedReport);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public interface TablePropertiesRepository extends JpaRepository<TableProperties, String> {
|
public interface TablePropertiesRepository extends JpaRepository<TableProperties, String> {
|
||||||
|
|
||||||
TableProperties findById(String id);
|
// TableProperties findById(String id);
|
||||||
|
|
||||||
List<TableProperties> findByDbtableid(String dbtableid);
|
List<TableProperties> findByDbtableid(String dbtableid);
|
||||||
|
|
||||||
@ -31,5 +31,5 @@ public interface TablePropertiesRepository extends JpaRepository<TableProperties
|
|||||||
|
|
||||||
List<TableProperties> findBySecfield(boolean secfield);
|
List<TableProperties> findBySecfield(boolean secfield);
|
||||||
|
|
||||||
TableProperties findByTablenameAndFieldname(String tablename, String fieldname) ;
|
// TableProperties findByTablenameAndFieldname(String tablename, String fieldname) ;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user