kimi
2020-03-28 ccb933362251344091a3881a4950dcab33c5008f
no message
32个文件已修改
1052 ■■■■ 已修改文件
src/main/java/com/highdatas/mdm/controller/ActivitiController.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/controller/AssembleController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/controller/MaintainController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/controller/MaintainFieldController.java 62 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/controller/MasterAuthorController.java 104 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/controller/MasterAuthorDetailController.java 96 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/controller/MasterDataController.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/controller/MenuMappingController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/controller/SysMenuController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/entity/MasterAuthor.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/mapper/TableInfoMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/process/canvas/ProcessDiagramGenerator.java 86 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/IFlowsService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/IMaintainFieldService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/IMasterAuthorService.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/IMenuMappingService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/ISysFieldService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/ISysMenuService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/MasterDataService.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/act/RepositoryService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/act/impl/RepositoryServiceImpl.java 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/impl/MaintainFieldServiceImpl.java 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/impl/MasterAuthorServiceImpl.java 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/impl/MasterDataServiceImpl.java 130 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/impl/MenuMappingServiceImpl.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/impl/SysFieldServiceImpl.java 85 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/service/impl/SysMenuServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/util/Constant.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/util/DbUtils.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapping/TableInfoMapper.xml 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/highdatas/mdm/controller/ActivitiController.java
@@ -90,16 +90,14 @@
    }
    @RequestMapping(value = "/img/{modelId}", method = RequestMethod.GET)
    public void image(@PathVariable String modelId, HttpServletResponse response)  {
        String filePath = basePath   + modelId +"/"+ modelId + ".png";
        File file = new File(filePath);
        FileInputStream fileInputStream = null;
        InputStream is = repositoryService.getModelImg(modelId);
        response.setHeader("Content-Type", "image/png");
        try{
            fileInputStream = new FileInputStream(file);
            OutputStream outputStream = response.getOutputStream();
            byte[] b = new byte[1024];
            int len;
            while ((len = fileInputStream.read(b, 0, 1024)) != -1) {
            while ((len = is.read(b, 0, 1024)) != -1) {
                outputStream.write(b, 0, len);
            }
        }
@@ -107,9 +105,9 @@
            e.printStackTrace();
        }
        finally {
            if (fileInputStream != null) {
            if (is != null) {
                try {
                    fileInputStream.close();
                    is.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
@@ -314,6 +312,7 @@
            return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
        }
        HttpSession session = request.getSession();
        //todo 判断当前task是否是当前人能审批的
        taskService.setSession(session);
        ActivitiStatus status = flows.getStatus();
src/main/java/com/highdatas/mdm/controller/AssembleController.java
@@ -397,8 +397,6 @@
                List<SysMenu> sysMenus = menuService.selectBatchIds(byParentId);
                o.fluentPut("menuList", sysMenus);
            }
            List<SysAssembleDb> dbList = dbService.selectList(new EntityWrapper<SysAssembleDb>().eq(Constant.PARENT_ID, record.getId()));
            o.fluentPut("dbList", dbList);
src/main/java/com/highdatas/mdm/controller/MaintainController.java
@@ -47,6 +47,8 @@
    IFlowsService  flowsService;
    @Autowired
    IMaintainFieldService maintainFieldService;
    @Autowired
    IMasterAuthorService masterAuthorService;
    @RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
    public Result get(@PathVariable String id) {
@@ -106,7 +108,10 @@
            if (StringUtils.isEmpty(flowId)) {
                continue;
            }
            boolean author = masterAuthorService.checkMaintainAuthor(userId, maintain.getId());
            if (!author) {
                continue;
            }
            Flows flows = flowsService.selectById(maintain.getFlowId());
            if (flows.getStatus().equals(ActivitiStatus.close)) {
                continue;
src/main/java/com/highdatas/mdm/controller/MaintainFieldController.java
@@ -1,14 +1,18 @@
package com.highdatas.mdm.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.highdatas.mdm.entity.Maintain;
import com.highdatas.mdm.entity.MaintainField;
import com.highdatas.mdm.entity.SysField;
import com.highdatas.mdm.entity.MenuMapping;
import com.highdatas.mdm.mapper.TableInfoMapper;
import com.highdatas.mdm.pojo.CodeMsg;
import com.highdatas.mdm.pojo.Result;
import com.highdatas.mdm.service.IMaintainFieldService;
import com.highdatas.mdm.service.IMaintainService;
import com.highdatas.mdm.service.IMenuMappingService;
import com.highdatas.mdm.service.ISysFieldService;
import com.highdatas.mdm.util.Constant;
import org.apache.commons.lang3.StringUtils;
@@ -18,8 +22,11 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.text.MessageFormat;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
/**
 * <p>
@@ -40,8 +47,22 @@
    ISysFieldService fieldService;
    @Autowired
    TableInfoMapper tableInfoMapper;
    @Autowired
    IMenuMappingService menuMappingService;
    @RequestMapping(value = "/getMaintainList/{tableName}", method = RequestMethod.GET)
    @RequestMapping(value = "/getMaintainListByMenu/{menuId}", method = RequestMethod.GET)
    public Result getMaintainListByTable(@PathVariable String menuId)  {
        MenuMapping menuMapping = menuMappingService.selectOne(new EntityWrapper<MenuMapping>().eq("menu_id", menuId).orderBy("create_time"));
        if (menuMapping == null){
            return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
        }
        String tableName = menuMapping.getTableName();
        JSONArray array = maintainFieldService.getMaintainListByTable(tableName);
        return Result.success(array);
    }
    @RequestMapping(value = "/getMaintainListByTable/{tableName}", method = RequestMethod.GET)
    public Result deleteModel(@PathVariable String tableName)  {
        List<MaintainField> maintainFieldList = maintainFieldService.selectList(new EntityWrapper<MaintainField>().eq("table_name", tableName).orderBy("order_no"));
        int preOrderNo = -1;
@@ -65,20 +86,33 @@
            resultMap.put(maintainField.getId(), maintainList);
            preOrderNo = orderNo;
        }
        return Result.success(resultMap);
        Set<String> keySet = resultMap.keySet();
        JSONArray array = new JSONArray();
        for (String s : keySet) {
            List<Maintain> maintainList = resultMap.get(s);
            Maintain max = maintainList.stream().max(new Comparator<Maintain>() {
                @Override
                public int compare(Maintain o1, Maintain o2) {
                    return o1.getOrderNo() - o2.getOrderNo();
                }
            }).get();
            Maintain min = maintainList.stream().min(new Comparator<Maintain>() {
                @Override
                public int compare(Maintain o1, Maintain o2) {
                    return o1.getOrderNo() - o2.getOrderNo();
                }
            }).get();
            JSONObject object = new JSONObject();
            object.fluentPut("maintainFieldId", s);
            object.fluentPut("version", MessageFormat.format(Constant.extent, min.getVersion(), max.getVersion()));
            array.add(object);
        }
        return Result.success(array);
    }
    @RequestMapping(value = "/getFieldByMaintainFieldId/{id}", method = RequestMethod.GET)
    public Result getFieldByMaintainFieldId(@PathVariable String id)  {
        List<SysField> result;
        if (Constant.Default.equalsIgnoreCase(id)) {
            result = fieldService.getFieldByMaintainField(null);
        }
        if (Constant.All.equalsIgnoreCase(id)) {
        }
        result = fieldService.getFieldByMaintainField(id);
        return null;
    }
}
src/main/java/com/highdatas/mdm/controller/MasterAuthorController.java
@@ -1,17 +1,14 @@
package com.highdatas.mdm.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.highdatas.mdm.entity.MasterAuthor;
import com.highdatas.mdm.entity.MasterAuthorDetail;
import com.highdatas.mdm.entity.TUser;
import com.highdatas.mdm.entity.TUserRole;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.highdatas.mdm.entity.*;
import com.highdatas.mdm.pojo.CodeMsg;
import com.highdatas.mdm.pojo.MasterAuthorType;
import com.highdatas.mdm.pojo.Result;
import com.highdatas.mdm.service.IMasterAuthorDetailService;
import com.highdatas.mdm.service.IMasterAuthorService;
import com.highdatas.mdm.service.ITUserRoleService;
import com.highdatas.mdm.service.*;
import com.highdatas.mdm.util.Constant;
import com.highdatas.mdm.util.DbUtils;
import org.apache.commons.lang3.StringUtils;
@@ -19,8 +16,7 @@
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -41,12 +37,19 @@
    IMasterAuthorDetailService authorDetailService;
    @Autowired
    ITUserRoleService userRoleService;
    @Autowired
    IMenuMappingService menuMappingService;
    @Autowired
    ISysMenuService menuService;
    public static final String masterAuthorType = "masterAuthorType";
    public static final String masterId = "masterId";
    public static final String tableName = "table_name";
    public static final String characterId = "characterId";
    public static final String character_id = "character_id";
    public static final String fields = "fields";
    private String maintainFieldId = "maintainFieldId";
    private String maintain_field_id = "maintain_field_id";
    @RequestMapping(value = "/addOrUpdate", method = RequestMethod.POST)
    public Result deleteModel(@RequestBody MasterAuthor masterAuthor)  {
@@ -55,7 +58,9 @@
        }else {
            masterAuthor.setId(DbUtils.getUUID()).setCreateTime(new Date());
        }
        String menuId = masterAuthor.getMenuId();
        String tableName = menuMappingService.getTableNameByMenu(menuId);
        masterAuthor.setTableName(tableName);
        //delete pre
        boolean delete = authorDetailService.delete(new EntityWrapper<MasterAuthorDetail>().eq(Constant.PARENT_ID, masterAuthor.getId()));
        if (!delete){
@@ -72,7 +77,6 @@
        }else {
            return Result.error(CodeMsg.UPDATE_ERROR);
        }
    }
    @RequestMapping(value = "/get/{characterId}", method = RequestMethod.GET)
@@ -82,11 +86,25 @@
            return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
        }else if (type.equals(MasterAuthorType.user) && masterAuthorList.isEmpty()){
            //user 获取角色 多脚色混合
            TUser user = DbUtils.getUser(request);
            String userId = user.getUserId();
            String userId = characterId;
            List<TUserRole> tUserRoles = userRoleService.selectList(new EntityWrapper<TUserRole>().eq(Constant.USERID, userId));
            List<String> roleIdList = tUserRoles.stream().map(tUserRole -> tUserRole.getRoleId()).collect(Collectors.toList());
            return authorService.merageRoleAuthor(roleIdList);
            HashMap<String, MasterAuthor> tableMasterAuthor = authorService.merageRoleAuthor(roleIdList);
            if (tableMasterAuthor == null) {
                Result.success(null);
            }
            JSONObject object = new JSONObject();
            ArrayList<MasterAuthor> list = new ArrayList(tableMasterAuthor.values());
            object.fluentPut("type", MasterAuthorType.role);
            object.fluentPut("author",list);
            Set<String> collect = list.stream().map(masterAuthor -> masterAuthor.getMenuId()).collect(Collectors.toSet());
            LinkedHashSet<String>  menuIds= new LinkedHashSet<>(collect);
            LinkedHashSet<String> byParentId = menuService.getByParentId(menuIds);
            List<SysMenu> sysMenus = menuService.selectBatchIds(byParentId);
            object.fluentPut("audit",sysMenus);
            return Result.success(object);
        }
        for (MasterAuthor masterAuthor : masterAuthorList) {
@@ -96,7 +114,16 @@
            masterAuthor.setFields(masterAuthorDetails);
        }
        return Result.success(masterAuthorList);
        JSONObject object = new JSONObject();
        Set<String> collect = masterAuthorList.stream().map(masterAuthor -> masterAuthor.getMenuId()).collect(Collectors.toSet());
        LinkedHashSet<String>  menuIds= new LinkedHashSet<>(collect);
        LinkedHashSet<String> byParentId = menuService.getByParentId(menuIds);
        List<SysMenu> sysMenus = menuService.selectBatchIds(byParentId);
        object.fluentPut("type", MasterAuthorType.user);
        object.fluentPut("author",masterAuthorList);
        object.fluentPut("audit",sysMenus);
        return Result.success(object);
    }
    @RequestMapping(value = "/delete/{characterId}", method = RequestMethod.GET)
@@ -121,6 +148,47 @@
        }
    }
    @RequestMapping(value = "/delete/menu/{menuId}", method = RequestMethod.GET)
    public Result deleteTable(@PathVariable String menuId, @RequestParam String characterId, @RequestParam MasterAuthorType type, HttpServletRequest request){
        String maintainFieldId = request.getParameter(this.maintainFieldId);
        Wrapper<MasterAuthor> masterAuthorWrapper = 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()) {
            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();
                }
            }
        }
        if (delete) {
            return Result.success(CodeMsg.DELETE_SUCCESS);
        }else  {
            return Result.error(CodeMsg.DELETE_ERROR);
        }
    }
    @RequestMapping(value = "/addRole/{roleId}", method = RequestMethod.GET)
    public Result addRole(@PathVariable String roleId, HttpServletRequest request){
        TUser user = DbUtils.getUser(request);
@@ -129,6 +197,10 @@
        List<String> roleIdList = tUserRoles.stream().map(tUserRole -> tUserRole.getRoleId()).collect(Collectors.toList());
        roleIdList.add(roleId);
        return authorService.merageRoleAuthor(roleIdList);
        HashMap<String, MasterAuthor> tableMasterAuthor = authorService.merageRoleAuthor(roleIdList);
        if (tableMasterAuthor == null) {
            Result.success(null);
        }
        return Result.success(tableMasterAuthor.values());
    }
}
src/main/java/com/highdatas/mdm/controller/MasterAuthorDetailController.java
@@ -1,8 +1,26 @@
package com.highdatas.mdm.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.highdatas.mdm.entity.MasterAuthor;
import com.highdatas.mdm.entity.MasterAuthorDetail;
import com.highdatas.mdm.entity.SysField;
import com.highdatas.mdm.entity.TUserRole;
import com.highdatas.mdm.pojo.CodeMsg;
import com.highdatas.mdm.pojo.MasterAuthorType;
import com.highdatas.mdm.pojo.Result;
import com.highdatas.mdm.service.*;
import com.highdatas.mdm.util.Constant;
import com.highdatas.mdm.util.DbUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -15,5 +33,79 @@
@RestController
@RequestMapping("/masterAuthor/detail")
public class MasterAuthorDetailController {
    @Autowired
    IMasterAuthorService masterAuthorService;
    @Autowired
    IMasterAuthorDetailService masterAuthorDetailService;
    @Autowired
    ISysFieldService fieldService;
    @Autowired
    IMaintainFieldService maintainFieldService;
    @Autowired
    IMenuMappingService menuMappingService;
    @Autowired
    ITUserRoleService userRoleService;
    @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
    public Result addRole(@PathVariable String id,@RequestParam String field){
        MasterAuthor masterAuthor = masterAuthorService.selectById(id);
        if (masterAuthor == null) {
            return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
        }
        boolean delete = masterAuthorDetailService.delete(new EntityWrapper<MasterAuthorDetail>()
                .eq(Constant.PARENT_ID, masterAuthor.getId()).eq(Constant.FIELD, field));
        if (delete) {
            return Result.success(CodeMsg.DELETE_SUCCESS);
        }else {
            return Result.error(CodeMsg.DELETE_ERROR);
        }
    }
    @RequestMapping(value = "/getFieldByMaintainFieldId/{id}", method = RequestMethod.GET)
    public Result getFieldByMaintainFieldId(@PathVariable String id, @RequestParam MasterAuthorType type, @RequestParam String characterId, HttpServletRequest request)  {
        List<SysField> result;
        String menuId = request.getParameter("menuId");
        String tableName = menuMappingService.getTableNameByMenu(menuId);
        if (Constant.Default.equalsIgnoreCase(id)) {
            if (StringUtils.isEmpty(tableName)) {
                return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
            }
            result = fieldService.getDefaultTableField(tableName);
        }else if (Constant.All.equalsIgnoreCase(id)) {
            if (StringUtils.isEmpty(tableName)) {
                return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
            }
            result = fieldService.getTotalTableField(tableName);
        }else {
            result = fieldService.getFieldByMaintainField(id);
        }
        JSONObject resultObj = new JSONObject();
        MasterAuthor masterAuthor = masterAuthorService.selectOne(new EntityWrapper<MasterAuthor>()
                .eq(Constant.TYPE, type)
                .eq("character_id", characterId).eq("maintain_field_id", id));
        if (masterAuthor == null && type.equals(MasterAuthorType.user)) {
            List<TUserRole> tUserRoles = userRoleService.selectList(new EntityWrapper<TUserRole>().eq(Constant.USERID, characterId));
            List<String> roleIdList = tUserRoles.stream().map(tUserRole -> tUserRole.getRoleId()).collect(Collectors.toList());
            HashMap<String, MasterAuthor> tableMasterAuthor = masterAuthorService.merageRoleAuthor(roleIdList);
            String key = DbUtils.getFieldRedisKey(tableName, id);
            masterAuthor = tableMasterAuthor.get(key);
        }
        if (masterAuthor == null) {
            resultObj.fluentPut("unchecked", result);
            return  Result.success(resultObj);
        }
        List<MasterAuthorDetail> fields = masterAuthorDetailService.selectList(new EntityWrapper<MasterAuthorDetail>().eq(Constant.PARENT_ID, masterAuthor.getId()));
        if (fields != null) {
            List<String> checkedFieldStrList = fields.stream().map(masterAuthorDetail -> masterAuthorDetail.getField()).collect(Collectors.toList());
            result = result.stream().filter(sysField -> !checkedFieldStrList.contains(sysField.getField())).collect(Collectors.toList());
        }
        resultObj.fluentPut("unchecked", result);
        resultObj.fluentPut("checked", fields);
        return Result.success(resultObj);
    }
}
src/main/java/com/highdatas/mdm/controller/MasterDataController.java
@@ -20,9 +20,7 @@
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -41,7 +39,8 @@
    IMaintainService maintainService;
    @Autowired
    IMaintainDetailService maintainDetailService;
    @Autowired
    IMaintainFieldService maintainFieldService;
    @Autowired
    IMenuMappingService menuMappingService;
@@ -50,6 +49,8 @@
    @Autowired
    IMasterModifiedService masterModifiedService;
    @Autowired
    IMasterAuthorService masterAuthorService;
    @RequestMapping(value = "{tableName}/uploaded",  method = RequestMethod.GET)
    public Result get(@PathVariable String tableName, HttpServletRequest request) {
@@ -106,7 +107,7 @@
            }
            version = String.valueOf(maxVersion.getVersion());
        }
        masterAuthorService.getFilter()
        if (StringUtils.isEmpty(fields)) {
            if (StringUtils.isEmpty(pageSizeStr)) {
                return masterDataService.selectListByPageByVersion(tableName, whereSegment,pageNo,version, findMax);
@@ -130,9 +131,9 @@
            version = String.valueOf(maintainService.getNowVersion(tableName).getVersion());
        }
        if (StringUtils.isEmpty(whereSegment)) {
            return masterDataService.selectList(tableName);
            return masterDataService.selectList(tableName,Constant.WHERE_DEFAULT, version);
        }
        return masterDataService.selectList(tableName,whereSegment);
        return masterDataService.selectList(tableName,whereSegment, version);
    }
    @RequestMapping(value = "{maintainId}/modify/{operateStr}", method = RequestMethod.POST)
@@ -334,10 +335,21 @@
        }
    }
    @RequestMapping(value = "/getValByMaintainFieldId/{maintainFieldId}", method = RequestMethod.GET)
    public Result getValByMaintainFieldId(@PathVariable String maintainFieldId,@RequestParam String menuId, @RequestParam String field, HttpServletRequest request) {
        String tableName = menuMappingService.getTableNameByMenu(menuId);
        if (StringUtils.isEmpty(tableName)) {
            return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
        }
        if (maintainFieldId.equalsIgnoreCase(Constant.All)) {
            Set<String> fieldValList =  masterDataService.getFieldValByTable(tableName, field);
            return Result.success(fieldValList);
        }
        Set<String> fieldValByMaintainField = masterDataService.getFieldValByMaintainField(maintainFieldId, field, tableName);
    @RequestMapping(value = "{tableName}/getFieldVal/{field}",  method = RequestMethod.GET)
    public Result getFieldVal(@PathVariable String tableName, @PathVariable String field) {
        return masterDataService.getFieldValByTable(tableName,field);
        return Result.success(fieldValByMaintainField);
    }
}
src/main/java/com/highdatas/mdm/controller/MenuMappingController.java
@@ -56,7 +56,7 @@
    public Result<Object> update(@RequestParam String data) throws Exception {
        boolean updated =menuMappingService.update(data);
        if (updated) {
            return  Result.success("更新成功", null);
            return  Result.success(data);
        } else {
            return Result.error(CodeMsg.UPDATE_ERROR);
        }
@@ -72,4 +72,6 @@
        }
    }
}
src/main/java/com/highdatas/mdm/controller/SysMenuController.java
@@ -46,12 +46,21 @@
    IMaintainService maintainService;
    @Autowired
    IMaintainFieldService maintainFieldService;
    @Autowired
    IMasterAuthorService masterAuthorService;
    @RequestMapping(value = "/all", method = RequestMethod.GET)
    public Result<List<SysMenu>> getAll() {
        EntityWrapper<SysMenu> sysMenuEntityWrapper = new EntityWrapper<>();
        sysMenuEntityWrapper.orderBy("parent_id, order_no");
        return Result.success(menuService.selectList(sysMenuEntityWrapper)) ;
    }
    @RequestMapping(value = "/author/all", method = RequestMethod.GET)
    public Result<List<SysMenu>> getAllBak(HttpServletRequest request) {
        TUser user = DbUtils.getUser(request);
        List<SysMenu> menu = masterAuthorService.getMenu(user.getUserId());
        return Result.success(menu) ;
    }
    @RequestMapping(value = "/audit", method = RequestMethod.GET)
@@ -174,7 +183,7 @@
        menu.setMenuType(menuType);
        boolean inserted = menuService.insert(menu);
        if (inserted) {
            return  Result.success("插入成功", null);
            return  Result.success(menu);
        } else {
            return Result.error(CodeMsg.INSERT_ERROR);
        }
@@ -227,7 +236,7 @@
//            }
//        }
        return Result.success(CodeMsg.SUCCESS);
        return Result.success(menu);
    }
    @RequestMapping(value = "/update", method = RequestMethod.GET)
@@ -324,6 +333,5 @@
        List<SysMenu> sysMenus = menuService.selectList(menuEntityWrapper);
        return Result.success(sysMenus);
    }
}
src/main/java/com/highdatas/mdm/entity/MasterAuthor.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldStrategy;
import com.highdatas.mdm.pojo.MasterAuthorType;
import java.io.Serializable;
@@ -35,7 +36,10 @@
    @TableField("character_id")
    private String characterId;
    @TableField("maintain_field_id")
    @TableField("menu_id")
    private String menuId;
    @TableField(value = "maintain_field_id", strategy = FieldStrategy.IGNORED)
    private String maintainFieldId;
@@ -49,6 +53,15 @@
    private transient List<MasterAuthorDetail> fields;
    public String getMenuId() {
        return menuId;
    }
    public MasterAuthor setMenuId(String menuId) {
        this.menuId = menuId;
        return this;
    }
    public Boolean getFieldAuto() {
        return fieldAuto;
    }
src/main/java/com/highdatas/mdm/mapper/TableInfoMapper.java
@@ -65,5 +65,8 @@
    Integer insertRecordFromStandrad(@Param("tableName")String tableName, @Param("recordTableName")String recordTableName, @Param("tempFieldList")String tempFieldList);
    Map<String,String> selectActMemberShip(@Param("userId")String userId, @Param("roleId")String roleId);
    List<Map<String, Object>> getOneTempFieldDataByMaintainExtent(@Param("tableName")String tableName, @Param("tempTableName")String tempTableName,@Param("field")String field, @Param("fromOrderNo")Integer fromOrderNo, @Param("toOrderNo")Integer toOrderNo);
    List<Map<String, Object>> getTempDataByMaintainExtent(@Param("tableName")String tableName, @Param("tempTableName")String tempTableName,@Param("fromOrderNo")Integer fromOrderNo, @Param("toOrderNo")Integer toOrderNo);
}
src/main/java/com/highdatas/mdm/process/canvas/ProcessDiagramGenerator.java
@@ -212,59 +212,63 @@
            processDiagramCanvas.drawActivityMarkers((int)graphicInfo.getX(), (int)graphicInfo.getY(), (int)graphicInfo.getWidth(), (int)graphicInfo.getHeight(), multiInstanceSequential, multiInstanceParallel, collapsed);
        }
            if (highLightedActivities.contains(flowNode.getId())) {
            if (highLightedActivities != null && highLightedActivities.contains(flowNode.getId())) {
                processDiagramCanvas.drawHighLight((int)graphicInfo.getX(), (int)graphicInfo.getY(), (int)graphicInfo.getWidth(), (int)graphicInfo.getHeight());
            }
         }
         for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) {
           boolean highLighted = highLightedFlows.contains(sequenceFlow.getId());
           String defaultFlow = null;
           if (flowNode instanceof Activity)
             defaultFlow = ((Activity)flowNode).getDefaultFlow();
           else if (flowNode instanceof Gateway) {
             defaultFlow = ((Gateway)flowNode).getDefaultFlow();
           }
             boolean highLighted = false;
            if (highLightedFlows != null) {
                highLighted = highLightedFlows.contains(sequenceFlow.getId());
            }
           boolean isDefault = false;
           if ((defaultFlow != null) && (defaultFlow.equalsIgnoreCase(sequenceFlow.getId()))) {
             isDefault = true;
           }
           boolean drawConditionalIndicator = (sequenceFlow.getConditionExpression() != null) && (!(flowNode instanceof Gateway));
              String defaultFlow = null;
              if (flowNode instanceof Activity)
                defaultFlow = ((Activity)flowNode).getDefaultFlow();
              else if (flowNode instanceof Gateway) {
                defaultFlow = ((Gateway)flowNode).getDefaultFlow();
              }
           String sourceRef = sequenceFlow.getSourceRef();
           String targetRef = sequenceFlow.getTargetRef();
           FlowElement sourceElement = bpmnModel.getFlowElement(sourceRef);
           FlowElement targetElement = bpmnModel.getFlowElement(targetRef);
           List graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId());
           if ((graphicInfoList != null) && (graphicInfoList.size() > 0)) {
             graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement, targetElement, graphicInfoList);
             int[] xPoints = new int[graphicInfoList.size()];
             int[] yPoints = new int[graphicInfoList.size()];
              boolean isDefault = false;
              if ((defaultFlow != null) && (defaultFlow.equalsIgnoreCase(sequenceFlow.getId()))) {
                isDefault = true;
              }
              boolean drawConditionalIndicator = (sequenceFlow.getConditionExpression() != null) && (!(flowNode instanceof Gateway));
             for (int i = 1; i < graphicInfoList.size(); ++i) {
               GraphicInfo graphicInfo = (GraphicInfo)graphicInfoList.get(i);
               GraphicInfo previousGraphicInfo = (GraphicInfo)graphicInfoList.get(i - 1);
              String sourceRef = sequenceFlow.getSourceRef();
              String targetRef = sequenceFlow.getTargetRef();
              FlowElement sourceElement = bpmnModel.getFlowElement(sourceRef);
              FlowElement targetElement = bpmnModel.getFlowElement(targetRef);
              List graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId());
              if ((graphicInfoList != null) && (graphicInfoList.size() > 0)) {
                graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement, targetElement, graphicInfoList);
                int[] xPoints = new int[graphicInfoList.size()];
                int[] yPoints = new int[graphicInfoList.size()];
               if (i == 1) {
                 xPoints[0] = (int)previousGraphicInfo.getX();
                 yPoints[0] = (int)previousGraphicInfo.getY();
               }
               xPoints[i] = (int)graphicInfo.getX();
               yPoints[i] = (int)graphicInfo.getY();
             }
                for (int i = 1; i < graphicInfoList.size(); ++i) {
                  GraphicInfo graphicInfo = (GraphicInfo)graphicInfoList.get(i);
                  GraphicInfo previousGraphicInfo = (GraphicInfo)graphicInfoList.get(i - 1);
             processDiagramCanvas.drawSequenceflow(xPoints, yPoints, drawConditionalIndicator, isDefault, highLighted, scaleFactor);
                  if (i == 1) {
                    xPoints[0] = (int)previousGraphicInfo.getX();
                    yPoints[0] = (int)previousGraphicInfo.getY();
                  }
                  xPoints[i] = (int)graphicInfo.getX();
                  yPoints[i] = (int)graphicInfo.getY();
                }
             GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId());
             if (labelGraphicInfo != null) {
               processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false);
             }
             else {
                 GraphicInfo lineCenter = getLineCenter(graphicInfoList);
                 processDiagramCanvas.drawLabel(sequenceFlow.getName(), lineCenter, false);
            }
                processDiagramCanvas.drawSequenceflow(xPoints, yPoints, drawConditionalIndicator, isDefault, highLighted, scaleFactor);
                GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(sequenceFlow.getId());
                if (labelGraphicInfo != null) {
                  processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false);
                }
                else {
                    GraphicInfo lineCenter = getLineCenter(graphicInfoList);
                    processDiagramCanvas.drawLabel(sequenceFlow.getName(), lineCenter, false);
                }
           }
     }
src/main/java/com/highdatas/mdm/service/IFlowsService.java
@@ -17,7 +17,7 @@
    MaintainField createNowVerion(String tableName, String maintainId, String userId);
    ActivitiStatus getStatusByBusinessId(String maintainFieldId);
    ActivitiStatus getStatusByBusinessId(String businssId);
    boolean isNextAudit(Flows flows, String userId);
src/main/java/com/highdatas/mdm/service/IMaintainFieldService.java
@@ -1,9 +1,9 @@
package com.highdatas.mdm.service;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.service.IService;
import com.highdatas.mdm.entity.Maintain;
import com.highdatas.mdm.entity.MaintainField;
import com.baomidou.mybatisplus.service.IService;
import com.highdatas.mdm.entity.SysField;
import com.highdatas.mdm.pojo.ActivitiStatus;
import java.util.List;
@@ -20,7 +20,7 @@
    MaintainField getNextMaintain(String tableName, String userId);
    List<Maintain> getMaintainByMaintainField(String maintainFieldId, String tableName);
    boolean checkNowVersion(String id);
    boolean checkFirstVersion(String id);
@@ -38,4 +38,7 @@
    void dealFlow(String maintainId, ActivitiStatus status);
    int getUnFlowCount(String tableName, String userId);
    JSONArray getMaintainListByTable(String tableName);
}
src/main/java/com/highdatas/mdm/service/IMasterAuthorService.java
@@ -4,8 +4,8 @@
import com.highdatas.mdm.entity.MasterAuthor;
import com.highdatas.mdm.entity.SysField;
import com.highdatas.mdm.entity.SysMenu;
import com.highdatas.mdm.pojo.Result;
import java.util.HashMap;
import java.util.List;
/**
@@ -18,11 +18,15 @@
 */
public interface IMasterAuthorService extends IService<MasterAuthor> {
    Result merageRoleAuthor(List<String> roleIds);
    HashMap<String, MasterAuthor> merageRoleAuthor(List<String> roleIds);
    List<SysMenu> getMenu(String userId);
    List<SysField> getField(String userId);
    List<SysField> getField(String userId, String maintainFieldId, String maintainId);
    boolean checkMaintainAuthor(String userId, String maintainId);
    String getFilter(String userId, String maintainId);
}
src/main/java/com/highdatas/mdm/service/IMenuMappingService.java
@@ -2,6 +2,7 @@
import com.baomidou.mybatisplus.service.IService;
import com.highdatas.mdm.entity.MenuMapping;
import com.highdatas.mdm.entity.SysMenu;
import com.highdatas.mdm.pojo.Result;
import javax.servlet.http.HttpSession;
@@ -23,4 +24,8 @@
    boolean update(String json);
    Result getMapping(HttpSession session, String id);
    SysMenu getMenuByTableName(String tableName);
    String getTableNameByMenu(String menuId);
}
src/main/java/com/highdatas/mdm/service/ISysFieldService.java
@@ -1,6 +1,7 @@
package com.highdatas.mdm.service;
import com.baomidou.mybatisplus.service.IService;
import com.highdatas.mdm.entity.MaintainField;
import com.highdatas.mdm.entity.SysField;
import com.highdatas.mdm.pojo.Result;
@@ -19,6 +20,8 @@
    List<SysField> getFieldByMaintain(String maintainId);
    MaintainField getMaintainFieldByMaintain(String maintainId);
    List<SysField> getFieldByTable(String tableName);
src/main/java/com/highdatas/mdm/service/ISysMenuService.java
@@ -1,10 +1,9 @@
package com.highdatas.mdm.service;
import com.highdatas.mdm.entity.SysMenu;
import com.baomidou.mybatisplus.service.IService;
import com.highdatas.mdm.entity.SysMenu;
import java.util.LinkedHashSet;
import java.util.Set;
/**
 * <p>
@@ -18,4 +17,5 @@
    LinkedHashSet<String> getByParentId(LinkedHashSet<String> parentIdSet);
}
src/main/java/com/highdatas/mdm/service/MasterDataService.java
@@ -5,6 +5,8 @@
import com.highdatas.mdm.pojo.SysAssembleUpdateType;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
 * @author kimi
@@ -83,10 +85,12 @@
    Result selectListByPageByVersion(String tableName, String whereSegment, Integer pageNo, String version, boolean findMax);
    List<Map<String, Object>> selectListByVersion(String tableName, List<String> fieldList, String whereSegment, String version, boolean findMax);
    Result selectListByPageByVersion(String tableName, List<String> fieldList, String whereSegment, Integer pageNo, Integer pageSize, String version, boolean findMax);
    Maintain uploadedData(String tableName, SysAssembleUpdateType uploadType, String userId);
    Result getFieldValByTable(String tableName, String field);
    Result getFieldValByMaintainField(String maintainFieldId, String field);
    Set<String> getFieldValByTable(String tableName, String field);
    Set<String> getFieldValByMaintainField(String maintainFieldId, String field, String tableName);
}
src/main/java/com/highdatas/mdm/service/act/RepositoryService.java
@@ -8,6 +8,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
/**
@@ -31,4 +32,5 @@
    public boolean updateProcessDefStatus(String type, String modelId);
    public void getModelXml(HttpServletResponse response,String modelId) throws IOException;
    InputStream getModelImg(String modelId);
}
src/main/java/com/highdatas/mdm/service/act/impl/RepositoryServiceImpl.java
@@ -6,6 +6,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.highdatas.mdm.pojo.Result;
import com.highdatas.mdm.process.canvas.ProcessDiagramGenerator;
import com.highdatas.mdm.util.WorkflowUtils;
import lombok.extern.slf4j.Slf4j;
import org.activiti.bpmn.converter.BpmnXMLConverter;
@@ -14,6 +15,7 @@
import org.activiti.editor.constants.ModelDataJsonConstants;
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
import org.activiti.engine.ActivitiException;
import org.activiti.engine.HistoryService;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.repository.Deployment;
import org.activiti.engine.repository.Model;
@@ -32,7 +34,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.ClassUtils;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -51,6 +52,9 @@
    private static final String MODEL_DESCRIPTION = "description";
    @Autowired
    RepositoryService service;
    @Autowired
    HistoryService historyService;
    @Autowired
    ObjectMapper objectMapper;
    @Value("${img.url}")
@@ -71,7 +75,34 @@
        response.flushBuffer();
    }
    public boolean updateProcessDefStatus(String type, String modelId) {
    @Override
    public InputStream getModelImg(String modelId) {
        InputStream resource = null;
        try{
            Model model = service.createModelQuery().modelId(modelId).singleResult();
            JsonNode editorNode = new ObjectMapper().readTree(service.getModelEditorSource(model.getId()));
            BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
            BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
            ProcessDiagramGenerator diagramGenerator = new ProcessDiagramGenerator();
            resource = diagramGenerator.generateDiagram(bpmnModel, "png",null,null, "宋体","宋体" ,null, null,0);
            return resource;
        }
        catch (Exception e) {
            e.printStackTrace();
            return null;
        }
        finally {
            if (resource != null) {
                try {
                    resource.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    public boolean updateProcessDefStatus(String type, String modelId) {
        Model model = service.createModelQuery().modelId(modelId).singleResult();
        ProcessDefinition processDefinition = service.createProcessDefinitionQuery().deploymentId(model.getDeploymentId()).singleResult();
        String processDefinitionId = processDefinition.getId();
src/main/java/com/highdatas/mdm/service/impl/MaintainFieldServiceImpl.java
@@ -1,7 +1,10 @@
package com.highdatas.mdm.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.highdatas.mdm.entity.Flows;
import com.highdatas.mdm.entity.Maintain;
import com.highdatas.mdm.entity.MaintainField;
@@ -11,23 +14,16 @@
import com.highdatas.mdm.pojo.Operate;
import com.highdatas.mdm.service.IFlowsService;
import com.highdatas.mdm.service.IMaintainFieldService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.highdatas.mdm.service.IMaintainService;
import com.highdatas.mdm.service.ISysFieldService;
import com.highdatas.mdm.util.Constant;
import com.highdatas.mdm.util.DbUtils;
import org.apache.commons.lang3.StringUtils;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.text.MessageFormat;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -104,6 +100,15 @@
            nowMaintain.setId(DbUtils.getUUID());
        }
        return nowMaintain;
    }
    @Override
    public List<Maintain> getMaintainByMaintainField(String maintainFieldId, String tableName) {
        HashMap<String, List<Maintain>> resultMap = getMaintainFieldMapByTable(tableName);
        if (resultMap == null) {
            return null;
        }
        return resultMap.get(maintainFieldId);
    }
    @Override
@@ -247,4 +252,52 @@
        }
        return cnt;
    }
    @Override
    public JSONArray getMaintainListByTable(String tableName) {
        HashMap<String, List<Maintain>> resultMap = getMaintainFieldMapByTable(tableName);
        Set<String> keySet = resultMap.keySet();
        JSONArray array = new JSONArray();
        for (String s : keySet) {
            List<Maintain> list = resultMap.get(s);
            Maintain max = list.stream().max(new Comparator<Maintain>() {
                @Override
                public int compare(Maintain o1, Maintain o2) {
                    return o1.getOrderNo() - o2.getOrderNo();
                }
            }).get();
            Maintain min = list.stream().min(new Comparator<Maintain>() {
                @Override
                public int compare(Maintain o1, Maintain o2) {
                    return o1.getOrderNo() - o2.getOrderNo();
                }
            }).get();
            JSONObject object = new JSONObject();
            object.fluentPut("maintainFieldId", s);
            object.fluentPut("version", MessageFormat.format(Constant.extent, min.getVersion(), max.getVersion()));
            array.add(object);
        }
        return array;
    }
    private HashMap<String, List<Maintain>> getMaintainFieldMapByTable(String tableName) {
        List<Maintain> maintainList = maintainService.selectList(new EntityWrapper<Maintain>().eq("table_name", tableName).isNotNull("flow_id").orderBy("order_no"));
        HashMap<String, List<Maintain>> resultMap = new HashMap<>();
        for (Maintain maintain : maintainList) {
            ActivitiStatus status = flowsService.getStatusByBusinessId(maintain.getId());
            if (!status.equals(ActivitiStatus.open)) {
                continue;
            }
            MaintainField maintainFieldByMaintain = fieldService.getMaintainFieldByMaintain(maintain.getId());
            List<Maintain> list = resultMap.get(maintainFieldByMaintain.getId());
            if (list == null) {
                list = new ArrayList<>();
            }
            list.add(maintain);
            resultMap.put(maintainFieldByMaintain.getId(), list);
        }
        return resultMap;
    }
}
src/main/java/com/highdatas/mdm/service/impl/MasterAuthorServiceImpl.java
@@ -1,21 +1,21 @@
package com.highdatas.mdm.service.impl;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.highdatas.mdm.entity.MasterAuthor;
import com.highdatas.mdm.entity.MasterAuthorDetail;
import com.highdatas.mdm.entity.SysField;
import com.highdatas.mdm.entity.SysMenu;
import com.highdatas.mdm.controller.MasterAuthorController;
import com.highdatas.mdm.entity.*;
import com.highdatas.mdm.mapper.MasterAuthorMapper;
import com.highdatas.mdm.pojo.MasterAuthorType;
import com.highdatas.mdm.pojo.Result;
import com.highdatas.mdm.service.IMasterAuthorDetailService;
import com.highdatas.mdm.service.IMasterAuthorService;
import com.highdatas.mdm.service.*;
import com.highdatas.mdm.util.Constant;
import com.highdatas.mdm.util.ContentBuilder;
import com.highdatas.mdm.util.DbUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.MessageFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -32,10 +32,20 @@
    public static final String characterId = "characterId";
    @Autowired
    IMasterAuthorDetailService authorDetailService;
    @Autowired
    ITUserRoleService userRoleService;
    @Autowired
    ISysMenuService menuService;
    @Autowired
    ISysFieldService fieldService;
    @Autowired
    IMaintainFieldService maintainFieldService;
    @Autowired
    IMaintainService maintainService;
    @Override
    public Result merageRoleAuthor(List<String> roleIds) {
        List<MasterAuthor> masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.role).in(this.characterId, roleIds));
    public HashMap<String, MasterAuthor> merageRoleAuthor(List<String> roleIds) {
        List<MasterAuthor> masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.role).in(MasterAuthorController.character_id, roleIds));
        HashMap<String, MasterAuthor> resultMap = new HashMap<>();
        for (MasterAuthor masterAuthor : masterAuthors) {
@@ -52,17 +62,154 @@
                resultMap.put(key, preMerageMasterAuthor);
            }
        }
        return Result.success(resultMap.values());
        return resultMap;
    }
    @Override
    public List<SysMenu> getMenu(String userId) {
        return null;
        List<MasterAuthor> masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.user).eq(MasterAuthorController.character_id, userId));
        if (masterAuthors.size() == 0) {
            //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<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;
    }
    @Override
    public List<SysField> getField(String userId) {
        return null;
    public List<SysField> getField(String userId, String maintainFieldId, String maintainId) {
        if (maintainFieldId.equalsIgnoreCase(Constant.All)) {
            List<SysField> total = fieldService.getFieldByMaintain(maintainId);
            return total;
        }
        List<MasterAuthor> masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.user).eq(this.characterId, userId).eq("maintain_field_id", maintainFieldId));
        if (masterAuthors.size() == 0) {
            //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(this.characterId, roleIds).eq("maintain_field_id", maintainFieldId));
        }
        if (masterAuthors.isEmpty()) {
            return null;
        }
        List<String> authorIds = masterAuthors.stream().map(masterAuthor -> masterAuthor.getId()).collect(Collectors.toList());
        List<MasterAuthorDetail> masterAuthorDetails = authorDetailService.selectList(new EntityWrapper<MasterAuthorDetail>().in(Constant.PARENT_ID, authorIds));
        Set<String> codes = masterAuthorDetails.stream().map(masterAuthorDetail -> masterAuthorDetail.getField()).collect(Collectors.toSet());
        if (codes.isEmpty()) {
            return null;
        }
        Wrapper<SysField> wrapper = new EntityWrapper<SysField>().in(Constant.FIELD, codes);
        if (maintainFieldId.equalsIgnoreCase(Constant.Default)) {
            wrapper.eq("maintain_field_id", maintainFieldId);
        }else {
            wrapper.isNull("maintain_field_id");
        }
        List<SysField> fieldList = fieldService.selectList(wrapper);
        return fieldList;
    }
    @Override
    public boolean checkMaintainAuthor(String userId, String maintainId) {
        Maintain maintain = maintainService.selectById(maintainId);
        if (maintain == null) {
            return false;
        }
        int checked = selectCount(new EntityWrapper<MasterAuthor>()
                .eq(Constant.TYPE, MasterAuthorType.user)
                .eq(MasterAuthorController.character_id, userId)
                .eq("table_name", maintain.getTableName())
                .eq("maintain_field_id", Constant.All));
        if(checked > 0) {
            return true;
        }
        MaintainField maintainField = fieldService.getMaintainFieldByMaintain(maintainId);
        if (maintainField == null) {
            return false;
        }
        //get user author
        checked = selectCount(new EntityWrapper<MasterAuthor>()
                .eq(Constant.TYPE, MasterAuthorType.user)
                .eq(MasterAuthorController.character_id, userId)
                .eq("table_name", maintain.getTableName())
                .eq("maintain_field_id", maintainField.getId()));
        if (checked > 0) {
            return true;
        }
        List<TUserRole> roles = userRoleService.selectList(new EntityWrapper<TUserRole>().eq("user_id", userId));
        Set<String> collect = roles.stream().map(tUserRole -> tUserRole.getRoleId()).collect(Collectors.toSet());
        checked = selectCount(new EntityWrapper<MasterAuthor>()
                .eq(Constant.TYPE, MasterAuthorType.role)
                .in(MasterAuthorController.character_id, collect)
                .eq("table_name", maintain.getTableName())
                .eq("maintain_field_id", maintainField.getId()));
        if (checked > 0) {
            return true;
        }
        return false;
    }
    @Override
    public String getFilter(String userId, String maintainId) {
        MaintainField maintainField = fieldService.getMaintainFieldByMaintain(maintainId);
        if (maintainField)
        if (maintainFieldId.equalsIgnoreCase(Constant.All)) {
            return Constant.WHERE_DEFAULT;
        }
        List<MasterAuthor> masterAuthors = selectList(new EntityWrapper<MasterAuthor>().eq(Constant.TYPE, MasterAuthorType.user).eq(this.characterId, userId).eq("maintain_field_id", maintainFieldId));
        if (masterAuthors.size() == 0) {
            //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(this.characterId, roleIds).eq("maintain_field_id", maintainFieldId));
        }
        if (masterAuthors.isEmpty()){
            return Constant.WHERE_DEFAULTUN;
        }
        List<String> authorIds = masterAuthors.stream().map(masterAuthor -> masterAuthor.getId()).collect(Collectors.toList());
        List<MasterAuthorDetail> masterAuthorDetails = authorDetailService.selectList(new EntityWrapper<MasterAuthorDetail>().in(Constant.PARENT_ID, authorIds));
        if (masterAuthorDetails.isEmpty()) {
            return Constant.WHERE_DEFAULTUN;
        }
        HashMap<String, List<String>> segmentMap = new HashMap<>();
        HashMap<String, Boolean> segmentAllMap = new HashMap<>();
        for (MasterAuthorDetail detail : masterAuthorDetails) {
            String field = detail.getField();
            Boolean all = detail.getAll();
            if (!(segmentAllMap.containsKey(field) && segmentAllMap.get(field))) {
                segmentAllMap.put(field, all);
            }
            Boolean preAll = segmentAllMap.get(field);
            if (preAll && segmentMap.containsKey(field)) {
                segmentMap.remove(field);
            }
            String val = detail.getVal();
            List<String> split = DbUtils.split(val);
            segmentMap.put(field,split);
        }
        ContentBuilder builder = new ContentBuilder(Constant.AND);
        Set<String> keySet = segmentMap.keySet();
        for (String code : keySet) {
            List<String> vals = segmentMap.get(code);
            String val = vals.stream()
                    .filter(s -> !StringUtils.isEmpty(s))
                    .map(s -> DbUtils.quotedStr(s)).collect(Collectors.joining(Constant.COMMA));
            String format = MessageFormat.format(Constant.MYSQL_UUID, code, val);
            builder.append(format);
        }
        String filter = builder.toString();
        return filter;
    }
    private MasterAuthor merage(MasterAuthor preMerageMasterAuthor, MasterAuthor masterAuthor) {
src/main/java/com/highdatas/mdm/service/impl/MasterDataServiceImpl.java
@@ -45,6 +45,8 @@
    IFlowsService flowsService;
    @Autowired
    RedisClient redisClient;
    @Autowired
    IMaintainFieldService maintainFieldService;
    @Resource
    protected DataSource dataSource;
@@ -352,6 +354,74 @@
        return selectListByPageByVersion(tableName, null,whereSegment, pageNo, null,version, findMax);
    }
    @Override
    public List<Map<String, Object>> selectListByVersion(String tableName, List<String> fieldList, String whereSegment, String version, boolean findMax) {
        Maintain maintainFromVersion = maintainService.getMaintainFromVersion(tableName, version);
        Maintain nowVersionMaintain = maintainService.getNowVersion(tableName);
        boolean isMax = maintainService.checkdMaxVersion(maintainFromVersion.getId());
        boolean isNow = maintainService.checkNowVersion(maintainFromVersion.getId());
        boolean isFirst = maintainService.checkFirstVersion(maintainFromVersion.getId());
        Integer fromVersionOrderNo = maintainFromVersion.getOrderNo();
        Integer nowVersionOrderNo = 0;
        if (nowVersionMaintain != null) {
            nowVersionOrderNo = nowVersionMaintain.getOrderNo();
        }
        String tableTempName = tableName + Constant.RECORD;
        List<Map<String, Object>> result = null;
        String fields;
        String tempFields;
        String Hfields;
        String A1fields;
        String A2fields;
        String tempHfields;
        if (fieldList == null || fieldList.size() == 0) {
            fields = getFields(tableName, maintainFromVersion);
            Hfields = getFields(tableName,Constant.H, maintainFromVersion);
            A1fields = getFields(tableName,Constant.A1, maintainFromVersion);
            A2fields = getFields(tableName,Constant.A2, maintainFromVersion);
            tempFields = getTempFields(tableName, maintainFromVersion);
            tempHfields = getTempFields(tableName, Constant.H, maintainFromVersion);
        } else {
            fields = fieldList.stream().collect(Collectors.joining(Constant.COMMA));
            Hfields = fieldList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.H, s)).collect(Collectors.joining(Constant.COMMA));
            A1fields = fieldList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.A1, s)).collect(Collectors.joining(Constant.COMMA));
            A2fields = fieldList.stream().map(s -> MessageFormat.format(Constant.Alias,Constant.A2, s)).collect(Collectors.joining(Constant.COMMA));
            tempFields = fieldList.stream()
                    .map(s ->
                            s.equalsIgnoreCase(Constant.ID) ? MessageFormat.format("{0} as id",Constant.STD_ID): s)
                    .collect(Collectors.joining(Constant.COMMA));
            tempHfields =  fieldList.stream()
                    .map(s ->
                            s.equalsIgnoreCase(Constant.ID) ? MessageFormat.format("{0} as id",Constant.STD_ID): s)
                    .map(s -> MessageFormat.format(Constant.Alias,Constant.H,s))
                    .collect(Collectors.joining(Constant.COMMA));
        }
        if (isNow && !findMax){
            result = mapper.selectByPage(tableName, fields, whereSegment, null);
        }
        else if (isMax && findMax) {
            ContentBuilder builder = new ContentBuilder(Constant.COMMA);
            if (nowVersionMaintain == null) {
                builder.append(DbUtils.quotedStr(maintainFromVersion.getId()));
            }else {
                List<String> maintainIds = maintainService.getCompareVersionMaintains(nowVersionMaintain, maintainFromVersion);
                long con = maintainIds.stream().map(s -> builder.append(DbUtils.quotedStr(s))).count();
            }
            result = mapper.selectByPageByMaxVersion(tableName,tableTempName,fields,tempFields, Hfields, A1fields, A2fields, tempHfields, fromVersionOrderNo, nowVersionOrderNo, DbUtils.quotedStr(maintainFromVersion.getId()),  whereSegment, null);
        }else {
            result = mapper.selectByPageByVersion(tableName,tableTempName,fields,tempFields, Hfields, A1fields, A2fields, tempHfields, nowVersionOrderNo, fromVersionOrderNo, DbUtils.quotedStr(maintainFromVersion.getId()), whereSegment,  null);
        }
        return result;
    }
    @Override
    public Result selectListByPageByVersion(String tableName, List<String> fieldList, String whereSegment, Integer pageNo, Integer pageSize, String version, boolean findMax) {
@@ -910,34 +980,78 @@
    }
    @Override
    public Result getFieldValByTable(String tableName, String field) {
    public Set<String> getFieldValByTable(String tableName, String field) {
        //查缓存
        String key = DbUtils.getFieldRedisKey(tableName,field);
        String redisVal = redisClient.getRedisVal(key);
        if (!StringUtils.isEmpty(redisVal)) {
            List<String> valList = DbUtils.split(redisVal);
            if (valList != null)  {
                return Result.success(valList);
                return new HashSet<String>(valList);
            }
        }
        // 读数据库
        String tempTableName = tableName + Constant.RECORD;
        List<Map<String, Object>> maps = mapper.selectByPage(tableName, MessageFormat.format(Constant.DISTINCT, field), Constant.WHERE_DEFAULT, null);
        return null;
        List<Map<String, Object>> tempMaps = mapper.selectByPage(tempTableName, MessageFormat.format(Constant.DISTINCT, field), Constant.WHERE_DEFAULT, null);
        maps.addAll(tempMaps);
        if (maps.size() == 0) {
            return null;
        }
        Set<String> result = maps.stream()
                .filter(one -> one != null)
                .map(one -> one.get(field))
                .filter(o -> o != null)
                .map(o -> o.toString()).collect(Collectors.toSet());
        return result;
    }
    @Override
    public Result getFieldValByMaintainField(String tableName, String field) {
    public Set<String> getFieldValByMaintainField(String maintainFieldId, String field, String tableName) {
        //查缓存
        String key = DbUtils.getFieldRedisKey(tableName,field);
        MaintainField maintainField = maintainFieldService.selectById(maintainFieldId);
        String key = DbUtils.getFieldRedisKey(tableName, field);
        String redisVal = redisClient.getRedisVal(key);
        if (!StringUtils.isEmpty(redisVal)) {
            List<String> valList = DbUtils.split(redisVal);
            if (valList != null)  {
                return Result.success(valList);
                HashSet<String> strings = new HashSet<>(valList);
                return strings;
            }
        }
        // 读数据库
        return null;
        List<Maintain> list = maintainFieldService.getMaintainByMaintainField(maintainFieldId, tableName);
        Maintain max = list.stream().max(new Comparator<Maintain>() {
            @Override
            public int compare(Maintain o1, Maintain o2) {
                return o1.getOrderNo() - o2.getOrderNo();
            }
        }).get();
        Maintain min = list.stream().min(new Comparator<Maintain>() {
            @Override
            public int compare(Maintain o1, Maintain o2) {
                return o1.getOrderNo() - o2.getOrderNo();
            }
        }).get();
        ArrayList<String> fieldList = new ArrayList<>();
        fieldList.add(field);
        fieldList.add(Constant.ID);
        List<Map<String, Object>> maps = selectListByVersion(tableName, fieldList, Constant.WHERE_DEFAULT, max.getVersion(), false);
        String tempTableName = tableName + Constant.RECORD;
        List<Map<String, Object>> tempVals = mapper.getOneTempFieldDataByMaintainExtent(DbUtils.quotedStr(tableName), tempTableName, field, min.getOrderNo(), max.getOrderNo());
        maps.addAll(tempVals);
        if (maps.size() == 0) {
            return null;
        }
        Set<String> result = maps.stream()
                .filter(one -> one != null)
                .map(one -> one.get(field))
                .filter(o -> o != null)
                .map(o -> o.toString()).collect(Collectors.toSet());
        String val = result.stream().collect(Collectors.joining(Constant.SEMICOLON));
        redisClient.putRedisVal(key, val);
        return result;
    }
}
src/main/java/com/highdatas/mdm/service/impl/MenuMappingServiceImpl.java
@@ -191,9 +191,28 @@
            mapping.put("version", resultMaintain.getVersion());
            mapping.put("maintainId", resultMaintain.getId());
        }
        return Result.success(mapping);
    }
    @Override
    public SysMenu getMenuByTableName(String tableName) {
        MenuMapping menuMapping = selectOne(new EntityWrapper<MenuMapping>().eq("table_name", tableName).orderBy("create_time desc"));
        if (menuMapping == null) {
            return null;
        }
        String menuId = menuMapping.getMenuId();
        SysMenu sysMenu = menuService.selectById(menuId);
        return sysMenu;
    }
    @Override
    public String getTableNameByMenu(String menuId) {
        MenuMapping menuMapping = selectOne(new EntityWrapper<MenuMapping>().eq("menu_id", menuId).orderBy("create_time desc"));
        if (menuMapping == null) {
            return null;
        }
        return menuMapping.getTableName();
    }
}
src/main/java/com/highdatas/mdm/service/impl/SysFieldServiceImpl.java
@@ -22,10 +22,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -52,13 +49,12 @@
    TableInfoMapper tableInfoMapper;
    @Override
    public List<SysField> getFieldByMaintain(String maintainId) {
    public MaintainField getMaintainFieldByMaintainId(String maintainId) {
        MaintainField maintainField;
        List<SysField> fieldList = null;
        if (StringUtils.isEmpty(maintainId)) {
          return null;
            return null;
        }
        Maintain maintain = maintainService.selectById(maintainId);
        if (maintain == null) {
@@ -70,17 +66,28 @@
            //对应版本找不到 往前找
            String maintainFieldId = maintainFieldMapper.getMappedMatintainId(DbUtils.quotedStr(maintain.getTableName()), maintain.getOrderNo());
            if (StringUtils.isEmpty(maintainFieldId)) {
                fieldList = this.selectList(new EntityWrapper<SysField>().eq("table_name", maintain.getTableName()).isNull("maintain_field_id").orderBy("order_no"));
                return fieldList;
               return null;
            }
            maintainField = maintainFieldService.selectById(maintainFieldId);
            if (maintainField == null){
                //无对应版本
                fieldList = this.selectList(new EntityWrapper<SysField>().eq("table_name", maintain.getTableName()).isNull("maintain_field_id").orderBy("order_no"));
                return fieldList;
            }
        }
        return maintainField;
    }
    @Override
    public List<SysField> getFieldByMaintain(String maintainId) {
        List<SysField> fieldList;
        Maintain maintain = maintainService.selectById(maintainId);
        if (maintain == null) {
            return null;
        }
        MaintainField maintainField = getMaintainFieldByMaintain(maintainId);
        if (maintainField == null && Constant.Default.equalsIgnoreCase(maintainField.getId())) {
            fieldList = this.selectList(new EntityWrapper<SysField>().eq("table_name", maintain.getTableName()).isNull("maintain_field_id").orderBy("order_no"));
            return fieldList;
        }
        String maintainFieldId = maintainField.getId();
        String tableName = maintainField.getTableName();
        //TODO  判断版本
@@ -102,6 +109,53 @@
            maintainField = maintainFieldService.selectOne(new EntityWrapper<MaintainField>().eq("table_name", maintain.getTableName()).eq("order_no", preNo));
            fieldList = this.selectList(new EntityWrapper<SysField>().eq("maintain_field_id", maintainField.getId()).eq("table_name", tableName).orderBy("order_no"));
            return fieldList;
        }
    }
    @Override
    public MaintainField getMaintainFieldByMaintain(String maintainId) {
        MaintainField maintainField;
        List<SysField> fieldList = null;
        if (StringUtils.isEmpty(maintainId)) {
            return null;
        }
        Maintain maintain = maintainService.selectById(maintainId);
        if (maintain == null) {
            return null;
        }
        maintainField = maintainFieldService.selectOne(new EntityWrapper<MaintainField>().eq("maintain_id", maintainId).orderBy("order_no desc, create_time desc"));
        if (maintainField == null) {
            //对应版本找不到 往前找
            String maintainFieldId = maintainFieldMapper.getMappedMatintainId(DbUtils.quotedStr(maintain.getTableName()), maintain.getOrderNo());
            if (StringUtils.isEmpty(maintainFieldId)) {
                return new MaintainField().setId(Constant.Default);
            }
            maintainField = maintainFieldService.selectById(maintainFieldId);
            if (maintainField == null){
                return new MaintainField().setId(Constant.Default);
            }
        }
        String maintainFieldId = maintainField.getId();
        String tableName = maintainField.getTableName();
        ActivitiStatus status = flowsService.getStatusByBusinessId(maintainFieldId);
        if (status != null && status.equals(ActivitiStatus.open)) {
            return maintainFieldService.selectById(maintainField);
        }
        // 当前版本正在审批  找前一版本
        Integer maintainFieldOrderNo = maintainField.getOrderNo();
        if (maintainFieldOrderNo < 1) {
            return new MaintainField().setId(Constant.Default);
        }else {
            Integer preNo = maintainFieldOrderNo - 1;
            maintainField = maintainFieldService.selectOne(new EntityWrapper<MaintainField>().eq("table_name", maintain.getTableName()).eq("order_no", preNo));
            return maintainField;
        }
@@ -310,7 +364,8 @@
                //没有中文名称的  应该属于系统自留字段 如id
                continue;
            }
            String alias = fieldList.stream().map(SysField::getAlias).collect(Collectors.joining(Constant.SEMICOLON));
            HashSet<SysField> strings = new HashSet<SysField>(fieldList);
            String alias = strings.stream().map(SysField::getAlias).collect(Collectors.joining(Constant.SEMICOLON));
            SysField sysField = new SysField().setField(fieldName).setAlias(alias);
            result.add(sysField);
        }
src/main/java/com/highdatas/mdm/service/impl/SysMenuServiceImpl.java
@@ -1,16 +1,14 @@
package com.highdatas.mdm.service.impl;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.highdatas.mdm.entity.SysMenu;
import com.highdatas.mdm.mapper.SysMenuMapper;
import com.highdatas.mdm.service.ISysMenuService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
/**
 * <p>
@@ -49,4 +47,6 @@
        return parentIdSet;
    }
}
src/main/java/com/highdatas/mdm/util/Constant.java
@@ -9,6 +9,7 @@
    public static final String COMMA = " , ";
    public static final String COMMA_TRIM = ",";
    public static final String WHERE_DEFAULT = " 1 = 1 ";
    public static final String WHERE_DEFAULTUN = " 1 <> 1 ";
    public static final String SEGMENT_COMMON = "value = {0}";
    public static final String SEGMENT_STRING = "value = '{0}'";
    public static final String EQUAL = " = ";
@@ -45,6 +46,7 @@
    String StructureMenu = "StructureMenu";
    String tableName = "tableName";
    String Alias = "{0}.{1}";
    String extent = "{0}~{1}";
    String FieldAsAlias = "{0} AS {1}";
    String caseWhen = " case when a2.{0} != null then a2.{0} else a1.{0} end  as {0}";
    String H = "h";
@@ -104,4 +106,6 @@
    String Default = "default";
    String USERID = "user_id";
    String FIELD = "field";
    String DISTINCT = "distinct {0}";
    String InSql = "{0} in ( {1} )";
}
src/main/java/com/highdatas/mdm/util/DbUtils.java
@@ -342,4 +342,10 @@
    public static TUser getUser(HttpServletRequest request) {
        return (TUser) request.getSession().getAttribute(Constant.USER);
    }
    public static ArrayList<String> getRoleByUser(String userId) {
        ArrayList<String> roleIds = new ArrayList<>();
        roleIds.add("ROO1");
        return roleIds;
    }
}
src/main/resources/application-dev.yml
@@ -5,7 +5,7 @@
spring:
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/data_admin?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true
    url: jdbc:mysql://localhost:3306/mdm?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true
    username: root
    password: 123456
    type: com.alibaba.druid.pool.DruidDataSource
@@ -69,7 +69,7 @@
  unbigdata:
    db:
      host: localhost
      url:  jdbc:mysql://localhost:3306/data_admin?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true
      url:  jdbc:mysql://localhost:3306/mdm?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true
      type: MYSQL
      port: 3306
      schema: mdm
src/main/resources/application.yml
@@ -1,7 +1,7 @@
spring:
  profiles:
    active:
      dev
      prod
  main:
    allow-bean-definition-overriding: true
src/main/resources/mapping/TableInfoMapper.xml
@@ -494,4 +494,38 @@
    <select id="selectActMemberShip" parameterType="java.util.Map" resultType="java.util.Map">
        select * from act_id_membership where USER_ID_ = #{userId} and GROUP_ID_ = #{roleId}
    </select>
    <select id="getOneTempFieldDataByMaintainExtent" statementType="STATEMENT"   resultType="java.util.Map">
         <![CDATA[
        SELECT DISTINCT ${field} FROM  ${tempTableName} t  WHERE  EXISTS (
          SELECT pre_merge_id  FROM ( SELECT  pre_merge_id FROM  maintain_detail  WHERE EXISTS (
            SELECT  id  FROM  ( SELECT  id  FROM  `maintain`  WHERE
              table_name = ${tableName}
              AND order_no >= ${fromOrderNo}
              AND order_no <  ${toOrderNo}
              ) a
            WHERE
            a.id = maintain_detail.parent_id  )
          ) a
        WHERE t.id = a.pre_merge_id)
        ]]>
    </select>
    <select id="getTempDataByMaintainExtent" statementType="STATEMENT"   resultType="java.util.Map">
        <![CDATA[
        SELECT *  FROM  ${tempTableName} t  WHERE  EXISTS (
          SELECT pre_merge_id  FROM ( SELECT  pre_merge_id FROM  maintain_detail  WHERE EXISTS (
            SELECT  id  FROM  ( SELECT  id  FROM  `maintain`  WHERE
              table_name = ${tableName}
              AND order_no >= ${fromOrderNo}
              AND order_no <  ${toOrderNo}
              ) a
            WHERE
            a.id = maintain_detail.parent_id  )
          ) a
        WHERE t.id = a.pre_merge_id)
        ]]>
    </select>
</mapper>