diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDeptController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDeptController.java index 62374c4bb9..49f4889c29 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDeptController.java +++ b/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"); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java index c136a05cde..005c205f46 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictDataController.java +++ b/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"); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictTypeController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictTypeController.java index 9d54f1e138..f6289329ab 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysDictTypeController.java +++ b/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"); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogErrorController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogErrorController.java index e6260f7fd4..a000b0bebd 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogErrorController.java +++ b/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 params, HttpServletResponse response) throws Exception { List list = sysLogErrorService.list(params); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogLoginController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogLoginController.java index 6df2a4ca9b..e503be46c2 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogLoginController.java +++ b/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") diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogOperationController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogOperationController.java index 85ec7cd34f..429375ffb4 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysLogOperationController.java +++ b/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 params, HttpServletResponse response) throws Exception { List list = sysLogOperationService.list(params); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysMenuController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysMenuController.java index 90c1ca5d63..2b60b0b25c 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysMenuController.java +++ b/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"); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysParamsController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysParamsController.java index 0185e12b0e..419d168392 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysParamsController.java +++ b/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 params, HttpServletResponse response) throws Exception { List list = sysParamsService.list(params); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRegionController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRegionController.java index c3bc399a57..b61c522004 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRegionController.java +++ b/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"); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRoleController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRoleController.java index 67be9b29c9..6093e3ec4e 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysRoleController.java +++ b/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"); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysUserController.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysUserController.java index 6618195db8..a7f9fb9eef 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/controller/SysUserController.java +++ b/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 params, HttpServletResponse response) throws Exception { List list = sysUserService.list(params); diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/log/LogConsumer.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/log/LogConsumer.java deleted file mode 100644 index 67f6f8d051..0000000000 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/log/LogConsumer.java +++ /dev/null @@ -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); - } - } - } - -} diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/AuthServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/AuthServiceImpl.java index d8bdd0548a..67ef6c0e90 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/AuthServiceImpl.java +++ b/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); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java index bf0689b2b7..8575a8e244 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java +++ b/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); diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index ebf5ab9146..d6921d0b8f 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -484,7 +484,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { } //密码错误 if(!passwordRightFlag){ - logger.error(String.format("根据当前手机号(%s)密码未找到所属组织,密码错误",formDTO.getMobile())); + logger.warn(String.format("根据当前手机号(%s)密码未找到所属组织,密码错误",formDTO.getMobile())); throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); } StaffOrgFormDTO staffOrgFormDTO = new StaffOrgFormDTO(); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LogOperation.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LogOperation.java deleted file mode 100644 index a93a9ef538..0000000000 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/LogOperation.java +++ /dev/null @@ -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 ""; -} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java index 42f1950d5f..7dfbd88a75 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aop/NoRepeatSubmitAop.java +++ b/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 CACHES = CacheBuilder.newBuilder() + private static final Cache 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 { } -} \ No newline at end of file +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/LogOperationAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/LogOperationAspect.java deleted file mode 100644 index d51d147a8e..0000000000 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/LogOperationAspect.java +++ /dev/null @@ -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); - } -} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index ac6d50bd9f..fb12799b4b 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -125,9 +125,11 @@ public enum EpmetErrorCode { // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), - ARTICLE_PUBLISH_ERROR(8801, "发布文章失败,请刷新重试"), - REPEATED_SUBMIT_ERROR(8998, "请勿重复提交"), - CUSTOMER_VALIDATE_ERROR(8999, "内部数据校验异常"), + DRAFT_CONTENT_FILENAME_NULL(8802, "附件名称不能为空"), + ARTICLE_PUBLISH_ERROR(8803, "发布文章失败,请刷新重试"), + REPEATED_SUBMIT_ERROR(8804, "请勿重复提交"), + CUSTOMER_VALIDATE_ERROR(8805, "内部数据校验异常"), + CATEGORY_IS_NULL(8806, "请设置分类"), //公众号 865..开头的码 PUBLIC_NOT_EXISTS(8651,"手机号未注册,请先完成信息注册"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java deleted file mode 100644 index 035ec89088..0000000000 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/RenExceptionHandler.java +++ /dev/null @@ -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 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); - } -} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/log/producer/LogProducer.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/log/producer/LogProducer.java deleted file mode 100644 index 4712a5c5a9..0000000000 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/log/producer/LogProducer.java +++ /dev/null @@ -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)); - } -} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index faee6de155..d7aa1ca071 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/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 */ @@ -386,4 +379,16 @@ public class RedisKeys { public static String getResiUserBadgeKey(String customerId, String userId) { return rootPrefix.concat("badge:user:").concat(customerId).concat(":").concat(StringUtils.isBlank(userId) ? "*" : userId); } + + /** + * desc: 根据文件路径获取oss 文件缓存key + * + * @param path + * @return java.lang.String + * @author LiuJanJun + * @date 2021/3/30 9:56 上午 + */ + public static String getOssFileKey(String path) { + return rootPrefix.concat("oss:temp:").concat(path); + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index 8c6432aadd..3217260019 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -424,6 +424,13 @@ public class DateUtils { return DateUtils.format(date,DateUtils.DATE_PATTERN_YYYYMMDD); } + public static String getBeforeNDay(int beforDay,String format){ + Calendar c = Calendar.getInstance(); + c.add(Calendar.DATE, - beforDay); + Date date = c.getTime(); + return DateUtils.format(date,format); + } + /** * @return java.lang.String * @param beforMonth diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index 201573688e..f06ee6b839 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -457,6 +457,11 @@ epmet: - /gov/project/** - /resi/home/** - /data/report/** + - /epmet/ext/** + - /data/stats/** + - /data/aggregator/** + - /gov/voice/** + - /resi/voice/** # 内部认证url白名单(在白名单中的,就不会再校验登录了) internalAuthUrlsWhiteList: diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectDistributionFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectDistributionFormDTO.java index f1f25aeb05..4e6f37f537 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectDistributionFormDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/form/ProjectDistributionFormDTO.java @@ -13,7 +13,20 @@ import java.io.Serializable; */ @Data public class ProjectDistributionFormDTO implements Serializable { + /** + * 网格id不必填 + */ private String gridId; @NotBlank(message = "customerId不能为空") private String customerId; + + /** + * 默认1 + */ + private Integer pageNo; + + /** + * 默认20 + */ + private Integer pageSize; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java index b3a96f917c..5159bda48f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/GovIssueService.java @@ -44,5 +44,5 @@ public interface GovIssueService { **/ List closedIssueList(ClosedIssueListFormDTO fromDTO); - List selectShiftProjectIssueList(String customerId,String gridId); + List selectShiftProjectIssueList(String customerId,String gridId,Integer pageNo,Integer pageSize); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java index e379b75a38..7b68d96332 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govissue/impl/GovIssueServiceImpl.java @@ -314,8 +314,13 @@ public class GovIssueServiceImpl implements GovIssueService { } @Override - public List selectShiftProjectIssueList(String customerId,String gridId) { - return issueDao.selectShiftProjectIssueList(customerId,gridId); + public List selectShiftProjectIssueList(String customerId, String gridId, Integer pageNo, Integer pageSize) { + if (pageNo != null && pageSize != null) { + PageHelper.startPage(pageNo, pageSize); + }else{ + PageHelper.startPage(NumConstant.ONE, NumConstant.TWENTY); + } + return issueDao.selectShiftProjectIssueList(customerId, gridId); } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java index cc664bf225..abc34e5c5c 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govproject/impl/GovProjectServiceImpl.java @@ -114,7 +114,7 @@ public class GovProjectServiceImpl implements GovProjectService { @Override public List queryProjectDistribution(ProjectDistributionFormDTO formDTO) { List resultDTOList = new ArrayList<>(); - List issueInfoDTOList = govIssueService.selectShiftProjectIssueList(formDTO.getCustomerId(), formDTO.getGridId()); + List issueInfoDTOList = govIssueService.selectShiftProjectIssueList(formDTO.getCustomerId(), formDTO.getGridId(),formDTO.getPageNo(),formDTO.getPageSize()); if (CollectionUtils.isNotEmpty(issueInfoDTOList)) { List topicIds = issueInfoDTOList.stream().map(data -> data.getTopicId()).collect(Collectors.toList()); // log.info("话题id集合:" + JSON.toJSONString(topicIds, true)); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java index 1e15dce4fa..0b3b4d1891 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/ResiGroupService.java @@ -1,7 +1,6 @@ package com.epmet.dataaggre.service.resigroup; import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO; -import org.apache.ibatis.annotations.Param; import java.util.List; @@ -10,5 +9,5 @@ import java.util.List; * @DateTime 2020/12/25 上午9:21 */ public interface ResiGroupService { - List selectTopicInfoByIds(@Param("topicIds") List topicIds); + List selectTopicInfoByIds(List topicIds); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml index 44c2924ba8..185816c9bb 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govissue/IssueDao.xml @@ -122,6 +122,6 @@ AND i.GRID_ID = #{gridId} - order by i.SHIFTED_TIME desc limit 100 + order by i.SHIFTED_TIME desc \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml index f171a790e3..eb4c0e2d93 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govproject/ProjectDao.xml @@ -140,6 +140,5 @@ #{issueId} - order by CREATED_TIME desc limit 100 \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java index e50824d0cb..40315afc0c 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java @@ -17,25 +17,58 @@ import java.util.List; public class UserStatisticalData implements Serializable { private static final long serialVersionUID = 7423427555123585566L; + /** + * 机关下(按日)参与用户数分析 + */ private List partiAgencyDailyList; + /** + * 网格下(按日)参与用户数分析 + */ private List partiGridDailyList; + /** + * 机关下(按月)参与用户数分析 + */ private List partiAgencyMonthlyList; + /** + * 网格下(月)参与用户数分析 + */ private List partiGridMonthlyList; + /** + * 机关(按日)注册用户数分析 + */ private List regAgencyDailyList; + /** + * 网格(按日)注册用户数分析 + */ private List regGridDailyList; + /** + * 机关(按月)注册用户数分析 + */ private List regAgencyMonthlyList; + /** + * 网格(月)注册用户数分析 + */ private List regGridMonthlyList; + /** + * 当前正在计算的客户id + */ private String customerId; + /** + * yyyyMMdd + */ private String dateId; + /** + * yyyyMM + */ private String monthId; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java index bc3ed0d09b..9c521b770a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java @@ -21,6 +21,12 @@ public class StatsUserController { @Autowired private StatsUserService statsUserService; + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @description 工作端数据一期,用户分析:参与用户、注册用户分析 + * @Date 2021/3/26 13:27 + **/ @RequestMapping("execute") public Result execute(@RequestBody StatsFormDTO formDTO) { statsUserService.partition(formDTO); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java index f44eef01de..089be0c513 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java @@ -198,7 +198,7 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { try { projectExtractService.extractProjectPeriodData(paramNew); } catch (Exception e) { - log.error("抽取【项目数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); + log.error("抽取【项目耗时数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); } } else { try { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java index 641b7efa03..b710d08af5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java @@ -30,7 +30,6 @@ import com.epmet.dao.evaluationindex.extract.FactOriginProjectLogDailyDao; import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; import com.epmet.dto.extract.FactOriginProjectLogDailyDTO; import com.epmet.dto.extract.result.*; -import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectLogDailyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService; import org.apache.commons.lang3.StringUtils; @@ -236,6 +235,7 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl projectsHandledByAgency = baseDao.selectProjectIdHandledByAgency(customerId, dimId); Map efficiencyMap = new HashMap<>(); + List projects = new LinkedList<>(); if (!CollectionUtils.isEmpty(projectsHandledByAgency)) { Map> agencyProjectsMap = new HashMap<>(); @@ -249,10 +249,9 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl projects = new LinkedList<>(); - agencyProjectsMap.forEach((key,value) -> {projects.addAll(value);}); //2.结案项目的总耗时 List costTimes = baseDao.selectProjectCostTime(projects); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java index 35b5bbd577..8f1985b6be 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java @@ -104,6 +104,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); String org = ""; + //取最短的ordIds中最后一个 则为最高级的那个orgIds if (orgIds.length > NumConstant.ONE) { org = orgIds[orgIds.length - 1]; } else { @@ -437,11 +438,8 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { formattingData.add(dest); }); if(!CollectionUtils.isEmpty(formattingData)) { - List projectIds = formattingData.stream().map(FactOriginProjectOrgPeriodDailyEntity::getProjectId).distinct().collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(projectIds)) { factOriginProjectOrgPeriodDailyDao.deleteByProjectIds(null,param.getCustomerId()); factOriginProjectOrgPeriodDailyDao.insertBatch(formattingData); - } } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index 906c0aea3d..39501e53b4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -78,6 +78,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr //2.查询出客户下网格的相关信息 List gridList = customerGridService.queryGridInfoList(param.getCustomerId()); + // list 转 map,以gridId为key,a = gridList,作为value,(o,n)->o 是遇到相同的gridId舍弃,(o,n)->n 是覆盖原来的gridId Map gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO :: getGridId,a -> a,(o, n) -> o)); //3.查询出客户下用户的累计积分(累计值,没有时间概念,否则需要查询积分明细计算出评价周期末的得分) @@ -96,7 +97,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr } } final String finalDateId = dateId; - + // 查询党员积分 Map scoreMap = cpcIndexCalculateService.getCpcScore(param.getCustomerId(),dateId); //剔除垃圾数据 @@ -155,7 +156,10 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr //最近一次操作 Map latestOperationMap = projectProcessService.getLatestOperation(projectIds,param.getCustomerId()); //图片 - List projectSourceMap = factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds); + List projectSourceMap = difficulties.stream().map(diff->{ + ProjectSourceMapFormDTO map = new ProjectSourceMapFormDTO();map.setProjectId(diff.getEventId());map.setSourceId(diff.getEventImgUrl());return map; + }).collect(Collectors.toList()); + //factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds); Map> imgMap = topicService.getTopicImgs(projectSourceMap); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java index 590f8c3df6..dfb64dfc01 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java @@ -69,7 +69,9 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic */ @Override public void extractScreenData(ScreenCentralZoneDataFormDTO param) { + //screen_project_data表是否存在此客户数据 int rows = targetDbService.checkIfExisted(param.getCustomerId()); + //查找客户项目超期参数 List exceedParams = projectService.getProjectExceedParams(param.getCustomerId()); Integer exceedLimit = NumConstant.FIVE; Integer about2ExceedLimit = NumConstant.FIVE; @@ -92,6 +94,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic originMainService.initNewScreenProjectData(param.getCustomerId(), rows , param.getDateId(),exceedLimit,about2ExceedLimit); if(!CollectionUtils.isEmpty(metaData)) { + // 查询项目信息 List info = projectService.getProjectInfo(metaData.stream().map(ScreenProjectDataDTO::getProjectId).collect(Collectors.toList())); if(!CollectionUtils.isEmpty(info)){ metaData = metaData.stream().flatMap(meta -> info.stream().filter(nature -> StringUtils.equals(meta.getProjectId(), diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java index 66873e1b6d..f263b332fc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java @@ -66,7 +66,7 @@ public class ScreenDifficultyDataServiceImpl extends BaseServiceImpl customerIdList = null; Date date = null; + if (StringUtils.isNotBlank(formDTO.getDate())) { + //如果指定了参数,转化为yyyy-MM-dd格式 date = DateUtils.stringToDate(formDTO.getDate(), DateUtils.DATE_PATTERN); } if (StringUtils.isNotBlank(formDTO.getCustomerId())) { generate(formDTO.getCustomerId(), date); } else { do { + //每100个客户一组 customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { @@ -90,6 +99,7 @@ public class StatsUserServiceImpl implements StatsUserService { * @date 2020.06.28 14:40 **/ void generate(String customerId,Date date){ + log.info("customerId:"+customerId+";date:"+DateUtils.format(date,DateUtils.DATE_TIME_PATTERN)); //1.初始化时间参数 Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); @@ -99,13 +109,11 @@ public class StatsUserServiceImpl implements StatsUserService { calendar.set(Calendar.MINUTE, NumConstant.ZERO); calendar.set(Calendar.SECOND, NumConstant.ZERO); - //2.初始化时间维度 + //2.初始化时间维度{"dateId":"20210325","monthId":"202103","quarterId":"2021Q1","weekId":"2021W13","yearId":"2021"} DimIdGenerator.DimIdBean timeDimension = DimIdGenerator.getDimIdBean(null == date ? calendar.getTime() : date); - + log.info("timeDimension:"+ JSON.toJSONString(timeDimension)); //3.初始化机关维度 List agencies = dimAgencyService.getAllAgency(customerId); - //List topAgencies = dimAgencyService.getTopAgency(customerId); - //4.计算机关统计数据、生成唯一性统计数据 try { UserStatisticalData agencyData = userService.traverseAgencyUser(agencies, date, timeDimension); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java index 24811db736..feceadf83d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java @@ -63,15 +63,17 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon //1.查询用户与党员数据,判断dimId是否为昨天,如果根据这个dimId没有查询出结果,则取前天的数据 //如果还是查不出数据,继续向下执行,这部分数据设置默认值 - //注册用户数 + //注册用户数 fact_reg_user_grid_daily 或 fact_reg_user_agency_daily agency级别 List result = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(result)){ + // 根据dateId查询为空,先根据当前时间-1天是否和dateId相等,相等的话,查询往前推2天的数据 if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ result = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } if(null == result) result = new LinkedList<>(); } + // 网格级别 List gridUserResult = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); @@ -84,13 +86,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon result.addAll(gridUserResult); } - //2.组 + //2.组 fact_group_grid_daily 或 fact_group_agency_daily List agencyGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(agencyGroup)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ agencyGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } + // 网格级别 List gridGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); if(CollectionUtils.isEmpty(gridGroup)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ @@ -101,13 +104,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon groupMap.putAll(gridGroup.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getGroupTotal))); - //3.话题 + //3.话题 fact_topic_total_grid_daily或fact_topic_total_agency_daily List agencyTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(agencyTopic)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ agencyTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } + // 网格级别 List gridTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); if(CollectionUtils.isEmpty(gridTopic)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ @@ -117,13 +121,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon Map topicMap = agencyTopic.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getTopicTotal)); topicMap.putAll(gridTopic.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getTopicTotal))); - //4.议题 + //4.议题 fact_issue_grid_daily 或 fact_issue_agency_daily List agencyIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(agencyIssue)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ agencyIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } + // 网格级别 List gridIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); if(CollectionUtils.isEmpty(gridIssue)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ @@ -133,13 +138,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon Map issueMap = agencyIssue.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal)); issueMap.putAll(gridIssue.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal))); - //5.项目 + //5.项目 fact_grid_project_daily 或 fact_agency_project_daily List agencyProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(agencyProject)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ agencyProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } + // 网格级别 List gridProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); if(CollectionUtils.isEmpty(gridProject)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java index 83e3b9da38..c832202e70 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -74,7 +74,7 @@ public class TopicServiceImpl implements TopicService { agencies.forEach(agency -> { initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); }); - + //计算网格-组-话题映射关系 List topics = topicDao.selectGroupOrderByGrid(targetDate,customerId); topics.forEach(groupTopic -> { if(null != groupTopic.getTopics() && groupTopic.getTopics().size() == NumConstant.ONE && StringUtils.isBlank(groupTopic.getTopics().get(NumConstant.ZERO).getTopicId())){ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index db739b79ab..b5594541a6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -62,8 +62,8 @@ public class UserServiceImpl implements UserService { dataPacket.setDateId(timeDimension.getDateId()); dataPacket.setMonthId(timeDimension.getMonthId()); //自上向下检索 - Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); + //subGridOfAgency key:agencyId ,value:当前组织下的所有网格(即直属网格+下级组织下的所有网格) Map> subGridOfAgency = new HashMap<>(); agencies.forEach(agency -> { initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); @@ -71,12 +71,13 @@ public class UserServiceImpl implements UserService { //对每一个机关进行数据统计 if(subGridOfAgency.size() > NumConstant.ZERO){ - subGridOfAgency.forEach((k,v) -> { + //如果当前客户存在组织 + subGridOfAgency.forEach((agencyId,subGridIds) -> { queryUserData(ModuleConstant.DIM_SUB_AGENCY, - k, - (null == agencyMap.get(k) || agencyMap.get(k).isEmpty()) ? NumConstant.ZERO_STR : agencyMap.get(k).get(NumConstant.ZERO).getPid(), - (null == agencyMap.get(k) || agencyMap.get(k).isEmpty()) ? null : agencyMap.get(k).get(NumConstant.ZERO).getCustomerId(), - v, + agencyId, + // (null == agencyMap.get(agencyId) || agencyMap.get(agencyId).isEmpty()) ? NumConstant.ZERO_STR : agencyMap.get(agencyId).get(NumConstant.ZERO).getPid(), + (null == agencyMap.get(agencyId) || agencyMap.get(agencyId).isEmpty()) ? null : agencyMap.get(agencyId).get(NumConstant.ZERO).getCustomerId(), + subGridIds, targetDate, dataPacket, timeDimension); @@ -107,11 +108,11 @@ public class UserServiceImpl implements UserService { //自上向下检索 Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); if(null != agencyMap && agencyMap.size() > NumConstant.ZERO){ - agencyMap.forEach((k,v) -> { + agencyMap.forEach((agencyId,v) -> { if(null != v && v.size() > NumConstant.ZERO){ queryUserData(ModuleConstant.DIM_BELONGING_GRID, - k, - v.get(NumConstant.ZERO).getPid(), + agencyId, + // v.get(NumConstant.ZERO).getPid(), v.get(NumConstant.ZERO).getCustomerId(), new HashSet<>(v.get(NumConstant.ZERO).getGridIds()), targetDate, @@ -181,22 +182,22 @@ public class UserServiceImpl implements UserService { /** * @Description 初始化机关-所有下级网格Map - * @param pid - 固定一个机关Id + * @param agencyId - 当前组织id * @param agency - AgencySubTreeDto * @param subGridOfAgency - Map> * @return * @author wangc * @date 2020.06.18 15:54 **/ - void initAgencyGridMap(String pid, AgencySubTreeDto agency, Map> subGridOfAgency){ + void initAgencyGridMap(String agencyId, AgencySubTreeDto agency, Map> subGridOfAgency){ //向map中放入数据 - if(subGridOfAgency.containsKey(pid)){ + if(subGridOfAgency.containsKey(agencyId)){ //包含key - Set grids = subGridOfAgency.get(pid); + Set grids = subGridOfAgency.get(agencyId); if(null == grids){ grids = new HashSet<>(); - subGridOfAgency.put(pid,grids); + subGridOfAgency.put(agencyId,grids); } if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){ grids.addAll(agency.getGridIds()); @@ -204,18 +205,20 @@ public class UserServiceImpl implements UserService { }else{ //不包含key Set grids = new HashSet<>(agency.getGridIds()); - subGridOfAgency.put(pid,grids); + subGridOfAgency.put(agencyId,grids); } - + //外层是从顶级组织向下循环,所以循环到社区时跳出 //定义递归出口 - if(StringUtils.equals(ModuleConstant.AGENCY_LEVEL_COMMUNITY,agency.getLevel()) || null == agency.getSubAgencies() || agency.getSubAgencies().size() == NumConstant.ZERO){ - return ; + if (StringUtils.equals(ModuleConstant.AGENCY_LEVEL_COMMUNITY, agency.getLevel()) + || null == agency.getSubAgencies() + || agency.getSubAgencies().size() == NumConstant.ZERO) { + return; } //定义递归入口 agency.getSubAgencies().forEach(obj -> { - initAgencyGridMap(pid,obj,subGridOfAgency); + initAgencyGridMap(agencyId,obj,subGridOfAgency); }); } @@ -223,7 +226,7 @@ public class UserServiceImpl implements UserService { * @Description 执行查询用户数据统计的逻辑 * @param relation - agency(下级机关加网格) | grid(直属网格) * @param agencyId - * @param pid + * @param //pid 当前agency的父级组织id * @param customerId * @param gridIds - 机关下所有网格集合/机关下直属网格集合 * @param targetDate @@ -233,10 +236,12 @@ public class UserServiceImpl implements UserService { * @author wangc * @date 2020.06.19 10:01 **/ - void queryUserData(String relation, String agencyId, String pid, String customerId, Set gridIds, Date targetDate, UserStatisticalData dataPacket, DimIdGenerator.DimIdBean timeDimension){ - - if(StringUtils.isBlank(pid)) - pid = NumConstant.ZERO_STR; + void queryUserData(String relation, String agencyId, + // String pid, + String customerId, Set gridIds, Date targetDate, UserStatisticalData dataPacket, DimIdGenerator.DimIdBean timeDimension){ + //pid没用到还传过来干啥-- 注释掉 + // if(StringUtils.isBlank(pid)) + // pid = NumConstant.ZERO_STR; dataPacket.setCustomerId(customerId); @@ -253,6 +258,9 @@ public class UserServiceImpl implements UserService { //指定日期 OR T-1 calendar.setTime(targetDateCheck); + //calendar.get(Calendar.DATE) 当前日期数eg:2021-03-29 :29 + //calendar.getActualMinimum(Calendar.DAY_OF_MONTH) :1 + //如果目标日期不是是当月的第一天 if(calendar.get(Calendar.DATE) != calendar.getActualMinimum(Calendar.DAY_OF_MONTH)){ //求出这个月的第一天 @@ -264,7 +272,6 @@ public class UserServiceImpl implements UserService { isMonthBeginning = false; } - if(StringUtils.equals(ModuleConstant.DIM_SUB_AGENCY,relation)){ @@ -396,8 +403,6 @@ public class UserServiceImpl implements UserService { partiAgencyM.setWarmHeartedProportion(partiAgencyD.getWarmHeartedProportion()); partiAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); - - //如果是月初第一天,不再做日期区间查询 if(isMonthBeginning) { if (null == dataPacket.getRegAgencyMonthlyList()) { @@ -416,6 +421,7 @@ public class UserServiceImpl implements UserService { } }else{ //如果不是月初第一天 + //targetDateCheck:定时任务参数中的date;calendar.getTime():date所属月第一天; //本月注册用户增长数 Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,calendar.getTime(),targetDateCheck); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml index 2db8a97d58..1d5b5c6e79 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml @@ -165,7 +165,7 @@ AGENCY_ID, COUNT(DISTINCT PROJECT_ID) AS count FROM - fact_origin_project_log_daily + fact_origin_project_log_daily log WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} AND IS_ACTIVE = '0' @@ -173,13 +173,14 @@ AND MONTH_ID = #{dimId} AND NOT EXISTS( SELECT ID - FROM fact_origin_project_log_daily + FROM fact_origin_project_log_daily innerLog WHERE DEL_FLAG = '0' AND MONTH_ID #{dimId} AND IS_ACTIVE = '0' + AND log.project_id = innerLog.project_id - AGENCY_ID = #{agencyId} + innerLog.AGENCY_ID = #{agencyId} ) @@ -198,15 +199,19 @@ COUNT(DISTINCT log.PROJECT_ID) AS count FROM fact_origin_project_log_daily log - LEFT JOIN fact_origin_project_main_daily project ON log.PROJECT_ID = project.ID AND project.DEL_FLAG = '0' AND project.CUSTOMER_ID = #{customerId} WHERE log.DEL_FLAG = '0' - AND project.PROJECT_STATUS LIKE 'close%' AND log.CUSTOMER_ID = #{customerId} AND log.IS_ACTIVE = '0' - AND log.MONTH_ID = #{dimId} + AND EXISTS ( + select innerLog.id from fact_origin_project_log_daily innerLog where innerLog.del_flag = '0' + and innerLog.customer_id = #{customerId} and innerLog.month_id = #{dimId} + and innerLog.action_code like 'close%' + and innerLog.project_id = log.project_id + ) + log.AGENCY_ID = #{agencyId} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index 89ba03036c..b9608e9ee3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -335,6 +335,7 @@ gridInfo.allParentIds FROM fact_origin_project_main_daily project + LEFT JOIN ( SELECT grid.ID AS dimGridId, @@ -368,7 +369,9 @@ grid.DEL_FLAG = '0' AND grid.CUSTOMER_ID = #{customerId} ) gridInfo ON project.GRID_ID = gridInfo.dimGridId + LEFT JOIN ( SELECT PROJECT_ID, COUNT( DISTINCT ORG_ID ) AS reOrg FROM fact_origin_project_org_period_daily WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} GROUP BY PROJECT_ID ) relation ON project.ID = relation.PROJECT_ID + LEFT JOIN ( SELECT PROJECT_ID, @@ -387,31 +390,34 @@ AND project.CUSTOMER_ID = #{customerId} AND project.ID IN ( - + SELECT DISTINCT period.project_id FROM fact_origin_project_org_period_daily period LEFT JOIN ( - - SELECT - - project.ID AS projectId, - IF(project.project_status = 'closed',period.handled_date,NOW()) AS finishDate - - FROM fact_origin_project_main_daily project LEFT JOIN fact_origin_project_org_period_daily period - ON project.ID = period.project_id AND period.del_flag = '0' AND period.customer_id = #{customerId} - AND period.operation = 'close' - WHERE project.customer_id = #{customerId} AND project.del_flag = '0' - ) projectFinishDate ON projectFinishDate.projectId = period.project_id - - WHERE - period.del_flag = '0' + + + SELECT + project.ID AS projectId, + IFNULL(period.handled_date,NOW()) AS finishDate + FROM + fact_origin_project_main_daily project + LEFT JOIN fact_origin_project_org_period_daily period ON project.ID = period.project_id + AND period.del_flag = '0' AND period.customer_id = #{customerId} - AND TIMESTAMPDIFF( DAY, period.informed_date, projectFinishDate.finishDate) > #{thresholdValue} - ) + AND period.operation = 'close' + WHERE + project.customer_id = #{customerId} + AND project.del_flag = '0' + ) projectFinishDate ON projectFinishDate.projectId = period.project_id + WHERE + period.del_flag = '0' + AND period.customer_id = #{customerId} + AND TIMESTAMPDIFF( DAY, period.informed_date, IFNULL(period.handled_date,projectFinishDate.finishDate)) > #{thresholdValue} + ) @@ -569,4 +575,4 @@ - \ No newline at end of file + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index 969a848ae3..f30740e0ee 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -40,11 +40,13 @@ + - AND CREATED_TIME =]]> #{targetDate} AND CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(#{targetDate},"%Y-%m-%d") + - AND CREATED_TIME CURDATE( ) AND CREATED_TIME =]]> DATE_SUB( CURDATE( ), INTERVAL 1 DAY ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT( DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") ) AS incr @@ -76,11 +78,13 @@ + - AND CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(#{targetDate},"%Y-%m-%d") + - AND CREATED_TIME CURDATE( ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") @@ -121,10 +125,10 @@ - AND CREATED_TIME =]]> #{targetDate} AND CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND CREATED_TIME CURDATE( ) AND CREATED_TIME =]]> DATE_SUB( CURDATE( ), INTERVAL 1 DAY ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") @@ -164,10 +168,10 @@ - AND CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND CREATED_TIME CURDATE( ) + and DATE_FORMAT(CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") @@ -190,10 +194,10 @@ - AND urole.CREATED_TIME =]]> #{targetDate} AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND urole.CREATED_TIME CURDATE( ) AND urole.CREATED_TIME =]]> DATE_SUB( CURDATE( ), INTERVAL 1 DAY ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") = DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") @@ -221,10 +225,10 @@ - AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) + and DATE_FORMAT( urole.CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND urole.CREATED_TIME CURDATE( ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") AND erole.ROLE_NAME = '党员' @@ -261,10 +265,10 @@ - AND urole.CREATED_TIME =]]> #{targetDate} AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d")=DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND urole.CREATED_TIME CURDATE( ) AND urole.CREATED_TIME =]]> DATE_SUB( CURDATE( ), INTERVAL 1 DAY ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d")=DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") AND erole.ROLE_NAME = '热心居民' @@ -290,10 +294,10 @@ - AND urole.CREATED_TIME DATE_SUB( #{targetDate}, INTERVAL - 1 DAY ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(#{targetDate},"%Y-%m-%d") - AND urole.CREATED_TIME CURDATE( ) + and DATE_FORMAT(urole.CREATED_TIME,"%Y-%m-%d") DATE_FORMAT(DATE_SUB( CURDATE( ), INTERVAL 1 DAY ),"%Y-%m-%d") AND erole.ROLE_NAME = '热心居民'; @@ -332,8 +336,8 @@ - - AND CREATED_TIME =]]> #{startDate} AND CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) + AND CREATED_TIME =]]> DATE_FORMAT(#{startDate},"%Y-%m-%d") + AND CREATED_TIME DATE_FORMAT(#{endDate},"%Y-%m-%d") @@ -368,10 +372,8 @@ - - - AND CREATED_TIME =]]> #{startDate} AND CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) - + AND CREATED_TIME =]]> DATE_FORMAT(#{startDate},"%Y-%m-%d") + AND CREATED_TIME DATE_FORMAT(#{endDate},"%Y-%m-%d") @@ -394,9 +396,8 @@ - - - AND urole.CREATED_TIME =]]> #{startDate} AND urole.CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) + AND urole.CREATED_TIME =]]> DATE_FORMAT(#{startDate},"%Y-%m-%d") + AND urole.CREATED_TIME DATE_FORMAT(#{endDate},"%Y-%m-%d") AND erole.ROLE_NAME = '党员' @@ -423,7 +424,8 @@ - AND urole.CREATED_TIME =]]> #{startDate} AND urole.CREATED_TIME DATE_SUB( #{endDate}, INTERVAL - 1 DAY) + AND urole.CREATED_TIME =]]> DATE_FORMAT(#{startDate},"%Y-%m-%d") + AND urole.CREATED_TIME DATE_FORMAT(#{endDate},"%Y-%m-%d") AND erole.ROLE_NAME = '热心居民' diff --git a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActModelController.java b/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActModelController.java index 8d3b0db55f..6ef0f13807 100644 --- a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActModelController.java +++ b/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); } diff --git a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActProcessController.java b/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActProcessController.java index e317d0f4fc..6615e815f6 100644 --- a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActProcessController.java +++ b/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); diff --git a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActRunningController.java b/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActRunningController.java index 6d938406fc..65b7da62f4 100644 --- a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActRunningController.java +++ b/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 start(String key){ ProcessInstanceDTO dto = actRunningService.startProcess(key); @@ -71,7 +68,6 @@ public class ActRunningController { @PostMapping("startOfBusinessKey") @ApiOperation("启动流程实例,依据流程定义ID和业务唯一标示启动实例") - @LogOperation("启动流程实例,依据流程定义ID和业务唯一标示启动实例") public Result startOfBusinessKey(@RequestBody ProcessStartDTO processStartDTO){ ProcessInstanceDTO dto = actRunningService.startOfBusinessKey(processStartDTO); return new Result().ok(dto); diff --git a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActTaskController.java b/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActTaskController.java index c0a9ee2bec..e7fbf44ca1 100644 --- a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/controller/ActTaskController.java +++ b/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); diff --git a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/demo/controller/CorrectionController.java b/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/demo/controller/CorrectionController.java index 85c0557e31..ae24d55c6f 100644 --- a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/demo/controller/CorrectionController.java +++ b/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") diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/CustomerRoleResultDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/CustomerRoleResultDTO.java new file mode 100644 index 0000000000..a8fe59a2f8 --- /dev/null +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/CustomerRoleResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/3/29 15:26 + */ +@Data +public class CustomerRoleResultDTO implements Serializable { + private static final long serialVersionUID = 4933114432141586045L; + + private String roleName; + private String roleKey; + private String roleId; + private Boolean fullTimeOnly; +} diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java index 4fd89b0dbc..c0535b648b 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/controller/OpenUpController.java @@ -147,5 +147,18 @@ public class OpenUpController { ValidatorUtils.validateEntity(formDTO); return new Result().ok(openUpService.queryStaffPermissionV2(formDTO)); } + + /** + * @return + * @param formDTO 客户id + * @author yinzuomei + * @description 010、获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:25 + **/ + @PostMapping("govrolelist") + public Result> queryCustomerGovRoleList(@RequestBody CustomerInfoQueryFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(openUpService.queryCustomerGovRoleList(formDTO.getCustomerId())); + } } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java index 6fbe32afe6..8047ec9f8c 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/OpenUpService.java @@ -62,4 +62,13 @@ public interface OpenUpService { * @Date 2021/2/3 20:59 **/ StaffPermissionResultDTO queryStaffPermissionV2(StaffPermissionFormDTO formDTO); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 010、获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:27 + **/ + List queryCustomerGovRoleList(String customerId); } diff --git a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java index 43f50a34c9..0f6cb365b3 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/service/impl/OpenUpServiceImpl.java @@ -210,4 +210,21 @@ public class OpenUpServiceImpl implements OpenUpService { return resultDTO; } + /** + * @param customerId + * @return java.util.List + * @author yinzuomei + * @description 010、获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:27 + **/ + @Override + public List queryCustomerGovRoleList(String customerId) { + Result> userRes = epmetUserOpenFeignClient.queryCustomerGovRoleList(customerId); + if (!userRes.success() || CollectionUtils.isEmpty(userRes.getData())) { + log.error(String.format("获取当前客户下,工作端角色列表失败,customerId:%s", customerId)); + return new ArrayList<>(); + } + return ConvertUtils.sourceToTarget(userRes.getData(), CustomerRoleResultDTO.class); + } + } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/ScheduleJobController.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/ScheduleJobController.java index 5c12cd27bf..ecd1b10718 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/ScheduleJobController.java +++ b/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(); diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/MailTemplateController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/MailTemplateController.java index 550a83c112..56fd837daf 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/MailTemplateController.java +++ b/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; diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/RemoveFileFormDTO.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/RemoveFileFormDTO.java new file mode 100644 index 0000000000..7f01fc9936 --- /dev/null +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/form/RemoveFileFormDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/3/30 9:51 + */ +@Data +public class RemoveFileFormDTO implements Serializable { + private static final long serialVersionUID = 3889369412733647229L; + private String url; +} diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java index b93b58bb39..cbd2797bfb 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/result/UploadImgResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.result; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -12,4 +13,9 @@ import java.io.Serializable; @Data public class UploadImgResultDTO implements Serializable { private String url; + /** + * 域名 + */ + @JsonIgnore + private String domain; } diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index a29c4474cc..2264f855e4 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/pom.xml @@ -14,8 +14,7 @@ 7.2.22 - 2.8.3 - 3.2.2 + 3.10.2 5.4.4 1.26.2 @@ -82,11 +81,6 @@ - - com.aliyun - aliyun-java-sdk-core - ${aliyun.core.version} - com.github.tobato fastdfs-client diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java index 0eabc11add..74a38551d0 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AbstractCloudStorageService.java @@ -25,7 +25,17 @@ import java.util.UUID; public abstract class AbstractCloudStorageService { /** 云存储配置信息 */ CloudStorageConfig config; - + /** + * desc: 获取oss域名 + * + * @param privacy + * @return java.lang.String + * @author LiuJanJun + * @date 2021/3/30 10:05 上午 + */ + public String getOssDomain(String privacy){ + return null; + }; /** * 文件路径 * @param prefix 前缀 @@ -97,4 +107,13 @@ public abstract class AbstractCloudStorageService { */ public abstract void down(String privacyType) throws IOException; + /** + * 文件删除 + * @author zhaoqifeng + * @date 2021/3/30 11:05 + * @param objectName + * @return boolean + */ + public abstract boolean delete(String objectName, String privacyType); + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java index 472609fbcd..c1865d8234 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/AliyunCloudStorageService.java @@ -8,7 +8,9 @@ package com.epmet.cloud; +import com.aliyun.oss.OSS; import com.aliyun.oss.OSSClient; +import com.aliyun.oss.OSSClientBuilder; import com.aliyun.oss.model.DownloadFileRequest; import com.aliyun.oss.model.DownloadFileResult; import com.epmet.commons.tools.exception.RenException; @@ -26,17 +28,44 @@ import java.io.InputStream; */ public class AliyunCloudStorageService extends AbstractCloudStorageService { + private OSS internalClient = null; + private OSS externalClient = null; + public AliyunCloudStorageService(CloudStorageConfig config){ this.config = config; } /** - * @Description 根据隐私类型获取属性。传递internal的时候会返回内部的,否则返回外部的,即公开的 + * @Description 根据隐私类型获取属性。获取client * @return * @author wxz * @date 2021.01.04 13:49 */ - private CloudStorageConfig.AliyunCloudStorageConfigProps getPropsByprivacyType(String privacyType) { + public OSS getOssClient(String privacyType) { + if (PrivacyType.INTERNAL.equalsIgnoreCase(privacyType)) { + if (internalClient == null){ + CloudStorageConfig.AliyunCloudStorageConfigProps props = config.getAliyun().getInternal(); + internalClient = new OSSClientBuilder().build(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(); } else { @@ -44,6 +73,23 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService { } } + /** + * desc: 获取oss域名 + * + * @param privacy + * @return java.lang.String + * @author LiuJanJun + * @date 2021/3/30 10:05 上午 + */ + @Override + public String getOssDomain(String privacy) { + if (PrivacyType.INTERNAL.equalsIgnoreCase(privacy)) { + return config.getAliyun().getInternal().getAliyunDomain(); + } else { + return config.getAliyun().getExternal().getAliyunDomain(); + } + } + @Override public String upload(byte[] data, String path, String privacyType) { return upload(new ByteArrayInputStream(data), path, privacyType); @@ -52,11 +98,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()); + OSS 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, ""); } @@ -64,6 +109,20 @@ public class AliyunCloudStorageService extends AbstractCloudStorageService { return props.getAliyunDomain() + "/" + path; } + @Override + public boolean delete(String objectName,String privacyType) { + CloudStorageConfig.AliyunCloudStorageConfigProps props = getPropsByprivacyType(privacyType); + OSS client = getOssClient(privacyType); + try { + client.deleteObject(props.getAliyunBucketName(), objectName); + //client.shutdown(); + } catch (Exception e){ + return false; + } + + return true; + } + @Override public String uploadSuffix(byte[] data, String suffix, String privacyType) { CloudStorageConfig.AliyunCloudStorageConfigProps props = getPropsByprivacyType(privacyType); @@ -79,8 +138,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()); + OSS client = getOssClient(privacyType); try { /* @@ -118,7 +176,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) { diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java index b5493c02b2..08a591e86d 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/FastDFSCloudStorageService.java @@ -65,4 +65,18 @@ public class FastDFSCloudStorageService extends AbstractCloudStorageService { public void down(String privacyType) throws IOException { } + + /** + * 文件删除 + * + * @param objectName + * @param privacyType + * @return boolean + * @author zhaoqifeng + * @date 2021/3/30 11:05 + */ + @Override + public boolean delete(String objectName, String privacyType) { + return false; + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java index 8143edaa0b..7317bbd780 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/LocalCloudStorageService.java @@ -58,4 +58,18 @@ public class LocalCloudStorageService extends AbstractCloudStorageService { public void down(String privacyType) throws IOException { } + + /** + * 文件删除 + * + * @param objectName + * @param privacyType + * @return boolean + * @author zhaoqifeng + * @date 2021/3/30 11:05 + */ + @Override + public boolean delete(String objectName, String privacyType) { + return false; + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/OssFactory.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/OssFactory.java index 7febe43644..3d69543784 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/OssFactory.java +++ b/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; } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java index 80c5e494f4..5d657ba318 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QcloudCloudStorageService.java @@ -88,4 +88,18 @@ public class QcloudCloudStorageService extends AbstractCloudStorageService { public void down(String privacyType) throws IOException { } + + /** + * 文件删除 + * + * @param objectName + * @param privacyType + * @return boolean + * @author zhaoqifeng + * @date 2021/3/30 11:05 + */ + @Override + public boolean delete(String objectName, String privacyType) { + return false; + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java index 16515203dd..2fe73cddeb 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/cloud/QiniuCloudStorageService.java @@ -82,4 +82,18 @@ public class QiniuCloudStorageService extends AbstractCloudStorageService { public void down(String privacyType) throws IOException { } + + /** + * 文件删除 + * + * @param objectName + * @param privacyType + * @return boolean + * @author zhaoqifeng + * @date 2021/3/30 11:05 + */ + @Override + public boolean delete(String objectName, String privacyType) { + return false; + } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 1559d4160b..04889584db 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -11,15 +11,19 @@ package com.epmet.controller; import com.epmet.cloud.CloudStorageConfig; import com.epmet.cloud.OssFactory; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AliyunGroup; import com.epmet.commons.tools.validator.group.QcloudGroup; import com.epmet.commons.tools.validator.group.QiniuGroup; import com.epmet.dto.UploadDTO; +import com.epmet.dto.form.RemoveFileFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import com.epmet.enums.OssTypeEnum; @@ -32,6 +36,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.http.entity.ContentType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; @@ -62,6 +67,8 @@ public class OssController { private OssService ossService; @Autowired private ParamsRemoteService paramsRemoteService; + @Autowired + private RedisUtils redisUtils; private final static String KEY = ModuleConstant.CLOUD_STORAGE_CONFIG_KEY; @@ -205,26 +212,55 @@ public class OssController { return ossService.uploadImg(file, null); } + /** + * desc: 党建声音模块 上传图片(2M)或附件(5M) + * + * @param file + * @return com.epmet.commons.tools.utils.Result + * @author LiuJanJun + * @date 2021/3/29 4:56 下午 + */ @PostMapping("article/upload") public Result uploadArticleImg(@RequestParam("file") MultipartFile file) { - // 校验文件类型 - if (!MediaType.IMAGE_PNG_VALUE.equals(file.getContentType()) && !MediaType.IMAGE_JPEG_VALUE.equals(file.getContentType()) - && !ModuleConstant.FILE_CONTENT_TYPE_JPG.equals(file.getContentType()) ) { - log.error("uploadArticleImg file type:{} is not support 2 upload",file.getContentType() == null? null:file.getContentType()); + // 校验文件类型 图片或pdf + if (!MediaType.IMAGE_PNG_VALUE.equals(file.getContentType()) + && !MediaType.IMAGE_JPEG_VALUE.equals(file.getContentType()) + && !ModuleConstant.FILE_CONTENT_TYPE_JPG.equals(file.getContentType()) + && !ModuleConstant.FILE_CONTENT_TYPE_PDF.equals(file.getContentType())) { + log.error("uploadArticleImg file type:{} is not support 2 upload", file.getContentType()); throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getCode() , EpmetErrorCode.OPER_UPLOAD_FILE_TYPE_ERROR.getMsg()); } - - // 校验文件体积,不超过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()); + if (ModuleConstant.FILE_CONTENT_TYPE_PDF.equals(file.getContentType())) { + // 校验文件大小,不超过5m + long maxSize = 5 * 1024 * 1024; + if (size > maxSize) { + throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode() + , EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg()); + } + } else { + // 校验文件大小,不超过2m + long maxSize = 2 * 1024 * 1024; + if (size > maxSize) { + throw new RenException(EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getCode() + , EpmetErrorCode.OPER_UPLOAD_FILE_OVER_SIZE.getMsg()); + } } - - return ossService.uploadImg(file, null); + Result result = ossService.uploadImg(file, null); + if (result != null && result.success() ){ + UploadImgResultDTO data = result.getData(); + if ( data!= null && StringUtils.isNotBlank(data.getUrl())){ + String path = data.getUrl().replace(data.getDomain(), StrConstant.EPMETY_STR); + if (path.startsWith(StrConstant.SEPARATOR)){ + path = path.replaceFirst(StrConstant.SEPARATOR,StrConstant.EPMETY_STR); + } + String fileName = data.getUrl().substring(data.getUrl().lastIndexOf(StrConstant.SEPARATOR)+1); + redisUtils.set(RedisKeys.getOssFileKey(fileName),path,RedisUtils.MINUTE_THIRTY_EXPIRE); + } + } + return result; } @@ -321,4 +357,9 @@ public class OssController { return ossService.uploadVoice(file); } + @PostMapping("article/remove/file") + public Result articleRemoveFile(@RequestBody RemoveFileFormDTO formDTO) { + return new Result().ok(ossService.articleRemoveFile(formDTO)); + } + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/dao/OssDao.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/dao/OssDao.java index 79f8b14823..0be20abd16 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/dao/OssDao.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/dao/OssDao.java @@ -11,6 +11,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.OssEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 文件上传 @@ -19,5 +20,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface OssDao extends BaseDao { - + OssEntity selectByUrl(@Param("url") String url); + void deleteDataById(@Param("id") String id); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java index 3253f78527..4f4171df0e 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/OssService.java @@ -11,6 +11,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.RemoveFileFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import org.springframework.web.multipart.MultipartFile; @@ -35,4 +36,13 @@ public interface OssService extends BaseService { Result uploadVariedFile(MultipartFile file); Result uploadVoice(MultipartFile file); + + /** + * 删除附件 + * @author zhaoqifeng + * @date 2021/3/30 9:55 + * @param formDTO + * @return boolean + */ + boolean articleRemoveFile(RemoveFileFormDTO formDTO); } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java index 3effd64fb8..6e9e8e2d90 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/service/impl/OssServiceImpl.java @@ -8,23 +8,31 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.cloud.AbstractCloudStorageService; import com.epmet.cloud.OssFactory; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constants.PrivacyType; import com.epmet.dao.OssDao; +import com.epmet.dto.form.RemoveFileFormDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; import com.epmet.exception.ModuleErrorCode; import com.epmet.service.OssService; import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -34,6 +42,10 @@ import java.util.Map; @Service public class OssServiceImpl extends BaseServiceImpl implements OssService { private static final Logger logger = LoggerFactory.getLogger(OssServiceImpl.class); + + @Autowired + private RedisUtils redisUtils; + @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -56,21 +68,26 @@ public class OssServiceImpl extends BaseServiceImpl implement //上传文件 String extension = FilenameUtils.getExtension(file.getOriginalFilename()); String url = null; + String ossDomain = null; try { - url = OssFactory.build().uploadSuffix(file.getBytes(), extension, privacy); + + AbstractCloudStorageService storageService = OssFactory.build(); + url = storageService.uploadSuffix(file.getBytes(), extension, privacy); + ossDomain = storageService.getOssDomain(privacy); } catch (IOException e) { - e.printStackTrace(); - logger.error("图片上传异常"); + logger.error("图片上传异常", e); throw new RenException("图片上传异常"); } //保存文件信息 OssEntity ossEntity = new OssEntity(); ossEntity.setUrl(url); + baseDao.insert(ossEntity); //文件信息 UploadImgResultDTO dto = new UploadImgResultDTO(); dto.setUrl(url); + dto.setDomain(ossDomain); return new Result().ok(dto); } @@ -117,8 +134,7 @@ public class OssServiceImpl extends BaseServiceImpl implement try { url = OssFactory.build().uploadSuffix(file.getBytes(), extension, PrivacyType.INTERNAL); } catch (IOException e) { - e.printStackTrace(); - logger.error("文件上传异常"); + logger.error("文件上传异常", e); throw new RenException("文件上传异常"); } //保存文件信息 @@ -148,13 +164,13 @@ public class OssServiceImpl extends BaseServiceImpl implement try { url = OssFactory.build().uploadSuffix(file.getBytes(), extension, null); } catch (IOException e) { - e.printStackTrace(); - logger.error("语音上传异常"); + logger.error("语音上传异常", e); throw new RenException("语音上传异常"); } //保存文件信息 OssEntity ossEntity = new OssEntity(); + ossEntity.setUrl(url); baseDao.insert(ossEntity); //文件信息 @@ -163,4 +179,36 @@ public class OssServiceImpl extends BaseServiceImpl implement return new Result().ok(dto); } + /** + * 删除附件 + * + * @return boolean + * @author zhaoqifeng + * @date 2021/3/30 9:55 + * @param formDTO + */ + @Override + public boolean articleRemoveFile(RemoveFileFormDTO formDTO) { + logger.info("articleRemoveFile param:{}", JSON.toJSONString(formDTO)); + if (StringUtils.isBlank(formDTO.getUrl())){ + logger.warn("articleRemoveFile param is empty"); + return false; + } + String key = RedisKeys.getOssFileKey(formDTO.getUrl().substring(formDTO.getUrl().lastIndexOf(StrConstant.SEPARATOR) +1)); + Object o = redisUtils.get(key); + if (o == null){ + return false; + } + redisUtils.delete(key); + String fileName = (String) o; + logger.info("articleRemoveFile oss delete fileName:{}", fileName); + OssFactory.build().delete(fileName,null); + OssEntity entity = baseDao.selectByUrl(formDTO.getUrl()); + if (entity != null){ + baseDao.deleteDataById(entity.getId()); + } + return true; + } + + } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java index a89b14fbd1..07a11d9ed7 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/utils/ModuleConstant.java @@ -26,6 +26,10 @@ public interface ModuleConstant extends Constant { * jpg文件类型 */ String FILE_CONTENT_TYPE_JPG = "image/jpg"; + /** + * pdf文件类型 + */ + String FILE_CONTENT_TYPE_PDF = "application/pdf"; /** * 项目附件-允许上传的文件类型 diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/mapper/SysOssDao.xml b/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/mapper/SysOssDao.xml index 2531640cb1..a7489f514b 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/mapper/SysOssDao.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/mapper/SysOssDao.xml @@ -2,5 +2,11 @@ + + delete from sys_oss where id = #{id} + + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index 8665b1921a..99a88c18a3 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java @@ -197,12 +197,14 @@ public class PointRuleServiceImpl extends BaseServiceImpl> customerListResult = operCrmOpenFeignClient.getAllCustomerList(); log.info("initPointRule operCrmOpenFeignClient.getAllCustomerList result:{}",JSON.toJSONString(customerListResult)); if (!customerListResult.success() || CollectionUtils.isEmpty(customerListResult.getData())) { throw new RenException("获取所有客户列表失败"); } List customerDTOList = customerListResult.getData(); + //获取默认规则列表 List ruleDefaultEntities = pointRuleDefaultDao.selectList(null); if (CollectionUtils.isEmpty(ruleDefaultEntities)) { log.warn("initPointRule pointRuleDefaultDao.selectList return empty"); @@ -211,15 +213,18 @@ public class PointRuleServiceImpl extends BaseServiceImpl insertList = new ArrayList<>(); + //获取全部默认规则code集合 List defaultEventCodeList = ruleDefaultEntities.stream().map(PointRuleDefaultEntity :: getEventCode).distinct().collect(Collectors.toList()); + //获取所有客户的积分规则 List customerRule = baseDao.selectList(null); if(!CollectionUtils.isEmpty(customerRule)){ + //key :: customerId || value :: 客户规则集合 Map> customerRuleMap = customerRule.stream().collect(Collectors.groupingBy(PointRuleEntity :: getCustomerId)); customerRuleMap.forEach((customerId,ruleList) -> { if(null != ruleList){ List event = new LinkedList<>(defaultEventCodeList); - //取差集 + //取差集,event只剩下当前客户没有的积分规则 event.removeAll(ruleList.stream().map(PointRuleEntity :: getEventCode).distinct().collect(Collectors.toList())); if(!CollectionUtils.isEmpty(event)){ ruleDefaultEntities.stream().filter(rule -> event.contains(rule.getEventCode())).map(o -> { @@ -238,7 +243,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl haveInitCustomerIds = baseDao.selectCustomerIds(); if (haveInitCustomerIds == null) { haveInitCustomerIds = new ArrayList<>(); @@ -249,6 +254,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl + * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuConfigFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuConfigFormDTO.java new file mode 100644 index 0000000000..1bd4fc67bc --- /dev/null +++ b/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 customerIds; +} diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuFormDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuFormDTO.java new file mode 100644 index 0000000000..83149065c5 --- /dev/null +++ b/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; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovCustomerMenuController.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovCustomerMenuController.java new file mode 100644 index 0000000000..77d498fb37 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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> page(@RequestParam Map params){ + PageData page = govCustomerMenuService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + GovCustomerMenuDTO data = govCustomerMenuService.get(id); + return new Result().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 params, HttpServletResponse response) throws Exception { + List 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> + * @Author zhangyong + * @Date 16:26 2021-03-16 + **/ + @PostMapping("getcustomerids") + public Result> getcustomerids(@RequestBody MenuFormDTO formDTO){ + List data = govCustomerMenuService.getcustomerIds(formDTO.getTableId()); + return new Result>().ok(data); + } +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovCustomerMenuDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovCustomerMenuDao.java new file mode 100644 index 0000000000..6daa27f116 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + + /** + * 根据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 + * @Author zhangyong + * @Date 16:29 2021-03-16 + **/ + List selectListcustomerIds(@Param("tableId") String tableId); +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java index 1e36bff758..ba05556dc1 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovMenuDao.java @@ -49,4 +49,13 @@ public interface GovMenuDao extends BaseDao { * @param pid 父菜单ID */ List getListPid(String pid); + + /** + * 查询客户菜单列表 + * + * @param customerId 客户id + * @param type 菜单类型 + * @param language 语言 + */ + List getCustomerMenuList(@Param("customerId") String customerId, @Param("type") Integer type, @Param("language") String language); } diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovCustomerMenuEntity.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovCustomerMenuEntity.java new file mode 100644 index 0000000000..d0358e7124 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/GovCustomerMenuExcel.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/GovCustomerMenuExcel.java new file mode 100644 index 0000000000..1ac8f2d886 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java new file mode 100644 index 0000000000..2333a6bd48 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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; + } + +} \ No newline at end of file diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovCustomerMenuService.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovCustomerMenuService.java new file mode 100644 index 0000000000..dea2a31ca0 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-03-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-03-16 + */ + List list(Map 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 + * @Author zhangyong + * @Date 16:29 2021-03-16 + **/ + List getcustomerIds(String tableId); + + /** + * 根据gov_menu表主键,先清除之前配置的客户信息 + * + * @param tableId + * @return void + * @Author zhangyong + * @Date 14:24 2021-03-16 + **/ + void deleteBatchTableIds(String tableId); +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java new file mode 100644 index 0000000000..32cf57e0c7 --- /dev/null +++ b/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 + *

+ * 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. + *

+ * 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. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +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 implements GovCustomerMenuService { + + @Autowired + private GovCustomerMenuRedis govCustomerMenuRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GovCustomerMenuDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GovCustomerMenuDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper 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 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 getcustomerIds(String tableId) { + return baseDao.selectListcustomerIds(tableId); + } + + @Override + public void deleteBatchTableIds(String tableId) { + baseDao.deleteBatchTableIds(tableId); + } +} diff --git a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java index 5a6efd43f2..4e4c142b55 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovMenuServiceImpl.java +++ b/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 page(Map params) { @@ -154,6 +153,9 @@ public class GovMenuServiceImpl extends BaseServiceImpl getUserMenuNavList(TokenDto tokenDto) { - List 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 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 + * @Author zhangyong + * @Date 15:51 2021-03-16 + **/ + private List getCustomerMenuList(String customerId, Integer type) { + List menuList = baseDao.getCustomerMenuList(customerId, type, HttpContextUtils.getLanguage()); + List dtoList = ConvertUtils.sourceToTarget(menuList, GovMenuDTO.class); + return TreeUtils.buildTree(dtoList); } @Override @@ -243,5 +261,4 @@ public class GovMenuServiceImpl extends BaseServiceImpl + + + + + + + + + + + + + + + + + + UPDATE gov_customer_menu SET DEL_FLAG = '1' + WHERE DEL_FLAG = '0' + AND TABLE_ID = #{tableId, jdbcType=VARCHAR} + + + + diff --git a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml b/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml index 90d0b8ee92..9ac55ce17b 100644 --- a/epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovMenuDao.xml +++ b/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} + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java index d6519fb6e9..f3320a96b8 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java @@ -115,6 +115,14 @@ public class IssueAuditController { return new Result>().ok(issueApplicationHistoryService.applicationHistoryWork(applicationHistoryWorkFormDTO)); } + /** + * @Description 工作端议题审核 + * @param token + * @param param + * @return java.lang.String + * @author wangc + * @date 2021.03.19 23:40 + */ @PostMapping("audit") public Result audit(@LoginUser TokenDto token, @RequestBody IssueAuditionFormDTO param){ return new Result().ok(issueService.audit(token,param)); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java index 0c58cfc807..4b14996149 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java @@ -152,7 +152,14 @@ public interface IssueService extends BaseService { * @date 2020.11.19 10:02 */ FirstTopicShiftedToIssueApplicationResultDTO topicShiftedToIssueV2(IssueShiftedFromTopicFormDTO issueShiftedFromTopicFormDTO); - + /** + * @Description 工作端议题审核 + * @param token + * @param param + * @return java.lang.String + * @author wangc + * @date 2021.03.19 23:40 + */ String audit(TokenDto token, IssueAuditionFormDTO param); /** diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 40fb145f77..b7d6c57015 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -443,6 +443,14 @@ public class IssueServiceImpl extends BaseServiceImpl imp return result; } + /** + * @Description 工作端议题审核 + * @param token + * @param param + * @return java.lang.String + * @author wangc + * @date 2021.03.19 23:40 + */ @Override @Transactional(rollbackFor = Exception.class) public String audit(TokenDto token, IssueAuditionFormDTO param){ diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index 003b0acd9e..258f91bd74 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -258,6 +258,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl issues = @@ -265,18 +266,20 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl ids = issues.stream().map(IssueDTO::getId).collect(Collectors.toSet()); List gridIds = issues.stream().map(IssueDTO::getGridId).distinct().collect(Collectors.toList()); CommonGridIdListFormDTO gridIdList = new CommonGridIdListFormDTO(); gridIdList.setGridIds(gridIds); + // 根据网格Id查询网格下所有加入组的组员 Result votableCountResult = resiGroupFeignClient.votableCounts(gridIdList); Map votableCountMap1 = null; if(votableCountResult.success() && null != votableCountResult.getData() && null != votableCountResult.getData().getVotableCountMap()){ votableCountMap1 = votableCountResult.getData().getVotableCountMap(); } final Map votableCountMap = votableCountMap1; - + //查询指定议题的统计数据 List statisticalList = baseDao.selectListByIds(ids); if (null != statisticalList && statisticalList.size() > NumConstant.ZERO) { diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml index 84d66f138b..71da21f685 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml @@ -23,6 +23,9 @@ + + + - \ No newline at end of file + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftContentDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftContentDao.xml index 906a248e3c..cd90573da5 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftContentDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftContentDao.xml @@ -9,6 +9,7 @@ CUSTOMER_ID, CONTENT, CONTENT_TYPE, + FILE_NAME, AUDIT_STATUS, AUDIT_REASON, ORDER_NUM @@ -28,7 +29,8 @@ SELECT ID, CONTENT, - CONTENT_TYPE + CONTENT_TYPE, + FILE_NAME FROM DRAFT_CONTENT WHERE @@ -41,4 +43,4 @@ DELETE FROM draft_content WHERE DRAFT_ID = #{draftId,jdbcType=VARCHAR} - \ No newline at end of file + diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml index 823e936884..a6675ddb4e 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml +++ b/epmet-module/gov-voice/gov-voice-server/src/main/resources/mapper/DraftDao.xml @@ -28,6 +28,7 @@ dc.ID, dc.CONTENT, dc.CONTENT_TYPE, + dc.FILE_NAME, dc.ORDER_NUM, (case when dc.AUDIT_STATUS is null then "" @@ -165,6 +166,7 @@ SELECT dc.CONTENT_TYPE, dc.CONTENT, + dc.FILE_NAME, dc.AUDIT_STATUS, dc.AUDIT_REASON FROM @@ -190,4 +192,4 @@ where id=#{draftId,jdbcType=VARCHAR} - \ No newline at end of file + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomerFunctionFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomerFunctionFormDTO.java index 83800e2af5..3f65de5bb8 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/UpdateCustomerFunctionFormDTO.java +++ b/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; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java index 0778f3d989..3a69b6da62 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionDetailController.java +++ b/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 diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java index bfbefc518d..8334159e8c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFunctionDetailDao.java @@ -73,6 +73,7 @@ public interface CustomerFunctionDetailDao extends BaseDao ICON_SMALL_IMG = #{iconSmallImg}, + + + DOMAIN_NAME = #{domainName}, + + + TARGET_LINK = #{targetLink}, + UPDATED_BY = #{userId}, UPDATED_TIME = now() WHERE diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberInfoRedisDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberInfoRedisDTO.java index 1bbabfc036..cb468c33fe 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberInfoRedisDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberInfoRedisDTO.java @@ -51,7 +51,7 @@ public class ResiGroupMemberInfoRedisDTO implements Serializable { * */ private String memberMobile; /** - * 组Id,不存在redis的value中,存在redis的key中 + * 组Id * */ private String groupId; @@ -64,7 +64,8 @@ public class ResiGroupMemberInfoRedisDTO implements Serializable { "userShowName": "山东路-尹女士", "groupLeaderFlag": "leader", "enterGroupType": "created", - "memberStatus": "approved" + "memberStatus": "approved", + "groupId":"***" } * * diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java index d635bd1dea..fcb7cb7b4a 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java @@ -18,6 +18,7 @@ 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; @@ -25,6 +26,7 @@ import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.modules.constant.ResiGroupRedisKeys; import com.epmet.modules.feign.EpmetUserFeignClient; @@ -85,7 +87,7 @@ public class ResiGroupMemberRedis { } /** - * @Description 得到一个指定组内成员信息,如果redis中没有,则返回null + * @Description 得到一个指定组内成员信息,如果redis中没有,则去数据库查询并放入缓存 * @Param groupId * @Param userId * @return ResiGroupMemberInfoRedisDTO.class @@ -97,7 +99,7 @@ public class ResiGroupMemberRedis { ResiGroupMemberInfoRedisDTO memberCache = (ResiGroupMemberInfoRedisDTO) redisUtils.get(ResiGroupRedisKeys.getResiGroupMemberInfoKey(groupId,userId)); //如果缓存中没有该成员数据 - if(null == memberCache || StringUtils.isNotBlank(memberCache.getUserId())){ + if(null == memberCache || StringUtils.isBlank(memberCache.getUserId())){ Map param = new HashMap<>(); param.put(TopicConstant.CUSTOMER_USER_ID,userId); param.put(TopicConstant.RESI_GROUP_ID,groupId); @@ -115,21 +117,34 @@ public class ResiGroupMemberRedis { memberRedis.setMemberStatus(memberMySql.getStatus()); - UserResiInfoFormDTO userParam = new UserResiInfoFormDTO(); - userParam.setUserId(memberMySql.getCustomerUserId()); - userParam.setCustomerId(groupService.get(groupId).getCustomerId()); - Result userInfo = epmetUserFeignClient.getUserResiInfoDTO(userParam); - if(userInfo.success()){ - if(null != userInfo.getData()){ - memberRedis.setUserShowName(userInfo.getData().getShowName()); - memberRedis.setUserHeadPhoto(userInfo.getData().getHeadPhoto()); - memberRedis.setMemberMobile(userInfo.getData().getRegMobile()); + + Map map = redisUtils.hGetAll(String.format("epmet:resi:user:%s",userId)); + if(null != map && !map.isEmpty()) { + //缓存中有数据,直接返回 + UserBaseInfoResultDTO userInfo = + BeanUtil.mapToBean(map, UserBaseInfoResultDTO.class, true); + if(null != userInfo){ + memberRedis.setUserShowName(userInfo.getShowName()); + memberRedis.setUserHeadPhoto(userInfo.getHeadImgUrl()); + memberRedis.setMemberMobile(userInfo.getMobile()); + set(memberRedis); + } + }else { + UserResiInfoFormDTO userParam = new UserResiInfoFormDTO(); + userParam.setUserId(memberMySql.getCustomerUserId()); + userParam.setCustomerId(groupService.get(groupId).getCustomerId()); + Result userInfo = epmetUserFeignClient.getUserResiInfoDTO(userParam); + if (userInfo.success()) { + if (null != userInfo.getData()) { + memberRedis.setUserShowName(userInfo.getData().getShowName()); + memberRedis.setUserHeadPhoto(userInfo.getData().getHeadPhoto()); + memberRedis.setMemberMobile(userInfo.getData().getRegMobile()); + set(memberRedis); + } + } else { + logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); } - }else{ - logger.warn(ModuleConstant.USER_INFO_LIST_NOT_FOUND); } - - set(memberRedis); return memberRedis; }else{ //日志打印效果:找不到组员信息,组Id: ********,用户Id:******** @@ -140,7 +155,6 @@ public class ResiGroupMemberRedis { .concat(userId)); } } - memberCache.setGroupId(groupId); return memberCache; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index d420a7205b..33c2af52a6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -814,9 +814,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl votableCountMap = new HashMap<>(); + // 给每个网格初始化 加入小组人数:0 gridList.getGridIds().forEach(gridId -> { votableCountMap.put(gridId, NumConstant.ZERO ); }); + // 查询 每个网格的人数 STATE = approved的 List list = baseDao.getMembersCountInGrids(gridList.getGridIds()); if(null == list || list.size() < NumConstant.ZERO){ result.setVotableCountMap(votableCountMap); diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index d48703ffb4..3332aec3a1 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -486,4 +486,14 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping(value = "/epmetuser/user/saveuserinfo") Result saveUserInfo(@RequestBody UserInfoFormDTO formDTO); + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param customerId + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:35 + **/ + @GetMapping(value = "/epmetuser/govstaffrole/querycustomergovrolelist/{customerId}") + Result> queryCustomerGovRoleList(@PathVariable("customerId")String customerId); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 195f1a0c38..c1944b43a3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -337,8 +337,21 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserInfo", formDTO); } + /** + * @param customerId + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:35 + **/ + @Override + public Result> queryCustomerGovRoleList(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryCustomerGovRoleList", customerId); + } + @Override public Result initGovStaffRolesForCustomer(String customerId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initGovStaffRolesForCustomer", customerId); } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java index 40cab6cb5a..37df7c9140 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java @@ -9,6 +9,7 @@ import com.epmet.dto.form.GovStaffRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; +import com.epmet.dto.result.RoleInfoResultDTO; import com.epmet.service.GovStaffRoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; @@ -112,4 +113,15 @@ public class GovStaffRoleController { return new Result>().ok(roles); } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param customerId + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:37 + **/ + @GetMapping("querycustomergovrolelist/{customerId}") + Result> queryCustomerGovRoleList(@PathVariable("customerId") String customerId){ + return new Result>().ok(govStaffRoleService.queryCustomerGovRoleList(customerId)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java index a8fc12840e..41e4a1114a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java @@ -201,6 +201,16 @@ public class UserResiInfoController { return new Result(); } + /** + * @Description 在分享链接之后完成注册居民之后调用的接口 + * 作用 + * + * 更改邀请浏览记录里"是否通过邀请链接注册居民" + * @param param + * @return void + * @author wangc + * @date 2020.12.18 16:34 + */ @PostMapping("submitinlink") public Result submitInLink(@RequestBody AfterRegisterResidentInSharableLinkFormDTO param, @LoginUser TokenDto token){ param.setInviteeId(token.getUserId()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 346fad61b2..6ee17905c2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -23,6 +23,7 @@ import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; +import com.epmet.dto.result.RoleInfoResultDTO; import com.epmet.entity.GovStaffRoleEntity; import java.util.List; @@ -140,4 +141,13 @@ public interface GovStaffRoleService extends BaseService { void saveSortOrder(List roleIdList); List listRolesByRoleKey(String roleKey); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:37 + **/ + List queryCustomerGovRoleList(String customerId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index 16c6a375e2..15a8b10483 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -20,20 +20,17 @@ 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.FieldConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.GovStaffRoleDao; import com.epmet.dao.GovStaffRoleTemplateDao; import com.epmet.dao.RoleDao; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.InitDefaultOperationsFormDTO; -import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.GovStaffRoleTemplateDTO; -import com.epmet.dto.result.ResiGovRoleListResultDTO; -import com.epmet.dto.result.ResiGovRoleResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.feign.GovAccessFeignClient; import com.epmet.redis.GovStaffRoleRedis; @@ -242,4 +239,28 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRolesByRoleKey(String roleKey) { return govStaffRoleDao.listRolesByRoleKey(roleKey); } + + /** + * @param customerId + * @return java.util.List + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:37 + **/ + @Override + public List queryCustomerGovRoleList(String customerId) { + List resultList=new ArrayList<>(); + GovStaffRoleDTO govStaffRoleDTO=new GovStaffRoleDTO(); + govStaffRoleDTO.setCustomerId(customerId); + List roleList = this.getGovStaffRoleList(govStaffRoleDTO); + roleList.forEach(role->{ + RoleInfoResultDTO resultDTO=new RoleInfoResultDTO(); + resultDTO.setFullTimeOnly(role.getFullTimeOnly()); + resultDTO.setRoleId(role.getId()); + resultDTO.setRoleName(role.getRoleName()); + resultDTO.setRoleKey(role.getRoleKey()); + resultList.add(resultDTO); + }); + return resultList; + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java index 852ca55843..e779487861 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java @@ -383,11 +383,10 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl govOrgResult = govOrgOpenFeignClient.userInfoExt(result); - if(govOrgResult.success() && null != govOrgResult.getData()){ - return govOrgResult.getData();} - + if (govOrgResult.success() && null != govOrgResult.getData()) { + return govOrgResult.getData(); + } return result; } }