Browse Source

Merge remote-tracking branch 'origin/dev_temp' into dev_temp

dev_shibei_match
wangchao 4 years ago
parent
commit
dbb05814cc
  1. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDeptController.java
  2. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java
  3. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictTypeController.java
  4. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogErrorController.java
  5. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogLoginController.java
  6. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogOperationController.java
  7. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysMenuController.java
  8. 5
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysParamsController.java
  9. 10
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRegionController.java
  10. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRoleController.java
  11. 6
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysUserController.java
  12. 95
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/log/LogConsumer.java
  13. 8
      epmet-auth/src/main/java/com/epmet/service/impl/AuthServiceImpl.java
  14. 24
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LogOperation.java
  15. 26
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java
  16. 34
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
  17. 121
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/LogOperationAspect.java
  18. 153
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java
  19. 43
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/log/producer/LogProducer.java
  20. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  21. 6
      epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActModelController.java
  22. 6
      epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActProcessController.java
  23. 4
      epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActRunningController.java
  24. 2
      epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActTaskController.java
  25. 5
      epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/demo/controller/CorrectionController.java
  26. 19
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/ScheduleJobController.java
  27. 1
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/MailTemplateController.java
  28. 48
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java
  29. 31
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/OssFactory.java
  30. 9
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java
  31. 16
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java
  32. 2
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuConfigFormDTO.java
  33. 3
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java
  34. 3
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupMemberConstant.java
  35. 55
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java
  36. 13
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java
  37. 21
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupLeaderTransferRecordServiceImpl.java
  38. 25
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java
  39. 8
      epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml
  40. 9
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java
  41. 4
      epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java
  42. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDeptController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysDeptDTO;
import com.epmet.service.SysDeptService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -56,7 +55,6 @@ public class SysDeptController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save Dept")
public Result save(@RequestBody SysDeptDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -68,7 +66,6 @@ public class SysDeptController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update Dept")
public Result update(@RequestBody SysDeptDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -80,7 +77,6 @@ public class SysDeptController {
@DeleteMapping("{id}")
@ApiOperation("删除")
@LogOperation("Delete Dept")
public Result delete(@PathVariable("id") Long id){
//效验数据
AssertUtils.isNull(id, "id");

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysDictDataDTO;
import com.epmet.service.SysDictDataService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -67,7 +66,6 @@ public class SysDictDataController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody SysDictDataDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, DefaultGroup.class);
@ -79,7 +77,6 @@ public class SysDictDataController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody SysDictDataDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -91,7 +88,6 @@ public class SysDictDataController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictTypeController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysDictTypeDTO;
import com.epmet.service.SysDictTypeService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -69,7 +68,6 @@ public class SysDictTypeController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody SysDictTypeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, DefaultGroup.class);
@ -81,7 +79,6 @@ public class SysDictTypeController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody SysDictTypeDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -93,7 +90,6 @@ public class SysDictTypeController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogErrorController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysLogErrorDTO;
import com.epmet.service.SysLogErrorService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -59,7 +58,6 @@ public class SysLogErrorController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export Log Error")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysLogErrorDTO> list = sysLogErrorService.list(params);

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogLoginController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysLogLoginDTO;
import com.epmet.service.SysLogLoginService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -60,7 +59,6 @@ public class SysLogLoginController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export Log Login")
@ApiImplicitParams({
@ApiImplicitParam(name = "status", value = "状态 0:失败 1:成功 2:账号已锁定", paramType = "query", dataType="int"),
@ApiImplicitParam(name = "creatorName", value = "用户名", paramType = "query", dataType="String")

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogOperationController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysLogOperationDTO;
import com.epmet.service.SysLogOperationService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -63,7 +62,6 @@ public class SysLogOperationController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export Log Operation")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysLogOperationDTO> list = sysLogOperationService.list(params);

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysMenuController.java

@ -12,7 +12,6 @@ import com.epmet.dto.MenuResourceDTO;
import com.epmet.dto.SysMenuDTO;
import com.epmet.service.SysMenuService;
import com.epmet.service.SysResourceService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.Result;
@ -83,7 +82,6 @@ public class SysMenuController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save Menu")
public Result save(@RequestBody SysMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, DefaultGroup.class);
@ -95,7 +93,6 @@ public class SysMenuController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update Menu")
public Result update(@RequestBody SysMenuDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, DefaultGroup.class);
@ -107,7 +104,6 @@ public class SysMenuController {
@DeleteMapping("{id}")
@ApiOperation("删除")
@LogOperation("Delete Menu")
public Result delete(@PathVariable("id") Long id){
//效验数据
AssertUtils.isNull(id, "id");

5
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysParamsController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysParamsDTO;
import com.epmet.service.SysParamsService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
@ -72,7 +71,6 @@ public class SysParamsController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save Params")
public Result save(@RequestBody SysParamsDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -84,7 +82,6 @@ public class SysParamsController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update Params")
public Result update(@RequestBody SysParamsDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -96,7 +93,6 @@ public class SysParamsController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("Delete Params")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
@ -108,7 +104,6 @@ public class SysParamsController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export Params")
@ApiImplicitParam(name = "paramCode", value = "参数编码", paramType = "query", dataType="String")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysParamsDTO> list = sysParamsService.list(params);

10
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRegionController.java

@ -11,7 +11,6 @@ package com.epmet.controller;
import com.epmet.dto.SysRegionDTO;
import com.epmet.dto.region.RegionProvince;
import com.epmet.service.SysRegionService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.Result;
@ -71,8 +70,7 @@ public class SysRegionController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody SysRegionDTO dto){
public Result save(@RequestBody SysRegionDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -83,8 +81,7 @@ public class SysRegionController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody SysRegionDTO dto){
public Result update(@RequestBody SysRegionDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -95,8 +92,7 @@ public class SysRegionController {
@DeleteMapping("{id}")
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@PathVariable("id") Long id){
public Result delete(@PathVariable("id") Long id){
//效验数据
AssertUtils.isNull(id, "id");

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRoleController.java

@ -10,7 +10,6 @@ package com.epmet.controller;
import com.epmet.dto.SysRoleDTO;
import com.epmet.service.SysRoleService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -94,7 +93,6 @@ public class SysRoleController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save Role")
public Result save(@RequestBody SysRoleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -106,7 +104,6 @@ public class SysRoleController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update Role")
public Result update(@RequestBody SysRoleDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -118,7 +115,6 @@ public class SysRoleController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("Delete Role")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");

6
epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysUserController.java

@ -13,7 +13,6 @@ import com.epmet.dto.PasswordDTO;
import com.epmet.dto.SysUserDTO;
import com.epmet.service.SysResourceService;
import com.epmet.service.SysUserService;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.page.PageData;
@ -98,7 +97,6 @@ public class SysUserController {
@PostMapping
@ApiOperation("保存")
@LogOperation("Save User")
public Result save(@RequestBody SysUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -110,7 +108,6 @@ public class SysUserController {
@PutMapping
@ApiOperation("修改")
@LogOperation("Update User")
public Result update(@RequestBody SysUserDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -122,7 +119,6 @@ public class SysUserController {
@PutMapping("password")
@ApiOperation("修改密码")
@LogOperation("Password User")
public Result password(@RequestBody PasswordDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto);
@ -141,7 +137,6 @@ public class SysUserController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("Delete User")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
@ -153,7 +148,6 @@ public class SysUserController {
@GetMapping("export")
@ApiOperation("导出")
@LogOperation("Export User")
@ApiImplicitParam(name = "username", value = "用户名", paramType = "query", dataType="String")
public void export(@ApiIgnore @RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<SysUserDTO> list = sysUserService.list(params);

95
epmet-admin/epmet-admin-server/src/main/java/com/epmet/log/LogConsumer.java

@ -1,95 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.log;
import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.log.BaseLog;
import com.epmet.commons.tools.log.enums.LogTypeEnum;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.entity.SysLogErrorEntity;
import com.epmet.entity.SysLogLoginEntity;
import com.epmet.entity.SysLogOperationEntity;
import com.epmet.service.SysLogErrorService;
import com.epmet.service.SysLogLoginService;
import com.epmet.service.SysLogOperationService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* 从Redis队列中获取Log保存到DB
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Slf4j
@Component
public class LogConsumer implements CommandLineRunner {
@Autowired
private RedisUtils redisUtils;
@Autowired
private SysLogErrorService sysLogErrorService;
@Autowired
private SysLogLoginService sysLogLoginService;
@Autowired
private SysLogOperationService sysLogOperationService;
private ScheduledExecutorService scheduledService = new ScheduledThreadPoolExecutor(1,
new BasicThreadFactory.Builder().namingPattern("log-consumer-schedule-pool-%d").daemon(true).build());
@Override
public void run(String... args) {
//上次任务结束后,等待10秒钟,再执行下次任务
scheduledService.scheduleWithFixedDelay(() -> {
try {
receiveQueue();
}catch (Exception e){
log.error("LogConsumer Error:"+ ExceptionUtils.getErrorStackTrace(e));
}
}, 1, 10, TimeUnit.SECONDS);
}
private void receiveQueue() {
String key = RedisKeys.getSysLogKey();
//每次插入100条
int count = 100;
for(int i = 0; i < count; i++){
BaseLog log = (BaseLog) redisUtils.rightPop(key);
if(log == null){
return;
}
//登录日志
if(log.getType() == LogTypeEnum.LOGIN.value()){
SysLogLoginEntity entity = ConvertUtils.sourceToTarget(log, SysLogLoginEntity.class);
sysLogLoginService.save(entity);
}
//操作日志
if(log.getType() == LogTypeEnum.OPERATION.value()){
SysLogOperationEntity entity = ConvertUtils.sourceToTarget(log, SysLogOperationEntity.class);
sysLogOperationService.save(entity);
}
//异常日志
if(log.getType() == LogTypeEnum.ERROR.value()){
SysLogErrorEntity entity = ConvertUtils.sourceToTarget(log, SysLogErrorEntity.class);
sysLogErrorService.save(entity);
}
}
}
}

8
epmet-auth/src/main/java/com/epmet/service/impl/AuthServiceImpl.java

@ -14,7 +14,6 @@ import com.epmet.commons.tools.log.SysLogLogin;
import com.epmet.commons.tools.log.enums.LogTypeEnum;
import com.epmet.commons.tools.log.enums.LoginOperationEnum;
import com.epmet.commons.tools.log.enums.LoginStatusEnum;
import com.epmet.commons.tools.log.producer.LogProducer;
import com.epmet.commons.tools.redis.UserDetailRedis;
import com.epmet.commons.tools.security.password.PasswordUtils;
import com.epmet.commons.tools.security.user.SecurityUser;
@ -49,8 +48,6 @@ public class AuthServiceImpl implements AuthService {
@Autowired
private UserDetailRedis userDetailRedis;
@Autowired
private LogProducer logProducer;
@Autowired
private JwtUtils jwtUtils;
@Autowired
private JwtProperties jwtProperties;
@ -76,7 +73,6 @@ public class AuthServiceImpl implements AuthService {
if(user == null){
log.setStatus(LoginStatusEnum.FAIL.value());
log.setCreatorName(login.getUsername());
logProducer.saveLog(log);
throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR);
}
@ -86,7 +82,6 @@ public class AuthServiceImpl implements AuthService {
log.setStatus(LoginStatusEnum.FAIL.value());
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
logProducer.saveLog(log);
throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR);
}
@ -96,7 +91,6 @@ public class AuthServiceImpl implements AuthService {
log.setStatus(LoginStatusEnum.LOCK.value());
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
logProducer.saveLog(log);
throw new RenException(ErrorCode.ACCOUNT_DISABLE);
}
@ -116,7 +110,6 @@ public class AuthServiceImpl implements AuthService {
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
log.setStatus(LoginStatusEnum.SUCCESS.value());
logProducer.saveLog(log);
return authorization;
}
@ -138,7 +131,6 @@ public class AuthServiceImpl implements AuthService {
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
log.setCreateDate(new Date());
logProducer.saveLog(log);
userDetailRedis.logout(userId);
}

24
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LogOperation.java

@ -1,24 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.annotation;
import java.lang.annotation.*;
/**
* 操作日志注解
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface LogOperation {
String value() default "";
}

26
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java

@ -7,18 +7,14 @@ import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
@ -35,19 +31,20 @@ public class NoRepeatSubmitAop {
/**
* 重复提交判断时间为2s
*/
private static final Cache<String, Object> CACHES = CacheBuilder.newBuilder()
private static final Cache<String, Integer> CACHES = CacheBuilder.newBuilder()
// 最大缓存 100 个
.maximumSize(1000)
.maximumSize(100)
// 设置写缓存后 5 秒钟过期
.expireAfterWrite(5, TimeUnit.SECONDS)
.build();
@Before("execution(public * com.epmet..*Controller.*(..))")
public void before(JoinPoint joinPoint) {
System.out.println(joinPoint.getSignature().getName());
@Pointcut("@annotation(com.epmet.commons.tools.aop.NoRepeatSubmit)")
public void doAspect() {
}
@Around("execution(public * com.epmet..*Controller.*(..)) && @annotation(com.epmet.commons.tools.aop.NoRepeatSubmit)")
public Object around(ProceedingJoinPoint pjp) {
@Before("doAspect()")
public void around(JoinPoint pjp) {
try {
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
assert attributes != null;
@ -55,9 +52,7 @@ public class NoRepeatSubmitAop {
String key = getKey(request.getRequestURI(), pjp.getArgs());
// 如果缓存中有这个url视为重复提交
if (CACHES.getIfPresent(key) == null) {
Object o = pjp.proceed();
CACHES.put(key, NumConstant.ZERO);
return o;
} else {
log.error("重复提交");
throw new RenException(EpmetErrorCode.REPEATED_SUBMIT_ERROR.getCode());
@ -68,7 +63,6 @@ public class NoRepeatSubmitAop {
log.error("验证重复提交时出现未知异常!");
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode());
}
}
private String getKey(String keyExpress, Object[] args) {
@ -79,4 +73,4 @@ public class NoRepeatSubmitAop {
}
}
}

34
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java

@ -1,5 +1,6 @@
package com.epmet.commons.tools.aspect;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.exception.*;
@ -14,6 +15,9 @@ import javax.servlet.http.HttpServletRequest;
import java.time.Duration;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
/**
* 日志切面
@ -54,6 +58,8 @@ public abstract class BaseRequestLogAspect {
// transactionSerial = UUID.randomUUID().toString();
//}
Map<String, String> requestHeaders = getRequestHeaders(request);
// 将当前线程名称设置为事务流水号
if (!StringUtils.isEmpty(transactionSerial)) {
Thread.currentThread().setName(transactionSerial);
@ -64,7 +70,8 @@ public abstract class BaseRequestLogAspect {
try {
Object[] args = point.getArgs();
ThreadLocalConstant.requestParam.set(Arrays.toString(point.getArgs()));
log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{}", transactionSerial, requestURI, method, objectsToString(args));
log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{},请求头:{}",
transactionSerial, requestURI, method, objectsToString(args), requestHeaders);
result = point.proceed();
resultInfoLog(transactionSerial, getExecPeriod(startTime), result);
} catch (RenException e) {
@ -91,6 +98,23 @@ public abstract class BaseRequestLogAspect {
return result;
}
/**
* @Description 获取请求头信息
* @return
* @author wxz
* @date 2021.03.31 13:59
*/
private Map<String, String> getRequestHeaders(HttpServletRequest request) {
Enumeration<String> headerNames = request.getHeaderNames();
HashMap<String, String> headerMap = new HashMap<>();
while (headerNames.hasMoreElements()) {
String headerName = headerNames.nextElement();
String headerValue = request.getHeader(headerName);
headerMap.put(headerName, headerValue);
}
return headerMap;
}
/**
* info日志
* @param transactionSerial
@ -225,7 +249,13 @@ public abstract class BaseRequestLogAspect {
StringBuilder builder = new StringBuilder("[");
for (Object object : args) {
if (object != null) {
builder.append(object.toString());
try {
// 尝试作为json解析
String objectString = JSON.toJSONString(object);
builder.append(objectString);
} catch (Exception e) {
builder.append(object.toString());
}
builder.append(",");
}
}

121
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/LogOperationAspect.java

@ -1,121 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.aspect;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.config.ModuleConfig;
import com.epmet.commons.tools.security.user.SecurityUser;
import com.epmet.commons.tools.log.SysLogOperation;
import com.epmet.commons.tools.log.enums.LogTypeEnum;
import com.epmet.commons.tools.log.enums.OperationStatusEnum;
import com.epmet.commons.tools.log.producer.LogProducer;
import com.epmet.commons.tools.security.user.UserDetail;
import com.epmet.commons.tools.utils.HttpContextUtils;
import com.epmet.commons.tools.utils.IpUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Date;
/**
* 操作日志切面处理类
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Aspect
@Component
public class LogOperationAspect {
@Autowired
private ModuleConfig moduleConfig;
@Autowired
private LogProducer logProducer;
@Pointcut("@annotation(com.epmet.commons.tools.annotation.LogOperation)")
public void logPointCut() {
}
@Around("logPointCut()")
public Object around(ProceedingJoinPoint point) throws Throwable {
long beginTime = System.currentTimeMillis();
try {
//执行方法
Object result = point.proceed();
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;
//保存日志
saveLog(point, time, OperationStatusEnum.SUCCESS.value());
return result;
}catch(Exception e) {
//执行时长(毫秒)
long time = System.currentTimeMillis() - beginTime;
//保存日志
saveLog(point, time, OperationStatusEnum.FAIL.value());
throw e;
}
}
private void saveLog(ProceedingJoinPoint joinPoint, long time, Integer status) {
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method method = signature.getMethod();
SysLogOperation log = new SysLogOperation();
LogOperation annotation = method.getAnnotation(LogOperation.class);
if(annotation != null){
//注解上的描述
log.setOperation(annotation.value());
}
//登录用户信息
UserDetail user = SecurityUser.getUser();
if(user != null){
log.setCreator(user.getId());
log.setCreatorName(user.getUsername());
}
log.setType(LogTypeEnum.OPERATION.value());
log.setModule(moduleConfig.getName());
log.setStatus(status);
log.setRequestTime((int)time);
log.setCreateDate(new Date());
//请求相关信息
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
log.setIp(IpUtils.getIpAddr(request));
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setRequestUri(request.getRequestURI());
log.setRequestMethod(request.getMethod());
//请求参数
Object[] args = joinPoint.getArgs();
try{
String params = JSON.toJSONString(args[0]);
log.setRequestParams(params);
}catch (Exception e){
}
//保存到Redis队列里
logProducer.saveLog(log);
}
}

153
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java

@ -1,153 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.exception;
import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.config.ModuleConfig;
import com.epmet.commons.tools.log.SysLogError;
import com.epmet.commons.tools.log.enums.LogTypeEnum;
import com.epmet.commons.tools.log.producer.LogProducer;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.HttpContextUtils;
import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.http.HttpHeaders;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.Map;
/**
* 异常处理器
* 暂停使用,改用BaseRequestLogAspect
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
//@RestControllerAdvice
public class RenExceptionHandler {
private static final Logger logger = LoggerFactory.getLogger(RenExceptionHandler.class);
@Autowired
private ModuleConfig moduleConfig;
@Autowired
private LogProducer logProducer;
@Autowired
private LoginUserUtil loginUserUtil;
/**
* 处理自定义异常
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(RenException.class)
public Result handleRRException(RenException ex){
if (ex.getCode() > 8000) {
Result result=new Result().error(ex.getCode());
result.setData(ex.getInternalMsg());
return result;
}
logger.error(ExceptionUtils.getErrorStackTrace(ex));
Result result=new Result().error();
result.setData(ex.getInternalMsg());
return result;
// return new Result().error();
}
/**
* 处理自定义异常
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(ValidateException.class)
public Result handleVException(ValidateException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
Result result=new Result();
result.setCode(ex.getCode());
result.setMsg(ex.getMsg());
return result;
// return new Result().error();
}
/**
* 运行时异常拦截
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(RuntimeException.class)
public Result handleRuntimeException(RuntimeException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
Result result=new Result().error();
result.setData(ex.getMessage());
return result;
// return new Result().error();
}
/**
* 处理自定义异常
* "code": 10002,
* "msg": "数据库中已存在该记录",
*/
@ExceptionHandler(DuplicateKeyException.class)
public Result handleDuplicateKeyException(DuplicateKeyException ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
return new Result().error(ErrorCode.DB_RECORD_EXISTS);
}
/**
* 异常
* "code": 8000,
* "msg": "服务器开小差了...",
*/
@ExceptionHandler(Exception.class)
public Result handleException(Exception ex){
logger.error(ExceptionUtils.getErrorStackTrace(ex));
// saveLog(ex);
Result result=new Result().error();
result.setData(ex.getMessage());
return result;
// return new Result().error();
}
/**
* 保存异常日志
*/
private void saveLog(Exception ex){
SysLogError log = new SysLogError();
log.setType(LogTypeEnum.ERROR.value());
log.setModule(moduleConfig.getName());
//请求相关信息
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
log.setUserAgent(request.getHeader(HttpHeaders.USER_AGENT));
log.setRequestUri(request.getRequestURI());
log.setRequestMethod(request.getMethod());
log.setIp(IpUtils.getIpAddr(request));
Map<String, String> params = HttpContextUtils.getParameterMap(request);
if(MapUtil.isNotEmpty(params)){
log.setRequestParams(JSON.toJSONString(params));
}
//登录用户ID
log.setCreator(loginUserUtil.getLoginUserId());
//异常信息
log.setErrorInfo(ExceptionUtils.getErrorStackTrace(ex));
//保存到Redis队列里
log.setCreateDate(new Date());
logProducer.saveLog(log);
}
}

43
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/log/producer/LogProducer.java

@ -1,43 +0,0 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* https://www.renren.io
*
* 版权所有侵权必究
*/
package com.epmet.commons.tools.log.producer;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.epmet.commons.tools.log.BaseLog;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.*;
/**
* 日志通过redis队列异步保存到数据库
*
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@Component
public class LogProducer {
@Autowired
private RedisUtils redisUtils;
ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("log-producer-pool-%d").build();
ExecutorService pool = new ThreadPoolExecutor(5, 200, 0L,TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<>(1024), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
/**
* 保存Log到Redis消息队列
*/
public void saveLog(BaseLog log){
String key = RedisKeys.getSysLogKey();
//异步保存到队列
pool.execute(() -> redisUtils.leftPush(key, log, RedisUtils.NOT_EXPIRE));
}
}

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -43,13 +43,6 @@ public class RedisKeys {
return rootPrefix.concat("sys:security:user:").concat(String.valueOf(id));
}
/**
* 系统日志Key
*/
public static String getSysLogKey() {
return rootPrefix.concat("sys:log");
}
/**
* 系统资源Key
*/

6
epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActModelController.java

@ -8,7 +8,6 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -55,7 +54,6 @@ public class ActModelController {
@PostMapping
@ApiOperation("新增模型")
@LogOperation("新增模型")
public Result save(@RequestBody ModelDTO dto) throws Exception{
//效验数据
ValidatorUtils.validateEntity(dto);
@ -67,7 +65,6 @@ public class ActModelController {
@PostMapping("deploy/{id}")
@ApiOperation("部署")
@LogOperation("部署")
public Result deploy(@PathVariable("id") String id) {
actModelService.deploy(id);
return new Result();
@ -75,14 +72,12 @@ public class ActModelController {
@GetMapping("export/{id}")
@ApiOperation("导出")
@LogOperation("导出")
public void export(@PathVariable("id") String id, @ApiIgnore HttpServletResponse response) {
actModelService.export(id, response);
}
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody String[] ids) {
for(String id : ids) {
actModelService.delete(id);
@ -92,7 +87,6 @@ public class ActModelController {
@GetMapping("image/{deploymentId}")
@ApiOperation(value = "查看流程图", produces="application/octet-stream")
@LogOperation("查看流程图")
public void viewDeployImage(@PathVariable("deploymentId") String deploymentId, @ApiIgnore HttpServletResponse response){
actModelService.deployImage(deploymentId, response);
}

6
epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActProcessController.java

@ -8,7 +8,6 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.page.PageData;
@ -82,7 +81,6 @@ public class ActProcessController {
@PostMapping("deploy")
@ApiOperation("部署流程文件")
@LogOperation("部署流程文件")
@ApiImplicitParam(name = "processFile", value = "流程文件", paramType = "query", dataType="file")
public Result deploy(@RequestParam("processFile") MultipartFile file) throws IOException {
if (file.isEmpty()) {
@ -95,7 +93,6 @@ public class ActProcessController {
}
@PutMapping("active/{id}")
@LogOperation("激活流程")
public Result active(@PathVariable("id") String id) {
actProcessService.active(id);
@ -104,7 +101,6 @@ public class ActProcessController {
@PutMapping("suspend/{id}")
@ApiOperation("挂起流程")
@LogOperation("挂起流程")
public Result suspend(@PathVariable("id") String id) {
actProcessService.suspend(id);
@ -113,7 +109,6 @@ public class ActProcessController {
@PostMapping("convertToModel/{id}")
@ApiOperation("将部署的流程转换为模型")
@LogOperation("将部署的流程转换为模型")
public Result convertToModel(@PathVariable("id") String id) throws Exception {
actProcessService.convertToModel(id);
@ -122,7 +117,6 @@ public class ActProcessController {
@DeleteMapping
@ApiOperation("删除流程")
@LogOperation("删除流程")
public Result delete(@RequestBody String[] deploymentIds) {
for(String deploymentId : deploymentIds) {
actProcessService.deleteDeployment(deploymentId);

4
epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActRunningController.java

@ -8,7 +8,6 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -53,7 +52,6 @@ public class ActRunningController {
@DeleteMapping("{id}")
@ApiOperation("删除")
@LogOperation("删除")
@ApiImplicitParam(name = "id", value = "ID", paramType = "query", dataType="String")
public Result deleteInstance(@PathVariable("id") String id) {
actRunningService.delete(id);
@ -62,7 +60,6 @@ public class ActRunningController {
@PostMapping("start")
@ApiOperation("启动流程实例,依据流程定义KEY,启动流程实例")
@LogOperation("启动流程实例,依据流程定义KEY,启动流程实例")
@ApiImplicitParam(name = "key", value = "流程定义标识key", paramType = "query", dataType="String")
public Result<ProcessInstanceDTO> start(String key){
ProcessInstanceDTO dto = actRunningService.startProcess(key);
@ -71,7 +68,6 @@ public class ActRunningController {
@PostMapping("startOfBusinessKey")
@ApiOperation("启动流程实例,依据流程定义ID和业务唯一标示启动实例")
@LogOperation("启动流程实例,依据流程定义ID和业务唯一标示启动实例")
public Result<ProcessInstanceDTO> startOfBusinessKey(@RequestBody ProcessStartDTO processStartDTO){
ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO);
return new Result().ok(dto);

2
epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActTaskController.java

@ -1,6 +1,5 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.ErrorCode;
import com.epmet.commons.tools.page.PageData;
@ -82,7 +81,6 @@ public class ActTaskController {
*/
@GetMapping("task/{id}")
@ApiOperation("获取任务详情")
@LogOperation("获取任务详情")
public Result getTaskById(@PathVariable("id") String id){
TaskDTO task = actTaskService.taskDetail(id);
return new Result().ok(task);

5
epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/demo/controller/CorrectionController.java

@ -1,6 +1,5 @@
package com.epmet.demo.controller;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -59,7 +58,6 @@ public class CorrectionController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody CorrectionDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
@ -72,7 +70,6 @@ public class CorrectionController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody CorrectionDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
@ -84,7 +81,6 @@ public class CorrectionController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody Long[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
@ -96,7 +92,6 @@ public class CorrectionController {
@PostMapping("updateInstanceId")
@ApiOperation("更新实例ID")
@LogOperation("更新实例ID")
@ApiImplicitParams({
@ApiImplicitParam(name = "businessKey", value = "业务KEY", paramType = "query", required = true, dataType="String"),
@ApiImplicitParam(name = "processInstanceId", value = "实例ID", paramType = "query",required = true, dataType="String")

19
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/ScheduleJobController.java

@ -8,7 +8,6 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
@ -66,8 +65,7 @@ public class ScheduleJobController {
@PostMapping
@ApiOperation("保存")
@LogOperation("保存")
public Result save(@RequestBody ScheduleJobDTO dto){
public Result save(@RequestBody ScheduleJobDTO dto){
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
scheduleJobService.save(dto);
@ -77,8 +75,7 @@ public class ScheduleJobController {
@PutMapping
@ApiOperation("修改")
@LogOperation("修改")
public Result update(@RequestBody ScheduleJobDTO dto){
public Result update(@RequestBody ScheduleJobDTO dto){
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
scheduleJobService.update(dto);
@ -88,8 +85,7 @@ public class ScheduleJobController {
@DeleteMapping
@ApiOperation("删除")
@LogOperation("删除")
public Result delete(@RequestBody Long[] ids){
public Result delete(@RequestBody Long[] ids){
scheduleJobService.deleteBatch(ids);
return new Result();
@ -97,8 +93,7 @@ public class ScheduleJobController {
@PutMapping("/run")
@ApiOperation("立即执行")
@LogOperation("立即执行")
public Result run(@RequestBody Long[] ids){
public Result run(@RequestBody Long[] ids){
scheduleJobService.run(ids);
return new Result();
@ -106,8 +101,7 @@ public class ScheduleJobController {
@PutMapping("/pause")
@ApiOperation("暂停")
@LogOperation("暂停")
public Result pause(@RequestBody Long[] ids){
public Result pause(@RequestBody Long[] ids){
scheduleJobService.pause(ids);
return new Result();
@ -115,8 +109,7 @@ public class ScheduleJobController {
@PutMapping("/resume")
@ApiOperation("恢复")
@LogOperation("恢复")
public Result resume(@RequestBody Long[] ids){
public Result resume(@RequestBody Long[] ids){
scheduleJobService.resume(ids);
return new Result();

1
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/MailTemplateController.java

@ -9,7 +9,6 @@
package com.epmet.controller;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.annotation.LogOperation;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.page.PageData;

48
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java

@ -26,16 +26,47 @@ import java.io.InputStream;
*/
public class AliyunCloudStorageService extends AbstractCloudStorageService {
private OSSClient internalClient = null;
private OSSClient externalClient = null;
{
}
public AliyunCloudStorageService(CloudStorageConfig config){
this.config = config;
}
/**
* @Description 根据隐私类型获取属性传递internal的时候会返回内部的否则返回外部的即公开的
* @Description 根据隐私类型获取属性获取client
* @return
* @author wxz
* @date 2021.01.04 13:49
*/
public OSSClient getOssClient(String privacyType) {
if (PrivacyType.INTERNAL.equalsIgnoreCase(privacyType)) {
if (internalClient == null){
CloudStorageConfig.AliyunCloudStorageConfigProps props = config.getAliyun().getInternal();
internalClient = new OSSClient(props.getAliyunEndPoint(), props.getAliyunAccessKeyId(),
props.getAliyunAccessKeySecret());
}
return internalClient;
} else {
if (externalClient == null) {
CloudStorageConfig.AliyunCloudStorageConfigProps props = config.getAliyun().getExternal();
externalClient = new OSSClient(props.getAliyunEndPoint(), props.getAliyunAccessKeyId(),
props.getAliyunAccessKeySecret());
}
return externalClient;
}
}
/**
* @Description 根据隐私类型获取属性传递internal的时候会返回内部的否则返回外部的即公开的
* @return
* @author wxz
* @date 2021.01.04 13:49
*/
public CloudStorageConfig.AliyunCloudStorageConfigProps getPropsByprivacyType(String privacyType) {
if (PrivacyType.INTERNAL.equalsIgnoreCase(privacyType)) {
return config.getAliyun().getInternal();
@ -69,11 +100,10 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService {
@Override
public String upload(InputStream inputStream, String path, String privacyType) {
CloudStorageConfig.AliyunCloudStorageConfigProps props = getPropsByprivacyType(privacyType);
OSSClient client = new OSSClient(props.getAliyunEndPoint(), props.getAliyunAccessKeyId(),
props.getAliyunAccessKeySecret());
OSSClient client = getOssClient(privacyType);
try {
client.putObject(props.getAliyunBucketName(), path, inputStream);
client.shutdown();
//client.shutdown();
} catch (Exception e){
throw new RenException(ModuleErrorCode.OSS_UPLOAD_FILE_ERROR, e, "");
}
@ -84,11 +114,10 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService {
@Override
public boolean delete(String objectName,String privacyType) {
CloudStorageConfig.AliyunCloudStorageConfigProps props = getPropsByprivacyType(privacyType);
OSSClient client = new OSSClient(props.getAliyunEndPoint(), props.getAliyunAccessKeyId(),
props.getAliyunAccessKeySecret());
OSSClient client = getOssClient(privacyType);
try {
client.deleteObject(props.getAliyunBucketName(), objectName);
client.shutdown();
//client.shutdown();
} catch (Exception e){
return false;
}
@ -111,8 +140,7 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService {
@Override
public void down(String privacyType) throws IOException {
CloudStorageConfig.AliyunCloudStorageConfigProps props = getPropsByprivacyType(privacyType);
OSSClient client = new OSSClient(props.getAliyunEndPoint(), props.getAliyunAccessKeyId(),
props.getAliyunAccessKeySecret());
OSSClient client = getOssClient(privacyType);
try {
/*
@ -150,7 +178,7 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService {
downloadRes.getObjectMetadata();
// 关闭OSSClient。
client.shutdown();
//client.shutdown();
} catch (Exception e){
throw new RenException(ModuleErrorCode.OSS_UPLOAD_FILE_ERROR, e, "");
} catch (Throwable throwable) {

31
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/OssFactory.java

@ -20,28 +20,29 @@ import com.epmet.utils.ModuleConstant;
*/
public final class OssFactory {
private static ParamsRemoteService paramsRemoteService;
private static AbstractCloudStorageService abstractCloudStorageService;
static {
OssFactory.paramsRemoteService = SpringContextUtils.getBean(ParamsRemoteService.class);
}
public static AbstractCloudStorageService build(){
//获取云存储配置信息
CloudStorageConfig config = paramsRemoteService.getValueObject(ModuleConstant.CLOUD_STORAGE_CONFIG_KEY, CloudStorageConfig.class);
if(config.getType() == OssTypeEnum.QINIU.value()){
return new QiniuCloudStorageService(config);
}else if(config.getType() == OssTypeEnum.ALIYUN.value()){
return new AliyunCloudStorageService(config);
}else if(config.getType() == OssTypeEnum.QCLOUD.value()){
return new QcloudCloudStorageService(config);
}else if(config.getType() == OssTypeEnum.FASTDFS.value()){
return new FastDFSCloudStorageService(config);
}else if(config.getType() == OssTypeEnum.LOCAL.value()){
return new LocalCloudStorageService(config);
if (abstractCloudStorageService == null){
//获取云存储配置信息
CloudStorageConfig config = paramsRemoteService.getValueObject(ModuleConstant.CLOUD_STORAGE_CONFIG_KEY, CloudStorageConfig.class);
if(config.getType() == OssTypeEnum.QINIU.value()){
abstractCloudStorageService = new QiniuCloudStorageService(config);
}else if(config.getType() == OssTypeEnum.ALIYUN.value()){
abstractCloudStorageService = new AliyunCloudStorageService(config);
}else if(config.getType() == OssTypeEnum.QCLOUD.value()){
abstractCloudStorageService = new QcloudCloudStorageService(config);
}else if(config.getType() == OssTypeEnum.FASTDFS.value()){
abstractCloudStorageService = new FastDFSCloudStorageService(config);
}else if(config.getType() == OssTypeEnum.LOCAL.value()){
abstractCloudStorageService = new LocalCloudStorageService(config);
}
}
return null;
return abstractCloudStorageService;
}
}

9
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java

@ -232,24 +232,24 @@ public class OssController {
throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getCode()
, EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getMsg());
}
long size = file.getSize();
if (ModuleConstant.FILE_CONTENT_TYPE_PDF.equals(file.getContentType())) {
// 校验文件体积,不超过5m
// 校验文件大小,不超过5m
long maxSize = 5 * 1024 * 1024;
long size = file.getSize();
if (size > maxSize) {
throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode()
, EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg());
}
} else {
// 校验文件体积,不超过2m
// 校验文件大小,不超过2m
long maxSize = 2 * 1024 * 1024;
long size = file.getSize();
if (size > maxSize) {
throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode()
, EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg());
}
}
Result<UploadImgResultDTO> result = ossService.uploadImg(file, null);
long start = System.currentTimeMillis();
if (result != null && result.success() ){
UploadImgResultDTO data = result.getData();
if ( data!= null && StringUtils.isNotBlank(data.getUrl())){
@ -261,6 +261,7 @@ public class OssController {
redisUtils.set(RedisKeys.getOssFileKey(fileName),path,RedisUtils.MINUTE_THIRTY_EXPIRE);
}
}
log.info("service setRedis:{}",System.currentTimeMillis()-start);
return result;
}

16
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java

@ -69,13 +69,17 @@ public class OssServiceImpl extends BaseServiceImpl<OssDao, OssEntity> implement
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
String url = null;
String ossDomain = null;
long start = System.currentTimeMillis();
try {
AbstractCloudStorageService storageService = OssFactory.build();
logger.info("build service:{}",System.currentTimeMillis()-start);
start = System.currentTimeMillis();
url = storageService.uploadSuffix(file.getBytes(), extension, privacy);
logger.info("service uploadSuffix:{}",System.currentTimeMillis()-start);
ossDomain = storageService.getOssDomain(privacy);
} catch (IOException e) {
e.printStackTrace();
logger.error("图片上传异常");
logger.error("图片上传异常", e);
throw new RenException("图片上传异常");
}
@ -83,7 +87,9 @@ public class OssServiceImpl extends BaseServiceImpl<OssDao, OssEntity> implement
OssEntity ossEntity = new OssEntity();
ossEntity.setUrl(url);
start = System.currentTimeMillis();
baseDao.insert(ossEntity);
logger.info("service insert:{}",System.currentTimeMillis()-start);
//文件信息
UploadImgResultDTO dto = new UploadImgResultDTO();
dto.setUrl(url);
@ -134,8 +140,7 @@ public class OssServiceImpl extends BaseServiceImpl<OssDao, OssEntity> implement
try {
url = OssFactory.build().uploadSuffix(file.getBytes(), extension, PrivacyType.INTERNAL);
} catch (IOException e) {
e.printStackTrace();
logger.error("文件上传异常");
logger.error("文件上传异常", e);
throw new RenException("文件上传异常");
}
//保存文件信息
@ -165,8 +170,7 @@ public class OssServiceImpl extends BaseServiceImpl<OssDao, OssEntity> implement
try {
url = OssFactory.build().uploadSuffix(file.getBytes(), extension, null);
} catch (IOException e) {
e.printStackTrace();
logger.error("语音上传异常");
logger.error("语音上传异常", e);
throw new RenException("语音上传异常");
}

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

@ -21,7 +21,7 @@ public class MenuConfigFormDTO implements Serializable {
/**
* 客户id 列表
* 列表为空则所有客户都不配置这个菜单了
*/
@NotBlank(message = "客户id 列表不能为空")
private List<String> customerIds;
}

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

@ -106,9 +106,8 @@ public class GovCustomerMenuServiceImpl extends BaseServiceImpl<GovCustomerMenuD
@Override
public void saveCustomerMenu(MenuConfigFormDTO formDTO) {
baseDao.deleteBatchTableIds(formDTO.getTableId());
if (NumConstant.ZERO < formDTO.getCustomerIds().size()) {
baseDao.deleteBatchTableIds(formDTO.getTableId());
List<GovCustomerMenuEntity> entities = new ArrayList<>();
for (String customerId : formDTO.getCustomerIds()) {
GovCustomerMenuEntity entity = new GovCustomerMenuEntity();

3
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupMemberConstant.java

@ -13,7 +13,8 @@ public interface GroupMemberConstant {
/**
* 删除组成员时对应话题操作日志表设置默认的屏蔽理由
*/
String DELETE_MEMBER_REASON = "删除组成员,屏蔽该成员话题";
String DELETE_MEMBER_REASON = "删除组员,屏蔽他的话题及评论";
String SLIENT_SUCCESS = "禁言成功";
}

55
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java

@ -1,14 +1,19 @@
package com.epmet.modules.group.service.impl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.Constant;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.security.dto.GovTokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.LoginUserDetailsFormDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.dto.form.UserRoleFormDTO;
import com.epmet.dto.result.UserRoleResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovIssueOpenFeignClient;
import com.epmet.modules.constant.GroupMemberConstant;
import com.epmet.modules.group.dao.ResiGroupDao;
import com.epmet.modules.group.dao.ResiGroupStatisticalDao;
import com.epmet.modules.group.entity.ResiGroupEntity;
import com.epmet.modules.group.entity.ResiGroupStatisticalEntity;
import com.epmet.modules.group.redis.ResiGroupRedis;
import com.epmet.modules.group.service.ExitGroupService;
@ -20,6 +25,7 @@ import com.epmet.modules.topic.dao.ResiTopicCommentDao;
import com.epmet.modules.topic.dao.ResiTopicDao;
import com.epmet.modules.topic.entity.ResiTopicOperationEntity;
import com.epmet.modules.topic.service.ResiTopicOperationService;
import com.epmet.resi.group.constant.TopicConstant;
import com.epmet.resi.group.dto.group.form.ExitGroupFormDTO;
import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO;
import lombok.extern.slf4j.Slf4j;
@ -60,6 +66,8 @@ public class ExitGroupServiceImpl implements ExitGroupService {
private ResiGroupStatisticalDao resiGroupStatisticalDao;
@Autowired
private ResiGroupRedis resiGroupRedis;
@Autowired
private ResiGroupDao resiGroupDao;
/**
* @param formDTO
@ -69,6 +77,11 @@ public class ExitGroupServiceImpl implements ExitGroupService {
@Override
@Transactional(rollbackFor = Exception.class)
public void removeMember(ExitGroupFormDTO formDTO) {
//0.组长自己不能删除自己
if(formDTO.getUserId().equals(formDTO.getOperateUserId())){
throw new RenException("群组长不能删除自己");
}
//1.校验被删除人员是否是当前小组内成员
int num = resiGroupMemberDao.checkUserInGroup(formDTO.getUserId(), formDTO.getGroupId());
if (num < NumConstant.ONE) {
@ -77,7 +90,7 @@ public class ExitGroupServiceImpl implements ExitGroupService {
//2.判断是否屏蔽本小组内历史话题
List<String> delIdList = new ArrayList<>();
if ("yes".equals(formDTO.getShieldFlag())) {
if (Constant.YES.equals(formDTO.getShieldFlag())) {
//2-1.查询当前被删除人员发表过的话题还未成为议题的并且只是谈论中的数据
List<String> topicIdList = resiTopicDao.selectIdList(formDTO.getGroupId(), formDTO.getUserId());
//2-2.查询当前未成为议题的话题但是提交了转议题申请的话题
@ -94,19 +107,24 @@ public class ExitGroupServiceImpl implements ExitGroupService {
resiTopicDao.upTopicList(delIdList, formDTO.getOperateUserId());
//2-4.话题操作日志表批量新增记录
List<ResiTopicOperationEntity> list = new ArrayList<>();
ResiTopicOperationEntity entity = new ResiTopicOperationEntity();
entity.setOperationType("hidden");
entity.setOperationReason("组员删除,话题屏蔽");
delIdList.forEach(d->{
ResiTopicOperationEntity entity = new ResiTopicOperationEntity();
entity.setOperationType(TopicConstant.HIDDEN);
entity.setOperationReason(GroupMemberConstant.DELETE_MEMBER_REASON);
entity.setTopicId(d);
list.add(entity);
});
resiTopicOperationService.insertBatch(list);
}
}
//去重
if(delIdList.size()>NumConstant.ZERO){
delIdList = delIdList.stream().distinct().collect(Collectors.toList());
}
int count = delIdList.size();
//3.判断是否屏蔽本小组内历史评论
if ("yes".equals(formDTO.getShieldFlag())) {
if (Constant.YES.equals(formDTO.getShieldFlag())) {
//3-1.查询别人的话题但自己评论过的话题Id
List<String> commetTopicList = resiTopicCommentDao.selectTopicIds(formDTO.getGroupId(), formDTO.getUserId());
delIdList.addAll(commetTopicList);
@ -135,34 +153,37 @@ public class ExitGroupServiceImpl implements ExitGroupService {
entity.setGroupId(formDTO.getGroupId());
entity.setMemberUserId(formDTO.getUserId());
entity.setShieldFlag(formDTO.getShieldFlag());
entity.setLeaveType("0");
entity.setLeaveType(NumConstant.ZERO_STR);
if (exitGroupRecordDao.insert(entity) < NumConstant.ONE) {
throw new RenException(String.format("新增退群记录表数据操作失败,小组Id【%s】被修改人Id【%s】", formDTO.getGroupId(), formDTO.getUserId()));
}
//5.群组统计表修改数据
//5-1.获取被删人员居民端角色信息
LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO();
dto.setApp("resi");
dto.setClient("wxmp");
//5-1.获取被删人员当前网格居民端角色信息
ResiGroupEntity groupEntity = resiGroupDao.selectById(formDTO.getGroupId());
UserRoleFormDTO dto = new UserRoleFormDTO();
dto.setApp(AppClientConstant.APP_RESI);
dto.setUserId(formDTO.getUserId());
Result<LoginUserDetailsResultDTO> resultUser = epmetUserOpenFeignClient.getLoginUserDetails(dto);
dto.setCustomerId(formDTO.getCustomerId());
dto.setGridId(groupEntity.getGridId());
Result<List<UserRoleResultDTO>> resultUser = epmetUserOpenFeignClient.getUserRoleInfo(dto);
if (!resultUser.success()) {
throw new RenException(resultUser.getInternalMsg());
}
List<GovTokenDto.Role> roleList = resultUser.getData().getRoleList();
List<UserRoleResultDTO> roleList = resultUser.getData();
//5-2.群组统计表数据修改,缓存数据修改
ResiGroupStatisticalEntity statisticalEntity = resiGroupStatisticalDao.selectByResiGroupId(formDTO.getGroupId());
if (null == statisticalEntity) {
throw new RenException("未查询到群组统计数据,删除失败");
}
statisticalEntity.setTotalMembers(statisticalEntity.getTotalMembers() - 1);
statisticalEntity.setTotalTopics(statisticalEntity.getTotalTopics()-count);
statisticalEntity.setTotalNormalMemebers(statisticalEntity.getTotalNormalMemebers() - 1);
roleList.forEach(r -> {
if ("partymember".equals(r)) {//党员总数减一
if (EpmetRoleKeyConstant.PARTYMEMBER.equals(r.getRoleKey())) {//党员总数减一
statisticalEntity.setTotalPartyMembers(statisticalEntity.getTotalPartyMembers() - 1);
}
if ("warmhearted".equals(r)) {//热心居民总数减一
if (EpmetRoleKeyConstant.WARMHEARTED.equals(r.getRoleKey())) {//热心居民总数减一
statisticalEntity.setTotalEarnestMemebers(statisticalEntity.getTotalEarnestMemebers() - 1);
}
});

13
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java

@ -21,7 +21,6 @@ package com.epmet.modules.member.redis;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
@ -204,4 +203,16 @@ public class ResiGroupMemberRedis {
return null;
}
/**
* @return void
* @param groupId
* @param userId
* @author yinzuomei
* @description 删除某个小组成员的缓存信息
* @Date 2021/3/31 10:08
**/
public void deleteMemberCatche(String groupId, String userId) {
String key=ResiGroupRedisKeys.getResiGroupMemberInfoKey(groupId,userId);
redisUtils.delete(key);
}
}

21
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupLeaderTransferRecordServiceImpl.java

@ -31,6 +31,7 @@ import com.epmet.modules.constant.UserMessageConstant;
import com.epmet.modules.group.service.ResiGroupService;
import com.epmet.modules.member.dao.GroupLeaderTransferRecordDao;
import com.epmet.modules.member.entity.GroupLeaderTransferRecordEntity;
import com.epmet.modules.member.redis.ResiGroupMemberRedis;
import com.epmet.modules.member.service.GroupLeaderTransferRecordService;
import com.epmet.modules.member.service.ResiGroupMemberService;
import com.epmet.modules.utils.ModuleConstant;
@ -65,6 +66,8 @@ public class GroupLeaderTransferRecordServiceImpl extends BaseServiceImpl<GroupL
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired
private ResiGroupService resiGroupService;
@Autowired
private ResiGroupMemberRedis resiGroupMemberRedis;
@Override
public PageData<GroupLeaderTransferRecordDTO> page(Map<String, Object> params) {
@ -161,6 +164,24 @@ public class GroupLeaderTransferRecordServiceImpl extends BaseServiceImpl<GroupL
insert(entity);
//发送站内信
saveUserMessage(formDTO,originalLeader.getCustomerUserId());
//新组长、原组长成员缓存更新
this.updateGroupMemberInfo(originalLeader.getCustomerUserId(),formDTO.getNewLeaderUserId(),formDTO.getGroupId());
}
/**
* @return void
* @param originalLeaderUserId
* @param newLeaderUserId
* @param groupId
* @author yinzuomei
* @description 先删缓存后查没有会查数据库同时放进缓存
* @Date 2021/3/31 10:09
**/
private void updateGroupMemberInfo(String originalLeaderUserId, String newLeaderUserId, String groupId) {
resiGroupMemberRedis.deleteMemberCatche(groupId,originalLeaderUserId);
resiGroupMemberRedis.deleteMemberCatche(groupId,newLeaderUserId);
resiGroupMemberRedis.get(groupId,originalLeaderUserId);
resiGroupMemberRedis.get(groupId,newLeaderUserId);
}
private void saveUserMessage(ConfirmTransferFormDTO formDTO,String originalLeaderUserId) {

25
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -931,20 +931,17 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
private Result verifyLeader(ResiTopicEntity topic,String userId){
if(null != topic){
ResiGroupMemberDTO leaderVerify = resiGroupMemberDao.selectLeaderMember(topic.getGroupId());
if(null != leaderVerify){
//1.2判断是否是组长
if(!StringUtils.equals(leaderVerify.getCustomerUserId(),userId)){
//非组长,无权限进行操作
logger.error(ModuleConstant.NO_TEAMLEADER_AUTH);
throw new RenException(ModuleConstant.NO_TEAMLEADER_AUTH);
}else{
//是组长
return new Result();
}
}else{
//未找到当前用户的成员信息
logger.error(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
throw new RenException(ModuleConstant.NOT_BELONG_TO_CURRENT_GROUP);
if (null == leaderVerify) {
throw new RenException(String.format("没有找到该组组长,groupId=%s", topic.getGroupId()));
}
//1.2判断是否是组长
if (!StringUtils.equals(leaderVerify.getCustomerUserId(), userId)) {
//非组长,无权限进行操作
logger.error(ModuleConstant.NO_TEAMLEADER_AUTH);
throw new RenException(ModuleConstant.NO_TEAMLEADER_AUTH);
} else {
//是组长
return new Result();
}
}else{
//未能识别该话题基本信息

8
epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml

@ -155,7 +155,10 @@
FROM
resi_group rg
LEFT JOIN resi_group_statistical rgs ON ( rg.id = rgs.RESI_GROUP_ID )
LEFT JOIN resi_group_member rgm ON ( rg.id = rgm.RESI_GROUP_ID AND rgm.CUSTOMER_USER_ID =#{userId})
LEFT JOIN resi_group_member rgm
ON ( rg.id = rgm.RESI_GROUP_ID
AND rgm.DEL_FLAG='0'
AND rgm.CUSTOMER_USER_ID =#{userId})
WHERE
rg.DEL_FLAG = '0'
AND rgs.DEL_FLAG = '0'
@ -188,10 +191,9 @@
rg.*
FROM
resi_group rg
LEFT JOIN resi_group_member rgm ON ( rg.id = rgm.RESI_GROUP_ID )
LEFT JOIN resi_group_member rgm ON ( rg.id = rgm.RESI_GROUP_ID AND rgm.DEL_FLAG = '0')
WHERE
rg.DEL_FLAG = '0'
AND rgm.DEL_FLAG = '0'
AND rgm.GROUP_LEADER_FLAG = 'leader'
AND rgm.CUSTOMER_USER_ID = #{userId}
AND rg.GROUP_NAME = #{groupName}

9
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java

@ -496,4 +496,13 @@ public interface EpmetUserOpenFeignClient {
**/
@GetMapping(value = "/epmetuser/govstaffrole/querycustomergovrolelist/{customerId}")
Result<List<RoleInfoResultDTO>> queryCustomerGovRoleList(@PathVariable("customerId")String customerId);
/**
* @return UserRoleResultDTO
* @Description 根据用户Id来源app客户Id查询用户角色
* @Param userRoleFormDTO
* @Author sun
**/
@PostMapping(value = "/epmetuser/userrole/getuserroleinfo")
Result<List<UserRoleResultDTO>> getUserRoleInfo(@RequestBody UserRoleFormDTO userRoleFormDTO);
}

4
epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java

@ -354,4 +354,8 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initGovStaffRolesForCustomer", customerId);
}
@Override
public Result<List<UserRoleResultDTO>> getUserRoleInfo(UserRoleFormDTO userRoleFormDTO) {
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfo", userRoleFormDTO);
}
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java

@ -383,11 +383,10 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
result.setGender(StringUtils.isNotBlank(userMsg.getGender()) ? userMsg.getGender() : "");
//end
}else{
logger.error("com.epmet.service.impl.UserBaseInfoServiceImpl.extUserInfo,查询不到用户信息,用户Id:{}",param.getUserId());
return result;
logger.warn("com.epmet.service.impl.UserBaseInfoServiceImpl.extUserInfo,user_base_info查询不到用户信息,用户Id:{}",param.getUserId());
}
if(null == currentGrid || StringUtils.isBlank(currentGrid.getGridId())){
logger.error("com.epmet.service.impl.UserBaseInfoServiceImpl.extUserInfo,查询不到用户最近访问的网格,用户Id:{}",param.getUserId());
logger.error("com.epmet.service.impl.UserBaseInfoServiceImpl.extUserInfo,grid_latest查询不到用户最近访问的网格,用户Id:{}",param.getUserId());
return result;
}
result.setCustomerId(currentGrid.getCustomerId());
@ -407,9 +406,9 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl<UserBaseInfoDao, Us
Result<ExtUserInfoResultDTO> govOrgResult =
govOrgOpenFeignClient.userInfoExt(result);
if(govOrgResult.success() && null != govOrgResult.getData()){
return govOrgResult.getData();}
if (govOrgResult.success() && null != govOrgResult.getData()) {
return govOrgResult.getData();
}
return result;
}
}

Loading…
Cancel
Save