Browse Source

Merge branch 'dev-customerfunction' into dev

master
sunyuchao 4 years ago
parent
commit
ab8fae2921
  1. 1
      epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java
  2. 81
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovCustomerMenuDTO.java
  3. 27
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuConfigFormDTO.java
  4. 22
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuFormDTO.java
  5. 130
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovCustomerMenuController.java
  6. 55
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovCustomerMenuDao.java
  7. 9
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java
  8. 51
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovCustomerMenuEntity.java
  9. 62
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/GovCustomerMenuExcel.java
  10. 47
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java
  11. 126
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovCustomerMenuService.java
  12. 132
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java
  13. 43
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java
  14. 12
      epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.5__gov_customer_menu.sql
  15. 29
      epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovCustomerMenuDao.xml
  16. 14
      epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml
  17. 10
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomerFunctionFormDTO.java
  18. 1
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java
  19. 1
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java
  20. 1
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java
  21. 7
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml

1
epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java

@ -106,6 +106,7 @@ public class GovWebServiceImpl implements GovWebService {
logger.info("app:" + formDTO.getApp() + ";client:" + formDTO.getClient() + ";userId:" + userId + ";生成token[" + token + "]");
int expire = jwtTokenProperties.getExpire();
TokenDto tokenDto = new TokenDto();
tokenDto.setCustomerId(formDTO.getCustomerId());
tokenDto.setApp(formDTO.getApp());
tokenDto.setClient(formDTO.getClient());
tokenDto.setUserId(userId);

81
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovCustomerMenuDTO.java

@ -0,0 +1,81 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Data
public class GovCustomerMenuDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* gov_menu表主键
*/
private String tableId;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

27
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuConfigFormDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* 菜单配置 - 一菜单 客户
*/
@Data
public class MenuConfigFormDTO implements Serializable {
private static final long serialVersionUID = -2898130727929596798L;
/**
* gov_menu表主键
*/
@NotBlank(message = "菜单ID不能为空")
private String tableId;
/**
* 客户id 列表
*/
@NotBlank(message = "客户id 列表不能为空")
private List<String> customerIds;
}

22
epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuFormDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
/**
* 菜单基础入参
*/
@Data
public class MenuFormDTO implements Serializable {
private static final long serialVersionUID = -2898130727929596798L;
/**
* gov_menu表主键
*/
@NotBlank(message = "菜单ID不能为空")
private String tableId;
}

130
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovCustomerMenuController.java

@ -0,0 +1,130 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.controller;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.GovCustomerMenuDTO;
import com.epmet.dto.form.MenuConfigFormDTO;
import com.epmet.dto.form.MenuFormDTO;
import com.epmet.excel.GovCustomerMenuExcel;
import com.epmet.service.GovCustomerMenuService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@RestController
@RequestMapping("govcustomermenu")
public class GovCustomerMenuController {
@Autowired
private GovCustomerMenuService govCustomerMenuService;
@GetMapping("page")
public Result<PageData<GovCustomerMenuDTO>> page(@RequestParam Map<String, Object> params){
PageData<GovCustomerMenuDTO> page = govCustomerMenuService.page(params);
return new Result<PageData<GovCustomerMenuDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<GovCustomerMenuDTO> get(@PathVariable("id") String id){
GovCustomerMenuDTO data = govCustomerMenuService.get(id);
return new Result<GovCustomerMenuDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody GovCustomerMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
govCustomerMenuService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody GovCustomerMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
govCustomerMenuService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
govCustomerMenuService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<GovCustomerMenuDTO> list = govCustomerMenuService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, GovCustomerMenuExcel.class);
}
/**
* 给每个客户 配置可见菜单
* 先删除后新增
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
* @Author zhangyong
* @Date 14:15 2021-03-16
**/
@PostMapping("addcustomermenu")
public Result addCustomerMenu(@RequestBody MenuConfigFormDTO formDTO) {
//效验数据
if (StringUtils.isBlank(formDTO.getTableId())) {
throw new RenException("菜单ID不能为空");
}
govCustomerMenuService.saveCustomerMenu(formDTO);
return new Result();
}
/**
* 根据gov_menu表主键查询拥有这项菜单的所有客户(customerIds)
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result<java.util.List<java.lang.String>>
* @Author zhangyong
* @Date 16:26 2021-03-16
**/
@PostMapping("getcustomerids")
public Result<List<String>> getcustomerids(@RequestBody MenuFormDTO formDTO){
List<String> data = govCustomerMenuService.getcustomerIds(formDTO.getTableId());
return new Result<List<String>>().ok(data);
}
}

55
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovCustomerMenuDao.java

@ -0,0 +1,55 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.GovCustomerMenuEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Mapper
public interface GovCustomerMenuDao extends BaseDao<GovCustomerMenuEntity> {
/**
* 根据gov_menu表主键先清除之前配置的客户信息
*
* @param tableId
* @return void
* @Author zhangyong
* @Date 14:24 2021-03-16
**/
void deleteBatchTableIds(@Param("tableId") String tableId);
/**
* 根据gov_menu表主键查询拥有这项菜单的所有客户(customerIds)
*
* @param tableId
* @return java.util.List<java.lang.String>
* @Author zhangyong
* @Date 16:29 2021-03-16
**/
List<String> selectListcustomerIds(@Param("tableId") String tableId);
}

9
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java

@ -49,4 +49,13 @@ public interface GovMenuDao extends BaseDao<GovMenuEntity> {
* @param pid 父菜单ID
*/
List<GovMenuEntity> getListPid(String pid);
/**
* 查询客户菜单列表
*
* @param customerId 客户id
* @param type 菜单类型
* @param language 语言
*/
List<GovMenuEntity> getCustomerMenuList(@Param("customerId") String customerId, @Param("type") Integer type, @Param("language") String language);
}

51
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovCustomerMenuEntity.java

@ -0,0 +1,51 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("gov_customer_menu")
public class GovCustomerMenuEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* gov_menu表主键
*/
private String tableId;
}

62
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/GovCustomerMenuExcel.java

@ -0,0 +1,62 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.util.Date;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Data
public class GovCustomerMenuExcel {
@Excel(name = "主键ID")
private String id;
@Excel(name = "客户ID")
private String customerId;
@Excel(name = "gov_menu表主键")
private String tableId;
@Excel(name = "删除标识 0未删除、1已删除")
private String delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
@Excel(name = "更新时间")
private Date updatedTime;
}

47
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java

@ -0,0 +1,47 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.redis;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Component
public class GovCustomerMenuRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

126
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovCustomerMenuService.java

@ -0,0 +1,126 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.GovCustomerMenuDTO;
import com.epmet.dto.form.MenuConfigFormDTO;
import com.epmet.entity.GovCustomerMenuEntity;
import java.util.List;
import java.util.Map;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
public interface GovCustomerMenuService extends BaseService<GovCustomerMenuEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<GovCustomerMenuDTO>
* @author generator
* @date 2021-03-16
*/
PageData<GovCustomerMenuDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<GovCustomerMenuDTO>
* @author generator
* @date 2021-03-16
*/
List<GovCustomerMenuDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return GovCustomerMenuDTO
* @author generator
* @date 2021-03-16
*/
GovCustomerMenuDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-03-16
*/
void save(GovCustomerMenuDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-03-16
*/
void update(GovCustomerMenuDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-03-16
*/
void delete(String[] ids);
/**
* 给每个客户 配置可见菜单
*
* @param formDTO
* @return void
* @Author zhangyong
* @Date 14:16 2021-03-16
**/
void saveCustomerMenu(MenuConfigFormDTO formDTO);
/**
* 根据gov_menu表主键查询拥有这项菜单的所有客户(customerIds)
*
* @param tableId
* @return java.util.List<java.lang.String>
* @Author zhangyong
* @Date 16:29 2021-03-16
**/
List<String> getcustomerIds(String tableId);
/**
* 根据gov_menu表主键先清除之前配置的客户信息
*
* @param tableId
* @return void
* @Author zhangyong
* @Date 14:24 2021-03-16
**/
void deleteBatchTableIds(String tableId);
}

132
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java

@ -0,0 +1,132 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.dao.GovCustomerMenuDao;
import com.epmet.dto.GovCustomerMenuDTO;
import com.epmet.dto.form.MenuConfigFormDTO;
import com.epmet.entity.GovCustomerMenuEntity;
import com.epmet.redis.GovCustomerMenuRedis;
import com.epmet.service.GovCustomerMenuService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 客户菜单配置表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-03-16
*/
@Service
public class GovCustomerMenuServiceImpl extends BaseServiceImpl<GovCustomerMenuDao, GovCustomerMenuEntity> implements GovCustomerMenuService {
@Autowired
private GovCustomerMenuRedis govCustomerMenuRedis;
@Override
public PageData<GovCustomerMenuDTO> page(Map<String, Object> params) {
IPage<GovCustomerMenuEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, GovCustomerMenuDTO.class);
}
@Override
public List<GovCustomerMenuDTO> list(Map<String, Object> params) {
List<GovCustomerMenuEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, GovCustomerMenuDTO.class);
}
private QueryWrapper<GovCustomerMenuEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<GovCustomerMenuEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public GovCustomerMenuDTO get(String id) {
GovCustomerMenuEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, GovCustomerMenuDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(GovCustomerMenuDTO dto) {
GovCustomerMenuEntity entity = ConvertUtils.sourceToTarget(dto, GovCustomerMenuEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(GovCustomerMenuDTO dto) {
GovCustomerMenuEntity entity = ConvertUtils.sourceToTarget(dto, GovCustomerMenuEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public void saveCustomerMenu(MenuConfigFormDTO formDTO) {
if (NumConstant.ZERO < formDTO.getCustomerIds().size()) {
baseDao.deleteBatchTableIds(formDTO.getTableId());
List<GovCustomerMenuEntity> entities = new ArrayList<>();
for (String customerId : formDTO.getCustomerIds()) {
GovCustomerMenuEntity entity = new GovCustomerMenuEntity();
entity.setCustomerId(customerId);
entity.setTableId(formDTO.getTableId());
entities.add(entity);
}
insertBatch(entities);
}
}
@Override
public List<String> getcustomerIds(String tableId) {
return baseDao.selectListcustomerIds(tableId);
}
@Override
public void deleteBatchTableIds(String tableId) {
baseDao.deleteBatchTableIds(tableId);
}
}

43
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java

@ -35,10 +35,7 @@ import com.epmet.entity.GovMenuEntity;
import com.epmet.enums.MenuTypeEnum;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.redis.GovMenuRedis;
import com.epmet.service.GovLanguageService;
import com.epmet.service.GovMenuService;
import com.epmet.service.GovResourceService;
import com.epmet.service.GovRoleMenuService;
import com.epmet.service.*;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -67,6 +64,8 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
private GovResourceService govResourceService;
@Autowired
private GovLanguageService govLanguageService;
@Autowired
private GovCustomerMenuService govCustomerMenuService;
@Override
public PageData<GovMenuDTO> page(Map<String, Object> params) {
@ -154,6 +153,9 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
//清空当前用户,菜单导航、权限标识
govMenuRedis.delete(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient());
// 逻辑删除 epmet_gov_access 表中的关联数据
govCustomerMenuService.deleteBatchTableIds(id);
}
@Override
@ -185,14 +187,30 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
@Override
public List<GovMenuDTO> getUserMenuNavList(TokenDto tokenDto) {
List<GovMenuDTO> menuList = govMenuRedis.getUserMenuNavList(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient());
if(menuList == null){
menuList = getUserMenuList(tokenDto, MenuTypeEnum.MENU.value());
govMenuRedis.setUserMenuNavList(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient(), menuList);
}
// List<GovMenuDTO> menuList = govMenuRedis.getUserMenuNavList(tokenDto.getCustomerId(), tokenDto.getApp(), tokenDto.getClient());
// if(menuList == null){
// menuList = getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value());
//
// govMenuRedis.setUserMenuNavList(tokenDto.getCustomerId(), tokenDto.getApp(), tokenDto.getClient(), menuList);
// }
// PC端 每个客户的菜单信息,不放入缓存,每次登陆重新查询。
// 或者 你可以选择,在给每个客户 配置可见菜单的时候, 在saveCustomerMenu方法中,增加更新缓存的逻辑
return getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value());
}
return menuList;
/**
* 获取客户配置的 菜单信息
*
* @param customerId
* @param type
* @return java.util.List<com.epmet.dto.GovMenuDTO>
* @Author zhangyong
* @Date 15:51 2021-03-16
**/
private List<GovMenuDTO> getCustomerMenuList(String customerId, Integer type) {
List<GovMenuEntity> menuList = baseDao.getCustomerMenuList(customerId, type, HttpContextUtils.getLanguage());
List<GovMenuDTO> dtoList = ConvertUtils.sourceToTarget(menuList, GovMenuDTO.class);
return TreeUtils.buildTree(dtoList);
}
@Override
@ -243,5 +261,4 @@ public class GovMenuServiceImpl extends BaseServiceImpl<GovMenuDao, GovMenuEntit
private void saveLanguage(String tableId, String fieldName, String fieldValue){
govLanguageService.saveOrUpdate("gov_menu", tableId, fieldName, fieldValue, HttpContextUtils.getLanguage());
}
}
}

12
epmet-module/gov-access/gov-access-server/src/main/resources/db/migration/V0.0.5__gov_customer_menu.sql

@ -0,0 +1,12 @@
CREATE TABLE `gov_customer_menu` (
`ID` varchar(32) NOT NULL COMMENT '主键ID',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID',
`TABLE_ID` varchar(32) NOT NULL COMMENT 'gov_menu表主键',
`DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除、1已删除',
`REVISION` int(11) DEFAULT '0' COMMENT '乐观锁',
`CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人',
`CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人',
`UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户菜单配置表';

29
epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovCustomerMenuDao.xml

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.GovCustomerMenuDao">
<resultMap type="com.epmet.entity.GovCustomerMenuEntity" id="govCustomerMenuMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="tableId" column="TABLE_ID"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<update id="deleteBatchTableIds">
UPDATE gov_customer_menu SET DEL_FLAG = '1'
WHERE DEL_FLAG = '0'
AND TABLE_ID = #{tableId, jdbcType=VARCHAR}
</update>
<select id="selectListcustomerIds" resultType="String">
SELECT CUSTOMER_ID customerId
FROM gov_customer_menu
WHERE del_flag = 0 AND TABLE_ID = #{tableId, jdbcType=VARCHAR}
</select>
</mapper>

14
epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml

@ -39,4 +39,18 @@
select * from gov_menu where del_flag = 0 and pid = #{value}
</select>
<select id="getCustomerMenuList" resultType="com.epmet.entity.GovMenuEntity">
select t1.*, (select lang.field_value from gov_language lang where lang.table_name='gov_menu' and lang.field_name='name'
and lang.table_id=t1.id and lang.language=#{language}) as name
from gov_menu t1
RIGHT JOIN gov_customer_menu m ON t1.id = m.TABLE_ID
where t1.del_flag = 0 AND m.del_flag = 0
<if test="type != null">
and t1.type = #{type}
</if>
<if test="customerId != null">
and m.CUSTOMER_ID = #{customerId}
</if>
order by t1.sort asc
</select>
</mapper>

10
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomerFunctionFormDTO.java

@ -50,4 +50,14 @@ public class UpdateCustomerFunctionFormDTO implements Serializable {
private String iconSmallImg;
private String userId;
/**
* 外链地址
*/
private String targetLink;
/**
* 自定义业务域名(可设置多个 用分号分隔)
*/
private String domainName;
}

1
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java

@ -143,7 +143,6 @@ public class CustomerFunctionDetailController {
/**
* 客户定制功能修改 入参
* 目前允许修改功能名称大小图标
*
* @param tokenDto
* @param formDTO

1
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java

@ -73,6 +73,7 @@ public interface CustomerFunctionDetailDao extends BaseDao<CustomerFunctionDetai
/**
* 客户定制功能修改 入参
* 目前允许修改功能名称大小图标
* 2021-03-12 追加修改范围业务域名外链地址
*
* @param formDTO
* @Author zhangyong

1
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionDetailService.java

@ -120,6 +120,7 @@ public interface CustomerFunctionDetailService extends BaseService<CustomerFunct
/**
* 客户定制功能修改 入参
* 目前允许修改功能名称大小图标
* 2021-03-12 追加修改范围业务域名外链地址
*
* @param formDTO
* @return com.epmet.commons.tools.utils.Result

7
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFunctionDetailDao.xml

@ -145,6 +145,13 @@
<if test="iconSmallImg != null and iconSmallImg.trim() != ''">
ICON_SMALL_IMG = #{iconSmallImg},
</if>
<if test="domainName != null and domainName.trim() != ''">
DOMAIN_NAME = #{domainName},
</if>
<if test="targetLink != null and targetLink.trim() != ''">
TARGET_LINK = #{targetLink},
</if>
UPDATED_BY = #{userId},
UPDATED_TIME = now()
WHERE

Loading…
Cancel
Save