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-admin/epmet-admin-server/src/main/resources/bootstrap.yml b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml index 7ecdd66d2b..89f42ed404 100644 --- a/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml +++ b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /sys @@ -112,7 +113,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true @@ -132,4 +133,4 @@ ribbon: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 5015feb391..5af5eae312 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -200,9 +200,15 @@ - http://101.206.141.251:21006 - soXDEoM1 - V7ea0KnlYt7eSyzc + http://101.206.141.251:21006 + soXDEoM1 + V7ea0KnlYt7eSyzc + + http://101.206.141.219:21006 + xSMONWwP + UUCnxLyXiB4eBF4p + + https://epmet-cloud.elinkservice.cn @@ -249,9 +255,15 @@ - http://101.206.141.251:21006 - soXDEoM1 - V7ea0KnlYt7eSyzc + http://101.206.141.251:21006 + soXDEoM1 + V7ea0KnlYt7eSyzc + + http://101.206.141.219:21006 + xSMONWwP + UUCnxLyXiB4eBF4p + + https://epmet-cloud.elinkservice.cn @@ -293,9 +305,15 @@ - http://101.206.141.251:21006 - soXDEoM1 - V7ea0KnlYt7eSyzc + http://101.206.141.251:21006 + soXDEoM1 + V7ea0KnlYt7eSyzc + + http://101.206.141.219:21006 + xSMONWwP + UUCnxLyXiB4eBF4p + + https://epmet-cloud.elinkservice.cn @@ -341,9 +359,15 @@ - https://jcytc.lzjczl.com:21009 - 2cy0a9lA - 6hU3PQgxLcXr27SE + https://jcytc.lzjczl.com:21009 + 2cy0a9lA + 6hU3PQgxLcXr27SE + + http://101.206.141.219:21006 + xSMONWwP + UUCnxLyXiB4eBF4p + + https://epmet-cloud.elinkservice.cn diff --git a/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java b/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java index e096c6a65a..8a85cb9da4 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/GovWebController.java @@ -1,19 +1,22 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.RSASignature; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.GovWebLoginFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.GovWebService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; + /** - * @Description PC工作端-登陆服务 * @author sun + * @Description PC工作端-登陆服务 */ @RestController @RequestMapping("govweb") @@ -21,7 +24,10 @@ public class GovWebController { @Autowired private GovWebService govWebService; - + @Value("${epmet.login.publicKey}") + private String publicKey; + @Value("${epmet.login.privateKey}") + private String privateKey; /** * @param formDTO @@ -32,8 +38,30 @@ public class GovWebController { @PostMapping("login") public Result workLogin(@RequestBody GovWebLoginFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); + + try { + if (formDTO.getPassword().length() > 50) { + String newPassword = RSASignature.decryptByPrivateKey(formDTO.getPassword(), privateKey); + formDTO.setPassword(newPassword); + } + + } catch (Exception e) { + e.printStackTrace(); + } return new Result().ok(govWebService.login(formDTO)); } + /** + * desc: 获取前端密码加密 公钥 + * + * @return com.epmet.commons.tools.utils.Result + * @author LiuJanJun + * @date 2021/3/8 5:07 下午 + */ + @PostMapping("getKey") + public Result getPubKey() { + return new Result().ok(publicKey); + } + } diff --git a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java index 45c8950d9c..f70495eb51 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/LoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/LoginController.java @@ -12,6 +12,7 @@ import com.epmet.dto.form.ResiWxPhoneFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.CaptchaService; import com.epmet.service.LoginService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -28,6 +29,7 @@ import java.io.IOException; * @Author yinzuomei * @Date 2020/3/14 13:58 */ +@Slf4j @RestController @RequestMapping("login") public class LoginController { @@ -47,15 +49,20 @@ public class LoginController { **/ @GetMapping("captcha") public void captcha(HttpServletResponse response, String uuid) throws IOException { - //uuid不能为空 - AssertUtils.isBlank(uuid, ErrorCode.IDENTIFIER_NOT_NULL); - //生成图片验证码 - BufferedImage image = captchaService.create(uuid); - response.setHeader("Cache-Control", "no-store, no-cache"); - response.setContentType("image/jpeg"); - ServletOutputStream out = response.getOutputStream(); - ImageIO.write(image, "jpg", out); - out.close(); + try { + //uuid不能为空 + AssertUtils.isBlank(uuid, ErrorCode.IDENTIFIER_NOT_NULL); + //生成图片验证码 + BufferedImage image = captchaService.create(uuid); + response.reset(); + response.setHeader("Cache-Control", "no-store, no-cache"); + response.setContentType("image/jpeg"); + ServletOutputStream out = response.getOutputStream(); + ImageIO.write(image, "jpg", out); + out.close(); + } catch (IOException e) { + log.error("获取登陆验证码异常", e); + } } /** diff --git a/epmet-auth/src/main/java/com/epmet/controller/SsoController.java b/epmet-auth/src/main/java/com/epmet/controller/SsoController.java index 86fc44aa18..6f19f29e62 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/SsoController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/SsoController.java @@ -6,6 +6,8 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.SsoEnteOrgFormDTO; import com.epmet.dto.form.SsoLoginFormDTO; +import com.epmet.dto.form.SsoWorkLoginFormDTO; +import com.epmet.dto.form.SsoLoginOperFormDTO; import com.epmet.dto.result.SsoLoginResultDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.SsoService; @@ -30,22 +32,34 @@ public class SsoController { private JcetApiService jcetApiService; /** - * @Description 0、入口:得到token + * @Description 0、泸州app登陆入口:得到token * @Param formDTO * @author zxc * @date 2021/1/18 下午4:59 */ @PostMapping("resi/login") - public Result ssoLogin(@RequestBody SsoLoginFormDTO formDTO){ + public Result ssoResiLogin(@RequestBody SsoLoginFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class); - return new Result().ok(ssoService.ssoLogin(formDTO)); + return new Result().ok(ssoService.ssoResiLogin(formDTO)); + } + + /** + * @Description 0、第三方系统跳转至 运营平台登陆接口 + * @Param formDTO + * @author zxc + * @date 2021/1/18 下午4:59 + */ + @PostMapping("oper/third/login") + public Result thirdLoginOper(@RequestBody SsoLoginOperFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, SsoLoginOperFormDTO.ThirdPlatformLoginForm.class); + return new Result().ok(ssoService.thirdLoginOperWork(formDTO)); } @PostMapping("test") - public Result testssoLogin(){ + public Result testssoLogin() { ThirdPlatUserInfo userInfoByTicket = null; try { - userInfoByTicket = jcetApiService.getUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui"); + userInfoByTicket = jcetApiService.getCUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui"); } catch (Exception e) { e.printStackTrace(); } @@ -58,8 +72,8 @@ public class SsoController { * @Description 1、ticket自动登录获取内部token **/ @PostMapping("work/login") - public Result ssoWorkLogin(@RequestBody SsoLoginFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, SsoLoginFormDTO.SsoLoginForm.class); + public Result ssoWorkLogin(@RequestBody SsoWorkLoginFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, SsoWorkLoginFormDTO.SsoLoginForm.class); return new Result().ok(ssoService.ssoWorkLogin(formDTO)); } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java index 4706061267..d74deaf828 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/SsoEnteOrgFormDTO.java @@ -15,10 +15,10 @@ public class SsoEnteOrgFormDTO implements Serializable { public interface AddUserInternalGroup {} public interface AddUserShowGroup extends CustomerClientShowGroup {} /** - * wxCode + * sso票据,有效期为300秒 */ - @NotBlank(message = "ticket不能为空",groups = {AddUserInternalGroup.class}) - private String ticket; + @NotBlank(message = "ssotoken不能为空",groups = SsoWorkLoginFormDTO.SsoLoginForm.class) + private String token; /** * 手机号 diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginFormDTO.java index eea5394ed5..0e2ee7cf40 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginFormDTO.java @@ -19,7 +19,7 @@ public class SsoLoginFormDTO implements Serializable { /** * sso票据,有效期为300秒 */ - @NotBlank(message = "sso票据不能为空",groups = SsoLoginForm.class) + @NotBlank(message = "sso票据不能为空", groups = {SsoLoginForm.class}) private String ticket; /** @@ -31,12 +31,12 @@ public class SsoLoginFormDTO implements Serializable { /** * app类型 resi;居民段,gov:工作端 */ - @NotBlank(message = "app不能为空",groups = SsoLoginForm.class) + @NotBlank(message = "app不能为空", groups = SsoLoginForm.class) private String app; /** * app;居民段,app:工作端 */ - @NotBlank(message = "client不能为空",groups = SsoLoginForm.class) + @NotBlank(message = "client不能为空", groups = SsoLoginForm.class) private String client; } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java new file mode 100644 index 0000000000..2084287984 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/SsoLoginOperFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * @Author zxc + * @DateTime 2021/1/18 下午4:43 + */ +@Data +public class SsoLoginOperFormDTO extends LoginCommonFormDTO { + + private static final long serialVersionUID = -4215746830030486659L; + + public interface ThirdPlatformLoginForm { + } + + /** + * 上游系统token + */ + @NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class}) + private String thirdToken; + + /** + * 上游系统标识 + * + * @see com.epmet.enums.ThirdPlatformEnum + */ + @NotBlank(message = "平台标识不能为空", groups = {ThirdPlatformLoginForm.class}) + private String platform; +} diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.java new file mode 100644 index 0000000000..32ff9aa00b --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/SsoWorkLoginFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/1/18 下午4:43 + */ +@Data +public class SsoWorkLoginFormDTO implements Serializable { + + private static final long serialVersionUID = -6543952487970013031L; + + public interface SsoLoginForm{} + + /** + * sso票据,有效期为300秒 + */ + @NotBlank(message = "ssotoken不能为空",groups = SsoLoginForm.class) + private String token; + + /** + * 三方平台应用AppId + */ + @NotBlank(message = "三方平台应用AppId不能为空",groups = SsoLoginForm.class) + private String appId; + + /** + * app类型 resi;居民段,gov:工作端 + */ + @NotBlank(message = "app不能为空",groups = SsoLoginForm.class) + private String app; + + /** + * app;居民段,app:工作端 + */ + @NotBlank(message = "client不能为空",groups = SsoLoginForm.class) + private String client; +} diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ThirdPlatFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdPlatFormDTO.java new file mode 100644 index 0000000000..ea97c2c685 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdPlatFormDTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/1/18 下午4:43 + */ +@Data +public class ThirdPlatFormDTO implements Serializable { + + private static final long serialVersionUID = -6543952487970013031L; + + public interface SsoLoginForm { + } + + public interface ThirdPlatformLoginForm { + } + + /** + * sso票据,有效期为300秒 + */ + @NotBlank(message = "sso票据不能为空", groups = {SsoLoginForm.class, ThirdPlatformLoginForm.class}) + private String ticket; + + /** + * 三方平台应用AppId + */ + @NotBlank(message = "三方平台应用AppId不能为空", groups = SsoLoginForm.class) + private String appId; + + /** + * app类型 resi;居民段,work:工作端 + */ + @NotBlank(message = "app不能为空", groups = SsoLoginForm.class) + private String app; + + @NotBlank(message = "client不能为空", groups = SsoLoginForm.class) + private String client; + + /** + * 上游系统token + */ + @NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class}) + private String thirdToken; + + /** + * 上游系统token + * + * @see com.epmet.enums.ThirdPlatformEnum + */ + @NotBlank(message = "token不能为空", groups = {ThirdPlatformLoginForm.class}) + private String platform; +} diff --git a/epmet-auth/src/main/java/com/epmet/dto/result/UserTokenResultDTO.java b/epmet-auth/src/main/java/com/epmet/dto/result/UserTokenResultDTO.java index 8e4b715422..c7ce124a75 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/result/UserTokenResultDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/result/UserTokenResultDTO.java @@ -17,4 +17,5 @@ public class UserTokenResultDTO implements Serializable { * 令牌 */ private String token; + private String customerId; } diff --git a/epmet-auth/src/main/java/com/epmet/enums/ThirdPlatformEnum.java b/epmet-auth/src/main/java/com/epmet/enums/ThirdPlatformEnum.java new file mode 100644 index 0000000000..d64df0fd1a --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/enums/ThirdPlatformEnum.java @@ -0,0 +1,50 @@ +package com.epmet.enums; + +/** + * 系统环境变量枚举类 + * dev|test|prod + * + * @author jianjun liu + * @date 2020-07-03 11:14 + **/ +public enum ThirdPlatformEnum { + /** + * 平阴联动指挥平台 + */ + PINGYIN_LIANDONG("pyld", "平阴联动指挥平台", "pyldApiService"), + ; + + private String code; + private String name; + private String apiService; + + + ThirdPlatformEnum(String code, String name, String apiService) { + this.code = code; + this.name = name; + this.apiService = apiService; + } + + public static ThirdPlatformEnum getEnum(String code) { + ThirdPlatformEnum[] values = ThirdPlatformEnum.values(); + for (ThirdPlatformEnum value : values) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + + + public String getCode() { + return code; + } + + public String getName() { + return name; + } + + public String getApiService() { + return apiService; + } +} diff --git a/epmet-auth/src/main/java/com/epmet/service/SsoService.java b/epmet-auth/src/main/java/com/epmet/service/SsoService.java index a2986482ab..4cc9c93ba7 100644 --- a/epmet-auth/src/main/java/com/epmet/service/SsoService.java +++ b/epmet-auth/src/main/java/com/epmet/service/SsoService.java @@ -2,6 +2,8 @@ package com.epmet.service; import com.epmet.dto.form.SsoEnteOrgFormDTO; import com.epmet.dto.form.SsoLoginFormDTO; +import com.epmet.dto.form.SsoLoginOperFormDTO; +import com.epmet.dto.form.SsoWorkLoginFormDTO; import com.epmet.dto.result.SsoLoginResultDTO; import com.epmet.dto.result.UserTokenResultDTO; @@ -12,19 +14,19 @@ import com.epmet.dto.result.UserTokenResultDTO; public interface SsoService { /** - * @Description 0、入口:得到token + * @Description 0、入口:得到token * @Param formDTO * @author zxc * @date 2021/1/18 下午4:59 */ - SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO); + SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO); /** * @param formDTO * @Author sun * @Description 1、ticket自动登录获取内部token **/ - UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO); + UserTokenResultDTO ssoWorkLogin(SsoWorkLoginFormDTO formDTO); /** * @param formDTO @@ -32,4 +34,14 @@ public interface SsoService { * @Description 4、自动进入组织-返回token **/ UserTokenResultDTO enterOrg(SsoEnteOrgFormDTO formDTO); + + /** + * desc: sso登陆运营端 + * + * @param formDTO + * @return com.epmet.dto.result.UserTokenResultDTO + * @author LiuJanJun + * @date 2021/2/24 1:28 下午 + */ + UserTokenResultDTO thirdLoginOperWork(SsoLoginOperFormDTO formDTO); } 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/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index ee60b3c22f..88f9f1a5a2 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -362,7 +362,7 @@ public class GovLoginServiceImpl implements GovLoginService { } //密码错误 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-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java index 9631436b98..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 @@ -10,10 +10,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.GovWebLoginFormDTO; import com.epmet.dto.form.GovWebOperLoginFormDTO; -import com.epmet.dto.form.LoginByPassWordFormDTO; -import com.epmet.dto.form.PasswordLoginUserInfoFormDTO; import com.epmet.dto.result.GovWebOperLoginResultDTO; -import com.epmet.dto.result.PasswordLoginUserInfoResultDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.jwt.JwtTokenProperties; @@ -65,7 +62,7 @@ public class GovWebServiceImpl implements GovWebService { //2.验证码校验 boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); if (!flag) { - logger.error(String.format("用户%s登录,验证码输入错误,暂时放行", formDTO.getPhone())); + logger.warn(String.format("用户%s登录,验证码输入错误", formDTO.getPhone())); //开启验证码校验 throw new RenException(EpmetErrorCode.ERR10019.getCode()); } @@ -84,7 +81,7 @@ public class GovWebServiceImpl implements GovWebService { //4.密码是否正确 //密码错误 if (!PasswordUtils.matches(formDTO.getPassword(), resultDTO.getPassWord())) { - logger.error("登陆密码错误"); + logger.warn("登陆密码错误"); throw new RenException(EpmetErrorCode.ERR10004.getCode()); } @@ -109,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/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index adadb9b626..27f7e71fe5 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -293,9 +293,9 @@ public class LoginServiceImpl implements LoginService { //1、验证码是否正确 boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); if (!flag) { - logger.error(String.format("用户%s登录,验证码输入错误,暂时放行",formDTO.getPhone())); - //2020-05-21去除验证码校验 TODO - //return new Result().error(EpmetErrorCode.ERR10019.getCode()); + logger.warn(String.format("用户%s登录,验证码输入错误", formDTO.getPhone())); + //2020-05-21去除验证码校验 + return new Result().error(EpmetErrorCode.ERR10019.getCode()); } //2、账号是否存在 //获取用户信息 diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java index 67d00ea4e6..f051924c9e 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.thirdplat.apiservice.AbstractApiService; import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; +import com.epmet.commons.thirdplat.constants.PyldConstants; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; @@ -14,6 +15,8 @@ import com.epmet.commons.tools.utils.*; import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; +import com.epmet.enums.ThirdPlatformEnum; +import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.OperCrmOpenFeignClient; @@ -22,13 +25,16 @@ import com.epmet.jwt.JwtTokenUtils; import com.epmet.redis.SsoRedis; import com.epmet.service.SsoService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -66,15 +72,22 @@ public class SsoServiceImpl implements SsoService { @Autowired private CpUserDetailRedis cpUserDetailRedis; + @Autowired + private EpmetUserFeignClient epmetUserFeignClient; + + @Value("${epmet.third.urlPrefix}") + private String epmetThirdUrlPrefix; + /** - * @Description 0、入口:得到token + * @Description 0、入口:得到token * @Param formDTO * @author zxc * @date 2021/1/18 下午4:59 */ @Override - public SsoLoginResultDTO ssoLogin(SsoLoginFormDTO formDTO) { + public SsoLoginResultDTO ssoResiLogin(SsoLoginFormDTO formDTO) { String customerId = getCustomerId(formDTO.getAppId()); + //String customerId = "3a4f923665a7a07701bcb311aac9a156"; String userId = ""; Result apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId)); @@ -89,7 +102,7 @@ public class SsoServiceImpl implements SsoService { ThirdPlatUserInfo userInfo; try { AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); - userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); + userInfo = apiService.getCUserInfoByTicket(formDTO.getTicket()); } catch (Exception e) { throw new RenException(e.getMessage()); } @@ -114,18 +127,66 @@ public class SsoServiceImpl implements SsoService { throw new RenException("【SSO登录】userId为空,生成token失败"); } //生成业务token - String token = this.generateToken(formDTO.getApp(),formDTO.getClient(), userId); + String token = this.generateToken(formDTO.getApp(), formDTO.getClient(), userId); //存放Redis - if (StringUtils.isBlank(customerId)){ + if (StringUtils.isBlank(customerId)) { throw new RenException("【SSO登录】customerId为空,缓存放置token失败"); } - this.disposeTokenDto(formDTO, userId, token, customerId); + this.disposeTokenDto(formDTO.getApp(), formDTO.getClient(), userId, token, customerId); return new SsoLoginResultDTO(token); } + @Override + public UserTokenResultDTO thirdLoginOperWork(SsoLoginOperFormDTO formDTO) { + ThirdPlatUserInfo thirdUser; + try { + ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform()); + String apiService = platformEnum.getApiService(); + AbstractApiService apiServiceImpl = (AbstractApiService) SpringContextUtils.getBean(apiService); + thirdUser = apiServiceImpl.getGUserInfoBySSOToken(formDTO.getThirdToken()); + } catch (RenException e) { + throw new RenException(e.getCode(), e.getMessage()); + } catch (Exception e) { + throw new RenException(e.getMessage()); + } + if (thirdUser == null) { + throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), PyldConstants.REPONSE_USER_NOT_LOGIN); + } + //获取用户信息 + GovWebOperLoginFormDTO form = new GovWebOperLoginFormDTO(); + form.setCustomerId(thirdUser.getCustomerId()); + form.setMobile(thirdUser.getMobile()); + Result result = epmetUserFeignClient.getStaffIdAndPwd(form); + //todo userId 写死测试 3f7f852ce22c511aa67ecb695395295d start + /* GovWebOperLoginResultDTO demo = new GovWebOperLoginResultDTO(); + demo.setUserId("3f7f852ce22c511aa67ecb695395295d"); + result = new Result<>(); + result.ok(demo);*/ + //test end + + if (!result.success() || null == result.getData() || null == result.getData().getUserId()) { + logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在,param:{}", JSON.toJSONString(form)); + throw new RenException(EpmetErrorCode.ERR10003.getCode()); + } + + //4、生成token返回,且将TokenDto存到redis + //生成业务token + GovWebOperLoginResultDTO epmetUser = result.getData(); + + + String token = this.generateToken(formDTO.getApp(), formDTO.getClient(), epmetUser.getUserId()); + //存放Redis + + this.disposeTokenDto(formDTO.getApp(), formDTO.getClient(), epmetUser.getUserId(), token, thirdUser.getCustomerId()); + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + userTokenResultDTO.setCustomerId(thirdUser.getCustomerId()); + return userTokenResultDTO; + } + /** - * @Description token放缓存 + * @Description token放缓存 * @Param formDTO * @Param userId * @Param token @@ -133,12 +194,12 @@ public class SsoServiceImpl implements SsoService { * @author zxc * @date 2021/1/18 下午5:32 */ - public void disposeTokenDto(SsoLoginFormDTO formDTO, String userId, String token, String customerId){ + public void disposeTokenDto(String app, String client, String userId, String token, String customerId) { int expire = jwtTokenProperties.getExpire(); TokenDto tokenDto = new TokenDto(); tokenDto.setCustomerId(customerId); - tokenDto.setApp(formDTO.getApp()); - tokenDto.setClient(formDTO.getClient()); + tokenDto.setApp(app); + tokenDto.setClient(client); tokenDto.setUserId(userId); tokenDto.setToken(token); tokenDto.setUpdateTime(System.currentTimeMillis()); @@ -155,7 +216,7 @@ public class SsoServiceImpl implements SsoService { * @author zxc * @date 2021/1/18 下午5:14 */ - private String generateToken(String app,String client, String userId) { + private String generateToken(String app, String client, String userId) { Map map = new HashMap<>(16); map.put("app", app); map.put("client", client); @@ -173,7 +234,7 @@ public class SsoServiceImpl implements SsoService { */ public String getCustomerId(String appId){ JSONObject jsonObject = new JSONObject(); - String customerMsgUrl = "https://epmet-cloud.elinkservice.cn/api/third/customermp/getcustomermsg/"; + String customerMsgUrl = epmetThirdUrlPrefix + "/api/third/customermp/getcustomermsg/"; String data = HttpClientManager.getInstance().sendPostByJSON(customerMsgUrl + appId, JSON.toJSONString(jsonObject)).getData(); log.info("调用third服务,根据appId查询客户信息:httpclient->url:" + customerMsgUrl + ",结果->" + data); JSONObject toResult = JSON.parseObject(data); @@ -199,10 +260,11 @@ public class SsoServiceImpl implements SsoService { * @Description 1、ticket自动登录获取内部token **/ @Override - public UserTokenResultDTO ssoWorkLogin(SsoLoginFormDTO formDTO) { + public UserTokenResultDTO ssoWorkLogin(SsoWorkLoginFormDTO formDTO) { //1.根据appId查询客户id String customerId = getCustomerId(formDTO.getAppId()); + //String customerId = "3a4f923665a7a07701bcb311aac9a156"; //2.客户Id换取第三方apiService,根据ticket换取华为Id Result apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(customerId)); @@ -215,7 +277,7 @@ public class SsoServiceImpl implements SsoService { ThirdPlatUserInfo userInfo; try { AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); - userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); + userInfo = apiService.getGUserInfoBySSOToken(formDTO.getToken()); } catch (Exception e) { throw new RenException(e.getMessage()); } @@ -297,7 +359,7 @@ public class SsoServiceImpl implements SsoService { int expire = jwtTokenProperties.getExpire(); GovTokenDto govTokenDto = new GovTokenDto(); govTokenDto.setApp(LoginConstant.APP_GOV); - govTokenDto.setClient(LoginConstant.CLIENT_WXMP); + govTokenDto.setClient(LoginConstant.CLIENT_APP); govTokenDto.setUserId(staffLatestAgency.getStaffId()); govTokenDto.setOpenId(userInfo.getOpenId()); govTokenDto.setSessionKey(""); @@ -423,21 +485,21 @@ public class SsoServiceImpl implements SsoService { //2.客户Id换取第三方apiService,根据ticket换取华为Id Result apiServiceResult = operCrmOpenFeignClient.getApiServiceByCustomerId(new ApiServiceFormDTO(formDTO.getCustomerId())); if (!apiServiceResult.success()) { - throw new RenException("【SSO登录】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg()); + throw new RenException("【SSO enterOrg】调用OperCrm获取ApiService接口失败:", apiServiceResult.getInternalMsg()); } if (apiServiceResult.getData() == null || StringUtils.isBlank(apiServiceResult.getData().getApiServiceName())) { - throw new RenException("【SSO登录】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString()); + throw new RenException("【SSO enterOrg】调用OperCrm获取ApiService,查询到的结果为空:", apiServiceResult.toString()); } ThirdPlatUserInfo userInfo; try { AbstractApiService apiService = (AbstractApiService) SpringContextUtils.getBean(apiServiceResult.getData().getApiServiceName()); - userInfo = apiService.getUserInfoByTicket(formDTO.getTicket()); + userInfo = apiService.getGUserInfoBySSOToken(formDTO.getToken()); } catch (Exception e) { throw new RenException(e.getMessage()); } if (null == userInfo){ throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), - "【SSO登录】调用第三方平台查询用户信息失败,用户信息为空"); + "【SSO enterOrg】调用第三方平台查询用户信息失败,用户信息为空"); } //3、记录staff_wechat,并记录用户激活状态,激活时间 @@ -466,4 +528,25 @@ public class SsoServiceImpl implements SsoService { return userTokenResultDTO; } + + public static void main(String[] args) { + String url = "https://epmet-ext9.elinkservice.cn/platform/unifiedAuth/loginCheck"; + String platformToken = "1348803062424166401_dd08e23b0d524879a5c67e7f2ffd1468"; + String appId = "7a5aec009ba4eba8e254ee64fe3775e1"; + String appKey = "14faef9af508d1c253b720ea5a43f9de"; + String appSecret = "38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595"; + long ts = System.currentTimeMillis(); + String message = appId + appKey + appSecret + ts; + String accessToken = DigestUtils.md5Hex(message.getBytes(StandardCharsets.UTF_8)); + //ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum("pyld"); + JSONObject jsonObject = new JSONObject(); + jsonObject.put("platformToken", platformToken); + + Map headerMap = new HashMap<>(4); + headerMap.put("AppKey", appKey); + headerMap.put("Timestamp", ts); + headerMap.put("AccessToken", accessToken); + Result stringResult = HttpClientManager.getInstance().sendPost(url, url.startsWith("https://"), jsonObject.toJSONString(), headerMap); + System.out.println(stringResult); + } } 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 d1cc70552e..4363556cf9 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-auth/src/main/resources/bootstrap.yml b/epmet-auth/src/main/resources/bootstrap.yml index 6efee6a635..b7cc83fd9c 100644 --- a/epmet-auth/src/main/resources/bootstrap.yml +++ b/epmet-auth/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /auth @@ -70,7 +71,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -135,7 +136,24 @@ shutdown: # 调用第三方平台相关参数 thirdplat: - jcet: - domain: @thirdplat.jcet.domain@ - appkey: @thirdplat.jcet.appkey@ - appsecret: @thirdplat.jcet.appsecret@ \ No newline at end of file + jcetCend: + domain: @thirdplat.jcet.c.domain@ + appkey: @thirdplat.jcet.c.appkey@ + appsecret: @thirdplat.jcet.c.appsecret@ + jcetGend: + domain: @thirdplat.jcet.g.domain@ + appkey: @thirdplat.jcet.g.appkey@ + appsecret: @thirdplat.jcet.g.appsecret@ + pyld: + domain: https://epmet-ext9.elinkservice.cn/platform + appId: 7a5aec009ba4eba8e254ee64fe3775e1 + appKey: 14faef9af508d1c253b720ea5a43f9de + appSecret: 38e7c2604c8dd33c445705d25eebbfc12a2f7ed8a87111e9e10a40312d3a1595 + +epmet: + login: + publicKey: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKjgDaHWqWgquoatbC4zzQCgqE8C425VIOyzJVVgH1HUYCHpuNUnGCv3HBAl2RsziWQqQgd1xxl0C3a5J4J69o8CAwEAAQ== + privateKey: MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEAqOANodapaCq6hq1sLjPNAKCoTwLjblUg7LMlVWAfUdRgIem41ScYK/ccECXZGzOJZCpCB3XHGXQLdrkngnr2jwIDAQABAkAyYaWvgrtHuHetdk+v+QRQC54q9FGluP/5nfilX+f4IUf8j92o/ZohTtmJn9qcDiAP4wxCLIsfy4IW3psST78BAiEA0A/E0WvtI7spWnjfw+wMDhdVMIbIJvDbj/cqMwRZInUCIQDPyO2sbXpwDjmAvyn0jpGJJxU5POWYdI37rTf9fScMcwIhAMkWNHbjBHKANVuHb10ACjakPmWEHnXkW5AspdBg53TxAiARPbzq99KXBbcjxbj3f/T3inSqYTEz60f0wDTLJd1dnQIhAIFe6Jd1TduIxGk1PDh/b/3q0jNGgVXkFnUBnKWDaL9N + # third服务的相关配置 + third: + urlPrefix: @epmet.third.urlprefix@ diff --git a/epmet-auth/src/main/resources/logback-spring.xml b/epmet-auth/src/main/resources/logback-spring.xml index 734c4114a1..0152e72505 100644 --- a/epmet-auth/src/main/resources/logback-spring.xml +++ b/epmet-auth/src/main/resources/logback-spring.xml @@ -139,7 +139,7 @@ - + diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java index 43b27e385b..1b874efc82 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/DemoApp.java @@ -20,7 +20,7 @@ public class DemoApp { //ssoToken.setSsoToken("wxz"); SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO(); - ssoTicket.setSsoTicket("wxz"); + ssoTicket.setSsoTicket("ssoTicket-jGOAW66udmRtUWBKgs3q7k1w7prGxd5I"); int bodyLength = JSON.toJSONString(ssoTicket).getBytes("utf-8").length; diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java index fbf0f7781e..aa59cf52ef 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/AbstractApiService.java @@ -19,7 +19,15 @@ public abstract class AbstractApiService { * @return * @throws Exception */ - public abstract ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws Exception; + public abstract ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception; + + /** + * G端用户token获取用户信息 + * @param token + * @return + * @throws Exception + */ + public abstract ThirdPlatUserInfo getGUserInfoBySSOToken(String token) throws Exception; /** * @Description 解析请求结果 @@ -32,7 +40,6 @@ public abstract class AbstractApiService { throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(thResult.getInternalMsg())); } - JcetResult jcetResult = JSON.parseObject(thResult.getData(), JcetResult.class); if (!jcetResult.isSuccess()) { throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java index c5f0753f47..f499156947 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java @@ -5,7 +5,8 @@ import com.epmet.commons.thirdplat.apiservice.AbstractApiService; import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; import com.epmet.commons.thirdplat.constants.JcetConstants; import com.epmet.commons.thirdplat.dto.form.jcet.SsoTicketFormDTO; -import com.epmet.commons.thirdplat.dto.result.jcet.JcetUserInfoResultDTO; +import com.epmet.commons.thirdplat.dto.result.jcet.JcetCUserInfoResultDTO; +import com.epmet.commons.thirdplat.dto.result.jcet.JcetGUserInfoResultDTO; import com.epmet.commons.thirdplat.encrypt.SignUtils; import com.epmet.commons.thirdplat.properties.JcetThirdplatProps; import com.epmet.commons.thirdplat.properties.ThirdplatProps; @@ -13,6 +14,7 @@ import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; import java.io.UnsupportedEncodingException; import java.util.HashMap; @@ -22,11 +24,13 @@ public class JcetApiService extends AbstractApiService { Logger logger = LoggerFactory.getLogger(getClass()); - private JcetThirdplatProps jcetThirdplatProps; + private JcetThirdplatProps jcetThirdplatCendProps; + private JcetThirdplatProps jcetThirdplatGendProps; public JcetApiService(ThirdplatProps props) { this.thirdplatProps = props; - jcetThirdplatProps = props.getJcet(); + jcetThirdplatCendProps = props.getJcetCend(); + jcetThirdplatGendProps = props.getJcetGend(); } /** @@ -35,7 +39,7 @@ public class JcetApiService extends AbstractApiService { * @author wxz * @date 2021.01.19 10:26 */ - public ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws UnsupportedEncodingException { + public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws UnsupportedEncodingException { logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket); @@ -43,12 +47,12 @@ public class JcetApiService extends AbstractApiService { SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO(); ssoTicket.setSsoTicket(ticket); - String domain = jcetThirdplatProps.getDomain(); + String domain = jcetThirdplatCendProps.getDomain(); Result result = HttpClientManager.getInstance().sendPost( domain.concat(JcetConstants.URL_GET_USER_BY_TICKET), domain.startsWith("https://"), JSON.toJSONString(ssoTicket), - getHeaders(ssoTicket)); + getHeaders(JSON.toJSONString(ssoTicket).getBytes("utf-8").length, jcetThirdplatCendProps.getAppkey(), jcetThirdplatCendProps.getAppsecret())); try { logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); @@ -57,7 +61,7 @@ public class JcetApiService extends AbstractApiService { } logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); - JcetUserInfoResultDTO resultDTO = parseResult(result, JcetUserInfoResultDTO.class); + JcetCUserInfoResultDTO resultDTO = parseResult(result, JcetCUserInfoResultDTO.class); ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); userInfo.setOpenId(resultDTO.getId()); @@ -66,6 +70,38 @@ public class JcetApiService extends AbstractApiService { return userInfo; } + @Override + public ThirdPlatUserInfo getGUserInfoBySSOToken(String token) throws Exception { + + logger.info("【请求酒城e通第三方平台】getGUserInfoBySSOToken()接口开始>>>>>>>>>>>>"); + logger.info("【请求酒城e通第三方平台】getGUserInfoBySSOToken()接口入参 ticket:{}", token); + + HashMap params = new HashMap<>(); + params.put("ssoToken",token); + + String domain = jcetThirdplatGendProps.getDomain(); + Result result = HttpClientManager.getInstance().sendGet( + domain.concat(JcetConstants.URL_GET_USER_BY_TOKEN), + domain.startsWith("https://"), + params, + getHeaders(0, jcetThirdplatGendProps.getAppkey(), jcetThirdplatGendProps.getAppsecret())); + + try { + logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); + } catch (Exception e) { + //e.printStackTrace(); + } + logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); + + JcetGUserInfoResultDTO resultDTO = parseResult(result, JcetGUserInfoResultDTO.class); + + ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); + userInfo.setOpenId(resultDTO.getUid()); + userInfo.setName(resultDTO.getName()); + userInfo.setMobile(resultDTO.getMobile()); + return userInfo; + } + /** * @return * @Description 通过token获取用户信息 @@ -94,19 +130,17 @@ public class JcetApiService extends AbstractApiService { /** * 获取请求所需要的头信息 * - * @param contentObject * @return * @throws UnsupportedEncodingException */ - private Map getHeaders(Object contentObject) throws UnsupportedEncodingException { - int bodyLength = JSON.toJSONString(contentObject).getBytes("utf-8").length; + private Map getHeaders(int bodyLength, String appKey, String appSecret) throws UnsupportedEncodingException { - Map headers = new HashMap(); + Map headers = new HashMap(); long timestamp = System.currentTimeMillis(); - headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, String.valueOf(timestamp)); - headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, jcetThirdplatProps.getAppkey()); - String encryptContent = jcetThirdplatProps.getAppkey() + timestamp + bodyLength; - headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, jcetThirdplatProps.getAppsecret())); + headers.put(JcetConstants.PLAT_HEADER_OPEN_TIMESTAMP, timestamp); + headers.put(JcetConstants.PLAT_HEADER_OPEN_APP_ID, appKey); + String encryptContent = appKey + timestamp + bodyLength; + headers.put(JcetConstants.PLAT_HEADER_OPEN_SIGN, SignUtils.generate(encryptContent, appSecret)); return headers; } diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java new file mode 100644 index 0000000000..b5307c2951 --- /dev/null +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/pyld/PyldApiService.java @@ -0,0 +1,128 @@ +package com.epmet.commons.thirdplat.apiservice.pyld; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.thirdplat.apiservice.AbstractApiService; +import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo; +import com.epmet.commons.thirdplat.constants.PyldConstants; +import com.epmet.commons.thirdplat.dto.result.jcet.PyldUserInfoResultDTO; +import com.epmet.commons.thirdplat.properties.PyldThirdplatProps; +import com.epmet.commons.thirdplat.properties.ThirdplatProps; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import org.apache.commons.codec.digest.DigestUtils; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; + +/** + * desc: 平阴联动指挥平台sso登陆服务类 接入文档:http://note.youdao.com/noteshare?id=167ad65365f9eccf7925e8c2629d2021&sub=555AE50510344CB5AACD5C06B9AA3B3B + * + * @author LiuJanJun + * @date 2021/2/25 1:43 下午 + */ +@Service +public class PyldApiService extends AbstractApiService { + + Logger logger = LoggerFactory.getLogger(getClass()); + + private PyldThirdplatProps pyldThirdplatProps; + + public PyldApiService(ThirdplatProps props) { + this.thirdplatProps = props; + pyldThirdplatProps = props.getPyld(); + } + + @Override + public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception { + return null; + } + + /** + * @return + * @Description 通过第三方平台ticket获取用户信息 + * @author wxz + * @date 2021.01.19 10:26 + */ + @Override + public ThirdPlatUserInfo getGUserInfoBySSOToken(String platformToken) { + + logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); + logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken); + + + JSONObject jsonParam = new JSONObject(); + jsonParam.put(PyldConstants.PLAT_PARAM_TOKEN, platformToken); + jsonParam.put(PyldConstants.PLAT_PARAM_MANAGEMENTKEY, PyldConstants.PLAT_PARAM_MANAGEMENTKEY_VALUE); + + String domain = pyldThirdplatProps.getDomain(); + Result result = HttpClientManager.getInstance().sendPost( + domain.concat(PyldConstants.METHOD_CHECK_LOGIN), + domain.startsWith("https://"), + jsonParam.toJSONString(), + buildHeaders()); + + logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口返回:{}", result.getData()); + logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<"); + PyldUserInfoResultDTO resultDTO = this.parseResult(result); + + ThirdPlatUserInfo userInfo = new ThirdPlatUserInfo(); + userInfo.setMobile(resultDTO.getMobile()); + userInfo.setCustomerId(resultDTO.getReserved()); + return userInfo; + + } + + /** + * 构建请求头信息 + * + * @return + */ + private Map buildHeaders() { + Map headers = new HashMap(); + long timestamp = System.currentTimeMillis(); + headers.put(PyldConstants.PLAT_HEADER_TIMESTAMP, timestamp); + headers.put(PyldConstants.PLAT_HEADER_APP_KEY, pyldThirdplatProps.getAppkey()); + String encryptContent = pyldThirdplatProps.getAppId() + pyldThirdplatProps.getAppkey() + pyldThirdplatProps.getAppSecret() + timestamp; + headers.put(PyldConstants.PLAT_HEADER_ACCESS_TOKEN, DigestUtils.md5Hex(encryptContent.getBytes(StandardCharsets.UTF_8))); + return headers; + } + + /** + * desc: 解析结果 + * + * @param thResult + * @return com.epmet.commons.thirdplat.dto.result.jcet.JcetUserInfoResultDTO + * @author LiuJanJun + * @date 2021/2/24 10:11 上午 + */ + private PyldUserInfoResultDTO parseResult(Result thResult) { + if (!thResult.success()) { + throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), + EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(thResult.getInternalMsg())); + } + JSONObject jcetResult = JSON.parseObject(thResult.getData()); + Integer code = jcetResult.getInteger("code"); + String msg = jcetResult.getString("msg"); + if (code == null || code != 0) { + throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), msg.concat(",错误码:") + code); + } + JSONObject data = jcetResult.getJSONObject("data"); + if (data == null) { + throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), + EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getMsg().concat(":").concat(PyldConstants.REPONSE_USER_NOT_LOGIN)); + } + PyldUserInfoResultDTO userInfo = data.getObject("userInfo", PyldUserInfoResultDTO.class); + if (userInfo == null || StringUtils.isBlank(userInfo.getMobile()) || StringUtils.isBlank(userInfo.getReserved())) { + throw new RenException(EpmetErrorCode.THIRD_PLAT_REQUEST_ERROR.getCode(), PyldConstants.REPONSE_USER_NOT_LOGIN); + } + return userInfo; + } +} diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/bean/ThirdPlatUserInfo.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/bean/ThirdPlatUserInfo.java index f1539efba7..7d9fa4aabf 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/bean/ThirdPlatUserInfo.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/bean/ThirdPlatUserInfo.java @@ -7,4 +7,5 @@ public class ThirdPlatUserInfo { private String openId; private String name; private String mobile; + private String customerId; } diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/PyldConstants.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/PyldConstants.java new file mode 100644 index 0000000000..ffb6dbde97 --- /dev/null +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/constants/PyldConstants.java @@ -0,0 +1,18 @@ +package com.epmet.commons.thirdplat.constants; + +public interface PyldConstants { + + String METHOD_CHECK_LOGIN = "/unifiedAuth/loginCheck"; + + + String PLAT_HEADER_TIMESTAMP = "timestamp"; + String PLAT_HEADER_APP_KEY = "appkey"; + String PLAT_HEADER_ACCESS_TOKEN = "accessToken"; + + + String PLAT_PARAM_TOKEN = "platformToken"; + String PLAT_PARAM_MANAGEMENTKEY = "managementKey"; + String PLAT_PARAM_MANAGEMENTKEY_VALUE = "epmet_work"; + + String REPONSE_USER_NOT_LOGIN = "token失效,请重新登陆"; +} diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java similarity index 91% rename from epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java rename to epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java index 8c025e5b9b..765126025d 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetUserInfoResultDTO.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetCUserInfoResultDTO.java @@ -3,7 +3,7 @@ package com.epmet.commons.thirdplat.dto.result.jcet; import lombok.Data; @Data -public class JcetUserInfoResultDTO { +public class JcetCUserInfoResultDTO { private String id; /** * 用户名称 diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java new file mode 100644 index 0000000000..24f2faf27c --- /dev/null +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/JcetGUserInfoResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.commons.thirdplat.dto.result.jcet; + +import lombok.Data; + +@Data +public class JcetGUserInfoResultDTO { + private String uid; + /** + * 手机号码 + */ + private String mobile; + /** + * 姓名 + */ + private String name; + /** + * 账号 + */ + private String account; + + /** + * 用户编码 + */ + private String code; +} diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/PyldUserInfoResultDTO.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/PyldUserInfoResultDTO.java new file mode 100644 index 0000000000..a7892d8820 --- /dev/null +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/dto/result/jcet/PyldUserInfoResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.commons.thirdplat.dto.result.jcet; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class PyldUserInfoResultDTO implements Serializable { + private static final long serialVersionUID = 6176427074670949388L; + /** + * 手机号 + */ + private String mobile; + /** + * 客户Id + */ + private String reserved; +} diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/PyldThirdplatProps.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/PyldThirdplatProps.java new file mode 100644 index 0000000000..03f9882532 --- /dev/null +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/PyldThirdplatProps.java @@ -0,0 +1,14 @@ +package com.epmet.commons.thirdplat.properties; + +import lombok.Data; + +/** + * 酒城e通三方平台配置 + */ +@Data +public class PyldThirdplatProps { + private String domain; + private String appId; + private String appkey; + private String appSecret; +} diff --git a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java index 07c4919bd9..441d1f0839 100644 --- a/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java +++ b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java @@ -7,6 +7,15 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @ConfigurationProperties(prefix = "thirdplat") public class ThirdplatProps { - private JcetThirdplatProps jcet; + // C端 + private JcetThirdplatProps jcetCend; + + // G端 + private JcetThirdplatProps jcetGend; + + /** + * 平阴联动指挥平台 + */ + private PyldThirdplatProps pyld; } diff --git a/epmet-commons/epmet-commons-tools/pom.xml b/epmet-commons/epmet-commons-tools/pom.xml index e2fd786edf..10b76c6f11 100644 --- a/epmet-commons/epmet-commons-tools/pom.xml +++ b/epmet-commons/epmet-commons-tools/pom.xml @@ -149,6 +149,11 @@ commons-httpclient 3.1 + + + com.aliyun + alibaba-dingtalk-service-sdk + 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/ApplicationFailedEventListener.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java new file mode 100644 index 0000000000..5c219ab095 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java @@ -0,0 +1,84 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.commons.tools.aspect; + +import com.alibaba.fastjson.JSON; +import com.dingtalk.api.DefaultDingTalkClient; +import com.dingtalk.api.DingTalkClient; +import com.dingtalk.api.request.OapiRobotSendRequest; +import com.dingtalk.api.response.OapiRobotSendResponse; +import com.epmet.commons.tools.enums.EnvEnum; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.taobao.api.ApiException; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.event.ApplicationFailedEvent; +import org.springframework.cloud.commons.util.InetUtils; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +/** + * 应用 启动健康检查 通知类 + * CustomerApplicationRunner + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Component +public class ApplicationFailedEventListener implements ApplicationListener { + private static Logger logger = LogManager.getLogger(ApplicationFailedEventListener.class); + @Value("${spring.application.name}") + private String appName; + @Value("${server.version}") + private String version; + + @Override + public void onApplicationEvent(ApplicationFailedEvent applicationFailedEvent) { + Throwable exception = applicationFailedEvent.getException(); + EnvEnum currentEnv = EnvEnum.getCurrentEnv(); + logger.info(currentEnv); + if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) { + sendDingMarkDownMsg(exception); + } + } + + + private String getServerIp() { + InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); + return inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); + } + + private void sendDingMarkDownMsg(Throwable exception) { + DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"); + OapiRobotSendRequest request = new OapiRobotSendRequest(); + request.setMsgtype("markdown"); + OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); + markdown.setTitle("部署失败通知"); + + markdown.setText("部署失败通知 \n" + + "> 服务:" + appName + "\n\n" + + "> 版本:" + version + "\n\n" + + "> 环境:" + EnvEnum.getCurrentEnv().getName() + "\n\n" + + "> IP: " + getServerIp() + "\n\n" + + "> 异常:" + exception.getMessage() + "\n\n" + ); + request.setMarkdown(markdown); + OapiRobotSendRequest.At at = new OapiRobotSendRequest.At(); + at.setIsAtAll(true); + request.setAt(at); + try { + OapiRobotSendResponse execute = client.execute(request); + logger.info("=====通知结果===>" + JSON.toJSONString(execute)); + } catch (ApiException e) { + logger.error("sendDingMarkDownMsg exception", e); + } + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java new file mode 100644 index 0000000000..901163e7ac --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.commons.tools.aspect; + +import com.alibaba.fastjson.JSON; +import com.dingtalk.api.DefaultDingTalkClient; +import com.dingtalk.api.DingTalkClient; +import com.dingtalk.api.request.OapiRobotSendRequest; +import com.dingtalk.api.response.OapiRobotSendResponse; +import com.epmet.commons.tools.dto.form.DingTalkTextMsg; +import com.epmet.commons.tools.enums.EnvEnum; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.taobao.api.ApiException; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.cloud.commons.util.InetUtils; +import org.springframework.context.ApplicationListener; +import org.springframework.stereotype.Component; + +/** + * 应用 启动健康检查 通知类 + * CustomerApplicationRunner + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Component +public class ApplicationReadyEventListener implements ApplicationListener { + private static Logger logger = LogManager.getLogger(ApplicationReadyEventListener.class); + @Value("${spring.application.name}") + private String appName; + @Value("${server.version}") + private String version; + + @Override + public void onApplicationEvent(ApplicationReadyEvent applicationReadyEvent) { + EnvEnum currentEnv = EnvEnum.getCurrentEnv(); + logger.info(currentEnv); + if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) { + //sendDingTextMsg(); + sendDingMarkDownMsg(); + } + } + + private void sendDingTextMsg() { + //发送启动成功消息 + InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); + String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); + + //开发小组 群机器人地址 + String url = "https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"; + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(EnvEnum.getCurrentEnv().getName()) + .append("【") + .append(appName) + .append("】") + .append("ip地址: ") + .append(serverIp) + .append("部署完毕!"); + DingTalkTextMsg msg = new DingTalkTextMsg(); + msg.setWebHook(url); + msg.setAtAll(true); + msg.setContent(stringBuilder.toString()); + Result stringResult = HttpClientManager.getInstance().sendPostByJSON(url, msg.getMsgContent()); + logger.info(stringResult); + } + + private String getServerIp() { + InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); + return inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); + } + + private void sendDingMarkDownMsg() { + DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"); + OapiRobotSendRequest request = new OapiRobotSendRequest(); + request.setMsgtype("markdown"); + OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); + markdown.setTitle("部署成功通知"); + + markdown.setText("部署成功通知 \n" + + "> 服务:" + appName + "\n\n" + + "> 版本:" + version + "\n\n" + + "> 环境:" + EnvEnum.getCurrentEnv().getName() + "\n\n" + + "> IP: " + getServerIp() + "\n\n" + ); + request.setMarkdown(markdown); + OapiRobotSendRequest.At at = new OapiRobotSendRequest.At(); + at.setIsAtAll(true); + request.setAt(at); + try { + OapiRobotSendResponse execute = client.execute(request); + logger.info("=====通知结果===>" + JSON.toJSONString(execute)); + } catch (ApiException e) { + logger.error("sendDingMarkDownMsg exception", e); + } + } + + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index ff877a04be..4b3496ee36 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -1,6 +1,7 @@ package com.epmet.commons.tools.aspect; import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.ThreadLocalConstant; import com.epmet.commons.tools.exception.*; import com.epmet.commons.tools.utils.Result; import org.apache.commons.lang3.StringUtils; @@ -12,6 +13,7 @@ import org.springframework.dao.DuplicateKeyException; import javax.servlet.http.HttpServletRequest; import java.time.Duration; import java.time.LocalDateTime; +import java.util.Arrays; /** * 日志切面 @@ -61,6 +63,7 @@ public abstract class BaseRequestLogAspect { try { Object[] args = point.getArgs(); + ThreadLocalConstant.requestParam.set(Arrays.toString(point.getArgs())); log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{}", transactionSerial, requestURI, method, objectsToString(args)); result = point.proceed(); resultInfoLog(transactionSerial, getExecPeriod(startTime), result); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java deleted file mode 100644 index 4500453213..0000000000 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright (c) 2018 人人开源 All rights reserved. - *

- * https://www.renren.io - *

- * 版权所有,侵权必究! - */ - -package com.epmet.commons.tools.aspect; - -import com.epmet.commons.tools.dto.form.DingTalkTextMsg; -import com.epmet.commons.tools.enums.EnvEnum; -import com.epmet.commons.tools.utils.HttpClientManager; -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.SpringContextUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.ApplicationArguments; -import org.springframework.boot.ApplicationRunner; -import org.springframework.cloud.commons.util.InetUtils; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -/** - * 应用 启动健康检查 通知类 - * CustomerApplicationRunner - * - * @author Mark sunlightcs@gmail.com - * @since 1.0.0 - */ -@Component -@Order(value = 99) -public class CustomerApplicationRunner implements ApplicationRunner { - private static Logger logger = LogManager.getLogger(CustomerApplicationRunner.class); - @Value("${spring.application.name}") - private String appName; - - @Override - public void run(ApplicationArguments args) { - //发送启动成功消息 - EnvEnum currentEnv = EnvEnum.getCurrentEnv(); - logger.info(currentEnv); - if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode()) && !EnvEnum.LOCAL.getCode().equals(currentEnv.getCode())) { - InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); - String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); - - //开发小组 群机器人地址 - String url = "https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"; - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(EnvEnum.getCurrentEnv().getName()) - .append("【") - .append(appName) - .append("】") - .append("ip地址: ") - .append(serverIp) - .append("部署完毕!"); - DingTalkTextMsg msg = new DingTalkTextMsg(); - msg.setWebHook(url); - msg.setAtAll(true); - msg.setContent(stringBuilder.toString()); - Result stringResult = HttpClientManager.getInstance().sendPostByJSON(url, msg.getMsgContent()); - logger.info(stringResult); - } - } - -} 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/aspect/RequirePermissionAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java index 3b5858b805..da3cab475e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/RequirePermissionAspect.java @@ -11,9 +11,6 @@ package com.epmet.commons.tools.aspect; import com.epmet.commons.tools.annotation.RequirePermission; import com.epmet.commons.tools.constant.ThreadLocalConstant; import com.epmet.commons.tools.dto.form.HasSpecifiedPermissionFormDTO; -import com.epmet.commons.tools.dto.form.LoginUserInfoFormDTO; -import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO; -import com.epmet.commons.tools.dto.form.RoleOpeScopeResultDTO; import com.epmet.commons.tools.enums.RequirePermissionEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; @@ -30,11 +27,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - /** * 每次请求,过滤Api中配置的权限key出来,并且判断是否具有该功能权限 * @Author wxz @@ -89,8 +81,9 @@ public class RequirePermissionAspect { throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); } Boolean data = result.getData(); + if (data == null || !data) { - log.error("操作权限不足"); + log.warn("操作权限不足,key:{}", requirePermission); throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 59e3ce4bdc..a9cc07d7a4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java @@ -26,6 +26,7 @@ public interface NumConstant { int TEN = 10; int ELEVEN = 11; int TWELVE = 12; + int THIRTEEN = 13; int SEVENTEEN = 17; int FIFTEEN = 15; int FOURTEEN=14; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index 03233b7c47..41302f5e32 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -81,4 +81,6 @@ public interface StrConstant { String MIN="MIN"; String MAX="MAX"; + + String SPECIAL_CUSTOMER = "150282ed25c14ff0785e7e06283b6283"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java index 2dad0d6dba..6a2b304cfa 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java @@ -1,7 +1,5 @@ package com.epmet.commons.tools.constant; -import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO; - /** * ThreadLocal常亮 */ @@ -16,4 +14,9 @@ public class ThreadLocalConstant { * 用于向DataFilterInterceptor传递权限过滤的sql片段(需要在Controller相关的AOP中进行清理,防止变量残留) */ public static final ThreadLocal sqlFilter = new ThreadLocal(); + + /** + * 用于本次的获取请求参数 + */ + public static final ThreadLocal requestParam = new ThreadLocal(); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java index d0df724665..31d5faaa34 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EnvEnum.java @@ -11,11 +11,14 @@ import org.springframework.core.env.Environment; * @date 2020-07-03 11:14 **/ public enum EnvEnum { - LOCAL("local", "本地环境","http://localhost:8080/api/"), - DEV("dev", "开发环境","http://192.168.1.130:8080/api/"), - TEST("test", "体验环境","https://epmet-dev.elinkservice.cn/api/"), - PROD("prod", "生产环境","https://epmet-cloud.elinkservice.cn/api/"), - UN_KNOWN("un_known", "未知","https://epmet-dev.elinkservice.cn/api/"), + /** + * 环境变量枚举 + */ + LOCAL("local", "本地环境", "http://localhost:8080/api/"), + DEV("dev", "开发环境", "http://192.168.1.130:8080/api/"), + TEST("test", "体验环境", "https://epmet-dev.elinkservice.cn/api/"), + PROD("prod", "生产环境", "https://epmet-cloud.elinkservice.cn/api/"), + UN_KNOWN("un_known", "未知", "https://epmet-dev.elinkservice.cn/api/"), ; private String code; @@ -33,7 +36,7 @@ public enum EnvEnum { public static EnvEnum getEnum(String code) { EnvEnum[] values = EnvEnum.values(); for (EnvEnum value : values) { - if (code != null && value.getCode().equals(code)) { + if (value.getCode().equals(code)) { return value; } } @@ -44,7 +47,7 @@ public enum EnvEnum { try { Environment environment = SpringContextUtils.getBean(Environment.class); String[] activeProfiles = environment.getActiveProfiles(); - if (activeProfiles != null && activeProfiles.length > 0) { + if (activeProfiles.length > 0) { return getEnum(activeProfiles[0]); } } catch (Exception e) { 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/feign/FeignConfig.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java index f7ae3265d0..c68dbc2913 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignConfig.java @@ -53,6 +53,6 @@ public class FeignConfig implements RequestInterceptor { @Bean Logger.Level feignLoggerLevel() { - return Logger.Level.FULL;//控制台会输出debug日志 + return Logger.Level.BASIC;//控制台会输出debug日志 } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java index 4e2f0d16ab..0651951d56 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java @@ -6,6 +6,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.StackTraceElementProxy; import ch.qos.logback.core.spi.FilterReply; +import com.epmet.commons.tools.constant.ThreadLocalConstant; import com.epmet.commons.tools.dto.form.DingTalkTextMsg; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.utils.DingdingMsgSender; @@ -15,9 +16,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.commons.util.InetUtils; import org.springframework.core.env.Environment; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; -import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -64,14 +68,26 @@ public class LogMsgSendFilter extends LevelFilter { stringBuilder.append("IP地址:" + serverIp); stringBuilder.append("\n"); } + stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp())); stringBuilder.append("\n"); stringBuilder.append("TraceId:" + Thread.currentThread().getName()); stringBuilder.append("\n"); + + HttpServletRequest request = getRequest(); + if (request != null) { + String requestURI = request.getRequestURI(); + stringBuilder.append("请求路径:" + requestURI); + stringBuilder.append("\n"); + + stringBuilder.append("请求参数:" + ThreadLocalConstant.requestParam.get()); + stringBuilder.append("\n"); + } + String formattedMessage = event.getFormattedMessage(); IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy == null && formattedMessage.length() > 1000) { - formattedMessage = formattedMessage.substring(0, getCharacterPosition(formattedMessage, baseProjectPackage, 5)); + formattedMessage = formattedMessage.substring(0, getCharacterPosition(formattedMessage, baseProjectPackage, 5)); } stringBuilder.append("告警信息:" + formattedMessage); stringBuilder.append("\n"); @@ -107,6 +123,9 @@ public class LogMsgSendFilter extends LevelFilter { try { if (serverIp == null) { InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); + if (inetUtils.findFirstNonLoopbackHostInfo() == null){ + return; + } serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); } } catch (Exception e) { @@ -159,105 +178,19 @@ public class LogMsgSendFilter extends LevelFilter { } } - public static void main(String[] args) { - String msg = "<<<<<<<<异常响应<<<<<<<<:事务流水号:na1597027822634, 执行时长:59ms, 响应数据:{\"code\":8102,\"internalMsg\":\"验证码错误\",\"msg\":\"验证码错误\"}, 异常信息:验证码错误, 堆栈信息:com.epmet.commons.tools.exception.RenException: \n" + - " at com.epmet.service.impl.VolunteerInfoServiceImpl.authenticate(VolunteerInfoServiceImpl.java:91)\n" + - " at com.epmet.service.impl.VolunteerInfoServiceImpl$$FastClassBySpringCGLIB$$7babb2e8.invoke()\n" + - " at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n" + - " at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n" + - " at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)\n" + - " at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" + - " at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)\n" + - " at com.epmet.service.impl.VolunteerInfoServiceImpl$$EnhancerBySpringCGLIB$$f78b4778.authenticate()\n" + - " at com.epmet.controller.ResiVolunteerController.authenticate(ResiVolunteerController.java:59)\n" + - " at com.epmet.controller.ResiVolunteerController$$FastClassBySpringCGLIB$$e023fb55.invoke()\n" + - " at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n" + - " at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n" + - " at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:56)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" + - " at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)\n" + - " at com.epmet.commons.tools.aspect.BaseRequestLogAspect.proceed(BaseRequestLogAspect.java:66)\n" + - " at com.epmet.aspect.RequestLogAspect.proceed(RequestLogAspect.java:26)\n" + - " at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)\n" + - " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" + - " at java.lang.reflect.Method.invoke(Method.java:498)\n" + - " at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)\n" + - " at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)\n" + - " at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" + - " at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" + - " at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)\n" + - " at com.epmet.controller.ResiVolunteerController$$EnhancerBySpringCGLIB$$1c0751c0.authenticate()\n" + - " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" + - " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n" + - " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" + - " at java.lang.reflect.Method.invoke(Method.java:498)\n" + - " at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)\n" + - " at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)\n" + - " at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)\n" + - " at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893)\n" + - " at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798)\n" + - " at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)\n" + - " at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)\n" + - " at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)\n" + - " at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)\n" + - " at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)\n" + - " at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)\n" + - " at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)\n" + - " at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:94)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114)\n" + - " at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)\n" + - " at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)\n" + - " at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)\n" + - " at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)\n" + - " at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\n" + - " at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)\n" + - " at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)\n" + - " at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)\n" + - " at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)\n" + - " at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)\n" + - " at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1591)\n" + - " at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\n" + - " at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n" + - " at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n" + - " at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n" + - " at java.lang.Thread.run(Thread.java:745)"; + /** + * 获取Request对象 + * + * @return + */ + private HttpServletRequest getRequest() { + RequestAttributes ra = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) ra; + if (sra == null){ + return null; + } + return sra.getRequest(); - String substring = msg.substring(0, getCharacterPosition(msg, "com.epme1t", 5)); - System.out.println(substring); } @@ -274,7 +207,7 @@ public class LogMsgSendFilter extends LevelFilter { } return slashMatcher.start(); } catch (Exception e) { - logger.warn("getCharacterPosition no matche"); + logger.warn("getCharacterPosition no matche", e); return 0; } } 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 098dd1c14d..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 @@ -9,6 +9,7 @@ package com.epmet.commons.tools.redis; import com.epmet.commons.tools.constant.StrConstant; +import org.apache.commons.lang3.StringUtils; /** * @author Mark sunlightcs@gmail.com @@ -42,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 */ @@ -355,19 +349,46 @@ public class RedisKeys { } /** + * @return + * @Description 客户的ApiService + * @author wxz + * @date 2021.01.20 16:56 + */ + public static String getCustomerApiServiceKey(String customerId) { + return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId); + } + + /** + * @return epmet:resi:user:userId * @Description 用户缓存Key + * @Param 用户Id + * @Author wangc + * @Date 2020.04.13 11:27 **/ - public static String getResiUserKey(String userId){ + public static String getResiUserKey(String userId) { return rootPrefix.concat("resi:user:").concat(userId); } /** - * @Description 客户的ApiService - * @return - * @author wxz - * @date 2021.01.20 16:56 + * @param userId + * @return epmet:badge:user:[customerId]:[userId] + * @Description 用户勋章缓存 epmet:badge:user:[customerId]:[userId] + * @author wangc + * @date 2020.11.05 13:34 */ - public static String getCustomerApiServiceKey(String customerId) { - return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId); + 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/security/user/LoginUserUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java index 088a26eb73..bb322aad2d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/user/LoginUserUtil.java @@ -34,6 +34,18 @@ public class LoginUserUtil { return userId; } + /** + * 查询登录用户的客户Id + * @return + */ + public String getCurrentCustomerId() { + HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); + if (request == null) { + return null; + } + return request.getHeader(AppClientConstant.CUSTOMER_ID); + } + /** * 登录用户的App头信息 * @return 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-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 0c83bfdede..2481664829 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -188,15 +188,16 @@ public class HttpClientManager { } - public Result sendPost(String url, boolean isHttps, String jsonStrParam,Map headerMap) { + public Result sendPost(String url, boolean isHttps, String jsonStrParam, Map headerMap) { try { HttpPost httppost = new HttpPost(url); httppost.setConfig(requestConfig); httppost.addHeader(HEADER_CONTENT_TYPE, HEADER_APPLICATION_JSON); - if (null != headerMap){ - headerMap.forEach((k,v) -> { - httppost.addHeader(k,v); + if (null != headerMap) { + headerMap.forEach((k, v) -> { + if (v != null) + httppost.addHeader(k, v.toString()); }); } if (StringUtils.isNotEmpty(jsonStrParam)) { @@ -348,7 +349,7 @@ public class HttpClientManager { } } - public Result sendGet(String url, boolean isHttps, Map params, Map headerMap) { + public Result sendGet(String url, boolean isHttps, Map params, Map headerMap) { try { URIBuilder builder = new URIBuilder(url); @@ -363,7 +364,9 @@ public class HttpClientManager { httpGet.setConfig(requestConfig); if (null != headerMap){ headerMap.forEach((k,v) -> { - httpGet.addHeader(k,v); + if (StringUtils.isNotBlank(k)) { + httpGet.addHeader(k, v == null ? null : v.toString()); + } }); } return execute(httpGet, isHttps); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/RSASignature.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/RSASignature.java new file mode 100644 index 0000000000..6de665f7eb --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/RSASignature.java @@ -0,0 +1,251 @@ +package com.epmet.commons.tools.utils; + +import javax.crypto.Cipher; +import java.security.*; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.Base64; + +/** + * @author jianjun liu + * @date 2020-06-05 16:48 + **/ + +public class RSASignature { + + + //非对称密钥算法 + private static final String KEY_ALGORITHM = "RSA"; + //密钥长度,在512到65536位之间,建议不要太长,否则速度很慢,生成的加密数据很长 + private static final int KEY_SIZE = 512; + //字符编码 + private static final String CHARSET = "UTF-8"; + + /** + * 生成密钥对 + * + * @return KeyPair 密钥对 + */ + public static KeyPair getKeyPair() throws Exception { + return getKeyPair(null); + } + + /** + * 生成密钥对 + * + * @param password 生成密钥对的密码 + * @return + * @throws Exception + */ + public static KeyPair getKeyPair(String password) throws Exception { + //实例化密钥生成器 + KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance(KEY_ALGORITHM); + //初始化密钥生成器 + if (password == null) { + keyPairGenerator.initialize(KEY_SIZE); + } else { + SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); + secureRandom.setSeed(password.getBytes(CHARSET)); + keyPairGenerator.initialize(KEY_SIZE, secureRandom); + } + //生成密钥对 + return keyPairGenerator.generateKeyPair(); + } + + /** + * 取得私钥 + * + * @param keyPair 密钥对 + * @return byte[] 私钥 + */ + public static byte[] getPrivateKeyBytes(KeyPair keyPair) { + return keyPair.getPrivate().getEncoded(); + } + + /** + * 取得Base64编码的私钥 + * + * @param keyPair 密钥对 + * @return String Base64编码的私钥 + */ + public static String getPrivateKey(KeyPair keyPair) { + return Base64.getEncoder().encodeToString(getPrivateKeyBytes(keyPair)); + } + + /** + * 取得公钥 + * + * @param keyPair 密钥对 + * @return byte[] 公钥 + */ + public static byte[] getPublicKeyBytes(KeyPair keyPair) { + return keyPair.getPublic().getEncoded(); + } + + /** + * 取得Base64编码的公钥 + * + * @param keyPair 密钥对 + * @return String Base64编码的公钥 + */ + public static String getPublicKey(KeyPair keyPair) { + return Base64.getEncoder().encodeToString(getPublicKeyBytes(keyPair)); + } + + /** + * 私钥加密 + * + * @param data 待加密数据 + * @param privateKey 私钥字节数组 + * @return byte[] 加密数据 + */ + public static byte[] encryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception { + //实例化密钥工厂 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + //生成私钥 + PrivateKey key = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKey)); + //数据加密 + Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); + cipher.init(Cipher.ENCRYPT_MODE, key); + return cipher.doFinal(data); + } + + /** + * 私钥加密 + * + * @param data 待加密数据 + * @param privateKey Base64编码的私钥 + * @return String Base64编码的加密数据 + */ + public static String encryptByPrivateKey(String data, String privateKey) throws Exception { + byte[] key = Base64.getDecoder().decode(privateKey); + return Base64.getEncoder().encodeToString(encryptByPrivateKey(data.getBytes(CHARSET), key)); + } + + /** + * 公钥加密 + * + * @param data 待加密数据 + * @param publicKey 公钥字节数组 + * @return byte[] 加密数据 + */ + public static byte[] encryptByPublicKey(byte[] data, byte[] publicKey) throws Exception { + //实例化密钥工厂 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + //生成公钥 + PublicKey key = keyFactory.generatePublic(new X509EncodedKeySpec(publicKey)); + //数据加密 + Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); + cipher.init(Cipher.ENCRYPT_MODE, key); + return cipher.doFinal(data); + } + + /** + * 公钥加密 + * + * @param data 待加密数据 + * @param publicKey Base64编码的公钥 + * @return String Base64编码的加密数据 + */ + public static String encryptByPublicKey(String data, String publicKey) throws Exception { + byte[] key = Base64.getDecoder().decode(publicKey); + return Base64.getEncoder().encodeToString(encryptByPublicKey(data.getBytes(CHARSET), key)); + } + + /** + * 私钥解密 + * + * @param data 待解密数据 + * @param privateKey 私钥字节数组 + * @return byte[] 解密数据 + */ + public static byte[] decryptByPrivateKey(byte[] data, byte[] privateKey) throws Exception { + //实例化密钥工厂 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + //生成私钥 + PrivateKey key = keyFactory.generatePrivate(new PKCS8EncodedKeySpec(privateKey)); + //数据解密 + Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); + cipher.init(Cipher.DECRYPT_MODE, key); + return cipher.doFinal(data); + } + + /** + * 私钥解密 + * + * @param data Base64编码的待解密数据 + * @param privateKey Base64编码的私钥 + * @return String 解密数据 + */ + public static String decryptByPrivateKey(String data, String privateKey) throws Exception { + byte[] key = Base64.getDecoder().decode(privateKey); + return new String(decryptByPrivateKey(Base64.getDecoder().decode(data), key), CHARSET); + } + + /** + * 公钥解密 + * + * @param data 待解密数据 + * @param publicKey 公钥字节数组 + * @return byte[] 解密数据 + */ + public static byte[] decryptByPublicKey(byte[] data, byte[] publicKey) throws Exception { + //实例化密钥工厂 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + //产生公钥 + PublicKey key = keyFactory.generatePublic(new X509EncodedKeySpec(publicKey)); + //数据解密 + Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); + cipher.init(Cipher.DECRYPT_MODE, key); + return cipher.doFinal(data); + } + + /** + * 公钥解密 + * + * @param data Base64编码的待解密数据 + * @param publicKey Base64编码的公钥 + * @return String 解密数据 + */ + public static String decryptByPublicKey(String data, String publicKey) throws Exception { + byte[] key = Base64.getDecoder().decode(publicKey); + return new String(decryptByPublicKey(Base64.getDecoder().decode(data), key), CHARSET); + } + + /** + * 测试加解密方法 + * + * @param args + * @throws Exception + */ + public static void main(String[] args) throws Exception { + //生成密钥对,一般生成之后可以放到配置文件中 + KeyPair keyPair = RSASignature.getKeyPair(); + //公钥 + String publicKey = RSASignature.getPublicKey(keyPair); + //私钥 + String privateKey = RSASignature.getPrivateKey(keyPair); + + System.out.println("公钥:\n" + publicKey); + System.out.println("私钥:\n" + privateKey); + + String data = "RSA 加解密测试!"; + { + System.out.println("\n===========私钥加密,公钥解密=============="); + String s1 = RSASignature.encryptByPrivateKey(data, privateKey); + System.out.println("加密后的数据:" + s1); + String s2 = RSASignature.decryptByPublicKey(s1, publicKey); + System.out.println("解密后的数据:" + s2 + "\n\n"); + } + //===== + { + System.out.println("\n===========公钥加密,私钥解密=============="); + String s1 = RSASignature.encryptByPublicKey(data, publicKey); + System.out.println("加密后的数据:" + s1); + String s2 = RSASignature.decryptByPrivateKey(s1, privateKey); + System.out.println("解密后的数据:" + s2 + "\n\n"); + } + + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/IdCardNoValidatorUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/IdCardNoValidatorUtils.java index 08a96295ac..1f44eb4333 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/IdCardNoValidatorUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/IdCardNoValidatorUtils.java @@ -35,14 +35,14 @@ public class IdCardNoValidatorUtils { try { //判断号码的长度 15位或18位 if (idCardNo.length() != 15 && idCardNo.length() != 18) { - logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证号码长度应该为15位或18位")); + logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证号码长度应该为15位或18位")); return false; } if (idCardNo.length() == 18) { String lastStr = idCardNo.substring(idCardNo.length() - 1); if (!Character.isDigit(lastStr.charAt(0))) { if (Character.isLowerCase(lastStr.charAt(0))) { - logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "18身份证号最后一位字母需要大写")); + logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "18身份证号最后一位字母需要大写")); return false; } } else { @@ -55,7 +55,7 @@ public class IdCardNoValidatorUtils { iDCardNo = idCardNo.substring(0, 6) + "19" + idCardNo.substring(6, 15); } if (isStrNum(iDCardNo) == false) { - logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证15位号码都应为数字;18位号码除最后一位外,都应为数字")); + logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证15位号码都应为数字;18位号码除最后一位外,都应为数字")); return false; } //判断出生年月 @@ -63,27 +63,27 @@ public class IdCardNoValidatorUtils { String strMonth = iDCardNo.substring(10, 12);// 月份 String strDay = iDCardNo.substring(12, 14);// 月份 if (isStrDate(strYear + "-" + strMonth + "-" + strDay) == false) { - logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证生日无效")); + logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证生日无效")); return false; } GregorianCalendar gc = new GregorianCalendar(); SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd"); if ((gc.get(Calendar.YEAR) - Integer.parseInt(strYear)) > 150 || (gc.getTime().getTime() - s.parse(strYear + "-" + strMonth + "-" + strDay).getTime()) < 0) { - logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证生日不在有效范围")); + logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证生日不在有效范围")); return false; } if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth) == 0) { - logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证月份无效")); + logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证月份无效")); return false; } if (Integer.parseInt(strDay) > 31 || Integer.parseInt(strDay) == 0) { - logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证日期无效")); + logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证日期无效")); return false; } //判断地区码 Hashtable h = GetAreaCode(); if (h.get(iDCardNo.substring(0, 2)) == null) { - logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证地区编码错误")); + logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证地区编码错误")); return false; } //判断最后一位 @@ -96,12 +96,12 @@ public class IdCardNoValidatorUtils { iDCardNo = iDCardNo + strVerifyCode; if (idCardNo.length() == 18 && !iDCardNo.equals(idCardNo)) { - logger.error(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证无效,不是合法的身份证号码")); + logger.warn(String.format("校验身份证号:%s错误:%s", idCardNo, "身份证无效,不是合法的身份证号码")); return false; } } catch (Exception e) { - logger.error(String.format("校验身份证号方法异常")); + logger.warn(String.format("校验身份证号方法异常")); e.printStackTrace(); } return true; diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index a0c1c35811..f06ee6b839 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -2,6 +2,7 @@ server: tomcat: max-swallow-size: 100MB port: @server.port@ + version: @version@ servlet: context-path: /api spring: @@ -418,7 +419,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -456,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/bootstrap.yml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml index f889044c69..50e01db7ee 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /data/aggregator @@ -126,7 +127,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -153,4 +154,4 @@ dingTalk: logging: level: - com.epmet.dataaggre: debug \ No newline at end of file + com.epmet.dataaggre: debug 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-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java new file mode 100644 index 0000000000..04d4896995 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/AgencyInfoDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/2/27 17:52 + */ +@Data +public class AgencyInfoDTO implements Serializable { + private String agencyId; + private String areaCode; + private List subAgencyIds; + private List subGridIds; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java new file mode 100644 index 0000000000..b9cd6657b6 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryGridDailyDTO.java @@ -0,0 +1,142 @@ +/** + * 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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 项目(事件)分类按网格_按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-02-23 + */ +@Data +public class ScreenProjectCategoryGridDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 日期yyyyMMdd + */ + private String dateId; + + /** + * 网格id + */ + private String gridId; + + /** + * 网格所属的组织id + */ + private String pid; + + /** + * 网格所有的父级id,以英文:或者英文,隔开 + */ + private String pids; + + /** + * e世通中的项目类别编码 + */ + private String epmetCategoryCode; + + /** + * 该分类下所有项目总数 + */ + private Integer projectTotal; + + /** + * 该分类下,正在处理中的项目总数 + */ + private Integer pendingTotal; + + /** + * 该分类下已结案的项目总数 + */ + private Integer closedTotal; + + /** + * 该分类下已结案无需解决的项目总数 + */ + private Integer unResolvedTotal; + + /** + * 该分类下已结案已解决的项目总数 + */ + private Integer resolvedTotal; + + /** + * 该分类下项目结案率 + */ + private BigDecimal closedRatio; + + /** + * 该分类下已结案项目解决率 + */ + private BigDecimal resolvedRatio; + + /** + * 该分类下已结案项目未解决率 + */ + private BigDecimal unResolvedRatio; + + /** + * 删除标识 + */ + 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/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java new file mode 100644 index 0000000000..1507a1f88a --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/ScreenProjectCategoryOrgDailyDTO.java @@ -0,0 +1,147 @@ +/** + * 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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 项目(事件)分类按组织_按天统计 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-02-23 + */ +@Data +public class ScreenProjectCategoryOrgDailyDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 日期yyyyMMdd + */ + private String dateId; + + /** + * 组织id + */ + private String orgId; + + /** + * 社区级:community,乡(镇、街道)级:street,区县级: district,市级: city省级:province + */ + private String orgType; + + /** + * 当前orgId所属的上级id + */ + private String pid; + + /** + * orgId所有的父级id,以英文:或者英文,隔开 + */ + private String pids; + + /** + * e世通中的项目类别编码 + */ + private String epmetCategoryCode; + + /** + * 该分类下所有项目总数 + */ + private Integer projectTotal; + + /** + * 该分类下,正在处理中的项目总数 + */ + private Integer pendingTotal; + + /** + * 该分类下已结案的项目总数 + */ + private Integer closedTotal; + + /** + * 该分类下已结案无需解决的项目总数 + */ + private Integer unResolvedTotal; + + /** + * 该分类下已结案已解决的项目总数 + */ + private Integer resolvedTotal; + + /** + * 该分类下项目结案率 + */ + private BigDecimal closedRatio; + + /** + * 该分类下已结案项目解决率 + */ + private BigDecimal resolvedRatio; + + /** + * 该分类下已结案项目未解决率 + */ + private BigDecimal unResolvedRatio; + + /** + * 删除标识 + */ + 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/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/CategoryAnalysisFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/CategoryAnalysisFormDTO.java new file mode 100644 index 0000000000..b39dadb41b --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/form/screen/CategoryAnalysisFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form.screen; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/2/23 15:26 + */ +@Data +public class CategoryAnalysisFormDTO implements Serializable { + private static final long serialVersionUID = -3088762710988337423L; + + public interface CategoryAnalysis{} + + @NotBlank(message = "组织ID不能为空",groups = {CategoryAnalysis.class}) + private String agencyId; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/CategoryAnalysisResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/CategoryAnalysisResultDTO.java new file mode 100644 index 0000000000..da023e6c0b --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/dto/result/screen/CategoryAnalysisResultDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result.screen; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/2/23 15:28 + */ +@NoArgsConstructor +@Data +public class CategoryAnalysisResultDTO implements Serializable { + + private static final long serialVersionUID = 4500337306142206855L; + /** + * 类别名称 + */ + private String categoryName; + /** + * 项目总数 + */ + private Integer projectTotal; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyAndNumFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyAndNumFormDTO.java index cd31c9688b..9410dda13a 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyAndNumFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyAndNumFormDTO.java @@ -25,4 +25,9 @@ public class AgencyAndNumFormDTO implements Serializable { * */ @NotBlank(message = "机关Id不能为空" , groups = AgencyFormDTO.CommonAgencyIdGroup.class) private String agencyId; + + /** + * 目前只有平阴在传,默认赋值:370124 + */ + private String areaCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyNumTypeParamFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyNumTypeParamFormDTO.java index 9e2e3c74a9..6dc17c3e48 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyNumTypeParamFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AgencyNumTypeParamFormDTO.java @@ -32,4 +32,9 @@ public class AgencyNumTypeParamFormDTO implements Serializable { @NotBlank(message = "类型不能为空", groups = AgencyNumTypeParamGroup.class) private String type; + /** + * 地区编码 + */ + private String areaCode; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ContactMassLineChartFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ContactMassLineChartFormDTO.java index c2deeac60b..b696426a2e 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ContactMassLineChartFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ContactMassLineChartFormDTO.java @@ -21,4 +21,9 @@ public class ContactMassLineChartFormDTO implements Serializable { */ @NotBlank(message = "机关ID不能为空",groups = {ContactMassLineChart.class}) private String agencyId; + + /** + * 目前只有平阴在传,默认赋值:370124 + */ + private String areaCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java index 5ed5b9fc1a..542c2e5b48 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/FineExampleFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.evaluationindex.screen.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ParymemberFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ParymemberFormDTO.java index fdf525f37b..15b3e36477 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ParymemberFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ParymemberFormDTO.java @@ -21,4 +21,9 @@ public class ParymemberFormDTO implements Serializable { */ @NotBlank(message = "机关ID不能为空",groups = {Parymember.class}) private String agencyId; + + /** + * 目前只有平阴在传,默认赋值:370124 + */ + private String areaCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDetailFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDetailFormDTO.java new file mode 100644 index 0000000000..be3585067d --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDetailFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.evaluationindex.screen.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2021/2/24 16:12 + */ +@Data +public class ScreenProjectDetailFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + @NotBlank(message = "projectId不能为空") + private String projectId; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDistributionFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDistributionFormDTO.java new file mode 100644 index 0000000000..aa4a89183e --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/ScreenProjectDistributionFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.evaluationindex.screen.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2021/2/24 15:22 + */ +@Data +public class ScreenProjectDistributionFormDTO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * 目前只有平阴在传,默认赋值:370124 + */ + private String areaCode; + + /** + * 如果为空返回全部;可选值:1:红色事件;2:黄色事件;3:绿色事件 + */ + private String level; + + /** + * 当前组织id + */ + @NotBlank(message = "agencyId不能为空") + private String agencyId; + + + /** + * 不必填;默认查询的是处理中;可选值:all: 全部,pending:处理中 已结案:closed_case ;已关闭:closed + * 默认查询pending + */ + private String status; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java index b1ffd9243d..18fdae844f 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java @@ -35,4 +35,9 @@ public class SubAgencyIndexRankFormDTO implements Serializable { * area_code升级,新增此参数,来源于当前token */ private String customerId; + + /** + * 行政区域编码 + */ + private String areaCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankPyFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankPyFormDTO.java new file mode 100644 index 0000000000..f437e1a5b4 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankPyFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.evaluationindex.screen.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/2/28 14:29 + */ +@Data +public class SubAgencyIndexRankPyFormDTO implements Serializable { + private static final long serialVersionUID = 8930332375421099186L; + /** + * 当前组织,平阴大屏,默认传跟组织 + * */ + @NotBlank(message = "agencyId不能为空") + private String agencyId; + + /** + * 目前只有平阴在传,默认赋值:370124 + * */ + @NotBlank(message = "areaCode不能为空;平阴默认传:370124") + private String areaCode; + + /** + * 默认查询前10条 + * */ + @NotNull(message = "topNum不能为空") + private Integer topNum; + + @NotBlank(message = "type不能为空,街道:street;网格:grid") + private String type; + + @NotBlank(message = "customerId不能为空") + private String customerId; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/GovernCapacityResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/GovernCapacityResultDTO.java index 95ab00a382..e749c0e218 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/GovernCapacityResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/GovernCapacityResultDTO.java @@ -44,4 +44,6 @@ public class GovernCapacityResultDTO implements Serializable { * 当前agencyName的上一级组织名称 */ private String parentAgencyName; + + private String orgId; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java new file mode 100644 index 0000000000..7ec31acd09 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java @@ -0,0 +1,124 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * @description: + * @author: liushaowen + * @date: 2021/2/24 16:15 + */ +@Data +public class ScreenProjectDetailResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 项目id + */ + private String projectId; + /** + * 议题内容,其实就是项目内容 + */ + private String projectContent; + /** + * 上报时间,对应的是立项时间;格式:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private String reportTime; + /** + * 所属类别名称 + */ + private String categoryName; + /** + * 上报人名 + */ + private String reportUserName; + /** + * 上报人电话 + */ + private String mobile; + /** + * 上报位置 + */ + private String reportAddress; + /** + * 图片列表 + */ + private List imgList; + /** + * 处理进展列表(返回的是按时间升序的集合) + */ + private List processList; + + @Data + public static class processDTO{ + @JsonIgnore + private String processId; + /** + * 处理部门名称 + */ + private String handleDeptName; + /** + * 公开处理意见 + */ + private String suggestion; + /** + * 处理时间:yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date reponseTime; + /** + * 关闭:close; 回应 response,结案closed_case,退回return,部门流转transfer,创建项目created + */ + private String operation; + /** + * 被吹哨部门;如果是多个以逗号隔开返给前端。 + */ + private String whistleDeptName; + + private List attachments; + + @Data + public static class AttachmentDTO{ + @JsonInclude(JsonInclude.Include.NON_NULL) + /** + * 文件名 + */ + private String fileName; + @JsonInclude(JsonInclude.Include.NON_NULL) + /** + * 附件名(uuid随机生成) + */ + private String attachmentName; + @JsonInclude(JsonInclude.Include.NON_NULL) + /** + * 附件大小 字节为单位 + */ + private String attachmentSize; + @JsonInclude(JsonInclude.Include.NON_NULL) + /** + * 文件格式(JPG、PNG、JPEG、BMP、GIF、PDF、PPT、PPTX、DOC、DOCX、XLS、XLSX、MP3、WMA、M4A、MP4、AVI、MOV、RMVB、RM、WMV) + */ + private String attachmentFormat; + @JsonInclude(JsonInclude.Include.NON_NULL) + /** + * 文件类型((图片 - image、 视频 - video、 语音 - voice、 文档 - doc)) + */ + private String attachmentType; + /** + * url地址 + */ + private String attachmentUrl; + @JsonInclude(JsonInclude.Include.NON_NULL) + /** + * 语音或视频时长,秒 + */ + private String duration; + } + } +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDistributionResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDistributionResultDTO.java new file mode 100644 index 0000000000..839870a4ab --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDistributionResultDTO.java @@ -0,0 +1,32 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @description: + * @author: liushaowen + * @date: 2021/2/24 15:26 + */ +@Data +public class ScreenProjectDistributionResultDTO implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 主键id + */ + private String id; + /** + * 项目标题 + */ + private String projectTitle; + /** + * 项目等级 1:红色事件;2:黄色事件;3:绿色事件 + */ + private String level; + /** + * 经纬度 + */ + private String longitude; + private String latitude; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java new file mode 100644 index 0000000000..63fdbc4571 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.plugins.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 7、【工作日志】党员志愿者服务近12月趋势图 + * + * @author yinzuomei@elink-cn.com + * @date 2021/2/27 19:53 + */ +@Data +public class VoluntaryServiceTrendFormDTO { + /** + * 当前组织id + */ + @NotBlank(message = "agencyId不能为空") + private String agencyId; + + @NotBlank(message = "目前只有平阴在传,默认赋值:370124") + private String areaCode; + + @NotBlank(message = "customerId不能为空") + private String customerId; + + /** + * 截止到某月格式:yyyyMM;目前没有让大屏前端赋值,代码默认为为上个月 + */ + private String endMonthId; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java index 3bbcb2973b..a4e5e0b9f4 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordRankFormDTO.java @@ -35,4 +35,7 @@ public class WorkRecordRankFormDTO implements Serializable { @NotBlank(message = "customerId不能为空") private String customerId; + + @NotBlank(message = "areaCode不能为空,目前只有平阴在传,默认赋值:370124") + private String areaCode; } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordTrendFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordTrendFormDTO.java new file mode 100644 index 0000000000..db2184bdc1 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/WorkRecordTrendFormDTO.java @@ -0,0 +1,46 @@ +package com.epmet.plugins.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 6、【工作日志】近12月趋势图 + * + * @author sun + */ +@Data +public class WorkRecordTrendFormDTO implements Serializable { + private static final long serialVersionUID = -2934835714413031036L; + /** + * party:支部建设; union:联建共建;党员志愿服务:voluntaryservice + */ + @NotBlank(message = "dataType不能为空;可选值:party:支部建设; union:联建共建") + private String dataType; + + /** + * 当前组织id + */ + @NotBlank(message = "agencyId不能为空") + private String agencyId; + + /** + * 组织次数:organize;参与人数:joinuser;平均参与人数:avguser + */ + @NotBlank(message = "type不能为空") + private String type; + + @NotBlank(message = "customerId不能为空") + private String customerId; + + /** + * 查询数据起始月份Id + */ + private String startMonth; + + /** + * 查询数据结束月份Id + */ + private String endMonth; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendDTO.java new file mode 100644 index 0000000000..49e79a19de --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendDTO.java @@ -0,0 +1,30 @@ +package com.epmet.plugins.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 7、【工作日志】党员志愿者服务近12月趋势图 + * + * @author yinzuomei@elink-cn.com + * @date 2021/2/28 13:41 + */ +@Data +public class VoluntaryServiceTrendDTO implements Serializable { + private String monthId; + /** + * 组织次数 + */ + private Integer organizeTotal; + + /** + * 参与人数 + */ + private Integer participateUserTotal; + + /** + * 平均参与人数 + */ + private Integer avgParticipateUserTotal; +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendResultDTO.java new file mode 100644 index 0000000000..ad5a204aef --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/VoluntaryServiceTrendResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.plugins.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 7、【工作日志】党员志愿者服务近12月趋势图 + * + * @author yinzuomei@elink-cn.com + * @date 2021/2/27 19:55 + */ +@Data +public class VoluntaryServiceTrendResultDTO implements Serializable { + private static final long serialVersionUID = -560895826884970305L; + private List xAxis=new ArrayList<>(); + //组织次数:organize;参与人数:joinuser;平均参与人数:avguser + private List organizeList=new ArrayList<>(); + private List joinUserList=new ArrayList<>(); + private List avgUserList=new ArrayList<>(); +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.java index 08c8df3ff2..4ca6521cce 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordRankResultDTO.java @@ -4,6 +4,7 @@ import lombok.AllArgsConstructor; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -29,4 +30,10 @@ public class WorkRecordRankResultDTO implements Serializable { *下级排行列表 */ private List subRankList; + + public WorkRecordRankResultDTO() { + this.participateTotal=0; + this.participateUserTotal=0; + this.subRankList=new ArrayList<>(); + } } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordTrendResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordTrendResultDTO.java new file mode 100644 index 0000000000..6c0aec4959 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/result/WorkRecordTrendResultDTO.java @@ -0,0 +1,56 @@ +package com.epmet.plugins.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 6、【工作日志】近12月趋势图 + * + * @author sun + */ +@Data +public class WorkRecordTrendResultDTO implements Serializable { + /** + * 横轴 过去十二个月份 + * ['1月', '2月', '3月', '4月', '5月','6月','7月','8月','9月','10月','11月','12月'] + */ + private List xAxis = new ArrayList<>(); + /** + * 资源标签名 + * ['三会一课', '主题党日', '三述专题', '志愿服务', '党内关怀'] + */ + private List legend = new ArrayList<>(); + + /** + *各项资源对应数据对象 + */ + private List series = new ArrayList<>(); + + @Data + public static class SeriesResultDTO { + /** + * 资源标签名 + * ['三会一课', '主题党日', '三述专题', '志愿服务', '党内关怀'] + */ + private String name; + /** + * 各项资源对应12月份数据 + */ + private List data = new ArrayList<>(); + /** + * 数据对应的月份Id + */ + @JsonIgnore + private String monthId; + /** + * 各项资源对应某一月份数据 + */ + @JsonIgnore + private Integer value = 0; + } + +} diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index e53e3b0643..8cb39e2c6b 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -39,6 +39,11 @@ common-service-client 2.0.0 + + com.epmet + oper-crm-client + 2.0.0 + org.springframework.boot spring-boot-starter-web diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java index 77c11404d5..4e409e6316 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/plugins/WorkRecordController.java @@ -1,10 +1,17 @@ package com.epmet.datareport.controller.plugins; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgDailyService; +import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO; import com.epmet.plugins.form.WorkRecordRankFormDTO; +import com.epmet.plugins.form.WorkRecordTrendFormDTO; +import com.epmet.plugins.result.VoluntaryServiceTrendResultDTO; import com.epmet.plugins.result.WorkRecordRankResultDTO; +import com.epmet.plugins.result.WorkRecordTrendResultDTO; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -14,17 +21,16 @@ import org.springframework.web.bind.annotation.*; * @author yinzuomei@elink-cn.com * @date 2021/2/21 19:51 */ +@Slf4j @RestController -@RequestMapping("plugins/workrecord") +@RequestMapping("screen/plugins/workrecord") public class WorkRecordController { @Autowired private ScreenWorkRecordOrgDailyService screenWorkRecordOrgDailyService; - //todo 工作日志是否要添加area_code、parent_area_code、orgType;插件是否可以提供;也可以采集的时候赋值 //5、【工作日志】本机及下级排名 //NEI接口地址:https://nei.netease.com/interface/detail/?pid=57068&id=348966 //返参中的当前组织的参与人数、组织次数 直接sum所有下级的值; //下级根据当前组织的areaCode查询下级列表,再去查询screen_work_record_org_daily - //legend来源于screen_customer_work_record_dict表 level=2,dataType=party @PostMapping("ranklist") public Result rankList(@RequestHeader("CustomerId")String customerId, @RequestBody WorkRecordRankFormDTO formDTO){ @@ -37,4 +43,37 @@ public class WorkRecordController { //6、【工作日志】近12月趋势图 //NEI接口地址:https://nei.netease.com/interface/detail/?pid=57068&id=348967 //可以下级组织+下级网格 orgId 直接 in + /** + * @Description 6、【工作日志】近12月趋势图 + * @author sun + */ + @PostMapping("trend") + public Result trend(@RequestHeader("CustomerId")String customerId, @RequestBody WorkRecordTrendFormDTO formDTO){ + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO); + if(!"party".equals(formDTO.getDataType())&&!"union".equals(formDTO.getDataType())){ + throw new RenException("入参dataType值错误,可选值:party--支部建设; union--联建共建"); + } + if(!"organize".equals(formDTO.getType())&&!"joinuser".equals(formDTO.getType())&&!"avguser".equals(formDTO.getType())){ + throw new RenException("入参type值错误,可选值:组织次数--organize;参与人数--joinuser;平均参与人数--avguser"); + } + return new Result().ok(screenWorkRecordOrgDailyService.trend(formDTO)); + } + + /** + * @param customerId + * @param formDTO + * @author yinzuomei + * @description 7、【工作日志】党员志愿者服务近12月趋势图 + * @Date 2021/2/27 19:56 + **/ + @PostMapping("voluntaryservicetrend") + public Result voluntaryServiceTrend(@RequestHeader("CustomerId")String customerId, @RequestBody VoluntaryServiceTrendFormDTO formDTO){ + formDTO.setCustomerId(customerId); + if (StringUtils.isBlank(formDTO.getEndMonthId())) { + formDTO.setEndMonthId(com.epmet.commons.tools.utils.DateUtils.getCurrentTimeBeforeMonthId()); + } + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(screenWorkRecordOrgDailyService.voluntaryServiceTrend(formDTO)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java index 88fa5c31b8..ed31aef27a 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/project/ProjectController.java @@ -5,21 +5,21 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.datareport.service.evaluationindex.screen.*; +import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectGridDailyService; +import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectOrgDailyService; +import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantityGridMonthlyService; +import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; import com.epmet.datareport.service.project.ProjectService; import com.epmet.dto.form.ProcessListFormDTO; -import com.epmet.dto.form.screen.EfficiencyAnalysisFormDTO; -import com.epmet.dto.form.screen.QueryQuantityMonthlyFormDTO; -import com.epmet.dto.form.screen.ScreenCommonFormDTO; -import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO; -import com.epmet.dto.result.screen.ProjectQuantityResultDTO; -import com.epmet.dto.result.screen.QueryQuantityMonthlyResultDTO; import com.epmet.project.constant.ProjectConstant; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; import com.epmet.project.dto.result.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import java.util.List; @@ -129,43 +129,4 @@ public class ProjectController { public Result> myNextAgency(@LoginUser TokenDto tokenDto){ return new Result>().ok(projectService.getMyNextAgency(tokenDto)); } - - /** - * @param customerId - * @param formDTO - * @description 【事件分析】数量统计查询 平阴大屏 - **/ - @PostMapping("queryquantity") - public Result queryQuantity(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCommonFormDTO formDTO){ - formDTO.setCustomerId(customerId); - return new Result().ok(projectOrgDailyService.queryQuantity(formDTO)); - } - - /** - * @param customerId - * @param formDTO - * @author yinzuomei - * @description 近12个月【事件分析】月度数量分析 平阴大屏 - **/ - @PostMapping("queryquantity-monthly") - public Result queryQuantityMonthly(@RequestHeader("CustomerId") String customerId, @RequestBody QueryQuantityMonthlyFormDTO formDTO) { - formDTO.setCustomerId(customerId); - ValidatorUtils.validateEntity(formDTO); - return new Result().ok(projectQuantityOrgMonthlyService.queryQuantityMonthly(formDTO)); - } - - /** - * @param customerId - * @param formDTO - * @author yinzuomei - * @description 【事件分析】效率分析 平阴大屏 - **/ - @PostMapping("efficiency-analysis") - public Result> efficiencyAnalysis(@RequestHeader("CustomerId") String customerId, @RequestBody EfficiencyAnalysisFormDTO formDTO){ - formDTO.setCustomerId(customerId); - ValidatorUtils.validateEntity(formDTO); - return new Result>().ok(projectOrgDailyService.efficiencyAnalysis(formDTO)); - } - - //todo 【事件类型分析】NEI接口地址: https://nei.netease.com/interface/detail/?pid=57068&id=346721 } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java index 4cec62dc66..f3c2a545c5 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassRootsGovernController.java @@ -8,10 +8,7 @@ import com.epmet.evaluationindex.screen.dto.form.AgencyFormDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyNumTypeParamFormDTO; import com.epmet.evaluationindex.screen.dto.result.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java index f7273b3da8..6d2a49cbe7 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/GrassrootsPartyDevController.java @@ -10,11 +10,9 @@ import com.epmet.evaluationindex.screen.dto.result.BranchBuildRankResultDTO; import com.epmet.evaluationindex.screen.dto.result.BranchBuildTrendResultDTO; import com.epmet.evaluationindex.screen.dto.result.PartymemberAgeDistributionResultDTO; import com.epmet.evaluationindex.screen.dto.result.PartymemberPercentResultDTO; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * 基层党建相关各指标查询 @@ -22,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController; * @author yinzuomei@elink-cn.com * @date 2020/8/18 10:11 */ +@Slf4j @RestController @RequestMapping("/screen/grassrootspartydev") public class GrassrootsPartyDevController { @@ -52,9 +51,10 @@ public class GrassrootsPartyDevController { * @date 2020.08.18 17:54 **/ @PostMapping("ageinfo") - public Result ageInfo(@RequestBody ParymemberFormDTO param){ + public Result ageInfo(@RequestBody ParymemberFormDTO param,@RequestHeader("CustomerId") String customerId){ + log.info("CustomerId"+customerId); ValidatorUtils.validateEntity(param, ParymemberFormDTO.Parymember.class); - return new Result().ok(grassrootsPartyDevService.partymemberAgeDistribution(param)); + return new Result().ok(grassrootsPartyDevService.partymemberAgeDistribution(param,customerId)); } /** diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java index 5ebeef980d..cb851647af 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java @@ -150,5 +150,16 @@ public class IndexController { return new Result>().ok(indexService.advancedBranchRank(formDTO)); } - + /** + * @param formDTO + * @author yinzuomei + * @description 8、平阴大屏-下级街道or网格指数排行 + * @Date 2021/2/28 14:33 + **/ + @PostMapping("subagencyindexrank-py") + Result> subAgencyIndexRankPy(@RequestHeader("CustomerId") String customerId,@RequestBody SubAgencyIndexRankPyFormDTO formDTO) { + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(indexService.subAgencyIndexRankPy(formDTO)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java index ca1104f534..bbd0039e71 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/PartyMemberLeadController.java @@ -6,10 +6,7 @@ import com.epmet.datareport.service.evaluationindex.screen.PartyMemberLeadServic import com.epmet.evaluationindex.screen.dto.form.*; import com.epmet.evaluationindex.screen.dto.result.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.util.List; diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java index 483e3edcc1..84e109d3fc 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java @@ -2,14 +2,26 @@ package com.epmet.datareport.controller.screen; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectOrgDailyService; +import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService; +import com.epmet.dto.form.screen.CategoryAnalysisFormDTO; +import com.epmet.dto.form.screen.EfficiencyAnalysisFormDTO; +import com.epmet.dto.form.screen.QueryQuantityMonthlyFormDTO; +import com.epmet.dto.form.screen.ScreenCommonFormDTO; +import com.epmet.dto.result.screen.CategoryAnalysisResultDTO; +import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO; +import com.epmet.dto.result.screen.ProjectQuantityResultDTO; +import com.epmet.dto.result.screen.QueryQuantityMonthlyResultDTO; import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO; +import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO; +import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO; import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; + +import java.util.List; /** * 项目 @@ -17,13 +29,17 @@ import org.springframework.web.bind.annotation.RestController; * @author yinzuomei@elink-cn.com * @date 2020/8/18 10:16 */ +@Slf4j @RestController @RequestMapping("/screen/project") public class ScreenProjectController { @Autowired private ScreenProjectService screenProjectService; - + @Autowired + private ScreenProjectOrgDailyService projectOrgDailyService; + @Autowired + private ScreenProjectQuantityOrgMonthlyService projectQuantityOrgMonthlyService; /** * @Description 3、项目详情 * @param projectDetailFormDTO @@ -36,4 +52,81 @@ public class ScreenProjectController { return new Result().ok(screenProjectService.projectDetail(projectDetailFormDTO)); } + /** + * @Description 中央区事件分析-项目分布 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2021/2/24 16:10 + */ + @PostMapping("projectdistribution") + public Result projectDistribution(@RequestBody ScreenProjectDistributionFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + return screenProjectService.projectDistribution(formDTO); + } + + /** + * @Description 中央区事件分析-项目详情接口 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2021/2/24 16:10 + */ + @PostMapping("projectdetailv2") + public Result projectDetail(@RequestBody ScreenProjectDetailFormDTO formDTO){ + return screenProjectService.projectDistributionDetail(formDTO); + } + + /** + * @param customerId + * @param formDTO + * @description 1、【事件分析】数量统计查询 平阴大屏 + **/ + @PostMapping("queryquantity") + public Result queryQuantity(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCommonFormDTO formDTO){ + formDTO.setCustomerId(customerId); + return new Result().ok(projectOrgDailyService.queryQuantity(formDTO)); + } + + /** + * @param customerId + * @param formDTO + * @author yinzuomei + * @description 2、近12个月【事件分析】月度数量分析 平阴大屏 + **/ + @PostMapping("queryquantity-monthly") + public Result queryQuantityMonthly(@RequestHeader("CustomerId") String customerId, @RequestBody QueryQuantityMonthlyFormDTO formDTO) { + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(projectQuantityOrgMonthlyService.queryQuantityMonthly(formDTO)); + } + + /** + * @param customerId + * @param formDTO + * @author yinzuomei + * @description 3、【事件分析】效率分析 平阴大屏 + **/ + @PostMapping("efficiency-analysis") + public Result> efficiencyAnalysis(@RequestHeader("CustomerId") String customerId, @RequestBody EfficiencyAnalysisFormDTO formDTO){ + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(projectOrgDailyService.efficiencyAnalysis(formDTO)); + } + + /** + * 【事件分析】类型分析 + * @author zhaoqifeng + * @date 2021/2/23 15:37 + * @param customerId + * @param formDTO 【事件类型分析】NEI接口地址: https://nei.netease.com/interface/detail/?pid=57068&id=346721 + * @return com.epmet.commons.tools.utils.Result> + */ + @PostMapping("category-analysis") + public Result> categoryAnalysis(@RequestHeader("CustomerId") String customerId, + @RequestBody CategoryAnalysisFormDTO formDTO) { + log.info("===================customerId"+customerId); + ValidatorUtils.validateEntity(formDTO, CategoryAnalysisFormDTO.CategoryAnalysis.class); + return new Result>().ok(screenProjectService.categoryAnalysis(customerId, formDTO)); + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java index dda6b177cf..a78d744487 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/user/UserAnalysisController.java @@ -1,5 +1,7 @@ package com.epmet.datareport.controller.user; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.user.UserIncrTrendFormDTO; @@ -50,9 +52,9 @@ public class UserAnalysisController { * @Date 2020/6/22 13:30 **/ @PostMapping("subagency") - public Result> subAgency(@RequestBody UserSubAgencyFormDTO formDTO) { + public Result> subAgency(@LoginUser TokenDto tokenDto, @RequestBody UserSubAgencyFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO,UserSubAgencyFormDTO.AddUserInternalGroup.class); - List userSubAgencyResultDTO = userService.subAgency(formDTO); + List userSubAgencyResultDTO = userService.subAgency(tokenDto, formDTO); return new Result>().ok(userSubAgencyResultDTO); } @@ -64,9 +66,9 @@ public class UserAnalysisController { * @Date 2020/6/22 13:33 **/ @PostMapping("subgrid") - public Result> subGrid(@RequestBody UserSubGridFormDTO formDTO) { + public Result> subGrid(@LoginUser TokenDto tokenDto, @RequestBody UserSubGridFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, UserSubGridFormDTO.AddUserInternalGroup.class); - List userSubGridResultDTO = userService.subGrid(formDTO); + List userSubGridResultDTO = userService.subGrid(tokenDto, formDTO); return new Result>().ok(userSubGridResultDTO); } @@ -78,9 +80,9 @@ public class UserAnalysisController { * @Date 2020/6/22 13:36 **/ @PostMapping("incrtrend") - public Result> incrTrend(@RequestBody UserIncrTrendFormDTO formDTO) { + public Result> incrTrend(@LoginUser TokenDto tokenDto, @RequestBody UserIncrTrendFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO, UserIncrTrendFormDTO.AddUserInternalGroup.class); - List userIncrTrendResultDTO = userService.incrTrendV2(formDTO); + List userIncrTrendResultDTO = userService.incrTrendV2(tokenDto, formDTO); return new Result>().ok(userIncrTrendResultDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java index e752fe40dd..effc1dce93 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java @@ -39,6 +39,7 @@ public interface ScreenCpcBaseDataDao{ * @date 2020.08.18 17:47 **/ PartymemberAgeDistributionResultDTO selectPartymemberAgeDistribution(@Param("agencyId") String agencyId); + PartymemberAgeDistributionResultDTO selectPartymemberAgeDistributionNew(@Param("agencyId") String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index af4b0b7af2..498f57309c 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -150,4 +150,7 @@ public interface ScreenCustomerAgencyDao { **/ List selectGridList(@Param("areaCode") String areaCode,@Param("agencyId") String agencyId); + List getNextAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId); + + List selectSubAgencyIds(@Param("areaCode")String areaCode,@Param("agencyId")String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java index a024d60791..e0484794e6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -80,5 +80,6 @@ public interface ScreenCustomerGridDao { * @date 2020/8/26 5:29 下午 */ List selectGridInfo(@Param("agencyId")String agencyId); - + + List selectSubGridIds(@Param("areaCode")String areaCode, @Param("agencyId")String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenDifficultyDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenDifficultyDataDao.java index 5a0a566342..801f8d5026 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenDifficultyDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenDifficultyDataDao.java @@ -42,6 +42,14 @@ public interface ScreenDifficultyDataDao { **/ List selectDifficulty(@Param("agencyId")String agencyId,@Param("type")String type); + /** + * @Description 查询难点赌点-耗时最长|涉及部门最多|处理次数【new】 + * @Param type + * @author zxc + * @date 2021/2/25 下午6:41 + */ + List selectDifficultyByAreaCode(@Param("areaCode")String areaCode,@Param("type")String type); + ProjectDetailResultDTO projectDetail(@Param("eventId")String projectId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenGovernRankDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenGovernRankDataDao.java index e973aa85f3..405144008a 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenGovernRankDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenGovernRankDataDao.java @@ -41,4 +41,13 @@ public interface ScreenGovernRankDataDao{ * @date 2020.08.20 17:34 **/ List selectGovernCapacityRatio(@Param("monthId") String monthId,@Param("agencyId") String agencyId); + + /** + * @Description 查询政府治理能力各项指标【new】 + * @Param monthId + * @Param orgIds + * @author zxc + * @date 2021/2/26 上午9:22 + */ + List selectGovernCapacityRatioNew(@Param("monthId") String monthId,@Param("orgIds") List orgIds); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java index f9965876db..f502b0f471 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java @@ -56,6 +56,7 @@ public interface ScreenIndexDataMonthlyDao{ * @date 2020/8/20 10:04 上午 */ List selectSubAgencyIndexRank(SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO); + List selectSubAgencyIndexRankNew(SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO); /** * 5、下级部门指数排行(安宁数据段用) - 月(上一个月) @@ -102,4 +103,26 @@ public interface ScreenIndexDataMonthlyDao{ * @author sun */ List getSingleIndexRank(SubSingleIndexRankFormDTO formDTO); + + /** + * @param yearId + * @param areaCode + * @Description 根据areaCode查询下级指数 + * @author yinzuomei + */ + List selectSubStreetByAreaCode(@Param("customerId") String customerId, + @Param("yearId") String yearId, + @Param("areaCode") String areaCode, + @Param("topNum") int topNum); + + /** + * @param yearId + * @param areaCode + * @Description 根据areaCode查询网格指数 + * @author yinzuomei + */ + List selectSubGridByAreaCode(@Param("customerId") String customerId, + @Param("yearId") String yearId, + @Param("areaCode") String areaCode, + @Param("topNum") int topNum); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenOrgRankDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenOrgRankDataDao.java index 2b9bdba497..1e9a5efe09 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenOrgRankDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenOrgRankDataDao.java @@ -42,4 +42,6 @@ public interface ScreenOrgRankDataDao{ **/ List selectGridDataMonthly(@Param("agencyId") String agencyId, @Param("monthId") String monthId); + List selectGridDataMonthlyAreaCode(@Param("monthId") String monthId, + @Param("areaCode")String areaCode); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java index 1ca974982f..30094b7225 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java @@ -39,5 +39,6 @@ public interface ScreenPartyLinkMassesDataDao { * @date 2020/8/20 2:48 下午 */ List selectContactMassLineChart(@Param("agencyId")String agencyId); - + + List selectContactMassLineChartByAgencyIds(@Param("agencyIdList")List agencyIdList); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java index 0f442931b5..fe5adc1a77 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java @@ -71,4 +71,8 @@ public interface ScreenPartyUserRankDataDao{ * @author sun */ List selectPartymemberPointList(PartIndexScroeRankFormDTO formDTO); + + List selectPartymemberPointOrderByAreaCode(@Param("areaCode") String areaCode); + + List selectUserPointOrderByAreaCode(@Param("areaCode") String areaCode); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java index 92177ec52c..5bc3077e85 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPioneerDataDao.java @@ -21,6 +21,8 @@ import com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 党建引领-先锋模范数据 * @@ -37,5 +39,16 @@ public interface ScreenPioneerDataDao{ * @date 2020/8/20 5:22 下午 */ FineExampleResultDTO selectFineExample(@Param("agencyId")String agencyId); + + /** + * @Description 根据地区码查询先锋模范 + * @param areaCode + * @param customerId + * @param customerIds - 子级客户列表 + * @return com.epmet.evaluationindex.screen.dto.result.FineExampleResultDTO + * @author wangc + * @date 2021.02.24 15:39 + */ + FineExampleResultDTO selectFineExampleByAreaCode(@Param("areaCode")String areaCode,@Param("customerId")String customerId,@Param("list") List customerIds); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java new file mode 100644 index 0000000000..c3b90ff1c7 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java @@ -0,0 +1,42 @@ +/** + * 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.datareport.dao.evaluationindex.screen; + +import com.epmet.dto.result.screen.CategoryAnalysisResultDTO; +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-02-23 + */ +@Mapper +public interface ScreenProjectCategoryOrgDailyDao { + /** + * 类型分析 + * @author zhaoqifeng + * @date 2021/2/23 16:47 + * @param agencyId + * @return java.util.List + */ + List selectCategoryAnalysis(@Param("agencyId") String agencyId); +} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java new file mode 100644 index 0000000000..eeb9831e21 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -0,0 +1,27 @@ +package com.epmet.datareport.dao.evaluationindex.screen; + +import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO; +import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +@Mapper +public interface ScreenProjectDataDao { + + List projectDistribution(@Param("agencyId") String agencyId, + @Param("ids") List ids, + @Param("level") String level, + @Param("status")String status); + + List selectIdsByAreaCode(@Param("areaCode") String areaCode); + + List projectDistributionDetail(@Param("projectId") String projectId); + + List selectProjectImgs(@Param("projectId") String projectId); + + List selectProjectProcess(@Param("projectId") String projectId); + + List selectProjectProcessAttachments(@Param("processId") String processId); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectGridDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectGridDailyDao.java index 1eada75ab4..33512f7557 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectGridDailyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectGridDailyDao.java @@ -39,5 +39,9 @@ public interface ScreenProjectGridDailyDao{ * @author yinzuomei * @description 下级网格的效率(解决率)列表 **/ - List queryGridEfficiencyAnalysis(@Param("customerId") String customerId, @Param("areaCode") String areaCode); + List queryGridEfficiencyAnalysis(@Param("customerId") String customerId, + @Param("areaCode") String areaCode, + @Param("dateId")String dateId); + + String selectLastDateId(String customerId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java index 88c2aa0e77..6feb784626 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenPublicPartiTotalDataDao.java @@ -39,4 +39,14 @@ public interface ScreenPublicPartiTotalDataDao{ * @date 2020.08.20 16:00 **/ List selectPublicPartiTotal(@Param("agencyId") String agencyId); + + + /** + * @Description 根据areaCode查询公众参与各类总数 + * @param areaCode + * @return + * @author wangc + * @date 2020.08.20 16:00 + **/ + List selectPublicPartiTotalByAreaCode(@Param("areaCode") String areaCode); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java index 962691f625..39a16db7bf 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserJoinDao.java @@ -42,6 +42,16 @@ public interface ScreenUserJoinDao { **/ UserJoinIndicatorGrowthRateResultDTO selectUserJoinData(@Param("agencyId") String agencyId, @Param("monthId")String monthId); + /** + * @Description 根据地区码查询用户参与数据 + * @param areaCode + * @return + * @author wangc + * @date 2020.08.20 15:07 + **/ + UserJoinIndicatorGrowthRateResultDTO selectUserJoinDataByAreaCode(@Param("areaCode") String areaCode, @Param("monthId")String monthId); + + /** * @Description 查询月度用户参与数据 * @param agencyId diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java index 653cf3f606..8de5eaadfc 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenUserTotalDataDao.java @@ -22,6 +22,8 @@ import com.epmet.evaluationindex.screen.dto.result.TopProfileResultDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 中央区-各类(用户|党员|党群|话题|议题|项目|注册人数|参与人数)总数 * @@ -56,5 +58,6 @@ public interface ScreenUserTotalDataDao { * @date 2020.08.20 14:54 **/ int selectAvgIssue(@Param("agencyId")String agencyId); - + + PartymemberPercentResultDTO selectAgencyPartymemberPercentByIds(@Param("orgIds") List orgIds); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenCustomerWorkRecordDictDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenCustomerWorkRecordDictDao.java index 5ee450d32c..7b2bf609c7 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenCustomerWorkRecordDictDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenCustomerWorkRecordDictDao.java @@ -20,6 +20,9 @@ package com.epmet.datareport.dao.plugins; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.datareport.entity.plugins.ScreenCustomerWorkRecordDictEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 工作日志资源字典表 @@ -29,5 +32,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ScreenCustomerWorkRecordDictDao extends BaseDao { - + + List selectListByDataType(@Param("customerId") String customerId, @Param("dataType") String dataType); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java index ca0bc02fda..d27a4eee75 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgDailyDao.java @@ -19,7 +19,6 @@ package com.epmet.datareport.dao.plugins; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgDailyEntity; -import com.epmet.plugins.result.WorkRecordRankResultDTO; import com.epmet.plugins.result.WorkRecordSubRank; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -35,23 +34,37 @@ import java.util.List; @Mapper public interface ScreenWorkRecordOrgDailyDao extends BaseDao { /** - * @param areaCode 当前组织对应的areaCode; - * @param dataType - * @param topRow * @return com.epmet.plugins.result.WorkRecordRankResultDTO * @author yinzuomei - * @description 5、【工作日志】本机及下级排名 + * @description 5、【工作日志】本机及下级排名- 下级组织 * @Date 2021/2/23 23:37 **/ - List selectSubList(@Param("areaCode") String areaCode, - @Param("agencyId") String agencyId, - @Param("dataType") String dataType, - @Param("topRow") Integer topRow, + List selectSubList(@Param("subAgencyIds") List subAgencyIds, + @Param("dataType")String dataType, + @Param("customerId")String customerId, @Param("dateId")String dateId); - String selectLatestDateId(String customerId); + /** + * @param subGridIds 当前组织的指数网格ids + * @author yinzuomei + * @description + * @Date 2021/2/27 19:31 + **/ + List selectSubGridList(@Param("subGridIds")List subGridIds, + @Param("dataType")String dataType, + @Param("customerId")String customerId, + @Param("dateId")String dateId); + + /** + * @param customerIds 当前客户+所有子客户 列表 + * @author yinzuomei + * @description 查询最近一次上传的日期 + * @Date 2021/2/27 19:31 + **/ + String selectLatestDateId(@Param("customerIds")List customerIds); - WorkRecordRankResultDTO selectCurrentAgency(@Param("areaCode") String areaCode, - @Param("dataType") String dataType, + List selectCurrentAgency(@Param("agencyId") String agencyId, + @Param("dataType")String dataType, + @Param("customerId")String customerId, @Param("dateId")String dateId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java index 5146beb59e..10e5fd88c3 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/plugins/ScreenWorkRecordOrgMonthlyDao.java @@ -19,7 +19,13 @@ package com.epmet.datareport.dao.plugins; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgMonthlyEntity; +import com.epmet.plugins.form.WorkRecordTrendFormDTO; +import com.epmet.plugins.result.VoluntaryServiceTrendDTO; +import com.epmet.plugins.result.WorkRecordTrendResultDTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 工作日志-组织按月统计(增量) @@ -29,5 +35,15 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ScreenWorkRecordOrgMonthlyDao extends BaseDao { - + + /** + * @Description 按组织查询某项数据近12月趋势图 + * @author sun + */ + List selectMonthList(WorkRecordTrendFormDTO formDTO); + + List selectVoluntaryServiceTrendDTO(@Param("customerId")String customerId, + @Param("orgIds") List orgIds, + @Param("startMonth")String startMonth, + @Param("endMonth")String endMonth); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java index 8e265fb34b..4f11f160ab 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/AgencyService.java @@ -1,5 +1,6 @@ package com.epmet.datareport.service.evaluationindex.screen; +import com.epmet.dto.AgencyInfoDTO; import com.epmet.dto.form.AddAreaCodeDictFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; @@ -61,4 +62,15 @@ public interface AgencyService { AgencyNodeDTO queryStaffAgencyTree(String agencyId); ScreenCustomerAgencyDTO queryAgencyInfo(String agencyId); + + /** + * @return java.util.List + * @param agencyId + * @author yinzuomei + * @description 获取当前组织的下级组织集合 + * @Date 2021/2/25 16:52 + **/ + List getNextAgencyIds(String areaCode,String agencyId); + + AgencyInfoDTO getAgencyInfoDTO(String areaCode, String agencyId); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/GrassrootsPartyDevService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/GrassrootsPartyDevService.java index 41c8fafc28..09e94717b6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/GrassrootsPartyDevService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/GrassrootsPartyDevService.java @@ -34,7 +34,7 @@ public interface GrassrootsPartyDevService { * @author wangc * @date 2020.08.18 17:54 **/ - PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param); + PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param,String customerId); /** * @Description 3、支部建设情况|联建共建情况-折线图 diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java index 0dc99d37bc..bfbf7a9d41 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java @@ -86,4 +86,12 @@ public interface IndexService { * @date 2020/10/22 10:58 上午 */ List getSubSingleIndexRank(SubSingleIndexRankFormDTO formDTO); + + /** + * @param formDTO + * @author yinzuomei + * @description 8、平阴大屏-下级街道or网格指数排行 + * @Date 2021/2/28 14:33 + **/ + List subAgencyIndexRankPy(SubAgencyIndexRankPyFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java index aea908ff15..b4b0fe8725 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java @@ -1,8 +1,15 @@ package com.epmet.datareport.service.evaluationindex.screen; +import com.epmet.commons.tools.utils.Result; +import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO; +import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO; +import com.epmet.dto.form.screen.CategoryAnalysisFormDTO; +import com.epmet.dto.result.screen.CategoryAnalysisResultDTO; import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO; import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO; +import java.util.List; + /** * 项目 * @@ -19,4 +26,17 @@ public interface ScreenProjectService { */ ProjectDetailResultDTO projectDetail(ProjectDetailFormDTO projectDetailFormDTO); + /** + * 【事件分析】类型分析 + * @author zhaoqifeng + * @date 2021/2/23 15:37 + * @param customerId + * @param formDTO + * @return java.util.List + */ + List categoryAnalysis(String customerId, CategoryAnalysisFormDTO formDTO); + + Result projectDistribution(ScreenProjectDistributionFormDTO formDTO); + + Result projectDistributionDetail(ScreenProjectDetailFormDTO formDTO); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java index 23d960354f..bf3f8dbdcc 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java @@ -10,6 +10,7 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao; import com.epmet.datareport.service.evaluationindex.screen.AgencyService; +import com.epmet.dto.AgencyInfoDTO; import com.epmet.dto.form.AddAreaCodeDictFormDTO; import com.epmet.dto.form.AreaCodeDictFormDTO; import com.epmet.dto.result.AreaCodeDictResultDTO; @@ -297,4 +298,28 @@ public class AgencyServiceImpl implements AgencyService { public ScreenCustomerAgencyDTO queryAgencyInfo(String agencyId) { return screenCustomerAgencyDao.selectByAgencyId(agencyId); } + + /** + * @param agencyId + * @return java.util.List + * @author yinzuomei + * @description 获取当前组织的下级组织集合 + * @Date 2021/2/25 16:52 + **/ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @Override + public List getNextAgencyIds(String areaCode,String agencyId) { + return screenCustomerAgencyDao.getNextAgencyIds(areaCode,agencyId); + } + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @Override + public AgencyInfoDTO getAgencyInfoDTO(String areaCode, String agencyId) { + AgencyInfoDTO agencyInfoDTO=new AgencyInfoDTO(); + agencyInfoDTO.setAgencyId(agencyId); + agencyInfoDTO.setAreaCode(areaCode); + agencyInfoDTO.setSubAgencyIds(screenCustomerAgencyDao.selectSubAgencyIds(areaCode,agencyId)); + agencyInfoDTO.setSubGridIds(screenCustomerGridDao.selectSubGridIds(areaCode,agencyId)); + return agencyInfoDTO; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java index afdbf95f82..e427ad9e3b 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java @@ -3,17 +3,23 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.*; +import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.evaluationindex.screen.GrassRootsGovernService; import com.epmet.datareport.utils.DateUtils; import com.epmet.datareport.utils.ModuleConstant; +import com.epmet.dto.result.ScreenCustomerAgencyDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyFormDTO; import com.epmet.evaluationindex.screen.dto.form.AgencyNumTypeParamFormDTO; import com.epmet.evaluationindex.screen.dto.result.*; +import com.epmet.feign.OperCrmOpenFeignClient; import com.github.pagehelper.PageHelper; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -32,6 +38,7 @@ import java.util.stream.Collectors; * @author yinzuomei@elink-cn.com * @date 2020/8/18 10:20 */ +@Slf4j @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { @@ -48,6 +55,13 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { private ScreenGovernRankDataDao screenGovernRankDataDao; @Autowired private ScreenPublicPartiTotalDataDao screenPublicPartiTotalDataDao; + @Autowired + private OperCrmOpenFeignClient crmClient; + @Autowired + private ScreenCustomerAgencyDao agencyDao; + @Autowired + private AgencyService screenCustomerAgencyService; + /** * @Description 1、热心市民积分排行 @@ -65,7 +79,13 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { param.setTopNum(NumConstant.FIVE); } PageHelper.startPage(NumConstant.ONE,param.getTopNum()); - List userPointList = screenPartyUserRankDataDao.selectUserPointOrder(param.getAgencyId()); + List userPointList = new ArrayList<>(); + if(StringUtils.isNotBlank(param.getAreaCode())){ + log.info("热心市民积分排行按照areaCode查询"+param.getAreaCode()); + userPointList=screenPartyUserRankDataDao.selectUserPointOrderByAreaCode(param.getAreaCode()); + }else{ + userPointList=screenPartyUserRankDataDao.selectUserPointOrder(param.getAgencyId()); + } UserPointRankResultDTO result = new UserPointRankResultDTO(); result.setNameData(userPointList.stream().map(UserPointResultDTO::getName).collect(Collectors.toList())); result.setPointsData(userPointList.stream().map(UserPointResultDTO::getPoint).collect(Collectors.toList())); @@ -84,11 +104,16 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public List difficultProject(AgencyNumTypeParamFormDTO param) { + List result = new ArrayList<>(); if(null == param.getTopNum()){ param.setTopNum(NumConstant.TWO); } PageHelper.startPage(NumConstant.ONE,param.getTopNum()); - List result = screenDifficultyDataDao.selectDifficulty(param.getAgencyId(),param.getType()); + if (StringUtils.isNotEmpty(param.getAreaCode())){ + result = screenDifficultyDataDao.selectDifficultyByAreaCode(param.getAreaCode(),param.getType()); + }else { + result = screenDifficultyDataDao.selectDifficulty(param.getAgencyId(),param.getType()); + } for(DifficultProjectResultDTO resultDTO:result){ if (StringUtils.isNotBlank(resultDTO.getImgUrl()) && !resultDTO.getImgUrl().contains("http")) { resultDTO.setImgUrl(StrConstant.EPMETY_STR); @@ -110,15 +135,24 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public PublicPartiProfileResultDTO publicPartiProfile(AgencyFormDTO param) { + ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()); + Result> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId()); + List subCustomers; + if(null == crmResp || !crmResp.success()|| org.apache.commons.collections4.CollectionUtils.isEmpty(crmResp.getData())) {subCustomers = null ;} + else {subCustomers = crmResp.getData();} String monthId = dateUtils.getCurrentMonthId(); - UserJoinIndicatorGrowthRateResultDTO latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + UserJoinIndicatorGrowthRateResultDTO latest = CollectionUtils.isEmpty(subCustomers) ||StringUtils.isBlank(agencyInfo.getAreaCode())? + screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : + screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId); //保证获取公众参与概率数据的最大可能性 int time = NumConstant.TWELVE; while (null == latest && time > NumConstant.ONE) { time--; monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); - latest = screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId); + latest = CollectionUtils.isEmpty(subCustomers)||StringUtils.isBlank(agencyInfo.getAreaCode()) ? + screenUserJoinDao.selectUserJoinData(param.getAgencyId(), monthId) : + screenUserJoinDao.selectUserJoinDataByAreaCode(agencyInfo.getAreaCode(),monthId); } if (null == latest) return new PublicPartiProfileResultDTO(); @@ -137,18 +171,30 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { * @author wangc * @date 2020.08.20 15:32 **/ - @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override public List publicPartiRank(AgencyAndNumFormDTO param) { - if(null == param.getTopNum()){ + if (null == param.getTopNum()) { param.setTopNum(NumConstant.TWO); } - if(NumConstant.ZERO == param.getTopNum()){ + if (NumConstant.ZERO == param.getTopNum()) { param.setTopNum(NumConstant.MAX); } - PageHelper.startPage(NumConstant.ONE,param.getTopNum()); - List result = screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId()); - if(null == result) { + + ScreenCustomerAgencyDTO agencyInfo = agencyInfo(param.getAgencyId()); + List subCustomers; + Result> crmResp = crmClient.getAllSubCustomerIds(agencyInfo.getCustomerId()); + if (null == crmResp || !crmResp.success() || CollectionUtils.isEmpty(crmResp.getData())) { + subCustomers = null; + } else { + subCustomers = crmResp.getData(); + } + PageHelper.startPage(NumConstant.ONE, param.getTopNum()); + List result = + CollectionUtils.isEmpty(subCustomers) || StringUtils.isBlank(agencyInfo.getAreaCode()) ? + screenPublicPartiTotalDataDao.selectPublicPartiTotal(param.getAgencyId()) + : screenPublicPartiTotalDataDao.selectPublicPartiTotalByAreaCode(agencyInfo.getAreaCode()); + if (null == result) { return new ArrayList<>(); } return result; @@ -165,19 +211,33 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public List governCapacityRank(AgencyAndNumFormDTO param) { + List orderList = new ArrayList<>(); if(null == param.getTopNum()) param.setTopNum(NumConstant.FIVE); if(NumConstant.ZERO == param.getTopNum()) param.setTopNum(NumConstant.MAX); PageHelper.startPage(NumConstant.ONE,param.getTopNum()); String monthId = dateUtils.getCurrentMonthId(); - List orderList = - screenGovernRankDataDao.selectGovernCapacityRatio(monthId,param.getAgencyId()); - int time = NumConstant.TWELVE; - while(CollectionUtils.isEmpty(orderList) && time > NumConstant.ONE){ - time--; - monthId = dateUtils.getPreviousMonthIdByDest(null ,monthId); - PageHelper.startPage(NumConstant.ONE,param.getTopNum()); - orderList = - screenGovernRankDataDao.selectGovernCapacityRatio(monthId,param.getAgencyId()); + if (StringUtils.isNotEmpty(param.getAreaCode())){ + List nextAgencyIds = screenCustomerAgencyService.getNextAgencyIds(param.getAreaCode(), param.getAgencyId()); + if (CollectionUtils.isEmpty(nextAgencyIds)){ + return new ArrayList<>(); + } + orderList = screenGovernRankDataDao.selectGovernCapacityRatioNew(monthId,nextAgencyIds); + int time = NumConstant.TWELVE; + while(CollectionUtils.isEmpty(orderList) && time > NumConstant.ONE){ + time--; + monthId = dateUtils.getPreviousMonthIdByDest(null ,monthId); + PageHelper.startPage(NumConstant.ONE,param.getTopNum()); + orderList = screenGovernRankDataDao.selectGovernCapacityRatioNew(monthId,nextAgencyIds); + } + }else { + orderList = screenGovernRankDataDao.selectGovernCapacityRatio(monthId, param.getAgencyId()); + int time = NumConstant.TWELVE; + while (CollectionUtils.isEmpty(orderList) && time > NumConstant.ONE) { + time--; + monthId = dateUtils.getPreviousMonthIdByDest(null, monthId); + PageHelper.startPage(NumConstant.ONE, param.getTopNum()); + orderList = screenGovernRankDataDao.selectGovernCapacityRatio(monthId, param.getAgencyId()); + } } if(null == orderList || orderList.isEmpty()) return new ArrayList<>(); List result = new LinkedList<>(); @@ -207,7 +267,7 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { Map Xaxis = dateUtils.getXpro(); List monthlyData = screenUserJoinDao.selectUserJoinDataMonthly(param.getAgencyId(),Xaxis.keySet().iterator().next()); PublicPartiChartResultDTO result = new PublicPartiChartResultDTO(); - result.setXAxis(Xaxis.values().stream().collect(Collectors.toList())); + result.setXAxis(new ArrayList<>(Xaxis.values())); List defaultData = new LinkedList<>(); for(int i = NumConstant.ZERO ; i < NumConstant.TWELVE ; i++){ defaultData.add(NumConstant.ZERO); @@ -222,17 +282,17 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { result.setJoinUserNumList(new ArrayList<>()); result.setAverageJoinNumList(new ArrayList<>()); Map> dataMap = monthlyData.stream().collect(Collectors.groupingBy(UserJoinMonthlyResultDTO :: getMonthId)); - Xaxis.keySet().stream().forEach(monthId -> { + Xaxis.keySet().forEach(monthId -> { List data = dataMap.get(monthId); - if(null == data || data.isEmpty()){ + if (null == data || data.isEmpty()) { result.getOrganizeNumList().add(NumConstant.ZERO); result.getJoinUserNumList().add(NumConstant.ZERO); result.getAverageJoinNumList().add(NumConstant.ZERO); - }else{ + } else { Integer o = NumConstant.ZERO; Integer j = NumConstant.ZERO; Integer a = NumConstant.ZERO; - for(UserJoinMonthlyResultDTO unit : data){ + for (UserJoinMonthlyResultDTO unit : data) { o = null == unit.getOrganizeNum() ? NumConstant.ZERO : o + unit.getOrganizeNum(); j = null == unit.getJoinUserNum() ? NumConstant.ZERO : o + unit.getJoinUserNum(); a = null == unit.getAverageJoinNum() ? NumConstant.ZERO : o + unit.getAverageJoinNum(); @@ -254,6 +314,18 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { return percentStr.concat(ModuleConstant.SYMBOL_PERCENT); } + /** + * @Description 通过agencyId获取机关信息 + * @param agencyId + * @return java.lang.String + * @author wangc + * @date 2021.02.25 13:46 + */ + private ScreenCustomerAgencyDTO agencyInfo(String agencyId){ + ScreenCustomerAgencyDTO agencyInfo = agencyDao.selectByAgencyId(agencyId); + if(null == agencyInfo) throw new RenException("获取Agency信息失败"); + return agencyInfo; + } } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java index 73ebfc5c14..333c129f87 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassrootsPartyDevServiceImpl.java @@ -2,17 +2,22 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCpcBaseDataDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenPartyBranchDataDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenUserTotalDataDao; +import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.evaluationindex.screen.GrassrootsPartyDevService; import com.epmet.datareport.utils.DateUtils; import com.epmet.datareport.utils.ModuleConstant; +import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.BranchBuildRankFormDTO; import com.epmet.evaluationindex.screen.dto.form.BranchBuildTrendFormDTO; import com.epmet.evaluationindex.screen.dto.form.ParymemberFormDTO; import com.epmet.evaluationindex.screen.dto.result.*; +import com.epmet.feign.OperCrmOpenFeignClient; import com.github.pagehelper.PageHelper; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; @@ -45,7 +50,10 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService private ScreenPartyBranchDataDao screenPartyBranchDataDao; @Autowired private DateUtils dateUtils; - + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private AgencyService screenCustomerAgencyService; /** * @Description 1、党员基本情况-饼状图概况 * @NEI https://nei.netease.com/interface/detail/res/?pid=57068&id=321324 @@ -57,10 +65,29 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public PartymemberPercentResultDTO partymemberBaseInfo(ParymemberFormDTO param) { - + if(StringUtils.isNotBlank(param.getAreaCode())){ + logger.info(String.format("党员基本情况-饼状图概况按照areaCode查询:%s",param.getAreaCode())); + List ids=screenCustomerAgencyService.getNextAgencyIds(param.getAreaCode(),param.getAgencyId()); + if(org.apache.commons.collections4.CollectionUtils.isNotEmpty(ids)){ + PartymemberPercentResultDTO result = screenUserTotalDataDao.selectAgencyPartymemberPercentByIds(ids); + if(null == result){ + logger.warn("selectAgencyPartymemberPercentByIds is null"); + result = new PartymemberPercentResultDTO(); + result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO)); + return result; + } + if(null == result.getPlatFormTotal() || NumConstant.ZERO == result.getPlatFormTotal()){ + result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO)); + }else{ + result.setPercentInPlatForm(getRatio(result.getPartyMemberTotal(),result.getPlatFormTotal())); + } + return result; + } + logger.warn("当前组织没有下级getNextAgencyIds is empty"); + return new PartymemberPercentResultDTO(); + } PartymemberPercentResultDTO result = screenUserTotalDataDao.selectAgencyPartymemberPercent(param.getAgencyId()); if(null == result){ - result = new PartymemberPercentResultDTO(); logger.warn("com.epmet.datareport.service.screen.impl.GrassrootsPartyDevServiceImpl.partymemberBaseInfo:未查询出指定agencyId下的党员基础信息数据,agencyId :: {}",param.getAgencyId()); result = new PartymemberPercentResultDTO(); result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO)); @@ -70,11 +97,21 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService if(null == result.getPlatFormTotal() || NumConstant.ZERO == result.getPlatFormTotal()){ result.setPercentInPlatForm(convertPercentStr(BigDecimal.ZERO)); }else{ - result.setPercentInPlatForm(convertPercentStr(new BigDecimal((result.getPartyMemberTotal().doubleValue()/result.getPlatFormTotal().doubleValue())))); + result.setPercentInPlatForm(getRatio(result.getPartyMemberTotal(),result.getPlatFormTotal())); } return result; } + public String getRatio(Integer partyMemberTotal, Integer platFormTotal){ + if (null == partyMemberTotal || null == platFormTotal || partyMemberTotal == NumConstant.ZERO || platFormTotal == NumConstant.ZERO){ + return "0.00%"; + } + BigDecimal aDecimal = new BigDecimal(partyMemberTotal); + BigDecimal bDecimal = new BigDecimal(platFormTotal); + BigDecimal result = aDecimal.divide(bDecimal, NumConstant.FOUR, BigDecimal.ROUND_HALF_UP); + return result.multiply(NumConstant.ONE_HUNDRED_DECIMAL).setScale(NumConstant.TWO,BigDecimal.ROUND_HALF_UP).toPlainString().concat(ScreenConstant.RATIO); + } + /** * @Description 2、党员基本情况-年龄分布 * @NEI https://nei.netease.com/interface/detail/req/?pid=57068&id=321980 @@ -85,8 +122,17 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService **/ @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override - public PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param) { - PartymemberAgeDistributionResultDTO ageInfo = screenCpcBaseDataDao.selectPartymemberAgeDistribution(param.getAgencyId()); + public PartymemberAgeDistributionResultDTO partymemberAgeDistribution(ParymemberFormDTO param,String customerId) { + Result> result = operCrmOpenFeignClient.getAllSubCustomerIds(customerId); + if (!result.success()){ + throw new RenException("select subCustomerIds failure"); + } + PartymemberAgeDistributionResultDTO ageInfo = new PartymemberAgeDistributionResultDTO(); + if (!CollectionUtils.isEmpty(result.getData())) { + ageInfo = screenCpcBaseDataDao.selectPartymemberAgeDistributionNew(param.getAgencyId()); + }else { + ageInfo = screenCpcBaseDataDao.selectPartymemberAgeDistribution(param.getAgencyId()); + } if(null == ageInfo){ ageInfo = new PartymemberAgeDistributionResultDTO(); } @@ -231,7 +277,7 @@ public class GrassrootsPartyDevServiceImpl implements GrassrootsPartyDevService private String convertPercentStr(BigDecimal percent){ - if(null == percent || BigDecimal.ZERO == percent) return "0.00%"; + if (null == percent || BigDecimal.ZERO.equals(percent)) return "0.00%"; String percentStr = percent.setScale(NumConstant.TWO, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); return percentStr.concat(ModuleConstant.SYMBOL_PERCENT); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java index 179c13a282..831aa3ae36 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java @@ -3,6 +3,7 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.enums.CommonOperateTypeEnum; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; @@ -230,7 +231,12 @@ public class IndexServiceImpl implements IndexService { LocalDate now = LocalDate.now().minusMonths(NumConstant.ONE); int yearId = now.getYear(); subAgencyIndexRankFormDTO.setYearId(String.valueOf(yearId)); - List subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyIndexRank(subAgencyIndexRankFormDTO); + List subAgencyIndexRankResultDTOS = new ArrayList<>(); + if (StringUtils.isNotEmpty(subAgencyIndexRankFormDTO.getAreaCode())){ + subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyIndexRankNew(subAgencyIndexRankFormDTO); + }else { + subAgencyIndexRankResultDTOS = screenIndexDataMonthlyDao.selectSubAgencyIndexRank(subAgencyIndexRankFormDTO); + } if (CollectionUtils.isEmpty(subAgencyIndexRankResultDTOS)){ return new ArrayList<>(); } @@ -380,4 +386,40 @@ public class IndexServiceImpl implements IndexService { return list; } + /** + * @param formDTO + * @author yinzuomei + * @description 8、平阴大屏-下级街道or网格指数排行 + * @Date 2021/2/28 14:33 + **/ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + public List subAgencyIndexRankPy(SubAgencyIndexRankPyFormDTO formDTO) { + if (!"street".equals(formDTO.getType()) && !"grid".equals(formDTO.getType())) { + throw new RenException("type传参错误,街道:street;网格:grid"); + } + LocalDate now = LocalDate.now().minusMonths(NumConstant.ONE); + String yearId = String.valueOf(now.getYear()); + if("street".equals(formDTO.getType())){ + List streetList = screenIndexDataMonthlyDao.selectSubStreetByAreaCode(formDTO.getCustomerId(),yearId,formDTO.getAreaCode(),formDTO.getTopNum()); + // 小数四舍五入 + streetList.forEach(indexRank -> { + indexRank.setPartyDevAbility(getRound(indexRank.getPartyDevAbility())); + indexRank.setGovernAbility(getRound(indexRank.getGovernAbility())); + indexRank.setServiceAbility(getRound(indexRank.getServiceAbility())); + indexRank.setTotalIndex(getRound(indexRank.getPartyDevAbility() + indexRank.getGovernAbility() + indexRank.getServiceAbility())); + }); + return streetList; + } + List gridList = screenIndexDataMonthlyDao.selectSubGridByAreaCode(formDTO.getCustomerId(),yearId,formDTO.getAreaCode(),formDTO.getTopNum()); + // 小数四舍五入 + gridList.forEach(indexRank -> { + indexRank.setPartyDevAbility(getRound(indexRank.getPartyDevAbility())); + indexRank.setGovernAbility(getRound(indexRank.getGovernAbility())); + indexRank.setServiceAbility(getRound(indexRank.getServiceAbility())); + indexRank.setTotalIndex(getRound(indexRank.getPartyDevAbility() + indexRank.getGovernAbility() + indexRank.getServiceAbility())); + }); + return gridList; + } + } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java index 941a294e49..fce388ec23 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/PartyMemberLeadServiceImpl.java @@ -1,19 +1,25 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.*; +import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.evaluationindex.screen.PartyMemberLeadService; import com.epmet.datareport.utils.DateUtils; import com.epmet.datareport.utils.ModuleConstant; +import com.epmet.dto.result.ScreenCustomerAgencyDTO; import com.epmet.evaluationindex.screen.constant.ScreenConstant; import com.epmet.evaluationindex.screen.dto.form.AgencyAndNumFormDTO; import com.epmet.evaluationindex.screen.dto.form.ContactMassLineChartFormDTO; import com.epmet.evaluationindex.screen.dto.form.FineExampleFormDTO; import com.epmet.evaluationindex.screen.dto.form.VolunteerServiceFormDTO; import com.epmet.evaluationindex.screen.dto.result.*; +import com.epmet.feign.OperCrmOpenFeignClient; import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -48,6 +54,12 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { private DateUtils dateUtils; @Autowired private ScreenPartyUserRankDataDao screenPartyUserRankDataDao; + @Autowired + private ScreenCustomerAgencyDao customerAgencyDao; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private AgencyService screenCustomerAgencyService; /** * @Description 1、先锋模范 @@ -58,17 +70,33 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public FineExampleResultDTO fineExample(FineExampleFormDTO fineExampleFormDTO) { - FineExampleResultDTO fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); - if (null == fineExampleResultDTO){ - return new FineExampleResultDTO(); - } - fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA())); - fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA())); - fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA())); - fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA())); - fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA())); - fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio()))); - return fineExampleResultDTO; + ScreenCustomerAgencyDTO agencyInfo = customerAgencyDao.selectByAgencyId(fineExampleFormDTO.getAgencyId()); + if(null == agencyInfo) throw new RenException("未找到对应的机关"); + String customerId = agencyInfo.getCustomerId(); + String areaCode = agencyInfo.getAreaCode(); + + Result> crmResponse = operCrmOpenFeignClient.getAllSubCustomerIds(customerId); + List subCustomers; + if(null == crmResponse || !crmResponse.success()) + {subCustomers = null;} + else + {subCustomers = crmResponse.getData();} + FineExampleResultDTO fineExampleResultDTO; + if(CollectionUtils.isEmpty(subCustomers)) + fineExampleResultDTO = screenPioneerDataDao.selectFineExample(fineExampleFormDTO.getAgencyId()); + else + fineExampleResultDTO = screenPioneerDataDao.selectFineExampleByAreaCode(areaCode,customerId,subCustomers); + + if (null == fineExampleResultDTO) { + return new FineExampleResultDTO(); + } + fineExampleResultDTO.setIssueRatio(this.getRatio(fineExampleResultDTO.getIssueRatioA())); + fineExampleResultDTO.setPublishIssueRatio(this.getRatio(fineExampleResultDTO.getPublishIssueRatioA())); + fineExampleResultDTO.setResolvedProjectRatio(this.getRatio(fineExampleResultDTO.getResolvedProjectRatioA())); + fineExampleResultDTO.setTopicRatio(this.getRatio(fineExampleResultDTO.getTopicRatioA())); + fineExampleResultDTO.setShiftProjectRatio(this.getRatio(fineExampleResultDTO.getShiftProjectRatioA())); + fineExampleResultDTO.setPlatJoinPartyRatio(this.getRatio(Double.valueOf(fineExampleResultDTO.getPlatJoinPartyRatio()))); + return fineExampleResultDTO; } /** @@ -91,8 +119,14 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public ContactMassLineChartResultDTO contactMassLineChart(ContactMassLineChartFormDTO contactMassLineChartFormDTO) { + + List subAgencyIdorGridIdList=screenCustomerAgencyService.getNextAgencyIds(contactMassLineChartFormDTO.getAreaCode(),contactMassLineChartFormDTO.getAgencyId()); + log.info("当前组织的下级id:"+JSON.toJSONString(subAgencyIdorGridIdList)); + ContactMassLineChartResultDTO result = new ContactMassLineChartResultDTO(); - List contactMassLineChartResults = screenPartyLinkMassesDataDao.selectContactMassLineChart(contactMassLineChartFormDTO.getAgencyId()); + // List contactMassLineChartResults = screenPartyLinkMassesDataDao.selectContactMassLineChart(contactMassLineChartFormDTO.getAgencyId()); + //多客户版修改如下: + List contactMassLineChartResults = screenPartyLinkMassesDataDao.selectContactMassLineChartByAgencyIds(subAgencyIdorGridIdList); if (contactMassLineChartResults.size() == NumConstant.ZERO){ result.setXAxis(new ArrayList<>()); result.setGroupMemberData(new ArrayList<>()); @@ -221,6 +255,7 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override public List advancedBranchRank(AgencyAndNumFormDTO param) { + List result = new LinkedList<>(); if(null == param.getTopNum()){ param.setTopNum(NumConstant.FIVE); }else if(NumConstant.ZERO == param.getTopNum()){ @@ -228,24 +263,43 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { } PageHelper.startPage(NumConstant.ONE,param.getTopNum()); String monthId = dateUtils.getCurrentMonthId(); - List gridData = - screenOrgRankDataDao.selectGridDataMonthly(param.getAgencyId(),monthId); - int time = NumConstant.TWELVE; - while(CollectionUtils.isEmpty(gridData) && time > NumConstant.ONE){ - time--; - monthId = dateUtils.getPreviousMonthIdByDest(null,monthId); - PageHelper.startPage(NumConstant.ONE,param.getTopNum()); - gridData = screenOrgRankDataDao.selectGridDataMonthly(param.getAgencyId(),monthId); + if(StringUtils.isNotBlank(param.getAreaCode())){ + log.info("先进排行榜单-先进支部排行入参"+JSON.toJSONString(param)); + //areaCode不为空,按照areaCode查询 + List gridData = + screenOrgRankDataDao.selectGridDataMonthlyAreaCode(monthId,param.getAreaCode()); + int time = NumConstant.TWELVE; + while(CollectionUtils.isEmpty(gridData) && time > NumConstant.ONE){ + time--; + monthId = dateUtils.getPreviousMonthIdByDest(null,monthId); + PageHelper.startPage(NumConstant.ONE,param.getTopNum()); + gridData = screenOrgRankDataDao.selectGridDataMonthlyAreaCode(monthId,param.getAreaCode()); + } + if(null == gridData || gridData.isEmpty()) return result; + gridData.forEach( data -> { + AdvanceBranchRankResultDTO o = ConvertUtils.sourceToTarget(data,AdvanceBranchRankResultDTO.class); + o.setClosedProjectRatio(convertPercentStr(data.getClosedProjectRatio())); + o.setSatisfactionRatio(convertPercentStr(data.getSatisfactionRatio())); + result.add(o); + }); + }else{ + List gridData = + screenOrgRankDataDao.selectGridDataMonthly(param.getAgencyId(),monthId); + int time = NumConstant.TWELVE; + while(CollectionUtils.isEmpty(gridData) && time > NumConstant.ONE){ + time--; + monthId = dateUtils.getPreviousMonthIdByDest(null,monthId); + PageHelper.startPage(NumConstant.ONE,param.getTopNum()); + gridData = screenOrgRankDataDao.selectGridDataMonthly(param.getAgencyId(),monthId); + } + if(null == gridData || gridData.isEmpty()) return result; + gridData.forEach( data -> { + AdvanceBranchRankResultDTO o = ConvertUtils.sourceToTarget(data,AdvanceBranchRankResultDTO.class); + o.setClosedProjectRatio(convertPercentStr(data.getClosedProjectRatio())); + o.setSatisfactionRatio(convertPercentStr(data.getSatisfactionRatio())); + result.add(o); + }); } - List result = new LinkedList<>(); - if(null == gridData || gridData.isEmpty()) return result; - gridData.forEach( data -> { - AdvanceBranchRankResultDTO o = ConvertUtils.sourceToTarget(data,AdvanceBranchRankResultDTO.class); - o.setClosedProjectRatio(convertPercentStr(data.getClosedProjectRatio())); - o.setSatisfactionRatio(convertPercentStr(data.getSatisfactionRatio())); - result.add(o); - }); - return result; } @@ -262,14 +316,20 @@ public class PartyMemberLeadServiceImpl implements PartyMemberLeadService { public List advancedPartymemberRank(AgencyAndNumFormDTO param) { if(null == param.getTopNum()) param.setTopNum(NumConstant.TEN); PageHelper.startPage(NumConstant.ONE,param.getTopNum()); - List result = screenPartyUserRankDataDao.selectPartymemberPointOrder(param.getAgencyId()); + List result=new ArrayList<>(); + if(StringUtils.isNotBlank(param.getAreaCode())){ + log.info("先进排行榜单-先进党员排行按照areaCode查询入参:"+param.getAreaCode()); + result=screenPartyUserRankDataDao.selectPartymemberPointOrderByAreaCode(param.getAreaCode()); + }else{ + result=screenPartyUserRankDataDao.selectPartymemberPointOrder(param.getAgencyId()); + } if(null == result) return new ArrayList<>(); return result; } private String convertPercentStr(BigDecimal percent){ - if(null == percent || BigDecimal.ZERO == percent) return "0.0%"; + if (null == percent || BigDecimal.ZERO.equals(percent)) return "0.0%"; String percentStr = percent.setScale(NumConstant.ONE, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(); return percentStr.concat(ModuleConstant.SYMBOL_PERCENT); } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java index a1f8a0c9fd..ca9130b5c4 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java @@ -17,7 +17,10 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; +import com.alibaba.druid.util.StringUtils; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectGridDailyDao; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectGridDailyService; @@ -48,6 +51,12 @@ public class ScreenProjectGridDailyServiceImpl implements ScreenProjectGridDail @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override public List efficiencyAnalysis(String customerId, String areaCode) { - return screenProjectGridDailyDao.queryGridEfficiencyAnalysis(customerId,areaCode); + //先查询最后一次统计的dateId + String dateId=screenProjectGridDailyDao.selectLastDateId(customerId); + if(StringUtils.isEmpty(dateId)){ + //如果为空,默认查询前一天 + dateId= DateUtils.getBeforeNDay(NumConstant.ONE); + } + return screenProjectGridDailyDao.queryGridEfficiencyAnalysis(customerId,areaCode,dateId); } } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java index b4518096dc..1ef82de513 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java @@ -66,7 +66,7 @@ public class ScreenProjectOrgDailyServiceImpl implements ScreenProjectOrgDailySe if (null != resultDTO) { return resultDTO; } - log.warn("【事件分析】数量统计查询 结果为空"); + log.warn(String.format("【事件分析】数量统计查询 结果为空,customerId:%s,agencyId:%s",formDTO.getCustomerId(),formDTO.getAgencyId())); ProjectQuantityResultDTO defaultDto = new ProjectQuantityResultDTO(); defaultDto.setCustomerId(formDTO.getCustomerId()); defaultDto.setAgencyId(formDTO.getAgencyId()); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java index 1e4855604d..72cc5f40cc 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java @@ -32,10 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.Function; import java.util.stream.Collectors; @@ -74,20 +71,27 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl implements ScreenProject Map dtoMap = new HashMap<>(); if (!CollectionUtils.isEmpty(dtoList)) { dtoMap = dtoList.stream().collect(Collectors.toMap(ScreenProjectQuantityOrgMonthlyDTO::getMonthId, Function.identity(), (key1, key2) -> key2)); + List blank = dtoMap.keySet().stream().filter(query -> !monthIdList.contains(query)).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(blank)){ + for(int i = NumConstant.ZERO; i < blank.size(); i++){dtoMap.put(blank.get(i),null);} + } + }else{ + for(int i = NumConstant.ZERO; i < monthIdList.size(); i++){dtoMap.put(monthIdList.get(i),null);} } for (String monthId : monthIdList) { //202101=>01月 xAxis.add(monthId.substring(NumConstant.FOUR, NumConstant.SIX).concat(ScreenConstant.MONTH)); if (!CollectionUtils.isEmpty(dtoList)) { + ScreenProjectQuantityOrgMonthlyDTO en = dtoMap.get(monthId); if ("incr".equals(formDTO.getType())) { - yAxis.add(dtoMap.get(monthId).getProjectIncr()); + yAxis.add( null == en ? NumConstant.ZERO : en.getProjectIncr()); } else if ("sum".equals(formDTO.getType())) { - yAxis.add(dtoMap.get(monthId).getProjectTotal()); + yAxis.add( null == en ? NumConstant.ZERO : en.getProjectTotal() ); } continue; } //没有数据默认赋值0 - yAxis.add(0); + //yAxis.add(0); } resultDTO.setXAxis(xAxis); resultDTO.setYAxis(yAxis); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index 2cf288cae9..97dafab068 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -1,12 +1,22 @@ package com.epmet.datareport.service.evaluationindex.screen.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventDataDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventImgDataDao; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao; +import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectDataDao; import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService; +import com.epmet.dto.form.screen.CategoryAnalysisFormDTO; +import com.epmet.dto.result.screen.CategoryAnalysisResultDTO; import com.epmet.evaluationindex.screen.dto.form.ProjectDetailFormDTO; +import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO; +import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO; import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO; +import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO; +import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -26,6 +36,11 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { private ScreenEventDataDao screenEventDataDao; @Autowired private ScreenEventImgDataDao screenEventImgDataDao; + @Autowired + private ScreenProjectDataDao screenProjectDataDao; + + @Autowired + private ScreenProjectCategoryOrgDailyDao screenProjectCategoryOrgDailyDao; /** * @Description 3、项目详情 @@ -44,4 +59,59 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { projectDetailResultDTO.setImgList(imgList); return projectDetailResultDTO; } -} \ No newline at end of file + + /** + * @Description 中央区事件分析-项目分布 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2021/2/24 15:25 + */ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + public Result projectDistribution(ScreenProjectDistributionFormDTO formDTO) { + if(StringUtils.isBlank(formDTO.getStatus())){ + formDTO.setStatus("pending"); + } + List areaIds = null; + if (StringUtils.isNotBlank(formDTO.getAreaCode())){ + areaIds = screenProjectDataDao.selectIdsByAreaCode(formDTO.getAreaCode()); + } + List resultDTOS = screenProjectDataDao.projectDistribution(formDTO.getAgencyId(),areaIds,formDTO.getLevel(),formDTO.getStatus()); + return new Result().ok(resultDTOS); + } + + @Override + public Result projectDistributionDetail(ScreenProjectDetailFormDTO formDTO) { + List resultDTOS = screenProjectDataDao.projectDistributionDetail(formDTO.getProjectId()); + resultDTOS.forEach(item -> { + //项目图片 + List imgList = screenProjectDataDao.selectProjectImgs(formDTO.getProjectId()); + item.setImgList(imgList); + //项目处理流程 + List processDTOS = screenProjectDataDao.selectProjectProcess(formDTO.getProjectId()); + //流程附件 + processDTOS.forEach(processDTO -> { + List attachmentDTOS = screenProjectDataDao.selectProjectProcessAttachments(processDTO.getProcessId()); + processDTO.setAttachments(attachmentDTOS); + }); + item.setProcessList(processDTOS); + }); + return new Result().ok(resultDTOS); + } + + /** + * 【事件分析】类型分析 + * + * @param customerId + * @param formDTO + * @return java.util.List + * @author zhaoqifeng + * @date 2021/2/23 15:37 + */ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + @Override + public List categoryAnalysis(String customerId, CategoryAnalysisFormDTO formDTO) { + return screenProjectCategoryOrgDailyDao.selectCategoryAnalysis(formDTO.getAgencyId()); + } +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java index cd528a5f50..0991305f4f 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/ScreenWorkRecordOrgDailyService.java @@ -21,8 +21,12 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgDailyEntity; import com.epmet.plugins.ScreenWorkRecordOrgDailyDTO; +import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO; import com.epmet.plugins.form.WorkRecordRankFormDTO; +import com.epmet.plugins.form.WorkRecordTrendFormDTO; +import com.epmet.plugins.result.VoluntaryServiceTrendResultDTO; import com.epmet.plugins.result.WorkRecordRankResultDTO; +import com.epmet.plugins.result.WorkRecordTrendResultDTO; import java.util.List; import java.util.Map; @@ -96,4 +100,19 @@ public interface ScreenWorkRecordOrgDailyService extends BaseService queryBidList(String customerId) { return screenBidInfoDao.selectList(customerId); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java index 47e4b8bb3e..39380cd9d4 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java @@ -19,10 +19,12 @@ package com.epmet.datareport.service.plugins.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.plugins.ScreenCustomerWorkRecordDictDao; import com.epmet.datareport.entity.plugins.ScreenCustomerWorkRecordDictEntity; import com.epmet.datareport.service.plugins.ScreenCustomerWorkRecordDictService; @@ -44,6 +46,7 @@ import java.util.Map; */ @Slf4j @Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) public class ScreenCustomerWorkRecordDictServiceImpl extends BaseServiceImpl implements ScreenCustomerWorkRecordDictService { @Override diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java index 692989e278..d55fbf927a 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java @@ -17,31 +17,45 @@ package com.epmet.datareport.service.plugins.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; 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.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.DataSourceConstant; +import com.epmet.datareport.dao.plugins.ScreenCustomerWorkRecordDictDao; import com.epmet.datareport.dao.plugins.ScreenWorkRecordOrgDailyDao; +import com.epmet.datareport.dao.plugins.ScreenWorkRecordOrgMonthlyDao; import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgDailyEntity; import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgDailyService; -import com.epmet.dto.result.ScreenCustomerAgencyDTO; +import com.epmet.datareport.utils.DateUtils; +import com.epmet.dto.AgencyInfoDTO; +import com.epmet.evaluationindex.screen.constant.ScreenConstant; +import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.plugins.ScreenWorkRecordOrgDailyDTO; +import com.epmet.plugins.form.VoluntaryServiceTrendFormDTO; import com.epmet.plugins.form.WorkRecordRankFormDTO; -import com.epmet.plugins.result.WorkRecordRankResultDTO; +import com.epmet.plugins.form.WorkRecordTrendFormDTO; +import com.epmet.plugins.result.*; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; 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; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; +import java.util.stream.Collectors; /** * 工作日志-组织按日统计(累计值) @@ -51,10 +65,18 @@ import java.util.Map; */ @Slf4j @Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl implements ScreenWorkRecordOrgDailyService { @Autowired private AgencyService agencyService; - + @Autowired + private DateUtils dateUtils; + @Autowired + private ScreenCustomerWorkRecordDictDao screenCustomerWorkRecordDictDao; + @Autowired + private ScreenWorkRecordOrgMonthlyDao screenWorkRecordOrgMonthlyDao; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -107,25 +129,182 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl customerIds=new ArrayList<>(); + Result> result=operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId()); + // log.info("根据customerId查询其所有下级子客户id result: "+JSON.toJSONString(result)); + if (result.success() && CollectionUtils.isNotEmpty(result.getData())) { + customerIds.addAll(result.getData()); + } + customerIds.add(formDTO.getCustomerId()); + String dateId= baseDao.selectLatestDateId(customerIds); + if(StringUtils.isBlank(dateId)){ + dateId= com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(NumConstant.ONE); + log.warn("dateId 赋值为"+dateId+" ; selectLatestDateId dateId is null customerIds" + JSON.toJSONString(customerIds)); } - String dateId = baseDao.selectLatestDateId(formDTO.getCustomerId()); - log.info(String.format("最近一次上传dateId:%s", dateId)); - if (agencyDTO.getLevel().equals("community")) { - log.warn("【工作日志】本机及下级排名接口待完善"); - //todo - return new WorkRecordRankResultDTO(0, 0, new ArrayList<>()); - } else { - //非社区的 - WorkRecordRankResultDTO resultDTO = baseDao.selectCurrentAgency(agencyDTO.getAreaCode(), formDTO.getDataType(), dateId); - resultDTO.setSubRankList(baseDao.selectSubList(agencyDTO.getAreaCode(), agencyDTO.getAgencyId(), formDTO.getDataType(), formDTO.getTopRow(), dateId)); + WorkRecordRankResultDTO returnDto = new WorkRecordRankResultDTO(); + AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId()); + // log.info("agencyInfoDTO: "+JSON.toJSONString(agencyInfoDTO)); + //当前组织的自身的数据 + List currentAgency = baseDao.selectCurrentAgency(formDTO.getAgencyId(), + formDTO.getDataType(), + formDTO.getCustomerId(), + dateId); + //下级所有组织 + List subAgencyRankList = CollectionUtils.isNotEmpty(agencyInfoDTO.getSubAgencyIds()) ? baseDao.selectSubList( + agencyInfoDTO.getSubAgencyIds(), + formDTO.getDataType(), + formDTO.getCustomerId(), + dateId) : new ArrayList<>(); + //直属网格 + List subGridList = CollectionUtils.isNotEmpty(agencyInfoDTO.getSubGridIds()) ? baseDao.selectSubGridList( + agencyInfoDTO.getSubGridIds(), + formDTO.getDataType(), + formDTO.getCustomerId(), + dateId) : new ArrayList<>(); + + returnDto.getSubRankList().addAll(subAgencyRankList); + returnDto.getSubRankList().addAll(subGridList); + // log.info("returnDto.getSubRankList()="+returnDto.getSubRankList()); + int participateUserTotal = 0; + int participateTotal = 0; + for (WorkRecordSubRank subAgency : returnDto.getSubRankList()) { + participateUserTotal += subAgency.getParticipateUserTotal(); + participateTotal += subAgency.getParticipateTotal(); + } + if (CollectionUtils.isNotEmpty(currentAgency)) { + for (WorkRecordSubRank m : currentAgency) { + participateUserTotal += m.getParticipateUserTotal(); + participateTotal += m.getParticipateTotal(); + } + } + returnDto.setParticipateTotal(participateTotal); + returnDto.setParticipateUserTotal(participateUserTotal); + returnDto.setSubRankList(CollectionUtils.isNotEmpty(returnDto.getSubRankList()) && returnDto.getSubRankList().size() >= formDTO.getTopRow() ? + returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()) : returnDto.getSubRankList()); + return returnDto; + } + + /** + * @Description 6、【工作日志】近12月趋势图 + * 查询当前组织及所有下级某项数据(组织次数、参与人数、平均参与人数)的某个资源(支部建设、联建共建、党员志愿服务)对应的每个类型的指标过去12个月的汇总数据,某个月份没数据的补0 + * @author sun + */ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + public WorkRecordTrendResultDTO trend(WorkRecordTrendFormDTO formDTO) { + WorkRecordTrendResultDTO resultDTO = new WorkRecordTrendResultDTO(); + + //1.根据资源编码查询资源名称集合,按sort升序 + List legendList = screenCustomerWorkRecordDictDao.selectListByDataType(formDTO.getCustomerId(), formDTO.getDataType()); + resultDTO.setLegend(legendList); + if (null == legendList || legendList.size() < NumConstant.ONE) { return resultDTO; } + + //2.查询当前月过去12个月份 + Map map = dateUtils.getXpro(); + resultDTO.setXAxis(map.values().stream().collect(Collectors.toList())); + List monthIdList = map.keySet().stream().collect(Collectors.toList()); + + //3-1.查询当前组织及所有下级过去12个月份某项数据所有资源的统计数据 + DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMM"); + LocalDate today = LocalDate.now(); + formDTO.setStartMonth(today.minusMonths(NumConstant.THIRTEEN).format(fmt)); + formDTO.setEndMonth(today.minusMonths(NumConstant.ONE).format(fmt)); + List list = screenWorkRecordOrgMonthlyDao.selectMonthList(formDTO); + + //3-2.遍历封装数据并返回 + LinkedList seriesList = new LinkedList<>(); + //按资源类型封装每一个资源类型对应的过去12个月的汇总数据,某个月份没有数据的补0 + legendList.forEach(le -> { + WorkRecordTrendResultDTO.SeriesResultDTO dto = new WorkRecordTrendResultDTO.SeriesResultDTO(); + dto.setName(le); + LinkedList dataList = new LinkedList<>(); + monthIdList.forEach(m->{ + AtomicInteger num = new AtomicInteger(0); + list.forEach(l -> { + if (m.equals(l.getMonthId())&&le.equals(l.getName())) { + //dataList.add(l.getValue()); + num.set(l.getValue()); + } + }); + dataList.add(num.get()); + }); + dto.setData(dataList); + seriesList.add(dto); + }); + + resultDTO.setSeries(seriesList); + return resultDTO; } + /** + * @param formDTO + * @return com.epmet.plugins.result.VoluntaryServiceTrendResultDTO + * @author yinzuomei + * @description 7、【工作日志】党员志愿者服务近12月趋势图 + * @Date 2021/2/27 19:56 + **/ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + public VoluntaryServiceTrendResultDTO voluntaryServiceTrend(VoluntaryServiceTrendFormDTO formDTO) { + VoluntaryServiceTrendResultDTO resultDTO = new VoluntaryServiceTrendResultDTO(); + //近12个月的monthId集合,["202002","202003","202004","202005","202006","202007","202008","202009","202010","202011","202012","202101"] + List monthIdList = com.epmet.commons.tools.utils.DateUtils.getMonthIdList(formDTO.getEndMonthId(), NumConstant.ELEVEN); + // log.info(JSON.toJSONString(monthIdList)); + + AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId()); + List orgIds = new ArrayList<>(); + orgIds.addAll(agencyInfoDTO.getSubAgencyIds()); + orgIds.add(agencyInfoDTO.getAgencyId()); + orgIds.addAll(agencyInfoDTO.getSubGridIds()); + List list = screenWorkRecordOrgMonthlyDao.selectVoluntaryServiceTrendDTO(formDTO.getCustomerId(), + orgIds, + monthIdList.get(NumConstant.ZERO), + monthIdList.get(NumConstant.ELEVEN)); + Map dtoMap = new HashMap<>(); + if (!org.springframework.util.CollectionUtils.isEmpty(list)) { + dtoMap = list.stream().collect(Collectors.toMap(VoluntaryServiceTrendDTO::getMonthId, Function.identity(), (key1, key2) -> key2)); + } + + //要返回的横坐标:["02月","03月","04月","05月","06月","07月","08月","09月","10月","11月","12月","01月"] + List xAxis = new ArrayList<>(); + List organizeList = new ArrayList<>(); + List joinUserList = new ArrayList<>(); + List avgUserList = new ArrayList<>(); + + for (String monthId : monthIdList) { + xAxis.add(monthId.substring(NumConstant.FOUR, NumConstant.SIX).concat(ScreenConstant.MONTH)); + if (null != dtoMap.get(monthId) && null != dtoMap.get(monthId).getOrganizeTotal()) { + organizeList.add(dtoMap.get(monthId).getOrganizeTotal()); + } else { + organizeList.add(NumConstant.ZERO); + } + if (null != dtoMap.get(monthId) && null != dtoMap.get(monthId).getParticipateUserTotal()) { + joinUserList.add(dtoMap.get(monthId).getParticipateUserTotal()); + } else { + joinUserList.add(NumConstant.ZERO); + } + if (null != dtoMap.get(monthId) && null != dtoMap.get(monthId).getAvgParticipateUserTotal()) { + avgUserList.add(dtoMap.get(monthId).getAvgParticipateUserTotal()); + } else { + avgUserList.add(NumConstant.ZERO); + } + } + resultDTO.setXAxis(xAxis); + resultDTO.setOrganizeList(organizeList); + resultDTO.setJoinUserList(joinUserList); + resultDTO.setAvgUserList(avgUserList); + return resultDTO; + } + + public static void main(String[] args) { + LocalDate today = LocalDate.now(); + DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyyMM"); + System.out.println(today.minusMonths(NumConstant.THIRTEEN).format(fmt)); + System.out.println(today.minusMonths(NumConstant.ONE).format(fmt)); + } } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java index 66f8eab095..533bf00c18 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java @@ -19,10 +19,12 @@ package com.epmet.datareport.service.plugins.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.DataSourceConstant; import com.epmet.datareport.dao.plugins.ScreenWorkRecordOrgMonthlyDao; import com.epmet.datareport.entity.plugins.ScreenWorkRecordOrgMonthlyEntity; import com.epmet.datareport.service.plugins.ScreenWorkRecordOrgMonthlyService; @@ -44,6 +46,7 @@ import java.util.Map; */ @Slf4j @Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) public class ScreenWorkRecordOrgMonthlyServiceImpl extends BaseServiceImpl implements ScreenWorkRecordOrgMonthlyService { @Override diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java index 6eadda5d8f..f095fb0666 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/project/impl/ProjectServiceImpl.java @@ -209,17 +209,16 @@ public class ProjectServiceImpl implements ProjectService { return new ProjectDetailResultDTO(); }*/ ProjectDetailResultDTO projectDetailResultDTO=new ProjectDetailResultDTO(); - //todo Result result=govProjectOpenFeignClient.queryProjectInfoByProjectId(processListFormDTO.getProjectId()); - if(result.success()&&null!=result.getData()){ - ProjectInfoDTO projectInfoDTO=result.getData(); - projectDetailResultDTO.setImgUrlList(projectInfoDTO.getImgUrlList()); - projectDetailResultDTO.setEventSource(projectInfoDTO.getGridName()); - projectDetailResultDTO.setEventTitle(projectInfoDTO.getEventTitle()); - projectDetailResultDTO.setEventContent(projectInfoDTO.getEventContent()); - }else{ - log.warn(String.format("项目信息查询失败,projectId:%s",processListFormDTO.getProjectId())); + if(!result.success()||null==result.getData()){ + log.warn(String.format("项目信息查询失败(该接口目前只支持e事通内的客户),projectId:%s", processListFormDTO.getProjectId())); + return projectDetailResultDTO; } + ProjectInfoDTO projectInfoDTO=result.getData(); + projectDetailResultDTO.setImgUrlList(projectInfoDTO.getImgUrlList()); + projectDetailResultDTO.setEventSource(projectInfoDTO.getGridName()); + projectDetailResultDTO.setEventTitle(projectInfoDTO.getEventTitle()); + projectDetailResultDTO.setEventContent(projectInfoDTO.getEventContent()); Result processList = govProjectOpenFeignClient.getProcessList(processListFormDTO); if (!processList.success()) { throw new RenException(ProjectConstant.PROCESS_FAILURE); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/UserAnalysisService.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/UserAnalysisService.java index 47c304f1b2..e7e31c78a1 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/UserAnalysisService.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/UserAnalysisService.java @@ -1,6 +1,7 @@ package com.epmet.datareport.service.user; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.user.UserIncrTrendFormDTO; import com.epmet.dto.form.user.UserSubAgencyFormDTO; import com.epmet.dto.form.user.UserSubGridFormDTO; @@ -32,7 +33,7 @@ public interface UserAnalysisService { * @description 直属机关柱状图查询 * @Date 2020/6/22 13:42 **/ - List subAgency(UserSubAgencyFormDTO formDTO); + List subAgency(TokenDto tokenDto, UserSubAgencyFormDTO formDTO); /** * @param formDTO @@ -41,7 +42,7 @@ public interface UserAnalysisService { * @description 直属网格柱状图查询 * @Date 2020/6/22 13:42 **/ - List subGrid(UserSubGridFormDTO formDTO); + List subGrid(TokenDto tokenDto, UserSubGridFormDTO formDTO); /** * @param formDTO @@ -60,7 +61,7 @@ public interface UserAnalysisService { * @description 按日、按月查询注册用户数(参与用户数)增量折线图 * @Date 2020/6/22 13:42 **/ - List incrTrendV2(UserIncrTrendFormDTO formDTO); + List incrTrendV2(TokenDto tokenDto, UserIncrTrendFormDTO formDTO); /** * @return com.epmet.dto.result.user.UserAgencyInfoResultDTO diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/UserAnalysisServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/UserAnalysisServiceImpl.java index 88e39067b4..c4bf48603a 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/UserAnalysisServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/user/impl/UserAnalysisServiceImpl.java @@ -2,7 +2,9 @@ package com.epmet.datareport.service.user.impl; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; @@ -74,6 +76,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { logger.info(String.format("用户%s的所属机关id为%s",loginUserDetailsFormDTO.getUserId(),result.getData().getAgencyId())); return result.getData().getAgencyId(); } + /** * @param formDTO * @return com.epmet.user.result.UserSummaryInfoResultDTO @@ -120,11 +123,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { * @Date 2020/6/22 13:42 **/ @Override - public List subAgency(UserSubAgencyFormDTO formDTO) { + public List subAgency(TokenDto tokenDto, UserSubAgencyFormDTO formDTO) { //获取用户所属机关id String myAgencyId = this.getMyAgency(); //初始化横坐标(用户所机关的下级机关列表) - List dimList = this.initUserSubAgencyResultDTO(myAgencyId); + List dimList = this.initUserSubAgencyResultDTO(tokenDto.getCustomerId(), myAgencyId); if(CollectionUtils.isEmpty(dimList)){ logger.info(String.format("当前机关(agencyId=%s)下没有下级机关",myAgencyId)); return new ArrayList<>(); @@ -199,7 +202,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { return dimList; } - private List initUserSubAgencyResultDTO(String myAgencyId) { + private List initUserSubAgencyResultDTO(String customerId, String myAgencyId) { List list=new ArrayList<>(); List dimAgencyDTOS=userAnalysisDao.selectSubAgencyList(myAgencyId); for(DimAgencyDTO agencyDTO:dimAgencyDTOS){ @@ -208,7 +211,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { resi.setAgencyId(agencyDTO.getId()); resi.setName(agencyDTO.getAgencyName()); resi.setValue(NumConstant.ZERO); - resi.setType(UserAnalysisConstant.REGISTERED_RESI); + if (StrConstant.SPECIAL_CUSTOMER.equals(customerId)) { + resi.setType("学员"); + } else { + resi.setType(UserAnalysisConstant.REGISTERED_RESI); + } resi.setTotal(NumConstant.ZERO); list.add(resi); //热心居民 @@ -216,7 +223,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { warm.setAgencyId(agencyDTO.getId()); warm.setName(agencyDTO.getAgencyName()); warm.setValue(NumConstant.ZERO); - warm.setType(UserAnalysisConstant.WARMHEARTED); + if (StrConstant.SPECIAL_CUSTOMER.equals(customerId)) { + warm.setType("组长"); + } else { + warm.setType(UserAnalysisConstant.WARMHEARTED); + } warm.setTotal(NumConstant.ZERO); list.add(warm); //党员 @@ -239,11 +250,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { * @Date 2020/6/22 13:42 **/ @Override - public List subGrid(UserSubGridFormDTO formDTO) { + public List subGrid(TokenDto tokenDto, UserSubGridFormDTO formDTO) { //获取用户所属机关id String myAgencyId = this.getMyAgency(); //初始化横坐标(用户所机关的直属网格) - List dimList = this.initUserSubGridResultDTO(myAgencyId); + List dimList = this.initUserSubGridResultDTO(tokenDto.getCustomerId(), myAgencyId); if(CollectionUtils.isEmpty(dimList)){ logger.info(String.format("当前机关(agencyId=%s)下没有网格",myAgencyId)); return new ArrayList<>(); @@ -315,7 +326,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { return dimList; } - private List initUserSubGridResultDTO(String myAgencyId) { + private List initUserSubGridResultDTO(String customerId, String myAgencyId) { List list=new ArrayList<>(); List gridList=userAnalysisDao.selectSubGridList(myAgencyId); for(DimGridDTO grid:gridList){ @@ -324,7 +335,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { resi.setGridId(grid.getId()); resi.setName(grid.getGridName()); resi.setValue(NumConstant.ZERO); - resi.setType(UserAnalysisConstant.REGISTERED_RESI); + if (StrConstant.SPECIAL_CUSTOMER.equals(customerId)) { + resi.setType("学员"); + } else { + resi.setType(UserAnalysisConstant.REGISTERED_RESI); + } resi.setTotal(NumConstant.ZERO); list.add(resi); //热心居民 @@ -332,7 +347,11 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { warm.setGridId(grid.getId()); warm.setName(grid.getGridName()); warm.setValue(NumConstant.ZERO); - warm.setType(UserAnalysisConstant.WARMHEARTED); + if (StrConstant.SPECIAL_CUSTOMER.equals(customerId)) { + warm.setType("组长"); + } else { + warm.setType(UserAnalysisConstant.WARMHEARTED); + } warm.setTotal(NumConstant.ZERO); list.add(warm); //党员 @@ -411,7 +430,7 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { } @Override - public List incrTrendV2(UserIncrTrendFormDTO formDTO) { + public List incrTrendV2(TokenDto tokenDto, UserIncrTrendFormDTO formDTO) { //获取用户所属机关id String myAgencyId = this.getMyAgency(); List resultList=new ArrayList<>(); @@ -443,14 +462,22 @@ public class UserAnalysisServiceImpl implements UserAnalysisService { UserIncrTrendResultDTO reg=new UserIncrTrendResultDTO(); reg.setDateOrMonthId(userIncrTrendResDTO.getDateIdOrMonthId()); reg.setDate(date); - reg.setType(UserAnalysisConstant.REGISTERED_RESI); + if (StrConstant.SPECIAL_CUSTOMER.equals(tokenDto.getCustomerId())) { + reg.setType("学员"); + } else { + reg.setType(UserAnalysisConstant.REGISTERED_RESI); + } reg.setValue(userIncrTrendResDTO.getRegIncr()); resultList.add(reg); UserIncrTrendResultDTO warm=new UserIncrTrendResultDTO(); warm.setDateOrMonthId(userIncrTrendResDTO.getDateIdOrMonthId()); warm.setDate(date); - warm.setType(UserAnalysisConstant.WARMHEARTED); + if (StrConstant.SPECIAL_CUSTOMER.equals(tokenDto.getCustomerId())) { + warm.setType("组长"); + } else { + warm.setType(UserAnalysisConstant.WARMHEARTED); + } warm.setValue(userIncrTrendResDTO.getWarmIncr()); resultList.add(warm); diff --git a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml index 01c4f3d8db..3ecb0ec3d1 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-report/data-report-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /data/report @@ -117,7 +118,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -154,4 +155,4 @@ jwt: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenCustomerWorkRecordDictDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenCustomerWorkRecordDictDao.xml index 10159b1a1b..4c68253adb 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenCustomerWorkRecordDictDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenCustomerWorkRecordDictDao.xml @@ -2,27 +2,18 @@ - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenListInfoDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenListInfoDao.xml index 647ff94bd4..7da320609b 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenListInfoDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenListInfoDao.xml @@ -3,15 +3,19 @@ \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml index f09b5f3f51..3f43d05337 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgDailyDao.xml @@ -3,51 +3,121 @@ - SELECT max( m.DATE_ID ) AS maxDateId FROM screen_work_record_org_daily m WHERE m.DEL_FLAG = '0' - AND m.CUSTOMER_ID = #{customerId} + AND m.CUSTOMER_ID in + + #{customerId} + - - SELECT - IFNULL( sum( m.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal, - IFNULL( sum( m.ORGANIZE_TOTAL ), 0 ) AS participateTotal + scg.GRID_ID AS orgId, + scg.GRID_NAME AS `NAME`, + IFNULL( sum( temp.PARTICIPATE_USER_TOTAL ), 0 ) AS participateUserTotal, + IFNULL( sum( temp.ORGANIZE_TOTAL ), 0 ) AS participateTotal FROM - screen_customer_agency sca - inner JOIN screen_work_record_org_daily m ON ( sca.AGENCY_ID = m.ORG_ID AND m.DEL_FLAG = '0' AND m.DATE_ID = #{dateId} ) - inner JOIN screen_customer_work_record_dict dict ON ( m.TYPE_CODE = dict.RESOURCE_CODE AND dict.DEL_FLAG = '0' AND dict.DATA_TYPE = #{dataType} ) + screen_customer_grid scg + left join ( + select m.* from screen_work_record_org_daily m + where m.DEL_FLAG = '0' + AND m.DATE_ID = #{dateId} + and m.TYPE_CODE in( + select distinct dict.RESOURCE_CODE + from screen_customer_work_record_dict dict + where dict.DEL_FLAG = '0' + and dict.`LEVEL`='1' + AND dict.DATA_TYPE =#{dataType} + and dict.CUSTOMER_ID=#{customerId} + ) + and org_id in + + #{gridId} + + )temp on(scg.GRID_ID = temp.ORG_ID) WHERE - sca.DEL_FLAG = '0' - AND sca.PARENT_AREA_CODE like concat( #{areaCode},'%') + scg.DEL_FLAG = '0' + AND scg.GRID_ID in + + #{gridId} + + group by scg.GRID_ID,scg.GRID_NAME + ORDER BY + participateUserTotal DESC, + participateTotal DESC + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml index 4e37ffe47e..9bbe13d732 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml @@ -3,6 +3,64 @@ + - + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml index 06e501b713..e08a490372 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml @@ -18,5 +18,20 @@ DEL_FLAG = '0' AND ORG_ID = #{agencyId} + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index cf3b1a7631..fba3b96602 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -272,4 +272,51 @@ and grid.PARENT_AGENCY_ID=#{agencyId} + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml index 0262675182..2d9f8e5deb 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml @@ -122,4 +122,19 @@ GROUP BY scg.PARENT_AGENCY_ID + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml index dc1320fa4d..7f30a13cac 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenDifficultyDataDao.xml @@ -52,4 +52,30 @@ AND dd.EVENT_ID = #{eventId} + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml index a1766981cc..5cd4094e36 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenGovernRankDataDao.xml @@ -6,6 +6,7 @@ + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml index dedfb2d276..ec417cbf50 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml @@ -265,4 +265,63 @@ ${sort} LIMIT #{topNum} + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml index bc1fa8f0aa..5d2be597be 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml @@ -34,4 +34,36 @@ + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml index 7f4520f8ff..2a5f09786e 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml @@ -19,4 +19,41 @@ AND md.ORG_TYPE = CASE WHEN sca.LEVEL = 'community' THEN 'grid' ELSE 'agency' END + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml index ed4cf4c4d1..30fb7bd125 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml @@ -98,4 +98,37 @@ LIMIT #{topNum} + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml index c1a5570113..6534512f8a 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPioneerDataDao.xml @@ -26,4 +26,41 @@ ORDER BY data_end_time DESC LIMIT 1 + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml new file mode 100644 index 0000000000..5816def044 --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml @@ -0,0 +1,28 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml new file mode 100644 index 0000000000..08e88bbeae --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectGridDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectGridDailyDao.xml index 2011413015..c674252a52 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectGridDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectGridDailyDao.xml @@ -19,14 +19,19 @@ WHERE m.DEL_FLAG = '0' AND a.AREA_CODE LIKE concat( #{areaCode}, '%') - AND M.DATE_ID=( - select t1.DATE_ID from screen_project_grid_daily t1 - where t1.DEL_FLAG='0' - and t1.CUSTOMER_ID=#{customerId} - order by t1.DATE_ID desc - limit 1 - ) + AND M.DATE_ID=#{dateId} - + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml index f050e5dd1b..9ef167d327 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml @@ -43,13 +43,13 @@ INNER JOIN screen_customer_agency a ON ( m.ORG_ID = a.AGENCY_ID AND a.DEL_FLAG = '0' ) WHERE m.DEL_FLAG = '0' - AND a.AREA_CODE LIKE concat( #{areaCode}, '%') + AND a.PARENT_AREA_CODE=#{areaCode} AND M.DATE_ID=( select t1.DATE_ID from screen_project_org_daily t1 where t1.DEL_FLAG='0' and t1.CUSTOMER_ID=#{customerId} order by t1.DATE_ID desc limit 1 - ) + )and m.CUSTOMER_ID=#{customerId} \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml index 277e6c17dc..1f3e4623c0 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml @@ -31,4 +31,37 @@ totalData.PROJECT_TOTAL desc + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml index 42f6d5753c..88ea0c6d44 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenUserJoinDao.xml @@ -5,25 +5,59 @@ + + + + + + + \ No newline at end of file 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 3d21f70ce7..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} + ) @@ -534,4 +540,39 @@ AND PROJECT_STATUS = 'closed' GROUP BY GRID_ID - \ No newline at end of file + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml index d607aac0d0..0790001c64 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -140,4 +140,24 @@ GROUP BY fp.ORG_ID + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml index 0ce20b42dd..f776956bf0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml @@ -141,11 +141,12 @@ LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fias.AGENCY_ID WHERE fias.del_flag = 0 - AND CHAR_LENGTH(sca.AREA_CODE) >= #{areaCodeLength} AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') + AND sca.AREA_CODE != #{areaCode} AND fias.MONTH_ID = #{monthId} AND fias.data_type = #{dataType} AND fias.IS_TOTAL = "0" + AND fias.customer_id = #{customerId} AND (fias.INDEX_CODE = "zhilinengli" OR fias.INDEX_CODE = "dangjiannengli" OR fias.INDEX_CODE = "fuwunengli") @@ -153,25 +154,71 @@ + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml index b028814062..28eda4f99c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunityScoreDao.xml @@ -139,10 +139,10 @@ LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = cs.AGENCY_ID WHERE cs.del_flag = 0 - AND CHAR_LENGTH(sca.AREA_CODE) >= 12 AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND cs.MONTH_ID = #{monthId} AND cs.IS_TOTAL = "0" + AND cs.customer_id = #{customerId} AND (cs.INDEX_CODE = "dangjiannengli" OR cs.INDEX_CODE = "zhilinengli" OR cs.INDEX_CODE = "fuwunengli") @@ -164,10 +164,30 @@ WHERE fics.del_flag = '0' AND sca.DEL_FLAG = 0 - AND CHAR_LENGTH(sca.AREA_CODE) >= 9 AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND fics.month_id = #{monthId} AND fics.index_code = #{indexCode} GROUP BY fics.parent_agency_id + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml index 05f3193d0c..7f3545b825 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml @@ -38,6 +38,7 @@ WHERE fidc.del_flag = '0' AND fidc.IS_TOTAL = '0' + AND sca.level = 'district' AND fidc.customer_id = #{customerId} AND fidc.month_id = #{monthId} AND fidc.index_code = #{indexCode} @@ -167,10 +168,30 @@ WHERE fidc.del_flag = '0' AND fidc.IS_TOTAL = '0' - AND CHAR_LENGTH(sca.AREA_CODE) >= 6 AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') AND fidc.month_id = #{monthId} AND fidc.index_code = #{indexCode} GROUP BY fidc.agency_id + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml index 51a1600474..cee52bfea1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/GridScoreDao.xml @@ -197,8 +197,8 @@ AND sca.DEL_FLAG = 0 AND figc.month_id = #{monthId} AND figc.index_code = #{indexCode} - AND CHAR_LENGTH(sca.AREA_CODE) >= 12 AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') + AND sca.AREA_CODE != #{areaCode} GROUP BY figc.agency_id diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml index 7cb270630c..3dbe2956ed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.xml @@ -171,7 +171,59 @@ WHERE gm.del_flag = '0' AND gm.month_id = #{monthId} - AND CHAR_LENGTH(sca.AREA_CODE) >= 12 AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml index 7454e9d0cd..eeddf7a408 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml @@ -128,12 +128,11 @@ WHERE fm.del_flag = '0' AND fm.month_id = #{monthId} - AND CHAR_LENGTH(sca.AREA_CODE) >= 12 AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') - SELECT pm.AGENCY_ID, pm.PARENT_ID, @@ -147,9 +146,44 @@ LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = pm.AGENCY_ID WHERE pm.del_flag = '0' - AND CHAR_LENGTH(sca.AREA_CODE) >= #{areaCode} - AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') + AND sca.PARENT_AREA_CODE = #{areaCode} + AND pm.month_id = #{monthId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml index f4b85f33cc..da861138bd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.xml @@ -127,8 +127,49 @@ LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = sm.AGENCY_ID WHERE sm.del_flag = '0' - AND CHAR_LENGTH(sca.AREA_CODE) >= 12 + AND sm.DATA_TYPE = 'street' AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') + AND sca.AREA_CODE != #{areaCode} AND sm.month_id = #{monthId} + AND sm.PARENT_ID = '0' + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 31d45d2e3c..fe274542a0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -377,4 +377,43 @@ WHERE DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId} + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml new file mode 100644 index 0000000000..bc84c6b2df --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from screen_project_category_grid_daily + where customer_id = #{customerId} + and date_id = #{dateId} + limit 1000 + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml new file mode 100644 index 0000000000..5d8cd9a73a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from screen_project_category_org_daily + where customer_id = #{customerId} + and date_id = #{dateId} + limit 1000 + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml new file mode 100644 index 0000000000..51c75a1c17 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from screen_project_data + where customer_id = #{customerId} + and DATA_END_TIME = #{dateId} + limit 1000 + + + + delete from screen_project_data + where customer_id = #{customerId} + and DATE_FORMAT(PROJECT_CREATE_TIME,'%Y%m%d') = #{dateId} + limit 1000 + + + + + + + + INSERT INTO screen_project_data + ( + id, + customer_id, + org_type, + org_id, + parent_id, + org_name, + project_id, + project_title, + project_create_time, + link_name, + link_mobile, + project_content, + project_level, + project_address, + all_category_name, + longitude, + latitude, + close_case_time, + data_end_time, + all_parent_ids, + project_status_code, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.orgType}, + #{item.orgId}, + #{item.parentId}, + #{item.orgName}, + #{item.projectId}, + #{item.projectTitle}, + #{item.projectCreateTime}, + #{item.linkName}, + #{item.linkMobile}, + #{item.projectContent}, + #{item.projectLevel}, + #{item.projectAddress}, + #{item.allCategoryName}, + #{item.longitude}, + #{item.latitude}, + #{item.closeCaseTime}, + #{item.dataEndTime}, + #{item.allParentIds}, + #{item.projectStatusCode}, + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + ) + + + + + update screen_project_data + + + + + when PROJECT_ID=#{i.projectId} then #{i.projectStatusCode} + + + + + + + when PROJECT_ID=#{i.projectId} then #{i.closeCaseTime} + + + + + + + when PROJECT_ID=#{i.projectId} then #{i.allCategoryName} + + + + + + + when PROJECT_ID=#{i.projectId} then #{i.projectLevel} + + + + + + #{dateId} + + + now() + + + + where + + PROJECT_ID=#{i.projectId} + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectImgDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectImgDataDao.xml new file mode 100644 index 0000000000..a9caf4992e --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectImgDataDao.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + delete from screen_project_img_data + + + PROJECT_ID = #{projectId} + + + + + + + INSERT INTO screen_project_img_data + ( + id, + customer_id, + project_id, + project_img_url, + sort, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.projectId}, + #{item.projectImgUrl}, + #{item.sort}, + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + ) + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml index 6bf6208ce0..ace5879e53 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectOrgDailyDao.xml @@ -121,7 +121,7 @@ LEFT JOIN screen_customer_grid cg ON cg.GRID_ID = g.GRID_ID WHERE g.DEL_FLAG = 0 AND cg.AREA_CODE LIKE CONCAT(#{a.areaCode},'%') - AND g.DATE_ID #{dateId} + AND g.DATE_ID #{dateId} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessAttachmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessAttachmentDao.xml new file mode 100644 index 0000000000..953f2bee72 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessAttachmentDao.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + delete from screen_project_process_attachment + + + PROCESS_ID = #{processId} + + + + + + + INSERT INTO screen_project_process_attachment + ( + id, + attachment_id, + customer_id, + project_id, + process_id, + file_place, + file_name, + attachment_name, + attachment_size, + attachment_format, + attachment_type, + attachment_url, + sort, + duration, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.attachmentId}, + #{item.customerId}, + #{item.projectId}, + #{item.processId}, + #{item.filePlace}, + #{item.fileName}, + #{item.attachmentName}, + #{item.attachmentSize}, + #{item.attachmentFormat}, + #{item.attachmentType}, + #{item.attachmentUrl}, + #{item.sort}, + #{item.duration}, + '0', + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + ) + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessDao.xml new file mode 100644 index 0000000000..fc19f60add --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessDao.xml @@ -0,0 +1,76 @@ + + + + + + + delete from screen_project_process + where customer_id = #{customerId} + and DATA_END_TIME = #{dateId} + limit 1000 + + + + delete from screen_project_process + where customer_id = #{customerId} + and DATE_FORMAT(PROCESS_TIME,'%Y%m%d') = #{dateId} + limit 1000 + + + + + + INSERT INTO screen_project_process + ( + id, + customer_id, + process_id, + project_id, + transfer_dept_ids, + transfer_dept_name, + handler_name, + handler_id, + handler_type, + org_id_path, + operation, + public_reply, + internal_remark, + process_time, + data_end_time, + del_flag, + revision, + created_by, + created_time, + updated_by, + updated_time + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.processId}, + #{item.projectId}, + #{item.transferDeptName}, + #{item.transferDeptIds}, + #{item.handlerName}, + #{item.handlerId}, + #{item.handlerType}, + #{item.orgIdPath}, + #{item.operation}, + #{item.publicReply}, + #{item.internalRemark}, + #{item.processTime}, + #{item.dataEndTime}, + '0', + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now() + ) + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml index a1a946f7ab..70fe070738 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyDao.xml @@ -123,7 +123,7 @@ LEFT JOIN screen_customer_grid cg ON cg.GRID_ID = g.GRID_ID WHERE g.DEL_FLAG = 0 AND cg.AREA_CODE LIKE CONCAT(#{a.areaCode},'%') - AND g.MONTH_ID #{monthId} + AND g.MONTH_ID #{monthId} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml index 945fd7b0e3..b4619ff0a2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml @@ -159,11 +159,10 @@ i.GRID_ID AS "gridId" FROM issue i - INNER JOIN issue_project_relation ipr ON i.ID = ipr.ISSUE_ID + INNER JOIN issue_project_relation ipr ON (i.ID = ipr.ISSUE_ID AND ipr.DEL_FLAG = '0') WHERE i.DEL_FLAG = '0' - AND ipr.DEL_FLAG = '0' - AND CUSTOMER_ID = #{customerId} + AND i.CUSTOMER_ID = #{customerId} + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml index 945b47260e..d5ead92c47 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml @@ -118,4 +118,11 @@ ) + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml index 08c8d78d5b..2a8699d341 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml @@ -105,5 +105,34 @@ and CUSTOMER_ID = #{customerId} and PARAMETER_KEY ='detention_days' + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml index 9e2bd9fe1d..e9079abc3b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectProcessDao.xml @@ -311,4 +311,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml index ab24c331f7..f272c6f692 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/topic/TopicDao.xml @@ -242,4 +242,34 @@ ID = #{item.sourceId} + + + + \ 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 810a972262..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 = '热心居民' @@ -514,4 +516,20 @@ AND register.CUSTOMER_ID = #{customerId} AND register.FIRST_REGISTER = '1' + + + + 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-activiti/epmet-activiti-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-activiti/epmet-activiti-server/src/main/resources/bootstrap.yml index f9a372c94e..811f0c352b 100644 --- a/epmet-module/epmet-activiti/epmet-activiti-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-activiti/epmet-activiti-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /activiti @@ -92,7 +93,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml index 11cc4d6aef..ff4ec82dcf 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /commonservice @@ -99,7 +100,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -136,4 +137,4 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 diff --git a/epmet-module/epmet-demo/epmet-demo-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-demo/epmet-demo-server/src/main/resources/bootstrap.yml index 1352c66f87..b9cf8dd559 100644 --- a/epmet-module/epmet-demo/epmet-demo-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-demo/epmet-demo-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /demo @@ -82,7 +83,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: diff --git a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/AgencyNodeDTO.java b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/AgencyNodeDTO.java index 54ad61602e..3d27d589ab 100644 --- a/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/AgencyNodeDTO.java +++ b/epmet-module/epmet-ext/epmet-ext-client/src/main/java/com/epmet/dto/result/AgencyNodeDTO.java @@ -56,5 +56,5 @@ public class AgencyNodeDTO implements Serializable { * */ private String areaCode; - private String parentCode; + private String parentAreaCode; } 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-ext/epmet-ext-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml index 6ac74f4419..1ed5a4306d 100644 --- a/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-ext/epmet-ext-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /epmet/ext @@ -80,7 +81,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -108,4 +109,4 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml index 07c67a3b3b..8fe49b4ea0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /heart @@ -98,7 +99,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -143,4 +144,4 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 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-job/epmet-job-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml index f30a2913ad..20fc7cb138 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-job/epmet-job-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /job @@ -99,7 +100,7 @@ feign: config: default: loggerLevel: FULL - httpclient: + okhttp: enabled: true logging: 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-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java index fe270e280c..e2c1d1f864 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java @@ -201,7 +201,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl @Override public void projectSendMsg(List formDTOList) { if (CollectionUtils.isEmpty(formDTOList)){ - logger.error(SysSmsConstant.IS_NULL_PARAM_LIST); + logger.warn(SysSmsConstant.IS_NULL_PARAM_LIST); return; } Map> groupByCustomer = formDTOList.stream().collect(Collectors.groupingBy(ProjectSendMsgFormDTO::getCustomerId)); @@ -213,7 +213,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl } List parameterResult = listResult.getData(); if (CollectionUtils.isEmpty(parameterResult)){ - logger.error(SysSmsConstant.PARAMETER_INFO_IS_ZERO); + logger.warn(SysSmsConstant.PARAMETER_INFO_IS_ZERO); return; } groupByCustomer.forEach((customerId,v) -> { @@ -230,11 +230,11 @@ public class SysSmsServiceImpl extends BaseServiceImpl if (customerId.equals(p.getCustomerId())){ // 判断参数开关是否打开,false:未打开 if (p.getSwitchStatus() == false){ - logger.error(String.format(SysSmsConstant.NOT_ON_SWITCH,customerId,p.getParameterKey())); + logger.warn(String.format(SysSmsConstant.NOT_ON_SWITCH,customerId,p.getParameterKey())); }else { // 判断余额状态 false:余额不足 if (p.getBalanceStatus() == false){ - logger.error(String.format(SysSmsConstant.NOT_ENOUGH_BALANCE,customerId,p.getParameterValue())); + logger.warn(String.format(SysSmsConstant.NOT_ENOUGH_BALANCE,customerId,p.getParameterValue())); }else { v.forEach(dto->{ SysSmsDTO sysSmsDTO = new SysSmsDTO(); @@ -249,7 +249,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl }); }); }catch (RenException e){ - logger.error(e.getInternalMsg()); + logger.warn(e.getInternalMsg()); } Map> groupBySwitch = parameterResult.stream().collect(Collectors.groupingBy(CrmParameterResultDTO::getSwitchStatus)); List crmParameterTrue = groupBySwitch.get(true); @@ -274,7 +274,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl //短信服务 AbstractSmsService service = SmsFactory.build(); if (service == null) { - logger.error("发送短信异常,ErrorCode:%s,异常AbstractSmsService is null", ModuleErrorCode.SMS_CONFIG); + logger.warn("发送短信异常,ErrorCode:%s,异常AbstractSmsService is null", ModuleErrorCode.SMS_CONFIG); } //发送短信 if (StringUtils.isNotBlank(sysSmsDTO.getAliyunTemplateCode())) { @@ -283,7 +283,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl service.sendSms(sysSmsDTO.getMobile(), map); } } catch (Exception e) { - logger.error(String.format("项目提醒发送短信失败,失败手机号:%s,ErrorCode:%s", sysSmsDTO.getMobile(), e.getMessage())); + logger.warn(String.format("项目提醒发送短信失败,失败手机号:%s,ErrorCode:%s", sysSmsDTO.getMobile(), e.getMessage())); } } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml index 0639ecbfd2..03945c0ebf 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /message @@ -100,7 +101,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -142,4 +143,4 @@ shutdown: rocketmq: name-server: @rocketmq.nameserver@ producer: - group: @rocketmq.producer.group@ \ No newline at end of file + group: @rocketmq.producer.group@ 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/bootstrap.yml b/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml index c05b439898..3bfe0d68bc 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /oss @@ -110,7 +111,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -139,4 +140,4 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 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 BaseServiceImplcompile - - - com.aliyun - alibaba-dingtalk-service-sdk - 1.0.1 - - diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml index fbee2e36e0..70ea9ad34a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /third @@ -80,7 +81,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -145,4 +146,4 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovCustomerMenuDTO.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovCustomerMenuDTO.java new file mode 100644 index 0000000000..93d5e9c66e --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovCustomerMenuDTO.java @@ -0,0 +1,81 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * 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-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java index 193e5bac1e..4ee3b04ee8 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java +++ b/epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/controller/ResiGroupController.java @@ -140,8 +140,9 @@ public class ResiGroupController { */ @PostMapping("edit-auditing-list") @RequirePermission(requirePermission = RequirePermissionEnum.WORK_GRASSROOTS_GROUP_EDIT_AUDITINGLIST) - public Result> getEditAuditingList(@RequestBody CommonGridAndPageFormDTO param){ + public Result> getEditAuditingList(@LoginUser TokenDto tokenDto, @RequestBody CommonGridAndPageFormDTO param){ ValidatorUtils.validateEntity(param, CommonGridAndPageFormDTO.GridPageGroup.class); + param.setCustomerId(tokenDto.getCustomerId()); return groupOpenFeignClient.govEditAuditingList(param); } diff --git a/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml b/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml index 9153797714..4afc1b94e4 100644 --- a/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-grid/gov-grid-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /gov/grid @@ -56,7 +57,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -85,4 +86,4 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 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/dao/IssueSuggestionDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueSuggestionDao.java index a39aeef521..dadf15338c 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueSuggestionDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueSuggestionDao.java @@ -23,6 +23,7 @@ import com.epmet.dto.form.UserIssueSuggestionFormDTO; import com.epmet.dto.result.IssueSuggestionResDTO; import com.epmet.entity.IssueSuggestionEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -51,4 +52,6 @@ public interface IssueSuggestionDao extends BaseDao { * @Date 2020/11/18 14:27 **/ List selectListIssueSugByIssueId(String issueId); + + IssueSuggestionEntity selectByUserIdAndIssueId(@Param("userId") String createdBy, @Param("issueId") String issueId); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java index 622a68e6cd..c5c96901ea 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.IssueVoteDetailDTO; import com.epmet.dto.form.VoteFormDTO; +import com.epmet.dto.form.VoteRedisFormDTO; import com.epmet.dto.result.IssueAttitudeCountResultDTO; import com.epmet.dto.result.MyPartIssuesResultDTO; import com.epmet.entity.IssueVoteDetailEntity; @@ -95,4 +96,21 @@ public interface IssueVoteDetailDao extends BaseDao { * @Date 2020/11/18 14:35 **/ IssueVoteDetailDTO selectUserIssueDet(@Param("userId") String userId, @Param("issueId") String issueId); + + /** + * @Description 统计出一个议题的所有支持数和反对数 + * @param issueId + * @return com.epmet.dto.form.VoteRedisFormDTO + * @author wangc + * @date 2021.03.03 18:09 + */ + VoteRedisFormDTO selectInfo4Cache(@Param("issueId") String issueId); + /** + * @Description 批量统计出议题的所有支持数和反对数 + * @param issueIds + * @return java.util.Set + * @author wangc + * @date 2021.03.18 14:58 + */ + List selectBatchVoteCount(@Param("issueIds")Set issueIds); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java index 268ddfbf88..a4a1439936 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.IssueConstant; +import com.epmet.dao.IssueVoteDetailDao; import com.epmet.dto.IssueDTO; import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.VoteRedisFormDTO; @@ -29,14 +30,20 @@ import com.epmet.feign.ResiGroupFeignClient; import com.epmet.service.IssueService; import com.epmet.service.IssueVoteDetailService; import com.epmet.utils.ModuleConstants; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import java.lang.reflect.Field; +import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE; @@ -59,13 +66,37 @@ public class IssueVoteDetailRedis { @Autowired private IssueService issueService; + @Autowired + private RedisTemplate redisTemplate; + @Autowired private IssueVoteDetailService issueVoteDetailService; + @Autowired + private IssueVoteDetailDao issueVoteDetailDao; + public void delete(Object[] ids) { } + public void deleteBatch(List issueIds){ + if(CollectionUtils.isEmpty(issueIds)) return ; + Set keys = issueIds.stream().map(id -> { + return IssueConstant.REDIS_KEY + id; + }).collect(Collectors.toSet()); + + redisTemplate.executePipelined((RedisCallback) connection ->{ + keys.forEach( ser -> {connection.del(redisTemplate.getKeySerializer().serialize(ser));}); + return null; + }); + } + + + public void delete(String issueId){ + redisUtils.delete(IssueConstant.REDIS_KEY +issueId); + } + + public void set(VoteRedisFormDTO vote){ @@ -185,10 +216,8 @@ public class IssueVoteDetailRedis { } //如果缓存中没有,去表决详情中计算出实时数据,并放入缓存中 //无需查询issue_vote_statistical中的数据,因为不是实时数据,可能不准确,有定时任务会自动同步 - VoteRedisFormDTO voteCache = new VoteRedisFormDTO(); - voteCache.setIssueId(issueId); - voteCache.setSupportAmount(issueVoteDetailService.getVotingCount(issueId,IssueConstant.SUPPORT)); - voteCache.setOppositionAmount(issueVoteDetailService.getVotingCount(issueId,IssueConstant.OPPOSE)); + VoteRedisFormDTO voteCache = issueVoteDetailDao.selectInfo4Cache(issueId); + if(StringUtils.isBlank(voteCache.getIssueId())) voteCache.setIssueId(issueId); IssueDTO issue = issueService.get(issueId); if(null != issue){ CommonGridIdFormDTO gridId = new CommonGridIdFormDTO(); 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/IssueSuggestionServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSuggestionServiceImpl.java index bbf037ea80..20e2d01e6e 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSuggestionServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueSuggestionServiceImpl.java @@ -121,11 +121,20 @@ public class IssueSuggestionServiceImpl extends BaseServiceImpl issues = @@ -265,17 +266,20 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl ids = issues.stream().map(IssueDTO::getId).collect(Collectors.toSet()); - List gridIds = issues.stream().map(IssueDTO::getGridId).collect(Collectors.toList()); + 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 votableCountMap = null; + Map votableCountMap1 = null; if(votableCountResult.success() && null != votableCountResult.getData() && null != votableCountResult.getData().getVotableCountMap()){ - votableCountMap = votableCountResult.getData().getVotableCountMap(); + votableCountMap1 = votableCountResult.getData().getVotableCountMap(); } - + final Map votableCountMap = votableCountMap1; + //查询指定议题的统计数据 List statisticalList = baseDao.selectListByIds(ids); if (null != statisticalList && statisticalList.size() > NumConstant.ZERO) { @@ -287,9 +291,8 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl existedIds = new HashSet<>(); - existedIds.addAll(ids); - existedIds.retainAll(statisiticalIds); + Set existedIds = new HashSet<>(statisiticalIds); + //更新 //对ids进行更新 - 从缓存中拿取 List listToUpdate = new ArrayList<>(); @@ -302,12 +305,42 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl NumConstant.ZERO) { + Map issueGridMap = issues.stream().collect(Collectors.toMap(IssueDTO::getId,IssueDTO::getGridId,(o, n) -> o)); //新增 - List toInsert = new ArrayList<>(); + List toInsert = new LinkedList<>(); + List voteList = issueVoteDetailDao.selectBatchVoteCount(notExistedIds); + List votedIssueIds = new ArrayList<>(); + if(!CollectionUtils.isEmpty(voteList) && StringUtils.isNotBlank(voteList.get(NumConstant.ZERO).getIssueId())) { + toInsert = voteList.stream().map(o -> { + IssueVoteStatisticalDTO dto = new IssueVoteStatisticalDTO(); + dto.setIssueId(o.getIssueId()); + dto.setOppositionCount(o.getOppositionAmount()); + dto.setSupportCount(o.getSupportAmount()); + dto.setVotableCount(Optional.ofNullable(votableCountMap.get(issueGridMap.get(o.getIssueId()))).orElse(NumConstant.ZERO)); + dto.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);dto.setUpdatedBy(ModuleConstants.CREATED_BY_SYSTEM); + return dto; + }).collect(Collectors.toList()); + votedIssueIds = voteList.stream().map(VoteRedisFormDTO::getIssueId).collect(Collectors.toList()); + } - List summaryList = issueVoteDetailDao.getVotingSummaryList(ids); + notExistedIds.removeAll(votedIssueIds); + if(!notExistedIds.isEmpty()){ + List collect = notExistedIds.stream().map(issueId -> { + IssueVoteStatisticalDTO dto = new IssueVoteStatisticalDTO(); + dto.setIssueId(issueId); + dto.setSupportCount(NumConstant.ZERO); + dto.setOppositionCount(NumConstant.ZERO); + dto.setVotableCount(Optional.ofNullable(votableCountMap.get(issueGridMap.get(issueId))).orElse(NumConstant.ZERO)); + dto.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM);dto.setUpdatedBy(ModuleConstants.CREATED_BY_SYSTEM); + return dto; + }).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(collect)) toInsert.addAll(collect);} + + /* + List summaryList = issueVoteDetailDao.getVotingSummaryList(notExistedIds); Map> summaryMap = summaryList.stream().collect(Collectors.groupingBy(IssueAttitudeCountResultDTO::getIssueId)); + for (Map.Entry> entry : summaryMap.entrySet()) { IssueVoteStatisticalDTO obj = new IssueVoteStatisticalDTO(); obj.setCreatedBy(ModuleConstants.CREATED_BY_SYSTEM); @@ -322,19 +355,15 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl setToInsert = toInsert.stream().map(IssueVoteStatisticalDTO::getIssueId).collect(Collectors.toSet()); +*/ + /* Set setToInsert = toInsert.stream().map(IssueVoteStatisticalDTO::getIssueId).collect(Collectors.toSet()); Set issuesNeverVotedIds = new HashSet(); issuesNeverVotedIds.addAll(ids); @@ -372,30 +401,27 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl redundantIds = new HashSet(); - redundantIds.addAll(statisiticalIds); - redundantIds.removeAll(ids); + //Set redundantIds = new HashSet(); + //redundantIds.addAll(statisiticalIds); + //redundantIds.removeAll(ids); //将redundantIds的议题统计信息删除 //因为statisiticalIds是通过ids查询出,因此不会出现这种情况 } else { //数据吻合,全部更新 List listToUpdate = new ArrayList<>(); - Map> gridIssueMap = - issues.stream().collect(Collectors.groupingBy(IssueDTO::getGridId)); - setVotableCountsAndUpdateCache(listToUpdate,issues,votableCountMap); // listToUpdate批量更新 @@ -518,8 +544,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl @@ -33,4 +34,11 @@ ORDER BY ig.CREATED_TIME DESC + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml index 426c741806..166f3d2b17 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteDetailDao.xml @@ -67,6 +67,9 @@ ISSUE_VOTE_DETAIL WHERE del_flag = '0' + + issue_id = #{issueId} + GROUP BY issue_id, attitude @@ -119,4 +122,37 @@ AND ivd.ISSUE_ID =#{issueId} AND ivd.CREATED_BY =#{userId} + + + + \ No newline at end of file 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-access/oper-access-server/src/main/resources/bootstrap.yml b/epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml index 34a87bb782..f7bad85d13 100644 --- a/epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml +++ b/epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /oper/access @@ -99,7 +100,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -128,4 +129,4 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/bootstrap.yml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/bootstrap.yml index 30b2608312..3d0b42162e 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/bootstrap.yml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /oper/crm @@ -105,7 +106,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -134,4 +135,4 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 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/group/form/CommonGridAndPageFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java index 169073eb68..1e4b79644c 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/CommonGridAndPageFormDTO.java @@ -37,4 +37,6 @@ public class CommonGridAndPageFormDTO implements Serializable { @Min(1) private Integer pageSize; + private String customerId; + } 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/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 7f86290566..e7432526b2 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -106,6 +106,12 @@ 2.0.0 compile + + com.epmet + epmet-user-client + 2.0.0 + compile + diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java index d8e11dc942..569a9137b3 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ResiGroupController.java @@ -19,6 +19,7 @@ package com.epmet.modules.group.controller; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -405,7 +406,17 @@ public class ResiGroupController { */ @PostMapping("gov-edit-auditing-list") public Result> govEditAuditingList(@RequestBody CommonGridAndPageFormDTO param){ - return new Result>().ok(resiGroupService.getEditAuditingList(param)); + List list = resiGroupService.getEditAuditingList(param); + if (StrConstant.SPECIAL_CUSTOMER.equals(param.getCustomerId())) { + list.forEach(item -> { + if (item.getMessageText().contains("热心居民")) { + item.setMessageText(item.getMessageText().replace("热心居民", "组长")); + } else if (item.getMessageText().contains("居民")) { + item.setMessageText(item.getMessageText().replace("居民", "学员")); + } + }); + } + return new Result>().ok(list); } /** diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java index 6615ca4bb1..55a15a3a39 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupCodeServiceImpl.java @@ -160,7 +160,7 @@ public class ResiGroupCodeServiceImpl extends BaseServiceImpl getGroupLeaderUserInfo(String groupId) { + String customerId = loginUserUtil.getCurrentCustomerId(); //群主名称需要调用feign查询 - ResiGroupEntity resiGroupEntity = baseDao.selectById(groupId); - if (null == resiGroupEntity) { - return new Result<>(); - } +// ResiGroupEntity resiGroupEntity = baseDao.selectById(groupId); +// if (null == resiGroupEntity) { +// return new Result<>(); +// } ResiGroupMemberDTO groupMemberDTO = baseDao.selectGroupLeader(groupId); if (null == groupMemberDTO) { return new Result<>(); } UserResiInfoFormDTO resiUserInfoFormDTO = new UserResiInfoFormDTO(); - resiUserInfoFormDTO.setCustomerId(resiGroupEntity.getCustomerId()); + resiUserInfoFormDTO.setCustomerId(customerId); resiUserInfoFormDTO.setUserId(groupMemberDTO.getCustomerUserId()); return epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); } @@ -384,7 +382,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl result = epmetUserFeignClient.getUserResiInfoDTO(resiUserInfoFormDTO); if (!result.success() || null == result.getData() || StringUtils.isBlank(result.getData().getRegMobile())) { logger.info(String.format("加入小组界面初始化查询成功,当前用户非注册居民,epmet-user-server接口入参%s,返回%s",JSON.toJSONString(resiUserInfoFormDTO),JSON.toJSONString(result))); - throw new RenException(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode()); + if (StrConstant.SPECIAL_CUSTOMER.equals(initApplyGroupFormDTO.getCustomerId())) { + throw new RenException(8001, "只有注册学员才可以加入小组"); + } else { + throw new RenException(EpmetErrorCode.CANNOT_JOIN_GROUP.getCode()); + } + } } @@ -526,7 +533,11 @@ public class ResiGroupServiceImpl extends BaseServiceImpl>().ok(baseDao.getApplyingGroupsByCustIdAndGridId(params)); + List list = baseDao.getApplyingGroupsByCustIdAndGridId(params); + if (StrConstant.SPECIAL_CUSTOMER.equals(params.getCustomerId())) { + list.forEach(item -> { + if (item.getMessageText().contains("热心居民")) { + item.setMessageText(item.getMessageText().replace("热心居民", "组长")); + } else if (item.getMessageText().contains("居民")) { + item.setMessageText(item.getMessageText().replace("居民", "学员")); + } + }); + } + return new Result>().ok(list); } /** @@ -984,7 +1005,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl 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 9207200b6e..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 @@ -226,7 +226,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-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml b/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml index 210ad19829..35cade577d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /resi/group @@ -99,7 +100,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -155,4 +156,4 @@ elink: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,每超过30秒,打印一次错误日志 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,每超过30秒,打印一次错误日志 diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml index d21ed5ccdd..5ccd3cdb7d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/group/ResiGroupDao.xml @@ -165,7 +165,14 @@ SELECT + DISTINCT GRID_ID, CUSTOMER_ID FROM @@ -43,6 +44,38 @@ user_id = #{userId} AND first_register = '1' + ORDER BY + CREATED_TIME desc + + LIMIT 1 + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml index f59dc05973..1ec439f398 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml @@ -73,7 +73,7 @@