| | |
| | | <version>3.7.2</version> |
| | | </dependency> |
| | | |
| | | |
| | | <dependency> |
| | | <groupId>com.xuxueli</groupId> |
| | | <artifactId>xxl-job-core</artifactId> |
| | |
| | | <systemPath>${pom.basedir}/src/main/resources/lib/common-1.0.jar</systemPath> |
| | | </dependency> |
| | | <!--hbase--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.data</groupId>--> |
| | | <!--<artifactId>spring-data-hadoop-boot</artifactId>--> |
| | | <!--<version>2.5.0.RELEASE</version>--> |
| | | <!--<exclusions>--> |
| | | <!--<exclusion>--> |
| | | <!--<groupId>javax.servlet</groupId>--> |
| | | <!--<artifactId>servlet-api</artifactId>--> |
| | | <!--</exclusion>--> |
| | | <!--</exclusions>--> |
| | | <!--</dependency>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.springframework.data</groupId>--> |
| | | <!--<artifactId>spring-data-hadoop</artifactId>--> |
| | | <!--<version>2.5.0.RELEASE</version>--> |
| | | <!--<exclusions>--> |
| | | <!--<exclusion>--> |
| | | <!--<groupId>org.slf4j</groupId>--> |
| | | <!--<artifactId>slf4j-log4j12</artifactId>--> |
| | | <!--</exclusion>--> |
| | | <!--<exclusion>--> |
| | | <!--<groupId>log4j</groupId>--> |
| | | <!--<artifactId>log4j</artifactId>--> |
| | | <!--</exclusion>--> |
| | | <!--<exclusion>--> |
| | | <!--<groupId>javax.servlet</groupId>--> |
| | | <!--<artifactId>servlet-api</artifactId>--> |
| | | <!--</exclusion>--> |
| | | <!--</exclusions>--> |
| | | <!--</dependency>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.apache.hbase</groupId>--> |
| | | <!--<artifactId>hbase-client</artifactId>--> |
| | | <!--<version>1.4.4</version>--> |
| | | <!--<exclusions>--> |
| | | <!--<exclusion>--> |
| | | <!--<groupId>org.slf4j</groupId>--> |
| | | <!--<artifactId>slf4j-log4j12</artifactId>--> |
| | | <!--</exclusion>--> |
| | | <!--<exclusion>--> |
| | | <!--<groupId>log4j</groupId>--> |
| | | <!--<artifactId>log4j</artifactId>--> |
| | | <!--</exclusion>--> |
| | | <!--<exclusion>--> |
| | | <!--<groupId>javax.servlet</groupId>--> |
| | | <!--<artifactId>servlet-api</artifactId>--> |
| | | <!--</exclusion>--> |
| | | <!--</exclusions>--> |
| | | <!--</dependency>--> |
| | | <!--<dependency>--> |
| | | <!--<groupId>org.apache.logging.log4j</groupId>--> |
| | | <!--<artifactId>log4j-1.2-api</artifactId>--> |
| | | <!--<version>2.11.0</version>--> |
| | | <!--</dependency>--> |
| | | <dependency> |
| | | <groupId>org.springframework.data</groupId> |
| | | <artifactId>spring-data-hadoop-hbase</artifactId> |
| | | <version>2.5.0.RELEASE</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.apache.hbase</groupId> |
| | | <artifactId>hbase-client</artifactId> |
| | | <version>1.1.2</version> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>org.springframework.data</groupId> |
| | | <artifactId>spring-data-hadoop</artifactId> |
| | | <version>2.5.0.RELEASE</version> |
| | | </dependency> |
| | | |
| | | </dependencies> |
| | | |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | |
| | | |
| | | @Autowired |
| | | IMaintainFieldService maintainFieldService; |
| | | @Autowired |
| | | ISysFieldService fieldService; |
| | | |
| | | |
| | | @RequestMapping(value = "/list", method = RequestMethod.GET) |
| | | public Result<List<Map<String, Object>>> list(HttpServletRequest request) throws FileNotFoundException { |
| | | @RequestMapping(value = "/list/{pageNo}", method = RequestMethod.GET) |
| | | public Result<List<Map<String, Object>>> list(@PathVariable Integer pageNo, HttpServletRequest request) { |
| | | String filterSegment = request.getParameter("filterSegment"); |
| | | String pageSize = request.getParameter("pageSize"); |
| | | if (StringUtils.isEmpty(filterSegment)) { |
| | | filterSegment = Constant.WHERE_DEFAULT; |
| | | } |
| | |
| | | String url = "act/img/" + newModelId; |
| | | one.put("imgurl",url); |
| | | } |
| | | return Result.success(list); |
| | | Integer size; |
| | | if(StringUtils.isEmpty(pageSize)){ |
| | | size = 15; |
| | | }else { |
| | | size = Integer.valueOf(pageSize); |
| | | } |
| | | return fieldService.getPagedDataByList(list, pageNo, size); |
| | | } |
| | | @RequestMapping(value = "/img/{modelId}", method = RequestMethod.GET) |
| | | public void image(@PathVariable String modelId, HttpServletResponse response) { |
New file |
| | |
| | | package com.highdatas.mdm.controller;
|
| | |
|
| | | import com.highdatas.mdm.pojo.Result;
|
| | | import com.highdatas.mdm.service.HBaseService;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.web.bind.annotation.PathVariable;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * @author kimi
|
| | | * @description
|
| | | * @date 2019-12-13 10:57
|
| | | */
|
| | |
|
| | | @Slf4j
|
| | | @RestController
|
| | | @RequestMapping("/hbase")
|
| | | public class HbaseController {
|
| | |
|
| | | @Autowired
|
| | | HBaseService hBaseService;
|
| | |
|
| | |
|
| | | @RequestMapping(value = "/test")
|
| | | public Result deleteActUser(){
|
| | | List<org.apache.hadoop.hbase.client.Result> rowKeyAndColumn = hBaseService.getRowKeyAndColumn("test", "1", "2", "name", " 1 = 1");
|
| | | return Result.success(rowKeyAndColumn);
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "/create/{tableName}")
|
| | | public Result create(@PathVariable String tableName){
|
| | | hBaseService.createTable(tableName);
|
| | | return Result.success(null);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | .eq(Constant.TYPE, type) |
| | | .eq(character_id, characterId) |
| | | .eq("menu_id", menuId); |
| | | Wrapper<MasterAuthor> menuWrapper = new EntityWrapper<MasterAuthor>() |
| | | .eq(Constant.TYPE, type) |
| | | .eq(character_id, characterId) |
| | | .eq("menu_id", menuId); |
| | | if (!StringUtils.isEmpty(maintainFieldId)) { |
| | | masterAuthorWrapper.eq(this.maintain_field_id, maintainFieldId); |
| | | } |
| | | |
| | | List<MasterAuthor> masterAuthorList = authorService.selectList(masterAuthorWrapper); |
| | | if (masterAuthorList.isEmpty()) { |
| | | int count = authorService.selectCount(menuWrapper); |
| | | boolean only = false; |
| | | if (count == 1 && !StringUtils.isEmpty(maintainFieldId)) { |
| | | only = true; |
| | | } |
| | | MasterAuthor masterAuthor = authorService.selectOne(masterAuthorWrapper); |
| | | if (masterAuthor == null) { |
| | | return Result.success(null); |
| | | } |
| | | boolean partDel = false; |
| | | if (masterAuthorList.size() == 1 && !StringUtils.isEmpty(maintainFieldId)) { |
| | | // 只有一个且删除 字段版本 保留本条 |
| | | partDel = true; |
| | | } |
| | | boolean delete = false; |
| | | for (MasterAuthor masterAuthor : masterAuthorList) { |
| | | delete = authorDetailService.delete(new EntityWrapper<MasterAuthorDetail>().eq(Constant.PARENT_ID, masterAuthor.getId())); |
| | | if (delete) { |
| | | if (partDel) { |
| | | delete = masterAuthor.setMaintainFieldId(null).updateById(); |
| | | }else { |
| | | delete = masterAuthor.deleteById(); |
| | | } |
| | | |
| | | boolean delete = authorDetailService.delete(new EntityWrapper<MasterAuthorDetail>().eq(Constant.PARENT_ID, masterAuthor.getId())); |
| | | if (delete) { |
| | | if (only){ |
| | | delete = masterAuthor.setMaintainFieldId(null).setFieldAuto(false).setMaintainAuto(false).setUpdateTime(new Date()).updateById(); |
| | | }else { |
| | | delete = masterAuthor.deleteById(); |
| | | } |
| | | } |
| | | |
| | |
| | | flows = flows.stream().filter(flow -> flowsService.isNextAudit(flow, userId)).collect(Collectors.toList()); |
| | | |
| | | HashSet<String> tableNameSet = new HashSet<>(); |
| | | List<String> maintainIds = flows.stream().map(Flows::getBusinessId).collect(Collectors.toList()); |
| | | if (maintainIds.size() == 0) { |
| | | List<String> maintainIds = flows.stream().filter(flow -> flow.getBusinessType().equals(ActivitiBusinessType.maintain)).map(Flows::getBusinessId).collect(Collectors.toList()); |
| | | List<String> maintainFieldIds = flows.stream().filter(flow -> flow.getBusinessType().equals(ActivitiBusinessType.field)).map(Flows::getBusinessId).collect(Collectors.toList()); |
| | | |
| | | if (maintainIds.isEmpty() && maintainFieldIds.isEmpty()) { |
| | | return Result.success(null); |
| | | } |
| | | maintainIds = maintainIds.stream().filter(s -> masterAuthorService.checkMaintainAuthor(userId,s)).collect(Collectors.toList()); |
| | | if (maintainIds.isEmpty()) { |
| | | return Result.success(null); |
| | | for (String maintainFieldId : maintainFieldIds) { |
| | | MaintainField maintainField = maintainFieldService.selectById(maintainFieldId); |
| | | if (maintainField == null) { |
| | | continue; |
| | | } |
| | | String tableName = maintainField.getTableName(); |
| | | if (StringUtils.isEmpty(tableName)) { |
| | | continue; |
| | | } |
| | | tableNameSet.add(tableName); |
| | | } |
| | | List<Maintain> maintains = maintainService.selectBatchIds(maintainIds); |
| | | maintainIds = maintainIds.stream().filter(s -> masterAuthorService.checkMaintainAuthor(userId,s)).collect(Collectors.toList()); |
| | | if (!maintainIds.isEmpty()) { |
| | | List<Maintain> maintains = maintainService.selectBatchIds(maintainIds); |
| | | |
| | | List<String> tableNameList = maintains.stream().map(Maintain::getTableName).collect(Collectors.toList()); |
| | | tableNameSet.addAll(tableNameList); |
| | | // |
| | | List<MaintainField> maintainFields = maintainFieldService.selectBatchIds(maintainIds); |
| | | tableNameSet.addAll(maintainFields.stream().map(MaintainField::getTableName).collect(Collectors.toList())); |
| | | List<String> tableNameList = maintains.stream().map(Maintain::getTableName).collect(Collectors.toList()); |
| | | tableNameSet.addAll(tableNameList); |
| | | } |
| | | if (tableNameSet.size() == 0) { |
| | | return Result.success(null); |
| | | } |
| | |
| | | @TableField("field_auto") |
| | | private Boolean fieldAuto; |
| | | |
| | | @TableField("is_group") |
| | | private Boolean isGroup; |
| | | |
| | | @TableField("maintain_auto") |
| | | private Boolean maintainAuto; |
| | | |
| | |
| | | |
| | | private transient List<MasterAuthorDetail> fields; |
| | | |
| | | public Boolean getGroup() { |
| | | return isGroup; |
| | | } |
| | | |
| | | public MasterAuthor setGroup(Boolean group) { |
| | | isGroup = group; |
| | | return this; |
| | | } |
| | | |
| | | public Boolean getMaintainAuto() { |
| | | return maintainAuto; |
| | | } |
New file |
| | |
| | | package com.highdatas.mdm.service;
|
| | |
|
| | | import org.apache.hadoop.hbase.client.Result;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | /**
|
| | | * @author kimi
|
| | | * @description
|
| | | * @date 2020-03-31 16:01
|
| | | */
|
| | |
|
| | | @Service
|
| | | public interface HBaseService {
|
| | |
|
| | | List<Result> getRowKeyAndColumn(String tableName, String startRowkey, String stopRowkey, String column, String qualifier);
|
| | | List<Result> getListRowkeyData(String tableName, List<String> rowKeys, String familyColumn, String column);
|
| | |
|
| | | void createTable(String tableName);
|
| | | }
|
| | |
| | | |
| | | List<SysField> getTotalTableField(String tableName); |
| | | |
| | | Result getPagedDataByList(List list, Integer pageSize, Integer pageNo); |
| | | Result getPagedDataByList(List list, Integer pageNo, Integer pageSize); |
| | | |
| | | Result getTotalFields(String tableName, Integer pageNo, Integer pageSize); |
| | | } |
New file |
| | |
| | | package com.highdatas.mdm.service.impl;
|
| | |
|
| | | import com.highdatas.mdm.service.HBaseService;
|
| | | import lombok.extern.slf4j.Slf4j;
|
| | | import org.apache.commons.lang3.StringUtils;
|
| | | import org.apache.hadoop.conf.Configuration;
|
| | | import org.apache.hadoop.hbase.HColumnDescriptor;
|
| | | import org.apache.hadoop.hbase.HTableDescriptor;
|
| | | import org.apache.hadoop.hbase.TableName;
|
| | | import org.apache.hadoop.hbase.client.HBaseAdmin;
|
| | | import org.apache.hadoop.hbase.client.Result;
|
| | | import org.apache.hadoop.hbase.client.Scan;
|
| | | import org.apache.hadoop.hbase.filter.*;
|
| | | import org.apache.hadoop.hbase.util.Bytes;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.data.hadoop.hbase.HbaseTemplate;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * @author kimi
|
| | | * @description
|
| | | * @date 2020-03-31 16:03
|
| | | */
|
| | |
|
| | | @Service
|
| | | @Slf4j
|
| | | public class HBaseServiceImpl implements HBaseService {
|
| | | @Autowired
|
| | | HbaseTemplate hbaseTemplate;
|
| | |
|
| | | @Override
|
| | | public List<Result> getRowKeyAndColumn(String tableName, String startRowkey, String stopRowkey, String column, String qualifier) {
|
| | | FilterList filterList = new FilterList(FilterList.Operator.MUST_PASS_ALL);
|
| | | if (StringUtils.isNotBlank(column)) {
|
| | | log.debug("{}", column);
|
| | | filterList.addFilter(new FamilyFilter(CompareFilter.CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes(column))));
|
| | | }
|
| | | if (StringUtils.isNotBlank(qualifier)) {
|
| | | log.debug("{}", qualifier);
|
| | | filterList.addFilter(new QualifierFilter(CompareFilter.CompareOp.EQUAL, new BinaryComparator(Bytes.toBytes(qualifier))));
|
| | | }
|
| | | Scan scan = new Scan();
|
| | | if (filterList.getFilters().size() > 0) {
|
| | | scan.setFilter(filterList);
|
| | | }
|
| | | scan.setStartRow(Bytes.toBytes(startRowkey));
|
| | | scan.setStopRow(Bytes.toBytes(stopRowkey));
|
| | |
|
| | | return hbaseTemplate.find(tableName, scan, (rowMapper, rowNum) -> rowMapper);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<Result> getListRowkeyData(String tableName, List<String> rowKeys, String familyColumn, String column) {
|
| | | return rowKeys.stream().map(rk -> {
|
| | | if (StringUtils.isNotBlank(familyColumn)) {
|
| | | if (StringUtils.isNotBlank(column)) {
|
| | | return hbaseTemplate.get(tableName, rk, familyColumn, column, (rowMapper, rowNum) -> rowMapper);
|
| | | } else {
|
| | | return hbaseTemplate.get(tableName, rk, familyColumn, (rowMapper, rowNum) -> rowMapper);
|
| | | }
|
| | | }
|
| | | return hbaseTemplate.get(tableName, rk, (rowMapper, rowNum) -> rowMapper);
|
| | | }).collect(Collectors.toList());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void createTable(String tableName) {
|
| | | try {
|
| | | Configuration conf = hbaseTemplate.getConfiguration();
|
| | | //得到HBase的一个客户端
|
| | | HBaseAdmin client = new HBaseAdmin(conf);
|
| | | //创建表的描述符
|
| | | HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(tableName));
|
| | | //创建列族
|
| | | HColumnDescriptor h1 = new HColumnDescriptor("info");
|
| | | HColumnDescriptor h2 = new HColumnDescriptor("prop");
|
| | | //把列族加入表的描述符中
|
| | | htd.addFamily(h1);
|
| | | htd.addFamily(h2);
|
| | | client.createTable(htd);
|
| | | client.close();
|
| | | }
|
| | | catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | |
| | | Integer orderNo = maintainField.getOrderNo(); |
| | | int preNo = orderNo - 1; |
| | | if (preNo< 0) { |
| | | return; |
| | | MaintainField preMaintainField; |
| | | if (preNo < 0 ) { |
| | | preMaintainField = new MaintainField().setId(Constant.Default); |
| | | }else { |
| | | preMaintainField = selectOne(new EntityWrapper<MaintainField>() |
| | | .eq("table_name", maintainField.getTableName()) |
| | | .eq("order_no", preNo)); |
| | | } |
| | | MaintainField preMaintainField = selectOne(new EntityWrapper<MaintainField>() |
| | | .eq("table_name", maintainField.getTableName()) |
| | | .eq("order_no", preNo)); |
| | | |
| | | if (preMaintainField == null){ |
| | | return; |
| | | } |
| | |
| | | |
| | | for (MasterAuthor masterAuthor : masterAuthors) { |
| | | Boolean fieldAuto = masterAuthor.getFieldAuto(); |
| | | |
| | | List<MasterAuthorDetail> masterAuthorDetails = masterAuthorDetailService.selectList(new EntityWrapper<MasterAuthorDetail>().eq(Constant.PARENT_ID, masterAuthor.getId())); |
| | | |
| | | masterAuthor.setMaintainFieldId(maintainField.getId()) |
| | | .setCreateTime(new Date()) |
| | | .setUpdateTime(null) |
| | | .setId(DbUtils.getUUID()) |
| | | .insert(); |
| | | List<MasterAuthorDetail> masterAuthorDetails = masterAuthorDetailService.selectList(new EntityWrapper<MasterAuthorDetail>().eq(Constant.PARENT_ID, preMaintainField.getId())); |
| | | |
| | | for (MasterAuthorDetail masterAuthorDetail : masterAuthorDetails) { |
| | | masterAuthorDetail.setParentId(maintainField.getId()).setId(DbUtils.getUUID()).insert(); |
| | | long count = deleteList.stream().filter(sysField -> sysField.getField().equalsIgnoreCase(masterAuthorDetail.getField())).count(); |
| | | if (count > 0) { |
| | | continue; |
| | | } |
| | | masterAuthorDetail.setParentId(masterAuthor.getId()).setId(DbUtils.getUUID()).insert(); |
| | | } |
| | | |
| | | if (fieldAuto) { |
| | | for (String s : createFieldList) { |
| | | new MasterAuthorDetail().setField(s).setVal(Constant.z_AllVal).setAll(true).setParentId(maintainField.getId()).setId(DbUtils.getUUID()).insert(); |
| | | new MasterAuthorDetail().setField(s).setVal(Constant.z_AllVal).setAll(true).setParentId(masterAuthor.getId()).setId(DbUtils.getUUID()).insert(); |
| | | } |
| | | } |
| | | } |
| | |
| | | @Override |
| | | public List<SysMenu> getMenu(String userId) { |
| | | List<MasterAuthor> masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.user).eq(MasterAuthorController.character_id, userId)); |
| | | if (masterAuthors.size() == 0) { |
| | | if (masterAuthors.isEmpty()) { |
| | | //user 获取role |
| | | List<TUserRole> roles = userRoleService.selectList(new EntityWrapper<TUserRole>().eq("user_id", userId)); |
| | | List<String> roleIds = roles.stream().map(tUserRole -> tUserRole.getRoleId()).collect(Collectors.toList()); |
| | | masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.role).in(MasterAuthorController.character_id, roleIds)); |
| | | } |
| | | List<MasterAuthor> groupAuthors = getUserGroupAuthor(userId); |
| | | masterAuthors.addAll(groupAuthors); |
| | | List<String> menuIds = masterAuthors.stream().map(masterAuthor -> masterAuthor.getMenuId()).collect(Collectors.toList()); |
| | | LinkedHashSet<String> strings = new LinkedHashSet<>(menuIds); |
| | | LinkedHashSet<String> byParentId = menuService.getByParentId(strings); |
| | | List<SysMenu> sysMenus = menuService.selectBatchIds(byParentId); |
| | | return sysMenus; |
| | | } |
| | | |
| | | private List<MasterAuthor> getUserGroupAuthor(String userId) { |
| | | //TODO |
| | | List<MasterAuthor> result = new ArrayList<>(); |
| | | List<String> groupIds = new ArrayList<>(); |
| | | for (String groupId : groupIds) { |
| | | List<MasterAuthor> masterAuthors = selectList( |
| | | new EntityWrapper<MasterAuthor>() |
| | | .eq(Constant.TYPE, MasterAuthorType.user) |
| | | .eq("is_group", true) |
| | | .eq(MasterAuthorController.character_id, groupId)); |
| | | if (masterAuthors.isEmpty()) { |
| | | //TODO getRoleList; |
| | | List<String> roleIds = new ArrayList<>(); |
| | | masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq("is_group", true).eq(Constant.TYPE, MasterAuthorType.role).in(MasterAuthorController.character_id, roleIds)); |
| | | } |
| | | result.addAll(masterAuthors); |
| | | } |
| | | |
| | | return result; |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<String> roleIds = roles.stream().map(tUserRole -> tUserRole.getRoleId()).collect(Collectors.toList()); |
| | | masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.role).in(MasterAuthorController.character_id, roleIds).eq("maintain_field_id", maintainFieldId)); |
| | | } |
| | | |
| | | List<MasterAuthor> groupAuthors = getUserGroupAuthor(userId); |
| | | masterAuthors.addAll(groupAuthors); |
| | | |
| | | if (masterAuthors.isEmpty()) { |
| | | return null; |
| | | } |
| | |
| | | } |
| | | |
| | | private boolean checkUnFilterAuthor(String userId, String tableName) { |
| | | List<MasterAuthor> masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.user).eq(MasterAuthorController.character_id, userId).eq("table_name", tableName)); |
| | | List<MasterAuthor> masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.user).eq("is_group", false).eq(MasterAuthorController.character_id, userId).eq("table_name", tableName)); |
| | | long isAll = masterAuthors.stream().filter(masterAuthor -> masterAuthor.getMaintainFieldId().equalsIgnoreCase(Constant.All)).count(); |
| | | if (isAll > 0) { |
| | | return true; |
| | |
| | | List<String> roleIds = roles.stream().map(tUserRole -> tUserRole.getRoleId()).collect(Collectors.toList()); |
| | | masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq("table_name", maintain.getTableName()).eq(Constant.TYPE, MasterAuthorType.role).in(MasterAuthorController.character_id, roleIds).eq("maintain_field_id", maintainFieldId)); |
| | | } |
| | | |
| | | List<MasterAuthor> groupAuthors = getUserGroupAuthor(userId); |
| | | masterAuthors.addAll(groupAuthors); |
| | | |
| | | if (masterAuthors.isEmpty()){ |
| | | return Constant.WHERE_DEFAULTUN; |
| | | } |
| | |
| | | TUser user = (TUser) session.getAttribute(Constant.USER); |
| | | |
| | | Maintain resultMaintain = masterAuthorService.getMaxVersionMaintain(user.getUserId(), tableName); |
| | | |
| | | Maintain nowVersion = maintainService.getNowVersion(tableName); |
| | | |
| | | if (resultMaintain != null) { |
| | | Maintain nowVersion = maintainService.getNowVersion(tableName); |
| | | if (nowVersion.getOrderNo().equals(resultMaintain.getOrderNo())) { |
| | | mapping.put("maintainType", 0); |
| | | }else { |
| | |
| | | mapping.put("version", resultMaintain.getVersion()); |
| | | mapping.put("maintainId", resultMaintain.getId()); |
| | | } |
| | | |
| | | if (nowVersion != null) { |
| | | mapping.put("hasData", true); |
| | | }else { |
| | | mapping.put("hasData", false); |
| | | } |
| | | return Result.success(mapping); |
| | | |
| | | } |
| | |
| | | String menuId = assemble.getMenuId(); |
| | | MenuMapping menuMapping = menuMappingService.selectOne(new EntityWrapper<MenuMapping>().eq("menu_id", menuId)); |
| | | String tableName = menuMapping.getTableName(); |
| | | Maintain maintain = masterDataService.uploadedData(tableName, assemble.getUpdateType(), assemble.getUserId()); |
| | | SysAssembleUpdateType updateType = assemble.getUpdateType(); |
| | | boolean isBigVersion = false; |
| | | if (updateType.equals(SysAssembleUpdateType.All)) { |
| | | isBigVersion = true; |
| | | } |
| | | Maintain maintain = masterDataService.uploadedData(tableName, updateType, assemble.getUserId(),isBigVersion); |
| | | |
| | | Result result = temp2recordUpdate(assemble, maintain); |
| | | if (!result.getSuccess()) { |
New file |
| | |
| | | package com.highdatas.mdm.util;
|
| | |
|
| | | import org.springframework.beans.factory.annotation.Value;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import org.springframework.data.hadoop.hbase.HbaseTemplate;
|
| | |
|
| | | /**
|
| | | * @author kimi
|
| | | * @description
|
| | | * @date 2020-03-31 16:00
|
| | | */
|
| | |
|
| | | @Configuration
|
| | | public class HBaseConfiguration {
|
| | | @Value("${hbase.zookeeper.quorum}")
|
| | | private String zookeeperQuorum;
|
| | |
|
| | | @Value("${hbase.zookeeper.property.clientPort}")
|
| | | private String clientPort;
|
| | |
|
| | | @Value("${zookeeper.znode.parent}")
|
| | | private String znodeParent;
|
| | |
|
| | | @Bean
|
| | | public HbaseTemplate hbaseTemplate() {
|
| | | org.apache.hadoop.conf.Configuration conf = new org.apache.hadoop.conf.Configuration();
|
| | | conf.set("hbase.zookeeper.quorum", zookeeperQuorum);
|
| | | conf.set("hbase.zookeeper.property.clientPort", clientPort);
|
| | | conf.set("zookeeper.znode.parent", znodeParent);
|
| | | return new HbaseTemplate(conf);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | db-config: |
| | | column-underline: true |
| | | logging: |
| | | file: ./mdm.log |
| | | level: |
| | | com: |
| | | highdatas: |
| | |
| | | db:hbase? |
| | | |
| | | hbase: |
| | | config: |
| | | hbase.zookeeper.quorum: kimi |
| | | hbase.zookeeper.property.clientPort: 2181 |
| | | zookeeper: |
| | | quorum: kimi |
| | | property: |
| | | clientPort: 2181 |
| | | |
| | | zookeeper: |
| | | znode: |
| | | parent: /hbase |