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 6413ffb82b..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,7 @@ 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; @@ -37,9 +38,9 @@ public class SsoController { * @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)); } /** @@ -58,7 +59,7 @@ public class SsoController { public Result testssoLogin() { ThirdPlatUserInfo userInfoByTicket = null; try { - userInfoByTicket = jcetApiService.getUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui"); + userInfoByTicket = jcetApiService.getCUserInfoByTicket("ssoTicket-vYtMRuXAQZri3wpA2vyq5D8n3Q9oO7ui"); } catch (Exception e) { e.printStackTrace(); } @@ -71,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/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/service/SsoService.java b/epmet-auth/src/main/java/com/epmet/service/SsoService.java index 4514230228..4cc9c93ba7 100644 --- a/epmet-auth/src/main/java/com/epmet/service/SsoService.java +++ b/epmet-auth/src/main/java/com/epmet/service/SsoService.java @@ -3,6 +3,7 @@ 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; @@ -18,14 +19,14 @@ public interface SsoService { * @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 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 1bedcc9a7a..86569434c2 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 @@ -79,13 +79,13 @@ public class GovLoginServiceImpl implements GovLoginService { public void sendSmsCode(SendSmsCodeFormDTO formDTO) { //1、校验手机号是否符合规范 if (!PhoneValidatorUtils.isMobile(formDTO.getMobile())) { - logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg())); + logger.warn(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), EpmetErrorCode.ERROR_PHONE.getCode(), EpmetErrorCode.ERROR_PHONE.getMsg())); throw new RenException(EpmetErrorCode.ERROR_PHONE.getCode()); } //2、根据手机号校验用户是否存在 Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); if (!customerStaffResult.success()) { - logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); + logger.warn(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); throw new RenException(customerStaffResult.getCode()); } //3、发送短信验证码 @@ -94,7 +94,7 @@ public class GovLoginServiceImpl implements GovLoginService { sendVerificationCodeFormDTO.setAliyunTemplateCode(SmsTemplateConstant.LGOIN_CONFIRM); Result smsCodeResult=epmetMessageOpenFeignClient.sendVerificationCode(sendVerificationCodeFormDTO); if (!smsCodeResult.success()) { - logger.error(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg())); + logger.warn(String.format(SEND_SMS_CODE_ERROR, formDTO.getMobile(), smsCodeResult.getCode(), smsCodeResult.getMsg())); throw new RenException(smsCodeResult.getCode()); } //4、保存短信验证码(删除现有短信验证码、将新的短信验证码存入Redis) @@ -114,13 +114,13 @@ public class GovLoginServiceImpl implements GovLoginService { //1、根据手机号查询到用户信息 Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); if (!customerStaffResult.success()) { - logger.error(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); + logger.warn(String.format("手机验证码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); throw new RenException(customerStaffResult.getCode()); } //2、验证码是否正确 String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile()); if (!formDTO.getSmsCode().equals(rightSmsCode)) { - logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); + logger.warn(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); } //3、查询用户所有的组织信息 @@ -134,7 +134,7 @@ public class GovLoginServiceImpl implements GovLoginService { if(result.success()&&null!=result.getData()){ return result.getData(); } - logger.error(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,验证码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER,formDTO.getMobile(),formDTO.getSmsCode(),result.getCode(),result.getMsg())); + logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,验证码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER,formDTO.getMobile(),formDTO.getSmsCode(),result.getCode(),result.getMsg())); return new ArrayList<>(); } @@ -147,7 +147,7 @@ public class GovLoginServiceImpl implements GovLoginService { } Result latestStaffWechat = epmetUserFeignClient.getLatestStaffWechatLoginRecord(wxMaJscode2SessionResult.getOpenid()); if (!latestStaffWechat.success() || null == latestStaffWechat.getData()) { - logger.error(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg())); + logger.warn(String.format("没有获取到用户最近一次登录账户信息,code[%s],msg[%s]", EpmetErrorCode.PLEASE_LOGIN.getCode(), EpmetErrorCode.PLEASE_LOGIN.getMsg())); throw new RenException(EpmetErrorCode.PLEASE_LOGIN.getCode()); } StaffLatestAgencyResultDTO staffLatestAgencyResultDTO = latestStaffWechat.getData(); @@ -222,7 +222,7 @@ public class GovLoginServiceImpl implements GovLoginService { public Set getGridIdList(String staffId) { Result> result = govOrgFeignClient.listGridsbystaffid(staffId); if (!result.success()) { - logger.error("登录:查询网格列表,远程调用返回错误:{}", result.getMsg()); + logger.warn("登录:查询网格列表,远程调用返回错误:{}", result.getMsg()); return null; } else { List grids = result.getData(); @@ -239,11 +239,11 @@ public class GovLoginServiceImpl implements GovLoginService { return deptIdLists; } } else { - logger.error("登录:查询部门列表,远程调用返回错误:{}", deptListResult.getMsg()); + logger.warn("登录:查询部门列表,远程调用返回错误:{}", deptListResult.getMsg()); } } catch (Exception e) { String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); - logger.error("登录:查询部门列表异常:{}", errorStackTrace); + logger.warn("登录:查询部门列表异常:{}", errorStackTrace); } return null; } @@ -268,7 +268,7 @@ public class GovLoginServiceImpl implements GovLoginService { customerStaffFormDTO.setMobile(formDTO.getMobile()); Result customerStaffDTOResult = epmetUserFeignClient.getCustomerStaffInfo(customerStaffFormDTO); if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) { - logger.error(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg())); + logger.warn(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg())); throw new RenException(customerStaffDTOResult.getCode()); } CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); @@ -291,7 +291,7 @@ public class GovLoginServiceImpl implements GovLoginService { @Override public void loginOut(TokenDto tokenDto) { if(null == tokenDto){ - logger.error("token解析失败,直接跳转重新登录即可"); + logger.warn("token解析失败,直接跳转重新登录即可"); throw new RenException("当前用户信息获取失败"); } cpUserDetailRedis.logout(tokenDto.getApp() , tokenDto.getClient() , tokenDto.getUserId()); @@ -328,7 +328,7 @@ public class GovLoginServiceImpl implements GovLoginService { //1、根据手机号查询到用户信息 Result> customerStaffResult = epmetUserFeignClient.checkCustomerStaff(formDTO.getMobile()); if (!customerStaffResult.success()) { - logger.error(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); + logger.warn(String.format("手机密码登录异常,手机号[%s],code[%s],msg[%s]", formDTO.getMobile(), customerStaffResult.getCode(), customerStaffResult.getMsg())); throw new RenException(customerStaffResult.getCode()); } //2、密码是否正确 @@ -357,12 +357,12 @@ public class GovLoginServiceImpl implements GovLoginService { } //根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码 if(!havePasswordFlag){ - logger.error(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile())); + logger.warn(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile())); throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); } //密码错误 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(); @@ -371,7 +371,7 @@ public class GovLoginServiceImpl implements GovLoginService { if(result.success()&&null!=result.getData()){ return result.getData(); } - logger.error(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,密码%s,返回错误码%s,错误提示信息%s", + logger.warn(String .format("手机验证码获取组织,调用%s服务失败,入参手机号%s,密码%s,返回错误码%s,错误提示信息%s", ServiceConstant.GOV_ORG_SERVER, formDTO.getMobile(), formDTO.getPassword(), @@ -467,7 +467,7 @@ public class GovLoginServiceImpl implements GovLoginService { public String getOrgIdPath(String staffId) { Result result = govOrgFeignClient.getAgencyByStaff(staffId); if (!result.success()) { - logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); + logger.warn("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); return null; } CustomerAgencyDTO agency = result.getData(); @@ -485,7 +485,7 @@ public class GovLoginServiceImpl implements GovLoginService { public CustomerAgencyDTO getAgencyByStaffId(String staffId) { Result result = govOrgFeignClient.getAgencyByStaff(staffId); if (!result.success()) { - logger.error("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); + logger.warn("登录:查询登录人所属的机关OrgIdPath失败:{}", result.getMsg()); return null; } return result.getData(); diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java index bf0689b2b7..8575a8e244 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java @@ -106,6 +106,7 @@ public class GovWebServiceImpl implements GovWebService { logger.info("app:" + formDTO.getApp() + ";client:" + formDTO.getClient() + ";userId:" + userId + ";生成token[" + token + "]"); int expire = jwtTokenProperties.getExpire(); TokenDto tokenDto = new TokenDto(); + tokenDto.setCustomerId(formDTO.getCustomerId()); tokenDto.setApp(formDTO.getApp()); tokenDto.setClient(formDTO.getClient()); tokenDto.setUserId(userId); diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java index f6f9e52dc5..0b0e86c104 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 @@ -30,6 +30,7 @@ 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; @@ -74,6 +75,9 @@ public class SsoServiceImpl implements SsoService { @Autowired private EpmetUserFeignClient epmetUserFeignClient; + @Value("${epmet.third.urlPrefix}") + private String epmetThirdUrlPrefix; + /** * @Description 0、入口:得到token * @Param formDTO @@ -81,8 +85,9 @@ public class SsoServiceImpl implements SsoService { * @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)); @@ -97,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()); } @@ -140,7 +145,7 @@ public class SsoServiceImpl implements SsoService { ThirdPlatformEnum platformEnum = ThirdPlatformEnum.getEnum(formDTO.getPlatform()); String apiService = platformEnum.getApiService(); AbstractApiService apiServiceImpl = (AbstractApiService) SpringContextUtils.getBean(apiService); - thirdUser = apiServiceImpl.getUserInfoByTicket(formDTO.getThirdToken()); + thirdUser = apiServiceImpl.getGUserInfoBySSOToken(formDTO.getThirdToken()); } catch (RenException e) { throw new RenException(e.getCode(), e.getMessage()); } catch (Exception e) { @@ -155,14 +160,14 @@ public class SsoServiceImpl implements SsoService { form.setMobile(thirdUser.getMobile()); Result result = epmetUserFeignClient.getStaffIdAndPwd(form); //todo userId 写死测试 3f7f852ce22c511aa67ecb695395295d start - GovWebOperLoginResultDTO demo = new GovWebOperLoginResultDTO(); + /* GovWebOperLoginResultDTO demo = new GovWebOperLoginResultDTO(); demo.setUserId("3f7f852ce22c511aa67ecb695395295d"); result = new Result<>(); - result.ok(demo); + result.ok(demo);*/ //test end if (!result.success() || null == result.getData() || null == result.getData().getUserId()) { - logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在"); + logger.error("根据手机号查询PC工作端登陆人员信息失败,返回10003账号不存在,param:{}", JSON.toJSONString(form)); throw new RenException(EpmetErrorCode.ERR10003.getCode()); } @@ -230,7 +235,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); @@ -256,10 +261,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)); @@ -272,7 +278,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()); } @@ -354,7 +360,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(""); @@ -480,21 +486,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,并记录用户激活状态,激活时间 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 024010f05b..c9a6addb29 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 @@ -401,7 +401,7 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { //0、验证码是否正确 String rightSmsCode = captchaRedis.getSmsCode(formDTO.getMobile()); if (!formDTO.getSmsCode().equals(rightSmsCode)) { - logger.error(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); + logger.warn(String.format("验证码错误code[%s],msg[%s]",EpmetErrorCode.MOBILE_CODE_ERROR.getCode(),EpmetErrorCode.MOBILE_CODE_ERROR.getMsg())); throw new RenException(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); } //1.根据appId查询对应客户Id @@ -480,12 +480,12 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { } //根据手机号查出来所有用户,密码都为空,表明用户未激活账户,未设置密码 if(!havePasswordFlag){ - logger.error(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile())); + logger.warn(String.format("当前手机号(%s)下所有账户都未设置密码,请先使用验证码登录激活账户",formDTO.getMobile())); throw new RenException(EpmetErrorCode.PASSWORD_ERROR.getCode()); } //密码错误 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 412dba2dc3..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,12 +136,24 @@ shutdown: # 调用第三方平台相关参数 thirdplat: - jcet: - domain: @thirdplat.jcet.domain@ - appkey: @thirdplat.jcet.appkey@ - appsecret: @thirdplat.jcet.appsecret@ + 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-cloud-generator/src/main/resources/application.yml b/epmet-cloud-generator/src/main/resources/application.yml index bfea2783f9..5a36af7c15 100644 --- a/epmet-cloud-generator/src/main/resources/application.yml +++ b/epmet-cloud-generator/src/main/resources/application.yml @@ -9,7 +9,7 @@ spring: type: com.alibaba.druid.pool.DruidDataSource #MySQL配置 driverClassName: com.mysql.jdbc.Driver - url: jdbc:mysql://192.168.1.130:3306/epmet_gov_project?useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://192.168.1.130:3306/epmet_third?useUnicode=true&characterEncoding=UTF-8&useSSL=false username: epmet_dba password: EpmEt-dbA-UsEr #oracle配置 diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java index 9c332a6626..ded5a9aa8d 100644 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java @@ -17,5 +17,9 @@ public interface ConsomerGroupConstants { * 初始化客户组织机构信息分组 */ String INIT_CUSTOMER_ORG_ROLES_GROUP = "init_customer_org_roles_group"; + /** + * 客户初始化议题、项目分类、标签数据 + */ + String ISSUE_PROJECT_CATEGORY_TAG = "issue_project_category_tag"; } 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 150d99b2da..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 解析请求结果 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 7dd811425d..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; @@ -16,20 +17,20 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; import java.io.UnsupportedEncodingException; -import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; -@Service 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(); } /** @@ -38,8 +39,7 @@ public class JcetApiService extends AbstractApiService { * @author wxz * @date 2021.01.19 10:26 */ - @Override - public ThirdPlatUserInfo getUserInfoByTicket(String ticket) throws UnsupportedEncodingException { + public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws UnsupportedEncodingException { logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket); @@ -47,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()); @@ -61,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()); @@ -70,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获取用户信息 @@ -98,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(StandardCharsets.UTF_8).length; + private Map getHeaders(int bodyLength, String appKey, String appSecret) throws UnsupportedEncodingException { 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 index 958fd8b1bb..b5307c2951 100644 --- 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 @@ -40,6 +40,11 @@ public class PyldApiService extends AbstractApiService { pyldThirdplatProps = props.getPyld(); } + @Override + public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws Exception { + return null; + } + /** * @return * @Description 通过第三方平台ticket获取用户信息 @@ -47,7 +52,7 @@ public class PyldApiService extends AbstractApiService { * @date 2021.01.19 10:26 */ @Override - public ThirdPlatUserInfo getUserInfoByTicket(String platformToken) { + public ThirdPlatUserInfo getGUserInfoBySSOToken(String platformToken) { logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>"); logger.info("【请求平阴联动指挥平台第三方平台】getUserInfoByTicket()接口入参 platformToken:{}", platformToken); 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/properties/ThirdplatProps.java b/epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/properties/ThirdplatProps.java index 4c9b46b9e0..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 @@ -6,10 +6,13 @@ import org.springframework.boot.context.properties.ConfigurationProperties; @Data @ConfigurationProperties(prefix = "thirdplat") public class ThirdplatProps { - /** - * 泸州 酒城e通 - */ - private JcetThirdplatProps jcet; + + // C端 + private JcetThirdplatProps jcetCend; + + // G端 + private JcetThirdplatProps jcetGend; + /** * 平阴联动指挥平台 */ 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..38a70d6582 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); @@ -74,7 +77,7 @@ public abstract class BaseRequestLogAspect { return result; } catch (ValidateException e) { result = handleValidateException(e); - resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e)); + resultWarnLog(transactionSerial, getExecPeriod(startTime), result, e.getMsg(), ExceptionUtils.getErrorStackTrace(e)); } catch (DuplicateKeyException e) { result = handlerDuplicateKeyException(e); resultErrorLog(transactionSerial, getExecPeriod(startTime), result, e.getMessage(), ExceptionUtils.getErrorStackTrace(e)); 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/constant/NumConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java index 59e3ce4bdc..8f416ef8e9 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; @@ -62,6 +63,10 @@ public interface NumConstant { String THREE_STR = "3"; String FOUR_STR = "4"; String FIVE_STR = "5"; + String SIX_STR = "6"; + String SEVEN_STR = "7"; + String EIGHT_STR = "8"; + String NINE_STR = "9"; String POSITIVE_EIGHT_STR = "+8"; String EMPTY_STR = ""; String ONE_NEG_STR = "-1"; 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/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index ac6d50bd9f..210f2d3443 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,12 @@ 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,"手机号未注册,请先完成信息注册"), @@ -143,7 +146,10 @@ public enum EpmetErrorCode { TOPIC_SHIFTED_TO_ISSUE_UNDER_AUDITING(9004,"当前话题正在转议题审核"), TOPIC_ALREADY_SHIFTED_TO_ISSUE(9005,"该话题已被转为议题,请勿重复操作"), TOPIC_IS_HIDDEN(9006,"该话题已被屏蔽,请先解除屏蔽"), - TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"); + TOPIC_IS_CLOSED(9008,"该话题已关闭,无法转为议题"), + + CUSTOMER_CATEGORY(9101,"分类已使用,不允许删除"), + CATEGORY_NAME(9102,"分类名称已存在,不允许重复"); private int code; private String msg; 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..9ddcadc507 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,64 @@ 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 + * @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 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); + } + + /** + * 一个客户对应多个第三方平台,多个ApiService的key + * @param customerId * @return - * @author wxz - * @date 2021.01.20 16:56 */ - public static String getCustomerApiServiceKey(String customerId) { - return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId); + public static String listCustomerApiServiceListKey(String customerId) { + return rootPrefix.concat("customer:thirdplat:apiservicelist:").concat(customerId); + } + + /** + * 查询第三方平台access token + * @param platformId + * @return + */ + public static String getThirdPlatformAccessTokenKey(String platformId) { + return rootPrefix.concat("thirdplatform:accesstoken:").concat(platformId); } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java index 72a6db9b10..dac7d44896 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisUtils.java @@ -206,6 +206,17 @@ public class RedisUtils { }).collect(Collectors.toList()); } + /** + * @Description 获取缓存List + * @Param key + * @author zxc + * @date 2021/3/30 下午3:33 + */ + public List getListLrange(String key){ + List range = redisTemplate.opsForList().range(key, 0, -1); + return range; + } + /** * @Description Redis lrem : * 根据参数 count 的值,移除列表中与参数 value 相等的元素 @@ -357,6 +368,18 @@ public class RedisUtils { return typedTuples; } + public Set zReverseRange(String key, long start, long end, Class clazz) { + Set objects = redisTemplate.opsForZSet().reverseRange(key, start, end); + if(CollectionUtils.isEmpty(objects)) return null; + return objects.stream().map(o->{ + try { + T target = clazz.newInstance(); + BeanUtils.copyProperties(o, target); + return target; + }catch (Exception e){throw new RenException("convert error");} + }).collect(Collectors.toSet()); + } + /** * @Description 标签使用数量缓存更新 * @param key @@ -368,6 +391,28 @@ public class RedisUtils { return redisTemplate.opsForZSet().incrementScore(key, value, delta); } + /** + * @Description 获取某个Zset的score + * @Param key + * @Param o + * @author zxc + * @date 2020/12/9 下午3:07 + */ + public Double getScore(String key, Object o){ + return redisTemplate.opsForZSet().score(key,o); + } + + /** + * @Description zset添加 + * @Param key + * @Param o + * @author zxc + * @date 2020/12/9 下午3:18 + */ + public void zSetAdd(String key, Object o){ + redisTemplate.opsForZSet().add(key,o,NumConstant.ZERO); + } + /** * @Description 判断key是否存在 * @param key 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 70307f6551..410549aecb 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 fe48e711e7..74809f9d30 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 @@ -6,6 +6,9 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; +import org.apache.commons.fileupload.FileItem; +import org.apache.commons.fileupload.FileItemFactory; +import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpEntity; @@ -23,6 +26,7 @@ import org.apache.http.config.RegistryBuilder; import org.apache.http.conn.socket.ConnectionSocketFactory; import org.apache.http.conn.socket.PlainConnectionSocketFactory; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntityBuilder; @@ -32,16 +36,15 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; import org.springframework.util.CollectionUtils; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.net.URLEncoder; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; @@ -62,7 +65,7 @@ public class HttpClientManager { // 连接超时时间,毫秒 private static int connectionTimeout = 5000; // 读取数据超时时间,毫秒 - private static int soTimeout = 20000; + private static int soTimeout = 45000; private static String HEADER_CONTENT_TYPE = "Content-Type"; private static String HEADER_APPLICATION_JSON = "application/json;charset=utf-8"; private static String UTF8 = "utf-8"; @@ -239,6 +242,32 @@ public class HttpClientManager { } } + public Result uploadFile(String url, boolean isHttps, File file, String fileName, Map headerMap) { + try { + HttpPost httppost = new HttpPost(url); + httppost.setConfig(requestConfig); + if (null != headerMap) { + headerMap.forEach((k, v) -> { + if (v != null) { + httppost.addHeader(k, v.toString()); + } + }); + } + if (file != null) { + HttpEntity entity = MultipartEntityBuilder + .create() + .addBinaryBody("file", file, ContentType.MULTIPART_FORM_DATA, fileName) + .setMode(HttpMultipartMode.RFC6532) + .build(); + httppost.setEntity(entity); + } + return execute(httppost,isHttps); + } catch (Exception e) { + log.error("send exception", e); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } + /** * desc: https发送json post 请求 * param: url,jsonStrParam @@ -349,7 +378,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); @@ -364,7 +393,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); @@ -434,6 +465,61 @@ public class HttpClientManager { } } + public Result getFileItem(String url, String fileName) { + + try { + URIBuilder builder = new URIBuilder(url); + + HttpGet httpGet = new HttpGet(builder.build()); + httpGet.setConfig(requestConfig); + return executeToFile(httpGet, fileName); + } catch (Exception e) { + log.error("sendGet exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } + + private Result executeToFile(HttpRequestBase httpMethod, String fileName) { + CloseableHttpResponse response = null; + FileItem item = null; + try { + response = httpclient.execute(httpMethod); + log.debug("http send response:{}", JSON.toJSONString(response)); + if (response != null && response.getStatusLine() != null) { + if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + InputStream is = response.getEntity().getContent(); + FileItemFactory factory = new DiskFileItemFactory(16, null); + String textFieldName = "file"; + item = factory.createItem(textFieldName, ContentType.APPLICATION_OCTET_STREAM.toString(), false, fileName); + OutputStream os = item.getOutputStream(); + + int bytesRead = 0; + byte[] buffer = new byte[8192]; + while ((bytesRead = is.read(buffer, 0, 8192)) != -1) { + os.write(buffer, 0, bytesRead); + } + os.close(); + is.close(); + return new Result().ok(new CommonsMultipartFile(item)); + } else { + log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); + } + } + } catch (Exception e) { + log.error("execute exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } finally { + httpMethod.releaseConnection(); + try { + if (response != null) { + response.close(); + } + } catch (IOException e) { + } + } + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + public Result getMediaByteArray(String url, String json) { try { 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-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index a0c1c35811..6c35fe31da 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,10 +457,16 @@ epmet: - /gov/project/** - /resi/home/** - /data/report/** + - /epmet/ext/** + - /data/stats/** + - /data/aggregator/** + - /gov/voice/** + - /resi/voice/** # 内部认证url白名单(在白名单中的,就不会再校验登录了) internalAuthUrlsWhiteList: - /epmetuser/customerstaff/customerlist + - /gov/project/project/platformcallback # 外部应用认证,使用AccessToken等头进行认证 externalOpenUrls: diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/GroupConstant.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/GroupConstant.java index ba879a3fee..928115a08f 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/GroupConstant.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/constant/GroupConstant.java @@ -5,4 +5,8 @@ package com.epmet.dataaggre.constant; * @DateTime 2020/12/25 上午10:55 */ public interface GroupConstant { + + String BADGE_ICON = "badgeIcon"; + + String BADGE_KEY = "epmet:badge:user:"; } diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java new file mode 100644 index 0000000000..19bfd88186 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/epmetuser/result/UserInfosResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dataaggre.dto.epmetuser.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/3/30 上午11:04 + * @DESC + */ +@Data +public class UserInfosResultDTO implements Serializable { + + private static final long serialVersionUID = 7129564173128153335L; + + private String userId; + private String userShowName; + private String headPhoto; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java index cbda7d52f6..752262827e 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govproject/ProjectCategoryDTO.java @@ -64,6 +64,11 @@ public class ProjectCategoryDTO implements Serializable { */ private String categoryPids; + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + /** * 删除标识 0未删除、1已删除 */ 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-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java index deae8e0ffd..7fd4a67286 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/ResiTopicCommentDTO.java @@ -17,9 +17,10 @@ package com.epmet.dataaggre.dto.resigroup; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -49,7 +50,7 @@ public class ResiTopicCommentDTO implements Serializable { private String topicId; /** - * 评论状态 + * 评论状态:讨论中:discussing;已屏蔽 :hidden */ private String status; diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/form/CandidateListFormDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/form/CandidateListFormDTO.java new file mode 100644 index 0000000000..60113c8ed1 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/form/CandidateListFormDTO.java @@ -0,0 +1,35 @@ +package com.epmet.dataaggre.dto.resigroup.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/3/30 上午9:34 + * @DESC + */ +@Data +public class CandidateListFormDTO implements Serializable { + + private static final long serialVersionUID = 6184071611057671961L; + + public interface CandidateListForm{} + + /** + * 小组ID + */ + @NotBlank(message = "小组ID不能为空",groups = CandidateListForm.class) + private String groupId; + + @NotNull(message = "pageNo不能为空",groups = CandidateListForm.class) + private Integer pageNo; + + @NotNull(message = "pageSize不能为空",groups = CandidateListForm.class) + private Integer pageSize; + + private String customerId; + +} diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/result/CandidateListResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/result/CandidateListResultDTO.java new file mode 100644 index 0000000000..100c94f58d --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/resigroup/result/CandidateListResultDTO.java @@ -0,0 +1,57 @@ +package com.epmet.dataaggre.dto.resigroup.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2021/3/30 上午9:15 + * @DESC + */ +@Data +public class CandidateListResultDTO implements Serializable { + + private static final long serialVersionUID = 4720936429310456924L; + + /** + * resi_group_member.id: 成员id + */ + private String memberId; + + /** + * 组员的用户id + */ + private String userId; + + /** + * 成员头像 + */ + private String headPhoto; + + /** + * 成员的显示名称 + */ + private String userShowName; + + /** + * 徽章Url集合 + */ + private String leaderFlag; + + /** + * leader群主,member成员 + */ + private List badgeList; + + public CandidateListResultDTO() { + this.memberId = ""; + this.userId = ""; + this.headPhoto = ""; + this.userShowName = ""; + this.leaderFlag = ""; + this.badgeList = new ArrayList<>(); + } +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/ResiGroupController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/ResiGroupController.java index 984db9af9f..259b22cff0 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/ResiGroupController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/ResiGroupController.java @@ -1,8 +1,20 @@ package com.epmet.dataaggre.controller; +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.dataaggre.dto.resigroup.form.CandidateListFormDTO; +import com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO; +import com.epmet.dataaggre.service.resigroup.ResiGroupService; +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 java.util.List; + /** * @Author zxc * @DateTime 2020/12/25 上午9:45 @@ -10,4 +22,21 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("resigroup") public class ResiGroupController { + + @Autowired + private ResiGroupService resiGroupService; + + /** + * @Description 可胜任组长-组员列表(工作端通用) + * @Param formDTO + * @author zxc + * @date 2021/3/30 上午9:45 + */ + @PostMapping("candidatelist") + public Result> candidateList(@RequestBody CandidateListFormDTO formDTO, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(formDTO, CandidateListFormDTO.CandidateListForm.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(resiGroupService.candidateList(formDTO)); + } + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java index f7ced8b6f0..805657fc11 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetuser/UserBaseInfoDao.java @@ -18,8 +18,12 @@ package com.epmet.dataaggre.dao.epmetuser; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; import com.epmet.dataaggre.entity.epmetuser.UserBaseInfoEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 用户基础信息 @@ -29,5 +33,21 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface UserBaseInfoDao extends BaseDao { - + + /** + * @Description 根据UserIds查询 + * @Param userIds + * @author zxc + * @date 2021/3/30 上午11:07 + */ + List selectUserInfosByUserIds(@Param("userIds") List userIds); + + /** + * @Description 查询是党员/热心居民的userId + * @Param userIds + * @author zxc + * @date 2021/4/1 上午9:08 + */ + List selectUserIdByCustomerId(@Param("userIds") List userIds); + } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiGroupDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiGroupDao.java index 1658a05ad9..f297a4f82f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiGroupDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/resigroup/ResiGroupDao.java @@ -18,8 +18,12 @@ package com.epmet.dataaggre.dao.resigroup; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO; import com.epmet.dataaggre.entity.resigroup.ResiGroupEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 群组信息表 @@ -29,5 +33,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ResiGroupDao extends BaseDao { + + /** + * @Description 根据小组ID查询组员信息身份【不包括组长】 + * @Param groupId + * @author zxc + * @date 2021/3/30 上午10:13 + */ + List candidateList(@Param("groupId")String groupId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java index 5097beb4a9..d0a4570756 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/resigroup/ResiTopicCommentEntity.java @@ -20,13 +20,10 @@ package com.epmet.dataaggre.entity.resigroup; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 话题评论表 * @@ -51,7 +48,7 @@ public class ResiTopicCommentEntity extends BaseEpmetEntity { private String topicId; /** - * 评论状态 + * 评论状态:讨论中:discussing;已屏蔽 :hidden */ private String status; diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/redis/ResiGroupRedis.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/redis/ResiGroupRedis.java new file mode 100644 index 0000000000..3efbd220d4 --- /dev/null +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/redis/ResiGroupRedis.java @@ -0,0 +1,47 @@ +package com.epmet.dataaggre.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.dataaggre.constant.GroupConstant; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @Author zxc + * @DateTime 2021/3/30 下午1:39 + * @DESC + */ +@Component +@Slf4j +public class ResiGroupRedis { + + @Autowired + private RedisUtils redisUtils; + + /** + * @Description 获取用户徽章 + * @Param customerId + * @Param userId + * @author zxc + * @date 2021/3/30 下午3:33 + */ + public List getBadgeInfoByUserId(String customerId,String userId){ + String key = GroupConstant.BADGE_KEY+customerId+":"+userId; + List result = redisUtils.getListLrange(key); + if (!CollectionUtils.isEmpty(result)){ + List icons = new ArrayList<>(); + for (Object o : result) { + Map map = (Map) o; + icons.add(map.get(GroupConstant.BADGE_ICON)); + } + return icons; + } + return new ArrayList<>(); + } + +} diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java index fc3acacff7..d6e03f7f40 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/EpmetUserService.java @@ -1,8 +1,29 @@ package com.epmet.dataaggre.service.epmetuser; +import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; + +import java.util.List; + /** * @Author zxc * @DateTime 2020/12/25 上午9:20 */ public interface EpmetUserService { + + /** + * @Description 根据UserIds查询 + * @Param userIds + * @author zxc + * @date 2021/3/30 上午11:07 + */ + List selectUserInfosByUserIds(List userIds); + + /** + * @Description 查询是党员/热心居民的userId + * @Param userIds + * @author zxc + * @date 2021/4/1 上午9:08 + */ + List selectUserIdByCustomerId(List userIds); + } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index a992809a17..2dac9b0ccd 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -2,10 +2,15 @@ package com.epmet.dataaggre.service.epmetuser.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.epmetuser.UserBaseInfoDao; +import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * @Author zxc * @DateTime 2020/12/25 上午9:21 @@ -14,4 +19,29 @@ import org.springframework.stereotype.Service; @DataSource(DataSourceConstant.EPMET_USER) @Slf4j public class EpmetUserServiceImpl implements EpmetUserService { + + @Autowired + private UserBaseInfoDao userBaseInfoDao; + + /** + * @Description 根据UserIds查询 + * @Param userIds + * @author zxc + * @date 2021/3/30 上午11:07 + */ + @Override + public List selectUserInfosByUserIds(List userIds) { + return userBaseInfoDao.selectUserInfosByUserIds(userIds); + } + + /** + * @Description 查询是党员/热心居民的userId + * @Param userIds + * @author zxc + * @date 2021/4/1 上午9:08 + */ + @Override + public List selectUserIdByCustomerId(List userIds) { + return userBaseInfoDao.selectUserIdByCustomerId(userIds); + } } 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..5b163c4f5d 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,6 +1,8 @@ package com.epmet.dataaggre.service.resigroup; import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO; +import com.epmet.dataaggre.dto.resigroup.form.CandidateListFormDTO; +import com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -10,5 +12,12 @@ import java.util.List; * @DateTime 2020/12/25 上午9:21 */ public interface ResiGroupService { - List selectTopicInfoByIds(@Param("topicIds") List topicIds); + /** + * @Description 可胜任组长-组员列表(工作端通用) + * @Param formDTO + * @author zxc + * @date 2021/3/30 上午9:45 + */ + List candidateList(CandidateListFormDTO formDTO); + List selectTopicInfoByIds(List topicIds); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java index 931c13ffbb..5e5c727555 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/resigroup/impl/ResiGroupServiceImpl.java @@ -2,14 +2,25 @@ package com.epmet.dataaggre.service.resigroup.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.dataaggre.constant.DataSourceConstant; +import com.epmet.dataaggre.dao.resigroup.ResiGroupDao; import com.epmet.dataaggre.dao.resigroup.ResiTopicDao; +import com.epmet.dataaggre.dto.epmetuser.result.UserInfosResultDTO; import com.epmet.dataaggre.dto.resigroup.ResiTopicDTO; +import com.epmet.dataaggre.dto.resigroup.form.CandidateListFormDTO; +import com.epmet.dataaggre.dto.resigroup.result.CandidateListResultDTO; +import com.epmet.dataaggre.redis.ResiGroupRedis; +import com.epmet.dataaggre.service.epmetuser.EpmetUserService; import com.epmet.dataaggre.service.resigroup.ResiGroupService; +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; /** * @Author zxc @@ -21,9 +32,56 @@ import java.util.List; public class ResiGroupServiceImpl implements ResiGroupService { @Autowired private ResiTopicDao resiTopicDao; + @Autowired + private ResiGroupDao resiGroupDao; + @Autowired + private EpmetUserService epmetUserService; + @Autowired + private ResiGroupRedis resiGroupRedis; @Override public List selectTopicInfoByIds(List topicIds) { return resiTopicDao.selectTopicInfoByIds(topicIds); } + + /** + * @Description 可胜任组长-组员列表(工作端通用) + * @Param formDTO + * @author zxc + * @date 2021/3/30 上午9:45 + */ + @Override + public List candidateList(CandidateListFormDTO formDTO) { + // 根据小组ID查询组员信息身份【不包括组长自己】 + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> resiGroupDao.candidateList(formDTO.getGroupId())); + List result = pageInfo.getList(); + // 没有直接返回空集合 + if (CollectionUtils.isEmpty(result)){ + return new ArrayList<>(); + } + // 获取userIds + List userIds = result.stream().map(m -> m.getUserId()).collect(Collectors.toList()); + // 查询用户信息【名字 头像】 + List userInfos = epmetUserService.selectUserInfosByUserIds(userIds); + result.forEach(r -> { + if (!CollectionUtils.isEmpty(userInfos)){ + userInfos.forEach(u -> { + if (r.getUserId().equals(u.getUserId())){ + r.setHeadPhoto(u.getHeadPhoto()); + r.setUserShowName(u.getUserShowName()); + } + }); + } + // 徽章赋值 + List badgeInfo = resiGroupRedis.getBadgeInfoByUserId(formDTO.getCustomerId(), r.getUserId()); + r.setBadgeList(null==badgeInfo ? new ArrayList<>() : badgeInfo); + }); + List showUsers = epmetUserService.selectUserIdByCustomerId(userIds); + if (CollectionUtils.isEmpty(showUsers)){ + return new ArrayList<>(); + } + List disResult = new ArrayList<>(); + showUsers.forEach(u -> result.stream().filter(r -> u.equals(r.getUserId())).forEach(r -> disResult.add(r))); + return disResult; + } } 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/epmetuser/UserBaseInfoDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml index 72039e24cd..489908227d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/UserBaseInfoDao.xml @@ -3,4 +3,38 @@ + + + + + \ No newline at end of file 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-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiGroupDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiGroupDao.xml index d2c9e20e2d..8a350ceec9 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiGroupDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/resigroup/ResiGroupDao.xml @@ -3,4 +3,16 @@ + + \ No newline at end of file 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 index b9cd6657b6..0a015c6762 100644 --- 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 @@ -17,11 +17,10 @@ package com.epmet.dto; -import java.io.Serializable; -import java.util.Date; import lombok.Data; -import java.math.BigDecimal; +import java.io.Serializable; +import java.util.Date; /** * 项目(事件)分类按网格_按天统计 @@ -67,7 +66,7 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; + private String categoryCode; /** * 该分类下所有项目总数 @@ -75,39 +74,9 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable { private Integer projectTotal; /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 + * 分类等级1、2.... */ - private BigDecimal unResolvedRatio; + private Integer level; /** * 删除标识 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 index 1507a1f88a..95d65184a8 100644 --- 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 @@ -17,11 +17,10 @@ package com.epmet.dto; -import java.io.Serializable; -import java.util.Date; import lombok.Data; -import java.math.BigDecimal; +import java.io.Serializable; +import java.util.Date; /** * 项目(事件)分类按组织_按天统计 @@ -72,7 +71,7 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; + private String categoryCode; /** * 该分类下所有项目总数 @@ -80,39 +79,9 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable { private Integer projectTotal; /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 + * 分类等级1、2.... */ - private BigDecimal unResolvedRatio; + private Integer level; /** * 删除标识 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 index 69da09b886..aa4a89183e 100644 --- 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 @@ -2,6 +2,7 @@ package com.epmet.evaluationindex.screen.dto.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; /** @@ -13,9 +14,26 @@ import java.io.Serializable; 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/plugins/form/VoluntaryServiceTrendFormDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/plugins/form/VoluntaryServiceTrendFormDTO.java index 63fdbc4571..037c0d895a 100644 --- 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 @@ -18,7 +18,7 @@ public class VoluntaryServiceTrendFormDTO { @NotBlank(message = "agencyId不能为空") private String agencyId; - @NotBlank(message = "目前只有平阴在传,默认赋值:370124") + // @NotBlank(message = "目前只有平阴在传,默认赋值:370124") private String areaCode; @NotBlank(message = "customerId不能为空") 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 a4e5e0b9f4..7460a1a9ed 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 @@ -36,6 +36,6 @@ public class WorkRecordRankFormDTO implements Serializable { @NotBlank(message = "customerId不能为空") private String customerId; - @NotBlank(message = "areaCode不能为空,目前只有平阴在传,默认赋值:370124") + // @NotBlank(message = "areaCode不能为空,目前只有平阴在传,默认赋值:370124") private String areaCode; } 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 index eb5df34e99..6c0aec4959 100644 --- 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 @@ -50,7 +50,7 @@ public class WorkRecordTrendResultDTO implements Serializable { * 各项资源对应某一月份数据 */ @JsonIgnore - private Integer value; + private Integer value = 0; } } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/CustomerCategoryDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/CustomerCategoryDTO.java new file mode 100644 index 0000000000..d351ae7346 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/CustomerCategoryDTO.java @@ -0,0 +1,43 @@ +/** + * 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.project.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +@Data +public class CustomerCategoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 父id + * pid = 0 查询一级分类 + * pid != 0 查询二级分类 + */ + private String pid; + + /** + * 客户Id + */ + private String customerId; + +} diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryDictResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryDictResultDTO.java new file mode 100644 index 0000000000..ca534db2a9 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryDictResultDTO.java @@ -0,0 +1,41 @@ +package com.epmet.project.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Author zhangyong + * @Description 002、项目分类字典查询 + **/ +@Data +public class ProjectCategoryDictResultDTO implements Serializable { + + private static final long serialVersionUID = 8529179932504931368L; + + /** + * 一级分类编码 + */ + private String categoryCode; + + /** + * 一级分类名称 + */ + private String categoryName; + + /** + * 二级分类列表 + */ + private List children; + + /** + * 主键 + **/ + private String id; + + /** + * 上级分类ID 顶级此列存储0 + **/ + private String pid; +} diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index 8cb39e2c6b..4480ac88e7 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -94,6 +94,12 @@ 2.0.0 compile + + com.epmet + gov-issue-client + 2.0.0 + compile + 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 0e903b9120..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,5 +1,6 @@ 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; @@ -50,6 +51,12 @@ public class WorkRecordController { 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)); } 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..2f704b6b16 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,15 +5,12 @@ 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; @@ -131,41 +128,16 @@ public class ProjectController { } /** + * 002、项目分类字典查询 + * 查询当前客户的父客户下,项目分类字典 + * * @param customerId - * @param formDTO - * @description 【事件分析】数量统计查询 平阴大屏 + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 10:41 2021-03-22 **/ - @PostMapping("queryquantity") - public Result queryQuantity(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCommonFormDTO formDTO){ - formDTO.setCustomerId(customerId); - return new Result().ok(projectOrgDailyService.queryQuantity(formDTO)); + @PostMapping("categorydict") + public Result> categoryDict(@RequestHeader("CustomerId") String customerId) { + return new Result>().ok(projectService.getCategoryDict(customerId)); } - - /** - * @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/ScreenProjectController.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java index cc7a55528e..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 @@ -18,7 +18,6 @@ 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.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -62,37 +61,26 @@ public class ScreenProjectController { */ @PostMapping("projectdistribution") public Result projectDistribution(@RequestBody ScreenProjectDistributionFormDTO formDTO){ - if (StringUtils.isBlank(formDTO.getAreaCode()) && StringUtils.isBlank(formDTO.getAgencyId())){ - formDTO.setAreaCode("370124"); - } + ValidatorUtils.validateEntity(formDTO); return screenProjectService.projectDistribution(formDTO); } - @PostMapping("projectdetailv2") - public Result projectDetail(@RequestBody ScreenProjectDetailFormDTO formDTO){ - return screenProjectService.projectDistributionDetail(formDTO); - } /** - * 【事件分析】类型分析 - * @author zhaoqifeng - * @date 2021/2/23 15:37 - * @param customerId + * @Description 中央区事件分析-项目详情接口 * @param formDTO - * @return com.epmet.commons.tools.utils.Result> + * @return com.epmet.commons.tools.utils.Result + * @Author liushaowen + * @Date 2021/2/24 16:10 */ - @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)); + @PostMapping("projectdetailv2") + public Result projectDetail(@RequestBody ScreenProjectDetailFormDTO formDTO){ + return screenProjectService.projectDistributionDetail(formDTO); } - /** * @param customerId * @param formDTO - * @description 【事件分析】数量统计查询 平阴大屏 + * @description 1、【事件分析】数量统计查询 平阴大屏 **/ @PostMapping("queryquantity") public Result queryQuantity(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCommonFormDTO formDTO){ @@ -104,7 +92,7 @@ public class ScreenProjectController { * @param customerId * @param formDTO * @author yinzuomei - * @description 近12个月【事件分析】月度数量分析 平阴大屏 + * @description 2、近12个月【事件分析】月度数量分析 平阴大屏 **/ @PostMapping("queryquantity-monthly") public Result queryQuantityMonthly(@RequestHeader("CustomerId") String customerId, @RequestBody QueryQuantityMonthlyFormDTO formDTO) { @@ -117,7 +105,7 @@ public class ScreenProjectController { * @param customerId * @param formDTO * @author yinzuomei - * @description 【事件分析】效率分析 平阴大屏 + * @description 3、【事件分析】效率分析 平阴大屏 **/ @PostMapping("efficiency-analysis") public Result> efficiencyAnalysis(@RequestHeader("CustomerId") String customerId, @RequestBody EfficiencyAnalysisFormDTO formDTO){ @@ -126,4 +114,19 @@ public class ScreenProjectController { 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/ScreenProjectDataDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java index 6ac5ef48ea..eeb9831e21 100644 --- 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 @@ -10,7 +10,10 @@ import java.util.List; @Mapper public interface ScreenProjectDataDao { - List projectDistribution(@Param("agencyId") String agencyId, @Param("ids") List ids, @Param("level") String level); + List projectDistribution(@Param("agencyId") String agencyId, + @Param("ids") List ids, + @Param("level") String level, + @Param("status")String status); List selectIdsByAreaCode(@Param("areaCode") String areaCode); 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/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/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index f8832532b1..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 @@ -70,11 +70,14 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { @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()); + List resultDTOS = screenProjectDataDao.projectDistribution(formDTO.getAgencyId(),areaIds,formDTO.getLevel(),formDTO.getStatus()); return new Result().ok(resultDTOS); } 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 0474d32f2e..09336cf37f 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 @@ -134,14 +134,15 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl customerIds=new ArrayList<>(); Result> result=operCrmOpenFeignClient.getAllSubCustomerIds(formDTO.getCustomerId()); - // log.info("result: "+JSON.toJSONString(result)); + // 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)){ - log.warn("selectLatestDateId dateId is null customerIds" + JSON.toJSONString(customerIds)); + dateId= com.epmet.commons.tools.utils.DateUtils.getBeforeNDay(NumConstant.ONE); + log.warn("dateId 赋值为"+dateId+" ; selectLatestDateId dateId is null customerIds" + JSON.toJSONString(customerIds)); } WorkRecordRankResultDTO returnDto = new WorkRecordRankResultDTO(); AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId()); @@ -166,6 +167,7 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl list = screenWorkRecordOrgMonthlyDao.selectMonthList(formDTO); + /*log.info("legendList:"+ JSON.toJSONString(legendList,true)); + log.info("xAxis:"+JSON.toJSONString(resultDTO.getXAxis(),true)); + log.info("monthIdList:"+JSON.toJSONString(monthIdList,true)); + log.info("startMonth:"+formDTO.getStartMonth()+";endMonth="+formDTO.getEndMonth());*/ + //3-2.遍历封装数据并返回 LinkedList seriesList = new LinkedList<>(); //按资源类型封装每一个资源类型对应的过去12个月的汇总数据,某个月份没有数据的补0 @@ -251,8 +256,9 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl monthIdList = com.epmet.commons.tools.utils.DateUtils.getMonthIdList(formDTO.getEndMonthId(), NumConstant.ELEVEN); - // log.info(JSON.toJSONString(monthIdList)); + log.info(JSON.toJSONString(monthIdList)); AgencyInfoDTO agencyInfoDTO = agencyService.getAgencyInfoDTO(formDTO.getAreaCode(), formDTO.getAgencyId()); List orgIds = new ArrayList<>(); @@ -299,4 +305,10 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl getMyNextAgency(TokenDto tokenDto); + + /** + * 002、项目分类字典查询 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 14:26 2021-03-22 + **/ + List getCategoryDict(String customerId); } 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 f095fb0666..4d2df70470 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 @@ -3,6 +3,7 @@ package com.epmet.datareport.service.project.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.constant.ServiceConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; @@ -18,20 +19,21 @@ import com.epmet.dto.form.ProcessListFormDTO; import com.epmet.dto.form.SubAgencyFormDTO; import com.epmet.dto.result.*; import com.epmet.evaluationindex.screen.dto.result.DepartmentNameListResultDTO; -import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.feign.GovProjectOpenFeignClient; +import com.epmet.feign.*; import com.epmet.project.constant.ProjectConstant; +import com.epmet.project.dto.CustomerCategoryDTO; import com.epmet.project.dto.FactAgencyProjectDailyDTO; import com.epmet.project.dto.form.DifficultyRankFormDTO; import com.epmet.project.dto.form.ProjectIncrTrendFormDTO; -import com.epmet.project.dto.result.ProjectDetailResultDTO; import com.epmet.project.dto.result.*; +import com.epmet.project.dto.result.ProjectDetailResultDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.github.pagehelper.PageHelper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -50,7 +52,7 @@ import java.util.List; @Slf4j @Service public class ProjectServiceImpl implements ProjectService { - + private Logger logger = LogManager.getLogger(getClass()); @Autowired private ProjectDao projectDao; @Autowired @@ -64,6 +66,11 @@ public class ProjectServiceImpl implements ProjectService { private GovOrgOpenFeignClient govOrgOpenFeignClient; @Autowired private ResiGroupOpenFeignClient resiGroupOpenFeignClient; + @Autowired + private GovIssueOpenFeignClient govIssueOpenFeignClient; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + /** * @Author sun * @Description 数据-项目-获取汇总数据 @@ -350,4 +357,41 @@ public class ProjectServiceImpl implements ProjectService { return result; } + @Override + public List getCategoryDict(String customerId) { + List result = new ArrayList<>(); + Result parentCustomerId = operCrmOpenFeignClient.getExternalAndParentCustomerId(customerId); + if (!parentCustomerId.success() && null == parentCustomerId.getData()) { + logger.warn(String.format("调用%s服务查询外部客户的 父级客户ID 失败,入参%s", ServiceConstant.OPER_CRM_SERVER, + JSON.toJSONString(customerId))); + return result; + } + CustomerCategoryDTO argDto = new CustomerCategoryDTO(); + argDto.setCustomerId(parentCustomerId.getData()); + argDto.setPid(NumConstant.ZERO_STR); + // 获取客户一级分类 + Result> parentCategoryDict = govIssueOpenFeignClient.getCustomerCategoryDict(argDto); + if (!parentCategoryDict.success()) { + logger.warn(String.format("调用%s服务查询当前客户的父客户下,项目分类字典失败,入参%s", ServiceConstant.GOV_ISSUE_SERVER, + JSON.toJSONString(customerId))); + } else { + result = parentCategoryDict.getData(); + // 获取客户二级分类 + argDto.setPid(NumConstant.TWO_STR); + Result> childrenCategoryDict = govIssueOpenFeignClient.getCustomerCategoryDict(argDto); + for (ProjectCategoryDictResultDTO p : result) { + List children = new ArrayList<>(); + for (ProjectCategoryDictResultDTO c : childrenCategoryDict.getData()) { + if (p.getId().equals(c.getPid())) { + ProjectCategoryDictResultDTO dto = new ProjectCategoryDictResultDTO(); + dto.setCategoryCode(c.getCategoryCode()); + dto.setCategoryName(c.getCategoryName()); + children.add(dto); + } + } + p.setChildren(children); + } + } + return result; + } } 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/java/com/epmet/datareport/utils/DateUtils.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java index 62356ad9f5..bfc46d03bd 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java @@ -75,6 +75,21 @@ public class DateUtils { return result; } + public Map getXproSub(){ + Map xAxis = new HashMap<>(); + LocalDate today = LocalDate.now(); + + for(int i = NumConstant.TWELVE;i > NumConstant.ZERO; i--){ + LocalDate localDate = today.minusMonths(i); + String s = localDate.getMonth().getValue() + "月"; + xAxis.put(localDate.format(fmt),s); + } + Map result = Maps.newLinkedHashMap(); + xAxis.entrySet().stream().sorted(Map.Entry.comparingByKey()) + .forEachOrdered((e -> result.put(e.getKey(),e.getValue()))); + return result; + } + public Map getXproEndMonth(String monthId){ Map xAxis = new HashMap<>(); for(int i=NumConstant.ZERO;i <= NumConstant.ELEVEN; i++){ 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/ScreenWorkRecordOrgMonthlyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/plugins/ScreenWorkRecordOrgMonthlyDao.xml index f50a6b3e06..6a87be93da 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 @@ -6,7 +6,7 @@ @@ -44,6 +44,7 @@ FROM screen_work_record_org_monthly m WHERE m.DEL_FLAG = '0' + and m.CUSTOMER_ID=#{customerId} AND m.TYPE_CODE =( SELECT dict.RESOURCE_CODE 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 index 5816def044..d2ac38a7f7 100644 --- 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 @@ -5,24 +5,26 @@ \ 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 index b59665f53e..08e88bbeae 100644 --- 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 @@ -27,6 +27,13 @@ and org_id = #{agencyId} + + + + + and PROJECT_STATUS_CODE=#{status} + + - + \ 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 27d91a7f2a..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 @@ -50,6 +50,6 @@ 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-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CalculateCommonFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CalculateCommonFormDTO.java index 03c5ae0ddb..9e019b6d24 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CalculateCommonFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CalculateCommonFormDTO.java @@ -23,6 +23,7 @@ public class CalculateCommonFormDTO implements Serializable { /** * 月份id: yyyyMM */ + @NotBlank(message = "monthId不能为空", groups = { CancelCalculateGroup.class }) private String monthId; /** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubCommunityAvgResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubCommunityAvgResultDTO.java index 06b06109f1..a2c167eaeb 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubCommunityAvgResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubCommunityAvgResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.dto.indexcal; +import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import java.io.Serializable; @@ -47,5 +48,10 @@ public class SubCommunityAvgResultDTO implements Serializable { /** * 分数 */ - private BigDecimal score; + private BigDecimal score = NumConstant.ZERO_DECIMAL; + + /** + * 赋值状态 + */ + private Boolean scoreStatus = false; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java new file mode 100644 index 0000000000..c07037ee92 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java @@ -0,0 +1,116 @@ +/** + * 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.issue; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +public class IssueProjectCategoryDictDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id, 产品默认default + */ + private String customerId; + + /** + * 上级分类ID 顶级此列存储0 + */ + private String pid; + + /** + * 所有上级分类ID,用逗号分开 + */ + private String pids; + + /** + * 上级分类编码 + */ + private String parentCategoryCode; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 分类类别1,2,3,4.... + */ + private String categoryType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 删除标识 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/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectCategoryDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectCategoryDTO.java new file mode 100644 index 0000000000..8977da4ee3 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectCategoryDTO.java @@ -0,0 +1,102 @@ +/** + * 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.project; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-25 + */ +@Data +public class ProjectCategoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 来源网格id + */ + private String gridId; + + /** + * 项目id + */ + private String projectId; + + /** + * 分类id + */ + private String categoryId; + + /** + * 分类对应的所有上级,英文逗号隔开 + */ + private String categoryPids; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 删除标识 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/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectStaffDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectStaffDTO.java new file mode 100644 index 0000000000..6de5285b6b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/ProjectStaffDTO.java @@ -0,0 +1,122 @@ +/** + * 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.project; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 项目人员关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-05-11 + */ +@Data +public class ProjectStaffDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 项目ID + */ + private String projectId; + + /** + * 项目处理进展ID + */ + private String processId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 机关ID + */ + private String orgId; + + /** + * 部门ID + */ + private String departmentId; + + /** + * 网格ID + */ + private String gridId; + + /** + * 所属机关(11:22:33) + */ + private String orgIdPath; + + /** + * 人员ID + */ + private String staffId; + + /** + * 部门名 + */ + private String departmentName; + + /** + * 是否处理:未处理unhandled,已处理handle + */ + private String isHandle; + + /** + * 删除标识: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/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/ProjectExceedParamsResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/ProjectExceedParamsResultDTO.java new file mode 100644 index 0000000000..a8b2b0f0e5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/ProjectExceedParamsResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.project.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 客户项目超期相关参数 + * @ClassName ProjectExceedParamsResultDTO + * @Auth wangc + * @Date 2021-03-05 17:02 + */ +@Data +public class ProjectExceedParamsResultDTO implements Serializable { + private static final long serialVersionUID = 7621539816482416776L; + + private Integer defaultExceedLimit; + + private Integer defaultAbout2ExceedLimit; + + private Integer exceedLimit; + + private Integer about2ExceedLimit; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/CategoryDictDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/CategoryDictDataFormDTO.java new file mode 100644 index 0000000000..bd88161f54 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/CategoryDictDataFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.screen; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import com.epmet.dto.screen.form.CategoryDictFormDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 项目分类字典上报 + * @Auther: zhangyong + * @Date: 2021-03-22 + */ +@Data +public class CategoryDictDataFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 当isFirst=true时,直接根据 customerId 删除原有数据,再批量insert。 + */ + private Boolean isFirst; + + private List dataList; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java index ee7863d40b..65e98b940b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenCustomerGridDTO.java @@ -112,5 +112,7 @@ public class ScreenCustomerGridDTO implements Serializable { * 所有上级ID,用英文逗号分开 */ private String allParentIds; + private String pid; + private String pids; } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java index 50afc350ef..0406fb26f2 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java @@ -17,11 +17,10 @@ package com.epmet.dto.screen; -import java.io.Serializable; -import java.util.Date; import lombok.Data; -import java.math.BigDecimal; +import java.io.Serializable; +import java.util.Date; /** * 项目(事件)分类按网格_按天统计 @@ -67,9 +66,7 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; - - private String epmetCategoryName; + private String categoryCode; /** * 该分类下所有项目总数 @@ -77,39 +74,9 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable { private Integer projectTotal; /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 + * 分类等级1、2.... */ - private BigDecimal unResolvedRatio; + private Integer level; /** * 删除标识 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java index 49c85be67e..117db2716c 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryOrgDailyDTO.java @@ -17,11 +17,10 @@ package com.epmet.dto.screen; -import java.io.Serializable; -import java.util.Date; import lombok.Data; -import java.math.BigDecimal; +import java.io.Serializable; +import java.util.Date; /** * 项目(事件)分类按组织_按天统计 @@ -72,9 +71,7 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; - - private String epmetCategoryName; + private String categoryCode; /** * 该分类下所有项目总数 @@ -82,39 +79,9 @@ public class ScreenProjectCategoryOrgDailyDTO implements Serializable { private Integer projectTotal; /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 + * 分类等级1、2.... */ - private BigDecimal unResolvedRatio; + private Integer level; /** * 删除标识 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java index b638f53197..423a94ebce 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectDataDTO.java @@ -169,4 +169,6 @@ public class ScreenProjectDataDTO implements Serializable { */ private String allParentIds; + private String topicId; + } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectImgDataDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectImgDataDTO.java index b175d7a41d..42824beb62 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectImgDataDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectImgDataDTO.java @@ -88,4 +88,6 @@ public class ScreenProjectImgDataDTO implements Serializable { */ private Date updatedTime; + private String topicId; + } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectProcessDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectProcessDTO.java index efb46d4387..e2479d607a 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectProcessDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectProcessDTO.java @@ -19,7 +19,9 @@ package com.epmet.dto.screen; import java.io.Serializable; import java.util.Date; +import java.util.List; +import com.epmet.dto.project.ProjectStaffDTO; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @@ -141,6 +143,8 @@ public class ScreenProjectProcessDTO implements Serializable { /** * 数据截止日期 */ - private String DataEndTime; + private String dataEndTime; + + private List points; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java new file mode 100644 index 0000000000..364c497eb1 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/form/CategoryDictFormDTO.java @@ -0,0 +1,61 @@ +package com.epmet.dto.screen.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 项目分类字典上报 + * @Auther: zhangyong + * @Date: 2021-03-22 + */ +@Data +public class CategoryDictFormDTO implements Serializable { + + + private static final long serialVersionUID = 1245827825857891963L; + /** + * 客户内自己的分类编码 + */ + private String categoryCode; + + /** + * 客户内自己的分类名称 + */ + private String categoryName; + + /** + * 父类分类编码,如果是一级分类,此列赋值为0 + */ + private String parentCategoryCode; + + /** + * 分类等级:1、2....; + */ + private Integer level; + + /** + * 排序 + */ + private Integer sort; + + /** + * 当前分类对应产品内的分类编码,如果对应不上,此列传空 + */ + private String epmetCategoryCode; + + /** + * 原始创建时间yyyy-MM-dd HH:mm:ss + */ + private String originCreatedTime; + + /** + * 原始更新时间yyyy-MM-dd HH:mm:ss + */ + private String orginUpdatedTime; + + /** + * 分类字典表主键 + */ + private String categoryId; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java new file mode 100644 index 0000000000..2ed95c1a35 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.screen.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2021/3/23 下午2:38 + * @DESC + */ +@Data +public class CategoryProjectResultDTO implements Serializable { + + private static final long serialVersionUID = -5774330825880917524L; + + private String pid; + private String pids; + + /** + * 组织ID + */ + private String orgId; + + /** + * 客户ID + */ + private String customerId; + + /** + * 分类码 + */ + private String categoryCode; + + /** + * 项目总数 + */ + private Integer projectTotal; + + /** + * 分类级别 + */ + private Integer level; + + /** + * 日期ID + */ + private String dateId; + + /** + * 组织级别 + */ + private String orgType; + + private Boolean status = false; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/ScreenCollFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/ScreenCollFormDTO.java index fa3e97d11d..16ab5fee7d 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/ScreenCollFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/ScreenCollFormDTO.java @@ -1,8 +1,12 @@ package com.epmet.dto.screencoll; import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import org.hibernate.validator.constraints.Length; +import javax.validation.Valid; +import javax.validation.constraints.*; import java.io.Serializable; import java.util.List; @@ -14,21 +18,47 @@ import java.util.List; */ @Data public class ScreenCollFormDTO implements Serializable { - private static final long serialVersionUID = 4605543711669000348L; + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface IsFirstShowGroup extends CustomerClientShowGroup { + } + + public interface DateIdShowGroup extends CustomerClientShowGroup { + } + + public interface MonthIdShowGroup extends CustomerClientShowGroup { + } + + public interface CustomerIdShowGroup extends CustomerClientShowGroup { + } + + public interface DataListShowGroup extends CustomerClientShowGroup { + + } + /** * 当为true时后台将先删除当前维度的数据,后新增 */ + @NotNull(message = "isFirst不能为空", groups = IsFirstShowGroup.class) private Boolean isFirst; /** * 日期Id, 数据更新至:yyyyMMdd */ + @NotBlank(message = "dateId不能为空;", groups = DateIdShowGroup.class) + @Length(min = 8, max = 8, message = "dateId不能为空,格式应为yyyyMMdd;", groups = {DateIdShowGroup.class}) private String dateId; /** * yyyyMM */ + @NotBlank(message = "monthId不能为空,格式yyyyMM;", groups = MonthIdShowGroup.class) + @Length(min = 6, max = 6, message = "monthId不能为空,格式应为yyyyMM;", groups = {MonthIdShowGroup.class}) private String monthId; /** @@ -39,6 +69,8 @@ public class ScreenCollFormDTO implements Serializable { /** * 数据集合 */ + @Valid + @NotEmpty(message = "dataList不能为空", groups = DataListShowGroup.class) private List dataList; @Override @@ -49,5 +81,6 @@ public class ScreenCollFormDTO implements Serializable { /** * 当前客户id */ + @NotBlank(message = "customerId不能为空;", groups = CustomerIdShowGroup.class) private String customerId; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnCommunityProjectProfileFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnCommunityProjectProfileFormDTO.java index d81ae5cf9e..0d52614cfd 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnCommunityProjectProfileFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnCommunityProjectProfileFormDTO.java @@ -1,7 +1,10 @@ package com.epmet.dto.screencoll.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -14,23 +17,30 @@ import java.io.Serializable; public class AnCommunityProjectProfileFormDTO implements Serializable { private static final long serialVersionUID = 1466172677051250092L; + public interface DefaultShowGroup extends CustomerClientShowGroup { + } + /** * 数据更新至: yyyy|yyyyMM|yyyyMMdd,项目根据实际情况赋值 */ + @NotBlank(message = "dataEndTime不能为空;", groups = DefaultShowGroup.class) private String dataEndTime; /** * 社区id */ + @NotBlank(message = "orgId不能为空;", groups = DefaultShowGroup.class) private String orgId; /** * 项目数 */ + @NotNull(message = "projectTotal不能为空;", groups = DefaultShowGroup.class) private Integer projectTotal; /** * 等级 */ + @NotBlank(message = "level不能为空;", groups = DefaultShowGroup.class) private String level; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsGovernMonthlyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsGovernMonthlyFormDTO.java index adcb9f63b2..ff3727625b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsGovernMonthlyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsGovernMonthlyFormDTO.java @@ -1,7 +1,10 @@ package com.epmet.dto.screencoll.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; import java.math.BigDecimal; @@ -12,51 +15,63 @@ import java.math.BigDecimal; * @since v1.0.0 2020-10-09 */ @Data -public class AnGrassRootsGovernMonthlyFormDTO implements Serializable { +public class AnGrassRootsGovernMonthlyFormDTO implements Serializable { private static final long serialVersionUID = -6947401956711903753L; + public interface DefaultShowGroup extends CustomerClientShowGroup { + } + /** * 网格,街道或社区id */ + @NotBlank(message = "orgId不能为空;", groups = DefaultShowGroup.class) private String orgId; /** * 网格,街道名称或者社区名称 */ + @NotBlank(message = "orgName不能为空;", groups = DefaultShowGroup.class) private String orgName; /** * 网格:grid;组织:agency */ + @NotBlank(message = "orgType不能为空,网格:grid;组织:agency;", groups = DefaultShowGroup.class) private String orgType; /** * org_id的上一级id */ + @NotBlank(message = "pid不能为空;", groups = DefaultShowGroup.class) private String pid; /** * 参与项目数 */ + @NotNull(message = "partiProjectTotal不能为空;", groups = DefaultShowGroup.class) private Integer partiProjectTotal; /** * 办结项目数 */ + @NotNull(message = "closedProjectTotal不能为空;", groups = DefaultShowGroup.class) private Integer closedProjectTotal; /** * 项目响应度 存储的是%前面的数 */ + @NotNull(message = "projectResponseRatio不能为空;", groups = DefaultShowGroup.class) private BigDecimal projectResponseRatio; /** * 项目满意率,存储的是%前面的数 */ + @NotNull(message = "projectSatisRatio不能为空;", groups = DefaultShowGroup.class) private BigDecimal projectSatisRatio; /** * 办结率 for 社区 */ + @NotNull(message = "closedProjectRatio不能为空;", groups = DefaultShowGroup.class) private BigDecimal closedProjectRatio; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsOrgMonthlyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsOrgMonthlyFormDTO.java index 70242f1ad3..5ca82e599e 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsOrgMonthlyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsOrgMonthlyFormDTO.java @@ -1,7 +1,10 @@ package com.epmet.dto.screencoll.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -13,39 +16,49 @@ import java.io.Serializable; @Data public class AnGrassRootsOrgMonthlyFormDTO implements Serializable { private static final long serialVersionUID = -7389300512268641307L; + + public interface DefaultShowGroup extends CustomerClientShowGroup {} + /** * 网格id或者组织(街道或社区)id */ + @NotBlank(message = "orgId不能为空;", groups = DefaultShowGroup.class) private String orgId; /** * 组织名称OR网格名称 */ + @NotBlank(message = "orgName不能为空;", groups = DefaultShowGroup.class) private String orgName; /** * 网格:grid; 组织:agency */ + @NotBlank(message = "orgType不能为空;", groups = DefaultShowGroup.class) private String orgType; /** * org_id的上一级id */ + @NotBlank(message = "pid不能为空;", groups = DefaultShowGroup.class) private String pid; /** * 党群数 */ + @NotNull(message = "groupTotal不能为空;", groups = DefaultShowGroup.class) private Integer groupTotal; /** * 议题数 */ + @NotNull(message = "issueTotal不能为空;", groups = DefaultShowGroup.class) private Integer issueTotal; /** * 项目数 */ + @NotNull(message = "projectTotal不能为空;", groups = DefaultShowGroup.class) private Integer projectTotal; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmRankFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmRankFormDTO.java index b889e54661..c558760bf4 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmRankFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmRankFormDTO.java @@ -1,7 +1,11 @@ package com.epmet.dto.screencoll.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import org.hibernate.validator.constraints.Length; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -13,60 +17,73 @@ import java.io.Serializable; @Data public class AnGrassRootsPmRankFormDTO implements Serializable { private static final long serialVersionUID = 3642729389245262928L; + public interface DefaultShowGroup extends CustomerClientShowGroup {} /** - * 月份Id + * 月份Id */ + @NotBlank(message = "monthId不能为空;", groups = DefaultShowGroup.class) + @Length(min = 6, max = 6, message = "monthId不能为空,格式应为yyyyMM;", groups = {DefaultShowGroup.class}) private String monthId; /** * 用户id */ + @NotBlank(message = "userId不能为空;", groups = DefaultShowGroup.class) private String userId; /** * 姓名 */ + @NotBlank(message = "userName不能为空;", groups = DefaultShowGroup.class) private String userName; /** * 所属支部id */ + @NotBlank(message = "branchId不能为空;", groups = DefaultShowGroup.class) private String branchId; /** * 所属支部名称 */ + @NotBlank(message = "branchName不能为空;", groups = DefaultShowGroup.class) private String branchName; /** * 所属社区id */ + @NotBlank(message = "communityId不能为空;", groups = DefaultShowGroup.class) private String communityId; /** * 所属社区名称 */ + @NotBlank(message = "communityName不能为空;", groups = DefaultShowGroup.class) private String communityName; /** * 群成员数 */ + @NotNull(message = "groupMemberTotal不能为空;",groups =DefaultShowGroup.class ) private Integer groupMemberTotal; /** * 话题数 */ + @NotNull(message = "topicTotal不能为空;",groups =DefaultShowGroup.class ) private Integer topicTotal; /** * 参与人次 */ + @NotNull(message = "partiUserTotal不能为空;",groups =DefaultShowGroup.class ) private Integer partiUserTotal; /** * 议题数 */ + @NotNull(message = "issueTotal不能为空;",groups =DefaultShowGroup.class ) private Integer issueTotal; /** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmTotalMonthlyFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmTotalMonthlyFormDTO.java index 4adb2ee168..1f1bcb4315 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmTotalMonthlyFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/AnGrassRootsPmTotalMonthlyFormDTO.java @@ -1,7 +1,10 @@ package com.epmet.dto.screencoll.form; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -14,44 +17,54 @@ import java.io.Serializable; public class AnGrassRootsPmTotalMonthlyFormDTO implements Serializable { private static final long serialVersionUID = 8675347783888892404L; + public interface DefaultShowGroup extends CustomerClientShowGroup {} + /** * 网格id或者组织(街道或社区)id */ + @NotBlank(message = "orgId不能为空;", groups = DefaultShowGroup.class) private String orgId; /** * 组织名称OR网格名称 */ + @NotBlank(message = "orgName不能为空;", groups = DefaultShowGroup.class) private String orgName; /** * 网格:grid;组织:agency */ + @NotBlank(message = "orgType不能为空;", groups = DefaultShowGroup.class) private String orgType; /** * org_id的上一级id */ + @NotBlank(message = "pid不能为空;", groups = DefaultShowGroup.class) private String pid; /** * 群成员数 */ + @NotNull(message = "groupMemberTotal不能为空;", groups = DefaultShowGroup.class) private Integer groupMemberTotal; /** * 话题数 */ + @NotNull(message = "topicTotal不能为空;", groups = DefaultShowGroup.class) private Integer topicTotal; /** * 话题参与人次 */ + @NotNull(message = "topicPartiUserTotal不能为空;", groups = DefaultShowGroup.class) private Integer topicPartiUserTotal; /** * 议题数 */ + @NotNull(message = "issueTotal不能为空;", groups = DefaultShowGroup.class) private Integer issueTotal; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java index e50824d0cb..40315afc0c 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/stats/user/result/UserStatisticalData.java @@ -17,25 +17,58 @@ import java.util.List; public class UserStatisticalData implements Serializable { private static final long serialVersionUID = 7423427555123585566L; + /** + * 机关下(按日)参与用户数分析 + */ private List partiAgencyDailyList; + /** + * 网格下(按日)参与用户数分析 + */ private List partiGridDailyList; + /** + * 机关下(按月)参与用户数分析 + */ private List partiAgencyMonthlyList; + /** + * 网格下(月)参与用户数分析 + */ private List partiGridMonthlyList; + /** + * 机关(按日)注册用户数分析 + */ private List regAgencyDailyList; + /** + * 网格(按日)注册用户数分析 + */ private List regGridDailyList; + /** + * 机关(按月)注册用户数分析 + */ private List regAgencyMonthlyList; + /** + * 网格(月)注册用户数分析 + */ private List regGridMonthlyList; + /** + * 当前正在计算的客户id + */ private String customerId; + /** + * yyyyMMdd + */ private String dateId; + /** + * yyyyMM + */ private String monthId; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java index 0766df597b..5b862b66ec 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java @@ -1,11 +1,10 @@ package com.epmet.controller; -import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.dto.screencoll.form.*; import com.epmet.service.evaluationindex.screen.AnScreenCollService; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -23,79 +22,116 @@ public class AnScreenCollController { private AnScreenCollService screenCollService; /** - * @Description 安宁大屏数据采集 - 基层党员-各类总数 - * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329494 * @param formDTO * @return void + * @Description 安宁大屏数据采集 - 基层党员-各类总数 + * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329494 * @author wangc * @date 2020.10.09 17:20 */ @PostMapping("pmtotal") - public Result pmTotal(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ - if(StringUtils.isBlank(customerId)) throw new ValidateException("客户Id不能为空"); - screenCollService.pmTotal(formDTO,customerId); + public Result pmTotal(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, + ScreenCollFormDTO.IsFirstShowGroup.class, + ScreenCollFormDTO.MonthIdShowGroup.class, + ScreenCollFormDTO.CustomerIdShowGroup.class, + ScreenCollFormDTO.DataListShowGroup.class); + formDTO.getDataList().forEach(data -> { + ValidatorUtils.validateEntity(data, AnGrassRootsPmTotalMonthlyFormDTO.DefaultShowGroup.class); + }); + screenCollService.pmTotal(formDTO); return new Result(); } /** - * @Description 安宁大屏数据采集 - 基层党员-党员排行榜单 - * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329483 * @param formDTO * @return void + * @Description 安宁大屏数据采集 - 基层党员-党员排行榜单 按月 + * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329483 * @author wangc * @date 2020.10.09 17:19 */ @PostMapping("pmrank") - public Result pmRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ - if (StringUtils.isBlank(formDTO.getMonthId())){ - throw new ValidateException("月份Id不能为空"); - } - screenCollService.pmRank(formDTO,customerId); + public Result pmRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, + ScreenCollFormDTO.IsFirstShowGroup.class, + ScreenCollFormDTO.MonthIdShowGroup.class, + ScreenCollFormDTO.CustomerIdShowGroup.class, + ScreenCollFormDTO.DataListShowGroup.class); + formDTO.getDataList().forEach(data -> { + ValidatorUtils.validateEntity(data, AnGrassRootsPmRankFormDTO.DefaultShowGroup.class); + }); + screenCollService.pmRank(formDTO); return new Result(); } /** - * @Description 安宁大屏数据采集 - 基层组织(党群数|议题数|项目数)-按月 - * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329498 * @param formDTO * @return void + * @Description 安宁大屏数据采集 - 基层组织(党群数|议题数|项目数)-按月 + * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329498 * @author wangc * @date 2020.10.09 17:22 */ @PostMapping("grassrootsorg") - public Result grassrootsOrg(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ - if(StringUtils.isBlank(customerId)) throw new ValidateException("客户Id不能为空"); - screenCollService.grassrootsOrg(formDTO,customerId); + public Result grassrootsOrg(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, + ScreenCollFormDTO.IsFirstShowGroup.class, + ScreenCollFormDTO.MonthIdShowGroup.class, + ScreenCollFormDTO.CustomerIdShowGroup.class, + ScreenCollFormDTO.DataListShowGroup.class); + formDTO.getDataList().forEach(data -> { + ValidatorUtils.validateEntity(data, AnGrassRootsOrgMonthlyFormDTO.DefaultShowGroup.class); + }); + screenCollService.grassrootsOrg(formDTO); return new Result(); } /** - * @Description 安宁大屏数据采集 - 基层治理-各类数 - * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329499 * @param formDTO * @return void + * @Description 安宁大屏数据采集 - 基层治理-各类数 按月 + * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329499 * @author wangc * @date 2020.10.09 17:23 */ @PostMapping("grassrootsgovern") - public Result grassrootsGovern(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ - if(StringUtils.isBlank(customerId)) throw new ValidateException("客户Id不能为空"); - screenCollService.grassrootsGovern(formDTO,customerId); + public Result grassrootsGovern(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, + ScreenCollFormDTO.IsFirstShowGroup.class, + ScreenCollFormDTO.MonthIdShowGroup.class, + ScreenCollFormDTO.CustomerIdShowGroup.class, + ScreenCollFormDTO.DataListShowGroup.class); + formDTO.getDataList().forEach(data -> { + ValidatorUtils.validateEntity(data, AnGrassRootsGovernMonthlyFormDTO.DefaultShowGroup.class); + }); + screenCollService.grassrootsGovern(formDTO); return new Result(); } /** - * @Description 安宁大屏数据采集 - 中央区-项目概要 - * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329502 * @param formDTO * @return void + * @Description 安宁大屏数据采集 - 中央区-项目概要 + * @NEI https://nei.netease.com/interface/detail/?pid=57069&id=329502 * @author wangc * @date 2020.10.09 16:41 */ @PostMapping("projectfile") - public Result projectFile(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ - if(StringUtils.isBlank(customerId)) throw new ValidateException("客户Id不能为空"); - screenCollService.communityProjectProfile(formDTO,customerId); + public Result projectFile(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, + ScreenCollFormDTO.IsFirstShowGroup.class, + ScreenCollFormDTO.CustomerIdShowGroup.class, + ScreenCollFormDTO.DataListShowGroup.class); + formDTO.getDataList().forEach(data -> { + ValidatorUtils.validateEntity(data, AnCommunityProjectProfileFormDTO.DefaultShowGroup.class); + }); + screenCollService.communityProjectProfile(formDTO); return new Result(); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 829a345264..9259e12463 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -2,6 +2,7 @@ package com.epmet.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; 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.DateUtils; import com.epmet.commons.tools.utils.Result; @@ -34,13 +35,11 @@ import com.epmet.entity.stats.DimDateEntity; import com.epmet.entity.stats.DimMonthEntity; import com.epmet.service.StatsDemoService; import com.epmet.service.evaluationindex.extract.dataToIndex.*; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.*; -import com.epmet.service.evaluationindex.screen.ScreenProjectGridDailyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectOrgDailyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityGridMonthlyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; +import com.epmet.service.evaluationindex.screen.*; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerPartymemberService; import lombok.extern.slf4j.Slf4j; @@ -49,6 +48,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; +import java.time.LocalDate; import java.time.LocalDateTime; import java.util.List; import java.util.concurrent.ExecutionException; @@ -103,6 +103,13 @@ public class DemoController { private GovernRankDataExtractService governRankDataExtractService; @Autowired private OrgRankExtractService orgRankExtractService; + @Autowired + private ScreenProjectSettleService screenProjectSettleService; + @Autowired + private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService; + @Autowired + private FactOriginProjectCategoryDailyService originProjectCategoryDailyService; + @GetMapping("testAlarm") public void testAlarm() { //for (int i = 0; i < 20; i++) { @@ -806,19 +813,60 @@ public class DemoController { return new Result(); } - @Autowired + /*@Autowired private ScreenGrassrootsGovernDataAbsorptionService ndddYhjfService; @PostMapping("diff") public Result diff(@RequestBody ScreenCentralZoneDataFormDTO param){ ndddYhjfService.difficultyDataHub(param); return new Result(); - } + }*/ + @PostMapping("project-test") + public Result project(@RequestBody ScreenCentralZoneDataFormDTO param){ + screenProjectSettleService.extractScreenData(param); + return new Result(); + } public static void main(String[] args) { List monthIds = DateUtils.getMonthBetween("202001","202012"); for(String monthId:monthIds){ System.out.println(monthId); } } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param customerId + * @author yinzuomei + * @description 产品内部计算:网格内按分类统计项目数量 + * @Date 2021/3/23 10:52 + **/ + @PostMapping("extractProjectCategoryData") + public Result extractProjectCategoryData(@RequestParam("customerId") String customerId){ + String dateId = LocalDate.now().minusDays(NumConstant.ONE).toString().replace("-", ""); + projectCategoryGridDailyService.extractProjectCategoryData(customerId,dateId); + return new Result(); + } + + /** + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 将epmet_gov_project库中的项目分类信息(project_category)同步到统计库epmet_data_statistical + * @Date 2021/3/23 10:52 + **/ + @PostMapping("extractProjectCategory") + public Result extractProjectCategory(@RequestBody ExtractOriginFormDTO formDTO){ + originProjectCategoryDailyService.extractProjectCategory(formDTO); + return new Result(); + } + + @Autowired + private ScreenProjectCategoryOrgDailyService screenProjectCategoryOrgDailyService; + + @PostMapping("orgdaily") + public Result orgDaily(@RequestParam("customerId")String customerId,@RequestParam("dateId")String dateId){ + screenProjectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId,dateId); + return new Result(); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java index 3e2a78b716..68dedbd4a0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DimController.java @@ -1,7 +1,6 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.AgencySubDeptTreeDto; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; @@ -105,6 +104,13 @@ public class DimController { } catch (Exception e) { logger.error("初始化按周维度失败:", e); } + //项目分类字典维度 初始化 每天晚上凌晨10分执行 + try { + statsDimService.customerInitProjectCategory(); + logger.info("初始化项目分类成功"); + } catch (Exception e) { + logger.error("初始化项目分类失败:", e); + } return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index 58bd3ab491..9f2a4b06cd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java @@ -10,6 +10,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.CalculateStatus; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.dto.indexcal.CustomerSubInfoDTO; import com.epmet.dto.indexcal.IndexStatisticsFormDTO; import com.epmet.model.CalculateFlagModel; import com.epmet.service.evaluationindex.indexcal.CpcIndexCalculateService; @@ -106,6 +107,7 @@ public class IndexCalculateController { @PostMapping("all") public Result indexCalculate(@RequestHeader("CustomerId") String customerId, @RequestBody CalculateCommonFormDTO formDTO) { formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO); indexCalculate(formDTO); return new Result().ok(true); } @@ -342,4 +344,23 @@ public class IndexCalculateController { indexCalculateService.indexStatistics(formDTO); return new Result(); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description + * @Date 2021/3/4 18:52 + **/ + @PostMapping("toscreenindexdata") + public Result toScreenIndexData(CalculateCommonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO); + indexCalculateService.toScreenIndexData(formDTO); + return new Result(); + } + + @PostMapping("getCustomerSubInfo") + public Result getCustomerSubInfo(@RequestParam("customerId") String customerId) { + return new Result().ok(indexCalculateService.getCustomerSubInfo(customerId)); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java index b64d7855a0..34269ee507 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java @@ -1,6 +1,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.dto.screencoll.form.*; import com.epmet.service.evaluationindex.screen.KcScreenCollService; @@ -35,7 +36,9 @@ public class KcScreenCollController { @PostMapping("homepage/platformsummary") public Result platFormSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertPlatFormSummary(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertPlatFormSummary(formDTO); return new Result(); } @@ -54,7 +57,9 @@ public class KcScreenCollController { @PostMapping("issue/summary") public Result issueSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertIssueSummary(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertIssueSummary(formDTO); return new Result(); } @@ -73,7 +78,9 @@ public class KcScreenCollController { @PostMapping("issue/trend") public Result issueTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertIssueTrend(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.MonthIdShowGroup.class); + kcScreenCollService.insertIssueTrend(formDTO); return new Result(); } @@ -92,7 +99,9 @@ public class KcScreenCollController { @PostMapping("user/summary") public Result userSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertUserSummary(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertUserSummary(formDTO); return new Result(); } @@ -111,7 +120,9 @@ public class KcScreenCollController { @PostMapping("volunteer/heartrank") public Result volunteerHeartRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertVolunteerHeartRank(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertVolunteerHeartRank(formDTO); return new Result(); } @@ -130,7 +141,9 @@ public class KcScreenCollController { @PostMapping("user/userheartrank") public Result userHeartRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertUserHeartRank(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.MonthIdShowGroup.class); + kcScreenCollService.insertUserHeartRank(formDTO); return new Result(); } @@ -149,7 +162,9 @@ public class KcScreenCollController { @PostMapping("act/summary") public Result actSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertActSummary(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertActSummary(formDTO); return new Result(); } @@ -168,7 +183,9 @@ public class KcScreenCollController { @PostMapping("act/trend") public Result actTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertActTrend(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.MonthIdShowGroup.class); + kcScreenCollService.insertActTrend(formDTO); return new Result(); } @@ -187,7 +204,9 @@ public class KcScreenCollController { @PostMapping("act/volunteersummary") public Result volunteerSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertVolunteerSummary(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertVolunteerSummary(formDTO); return new Result(); } @@ -206,7 +225,9 @@ public class KcScreenCollController { @PostMapping("project/summary") public Result projectSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertProjectSummary(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertProjectSummary(formDTO); return new Result(); } @@ -225,7 +246,9 @@ public class KcScreenCollController { @PostMapping("project/categorysummary") public Result categorySummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertCategorySummary(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertCategorySummary(formDTO); return new Result(); } @@ -244,7 +267,9 @@ public class KcScreenCollController { @PostMapping("project/satisanalysis") public Result projectSatisanalysis(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertProjectSatisanalysis(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.MonthIdShowGroup.class); + kcScreenCollService.insertProjectSatisanalysis(formDTO); return new Result(); } @@ -263,7 +288,9 @@ public class KcScreenCollController { @PostMapping("news/summary") public Result newsSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertNewsSummary(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertNewsSummary(formDTO); return new Result(); } @@ -282,7 +309,9 @@ public class KcScreenCollController { @PostMapping("news/trend") public Result newsTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertNewsTrend(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.MonthIdShowGroup.class); + kcScreenCollService.insertNewsTrend(formDTO); return new Result(); } @@ -301,7 +330,9 @@ public class KcScreenCollController { @PostMapping("news/hotrank") public Result newsHotRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertNewsHotRank(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertNewsHotRank(formDTO); return new Result(); } @@ -320,7 +351,9 @@ public class KcScreenCollController { @PostMapping("news/categoryanalysis") public Result newsCategoryAnalysis(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertNewsCategoryAnalysis(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertNewsCategoryAnalysis(formDTO); return new Result(); } @@ -339,7 +372,9 @@ public class KcScreenCollController { @PostMapping("group/summary") public Result groupSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertGroupSummary(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertGroupSummary(formDTO); return new Result(); } @@ -358,7 +393,9 @@ public class KcScreenCollController { @PostMapping("group/detail") public Result groupDetail(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertGroupDetail(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); + kcScreenCollService.insertGroupDetail(formDTO); return new Result(); } @@ -377,7 +414,9 @@ public class KcScreenCollController { @PostMapping("group/topictrend") public Result groupTopicTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { - kcScreenCollService.insertGroupTopicTrend(formDTO, customerId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.MonthIdShowGroup.class); + kcScreenCollService.insertGroupTopicTrend(formDTO); return new Result(); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java index 43b6171c05..db45cca198 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java @@ -1,20 +1,17 @@ package com.epmet.controller; -import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.screen.*; +import com.epmet.dto.screen.form.CategoryDictFormDTO; import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; import com.epmet.dto.screen.form.ScreenProjectProcessFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.service.evaluationindex.screen.*; +import com.epmet.service.stats.CustomerProjectCategoryDictService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.CollectionUtils; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestHeader; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; /** * @Description 事件/项目采集接口入口 @@ -43,17 +40,17 @@ public class ScreenProjectDataCollController { private ScreenProjectDataService projectDataService; @Autowired private ScreenProjectProcessService projectProcessService; - + @Autowired + private CustomerProjectCategoryDictService customerProjectCategoryDictService; /** * @author wangc * @description 【事件/项目分析】网格内月度数量统计 **/ @RequestMapping("quantity-grid-monthly") public Result quantityGridMonthly(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO param) { - if (null == param || CollectionUtils.isEmpty(param.getDataList()) || StringUtils.isBlank(param.getMonthId())) { - throw new ValidateException("参数错误:dataList不能为空且monthId不能为空"); - } - projectQuantityGridMonthlyService.collect(customerId, param); + param.setCustomerId(customerId); + ValidatorUtils.validateEntity(param, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.MonthIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + projectQuantityGridMonthlyService.collect(param); return new Result(); } @@ -63,10 +60,9 @@ public class ScreenProjectDataCollController { **/ @RequestMapping("quantity-org-monthly") public Result quantityOrgMonthly(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO param) { - if (null == param || CollectionUtils.isEmpty(param.getDataList()) || StringUtils.isBlank(param.getMonthId())) { - throw new ValidateException("参数错误:dataList不能为空且monthId不能为空"); - } - projectQuantityOrgMonthlyService.collect(customerId, param); + param.setCustomerId(customerId); + ValidatorUtils.validateEntity(param, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.MonthIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + projectQuantityOrgMonthlyService.collect(param); return new Result(); } @@ -76,10 +72,9 @@ public class ScreenProjectDataCollController { **/ @RequestMapping("project-grid-daily") public Result projectGridDaily(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO param) { - if (null == param || CollectionUtils.isEmpty(param.getDataList()) || StringUtils.isBlank(param.getDateId())) { - throw new ValidateException("参数错误:dataList不能为空且dataId不能为空"); - } - projectGridDailyService.collect(customerId, param); + param.setCustomerId(customerId); + ValidatorUtils.validateEntity(param, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + projectGridDailyService.collect(param); return new Result(); } @@ -89,10 +84,9 @@ public class ScreenProjectDataCollController { **/ @RequestMapping("project-org-daily") public Result projectOrgDaily(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO param) { - if (null == param || CollectionUtils.isEmpty(param.getDataList()) || StringUtils.isBlank(param.getDateId())) { - throw new ValidateException("参数错误:dataList不能为空且dataId不能为空"); - } - projectOrgDailyService.collect(customerId, param); + param.setCustomerId(customerId); + ValidatorUtils.validateEntity(param, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + projectOrgDailyService.collect(param); return new Result(); } @@ -107,10 +101,9 @@ public class ScreenProjectDataCollController { */ @RequestMapping("category-grid-daily") public Result categoryGridDaily(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO param) { - if (null == param || CollectionUtils.isEmpty(param.getDataList()) || StringUtils.isBlank(param.getDateId())) { - throw new ValidateException("参数错误:dataList不能为空且dataId不能为空"); - } - projectCategoryGridDailyService.collect(customerId, param); + param.setCustomerId(customerId); + ValidatorUtils.validateEntity(param, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + projectCategoryGridDailyService.collect(param); return new Result(); } @@ -124,10 +117,9 @@ public class ScreenProjectDataCollController { */ @RequestMapping("category-org-daily") public Result categoryOrgDaily(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO param) { - if (null == param || CollectionUtils.isEmpty(param.getDataList()) || StringUtils.isBlank(param.getDateId())) { - throw new ValidateException("参数错误:dataList不能为空且dataId不能为空"); - } - projectCategoryOrgDailyService.collect(customerId, param); + param.setCustomerId(customerId); + ValidatorUtils.validateEntity(param, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + projectCategoryOrgDailyService.collect(param); return new Result(); } //上述两个接口可以有采集接口方便灌假数。后面项目分类统计两个方案A:从项目信息中分析计算到大屏表; B:下面三个子客户(榆山街道、孔村街道、锦水街道)单独上报;子客户根据area_code计算 @@ -140,10 +132,9 @@ public class ScreenProjectDataCollController { */ @RequestMapping("uploadprojectinfo") public Result uploadProjectInfo(@RequestHeader("CustomerId") String customerId,@RequestBody ScreenCollFormDTO param){ - if (null == param || CollectionUtils.isEmpty(param.getDataList()) || StringUtils.isBlank(param.getDateId())) { - throw new ValidateException("参数错误:dataList不能为空且dateId不能为空"); - } - projectDataService.collect(customerId,param); + param.setCustomerId(customerId); + ValidatorUtils.validateEntity(param, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + projectDataService.collect(param); return new Result(); } @@ -155,11 +146,27 @@ public class ScreenProjectDataCollController { */ @RequestMapping("uploadprojectprocess") public Result uploadProjectProcess(@RequestHeader("CustomerId") String customerId,@RequestBody ScreenCollFormDTO param){ - if (null == param || CollectionUtils.isEmpty(param.getDataList()) || StringUtils.isBlank(param.getDateId())) { - throw new ValidateException("参数错误:dataList不能为空且dataId不能为空"); - } - projectProcessService.collect(customerId,param); + param.setCustomerId(customerId); + ValidatorUtils.validateEntity(param, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + projectProcessService.collect(param); return new Result(); } + /** + * 项目分类字典上报 + * 目标表:epmet_evaluation_index库的customer_project_category_dict + * + * @param customerId + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 16:03 2021-03-22 + **/ + @PostMapping("uploadcategorydict") + public Result uploadcategorydict(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + customerProjectCategoryDictService.uploadCategoryDict(formDTO); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java index bc3ed0d09b..9c521b770a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java @@ -21,6 +21,12 @@ public class StatsUserController { @Autowired private StatsUserService statsUserService; + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @description 工作端数据一期,用户分析:参与用户、注册用户分析 + * @Date 2021/3/26 13:27 + **/ @RequestMapping("execute") public Result execute(@RequestBody StatsFormDTO formDTO) { statsUserService.partition(formDTO); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java index ca112ac6a9..33e7c281aa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java @@ -1,6 +1,7 @@ package com.epmet.controller.plugins; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.plugins.BidFormDTO; import com.epmet.dto.plugins.ContractFormDTO; import com.epmet.dto.plugins.OneListFormDTO; @@ -32,6 +33,7 @@ public class OfsController { @PostMapping("onelist-daily") public Result collOneList(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); ofsService.collOneList(formDTO); return new Result(); } @@ -46,6 +48,7 @@ public class OfsController { @PostMapping("contract-daily") public Result collContract(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); ofsService.collContract(formDTO); return new Result(); } @@ -60,6 +63,7 @@ public class OfsController { @PostMapping("bid-daily") public Result collBid(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class); ofsService.collBid(formDTO); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java index 314a814ade..8bbce3e324 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java @@ -1,8 +1,7 @@ package com.epmet.controller.plugins; -import com.alibaba.fastjson.JSON; -import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.plugins.ScreenCustomerWorkRecordDictDTO; import com.epmet.dto.plugins.ScreenWorkRecordCommonFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; @@ -10,9 +9,7 @@ import com.epmet.service.plugins.ScreenCustomerWorkRecordDictService; import com.epmet.service.plugins.ScreenWorkRecordOrgDailyService; import com.epmet.service.plugins.ScreenWorkRecordOrgMonthlyService; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; /** @@ -44,12 +41,9 @@ public class WorkRecordColController { */ @PostMapping("resource-dict") public Result resourceDict(@RequestHeader("CustomerId")String customerId, @RequestBody ScreenCollFormDTO data){ - if(StringUtils.isBlank(customerId) || CollectionUtils.isEmpty(data.getDataList()) || - StringUtils.isBlank(data.getDateId())) { - log.error("com.epmet.controller.plugins.WorkRecordColController.resourceDict,param:{}", JSON.toJSONString(data)); - throw new ValidateException("客户Id、上传数据列表、日期Id不可为空"); - } - dictService.collect(customerId,data); + data.setCustomerId(customerId); + ValidatorUtils.validateEntity(data, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + dictService.collect(data); return new Result(); } @@ -63,12 +57,9 @@ public class WorkRecordColController { */ @PostMapping("org-monthly") public Result collectOrg(@RequestHeader("CustomerId")String customerId, @RequestBody ScreenCollFormDTO data){ - if(StringUtils.isBlank(customerId) || CollectionUtils.isEmpty(data.getDataList()) || - StringUtils.isBlank(data.getMonthId())) { - log.error("com.epmet.controller.plugins.WorkRecordColController.collectOrg,param:{}", JSON.toJSONString(data)); - throw new ValidateException("客户Id、上传数据列表、月份Id不可为空"); - } - screenWorkRecordOrgMonthlyService.collect(customerId,data); + data.setCustomerId(customerId); + ValidatorUtils.validateEntity(data, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.MonthIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + screenWorkRecordOrgMonthlyService.collect(data); return new Result(); } @@ -82,12 +73,9 @@ public class WorkRecordColController { */ @PostMapping("org-daily") public Result collectOrgDaily(@RequestHeader("CustomerId")String customerId, @RequestBody ScreenCollFormDTO data){ - if(StringUtils.isBlank(customerId) || CollectionUtils.isEmpty(data.getDataList()) || - StringUtils.isBlank(data.getDateId())) { - log.error("com.epmet.controller.plugins.WorkRecordColController.collectOrgDaily,param:{}", JSON.toJSONString(data)); - throw new ValidateException("客户Id、上传数据列表、日期Id不可为空"); - } - screenWorkRecordOrgDailyService.collectOrgDaily(customerId,data); + data.setCustomerId(customerId); + ValidatorUtils.validateEntity(data, ScreenCollFormDTO.CustomerIdShowGroup.class, ScreenCollFormDTO.DateIdShowGroup.class, ScreenCollFormDTO.DataListShowGroup.class); + screenWorkRecordOrgDailyService.collectOrgDaily(data); return new Result(); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java index fabee946e7..11ec9c119c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerRelationDao.java @@ -43,4 +43,12 @@ public interface CustomerRelationDao extends BaseDao { CustomerSubInfoDTO selectCustomerSubInfo(@Param("customerId")String customerId); List selectListByPids(String customerId); + + /** + * @Description 查询子级客户 + * @Param customerId + * @author zxc + * @date 2021/3/23 上午10:21 + */ + List selectSubCustomer(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java new file mode 100644 index 0000000000..010004d7ba --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java @@ -0,0 +1,46 @@ +/** + * 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.evaluationindex.extract; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity; +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-19 + */ +@Mapper +public interface FactOriginProjectCategoryDailyDao extends BaseDao { + + void deleteOldData(@Param("customerId") String customerId,@Param("dateId") String dateId); + + /** + * @param customerId + * @author yinzuomei + * @description 计算当前客户下,各个网格内,各项目分类下项目数量 + * @Date 2021/3/23 9:58 + **/ + List selectListProjectCategoryGridDailyDTO(@Param("customerId") String customerId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java index 12b747d206..086c2e4b61 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java @@ -24,6 +24,7 @@ import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.TransferRightRatioResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.dto.pingyin.result.*; +import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; @@ -273,4 +274,19 @@ public interface FactOriginProjectMainDailyDao extends BaseDao selectClosedIncr(@Param("customerId")String customerId, @Param("monthId")String monthId); + + /** + * @Description 初始化screen_project_data数据 + * 如果是dateId不为空,则查询前一天的数据 + * 否则全查(适用于首次初始化的场景) + * + * 这是只查询指定天新增的项目,对于需要更新状态的项目,对历史数据(流转中的项目)进行遍历查询 + * @param customerId + * @param dateId + * @return java.util.List + * @author wangc + * @date 2021.03.04 22:56 + */ + List initNewScreenProjectData(@Param("customerId")String customerId,@Param("dateId") String dateId,@Param("dataEndTime")String dataEndTime); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java index 70a1fee036..5f3bf2ae42 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.form.CostDayFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -83,4 +84,13 @@ public interface FactOriginProjectOrgPeriodDailyDao extends BaseDao */ List selectDeptHandle(@Param("customerId") String customerId, @Param("monthId") String monthId); + + /** + * @Description + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.05 15:12 + */ + List selectProjectNodeStartStopTime(@Param("list")List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java index 5e0d0585be..2593996a1b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java @@ -70,7 +70,8 @@ public interface AgencyScoreDao extends BaseDao { * @author zxc * @date 2021/1/15 下午4:23 */ - List selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode,@Param("areaCodeLength") Integer areaCodeLength, @Param("monthId")String monthId, @Param("dataType")String dataType); + List selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode, @Param("monthId")String monthId, @Param("dataType")String dataType,@Param("customerId")String customerId); + List selectAgencyScoreInfoExistsSubSelf(@Param("areaCode") String areaCode, @Param("monthId")String monthId, @Param("dataType")String dataType,@Param("customerId")String customerId); /** * @Description 区下级街道得分平均值 @@ -90,7 +91,8 @@ public interface AgencyScoreDao extends BaseDao { * @author zxc * @date 2021/1/18 上午9:09 */ - List selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength); + List selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("areaCode")String areaCode); + List selectAgencyScoreAvgByOrgIds(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("orgIds")List orgIds); /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java index 1e653e61a7..104f53bb42 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunityScoreDao.java @@ -68,7 +68,7 @@ public interface CommunityScoreDao extends BaseDao selectCommunityInfoExistsSub(@Param("areaCode") String areaCode,@Param("monthId")String monthId); + List selectCommunityInfoExistsSub(@Param("areaCode") String areaCode,@Param("monthId")String monthId,@Param("customerId")String customerId); /** * 根据入参查询 查询社区相关信息 @@ -97,6 +97,7 @@ public interface CommunityScoreDao extends BaseDao selectSubCommAvgScoreExistSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("areaCode")String areaCode); + List selectSubCommAvgScoreExistSubNotSelf(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("areaCode")String areaCode); /** * 根据入参查询 查询社区id diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java index a22317c371..cc35dbb875 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java @@ -77,6 +77,7 @@ public interface DeptScoreDao extends BaseDao { * @date 2021/1/18 上午9:31 */ List selectGovernDeptScoreAvgExistsSub(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode); + List selectGovernDeptScoreAvgExistsSubNotSelf(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode); /** * @return int diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java index 48d156cc81..24f48eef4f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyDao.java @@ -75,6 +75,15 @@ public interface FactIndexGovrnAblityOrgMonthlyDao extends BaseDao> selectCommunityGovernAbilityExistsSub(@Param("monthId")String monthId,@Param("areaCode")String areaCode); + List> selectCommunityGovernAbilityExistsSubNotSelf(@Param("monthId")String monthId,@Param("areaCode")String areaCode,@Param("level")String level); + /** + * @Description 孔村单独查询 + * @Param monthId + * @Param areaCode + * @author zxc + * @date 2021/3/11 下午5:21 + */ + List> selectCommunityGovernAbilityIsKongCun(@Param("monthId")String monthId,@Param("areaCode")String areaCode); /** * 根据组织类型删除数据 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java index ebbdc9424f..dd3774be45 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.java @@ -85,7 +85,8 @@ public interface FactIndexPartyAblityOrgMonthlyDao extends BaseDao> selectPublishArticleCountMapExistSub(@Param("monthId")String monthId,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength); + List> selectPublishArticleCountMapExistSubStreet(@Param("monthId")String monthId,@Param("areaCode")String areaCode); + List> selectPublishArticleCountMapExistSubNotSelf(@Param("monthId")String monthId,@Param("areaCode")String areaCode); /** * @Description 查询社区下的发文数 Map【根据areaCode】 @@ -96,6 +97,7 @@ public interface FactIndexPartyAblityOrgMonthlyDao extends BaseDao> selectPublishArticleCountMapbyAreaCode(@Param("monthId")String monthId,@Param("areaCode")String areaCode); + List> selectPublishArticleCountMapbyAreaCodeNotSelf(@Param("monthId")String monthId,@Param("areaCode")String areaCode); /** * 根据组织类型删除数据 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java index bacc7b77ed..28917bf72b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityOrgMonthlyDao.java @@ -87,6 +87,8 @@ public interface FactIndexServiceAblityOrgMonthlyDao extends BaseDao> selectActivityCountMapExistsSub(@Param("monthId")String monthId,@Param("areaCode")String areaCode); + List> selectActivityCountMapIsKongCun(@Param("monthId")String monthId,@Param("areaCode")String areaCode); + List> selectActivityCountMapExistsSubNotSelf(@Param("monthId")String monthId,@Param("areaCode")String areaCode); /** * 根据组织类型删除数据 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index f61e21f2ad..6aa48bf445 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -95,6 +95,8 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectAgencyByCustomer(@Param("customerId")String customerId); List selectAgencyByAreaCode(String areaCode); + + /** + * @Description 根据areaCode查询下级组织 + * @Param areaCode + * @author zxc + * @date 2021/3/9 上午9:41 + */ + List selectAgencyByParentAreaCode(@Param("areaCode") String areaCode); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index c06e189d7c..1d5099bc67 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -194,4 +194,13 @@ public interface ScreenCustomerGridDao extends BaseDao * @date 2021/1/28 下午3:18 */ List selectGridInfoByCustomerId(@Param("customerId") String customerId); + + /** + * @Description 查询直属网格信息 + * @Param customerId + * @Param level + * @author zxc + * @date 2021/3/23 下午4:03 + */ + List selectBelongGridInfo(@Param("customerId") String customerId,@Param("level") String level); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java index 5b96c10067..bad0a291bf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.java @@ -18,10 +18,13 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.result.CategoryProjectResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryGridDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 项目(事件)分类按网格_按天统计 * @@ -39,4 +42,13 @@ public interface ScreenProjectCategoryGridDailyDao extends BaseDao selectCategoryInfo(@Param("customerId") String customerId,@Param("dateId") String dateId,@Param("level")String level,@Param("gridIds")List gridIds); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java index c87d8bec0f..9f55340594 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java @@ -18,10 +18,14 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.result.CategoryProjectResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity; +import com.sun.org.apache.xpath.internal.operations.Bool; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 项目(事件)分类按组织_按天统计 * @@ -39,4 +43,26 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao selectOrgCategoryInfo(@Param("customerId") String customerId, @Param("dateId") String dateId,@Param("level")String level); + + /** + * @Description 查询组织分类信息【多客户】 + * @Param customerId + * @Param dateId + * @Param level + * @Param existsStatus 父客户是否存在 + * @author zxc + * @date 2021/3/24 下午2:48 + */ + List selectOrgCategoryMoreCustomerInfo(@Param("customerIds")List customerIds, @Param("dateId") String dateId, + @Param("level")String level, @Param("customerId")String customerId, @Param("existsStatus")Boolean existsStatus); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java index b1cea20772..1cdb4a1e8d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java @@ -18,7 +18,8 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; +import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -36,4 +37,13 @@ public interface ScreenProjectDataDao extends BaseDao { int deleteByDateIdAndCustomerId(@Param("customerId") String customerId,@Param("dateId") String dateId); + int deleteByProjectTimeAndCustomerId(@Param("customerId") String customerId,@Param("dateId") String dateId); + + int checkIfExisted(@Param("customerId") String customerId); + + List selectPending(ScreenProjectDataDTO param); + + void insertBatch(@Param("list") List list); + + void updateBatch(@Param("list") List list,@Param("dateId") String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java index 2c4039af04..4904f32724 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectImgDataDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.ScreenProjectImgDataDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectImgDataEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 中央区-项目数据图片 @@ -30,4 +34,7 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ScreenProjectImgDataDao extends BaseDao { + void deleteByProjectIds(@Param("list") List list); + + void insertBatch(@Param("list") List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessAttachmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessAttachmentDao.java index d4650815f5..4a84a02c90 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessAttachmentDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessAttachmentDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessAttachmentEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 中央区-项目数据处理节点附件表 @@ -30,4 +34,8 @@ import org.apache.ibatis.annotations.Mapper; @Mapper public interface ScreenProjectProcessAttachmentDao extends BaseDao { + void deleteByProcessId(@Param("list") List list); + + void insertBatch(@Param("list")List list); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessDao.java index 4ad6a11e69..f9638e9c4f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectProcessDao.java @@ -18,10 +18,13 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.ScreenProjectProcessDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 中央区-项目数据项目处理进展表 * @@ -32,4 +35,10 @@ import org.apache.ibatis.annotations.Param; public interface ScreenProjectProcessDao extends BaseDao { int deleteByDateIdAndCustomerId(@Param("customerId") String customerId, @Param("dateId") String dateId); + + int deleteByProcessTimeAndCustomerId(@Param("customerId") String customerId, @Param("dateId") String dateId); + + int countByCustomerId(@Param("customerId") String customerId); + + void insertBatch(@Param("list") List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java new file mode 100644 index 0000000000..371cda3cf2 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/IssueProjectCategoryDictDao.java @@ -0,0 +1,41 @@ +/** + * 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.issue; + +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface IssueProjectCategoryDictDao { + + List listInsertCategoies(@Param("start") Date start, @Param("end") Date end); + + List listByUpdatedTime(@Param("start") Date start, @Param("end") Date end); + + IssueProjectCategoryDictEntity getById(@Param("customerId")String customerId, @Param("id")String id);; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java index 190353059f..875efb82e1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java @@ -5,15 +5,13 @@ import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO; import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; -import com.epmet.dto.issue.IssueAgencyDTO; -import com.epmet.dto.issue.IssueDTO; -import com.epmet.dto.issue.IssueGridDTO; -import com.epmet.dto.issue.IssueProjectDTO; +import com.epmet.dto.issue.*; import com.epmet.entity.issue.IssueEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Set; @Mapper public interface StatsIssueDao extends BaseDao { @@ -181,4 +179,6 @@ public interface StatsIssueDao extends BaseDao { * @date 2020/9/27 1:22 下午 */ List selectIssueVoteStatis(@Param("customerId") String customerId, @Param("dateId") String dateId); + + List selectCategory(@Param("customerId") String customerId, @Param("ids") Set set); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java index 3d4526a0fe..2d3318c262 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectDao.java @@ -20,7 +20,10 @@ package com.epmet.dao.project; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ProjectDTO; import com.epmet.dto.project.ProjectAgencyDTO; +import com.epmet.dto.project.ProjectCategoryDTO; import com.epmet.dto.project.ProjectGridDTO; +import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; +import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; import com.epmet.entity.project.ProjectEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -103,5 +106,33 @@ public interface ProjectDao extends BaseDao { */ String selectParameterValueByKey(@Param("customerId") String customerId); + /** + * @Description 查找客户项目超期参数 + * + * @param customerId + * @return java.util.List + * @author wangc + * @date 2021.03.05 17:52 + */ + List selectProjectExceedParams(@Param("customerId") String customerId); + + /** + * @Description 批量查询项目信息 + * @param ids + * @return java.util.List + * @author wangc + * @date 2021.03.08 10:32 + */ + List batchSelectProjectInfo(@Param("ids")List ids); + + /** + * @Description 查询项目的分类信息 + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.08 23:44 + */ + List selectProjectCategory(@Param("list")List list); -} \ No newline at end of file + List getProjectCategoryData(@Param("customerId") String customerId, @Param("dateId") String dateId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java index 37e130e678..f9647a4fe0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/project/ProjectProcessDao.java @@ -18,12 +18,14 @@ package com.epmet.dao.project; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ProjectProcessDTO; import com.epmet.dto.project.FinishOrgDTO; import com.epmet.dto.project.ProcessInfoDTO; -import com.epmet.dto.project.ProjectOrgRelationDTO; import com.epmet.dto.project.result.ProjectLatestOperationResultDTO; import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO; import com.epmet.dto.project.result.ProjectOrgRelationWhenResponseResultDTO; +import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; +import com.epmet.dto.screen.ScreenProjectProcessDTO; import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectProcessEntity; import org.apache.ibatis.annotations.Mapper; @@ -153,4 +155,28 @@ public interface ProjectProcessDao extends BaseDao { * @date 2020.09.28 14:45 */ List selectLatestOperation(@Param("list") List list,@Param("customerId") String customerId); + + /** + * @Description 查找指定日期结案的项目 + * @param customerId + * @param dateId + * @return java.util.List + * @author wangc + * @date 2021.03.09 10:49 + */ + List selectClosedProjectOnAppointedDay(@Param("customerId") String customerId, @Param("dateId") String dateId); + + List selectClosedProjectByProjectIds(@Param("list")List list); + /** + * @Description 统计新增项目节点以及被流转到的指向部门 + * @param customerId + * @param dateId + * @param dataEndTime + * @return java.util.List + * @author wangc + * @date 2021.03.09 16:25 + */ + List selectProjectProcessAndDirection(@Param("customerId") String customerId, @Param("dateId") String dateId, @Param("dataEndTime")String dataEndTime ); + + List selectProcessAttachment(@Param("list")List list); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java new file mode 100644 index 0000000000..3489fc5917 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerProjectCategoryDictDao.java @@ -0,0 +1,63 @@ +/** + * 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.stats; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.form.CategoryDictFormDTO; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; +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-19 + */ +@Mapper +public interface CustomerProjectCategoryDictDao extends BaseDao { + + CustomerProjectCategoryDictEntity getLatestProjectCategory(); + + CustomerProjectCategoryDictEntity getLatestUpdatedEntity(); + + CustomerProjectCategoryDictEntity selectByCustomerIdAndId(@Param("customerId") String customerId, @Param("categoryId") String categoryId); + + /** + * 当isFirst=true时,直接根据 customerId 删除原有数据,再批量insert。 + * + * @param customerId + * @return java.lang.Integer + * @Author zhangyong + * @Date 16:12 2021-03-22 + **/ + Integer deleteCustomerProjectCategoryDict(@Param("customerId") String customerId); + + /** + * 批量insert。 + * + * @param list + * @param customerId + * @return void + * @Author zhangyong + * @Date 16:13 2021-03-22 + **/ + void batchInsertCustomerProjectCategoryDict(@Param("list") List list, @Param("customerId")String customerId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java index 1d9a6125bc..16a76f30ee 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/topic/TopicDao.java @@ -8,6 +8,8 @@ package com.epmet.dao.topic; */ import com.epmet.dto.group.result.TopicContentResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.screen.ScreenProjectImgDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.topic.ResiTopicDTO; import com.epmet.dto.extract.result.TopicInfoResultDTO; @@ -117,4 +119,23 @@ public interface TopicDao { * @date 2020.09.28 16:28 */ List selectTopicContent(@Param("list") List list); + + /** + * @Description 根据话题Id查询大屏项目的相关信息 + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.08 17:13 + */ + List selectScreenProjectData(@Param("list") List list); + + /** + * @Description 初始化指定项目的图片 + * @param customerId + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.09 14:19 + */ + List initNewScreenProjectImgData(@Param("customerId")String customerId,@Param("list") List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index b9162c30a2..411452caeb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -2,6 +2,7 @@ package com.epmet.dao.user; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import org.apache.ibatis.annotations.Mapper; @@ -131,4 +132,14 @@ public interface UserDao { * @date 2020.09.25 13:54 **/ List selectRegisteredUserByCustomerId(@Param("customerId") String customerId); + + /** + * @Description 获取大屏项目相关信息 联系人 + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.08 17:16 + */ + List selectScreenProjectData(@Param("list") List list); } + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectCategoryDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectCategoryDailyEntity.java new file mode 100644 index 0000000000..4587577a2d --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/extract/FactOriginProjectCategoryDailyEntity.java @@ -0,0 +1,63 @@ +/** + * 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.evaluationindex.extract; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("fact_origin_project_category_daily") +public class FactOriginProjectCategoryDailyEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 项目id + */ + private String projectId; + + /** + * 分类编码 + */ + private String categoryCode; + + /** + * 所属父类分类编码 + */ + private String parentCategoryCode; + + /** + * 分类等级:1、2....;产品目前只有2级分类 + */ + private Integer level; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyDataEntity.java index f8f7595adf..04c252172e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenDifficultyDataEntity.java @@ -61,7 +61,7 @@ public class ScreenDifficultyDataEntity extends BaseEpmetEntity { private String orgName; /** - * 事件原Id + * 事件原Id(项目Id) */ private String eventId; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java index ef91f696c2..82b03555ac 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java @@ -18,14 +18,10 @@ package com.epmet.entity.evaluationindex.screen; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.math.BigDecimal; -import java.util.Date; - /** * 项目(事件)分类按网格_按天统计 * @@ -65,50 +61,17 @@ public class ScreenProjectCategoryGridDailyEntity extends BaseEpmetEntity { private String pids; /** - * e世通中的项目类别编码 + * 项目类别编码 */ - private String epmetCategoryCode; - - private String epmetCategoryName; + private String categoryCode; /** * 该分类下所有项目总数 */ private Integer projectTotal; - /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 - */ - private BigDecimal unResolvedRatio; - + /** + * 分类等级1、2.... + */ + private Integer level; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java index 1ac6c76145..5c097997a6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java @@ -18,14 +18,10 @@ package com.epmet.entity.evaluationindex.screen; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.math.BigDecimal; -import java.util.Date; - /** * 项目(事件)分类按组织_按天统计 * @@ -72,48 +68,15 @@ public class ScreenProjectCategoryOrgDailyEntity extends BaseEpmetEntity { /** * e世通中的项目类别编码 */ - private String epmetCategoryCode; - - private String epmetCategoryName; + private String categoryCode; /** * 该分类下所有项目总数 */ private Integer projectTotal; - /** - * 该分类下,正在处理中的项目总数 - */ - private Integer pendingTotal; - - /** - * 该分类下已结案的项目总数 - */ - private Integer closedTotal; - - /** - * 该分类下已结案无需解决的项目总数 - */ - private Integer unResolvedTotal; - - /** - * 该分类下已结案已解决的项目总数 - */ - private Integer resolvedTotal; - - /** - * 该分类下项目结案率 - */ - private BigDecimal closedRatio; - - /** - * 该分类下已结案项目解决率 - */ - private BigDecimal resolvedRatio; - - /** - * 该分类下已结案项目未解决率 - */ - private BigDecimal unResolvedRatio; - + /** + * 分类等级1、2.... + */ + private Integer level; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java new file mode 100644 index 0000000000..67c82fee00 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java @@ -0,0 +1,83 @@ +/** + * 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.issue; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_project_category_dict") +public class IssueProjectCategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id, 产品默认default + */ + private String customerId; + + /** + * 上级分类ID 顶级此列存储0 + */ + private String pid; + + /** + * 所有上级分类ID,用逗号分开 + */ + private String pids; + + /** + * 上级分类编码 + */ + private String parentCategoryCode; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 分类类别1,2,3,4.... + */ + private String categoryType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java new file mode 100644 index 0000000000..82afefb88c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/CustomerProjectCategoryDictEntity.java @@ -0,0 +1,95 @@ +/** + * 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.stats; + +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-19 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_project_category_dict") +public class CustomerProjectCategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 外部客户:external;内部客户:internal + */ + private String customerType; + + /** + * 客户自己的分类编码 + */ + private String categoryCode; + + /** + * 客户自己的分类名称 + */ + private String categoryName; + + /** + * 父类分类编码,如果是一级分类,此列赋值为0 + */ + private String parentCategoryCode; + + /** + * 分类等级:1、2....;产品只有2级分类 + */ + private Integer level; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 对应e世通中的分类编码,没有此列为空 + */ + private String epmetCategoryCode; + + /** + * 创建时间 + */ + private Date originCreatedTime; + /** + * 修改时间 + */ + private Date originUpdatedTime; + + private String categoryId; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java new file mode 100644 index 0000000000..4d2a96f7be --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueProjectCategoryDictService.java @@ -0,0 +1,39 @@ +/** + * 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.Issue; + +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; + +import java.util.Date; +import java.util.List; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ + +public interface IssueProjectCategoryDictService{ + + List listInsertCategoies(Date start, Date end); + + List listByUpdatedTime(Date start, Date end); + + IssueProjectCategoryDictEntity getById(String customerId,String id); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java index 239ad2d8b1..b920c0e29a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java @@ -11,6 +11,8 @@ import com.epmet.dto.issue.IssueProjectDTO; import com.epmet.entity.issue.IssueEntity; import java.util.List; +import java.util.Map; +import java.util.Set; /** * @author zhaoqifeng @@ -172,4 +174,13 @@ public interface IssueService { * @date 2020/9/27 11:20 上午 */ List selectIssueVoteStatis(String customerId, String monthId); + + /** + * @Description 查找项目的分类名称 以-相连,以,分隔, + * @param param + * @return java.util.Map + * @author wangc + * @date 2021.03.09 00:23 + */ + Map getIntegratedProjectCategory(Map> param,String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java new file mode 100644 index 0000000000..982030799f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueProjectCategoryDictServiceImpl.java @@ -0,0 +1,42 @@ +package com.epmet.service.Issue.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.issue.IssueProjectCategoryDictDao; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.service.Issue.IssueProjectCategoryDictService; +import org.apache.ibatis.annotations.Param; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2021/3/19 15:29 + */ +@Service +@DataSource(DataSourceConstant.GOV_ISSUE) +public class IssueProjectCategoryDictServiceImpl implements IssueProjectCategoryDictService { + @Autowired + private IssueProjectCategoryDictDao issueProjectCategoryDictDao; + + @Override + public List listInsertCategoies(Date start, Date end) { + return issueProjectCategoryDictDao.listInsertCategoies(start, end); + } + + @Override + public List listByUpdatedTime(Date start, Date end) { + return issueProjectCategoryDictDao.listByUpdatedTime(start, end); + } + + @Override + public IssueProjectCategoryDictEntity getById(String customerId, String id) { + return issueProjectCategoryDictDao.getById(customerId,id); + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java index e134358618..44578a426a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java @@ -1,22 +1,25 @@ package com.epmet.service.Issue.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.constant.DataSourceConstant; import com.epmet.dao.issue.StatsIssueDao; import com.epmet.dto.extract.result.IssueInfoResultDTO; import com.epmet.dto.extract.result.IssueProcessInfoResultDTO; import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO; import com.epmet.dto.extract.result.SatisfactionInfoResultDTO; -import com.epmet.dto.issue.IssueAgencyDTO; -import com.epmet.dto.issue.IssueDTO; -import com.epmet.dto.issue.IssueGridDTO; -import com.epmet.dto.issue.IssueProjectDTO; +import com.epmet.dto.issue.*; import com.epmet.entity.issue.IssueEntity; import com.epmet.service.Issue.IssueService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; /** * @author zhaoqifeng @@ -143,4 +146,27 @@ public class IssueServiceImpl implements IssueService { public List selectIssueVoteStatis(String customerId, String dateId) { return statsIssueDao.selectIssueVoteStatis(customerId, dateId); } + + /** + * @Description 查找项目的分类名称 以-相连,以,分隔, + * @param param + * @return java.util.Map + * @author wangc + * @date 2021.03.09 00:23 + */ + @Override + public Map getIntegratedProjectCategory(Map> param,String customerId) { + Map map = new HashMap<>(); + param.forEach((projectId,categoryIds) -> { + //以下查询只适用于二级分类,如果分类层级变多了要修改此查询 + List categories = statsIssueDao.selectCategory(customerId, categoryIds); + if(!CollectionUtils.isEmpty(categories)){ + StringBuilder str = new StringBuilder(); + categories.forEach(category -> {str.append(category.getCategoryName()).append(StrConstant.COMMA);}); + map.put(projectId,str.substring(NumConstant.ZERO,str.length() - NumConstant.TWO)); + } + }); + + return map; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java index 1e2f05991b..0bdac4cb04 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsDimService.java @@ -10,4 +10,6 @@ public interface StatsDimService { void initCustomerDim(); void initDepartmentDim(); + + void customerInitProjectCategory(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java index 7d9a9f8aca..4c2a37620f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerRelationService.java @@ -23,7 +23,6 @@ import com.epmet.dto.indexcal.CustomerSubInfoDTO; import com.epmet.entity.crm.CustomerRelationEntity; import java.util.List; -import java.util.Map; /** * 客户关系表(01.14 add) @@ -35,12 +34,20 @@ public interface CustomerRelationService extends BaseService - * @param customerIds + * @param customerId * @author yinzuomei * @description 查询每个客户的area_code、以及下一级客户列表 * @Date 2021/1/14 16:22 **/ - Map getCustomerInfoMap(List customerIds); + CustomerSubInfoDTO getCustomerSubInfo(String customerId); boolean haveSubCustomer(String customerId); + + /** + * @Description 查询子级客户 + * @Param customerId + * @author zxc + * @date 2021/3/23 上午10:21 + */ + List selectSubCustomer(String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java index ac09dc001a..06d2b580fc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerRelationServiceImpl.java @@ -26,15 +26,13 @@ import com.epmet.dto.stats.DimCustomerDTO; import com.epmet.entity.crm.CustomerRelationEntity; import com.epmet.service.crm.CustomerRelationService; import com.epmet.service.stats.DimCustomerService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; 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.stream.Collectors; /** * 客户关系表(01.14 add) @@ -42,6 +40,7 @@ import java.util.stream.Collectors; * @author generator generator@elink-cn.com * @since v1.0.0 2021-01-14 */ +@Slf4j @DataSource(DataSourceConstant.OPER_CRM) @Service public class CustomerRelationServiceImpl extends BaseServiceImpl implements CustomerRelationService { @@ -49,37 +48,42 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl * @author yinzuomei * @description 查询每个客户的area_code、以及下一级客户列表 * @Date 2021/1/14 16:22 **/ @Override - public Map getCustomerInfoMap(List customerIds) { - List list=new ArrayList<>(); - for(String customerId:customerIds){ - CustomerSubInfoDTO customerSubInfoDTO = baseDao.selectCustomerSubInfo(customerId); - if(null!=customerSubInfoDTO){ - DimCustomerDTO dimCustomerDTO=dimCustomerService.get(customerId); - if(null!=dimCustomerDTO){ - customerSubInfoDTO.setCustomerName(dimCustomerDTO.getCustomerName()); - } - list.add(customerSubInfoDTO); - } + public CustomerSubInfoDTO getCustomerSubInfo(String customerId) { + CustomerSubInfoDTO customerSubInfoDTO = baseDao.selectCustomerSubInfo(customerId); + if (null != customerSubInfoDTO) { + DimCustomerDTO dimCustomerDTO = dimCustomerService.get(customerId); + customerSubInfoDTO.setCustomerName(dimCustomerDTO.getCustomerName()); } - if(CollectionUtils.isEmpty(list)){ - return new HashMap<>(); - } - return list.stream().collect(Collectors.toMap(CustomerSubInfoDTO::getCustomerId, customer -> customer)); + return customerSubInfoDTO; } @Override public boolean haveSubCustomer(String customerId) { - List list=baseDao.selectListByPids(customerId); - if(null==list||list.isEmpty()){ + List list = baseDao.selectListByPids(customerId); + if (null == list || list.isEmpty()) { return false; } return true; } + + /** + * @Description 查询子级客户 + * @Param customerId + * @author zxc + * @date 2021/3/23 上午10:21 + */ + @Override + public List selectSubCustomer(String customerId) { + if (StringUtils.isEmpty(customerId)){ + return new ArrayList<>(); + } + return baseDao.selectSubCustomer(customerId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java new file mode 100644 index 0000000000..1a0a27eda9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java @@ -0,0 +1,50 @@ +/** + * 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.evaluationindex.extract.todata; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity; + +import java.util.List; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +public interface FactOriginProjectCategoryDailyService extends BaseService { + /** + * @Description 将epmet_gov_project库中的项目分类信息(project_category)同步到统计库epmet_data_statistical + * @param paramNew + * @return void + * @Author liushaowen + * @Date 2021/3/22 15:28 + */ + void extractProjectCategory(ExtractOriginFormDTO paramNew); + + /** + * @param customerId + * @author yinzuomei + * @description 计算当前客户下,各个网格内,各项目分类下项目数量 + * @Date 2021/3/23 9:56 + **/ + List selectListProjectCategoryGridDailyDTO(String customerId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java index 2a3c3ab304..c337c085da 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.extract.FactOriginProjectLogDailyDTO; import com.epmet.dto.extract.result.*; +import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectLogDailyEntity; import java.math.BigDecimal; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java index 3cb5f6e0e7..ea44540cd9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java @@ -25,6 +25,7 @@ import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.TransferRightRatioResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.dto.pingyin.result.*; +import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; @@ -319,4 +320,24 @@ public interface FactOriginProjectMainDailyService extends BaseService selectClosedIncr(String customerId, String monthId); + + /** + * @Description 初始化screen_project_data数据 + * 如果是dateId不为空,则查询前一天的数据 + * 否则全查(适用于首次初始化的场景) + * + * 这是只查询指定天新增的项目,对于需要更新状态的项目,对历史数据(流转中的项目)进行遍历查询 + * @param customerId + * @param rows + * @param dateId + * @param exceedLimit 超期上线 + * @param about2exceedLimit 即将超期参数 + * @return java.util.List + * @author wangc + * @date 2021.03.04 22:56 + */ + List initNewScreenProjectData(String customerId,Integer rows ,String dateId,Integer exceedLimit,Integer about2exceedLimit); + + void computerIfExceed(List list,Integer exceedLimit,Integer about2exceedLimit); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java index f44eef01de..1d6e4dc9fd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java @@ -46,7 +46,8 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { private GroupExtractService groupExtractService; @Autowired private DimCustomerPartymemberService dimCustomerPartymemberService; - + @Autowired + private FactOriginProjectCategoryDailyService originProjectCategoryDailyService; @Override public void extractAll(ExtractOriginFormDTO extractOriginFormDTO) { @@ -198,7 +199,12 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { try { projectExtractService.extractProjectPeriodData(paramNew); } catch (Exception e) { - log.error("抽取【项目数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); + log.error("抽取【项目耗时数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); + } + try { + originProjectCategoryDailyService.extractProjectCategory(paramNew); + } catch (Exception e) { + log.error("抽取【项目分类数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); } } else { try { @@ -219,6 +225,16 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService { } catch (Exception e) { log.error("抽取【项目数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); } + try { + for (int i = 0; i < finalDaysBetween.size(); i++) { + String dateDimId = finalDaysBetween.get(i); + paramNew.setDateId(dateDimId); + originProjectCategoryDailyService.extractProjectCategory(paramNew); + } + } catch (Exception e) { + log.error("抽取【项目分类数据】发生异常,参数:" + JSON.toJSONString(paramNew), e); + } + } }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java new file mode 100644 index 0000000000..c97322b4b4 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java @@ -0,0 +1,122 @@ +/** + * 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.evaluationindex.extract.todata.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.extract.FactOriginProjectCategoryDailyDao; +import com.epmet.dto.ProjectCategoryDTO; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectCategoryDailyEntity; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.service.Issue.IssueProjectCategoryDictService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectCategoryDailyService; +import com.epmet.service.project.ProjectService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 项目所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Service +@DataSource(DataSourceConstant.STATS) +@Slf4j +public class FactOriginProjectCategoryDailyServiceImpl extends BaseServiceImpl implements FactOriginProjectCategoryDailyService { + @Autowired + private ProjectService projectService; + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + /** + * @param extractOriginFormDTO + * @return void + * @Description 将epmet_gov_project库中的项目分类信息(project_category)同步到统计库epmet_data_statistical + * @Author liushaowen + * @Date 2021/3/22 15:28 + */ + @Override + public void extractProjectCategory(ExtractOriginFormDTO extractOriginFormDTO) { + String dateString = extractOriginFormDTO.getDateId(); + String customerId = extractOriginFormDTO.getCustomerId(); + List entities = new ArrayList<>(); + Integer count = baseDao.selectCount(new QueryWrapper().eq("customer_id",customerId)); + //如果count = 0 初始化该customer所有数据 + if (NumConstant.ZERO == count){ + dateString = null; + } + List projectCategoryData = projectService.getProjectCategoryData(customerId, dateString); + if (!CollectionUtils.isEmpty(projectCategoryData)){ + projectCategoryData.forEach(data->{ + FactOriginProjectCategoryDailyEntity insertEntity = new FactOriginProjectCategoryDailyEntity(); + IssueProjectCategoryDictEntity categoryDictEntity = issueProjectCategoryDictService.getById(customerId, data.getCategoryId()); + if (categoryDictEntity == null){ + log.warn("categoryDict not found : customerId:{},categoryId:{}",customerId,data.getCategoryId()); + } + insertEntity.setProjectId(data.getProjectId()); + insertEntity.setCategoryCode(categoryDictEntity.getCategoryCode()); + insertEntity.setParentCategoryCode(categoryDictEntity.getParentCategoryCode()); + insertEntity.setCustomerId(customerId); + insertEntity.setLevel(Integer.valueOf(categoryDictEntity.getCategoryType())); + insertEntity.setCreatedTime(data.getCreatedTime()); + entities.add(insertEntity); + }); + if (!CollectionUtils.isEmpty(entities)){ + delAndInsert(customerId,dateString,entities); + } + } + } + /** + * @Description category表删除插入 + * @param customerId + * @param dateId + * @param result + * @return void + * @Author liushaowen + * @Date 2021/3/22 17:01 + */ + @Transactional(rollbackFor = Exception.class) + public void delAndInsert(String customerId,String dateId,List result){ + baseDao.deleteOldData(customerId, dateId); + insertBatch(result); + } + + + /** + * @param customerId + * @author yinzuomei + * @description 计算当前客户下,各个网格内,各项目分类下项目数量 + * @Date 2021/3/23 9:56 + **/ + @Override + public List selectListProjectCategoryGridDailyDTO(String customerId) { + List list=baseDao.selectListProjectCategoryGridDailyDTO(customerId); + return list; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java index 7b3f127cd2..b710d08af5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java @@ -235,6 +235,7 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl projectsHandledByAgency = baseDao.selectProjectIdHandledByAgency(customerId, dimId); Map efficiencyMap = new HashMap<>(); + List projects = new LinkedList<>(); if (!CollectionUtils.isEmpty(projectsHandledByAgency)) { Map> agencyProjectsMap = new HashMap<>(); @@ -248,10 +249,9 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl projects = new LinkedList<>(); - agencyProjectsMap.forEach((key,value) -> {projects.addAll(value);}); //2.结案项目的总耗时 List costTimes = baseDao.selectProjectCostTime(projects); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java index c5aaa76daa..7f9d220602 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java @@ -25,27 +25,32 @@ import com.epmet.commons.tools.constant.FieldConstant; 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.DateUtils; +import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.extract.FactOriginProjectMainDailyDao; +import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; import com.epmet.dto.extract.FactOriginProjectMainDailyDTO; import com.epmet.dto.extract.result.GridProjectClosedTotalResultDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.TransferRightRatioResultDTO; import com.epmet.dto.indexcollect.result.CpcIndexCommonDTO; import com.epmet.dto.pingyin.result.*; +import com.epmet.dto.result.CostDayResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; +import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; 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 org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 项目主表_日统计 @@ -57,6 +62,10 @@ import java.util.Map; @DataSource(DataSourceConstant.STATS) public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl implements FactOriginProjectMainDailyService { + @Autowired + private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; + @Autowired + private FactOriginProjectOrgPeriodDailyDao periodDao; @Override public PageData page(Map params) { IPage page = baseDao.selectPage( @@ -239,6 +248,7 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl * @author wangc @@ -358,4 +368,59 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl(); } -} \ No newline at end of file + + /** + * @Description 初始化screen_project_data数据 + * 如果是dateId不为空,则查询前一天的数据 + * 否则全查(适用于首次初始化的场景) + * + * 这是只查询指定天新增的项目,对于需要更新状态的项目,对历史数据(流转中的项目)进行遍历查询 + * @param customerId + * @param rows + * @param dateId + * @param exceedLimit 超期上线 + * @param about2exceedLimit 即将超期参数 + * @return java.util.List + * @author wangc + * @date 2021.03.04 22:56 + */ + @Override + public List initNewScreenProjectData(String customerId,Integer rows , String dateId,Integer exceedLimit,Integer about2exceedLimit) { + boolean ifBeforeYesterday = true; + if(Integer.parseInt(DateUtils.getBeforeNDay(NumConstant.ONE)) > Integer.parseInt(dateId)){ + ifBeforeYesterday = false; + } + List projects = baseDao.initNewScreenProjectData(customerId, rows <= NumConstant.ZERO ? "" : dateId, dateId); + //如果不是昨天立项 + if(!CollectionUtils.isEmpty(projects) && !ifBeforeYesterday) + computerIfExceed(projects,exceedLimit,about2exceedLimit); + + return projects; + } + + @Override + public void computerIfExceed(List list,Integer exceedLimit,Integer about2exceedLimit){ + if(CollectionUtils.isEmpty(list)) return; + Result> costDays = epmetCommonServiceOpenFeignClient.costWorkDays(periodDao.selectProjectNodeStartStopTime(list.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList()))); + if(null != costDays && !CollectionUtils.isEmpty(costDays.getData())){ + //key : projectId + Map> projectPeriodMap + = costDays.getData().stream().collect(Collectors.groupingBy(CostDayResultDTO :: getId)); + list = list.stream().map(o -> { + List days = projectPeriodMap.get(o.getProjectId()); + if(!CollectionUtils.isEmpty(days)){ + Integer max = days.stream().max(Comparator.comparing(CostDayResultDTO::getDetentionDays)).get().getDetentionDays(); + //事件级别 红色1级:已超期;黄色2级:即将超期;绿色3级:未超期 + if(max > exceedLimit) + o.setProjectLevel(NumConstant.ONE); + else if(max >= about2exceedLimit) + o.setProjectLevel(NumConstant.TWO); + } + return o; + }).collect(Collectors.toList()); + } + } + + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java index 35b5bbd577..8f1985b6be 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/ProjectExtractServiceImpl.java @@ -104,6 +104,7 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { closeProjects.forEach(close -> finishOrgList.stream().filter(finish -> close.getId().equals(finish.getProjectId())).forEach(dto -> { String[] orgIds = dto.getPIdPath().split(StrConstant.COLON); String org = ""; + //取最短的ordIds中最后一个 则为最高级的那个orgIds if (orgIds.length > NumConstant.ONE) { org = orgIds[orgIds.length - 1]; } else { @@ -437,11 +438,8 @@ public class ProjectExtractServiceImpl implements ProjectExtractService { formattingData.add(dest); }); if(!CollectionUtils.isEmpty(formattingData)) { - List projectIds = formattingData.stream().map(FactOriginProjectOrgPeriodDailyEntity::getProjectId).distinct().collect(Collectors.toList()); - if (!CollectionUtils.isEmpty(projectIds)) { factOriginProjectOrgPeriodDailyDao.deleteByProjectIds(null,param.getCustomerId()); factOriginProjectOrgPeriodDailyDao.insertBatch(formattingData); - } } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java new file mode 100644 index 0000000000..fe147887b0 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenProjectSettleService.java @@ -0,0 +1,27 @@ +package com.epmet.service.evaluationindex.extract.toscreen; + +import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; + +/** + * @Description + * 给【screen_project_data】 + * 【screen_project_process_attachment】 + * 【screen_project_img_data】 + * 【screen_project_process】这四个表定时整理数据 + * @author wangc + * @date 2021.03.04 13:38 +*/ + +public interface ScreenProjectSettleService { + + + /** + * @Description 抽取项目数据到screen_project_* + * @param param + * @return void + * @author wangc + * @date 2021.03.04 23:09 + */ + void extractScreenData(ScreenCentralZoneDataFormDTO param); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index aa8c4728dc..92bb8def5d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -103,12 +103,12 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { //获取议题月份增量 List issueTotal = factIssueGridMonthlyService.getIssueIncCountAndTotalByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); if (CollectionUtils.isEmpty(issueTotal)) { - log.error("抽取【公众参与-人均议题】,获取议题增量为空,customerId:{}", formDTO.getCustomerId()); + log.error("抽取【公众参与-人均议题】,获取议题增量为空,customerId:{},monthId:{}", formDTO.getCustomerId(),formDTO.getMonthId()); return; } List userCountList = factRegUserGridMonthlyService.selectGridUserCount(formDTO.getCustomerId(), formDTO.getMonthId()); if (CollectionUtils.isEmpty(userCountList)) { - log.error("抽取【公众参与-人均议题】,获取注册用户数为空,customerId:{}", formDTO.getCustomerId()); + log.error("抽取【公众参与-人均议题】,获取注册用户数为空,customerId:{},monthId:{}", formDTO.getCustomerId(),formDTO.getMonthId()); return; } Map userCountMap = userCountList.stream().collect(Collectors.toMap(GridUserCountResultDTO::getOrgId, o -> o)); @@ -143,7 +143,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { //获取每个网格的应表决人数 List memberCountList = factOriginGroupMainDailyService.selectDistinctGroupMemberCount(formDTO.getCustomerId(), ProjectConstant.AGENCY_ID); if (CollectionUtils.isEmpty(memberCountList)) { - log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{}", formDTO.getCustomerId()); + log.warn("抽取【公众参与-人均议题】,获取应表决人数为空,customerId:{},monthId:{}", formDTO.getCustomerId(),formDTO.getMonthId()); return; } gridMemberCount = memberCountList.stream().collect(Collectors.toMap(GridGroupUserCountResultDTO::getOrgId, o -> o.getMemberCount())); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java index 8eda9e93c6..9cdd394e67 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java @@ -11,10 +11,7 @@ import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.service.evaluationindex.extract.toscreen.*; import com.epmet.service.evaluationindex.indexcal.IndexCalculateService; -import com.epmet.service.evaluationindex.screen.ScreenProjectGridDailyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectOrgDailyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityGridMonthlyService; -import com.epmet.service.evaluationindex.screen.ScreenProjectQuantityOrgMonthlyService; +import com.epmet.service.evaluationindex.screen.*; import com.epmet.service.stats.DimCustomerService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -66,6 +63,12 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { private ScreenProjectGridDailyService screenProjectGridDailyService; @Autowired private ScreenProjectOrgDailyService screenProjectOrgDailyService; + @Autowired + private ScreenProjectSettleService screenProjectSettleService; + @Autowired + private ScreenProjectCategoryGridDailyService projectCategoryGridDailyService; + @Autowired + private ScreenProjectCategoryOrgDailyService projectCategoryOrgDailyService; /** * @param extractOriginFormDTO @@ -195,6 +198,25 @@ public class ScreenExtractServiceImpl implements ScreenExtractService { }catch (Exception e){ log.error("项目(事件)分析按组织_按天统计失败,customerId为:"+customerId+"dateId为:"+dateId, e); } + //项目分类打标签未上线,暂时屏蔽 + try{ + //大屏项目数据抽取_按天抽取 + screenProjectSettleService.extractScreenData(param); + }catch (Exception e){ + log.error("大屏项目数据抽取_按天抽取_按天统计失败,customerId为:"+customerId+"dateId为:"+dateId, e); + } + //按天统计:网格内各个分类下的项目总数 + try{ + projectCategoryGridDailyService.extractProjectCategoryData(customerId,dateId); + }catch(Exception e){ + log.error("按天统计:网格内各个分类下的项目总数,customerId为:"+customerId+"dateId为:"+dateId, e); + } + // 按天统计:组织内各个分类下的项目总数 + try{ + projectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId,dateId); + }catch(Exception e){ + log.error("按天统计:组织内各个分类下的项目总数,customerId为:"+customerId+"dateId为:"+dateId, e); + } log.info("===== extractDaily method end ======"); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java index de2149480e..3554743482 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -78,6 +78,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr //2.查询出客户下网格的相关信息 List gridList = customerGridService.queryGridInfoList(param.getCustomerId()); + // list 转 map,以gridId为key,a = gridList,作为value,(o,n)->o 是遇到相同的gridId舍弃,(o,n)->n 是覆盖原来的gridId Map gridMap = gridList.stream().collect(Collectors.toMap(GridInfoDTO :: getGridId,a -> a,(o, n) -> o)); //3.查询出客户下用户的累计积分(累计值,没有时间概念,否则需要查询积分明细计算出评价周期末的得分) @@ -96,7 +97,7 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr } } final String finalDateId = dateId; - + // 查询党员积分 Map scoreMap = cpcIndexCalculateService.getCpcScore(param.getCustomerId(),dateId); //剔除垃圾数据 @@ -155,10 +156,12 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr //最近一次操作 Map latestOperationMap = projectProcessService.getLatestOperation(projectIds,param.getCustomerId()); //图片 - List projectSourceMap = factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds); + List projectSourceMap = difficulties.stream().map(diff->{ + ProjectSourceMapFormDTO map = new ProjectSourceMapFormDTO();map.setProjectId(diff.getEventId());map.setSourceId(diff.getEventImgUrl());return map; + }).collect(Collectors.toList()); + //factOriginProjectMainDailyService.getNewProject(param.getCustomerId(),projectIds); - Map> imgMap = - topicService.getTopicImgs(projectSourceMap); + Map> imgMap = topicService.getTopicImgs(projectSourceMap); Map contentMap = topicService.getTopicContent(projectSourceMap); @@ -183,8 +186,9 @@ public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGr diff.setDataEndTime(DateUtils.getBeforeNDay(NumConstant.ONE)); }); List imgList = new LinkedList<>(); - imgMap.values().forEach(list -> {imgList.addAll(list);}); + imgMap.values().forEach(imgList::addAll); + //立案后会有 一个process 如果没有则说明是垃圾数据 如果有其他方式立项的项目则需要考虑下兼容 difficulties.removeIf( diff -> StringUtils.isBlank(diff.getLatestOperateDesc())); imgList.forEach(item -> { item.setCustomerId(param.getCustomerId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java new file mode 100644 index 0000000000..dfb64dfc01 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java @@ -0,0 +1,167 @@ +package com.epmet.service.evaluationindex.extract.toscreen.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.screen.ScreenProjectImgDataDTO; +import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; +import com.epmet.dto.screen.ScreenProjectProcessDTO; +import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; +import com.epmet.entity.project.ProjectEntity; +import com.epmet.service.Issue.IssueService; +import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService; +import com.epmet.service.evaluationindex.extract.toscreen.ScreenProjectSettleService; +import com.epmet.service.evaluationindex.screen.ScreenProjectDataService; +import com.epmet.service.evaluationindex.screen.ScreenProjectImgDataService; +import com.epmet.service.evaluationindex.screen.ScreenProjectProcessAttachmentService; +import com.epmet.service.evaluationindex.screen.ScreenProjectProcessService; +import com.epmet.service.project.ProjectProcessService; +import com.epmet.service.project.ProjectService; +import com.epmet.service.topic.TopicService; +import com.epmet.service.user.UserService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Description + * @ClassName ScreenProjectSettleServiceImpl + * @Auth wangc + * @Date 2021-03-04 23:10 + */ +@Service +@Slf4j +public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleService { + + + @Autowired + private ScreenProjectDataService targetDbService; + @Autowired + private FactOriginProjectMainDailyService originMainService; + @Autowired + private ProjectService projectService; + @Autowired + private ProjectProcessService processService; + @Autowired + private TopicService topicService; + @Autowired + private UserService userService; + @Autowired + private IssueService issueService; + @Autowired + private ScreenProjectProcessService targetProcessService; + @Autowired + private ScreenProjectImgDataService targetImgService; + @Autowired + private ScreenProjectProcessAttachmentService targetAttachmentService; + + /** + * @Description 抽取项目数据到screen_project_* + * @param param + * @return void + * @author wangc + * @date 2021.03.04 23:09 + */ + @Override + public void extractScreenData(ScreenCentralZoneDataFormDTO param) { + //screen_project_data表是否存在此客户数据 + int rows = targetDbService.checkIfExisted(param.getCustomerId()); + //查找客户项目超期参数 + List exceedParams = projectService.getProjectExceedParams(param.getCustomerId()); + Integer exceedLimit = NumConstant.FIVE; + Integer about2ExceedLimit = NumConstant.FIVE; + + + if(!CollectionUtils.isEmpty(exceedParams)){ + for(ProjectExceedParamsResultDTO ex :exceedParams){ + if(null != ex.getDefaultExceedLimit()){ + exceedLimit = null == ex.getExceedLimit() ? ex.getDefaultExceedLimit() : ex.getExceedLimit(); + } + if(null != ex.getDefaultAbout2ExceedLimit()){ + about2ExceedLimit = null == ex.getAbout2ExceedLimit() ? ex.getDefaultAbout2ExceedLimit() : ex.getDefaultAbout2ExceedLimit(); + } + } + } + //因为即将超期提醒时间(天)就是即将超期期限,在表中存储的是超期前多少天 + //所以这里要换算成滞留日 + about2ExceedLimit = exceedLimit >= about2ExceedLimit ? exceedLimit - about2ExceedLimit : exceedLimit; + List metaData = + originMainService.initNewScreenProjectData(param.getCustomerId(), rows , param.getDateId(),exceedLimit,about2ExceedLimit); + + if(!CollectionUtils.isEmpty(metaData)) { + // 查询项目信息 + List info = projectService.getProjectInfo(metaData.stream().map(ScreenProjectDataDTO::getProjectId).collect(Collectors.toList())); + if(!CollectionUtils.isEmpty(info)){ + metaData = metaData.stream().flatMap(meta -> info.stream().filter(nature -> StringUtils.equals(meta.getProjectId(), + nature.getId())).map(projectInfo -> { + meta.setProjectCreateTime(projectInfo.getCreatedTime()); + meta.setProjectTitle(projectInfo.getTitle()); + return meta; + })).collect(Collectors.toList()); + } + topicService.fillScreenProjectData(metaData); + //metaData = Optional.ofNullable(topicService.getScreenProjectData(metaData)).orElse(metaData); + userService.fillScreenProjectData(metaData); + //metaData = Optional.ofNullable(userService.getScreenProjectData(metaData)).orElse(metaData); + } + + ScreenProjectDataDTO orientCase = new ScreenProjectDataDTO(); + orientCase.setCustomerId(param.getCustomerId()); + //待更新的数据 需要检测更新的字段为:①projectStatusCode ②closeCaseTime ③allCategoryName ④projectLevel + List orientData = + targetDbService.getPending(orientCase,param.getDateId()); + + // 给metaData和orientData赋上分类信息 + List projectIds = + Optional.ofNullable(metaData.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList())).orElse(new ArrayList<>()); + if(!CollectionUtils.isEmpty(orientData)) + projectIds.addAll(orientData.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList())); + Map> categoryMap = projectService.getProjectCategory(projectIds); + if(!CollectionUtils.isEmpty(categoryMap)){ + Map integratedProjectCategoryMap = issueService.getIntegratedProjectCategory(categoryMap, param.getCustomerId()); + if(!CollectionUtils.isEmpty(integratedProjectCategoryMap)){ + metaData.forEach(meta -> { + meta.setAllCategoryName(integratedProjectCategoryMap.get(meta.getProjectId())); + }); + orientData.forEach(orient -> { + orient.setAllCategoryName(integratedProjectCategoryMap.get(orient.getProjectId())); + }); + } + } + + //重新计算orientData的级别 有现成的方法 fact_origin_project_org_period_daily + originMainService.computerIfExceed(orientData, exceedLimit,about2ExceedLimit); + processService.updateProjectCloseTime(metaData); + //更新结案时间和结案状态 + processService.updateProjectStatus(orientData,param.getDateId(),param.getCustomerId()); + + targetDbService.insertOrUpdateBatch(param.getCustomerId(),param.getDateId(),metaData,orientData); + + if(!CollectionUtils.isEmpty(metaData)){ + List imgs = topicService.buildNewScreenProjectImgData(metaData); + if(!CollectionUtils.isEmpty(imgs)){ + + targetImgService.insertBatch(imgs); + } + } + + // + List processes = processService.buildNewScreenProjectProcessData(param.getCustomerId(), param.getDateId(),!targetProcessService.checkIfHistoricalDataExists(param.getCustomerId())); + if(!CollectionUtils.isEmpty(processes)){ + targetProcessService.insertBatch(processes,param.getCustomerId(),param.getDateId()); + List attachments = processService.buildProcessAttachmentData(processes.stream().map(ScreenProjectProcessDTO::getProcessId).distinct().collect(Collectors.toList())); + if(!CollectionUtils.isEmpty(attachments)){ + + targetAttachmentService.insertBatch(attachments); + } + } + + + } + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateService.java index 4e7c074a57..d5d41e48a3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateService.java @@ -1,6 +1,7 @@ package com.epmet.service.evaluationindex.indexcal; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.dto.indexcal.CustomerSubInfoDTO; import com.epmet.dto.indexcal.IndexStatisticsFormDTO; /** @@ -19,4 +20,14 @@ public interface IndexCalculateService { Boolean indexCalculate(CalculateCommonFormDTO formDTO); Boolean indexStatistics(IndexStatisticsFormDTO formDTO); + + /** + * @return void + * @param formDTO + * @description 单独将分数插入screen_index_data_monthly,screen_index_data_yearly + * @Date 2021/3/4 18:54 + **/ + void toScreenIndexData(CalculateCommonFormDTO formDTO); + + CustomerSubInfoDTO getCustomerSubInfo(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java index 8c03bf53f5..693f02c50d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.IndexCalConstant; import com.epmet.constant.ProjectConstant; +import com.epmet.constant.ScreenConstant; import com.epmet.dao.evaluationindex.indexcal.CommunityScoreDao; import com.epmet.dao.evaluationindex.indexcal.CommunitySelfSubScoreDao; import com.epmet.dao.evaluationindex.indexcal.CommunitySubScoreDao; @@ -628,7 +629,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni } } else { // 社区名义发文数量 - List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapbyAreaCode( form.getMonthId(),form.getCustomerAreaCode()); + List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapbyAreaCodeNotSelf( form.getMonthId(),form.getCustomerAreaCode()); if (CollectionUtils.isEmpty(publishArticleCountList)) { log.warn(IndexCalConstant.COMMUNITY_PUBLISH_ARTICLE_LIST_NULL); } else { @@ -702,7 +703,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni } } else { // 治理能力的六个五级指标 - List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityExistsSub(form.getMonthId(),form.getCustomerAreaCode()); + List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityExistsSubNotSelf(form.getMonthId(),form.getCustomerAreaCode(), ScreenConstant.COMMUNITY); if (CollectionUtils.isEmpty(communityGovernAbility)){ log.warn(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL); }else{ @@ -774,7 +775,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni }); } } else { - List> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapExistsSub(form.getMonthId(),form.getCustomerAreaCode()); + List> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapExistsSubNotSelf(form.getMonthId(),form.getCustomerAreaCode()); if (CollectionUtils.isEmpty(communityActivityCountList)) { log.warn(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL); }else{ @@ -819,7 +820,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni String customerId = form.getCustomerId(); String monthId = form.getMonthId(); List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(form.getCustomerId(), IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); - List factIndexCommunityScoreEntities = factIndexCommunityScoreDao.selectCommunityInfoExistsSub(form.getCustomerAreaCode(),form.getMonthId()); + List factIndexCommunityScoreEntities = factIndexCommunityScoreDao.selectCommunityInfoExistsSub(form.getCustomerAreaCode(),form.getMonthId(),form.getCustomerId()); detailListByParentCode.forEach(detail -> { factIndexCommunityScoreEntities.forEach(community -> { if (detail.getIndexCode().equals(community.getIndexCode())) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index 592c114fd4..9c3328f6ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -23,6 +23,7 @@ import com.epmet.dto.indexcal.AgencyCalResultDTO; import com.epmet.dto.indexcal.AgencyScoreDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; +import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.AgencySubScoreEntity; @@ -225,6 +226,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict indexDetailList.forEach(detail -> { if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); + log.info("subGridPartyAvgScore:::"+subGridPartyAvgScore.toString()); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { log.warn(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { @@ -247,6 +249,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } else { // 区名义发文数量 List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.DISTRICT_LEVEL); + log.info("publishArticleCountList:::"+publishArticleCountList.toString()); if (CollectionUtils.isEmpty(publishArticleCountList)) { log.warn(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL); } else { @@ -301,6 +304,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict detailListByParentCode.forEach(detail -> { if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) { List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); + log.info("districtGovernAvgList:::"+districtGovernAvgList.toString()); for (int i = 0; i < districtGovernAvgList.size(); i++) { if (districtGovernAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ districtGovernAvgList.remove(districtGovernAvgList.get(i)); @@ -327,6 +331,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } } else if (IndexCodeEnum.SUO_YOU_ZHI_SHU_BMZLNLPJZ.getCode().equals(detail.getIndexCode())){ List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); + log.info("deptScoreAvgList:::"+deptScoreAvgList.toString()); for (int i = 0; i < deptScoreAvgList.size(); i++) { if (deptScoreAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ deptScoreAvgList.remove(deptScoreAvgList.get(i)); @@ -381,6 +386,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict String indexCode = detail.getIndexCode(); if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) { List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL); + log.info("subStreetAvgList:::"+subStreetAvgList.toString()); for (int i = 0; i < subStreetAvgList.size(); i++) { if (subStreetAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ subStreetAvgList.remove(subStreetAvgList.get(i)); @@ -430,6 +436,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict public Boolean districtRelate(String customerId, String monthId) { List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); List agencyScoreList = agencyScoreDao.selectAgencyScoreInfo(customerId, monthId, IndexCalConstant.DISTRICT_LEVEL); + log.info("agencyScoreList:::"+agencyScoreList.toString()); detailListByParentCode.forEach(detail -> { agencyScoreList.forEach(community -> { if (detail.getIndexCode().equals(community.getIndexCode())) { @@ -607,7 +614,8 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict //党建能力平均值 indexDetailList.forEach(detail -> { if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { - List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); + List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),form.getCustomerAreaCode()); + log.info("subGridPartyAvgScore:::"+subGridPartyAvgScore.toString()); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { log.warn(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { @@ -620,6 +628,10 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict pid.put(c.getParentId(), customerAgencyDao.selectPid(c.getParentId())); SampleValue s = new SampleValue(c.getParentId(), c.getScore()); index1SampleValues.add(s); + }else { + pid.put(c.getAgencyId(), customerAgencyDao.selectPid(c.getAgencyId())); + SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + index1SampleValues.add(s); } }); BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); @@ -629,7 +641,8 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } } else { // 区名义发文数量 - List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode(),NumConstant.SIX); + List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSubNotSelf(monthId,form.getCustomerAreaCode()); + log.info("publishArticleCountList:::"+publishArticleCountList.toString()); if (CollectionUtils.isEmpty(publishArticleCountList)) { log.warn(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL); } else { @@ -684,7 +697,8 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict Map pid = new HashMap<>(); detailListByParentCode.forEach(detail -> { if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) { - List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); + List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); + log.info("districtGovernAvgList:::"+districtGovernAvgList.toString()); for (int i = 0; i < districtGovernAvgList.size(); i++) { if (districtGovernAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ districtGovernAvgList.remove(districtGovernAvgList.get(i)); @@ -702,6 +716,10 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict pid.put(c.getParentId(), customerAgencyDao.selectPid(c.getParentId())); SampleValue s = new SampleValue(c.getParentId(), c.getScore()); index1SampleValues.add(s); + }else { + pid.put(c.getAgencyId(), customerAgencyDao.selectPid(c.getAgencyId())); + SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + index1SampleValues.add(s); } }); BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); @@ -710,7 +728,8 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict }); } } else if (IndexCodeEnum.SUO_YOU_ZHI_SHU_BMZLNLPJZ.getCode().equals(detail.getIndexCode())){ - List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); + List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSubNotSelf(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); + log.info("deptScoreAvgList:::"+deptScoreAvgList.toString()); for (int i = 0; i < deptScoreAvgList.size(); i++) { if (deptScoreAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ deptScoreAvgList.remove(deptScoreAvgList.get(i)); @@ -765,7 +784,8 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict detailListByParentCode.forEach(detail -> { String indexCode = detail.getIndexCode(); if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) { - List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); + List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),form.getCustomerAreaCode()); + log.info("subStreetAvgList:::"+subStreetAvgList.toString()); for (int i = 0; i < subStreetAvgList.size(); i++) { if (subStreetAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ subStreetAvgList.remove(subStreetAvgList.get(i)); @@ -784,6 +804,10 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict pid.put(c.getParentId(), customerAgencyDao.selectPid(c.getParentId())); SampleValue s = new SampleValue(c.getParentId(), c.getScore()); index1SampleValues.add(s); + }else { + pid.put(c.getAgencyId(), customerAgencyDao.selectPid(c.getAgencyId())); + SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + index1SampleValues.add(s); } }); IndexInputVO index1VO = new IndexInputVO(detail.getIndexCode(), detail.getAllParentIndexCode(), index1SampleValues, detail.getThreshold(), detail.getWeight(), IndexCodeEnum.isAvgIndex(detail.getIndexCode()), sc1); @@ -815,7 +839,8 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict String customerId = form.getCustomerId(); String monthId = form.getMonthId(); List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); - List agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(),NumConstant.SIX,monthId, IndexCalConstant.DISTRICT_LEVEL); + List agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSubSelf(form.getCustomerAreaCode(),monthId, IndexCalConstant.DISTRICT_LEVEL,form.getCustomerId()); + log.info("agencyScoreList:::"+agencyScoreList.toString()); detailListByParentCode.forEach(detail -> { agencyScoreList.forEach(community -> { if (detail.getIndexCode().equals(community.getIndexCode())) { @@ -843,6 +868,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict }); result.add(score); }); + log.info("result:::"+result.toString()); if (!CollectionUtils.isEmpty(result)){ agencyScoreDao.insertStreetRecord(result); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java index d517fd70ec..01d7f5d581 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java @@ -28,7 +28,6 @@ import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.Map; /** * @author liujianjun @@ -83,18 +82,17 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { customerIds.add(formDTO.getCustomerId()); } - //查询客户编码、以及下一级客户列表 add01.14 - Map customerInfoMap=this.getCustomerInfoMap(customerIds); Boolean flag = false; for (String customerId : customerIds) { CalculateCommonFormDTO param = new CalculateCommonFormDTO(); param.setCustomerId(customerId); param.setMonthId(formDTO.getMonthId()); - //01.14 add - if (!customerInfoMap.isEmpty() && null != customerInfoMap.get(customerId)) { - param.setCustomerAreaCode(customerInfoMap.get(customerId).getCustomerAreaCode()); - param.setSubCustomerIds(customerInfoMap.get(customerId).getSubCustomerIds()); + //01.14 add 查询客户编码、以及下一级客户列表 + CustomerSubInfoDTO customerSubInfoDTO=this.getCustomerSubInfo(customerId); + if (null != customerSubInfoDTO) { + param.setCustomerAreaCode(customerSubInfoDTO.getCustomerAreaCode()); + param.setSubCustomerIds(customerSubInfoDTO.getSubCustomerIds()); } flag = calulateCustomerIndexScore(param); } @@ -159,7 +157,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { log.error("indexCalculate calStreetAll exception", e); } - //计算区直属 + //计算部门相关 start = System.currentTimeMillis(); try { flag = deptScoreService.calculateDeptCorreLation(formDTO); @@ -202,13 +200,14 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { } /** - * @param customerIds + * @param customerId * @author yinzuomei * @description 查询当前客户的area_code信息、以及下一级客户列表 * @Date 2021/1/21 11:28 **/ - private Map getCustomerInfoMap(List customerIds) { - return customerRelationService.getCustomerInfoMap(customerIds); + @Override + public CustomerSubInfoDTO getCustomerSubInfo(String customerId) { + return customerRelationService.getCustomerSubInfo(customerId); } @Async @@ -246,4 +245,24 @@ public class IndexCalculateServiceImpl implements IndexCalculateService { }); return true; } + + /** + * @param formDTO + * @return void + * @description 单独将分数插入screen_index_data_monthly, screen_index_data_yearly + * @Date 2021/3/4 18:54 + **/ + @Override + public void toScreenIndexData(CalculateCommonFormDTO formDTO) { + //查询客户编码、以及下一级客户列表 add01.14 + CustomerSubInfoDTO customerSubInfoDTO = this.getCustomerSubInfo(formDTO.getCustomerId()); + log.info("customerInfoMap: " + JSON.toJSONString(customerSubInfoDTO, true)); + //01.14 add + if (null != customerSubInfoDTO) { + formDTO.setCustomerAreaCode(customerSubInfoDTO.getCustomerAreaCode()); + formDTO.setSubCustomerIds(customerSubInfoDTO.getSubCustomerIds()); + } + log.info("入参: " + JSON.toJSONString(formDTO, true)); + factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index c2d488ea41..8c0bcf7484 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -8,10 +8,7 @@ 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.DateUtils; -import com.epmet.constant.DataSourceConstant; -import com.epmet.constant.IndexCalConstant; -import com.epmet.constant.OrgTypeConstant; -import com.epmet.constant.ProjectConstant; +import com.epmet.constant.*; import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao; import com.epmet.dao.evaluationindex.indexcal.AgencySelfSubScoreDao; import com.epmet.dao.evaluationindex.indexcal.AgencySubScoreDao; @@ -20,10 +17,12 @@ import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyDao import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityOrgMonthlyDao; import com.epmet.dao.evaluationindex.screen.IndexGroupDetailDao; +import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dto.indexcal.AgencyCalResultDTO; import com.epmet.dto.indexcal.AgencyScoreDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.SubCommunityAvgResultDTO; +import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.AgencySubScoreEntity; @@ -49,6 +48,7 @@ import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; /** @@ -80,6 +80,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ private IndexGroupDetailDao indexGroupDetailDao; @Autowired private AgencySelfSubScoreDao agencySelfSubScoreDao; + @Autowired + private ScreenCustomerAgencyDao customerAgencyDao; /** * @param form @@ -613,7 +615,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ //下属所有社区的党建能力平均值 detailListByParentCode.forEach(detail -> { if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { - List subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScoreExistSub(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),form.getCustomerAreaCode()); + List dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),form.getCustomerAreaCode()); + List subCommPartyAvgScore = disposeSubAvg(dispose, form); if (CollectionUtils.isEmpty(subCommPartyAvgScore)) { log.warn(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL); } else if (subCommPartyAvgScore.size() > NumConstant.ZERO) { @@ -623,6 +626,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ partition.forEach(publish -> { List index1SampleValues = new ArrayList<>(); publish.forEach(c -> { + c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); @@ -634,7 +638,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ } } else { // 街道名义发文数量 - List> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode(),NumConstant.NINE); + List> mapList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSubStreet(monthId,form.getCustomerAreaCode()); if (CollectionUtils.isEmpty(mapList)) { log.warn(IndexCalConstant.STREET_PUBLISH_ARTICLE_LIST_NULL); } else { @@ -688,7 +692,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ Map pid = new HashMap<>(); detailListByParentCode.forEach(detail -> { if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQZLNLHZ.getCode().equals(detail.getIndexCode())) { - List subGridGovernAvg = communityScoreDao.selectSubCommAvgScoreExistSub(monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); + List dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); + List subGridGovernAvg = disposeSubAvg(dispose,form); if (CollectionUtils.isEmpty(subGridGovernAvg)){ log.warn("查询街道下属所有社区治理能力汇总为空"); }else if (subGridGovernAvg.size() > NumConstant.ZERO) { @@ -697,6 +702,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ governAvg.forEach(avg -> { List index1SampleValues = new ArrayList<>(); avg.forEach(c -> { + c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); @@ -708,7 +714,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ } } else { // 治理能力的六个五级指标 - List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityExistsSub(monthId,form.getCustomerAreaCode()); + List> communityGovernAbility = disposeFiveLevel(form); if (CollectionUtils.isEmpty(communityGovernAbility)){ log.warn(IndexCalConstant.STREET_GOVERN_ABILITY_NULL); }else{ @@ -762,7 +768,8 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ detailListByParentCode.forEach(detail -> { String indexCode = detail.getIndexCode(); if (IndexCodeEnum.JIE_DAO_XIA_SHU_SQFWNLDFPYZ.getCode().equals(indexCode)) { - List subCommServiceAvg = communityScoreDao.selectSubCommAvgScoreExistSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),form.getCustomerAreaCode()); + List dispose = communityScoreDao.selectSubCommAvgScoreExistSubNotSelf(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),form.getCustomerAreaCode()); + List subCommServiceAvg = disposeSubAvg(dispose,form); if (CollectionUtils.isEmpty(subCommServiceAvg)) { log.warn("查询街道下属社区服务能力得分平均值为空"); } else if (subCommServiceAvg.size() > NumConstant.ZERO) { @@ -772,6 +779,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); List index1SampleValues = new ArrayList<>(); serviceAvg.forEach(c -> { + c.setParentId(customerAgencyDao.selectAgencyId(form.getCustomerAreaCode())); pid.put(c.getAgencyId(),c.getParentId()); SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); index1SampleValues.add(s); @@ -781,7 +789,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ }); } } else { - List> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapExistsSub(monthId,form.getCustomerAreaCode()); + List> communityActivityCountList = disposeActivityCount(form); if (CollectionUtils.isEmpty(communityActivityCountList)) { log.warn(IndexCalConstant.STREET_SERVICE_ABILITY_NULL); }else{ @@ -826,7 +834,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ String customerId = form.getCustomerId(); String monthId = form.getMonthId(); List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); - List agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(), NumConstant.NINE, monthId, IndexCalConstant.STREET_LEVEL); + List agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(), monthId, IndexCalConstant.STREET_LEVEL,form.getCustomerId()); detailListByParentCode.forEach(detail -> { agencyScoreList.forEach(community -> { if (detail.getIndexCode().equals(community.getIndexCode())) { @@ -860,4 +868,77 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ return true; } + public List disposeSubAvg(List avgScore, CalculateCommonFormDTO formDTO){ + List orgIds = customerAgencyDao.selectAgencyByParentAreaCode(formDTO.getCustomerAreaCode()); + List subAvgScores = new ArrayList<>(); + orgIds.forEach(org -> { + SubCommunityAvgResultDTO s = new SubCommunityAvgResultDTO(); + s.setAgencyId(org.getOrgId()); + subAvgScores.add(s); + }); + subAvgScores.forEach(subScore -> { + if (!CollectionUtils.isEmpty(avgScore)){ + avgScore.forEach(avg -> { + if (subScore.getAgencyId().equals(avg.getParentId())){ + subScore.setScore(avg.getScore()); + avg.setScoreStatus(true); + } + }); + } + }); + Map> groupByStatus = avgScore.stream().collect(Collectors.groupingBy(SubCommunityAvgResultDTO::getScoreStatus)); + List subAvgResultDTOS = groupByStatus.get(false); + if (!CollectionUtils.isEmpty(subAvgResultDTOS)){ + AtomicReference finalScore = new AtomicReference<>(new BigDecimal(NumConstant.ZERO)); + subAvgResultDTOS.forEach(sub -> { + finalScore.set(finalScore.get().add(sub.getScore())); + }); + BigDecimal divide = finalScore.get().divide(new BigDecimal(subAvgResultDTOS.size()),NumConstant.SIX,BigDecimal.ROUND_HALF_UP); + subAvgScores.forEach(s -> { + // 孔村单独处理 + if (s.getAgencyId().equals("1234085031077498881")){ + s.setScore(divide); + } + }); + } + return subAvgScores; + } + + public List> disposeFiveLevel(CalculateCommonFormDTO formDTO){ + List> result = new ArrayList<>(); + List> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityExistsSubNotSelf(formDTO.getMonthId(),formDTO.getCustomerAreaCode(), ScreenConstant.STREET); + List> kongCunGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbilityIsKongCun(formDTO.getMonthId(),formDTO.getCustomerAreaCode()); + if (!CollectionUtils.isEmpty(kongCunGovernAbility)){ + kongCunGovernAbility.forEach(k -> { + k.put("AGENCY_ID",k.get("PARENT_ID")); + k.put("PARENT_ID",NumConstant.ZERO_STR); + }); + } + if (!CollectionUtils.isEmpty(communityGovernAbility)){ + result.addAll(communityGovernAbility); + } + if (!CollectionUtils.isEmpty(kongCunGovernAbility)){ + result.addAll(kongCunGovernAbility); + } + return result; + } + + public List> disposeActivityCount(CalculateCommonFormDTO formDTO){ + List> result = new ArrayList<>(); + List> ActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapExistsSub(formDTO.getMonthId(),formDTO.getCustomerAreaCode()); + List> kongCunActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMapIsKongCun(formDTO.getMonthId(),formDTO.getCustomerAreaCode()); + if (!CollectionUtils.isEmpty(kongCunActivityCountList)){ + kongCunActivityCountList.forEach(k -> { + k.put("AGENCY_ID",k.get("PARENT_ID")); + k.put("PARENT_ID",NumConstant.ZERO_STR); + }); + } + if (!CollectionUtils.isEmpty(ActivityCountList)){ + result.addAll(ActivityCountList); + } + if (!CollectionUtils.isEmpty(kongCunActivityCountList)){ + result.addAll(kongCunActivityCountList); + } + return result; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index a117021b91..7df7c2920d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -518,7 +518,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { } } if ("".equals(agencyName)) { - log.error("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + communityScore.getKey()); + log.error("1)在screen_customer_agency表中未查询到该客户下的组织名称:当前计算的customerId =" + customerId + ", agencyId = " + communityScore.getKey()); continue; } // 补充表中其他字段 @@ -753,7 +753,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { } } if ("".equals(agencyName)) { - log.error("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + agencyScore.getKey()); + log.error("2)在screen_customer_agency表中未查询到该客户下的组织名称:当前计算的customerId =" + customerId + ", agencyId = " + agencyScore.getKey()); continue; } // 补充表中其他字段 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/AnScreenCollService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/AnScreenCollService.java index 15a9d72a35..a347d5286d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/AnScreenCollService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/AnScreenCollService.java @@ -17,7 +17,7 @@ public interface AnScreenCollService { * @author wangc * @date 2020.10.09 16:41 */ - void communityProjectProfile(ScreenCollFormDTO formDTO,String customerId); + void communityProjectProfile(ScreenCollFormDTO formDTO); /** * @Description 安宁大屏数据采集 - 基层党员-党员排行榜单 @@ -27,7 +27,7 @@ public interface AnScreenCollService { * @author wangc * @date 2020.10.09 17:19 */ - void pmRank(ScreenCollFormDTO formDTO,String customerId); + void pmRank(ScreenCollFormDTO formDTO); /** * @Description 安宁大屏数据采集 - 基层党员-各类总数 @@ -37,7 +37,7 @@ public interface AnScreenCollService { * @author wangc * @date 2020.10.09 17:20 */ - void pmTotal(ScreenCollFormDTO formDTO,String customerId); + void pmTotal(ScreenCollFormDTO formDTO); /** * @Description 安宁大屏数据采集 - 基层组织(党群数|议题数|项目数)-按月 @@ -46,7 +46,7 @@ public interface AnScreenCollService { * @author wangc * @date 2020.10.09 17:22 */ - void grassrootsOrg(ScreenCollFormDTO formDTO,String customerId); + void grassrootsOrg(ScreenCollFormDTO formDTO); /** * @Description 安宁大屏数据采集 - 基层治理-各类数 @@ -55,5 +55,5 @@ public interface AnScreenCollService { * @author wangc * @date 2020.10.09 17:23 */ - void grassrootsGovern(ScreenCollFormDTO formDTO,String customerId); + void grassrootsGovern(ScreenCollFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/KcScreenCollService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/KcScreenCollService.java index 492a951156..5eaca5388c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/KcScreenCollService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/KcScreenCollService.java @@ -17,12 +17,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertPlatFormSummary(ScreenCollFormDTO formDTO, String customerId); + void insertPlatFormSummary(ScreenCollFormDTO formDTO); /** * 2、议题分析-各类总数 @@ -30,12 +29,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertIssueSummary(ScreenCollFormDTO formDTO, String customerId); + void insertIssueSummary(ScreenCollFormDTO formDTO); /** * 3、议题分析-参与趋势 @@ -43,12 +41,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertIssueTrend(ScreenCollFormDTO formDTO, String customerId); + void insertIssueTrend(ScreenCollFormDTO formDTO); /** * 4、用户分析-各类总数 @@ -56,12 +53,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertUserSummary(ScreenCollFormDTO formDTO, String customerId); + void insertUserSummary(ScreenCollFormDTO formDTO); /** * 5、公益互助-志愿者公益时长排名 @@ -69,12 +65,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertVolunteerHeartRank(ScreenCollFormDTO formDTO, String customerId); + void insertVolunteerHeartRank(ScreenCollFormDTO formDTO); /** * 6、用户分析-用户趋势 @@ -82,12 +77,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertUserHeartRank(ScreenCollFormDTO formDTO, String customerId); + void insertUserHeartRank(ScreenCollFormDTO formDTO); /** * 7、公益互助-活动各类总数 @@ -95,12 +89,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertActSummary(ScreenCollFormDTO formDTO, String customerId); + void insertActSummary(ScreenCollFormDTO formDTO); /** * 8、公益互助-活动次数趋势 @@ -108,12 +101,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertActTrend(ScreenCollFormDTO formDTO, String customerId); + void insertActTrend(ScreenCollFormDTO formDTO); /** * 9、公益互助-志愿者画像 @@ -121,12 +113,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertVolunteerSummary(ScreenCollFormDTO formDTO, String customerId); + void insertVolunteerSummary(ScreenCollFormDTO formDTO); /** * 10、项目分析-各类总数 @@ -134,12 +125,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertProjectSummary(ScreenCollFormDTO formDTO, String customerId); + void insertProjectSummary(ScreenCollFormDTO formDTO); /** * 11、项目分析-按分类统计 @@ -147,12 +137,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertCategorySummary(ScreenCollFormDTO formDTO, String customerId); + void insertCategorySummary(ScreenCollFormDTO formDTO); /** * 12、项目分析-满意度分析 @@ -160,12 +149,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertProjectSatisanalysis(ScreenCollFormDTO formDTO, String customerId); + void insertProjectSatisanalysis(ScreenCollFormDTO formDTO); /** * 13、党建声音-新闻各类总数汇总 @@ -173,12 +161,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertNewsSummary(ScreenCollFormDTO formDTO, String customerId); + void insertNewsSummary(ScreenCollFormDTO formDTO); /** * 14、党建声音-新闻阅读参与趋势 @@ -186,12 +173,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertNewsTrend(ScreenCollFormDTO formDTO, String customerId); + void insertNewsTrend(ScreenCollFormDTO formDTO); /** * 15、党建声音-热度新闻排行 @@ -199,12 +185,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertNewsHotRank(ScreenCollFormDTO formDTO, String customerId); + void insertNewsHotRank(ScreenCollFormDTO formDTO); /** * 16、党建声音-新闻按类别统计 @@ -212,12 +197,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertNewsCategoryAnalysis(ScreenCollFormDTO formDTO, String customerId); + void insertNewsCategoryAnalysis(ScreenCollFormDTO formDTO); /** * 17、邻里党群-各类总数汇总 @@ -225,12 +209,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertGroupSummary(ScreenCollFormDTO formDTO, String customerId); + void insertGroupSummary(ScreenCollFormDTO formDTO); /** * 18、邻里党群-小组详情 @@ -238,12 +221,11 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertGroupDetail(ScreenCollFormDTO formDTO, String customerId); + void insertGroupDetail(ScreenCollFormDTO formDTO); /** * 19、邻里党群-话题参与趋势 @@ -251,10 +233,9 @@ public interface KcScreenCollService { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * * @param formDTO - * @param customerId * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - void insertGroupTopicTrend(ScreenCollFormDTO formDTO, String customerId); + void insertGroupTopicTrend(ScreenCollFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java index 3d2fc7a15a..ef39e1b781 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java @@ -19,6 +19,7 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; @@ -92,4 +93,13 @@ public interface ScreenCustomerGridService extends BaseService selectBelongGridInfo(String customerId,String level); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridDailyService.java index 5306e7f73b..4fcb249db1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridDailyService.java @@ -98,9 +98,18 @@ public interface ScreenProjectCategoryGridDailyService extends BaseService param); + void collect(ScreenCollFormDTO param); + + /** + * @return void + * @param customerId + * @param dateId + * @author yinzuomei + * @description 产品内部计算:网格内按分类统计项目数量 + * @Date 2021/3/22 16:46 + **/ + void extractProjectCategoryData(String customerId, String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java index 005232d59a..150c15a0d4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryOrgDailyService.java @@ -98,9 +98,17 @@ public interface ScreenProjectCategoryOrgDailyService extends BaseService param); + void collect(ScreenCollFormDTO param); + + /** + * @Description 按组织计算分类统计项目数量 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/3/23 上午10:07 + */ + void extractProjectCategoryOrgData(String customerId, String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java index 82d296a1a3..b6f2c25c15 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java @@ -95,5 +95,33 @@ public interface ScreenProjectDataService extends BaseService param); + void collect(ScreenCollFormDTO param); + + + /** + * @Description 查询是否存在客户的数据 + * @param customerId + * @return int + * @author wangc + * @date 2021.03.04 23:35 + */ + int checkIfExisted(String customerId); + + /** + * @Description 获取客户下已经入库而且未结案的数据集 + * @param + * @return + * @author wangc + * @date 2021.03.08 09:32 + */ + List getPending(ScreenProjectDataDTO param,String dateId); + + /** + * @Description collect或更新 + * @param + * @return void + * @author wangc + * @date 2021.03.09 17:36 + */ + void insertOrUpdateBatch(String customerId,String dateId,List meta,List orient); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectGridDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectGridDailyService.java index 2b710cefb3..7702f0cfd1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectGridDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectGridDailyService.java @@ -96,13 +96,12 @@ public interface ScreenProjectGridDailyService extends BaseService data); + void collect(ScreenCollFormDTO data); /** * @Description 数据抽取【网格-日】 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectImgDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectImgDataService.java index eba2c666d8..fb170d618d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectImgDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectImgDataService.java @@ -93,4 +93,6 @@ public interface ScreenProjectImgDataService extends BaseService list); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectOrgDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectOrgDailyService.java index 587a6eef72..ee1f4bf1e7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectOrgDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectOrgDailyService.java @@ -96,13 +96,12 @@ public interface ScreenProjectOrgDailyService extends BaseService data); + void collect(ScreenCollFormDTO data); /** * @Description 数据抽取【机关-日】 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectProcessAttachmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectProcessAttachmentService.java index de086e33a2..44289bdfc7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectProcessAttachmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectProcessAttachmentService.java @@ -92,4 +92,6 @@ public interface ScreenProjectProcessAttachmentService extends BaseService list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectProcessService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectProcessService.java index f4b050fe13..62be8b8746 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectProcessService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectProcessService.java @@ -95,5 +95,9 @@ public interface ScreenProjectProcessService extends BaseService param); + void collect(ScreenCollFormDTO param); + + boolean checkIfHistoricalDataExists(String customerId); + + void insertBatch(List list,String customerId,String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectQuantityGridMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectQuantityGridMonthlyService.java index 6d5e5b909d..da29112ad7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectQuantityGridMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectQuantityGridMonthlyService.java @@ -95,13 +95,12 @@ public interface ScreenProjectQuantityGridMonthlyService extends BaseService data); + void collect(ScreenCollFormDTO data); /** * @Description 数据抽取 【网格-月】 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyService.java index 88c451bcfc..6088a6dba4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectQuantityOrgMonthlyService.java @@ -96,13 +96,12 @@ public interface ScreenProjectQuantityOrgMonthlyService extends BaseService data); + void collect(ScreenCollFormDTO data); /** * @Description 数据抽取【组织-月】 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/AnScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/AnScreenCollServiceImpl.java index e5229f146b..30adab1c63 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/AnScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/AnScreenCollServiceImpl.java @@ -4,11 +4,7 @@ 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.dao.evaluationindex.screen.ScreenAnCommunityProjectProfileDao; -import com.epmet.dao.evaluationindex.screen.ScreenAnGrassRootsGovernMonthlyDao; -import com.epmet.dao.evaluationindex.screen.ScreenAnGrassRootsOrgMonthlyDao; -import com.epmet.dao.evaluationindex.screen.ScreenAnGrassRootsPmRankDao; -import com.epmet.dao.evaluationindex.screen.ScreenAnGrassRootsPmTotalMonthlyDao; +import com.epmet.dao.evaluationindex.screen.*; import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.dto.screencoll.form.*; import com.epmet.service.evaluationindex.screen.AnScreenCollService; @@ -17,10 +13,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; - - -import java.util.List; /** @@ -56,17 +48,17 @@ public class AnScreenCollServiceImpl implements AnScreenCollService { */ @Override @Transactional(rollbackFor = Exception.class) - public void communityProjectProfile(ScreenCollFormDTO formDTO,String customerId) { - List dataList = formDTO.getDataList(); - if(CollectionUtils.isEmpty(dataList)) return ; + public void communityProjectProfile(ScreenCollFormDTO formDTO) { + /*List dataList = formDTO.getDataList(); + if(CollectionUtils.isEmpty(dataList)) return ;*/ if(formDTO.getIsFirst()){ - int affectRows = communityProjectProfileDao.deleteBatch(customerId); + int affectRows = communityProjectProfileDao.deleteBatch(formDTO.getCustomerId()); while(affectRows >= NumConstant.ONE){ - affectRows = communityProjectProfileDao.deleteBatch(customerId); + affectRows = communityProjectProfileDao.deleteBatch(formDTO.getCustomerId()); } } Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> { - communityProjectProfileDao.insertBatch(list,customerId); + communityProjectProfileDao.insertBatch(list,formDTO.getCustomerId()); }); } @@ -81,17 +73,17 @@ public class AnScreenCollServiceImpl implements AnScreenCollService { */ @Override @Transactional(rollbackFor = Exception.class) - public void pmRank(ScreenCollFormDTO formDTO,String customerId) { - List dataList = formDTO.getDataList(); - if(CollectionUtils.isEmpty(dataList)) return ; + public void pmRank(ScreenCollFormDTO formDTO) { + /*List dataList = formDTO.getDataList(); + if(CollectionUtils.isEmpty(dataList)) return ;*/ if(formDTO.getIsFirst()){ - int affectRows = pmRankDao.deleteBatch(customerId,formDTO.getMonthId()); + int affectRows = pmRankDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId()); while(affectRows >= NumConstant.ONE){ - affectRows = pmRankDao.deleteBatch(customerId,formDTO.getMonthId()); + affectRows = pmRankDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId()); } } Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> { - pmRankDao.insertBatch(list,customerId); + pmRankDao.insertBatch(list,formDTO.getCustomerId()); }); } @@ -105,21 +97,21 @@ public class AnScreenCollServiceImpl implements AnScreenCollService { */ @Override @Transactional(rollbackFor = Exception.class) - public void pmTotal(ScreenCollFormDTO formDTO,String customerId) { - List dataList = formDTO.getDataList(); - if(CollectionUtils.isEmpty(dataList)) return ; + public void pmTotal(ScreenCollFormDTO formDTO) { + /*List dataList = formDTO.getDataList(); + if(CollectionUtils.isEmpty(dataList)) return ;*/ if(formDTO.getIsFirst()){ - int affectRows = pmTotalMonthlyDao.deleteBatch(customerId,formDTO.getMonthId()); + int affectRows = pmTotalMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId()); while(affectRows >= NumConstant.ONE){ - affectRows = pmTotalMonthlyDao.deleteBatch(customerId,formDTO.getMonthId()); + affectRows = pmTotalMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId()); } } String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); String yearId = DateUtils.getYearId(formDTO.getMonthId()); Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> { pmTotalMonthlyDao.insertBatch(list, - customerId, + formDTO.getCustomerId(), formDTO.getMonthId(), quarterId, yearId); @@ -136,21 +128,21 @@ public class AnScreenCollServiceImpl implements AnScreenCollService { */ @Override @Transactional(rollbackFor = Exception.class) - public void grassrootsOrg(ScreenCollFormDTO formDTO,String customerId) { - List dataList = formDTO.getDataList(); - if(CollectionUtils.isEmpty(dataList)) return ; + public void grassrootsOrg(ScreenCollFormDTO formDTO) { + /*List dataList = formDTO.getDataList(); + if(CollectionUtils.isEmpty(dataList)) return ;*/ if(formDTO.getIsFirst()){ - int affectRows = orgMonthlyDao.deleteBatch(customerId,formDTO.getMonthId()); + int affectRows = orgMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId()); while(affectRows >= NumConstant.ONE){ - affectRows = orgMonthlyDao.deleteBatch(customerId,formDTO.getMonthId()); + affectRows = orgMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId()); } } String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); String yearId = DateUtils.getYearId(formDTO.getMonthId()); Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> { orgMonthlyDao.insertBatch(list, - customerId, + formDTO.getCustomerId(), formDTO.getMonthId(), quarterId, yearId); @@ -167,21 +159,21 @@ public class AnScreenCollServiceImpl implements AnScreenCollService { */ @Override @Transactional(rollbackFor = Exception.class) - public void grassrootsGovern(ScreenCollFormDTO formDTO,String customerId) { - List dataList = formDTO.getDataList(); - if(CollectionUtils.isEmpty(dataList)) return ; + public void grassrootsGovern(ScreenCollFormDTO formDTO) { + /*List dataList = formDTO.getDataList(); + if(CollectionUtils.isEmpty(dataList)) return ;*/ if(formDTO.getIsFirst()){ - int affectRows = governMonthlyDao.deleteBatch(customerId,formDTO.getMonthId()); + int affectRows = governMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId()); while(affectRows >= NumConstant.ONE){ - affectRows = governMonthlyDao.deleteBatch(customerId,formDTO.getMonthId()); + affectRows = governMonthlyDao.deleteBatch(formDTO.getCustomerId(),formDTO.getMonthId()); } } String quarterId = DateUtils.getQuarterId(formDTO.getMonthId()); String yearId = DateUtils.getYearId(formDTO.getMonthId()); Lists.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED).forEach(list -> { governMonthlyDao.insertBatch(list, - customerId, + formDTO.getCustomerId(), formDTO.getMonthId(), quarterId, yearId); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/KcScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/KcScreenCollServiceImpl.java index 2e4abd79df..dc3bed6bd7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/KcScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/KcScreenCollServiceImpl.java @@ -82,285 +82,285 @@ public class KcScreenCollServiceImpl implements KcScreenCollService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertPlatFormSummary(ScreenCollFormDTO formDTO, String customerId) { + public void insertPlatFormSummary(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcPlatformSummaryDailyDao.deletePlatFormSummary(customerId, formDTO.getDateId()); + deleteNum = screenKcPlatformSummaryDailyDao.deletePlatFormSummary(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcPlatformSummaryDailyDao.batchInsertPlatFormSummary(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcPlatformSummaryDailyDao.batchInsertPlatFormSummary(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertIssueSummary(ScreenCollFormDTO formDTO, String customerId) { + public void insertIssueSummary(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcIssueSummaryGridDailyDao.deleteIssueSummaryGrid(customerId, formDTO.getDateId()); + deleteNum = screenKcIssueSummaryGridDailyDao.deleteIssueSummaryGrid(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcIssueSummaryGridDailyDao.batchInsertIssueSummaryGrid(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcIssueSummaryGridDailyDao.batchInsertIssueSummaryGrid(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertIssueTrend(ScreenCollFormDTO formDTO, String customerId) { + public void insertIssueTrend(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcIssueTrendGridMonthlyDao.deleteIssueTrendGrid(customerId, formDTO.getMonthId()); + deleteNum = screenKcIssueTrendGridMonthlyDao.deleteIssueTrendGrid(formDTO.getCustomerId(), formDTO.getMonthId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcIssueTrendGridMonthlyDao.batchInsertIssueTrendGrid(formDTO.getDataList(), customerId, formDTO.getMonthId()); + screenKcIssueTrendGridMonthlyDao.batchInsertIssueTrendGrid(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getMonthId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertUserSummary(ScreenCollFormDTO formDTO, String customerId) { + public void insertUserSummary(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcUserSummaryDailyDao.deleteUserSummary(customerId, formDTO.getDateId()); + deleteNum = screenKcUserSummaryDailyDao.deleteUserSummary(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcUserSummaryDailyDao.batchInsertUserSummary(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcUserSummaryDailyDao.batchInsertUserSummary(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertVolunteerHeartRank(ScreenCollFormDTO formDTO, String customerId) { + public void insertVolunteerHeartRank(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcVolunteerHeatRankGridDailyDao.deleteVolunteerHeatRankGrid(customerId); + deleteNum = screenKcVolunteerHeatRankGridDailyDao.deleteVolunteerHeatRankGrid(formDTO.getCustomerId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcVolunteerHeatRankGridDailyDao.batchInsertVolunteerHeatRankGrid(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcVolunteerHeatRankGridDailyDao.batchInsertVolunteerHeatRankGrid(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertUserHeartRank(ScreenCollFormDTO formDTO, String customerId) { + public void insertUserHeartRank(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcUserTrendGridMonthlyDao.deleteUserTrendGrid(customerId, formDTO.getMonthId()); + deleteNum = screenKcUserTrendGridMonthlyDao.deleteUserTrendGrid(formDTO.getCustomerId(), formDTO.getMonthId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcUserTrendGridMonthlyDao.batchInsertUserTrendGrid(formDTO.getDataList(), customerId, formDTO.getMonthId()); + screenKcUserTrendGridMonthlyDao.batchInsertUserTrendGrid(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getMonthId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertActSummary(ScreenCollFormDTO formDTO, String customerId) { + public void insertActSummary(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcActSummaryDailyDao.deleteActSummary(customerId, formDTO.getDateId()); + deleteNum = screenKcActSummaryDailyDao.deleteActSummary(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcActSummaryDailyDao.batchInsertActSummary(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcActSummaryDailyDao.batchInsertActSummary(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertActTrend(ScreenCollFormDTO formDTO, String customerId) { + public void insertActTrend(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcActTrendMonthlyDao.deleteActTrend(customerId, formDTO.getMonthId()); + deleteNum = screenKcActTrendMonthlyDao.deleteActTrend(formDTO.getCustomerId(), formDTO.getMonthId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcActTrendMonthlyDao.batchInsertActTrend(formDTO.getDataList(), customerId, formDTO.getMonthId()); + screenKcActTrendMonthlyDao.batchInsertActTrend(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getMonthId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertVolunteerSummary(ScreenCollFormDTO formDTO, String customerId) { + public void insertVolunteerSummary(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcVolunteerSummaryDailyDao.deleteVolunteerSummary(customerId, formDTO.getDateId()); + deleteNum = screenKcVolunteerSummaryDailyDao.deleteVolunteerSummary(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcVolunteerSummaryDailyDao.batchInsertVolunteerSummary(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcVolunteerSummaryDailyDao.batchInsertVolunteerSummary(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertProjectSummary(ScreenCollFormDTO formDTO, String customerId) { + public void insertProjectSummary(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcProjectSummaryGridDailyDao.deleteProjectSummary(customerId, formDTO.getDateId()); + deleteNum = screenKcProjectSummaryGridDailyDao.deleteProjectSummary(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcProjectSummaryGridDailyDao.batchInsertProjectSummary(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcProjectSummaryGridDailyDao.batchInsertProjectSummary(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertCategorySummary(ScreenCollFormDTO formDTO, String customerId) { + public void insertCategorySummary(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcProjectCategoryGridDailyDao.deleteCategoryGrid(customerId, formDTO.getDateId()); + deleteNum = screenKcProjectCategoryGridDailyDao.deleteCategoryGrid(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcProjectCategoryGridDailyDao.batchInsertCategoryGrid(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcProjectCategoryGridDailyDao.batchInsertCategoryGrid(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertProjectSatisanalysis(ScreenCollFormDTO formDTO, String customerId) { + public void insertProjectSatisanalysis(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcProjectSatisGridMonthlyDao.deleteProjectSatisGrid(customerId, formDTO.getMonthId()); + deleteNum = screenKcProjectSatisGridMonthlyDao.deleteProjectSatisGrid(formDTO.getCustomerId(), formDTO.getMonthId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcProjectSatisGridMonthlyDao.batchInsertProjectSatisGrid(formDTO.getDataList(), customerId, formDTO.getMonthId()); + screenKcProjectSatisGridMonthlyDao.batchInsertProjectSatisGrid(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getMonthId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertNewsSummary(ScreenCollFormDTO formDTO, String customerId) { + public void insertNewsSummary(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcNewsSummaryDailyDao.deleteNewsSummary(customerId, formDTO.getDateId()); + deleteNum = screenKcNewsSummaryDailyDao.deleteNewsSummary(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcNewsSummaryDailyDao.batchInsertNewsSummary(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcNewsSummaryDailyDao.batchInsertNewsSummary(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertNewsTrend(ScreenCollFormDTO formDTO, String customerId) { + public void insertNewsTrend(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcNewsTrendMonthlyDao.deleteNewsTrend(customerId, formDTO.getMonthId()); + deleteNum = screenKcNewsTrendMonthlyDao.deleteNewsTrend(formDTO.getCustomerId(), formDTO.getMonthId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcNewsTrendMonthlyDao.batchInsertNewsTrend(formDTO.getDataList(), customerId, formDTO.getMonthId()); + screenKcNewsTrendMonthlyDao.batchInsertNewsTrend(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getMonthId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertNewsHotRank(ScreenCollFormDTO formDTO, String customerId) { + public void insertNewsHotRank(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcNewsRankDao.deleteNewsRank(customerId); + deleteNum = screenKcNewsRankDao.deleteNewsRank(formDTO.getCustomerId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcNewsRankDao.batchInsertNewsRank(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcNewsRankDao.batchInsertNewsRank(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertNewsCategoryAnalysis(ScreenCollFormDTO formDTO, String customerId) { + public void insertNewsCategoryAnalysis(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcNewsCategoryAnalysisDao.deleteNewsCategoryAnalysis(customerId, formDTO.getDateId()); + deleteNum = screenKcNewsCategoryAnalysisDao.deleteNewsCategoryAnalysis(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcNewsCategoryAnalysisDao.batchInsertNewsCategoryAnalysis(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcNewsCategoryAnalysisDao.batchInsertNewsCategoryAnalysis(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertGroupSummary(ScreenCollFormDTO formDTO, String customerId) { + public void insertGroupSummary(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcGroupSummaryGridDailyDao.deleteGroupSummaryGrid(customerId, formDTO.getDateId()); + deleteNum = screenKcGroupSummaryGridDailyDao.deleteGroupSummaryGrid(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcGroupSummaryGridDailyDao.batchInsertGroupSummaryGrid(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcGroupSummaryGridDailyDao.batchInsertGroupSummaryGrid(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertGroupDetail(ScreenCollFormDTO formDTO, String customerId) { + public void insertGroupDetail(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcGroupDetailGridDailyDao.deleteGroupDetailGrid(customerId, formDTO.getDateId()); + deleteNum = screenKcGroupDetailGridDailyDao.deleteGroupDetailGrid(formDTO.getCustomerId(), formDTO.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcGroupDetailGridDailyDao.batchInsertGroupDetailGrid(formDTO.getDataList(), customerId, formDTO.getDateId()); + screenKcGroupDetailGridDailyDao.batchInsertGroupDetailGrid(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getDateId()); } } @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertGroupTopicTrend(ScreenCollFormDTO formDTO, String customerId) { + public void insertGroupTopicTrend(ScreenCollFormDTO formDTO) { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenKcTopicTrendGridMonthlyDao.deleteTopicTrendGrid(customerId, formDTO.getMonthId()); + deleteNum = screenKcTopicTrendGridMonthlyDao.deleteTopicTrendGrid(formDTO.getCustomerId(), formDTO.getMonthId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { - screenKcTopicTrendGridMonthlyDao.batchInsertTopicTrendGrid(formDTO.getDataList(), customerId, formDTO.getMonthId()); + screenKcTopicTrendGridMonthlyDao.batchInsertTopicTrendGrid(formDTO.getDataList(), formDTO.getCustomerId(), formDTO.getMonthId()); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java index 6655be0a08..67dae90b1c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java @@ -24,6 +24,7 @@ import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgSourceTypeConstant; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; +import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; @@ -166,4 +167,16 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl selectBelongGridInfo(String customerId, String level) { + return baseDao.selectBelongGridInfo(customerId, level); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java index 66873e1b6d..f263b332fc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenDifficultyDataServiceImpl.java @@ -66,7 +66,7 @@ public class ScreenDifficultyDataServiceImpl extends BaseServiceImpl implements ScreenProjectCategoryGridDailyService { - + @Autowired + private FactOriginProjectCategoryDailyService factOriginProjectCategoryDailyService; @Override public PageData page(Map params) { @@ -108,27 +111,44 @@ public class ScreenProjectCategoryGridDailyServiceImpl extends BaseServiceImpl param) { + public void collect(ScreenCollFormDTO param) { if(param.getIsFirst()){ int deleteNum; do { - deleteNum = baseDao.deleteByDateIdAndCustomerId(customerId,param.getDateId()); + deleteNum = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(),param.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(param.getDataList())) { param.getDataList().forEach(item -> { - item.setCustomerId(customerId); + item.setCustomerId(param.getCustomerId()); item.setDateId(param.getDateId()); }); insertBatch(ConvertUtils.sourceToTarget(param.getDataList(), ScreenProjectCategoryGridDailyEntity.class)); } } + /** + * @param customerId + * @param dateId + * @return void + * @author yinzuomei + * @description 产品内部计算:网格内按分类统计项目数量 + * @Date 2021/3/22 16:46 + **/ + @Override + public void extractProjectCategoryData(String customerId, String dateId) { + List listDTO= factOriginProjectCategoryDailyService.selectListProjectCategoryGridDailyDTO(customerId); + listDTO.forEach(dto->{ + dto.setDateId(dateId); + }); + boolean insertRes=insertBatch(ConvertUtils.sourceToTarget(listDTO, ScreenProjectCategoryGridDailyEntity.class)); + log.info("insertRes is {}",insertRes); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java index 290b30cf74..8dbbe72d73 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java @@ -26,20 +26,34 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.ScreenConstant; +import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao; import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao; +import com.epmet.dto.ScreenCustomerGridDTO; +import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO; +import com.epmet.dto.screen.result.CategoryProjectResultDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.crm.CustomerRelationEntity; import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity; +import com.epmet.service.crm.CustomerRelationService; +import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService; +import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryOrgDailyService; import com.google.common.collect.Lists; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; 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 org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 项目(事件)分类按组织_按天统计 @@ -49,8 +63,17 @@ import java.util.Map; */ @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) +@Slf4j public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl implements ScreenProjectCategoryOrgDailyService { + @Autowired + private CustomerRelationService relationService; + @Autowired + private ScreenCustomerAgencyService agencyService; + @Autowired + private ScreenProjectCategoryGridDailyDao gridDailyDao; + @Autowired + private ScreenCustomerGridService gridService; @Override public PageData page(Map params) { @@ -107,23 +130,22 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl param) { + public void collect(ScreenCollFormDTO param) { if(param.getIsFirst()){ int deleteNum; do { - deleteNum = baseDao.deleteByDateIdAndCustomerId(customerId,param.getDateId()); + deleteNum = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(),param.getDateId()); } while (deleteNum > NumConstant.ZERO); } if (!CollectionUtils.isEmpty(param.getDataList())) { param.getDataList().forEach(item -> { - item.setCustomerId(customerId); + item.setCustomerId(param.getCustomerId()); item.setDateId(param.getDateId()); }); Lists.partition(param.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { @@ -132,4 +154,238 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl relationInfo = relationService.selectSubCustomer(customerId); + if (CollectionUtils.isEmpty(relationInfo)){ + // 单客户 + disposeOneCustomer(customerId, dateId); + }else { + // 多客户 + /** + * 1.查自己客户分类标签统计 + * 2.查询子级客户分类标签【分为 epmet_category_code is null 和 is not null】,pid = '0',跟父客户对比,同类标签项目数累加,不同直接添加到父客户 + * 注:加入直属网格 + */ + disposeMoreCustomer(customerId,dateId,relationInfo); + } + } + + /** + * @Description 单客户处理 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/3/23 上午10:40 + */ + private void disposeOneCustomer(String customerId, String dateId){ + List agencyIdList = agencyService.selectAllAgencyId(customerId); + if (!CollectionUtils.isEmpty(agencyIdList)){ + // 根据组织级别分组 + Map> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); + if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ + // 社区级别 + disposeOneCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId); + } + if (groupByLevel.containsKey(ScreenConstant.STREET)){ + // 街道级别 + disposeOneCustomerSub(ScreenConstant.STREET,false,customerId,dateId); + } + if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ + // 区级 + disposeOneCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId); + } + if (groupByLevel.containsKey(ScreenConstant.CITY)){ + // 市级 + disposeOneCustomerSub(ScreenConstant.CITY,false,customerId,dateId); + } + if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ + // 省级 + disposeOneCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId); + } + } + } + + /** + * @Description 单客户处理 + * @Param level + * @Param isGrid + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/3/25 上午10:44 + */ + public void disposeOneCustomerSub(String level, Boolean isGrid, String customerId, String dateId){ + List result = new ArrayList<>(); + if (isGrid){ + // 是社区级别 + List categoryInfos = gridDailyDao.selectCategoryInfo(customerId, dateId,null,null); + if (!CollectionUtils.isEmpty(categoryInfos)){ + result = ConvertUtils.sourceToTarget(categoryInfos, ScreenProjectCategoryOrgDailyEntity.class); + } + }else { + List categoryProjectResultDTOS = baseDao.selectOrgCategoryInfo(customerId, dateId, level); + List belongGridInfos = gridService.selectBelongGridInfo(customerId, level); + if (!CollectionUtils.isEmpty(belongGridInfos)){ + // 存在直属网格 + List gridIds = belongGridInfos.stream().map(m -> m.getGridId()).collect(Collectors.toList()); + List categoryProjectGrid = gridDailyDao.selectCategoryInfo(customerId, dateId, level, gridIds); + if (!CollectionUtils.isEmpty(categoryProjectGrid)){ + categoryProjectResultDTOS.forEach(agency -> { + categoryProjectGrid.forEach(grid -> { + if (agency.getOrgId().equals(grid.getOrgId()) && agency.getCategoryCode().equals(grid.getCategoryCode())){ + agency.setProjectTotal(agency.getProjectTotal() + grid.getProjectTotal()); + grid.setStatus(true); + } + }); + }); + Map> groupByStatus = categoryProjectGrid.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); + List categoryProjectResultDTOS1 = groupByStatus.get(false); + if (!CollectionUtils.isEmpty(categoryProjectResultDTOS1)) categoryProjectResultDTOS.addAll(categoryProjectResultDTOS1); + } + } + result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class); + } + deleteAndInsert(customerId,dateId,result); + } + + /** + * @Description 多客户处理 + * @Param customerId + * @Param dateId + * @Param relationInfo 子级客户信息 + * @author zxc + * @date 2021/3/23 上午10:40 + */ + private void disposeMoreCustomer(String customerId, String dateId,List relationInfo){ + List agencyIdList = agencyService.selectAllAgencyId(customerId); + if (!CollectionUtils.isEmpty(agencyIdList)){ + // 根据组织级别分组 + Map> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel)); + if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ + // 社区级别 + disposeMoreCustomerSub(ScreenConstant.COMMUNITY,true,customerId,dateId,relationInfo); + } + if (groupByLevel.containsKey(ScreenConstant.STREET)){ + // 街道级别 + disposeMoreCustomerSub(ScreenConstant.STREET,false,customerId,dateId,relationInfo); + } + if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ + // 区级 + disposeMoreCustomerSub(ScreenConstant.DISTRICT,false,customerId,dateId,relationInfo); + } + if (groupByLevel.containsKey(ScreenConstant.CITY)){ + // 市级 + disposeMoreCustomerSub(ScreenConstant.CITY,false,customerId,dateId,relationInfo); + } + if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ + // 省级 + disposeMoreCustomerSub(ScreenConstant.PROVINCE,false,customerId,dateId,relationInfo); + } + } + } + + /** + * @Description 多客户处理 + * @Param level 级别 + * @Param isGrid + * @Param customerId + * @Param dateId + * @Param relationInfo 子级客户信息 + * @author zxc + * @date 2021/3/25 下午1:29 + */ + private void disposeMoreCustomerSub(String level,Boolean isGrid,String customerId, String dateId, List relationInfo){ + List result = new ArrayList<>(); + if (isGrid){ + // community级别走这 + List categoryInfos = gridDailyDao.selectCategoryInfo(customerId, dateId,null,null); + if (!CollectionUtils.isEmpty(categoryInfos)){ + result = ConvertUtils.sourceToTarget(categoryInfos, ScreenProjectCategoryOrgDailyEntity.class); + } + }else { + List categoryProjectResultDTOS = baseDao.selectOrgCategoryInfo(customerId, dateId, level); + List belongGridInfos = gridService.selectBelongGridInfo(customerId, level); + if (!CollectionUtils.isEmpty(belongGridInfos)){ + // 存在直属网格 + List gridIds = belongGridInfos.stream().map(m -> m.getGridId()).collect(Collectors.toList()); + List categoryProjectGrid = gridDailyDao.selectCategoryInfo(customerId, dateId, level, gridIds); + if (!CollectionUtils.isEmpty(categoryProjectGrid)){ + categoryProjectResultDTOS.forEach(agency -> { + categoryProjectGrid.forEach(grid -> { + if (agency.getOrgId().equals(grid.getOrgId()) && agency.getCategoryCode().equals(grid.getCategoryCode())){ + agency.setProjectTotal(agency.getProjectTotal() + grid.getProjectTotal()); + grid.setStatus(true); + } + }); + }); + Map> groupByStatus = categoryProjectGrid.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); + List categoryProjectResultDTOS1 = groupByStatus.get(false); + categoryProjectResultDTOS.addAll(categoryProjectResultDTOS1); + } + } + result = ConvertUtils.sourceToTarget(categoryProjectResultDTOS,ScreenProjectCategoryOrgDailyEntity.class); + if (ScreenConstant.DISTRICT.equals(level)){ + // 子级客户ID + List customerIds = relationInfo.stream().map(m -> m.getCustomerId()).collect(Collectors.toList()); + // 父客户存在的分类 + List categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true); + if (!CollectionUtils.isEmpty(categoryProjectExists)){ + result.forEach(r -> { + categoryProjectExists.forEach(c -> { + if (r.getCategoryCode().equals(c.getCategoryCode())){ + r.setProjectTotal(r.getProjectTotal() + c.getProjectTotal()); + c.setStatus(true); + } + }); + }); + Map> groupByStatus = categoryProjectExists.stream().collect(Collectors.groupingBy(CategoryProjectResultDTO::getStatus)); + List categoryProjectFalse = groupByStatus.get(false); + if (!CollectionUtils.isEmpty(categoryProjectFalse)){ + List f = ConvertUtils.sourceToTarget(categoryProjectFalse, ScreenProjectCategoryOrgDailyEntity.class); + result.addAll(f); + } + } + // 父客户不存在的分类 + List categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false); + if (!CollectionUtils.isEmpty(categoryProjectNotExists)){ + List notExists = ConvertUtils.sourceToTarget(categoryProjectNotExists, ScreenProjectCategoryOrgDailyEntity.class); + result.addAll(notExists); + } + } + } + deleteAndInsert(customerId,dateId,result); + } + + /** + * @Description 删除和新增 + * @Param customerId + * @Param dateId + * @author zxc + * @date 2021/3/23 上午10:52 + */ + @Transactional(rollbackFor = Exception.class) + public void deleteAndInsert(String customerId, String dateId, List needInsert){ + if (CollectionUtils.isEmpty(needInsert)){ + return; + } + Integer row = NumConstant.ZERO; + do { + row = baseDao.deleteByDateIdAndCustomerId(customerId, dateId); + }while (row > NumConstant.ZERO && row == NumConstant.ONE_THOUSAND); + List> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + insertBatch(p); + }); + } + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java index b826fd1f6e..501bfa2c43 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java @@ -21,23 +21,24 @@ 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.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.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.*; import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO; import com.epmet.dto.screencoll.ScreenCollFormDTO; -import com.epmet.entity.evaluationindex.screen.*; -import com.epmet.service.evaluationindex.screen.*; -import com.google.common.collect.Lists; +import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; +import com.epmet.entity.evaluationindex.screen.ScreenProjectImgDataEntity; +import com.epmet.service.evaluationindex.screen.ScreenProjectDataService; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.ArrayUtils; 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 org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.text.ParseException; @@ -54,6 +55,7 @@ import java.util.Map; * @since v1.0.0 2021-02-23 */ @Service +@DataSource(value = DataSourceConstant.EVALUATION_INDEX) public class ScreenProjectDataServiceImpl extends BaseServiceImpl implements ScreenProjectDataService { @Resource @@ -120,11 +122,11 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl param) { + public void collect(ScreenCollFormDTO param) { if (param.getIsFirst()) { - int affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId, param.getDateId()); + int affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId()); while (affectedRows > 0) { - affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId, param.getDateId()); + affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId()); } } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -132,53 +134,56 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl { String projectStatusCode = item.getProjectStatusCode(); - //todo 动态获取超时时间 - //如果结案 结案时间立项时间; - if ("closed_case".equals(projectStatusCode)) { - try { - Date createTime = sdf.parse(item.getProjectCreateTime()); - Date closeCaseTime = sdf.parse(item.getCloseCaseTime()); - - if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4) { - //如果结案时间-立项时间小于等于4天 未超期 level3 - item.setProjectLevel(3); - } else if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5) { - //如果结案时间-立项时间大于4天小于5天 即将超期 level2 - item.setProjectLevel(2); - } else { - //大于5天 已超期 level1 - item.setProjectLevel(1); + //2021.3.8 epmet中,调用方传level,这边不再计算 + if(item.getProjectLevel() == null){ + //todo 动态获取超时时间 + //如果结案 结案时间立项时间; + if ("closed_case".equals(projectStatusCode)) { + try { + Date createTime = sdf.parse(item.getProjectCreateTime()); + Date closeCaseTime = sdf.parse(item.getCloseCaseTime()); + + if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4) { + //如果结案时间-立项时间小于等于4天 未超期 level3 + item.setProjectLevel(3); + } else if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5) { + //如果结案时间-立项时间大于4天小于5天 即将超期 level2 + item.setProjectLevel(2); + } else { + //大于5天 已超期 level1 + item.setProjectLevel(1); + } + } catch (ParseException e) { + e.printStackTrace(); } - } catch (ParseException e) { - e.printStackTrace(); - } - } else if ("pending".equals(projectStatusCode)) { - //如果处理中 当前时间-立项时间; - try { - Date createTime = sdf.parse(item.getProjectCreateTime()); - - if (today.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4) { - //如果当前时间-立项时间小于等于4天 未超期 level3 - item.setProjectLevel(3); - } else if (today.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5) { - //如果当前时间-立项时间大于4天小于5天 即将超期 level2 - item.setProjectLevel(2); - } else { - //大于5天 已超期 level1 - item.setProjectLevel(1); + } else if ("pending".equals(projectStatusCode)) { + //如果处理中 当前时间-立项时间; + try { + Date createTime = sdf.parse(item.getProjectCreateTime()); + + if (today.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4) { + //如果当前时间-立项时间小于等于4天 未超期 level3 + item.setProjectLevel(3); + } else if (today.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5) { + //如果当前时间-立项时间大于4天小于5天 即将超期 level2 + item.setProjectLevel(2); + } else { + //大于5天 已超期 level1 + item.setProjectLevel(1); + } + } catch (ParseException e) { + e.printStackTrace(); } - } catch (ParseException e) { - e.printStackTrace(); } } //先删除该projectId对应的旧数据 QueryWrapper deleteWrapper = new QueryWrapper<>(); deleteWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId()) - .eq(StringUtils.isNotBlank(customerId), "customer_id", customerId); + .eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId()); baseDao.delete(deleteWrapper); QueryWrapper screenProjectImgDataEntityQueryWrapper = new QueryWrapper<>(); screenProjectImgDataEntityQueryWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId()) - .eq(StringUtils.isNotBlank(customerId), "customer_id", customerId); + .eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId()); screenProjectImgDataDao.delete(screenProjectImgDataEntityQueryWrapper); //如果orgType未知,获取一下 @@ -201,7 +206,7 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl getPending(ScreenProjectDataDTO param,String dateId) { + param.setDataEndTime(dateId); + return baseDao.selectPending(param); + } + + /** + * @Description collect或更新 + * @param + * @return void + * @author wangc + * @date 2021.03.09 17:36 + */ + @Override + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + public void insertOrUpdateBatch(String customerId, String dateId, List meta, List orient) { + //内部数据抽取的逻辑是,不管dateId指定的哪一天,只要在抽取时,目标数据库中没有相应数据 + //就抽取指定日期及其之前的所有数据,因此在删除时只需对指定日期删除即可,上述情况是因为 + //库中无数据,范围性删除无意义,只是针对在数据库有历史数据的情况下,保证对同一天进行反 + //复采集时数不会重复 + if(!CollectionUtils.isEmpty(meta)){ + int affectedRows = baseDao.deleteByProjectTimeAndCustomerId(customerId,dateId); + while (affectedRows > 0) { + affectedRows = baseDao.deleteByProjectTimeAndCustomerId(customerId, dateId); + } + List> partition = ListUtils.partition(meta, NumConstant.ONE_HUNDRED); + partition.forEach(part -> baseDao.insertBatch(part)); + } + + + if(!CollectionUtils.isEmpty(orient)){ + List> partition = ListUtils.partition(orient, NumConstant.ONE_HUNDRED); + partition.forEach(part -> baseDao.updateBatch(part,dateId)); + } + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java index 527c41624e..64cb66e04c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectGridDailyServiceImpl.java @@ -122,7 +122,6 @@ public class ScreenProjectGridDailyServiceImpl extends BaseServiceImpl data) { + public void collect(ScreenCollFormDTO data) { if(data.getIsFirst()){ - int affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId,data.getDateId()); + int affectedRows = baseDao.deleteByDateIdAndCustomerId(data.getCustomerId(),data.getDateId()); while(affectedRows > 0){ - affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId,data.getDateId()); + affectedRows = baseDao.deleteByDateIdAndCustomerId(data.getCustomerId(),data.getDateId()); } } Lists.partition(data.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { - baseDao.insertBatch(list,customerId,"APP_USER",data.getDateId()); + baseDao.insertBatch(list,data.getCustomerId(),"APP_USER",data.getDateId()); }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectImgDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectImgDataServiceImpl.java index 3b149b2d37..cb1217f055 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectImgDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectImgDataServiceImpl.java @@ -19,14 +19,18 @@ package com.epmet.service.evaluationindex.screen.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.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.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenProjectImgDataDao; import com.epmet.dto.screen.ScreenProjectImgDataDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectImgDataEntity; import com.epmet.service.evaluationindex.screen.ScreenProjectImgDataService; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -34,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 中央区-项目数据图片 @@ -42,6 +47,7 @@ import java.util.Map; * @since v1.0.0 2021-02-23 */ @Service +@DataSource(value = DataSourceConstant.EVALUATION_INDEX) public class ScreenProjectImgDataServiceImpl extends BaseServiceImpl implements ScreenProjectImgDataService { @Override @@ -96,4 +102,11 @@ public class ScreenProjectImgDataServiceImpl extends BaseServiceImpl list) { + baseDao.deleteByProjectIds(list.stream().map(ScreenProjectImgDataDTO::getProjectId).distinct().collect(Collectors.toList())); + List> partition = ListUtils.partition(list, NumConstant.ONE_HUNDRED); + partition.forEach(part -> baseDao.insertBatch(list)); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java index b5c71b558b..98fc2f38f7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java @@ -125,7 +125,6 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl data) { + public void collect(ScreenCollFormDTO data) { if(data.getIsFirst()){ - int affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId,data.getDateId()); + int affectedRows = baseDao.deleteByDateIdAndCustomerId(data.getCustomerId(),data.getDateId()); while(affectedRows > 0){ - affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId,data.getDateId()); + affectedRows = baseDao.deleteByDateIdAndCustomerId(data.getCustomerId(),data.getDateId()); } } Lists.partition(data.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { - baseDao.insertBatch(list,customerId,"APP_USER",data.getDateId()); + baseDao.insertBatch(list,data.getCustomerId(),"APP_USER",data.getDateId()); }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessAttachmentServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessAttachmentServiceImpl.java index 7219b2ae21..e750394f9b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessAttachmentServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessAttachmentServiceImpl.java @@ -19,14 +19,18 @@ package com.epmet.service.evaluationindex.screen.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.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.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenProjectProcessAttachmentDao; import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessAttachmentEntity; import com.epmet.service.evaluationindex.screen.ScreenProjectProcessAttachmentService; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -34,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * 中央区-项目数据处理节点附件表 @@ -42,6 +47,7 @@ import java.util.Map; * @since v1.0.0 2021-02-23 */ @Service +@DataSource(value = DataSourceConstant.EVALUATION_INDEX) public class ScreenProjectProcessAttachmentServiceImpl extends BaseServiceImpl implements ScreenProjectProcessAttachmentService { @Override public PageData page(Map params) { @@ -95,4 +101,11 @@ public class ScreenProjectProcessAttachmentServiceImpl extends BaseServiceImpl list) { + baseDao.deleteByProcessId(list.stream().map(ScreenProjectProcessAttachmentDTO::getProcessId).distinct().collect(Collectors.toList())); + List> partition = ListUtils.partition(list,NumConstant.ONE_HUNDRED); + partition.forEach(part -> baseDao.insertBatch(part)); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java index 1d18eb0b7f..863b119c07 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectProcessServiceImpl.java @@ -21,6 +21,7 @@ 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.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; @@ -34,6 +35,7 @@ import com.epmet.dto.screencoll.ScreenCollFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessAttachmentEntity; import com.epmet.entity.evaluationindex.screen.ScreenProjectProcessEntity; import com.epmet.service.evaluationindex.screen.ScreenProjectProcessService; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -51,6 +53,7 @@ import java.util.Map; * @since v1.0.0 2021-02-23 */ @Service +@DataSource(value = DataSourceConstant.EVALUATION_INDEX) public class ScreenProjectProcessServiceImpl extends BaseServiceImpl implements ScreenProjectProcessService { @Resource @@ -110,29 +113,29 @@ public class ScreenProjectProcessServiceImpl extends BaseServiceImpl param) { + public void collect(ScreenCollFormDTO param) { if (param.getIsFirst()) { - int affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId, param.getDateId()); + int affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId()); while (affectedRows > 0) { - affectedRows = baseDao.deleteByDateIdAndCustomerId(customerId, param.getDateId()); + affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId()); } } param.getDataList().forEach(item -> { //先删除旧数据 QueryWrapper screenProjectProcessEntityQueryWrapper = new QueryWrapper<>(); screenProjectProcessEntityQueryWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId()) - .eq(StringUtils.isNotBlank(customerId), "customer_id", customerId) + .eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId()) .eq(StringUtils.isNotBlank(item.getProcessId()), "process_id", item.getProcessId()); baseDao.delete(screenProjectProcessEntityQueryWrapper); QueryWrapper screenProjectProcessAttachmentEntityQueryWrapper = new QueryWrapper<>(); screenProjectProcessAttachmentEntityQueryWrapper.eq(StringUtils.isNotBlank(item.getProjectId()), "project_id", item.getProjectId()) - .eq(StringUtils.isNotBlank(customerId), "customer_id", customerId) + .eq(StringUtils.isNotBlank(param.getCustomerId()), "customer_id", param.getCustomerId()) .eq(StringUtils.isNotBlank(item.getProcessId()), "process_id", item.getProcessId()); screenProjectProcessAttachmentDao.delete(screenProjectProcessAttachmentEntityQueryWrapper); //插入 ScreenProjectProcessEntity screenProjectProcessEntity = ConvertUtils.sourceToTarget(item, ScreenProjectProcessEntity.class); - screenProjectProcessEntity.setCustomerId(customerId); + screenProjectProcessEntity.setCustomerId(param.getCustomerId()); screenProjectProcessEntity.setDataEndTime(param.getDateId()); baseDao.insert(screenProjectProcessEntity); @@ -140,7 +143,7 @@ public class ScreenProjectProcessServiceImpl extends BaseServiceImpl NumConstant.ZERO; + } + + @Override + public void insertBatch(List list,String customerId,String dateId) { + int affectedRows = baseDao.deleteByProcessTimeAndCustomerId(customerId, dateId); + while (affectedRows > 0) { + affectedRows = baseDao.deleteByProcessTimeAndCustomerId(customerId, dateId); + } + + List> partition = ListUtils.partition(list,NumConstant.ONE_HUNDRED); + partition.forEach(part -> { + baseDao.insertBatch(part); + }); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityGridMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityGridMonthlyServiceImpl.java index 0457c180d0..ea99b5148a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityGridMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityGridMonthlyServiceImpl.java @@ -123,7 +123,6 @@ public class ScreenProjectQuantityGridMonthlyServiceImpl extends BaseServiceImpl /** * @Description 数据采集 - * @param customerId * @param data * @return void * @author wangc @@ -132,15 +131,15 @@ public class ScreenProjectQuantityGridMonthlyServiceImpl extends BaseServiceImpl @Transactional(rollbackFor = Exception.class) @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override - public void collect(String customerId, ScreenCollFormDTO data) { + public void collect(ScreenCollFormDTO data) { if(data.getIsFirst()){ - int affectedRows = baseDao.deleteByMonthIdAndCustomerId(customerId,data.getMonthId()); + int affectedRows = baseDao.deleteByMonthIdAndCustomerId(data.getCustomerId(),data.getMonthId()); while(affectedRows > 0){ - affectedRows = baseDao.deleteByMonthIdAndCustomerId(customerId,data.getMonthId()); + affectedRows = baseDao.deleteByMonthIdAndCustomerId(data.getCustomerId(),data.getMonthId()); } } Lists.partition(data.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { - baseDao.insertBatch(list,customerId,"APP_USER",data.getMonthId()); + baseDao.insertBatch(list,data.getCustomerId(),"APP_USER",data.getMonthId()); }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java index 3d06e12698..91917d22b7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectQuantityOrgMonthlyServiceImpl.java @@ -123,7 +123,6 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< /** * @Description 数据采集 - * @param customerId * @param data * @return void * @author wangc @@ -132,15 +131,15 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< @Transactional(rollbackFor = Exception.class) @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @Override - public void collect(String customerId, ScreenCollFormDTO data) { + public void collect(ScreenCollFormDTO data) { if(data.getIsFirst()){ - int affectedRows = baseDao.deleteByMonthIdAndCustomerId(customerId,data.getMonthId()); + int affectedRows = baseDao.deleteByMonthIdAndCustomerId(data.getCustomerId(),data.getMonthId()); while(affectedRows > 0){ - affectedRows = baseDao.deleteByMonthIdAndCustomerId(customerId,data.getMonthId()); + affectedRows = baseDao.deleteByMonthIdAndCustomerId(data.getCustomerId(),data.getMonthId()); } } Lists.partition(data.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { - baseDao.insertBatch(list,customerId,"APP_USER",data.getMonthId()); + baseDao.insertBatch(list,data.getCustomerId(),"APP_USER",data.getMonthId()); }); } @@ -156,7 +155,6 @@ public class ScreenProjectQuantityOrgMonthlyServiceImpl extends BaseServiceImpl< List screenProjectOrgDailyDTOS = new ArrayList<>(); //如果有子客户要按照跟组织的area_code查询组织列表 if(customerRelationService.haveSubCustomer(customerId)){ - // CustomerAgencyEntity rootAgency=customerAgencyService.getRootAgencyInfo(customerId); screenProjectOrgDailyDTOS=agencyDao.selectAgencyByAreaCode(rootAgency.getAreaCode()); }else{ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java index 6338145260..09db5e717d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java @@ -3,10 +3,12 @@ package com.epmet.service.impl; import com.epmet.constant.RobotConstant; import com.epmet.dto.org.result.CustomerAreaCodeResultDTO; import com.epmet.entity.crm.CustomerEntity; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.entity.org.CustomerDepartmentEntity; import com.epmet.entity.org.CustomerGridEntity; import com.epmet.entity.stats.*; +import com.epmet.service.Issue.IssueProjectCategoryDictService; import com.epmet.service.StatsDimService; import com.epmet.service.crm.CustomerService; import com.epmet.service.org.CustomerAgencyService; @@ -52,6 +54,12 @@ public class StatsDimServiceImpl implements StatsDimService { @Autowired private DimDepartmentService dimDepartmentService; + @Autowired + private CustomerProjectCategoryDictService projectCategoryDictService; + + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + @Override public void initGridDim() { List newDimGrids = getNewDimGrids(); @@ -264,4 +272,47 @@ public class StatsDimServiceImpl implements StatsDimService { } return new ArrayList<>(); } + + /** + * @return void + * @author yinzuomei + * @description 初始化项目分类字典表 + * @Date 2021/3/19 15:44 + **/ + @Override + public void customerInitProjectCategory() { + Date now = new Date(); + List insertCategoies = listInsertCategoies(); + List updateCategoies = listUpdateCategoies(now); + projectCategoryDictService.initProjectCategory(insertCategoies,updateCategoies); + } + + /** + * @author yinzuomei + * @description 构造需要插入的分类字典 + * @Date 2021/3/19 15:52 + **/ + private List listInsertCategoies() { + CustomerProjectCategoryDictEntity lastInsertProjectCategory = projectCategoryDictService.getLatestProjectCategory(); + Date now = new Date(); + Date lastInitTime = null; + if (null != lastInsertProjectCategory) { + lastInitTime = lastInsertProjectCategory.getOriginCreatedTime(); + } + return issueProjectCategoryDictService.listInsertCategoies(lastInitTime, now); + } + + /** + * @param initTime + * @author yinzuomei + * @description + * @Date 2021/3/19 15:55 + **/ + private List listUpdateCategoies(Date initTime) { + CustomerProjectCategoryDictEntity lastUpdated = projectCategoryDictService.getLatestUpdatedEntity(); + if (lastUpdated != null) { + return issueProjectCategoryDictService.listByUpdatedTime(lastUpdated.getOriginUpdatedTime(), initTime); + } + return new ArrayList<>(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java index 35568a1e2f..0d35eede37 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsUserServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ProjectConstant; @@ -58,17 +59,25 @@ public class StatsUserServiceImpl implements StatsUserService { **/ @Override public void partition(StatsFormDTO formDTO) { + if(StringUtils.isBlank(formDTO.getDate())){ + //如果定时任务没有指定参数,默认数据更新至t-1,包含t-1这一天内的数据 + formDTO.setDate(DateUtils.getBeforeNDay(1,DateUtils.DATE_PATTERN)); + } + int pageNo = NumConstant.ONE; int pageSize = NumConstant.ONE_HUNDRED; List customerIdList = null; Date date = null; + if (StringUtils.isNotBlank(formDTO.getDate())) { + //如果指定了参数,转化为yyyy-MM-dd格式 date = DateUtils.stringToDate(formDTO.getDate(), DateUtils.DATE_PATTERN); } if (StringUtils.isNotBlank(formDTO.getCustomerId())) { generate(formDTO.getCustomerId(), date); } else { do { + //每100个客户一组 customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); if (!CollectionUtils.isEmpty(customerIdList)) { for (String customerId : customerIdList) { @@ -90,6 +99,7 @@ public class StatsUserServiceImpl implements StatsUserService { * @date 2020.06.28 14:40 **/ void generate(String customerId,Date date){ + log.info("customerId:"+customerId+";date:"+DateUtils.format(date,DateUtils.DATE_TIME_PATTERN)); //1.初始化时间参数 Calendar calendar = Calendar.getInstance(); calendar.setTime(new Date()); @@ -99,13 +109,11 @@ public class StatsUserServiceImpl implements StatsUserService { calendar.set(Calendar.MINUTE, NumConstant.ZERO); calendar.set(Calendar.SECOND, NumConstant.ZERO); - //2.初始化时间维度 + //2.初始化时间维度{"dateId":"20210325","monthId":"202103","quarterId":"2021Q1","weekId":"2021W13","yearId":"2021"} DimIdGenerator.DimIdBean timeDimension = DimIdGenerator.getDimIdBean(null == date ? calendar.getTime() : date); - + log.info("timeDimension:"+ JSON.toJSONString(timeDimension)); //3.初始化机关维度 List agencies = dimAgencyService.getAllAgency(customerId); - //List topAgencies = dimAgencyService.getTopAgency(customerId); - //4.计算机关统计数据、生成唯一性统计数据 try { UserStatisticalData agencyData = userService.traverseAgencyUser(agencies, date, timeDimension); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenCustomerWorkRecordDictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenCustomerWorkRecordDictService.java index 6f5ac2573e..98d18d8339 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenCustomerWorkRecordDictService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenCustomerWorkRecordDictService.java @@ -96,11 +96,10 @@ public interface ScreenCustomerWorkRecordDictService extends BaseService data); + void collect(ScreenCollFormDTO data); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgDailyService.java index 6edbb9ba92..c14291c641 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgDailyService.java @@ -30,5 +30,5 @@ import com.epmet.entity.plugins.ScreenWorkRecordOrgDailyEntity; */ public interface ScreenWorkRecordOrgDailyService extends BaseService { - void collectOrgDaily(String customerId, ScreenCollFormDTO data); + void collectOrgDaily(ScreenCollFormDTO data); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgMonthlyService.java index 0e16b4b1fe..7804957e4e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/ScreenWorkRecordOrgMonthlyService.java @@ -32,11 +32,10 @@ public interface ScreenWorkRecordOrgMonthlyService extends BaseService data); + void collect(ScreenCollFormDTO data); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java index 05b1172eb7..7a6291717a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java @@ -107,15 +107,15 @@ public class ScreenCustomerWorkRecordDictServiceImpl extends BaseServiceImpl data) { + public void collect(ScreenCollFormDTO data) { if(data.getIsFirst()){ - int affectedRows = baseDao.deleteBatch(customerId); + int affectedRows = baseDao.deleteBatch(data.getCustomerId()); while(affectedRows > 0){ - affectedRows = baseDao.deleteBatch(customerId); + affectedRows = baseDao.deleteBatch(data.getCustomerId()); } } Lists.partition(data.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { - baseDao.insertBatch(list,customerId,data.getDateId()); + baseDao.insertBatch(list,data.getCustomerId(),data.getDateId()); }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java index c517555fbc..8f4d4f7c84 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java @@ -41,15 +41,15 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl data) { + public void collectOrgDaily(ScreenCollFormDTO data) { if(data.getIsFirst()){ - int affectedRows = baseDao.deleteBatch(customerId,data.getDateId()); + int affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getDateId()); while(affectedRows > 0){ - affectedRows = baseDao.deleteBatch(customerId,data.getDateId()); + affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getDateId()); } } Lists.partition(data.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { - baseDao.insertBatch(list,customerId,data.getDateId()); + baseDao.insertBatch(list,data.getCustomerId(),data.getDateId()); }); } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java index a27cb040aa..7ecd3c4eb6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java @@ -42,7 +42,6 @@ public class ScreenWorkRecordOrgMonthlyServiceImpl extends BaseServiceImpl data) { + public void collect(ScreenCollFormDTO data) { if(data.getIsFirst()){ - int affectedRows = baseDao.deleteBatch(customerId,data.getMonthId()); + int affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getMonthId()); while(affectedRows > 0){ - affectedRows = baseDao.deleteBatch(customerId,data.getMonthId()); + affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getMonthId()); } } Lists.partition(data.getDataList(), NumConstant.ONE_HUNDRED).forEach(list -> { - baseDao.insertBatch(list,customerId,data.getMonthId()); + baseDao.insertBatch(list,data.getCustomerId(),data.getMonthId()); }); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java index 5a27fdca62..84386e9ec3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java @@ -22,6 +22,9 @@ import com.epmet.dto.project.FinishOrgDTO; import com.epmet.dto.project.ProcessInfoDTO; import com.epmet.dto.project.result.ProjectLatestOperationResultDTO; import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; +import com.epmet.dto.screen.ScreenProjectProcessDTO; import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectProcessEntity; @@ -124,4 +127,43 @@ public interface ProjectProcessService extends BaseService * @date 2020.09.28 14:44 */ Map getLatestOperation(List list, String customerId); + + /** + * @Description 查询指定日期关闭的项目 然后将状态由【pending】改为【closed_case】,并加上结案时间 + * @param list + * @param dateId + * @return void + * @author wangc + * @date 2021.03.09 09:54 + */ + void updateProjectStatus(List list, String dateId,String customerId); + + /** + * @Description 查询指定日期关闭的项目 然后将状态由【pending】改为【closed_case】,并加上结案时间 + * @param list + * @return void + * @author wangc + * @date 2021.03.09 09:54 + */ + void updateProjectCloseTime(List list); + + /** + * @Description 构建大屏项目进展数据 + * + * @param customerId + * @param dateId + * @return java.util.List + * @author wangc + * @date 2021.03.09 14:49 + */ + List buildNewScreenProjectProcessData(String customerId,String dateId,boolean ifRanged); + + /** + * @Description 构建节点附件数据 + * @param processIds + * @return java.util.List + * @author wangc + * @date 2021.03.09 16:56 + */ + List buildProcessAttachmentData(List processIds); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java index 2dc0e88aa6..56a99d5257 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java @@ -18,13 +18,17 @@ package com.epmet.service.project; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.ProjectCategoryDTO; import com.epmet.dto.ProjectDTO; import com.epmet.dto.project.ProjectAgencyDTO; import com.epmet.dto.project.ProjectGridDTO; -import com.epmet.dto.project.ProjectInfoDTO; +import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; import com.epmet.entity.project.ProjectEntity; +import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; +import java.util.Set; /** * 项目表 @@ -109,4 +113,43 @@ public interface ProjectService extends BaseService { * @date 2020.11.06 14:14 */ Integer getOvertimeProjectByParameter(String customerId); -} \ No newline at end of file + + /** + * @Description 查找客户项目超期参数 + * + * @param customerId + * @return java.util.List + * @author wangc + * @date 2021.03.05 17:52 + */ + List getProjectExceedParams(@Param("customerId") String customerId); + + /** + * @Description 获取项目相关信息 + * @param projectIds + * @return java.util.List + * @author wangc + * @date 2021.03.08 10:28 + */ + List getProjectInfo(List projectIds); + + /** + * @Description 获取项目的所有标签名称 用-连接 + * @param projectIds + * @return java.util.Map> + * @author wangc + * @date 2021.03.08 23:46 + */ + Map> getProjectCategory(List projectIds); + + /** + * @Description 抽取project_category + * @param customerId + * @param dateId + * @return java.util.List + * @Author liushaowen + * @Date 2021/3/22 15:44 + */ + List getProjectCategoryData(String customerId, String dateId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java index d45bad78ed..d16db0530e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java @@ -20,16 +20,18 @@ package com.epmet.service.project.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.project.ProjectProcessDao; -import com.epmet.dto.form.CommonStaffIdFormDTO; +import com.epmet.dto.ProjectProcessDTO; import com.epmet.dto.project.FinishOrgDTO; import com.epmet.dto.project.ProcessInfoDTO; -import com.epmet.dto.project.ProjectOrgRelationDTO; +import com.epmet.dto.project.ProjectStaffDTO; import com.epmet.dto.project.result.ProjectLatestOperationResultDTO; import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO; -import com.epmet.dto.project.result.ProjectOrgRelationWhenResponseResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; +import com.epmet.dto.screen.ScreenProjectProcessDTO; import com.epmet.entity.project.ProjectEntity; import com.epmet.entity.project.ProjectProcessEntity; import com.epmet.service.project.ProjectProcessService; @@ -39,7 +41,6 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.*; -import java.util.stream.Collector; import java.util.stream.Collectors; /** @@ -91,7 +92,7 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl @@ -125,4 +126,93 @@ public class ProjectProcessServiceImpl extends BaseServiceImplo,(a,n)-> a)); } } + + /** + * @Description 查询指定日期关闭的项目 然后将状态由【pending】改为【closed_case】,并加上结案时间 + * @param list + * @param dateId + * @return void + * @author wangc + * @date 2021.03.09 09:54 + */ + @Override + public void updateProjectStatus(List list,String dateId,String customerId) { + if(CollectionUtils.isEmpty(list)) return; + List closedInfo = baseDao.selectClosedProjectOnAppointedDay(customerId, dateId); + if(CollectionUtils.isEmpty(closedInfo)) return; + + list = list.stream().flatMap(target -> closedInfo.stream().filter(closedCase -> StringUtils.equals(closedCase.getProjectId(),target.getProjectId())).map( + merge -> { + target.setProjectStatusCode("closed_case"); + target.setCloseCaseTime(DateUtils.format(merge.getCreatedTime(),DateUtils.DATE_TIME_PATTERN)); + return target; + } + )).collect(Collectors.toList()); + } + + /** + * @Description 查询指定日期关闭的项目 然后将状态由【pending】改为【closed_case】,并加上结案时间 + * @param list + * @return void + * @author wangc + * @date 2021.03.09 09:54 + */ + @Override + public void updateProjectCloseTime(List list) { + if(CollectionUtils.isEmpty(list)) return; + List closedInfo = baseDao.selectClosedProjectByProjectIds(list.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList())); + if(CollectionUtils.isEmpty(closedInfo)) return; + + list = list.stream().flatMap(target -> closedInfo.stream().filter(closedCase -> StringUtils.equals(closedCase.getProjectId(),target.getProjectId())).map( + merge -> { + //target.setProjectStatusCode("closed_case"); + target.setCloseCaseTime(DateUtils.format(merge.getCreatedTime(),DateUtils.DATE_TIME_PATTERN)); + return target; + } + )).collect(Collectors.toList()); + } + + /** + * @Description 构建大屏项目进展数据 + * + * @param customerId + * @param dateId + * @return java.util.List + * @author wangc + * @date 2021.03.09 14:49 + */ + @Override + public List buildNewScreenProjectProcessData(String customerId, String dateId, boolean ifRanged) { + List processes = baseDao.selectProjectProcessAndDirection(customerId, ifRanged ? null : dateId, dateId); + if(CollectionUtils.isEmpty(processes)) return null; + return processes.stream().map(target -> { + List points = target.getPoints(); + if(!CollectionUtils.isEmpty(points)){ + List orgIds = points.stream().map(ProjectStaffDTO::getOrgId).distinct().collect(Collectors.toList()); + List names = points.stream().map(ProjectStaffDTO::getDepartmentName).distinct().collect(Collectors.toList()); + StringBuilder builder1 = new StringBuilder(); + orgIds.forEach(orgId -> builder1.append(orgId).append(",")); + StringBuilder builder2 = new StringBuilder(); + names.forEach(name -> builder2.append(name).append(",")); + target.setTransferDeptIds(builder1.substring(NumConstant.ZERO,builder1.length() - NumConstant.TWO)); + target.setTransferDeptName(builder2.substring(NumConstant.ZERO,builder2.length() - NumConstant.TWO)); + } + return target; + }).collect(Collectors.toList()); + + } + + + + /** + * @Description 构建节点附件数据 + * @param processIds + * @return java.util.List + * @author wangc + * @date 2021.03.09 16:56 + */ + @Override + public List buildProcessAttachmentData(List processIds) { + return baseDao.selectProcessAttachment(processIds); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java index 5ba8ea04d6..d2a3ff001d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java @@ -24,13 +24,20 @@ import com.epmet.constant.DataSourceConstant; import com.epmet.dao.project.ProjectDao; import com.epmet.dto.ProjectDTO; import com.epmet.dto.project.ProjectAgencyDTO; +import com.epmet.dto.project.ProjectCategoryDTO; import com.epmet.dto.project.ProjectGridDTO; +import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; import com.epmet.entity.project.ProjectEntity; import com.epmet.service.project.ProjectService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import java.util.HashMap; import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; /** * 项目表 @@ -97,4 +104,64 @@ public class ProjectServiceImpl extends BaseServiceImpl + * @author wangc + * @date 2021.03.05 17:52 + */ + @Override + public List getProjectExceedParams(String customerId) { + return baseDao.selectProjectExceedParams(customerId); + } + + /** + * @Description 获取项目相关信息 + * @param projectIds + * @return java.util.List + * @author wangc + * @date 2021.03.08 10:28 + */ + @Override + public List getProjectInfo(List projectIds) { + return baseDao.batchSelectProjectInfo(projectIds); + } + + /** + * @Description 获取项目的所有标签名称 用-连接 + * @param projectIds + * @return java.util.Map> + * @author wangc + * @date 2021.03.08 10:28 + */ + @Override + public Map> getProjectCategory(List projectIds) { + if(CollectionUtils.isEmpty(projectIds)) return null; + List categories = baseDao.selectProjectCategory(projectIds); + if(CollectionUtils.isEmpty(categories)) return null; + Map> map = new HashMap<>(); + Map> projectMap = categories.stream().collect(Collectors.groupingBy(ProjectCategoryDTO::getProjectId)); + projectMap.forEach((k,v) -> { + Set categoryIds = v.stream().map(ProjectCategoryDTO::getCategoryId).collect(Collectors.toSet()); + map.put(k,categoryIds); + }); + return map; + } + + /** + * @param customerId + * @param dateId + * @return java.util.List + * @Description 抽取project_category + * @Author liushaowen + * @Date 2021/3/22 15:44 + */ + @Override + public List getProjectCategoryData(String customerId, String dateId) { + return baseDao.getProjectCategoryData(customerId,dateId); + } + + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java new file mode 100644 index 0000000000..ef8440c594 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/CustomerProjectCategoryDictService.java @@ -0,0 +1,58 @@ +/** + * 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.stats; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.screen.form.CategoryDictFormDTO; +import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; + +import java.util.List; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +public interface CustomerProjectCategoryDictService extends BaseService { + + void initProjectCategory(List insertCategoies, + List updateCategoies); + + /** + * @author yinzuomei + * @description 获取内部客户最近一次初始记录 + * @Date 2021/3/19 14:57 + **/ + CustomerProjectCategoryDictEntity getLatestProjectCategory(); + + CustomerProjectCategoryDictEntity getLatestUpdatedEntity(); + + /** + * 项目分类字典上报 + * 目标表:epmet_evaluation_index库的customer_project_category_dict + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 16:03 2021-03-22 + **/ + void uploadCategoryDict(ScreenCollFormDTO formDTO); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java new file mode 100644 index 0000000000..97a8a560f5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerProjectCategoryDictServiceImpl.java @@ -0,0 +1,119 @@ +/** + * 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.stats.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.stats.CustomerProjectCategoryDictDao; +import com.epmet.dto.screen.form.CategoryDictFormDTO; +import com.epmet.dto.screencoll.ScreenCollFormDTO; +import com.epmet.entity.issue.IssueProjectCategoryDictEntity; +import com.epmet.entity.stats.CustomerProjectCategoryDictEntity; +import com.epmet.service.stats.CustomerProjectCategoryDictService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * 客户项目分类字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-19 + */ +@Slf4j +@DataSource(DataSourceConstant.EVALUATION_INDEX) +@Service +public class CustomerProjectCategoryDictServiceImpl extends BaseServiceImpl implements CustomerProjectCategoryDictService { + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + @Transactional(rollbackFor = Exception.class) + @Override + public void initProjectCategory(List insertCategoies, List updateCategoies) { + log.info(String.format("=============需要插入的条数=%s,更新的条数=%s",insertCategoies.size(),updateCategoies.size())); + insertCategoies.forEach(insertEntity -> { + CustomerProjectCategoryDictEntity entityInsert=new CustomerProjectCategoryDictEntity(); + entityInsert.setCustomerId(insertEntity.getCustomerId()); + entityInsert.setCustomerType("internal"); + entityInsert.setCategoryCode(insertEntity.getCategoryCode()); + entityInsert.setCategoryName(insertEntity.getCategoryName()); + entityInsert.setParentCategoryCode(insertEntity.getParentCategoryCode()); + entityInsert.setLevel(Integer.valueOf(insertEntity.getCategoryType())); + entityInsert.setSort(insertEntity.getSort()); + entityInsert.setIsDisable(insertEntity.getIsDisable()); + entityInsert.setOriginCreatedTime(insertEntity.getCreatedTime()); + entityInsert.setOriginUpdatedTime(insertEntity.getUpdatedTime()); + entityInsert.setCategoryId(insertEntity.getId()); + baseDao.insert(entityInsert); + }); + updateCategoies.forEach(updatedEntity -> { + CustomerProjectCategoryDictEntity entity=baseDao.selectByCustomerIdAndId(updatedEntity.getCustomerId(),updatedEntity.getId()); + if (null != entity) { + entity.setCategoryCode(updatedEntity.getCategoryCode()); + entity.setCategoryName(updatedEntity.getCategoryName()); + entity.setParentCategoryCode(updatedEntity.getParentCategoryCode()); + if (StringUtils.isNotBlank(updatedEntity.getCategoryType())) { + entity.setLevel(Integer.valueOf(updatedEntity.getCategoryType())); + } + entity.setSort(updatedEntity.getSort()); + entity.setIsDisable(updatedEntity.getIsDisable()); + entity.setOriginCreatedTime(updatedEntity.getCreatedTime()); + entity.setOriginUpdatedTime(updatedEntity.getUpdatedTime()); + baseDao.updateById(entity); + } + }); + } + + /** + * @author yinzuomei + * @description 获取内部客户最近一次初始记录 + * @Date 2021/3/19 14:57 + **/ + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + @Override + public CustomerProjectCategoryDictEntity getLatestProjectCategory() { + return baseDao.getLatestProjectCategory(); + } + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX) + @Override + public CustomerProjectCategoryDictEntity getLatestUpdatedEntity() { + return baseDao.getLatestUpdatedEntity(); + } + + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) + @Override + @Transactional(rollbackFor = Exception.class) + public void uploadCategoryDict(ScreenCollFormDTO formDTO) { + if (formDTO.getIsFirst()) { + int deleteNum; + do { + deleteNum = baseDao.deleteCustomerProjectCategoryDict(formDTO.getCustomerId()); + } while (deleteNum > NumConstant.ZERO); + } + if (!CollectionUtils.isEmpty(formDTO.getDataList())) { + baseDao.batchInsertCustomerProjectCategoryDict(formDTO.getDataList(), formDTO.getCustomerId()); + } + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java index 24811db736..feceadf83d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java @@ -63,15 +63,17 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon //1.查询用户与党员数据,判断dimId是否为昨天,如果根据这个dimId没有查询出结果,则取前天的数据 //如果还是查不出数据,继续向下执行,这部分数据设置默认值 - //注册用户数 + //注册用户数 fact_reg_user_grid_daily 或 fact_reg_user_agency_daily agency级别 List result = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(result)){ + // 根据dateId查询为空,先根据当前时间-1天是否和dateId相等,相等的话,查询往前推2天的数据 if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ result = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } if(null == result) result = new LinkedList<>(); } + // 网格级别 List gridUserResult = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); @@ -84,13 +86,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon result.addAll(gridUserResult); } - //2.组 + //2.组 fact_group_grid_daily 或 fact_group_agency_daily List agencyGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(agencyGroup)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ agencyGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } + // 网格级别 List gridGroup = factGroupGridDailyDao.selectGroupCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); if(CollectionUtils.isEmpty(gridGroup)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ @@ -101,13 +104,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon groupMap.putAll(gridGroup.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getGroupTotal))); - //3.话题 + //3.话题 fact_topic_total_grid_daily或fact_topic_total_agency_daily List agencyTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(agencyTopic)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ agencyTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } + // 网格级别 List gridTopic = factTopicTotalGridDailyDao.selectTopicCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); if(CollectionUtils.isEmpty(gridTopic)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ @@ -117,13 +121,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon Map topicMap = agencyTopic.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getTopicTotal)); topicMap.putAll(gridTopic.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getTopicTotal))); - //4.议题 + //4.议题 fact_issue_grid_daily 或 fact_issue_agency_daily List agencyIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(agencyIssue)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ agencyIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } + // 网格级别 List gridIssue = factIssueGridDailyDao.selectIssueCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); if(CollectionUtils.isEmpty(gridIssue)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ @@ -133,13 +138,14 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon Map issueMap = agencyIssue.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal)); issueMap.putAll(gridIssue.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal))); - //5.项目 + //5.项目 fact_grid_project_daily 或 fact_agency_project_daily List agencyProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(agencyProject)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ agencyProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } + // 网格级别 List gridProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); if(CollectionUtils.isEmpty(gridProject)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java index 8acaa3c3ac..5dc7b17392 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/TopicService.java @@ -2,6 +2,8 @@ package com.epmet.service.topic; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.result.TopicInfoResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.screen.ScreenProjectImgDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.stats.DimTopicStatusDTO; import com.epmet.dto.stats.topic.result.TopicStatisticalData; @@ -83,4 +85,23 @@ public interface TopicService { * @date 2020.09.28 16:28 */ Map getTopicContent(List list); + + /** + * @Description 获取大屏项目相关信息 + * + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.08 17:16 + */ + List fillScreenProjectData(List list); + + /** + * @Description 构建新增的大屏项目图片数据 + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.09 13:59 + */ + List buildNewScreenProjectImgData(List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java index 61c926507d..c832202e70 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -2,11 +2,14 @@ package com.epmet.service.topic.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.topic.TopicDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.result.TopicInfoResultDTO; import com.epmet.dto.group.result.TopicContentResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; +import com.epmet.dto.screen.ScreenProjectImgDataDTO; import com.epmet.dto.screen.form.ProjectSourceMapFormDTO; import com.epmet.dto.stats.DimTopicStatusDTO; import com.epmet.dto.stats.topic.*; @@ -71,7 +74,7 @@ public class TopicServiceImpl implements TopicService { agencies.forEach(agency -> { initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); }); - + //计算网格-组-话题映射关系 List topics = topicDao.selectGroupOrderByGrid(targetDate,customerId); topics.forEach(groupTopic -> { if(null != groupTopic.getTopics() && groupTopic.getTopics().size() == NumConstant.ONE && StringUtils.isBlank(groupTopic.getTopics().get(NumConstant.ZERO).getTopicId())){ @@ -144,7 +147,7 @@ public class TopicServiceImpl implements TopicService { List imgs = topicDao.selectTopicImgs(list); if(CollectionUtils.isEmpty(imgs)) return Collections.EMPTY_MAP; //key -> topicId | value -> projectId - Map projectTopicMap = list.stream().collect(Collectors.toMap(ProjectSourceMapFormDTO :: getSourceId,ProjectSourceMapFormDTO :: getProjectId)); + Map projectTopicMap = list.stream().collect(Collectors.toMap(ProjectSourceMapFormDTO :: getSourceId,ProjectSourceMapFormDTO :: getProjectId,(o,n)->n)); //key -> topicId Map> result = imgs.stream().collect(Collectors.groupingBy(ScreenDifficultyImgDataEntity :: getEventId)); @@ -175,7 +178,7 @@ public class TopicServiceImpl implements TopicService { if(CollectionUtils.isEmpty(contents)) return Collections.EMPTY_MAP; Map topicContentMap = contents.stream().collect(Collectors.toMap(TopicContentResultDTO :: getTopicId,TopicContentResultDTO::getContent)); //key -> topicId | value -> projectId - Map projectTopicMap = list.stream().collect(Collectors.toMap(ProjectSourceMapFormDTO :: getSourceId,ProjectSourceMapFormDTO :: getProjectId)); + Map projectTopicMap = list.stream().collect(Collectors.toMap(ProjectSourceMapFormDTO :: getSourceId,ProjectSourceMapFormDTO :: getProjectId,(o,n)->n)); Map result = new HashMap<>(); projectTopicMap.forEach((topic,project) -> { result.put(project,topicContentMap.get(topic)); @@ -183,6 +186,52 @@ public class TopicServiceImpl implements TopicService { return result; } + /** + * @Description 获取大屏项目相关信息 + * + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.08 17:16 + */ + @Override + public List fillScreenProjectData(List list) { + List collection = topicDao.selectScreenProjectData(list); + if(!CollectionUtils.isEmpty(collection)){ + list = list.stream().flatMap(target -> collection.stream().filter( + res -> StringUtils.equals(target.getTopicId(),res.getTopicId()) + ).map(merge -> { + target.setLatitude(merge.getLatitude()); + target.setLongitude(merge.getLongitude()); + target.setProjectContent(merge.getProjectContent()); + target.setProjectAddress(merge.getProjectAddress()); + return target; + })).collect(Collectors.toList()); + } + return collection; + } + + /** + * @Description 构建新增的大屏项目图片数据 + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.09 13:59 + */ + @Override + public List buildNewScreenProjectImgData(List list) { + List imgs = topicDao.initNewScreenProjectImgData(list.get(NumConstant.ZERO).getCustomerId(), list); + if(CollectionUtils.isEmpty(imgs)) return null; + return imgs.stream().flatMap(img -> list.stream().filter(project -> StringUtils.equals(img.getTopicId(),project.getTopicId())).map( + match -> { + ScreenProjectImgDataDTO matchedImg + = ConvertUtils.sourceToTarget(img,ScreenProjectImgDataDTO.class); + matchedImg.setProjectId(match.getProjectId()); + return matchedImg; + } + )).collect(Collectors.toList()); + } + /** * @Description 初始化机关-所有下级网格Map * @param pid - 固定一个机关Id diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index 767af842b0..36229bfbb2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -2,10 +2,10 @@ package com.epmet.service.user; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.util.DimIdGenerator; -import org.apache.ibatis.annotations.Param; import java.util.Date; import java.util.List; @@ -75,4 +75,13 @@ public interface UserService { * @date 2020.09.25 13:54 **/ List getRegisteredUserList(String customerId); + + /** + * @Description 获取大屏项目相关信息 联系人 + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.08 17:16 + */ + List fillScreenProjectData(List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index bc0a9e83d2..b5594541a6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -8,6 +8,7 @@ import com.epmet.dao.user.UserDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; +import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; @@ -61,8 +62,8 @@ public class UserServiceImpl implements UserService { dataPacket.setDateId(timeDimension.getDateId()); dataPacket.setMonthId(timeDimension.getMonthId()); //自上向下检索 - Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); + //subGridOfAgency key:agencyId ,value:当前组织下的所有网格(即直属网格+下级组织下的所有网格) Map> subGridOfAgency = new HashMap<>(); agencies.forEach(agency -> { initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); @@ -70,12 +71,13 @@ public class UserServiceImpl implements UserService { //对每一个机关进行数据统计 if(subGridOfAgency.size() > NumConstant.ZERO){ - subGridOfAgency.forEach((k,v) -> { + //如果当前客户存在组织 + subGridOfAgency.forEach((agencyId,subGridIds) -> { queryUserData(ModuleConstant.DIM_SUB_AGENCY, - k, - (null == agencyMap.get(k) || agencyMap.get(k).isEmpty()) ? NumConstant.ZERO_STR : agencyMap.get(k).get(NumConstant.ZERO).getPid(), - (null == agencyMap.get(k) || agencyMap.get(k).isEmpty()) ? null : agencyMap.get(k).get(NumConstant.ZERO).getCustomerId(), - v, + agencyId, + // (null == agencyMap.get(agencyId) || agencyMap.get(agencyId).isEmpty()) ? NumConstant.ZERO_STR : agencyMap.get(agencyId).get(NumConstant.ZERO).getPid(), + (null == agencyMap.get(agencyId) || agencyMap.get(agencyId).isEmpty()) ? null : agencyMap.get(agencyId).get(NumConstant.ZERO).getCustomerId(), + subGridIds, targetDate, dataPacket, timeDimension); @@ -106,11 +108,11 @@ public class UserServiceImpl implements UserService { //自上向下检索 Map> agencyMap = agencies.stream().collect(Collectors.groupingBy(AgencySubTreeDto::getAgencyId)); if(null != agencyMap && agencyMap.size() > NumConstant.ZERO){ - agencyMap.forEach((k,v) -> { + agencyMap.forEach((agencyId,v) -> { if(null != v && v.size() > NumConstant.ZERO){ queryUserData(ModuleConstant.DIM_BELONGING_GRID, - k, - v.get(NumConstant.ZERO).getPid(), + agencyId, + // v.get(NumConstant.ZERO).getPid(), v.get(NumConstant.ZERO).getCustomerId(), new HashSet<>(v.get(NumConstant.ZERO).getGridIds()), targetDate, @@ -180,22 +182,22 @@ public class UserServiceImpl implements UserService { /** * @Description 初始化机关-所有下级网格Map - * @param pid - 固定一个机关Id + * @param agencyId - 当前组织id * @param agency - AgencySubTreeDto * @param subGridOfAgency - Map> * @return * @author wangc * @date 2020.06.18 15:54 **/ - void initAgencyGridMap(String pid, AgencySubTreeDto agency, Map> subGridOfAgency){ + void initAgencyGridMap(String agencyId, AgencySubTreeDto agency, Map> subGridOfAgency){ //向map中放入数据 - if(subGridOfAgency.containsKey(pid)){ + if(subGridOfAgency.containsKey(agencyId)){ //包含key - Set grids = subGridOfAgency.get(pid); + Set grids = subGridOfAgency.get(agencyId); if(null == grids){ grids = new HashSet<>(); - subGridOfAgency.put(pid,grids); + subGridOfAgency.put(agencyId,grids); } if(null != agency.getGridIds() && agency.getGridIds().size() > NumConstant.ZERO){ grids.addAll(agency.getGridIds()); @@ -203,18 +205,20 @@ public class UserServiceImpl implements UserService { }else{ //不包含key Set grids = new HashSet<>(agency.getGridIds()); - subGridOfAgency.put(pid,grids); + subGridOfAgency.put(agencyId,grids); } - + //外层是从顶级组织向下循环,所以循环到社区时跳出 //定义递归出口 - if(StringUtils.equals(ModuleConstant.AGENCY_LEVEL_COMMUNITY,agency.getLevel()) || null == agency.getSubAgencies() || agency.getSubAgencies().size() == NumConstant.ZERO){ - return ; + if (StringUtils.equals(ModuleConstant.AGENCY_LEVEL_COMMUNITY, agency.getLevel()) + || null == agency.getSubAgencies() + || agency.getSubAgencies().size() == NumConstant.ZERO) { + return; } //定义递归入口 agency.getSubAgencies().forEach(obj -> { - initAgencyGridMap(pid,obj,subGridOfAgency); + initAgencyGridMap(agencyId,obj,subGridOfAgency); }); } @@ -222,7 +226,7 @@ public class UserServiceImpl implements UserService { * @Description 执行查询用户数据统计的逻辑 * @param relation - agency(下级机关加网格) | grid(直属网格) * @param agencyId - * @param pid + * @param //pid 当前agency的父级组织id * @param customerId * @param gridIds - 机关下所有网格集合/机关下直属网格集合 * @param targetDate @@ -232,10 +236,12 @@ public class UserServiceImpl implements UserService { * @author wangc * @date 2020.06.19 10:01 **/ - void queryUserData(String relation, String agencyId, String pid, String customerId, Set gridIds, Date targetDate, UserStatisticalData dataPacket, DimIdGenerator.DimIdBean timeDimension){ - - if(StringUtils.isBlank(pid)) - pid = NumConstant.ZERO_STR; + void queryUserData(String relation, String agencyId, + // String pid, + String customerId, Set gridIds, Date targetDate, UserStatisticalData dataPacket, DimIdGenerator.DimIdBean timeDimension){ + //pid没用到还传过来干啥-- 注释掉 + // if(StringUtils.isBlank(pid)) + // pid = NumConstant.ZERO_STR; dataPacket.setCustomerId(customerId); @@ -252,6 +258,9 @@ public class UserServiceImpl implements UserService { //指定日期 OR T-1 calendar.setTime(targetDateCheck); + //calendar.get(Calendar.DATE) 当前日期数eg:2021-03-29 :29 + //calendar.getActualMinimum(Calendar.DAY_OF_MONTH) :1 + //如果目标日期不是是当月的第一天 if(calendar.get(Calendar.DATE) != calendar.getActualMinimum(Calendar.DAY_OF_MONTH)){ //求出这个月的第一天 @@ -263,7 +272,6 @@ public class UserServiceImpl implements UserService { isMonthBeginning = false; } - if(StringUtils.equals(ModuleConstant.DIM_SUB_AGENCY,relation)){ @@ -395,8 +403,6 @@ public class UserServiceImpl implements UserService { partiAgencyM.setWarmHeartedProportion(partiAgencyD.getWarmHeartedProportion()); partiAgencyM.setCreatedBy(ModuleConstant.CREATED_BY_STATISTICAL_ROBOT); - - //如果是月初第一天,不再做日期区间查询 if(isMonthBeginning) { if (null == dataPacket.getRegAgencyMonthlyList()) { @@ -415,6 +421,7 @@ public class UserServiceImpl implements UserService { } }else{ //如果不是月初第一天 + //targetDateCheck:定时任务参数中的date;calendar.getTime():date所属月第一天; //本月注册用户增长数 Integer regIncrMonthly = userDao.selectResiIncrWithinTimeRange(ModuleConstant.REG_OR_PARTI_FLAG_REG,gridIds,calendar.getTime(),targetDateCheck); @@ -728,4 +735,24 @@ public class UserServiceImpl implements UserService { return userList; } + /** + * @Description 获取大屏项目相关信息 联系人 + * @param list + * @return java.util.List + * @author wangc + * @date 2021.03.08 17:16 + */ + @Override + public List fillScreenProjectData(List list) { + List collection = userDao.selectScreenProjectData(list); + if(!CollectionUtils.isEmpty(collection)){ + list = list.stream().flatMap(target -> collection.stream().filter(res -> StringUtils.equals(target.getLinkName(),res.getTopicId())) + .map(merge -> { + target.setLinkName(merge.getLinkName()); + target.setLinkMobile(merge.getLinkMobile()); + return target;})).collect(Collectors.toList()); + } + return collection; + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml index dfbb2b9a4c..f94ee99777 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /data/stats @@ -98,7 +99,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.10__add_project_category_analysis.sql b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.10__add_project_category_analysis.sql new file mode 100644 index 0000000000..391bb2af03 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.10__add_project_category_analysis.sql @@ -0,0 +1,47 @@ +-- epmet_data_statistical 库: +drop table if exists fact_origin_project_category_daily; +CREATE TABLE `fact_origin_project_category_daily` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `PROJECT_ID` varchar(64) NOT NULL COMMENT '项目id', + `CATEGORY_CODE` varchar(50) NOT NULL COMMENT '分类编码', + `PARENT_CATEGORY_CODE` varchar(50) NOT NULL COMMENT '所属父类分类编码', + `LEVEL` int(11) NOT NULL COMMENT '分类等级:1、2....;产品目前只有2级分类', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='项目所属分类表'; + +-- epmet_data_statistical_display 、epmet_evaluation_index: +drop table if exists customer_project_category_dict; +CREATE TABLE `customer_project_category_dict` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `CUSTOMER_TYPE` varchar(20) NOT NULL COMMENT '外部客户:external;内部客户:internal', + `CATEGORY_CODE` varchar(64) NOT NULL COMMENT '客户自己的分类编码', + `CATEGORY_NAME` varchar(500) CHARACTER SET utf8 NOT NULL COMMENT '客户自己的分类名称', + `PARENT_CATEGORY_CODE` varchar(64) NOT NULL COMMENT '父类分类编码,如果是一级分类,此列赋值为0', + `LEVEL` int(11) NOT NULL COMMENT '分类等级:1、2....;产品只有2级分类', + `SORT` int(11) unsigned NOT NULL COMMENT '排序', + `IS_DISABLE` varchar(32) CHARACTER SET utf8 NOT NULL COMMENT '是否禁用(enable:启用 disable:禁用)', + `EPMET_CATEGORY_CODE` varchar(64) DEFAULT NULL COMMENT '对应e世通中的分类编码,没有此列为空', + `ORIGIN_CREATED_TIME` datetime DEFAULT NULL COMMENT '原始创建时间', + `ORIGIN_UPDATED_TIME` datetime DEFAULT NULL COMMENT '原始更新时间', + `CATEGORY_ID` varchar(64) NOT NULL COMMENT '分类字典表主键', + `DEL_FLAG` char(1) NOT NULL DEFAULT '0' COMMENT '删除标识 0未删除;1已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE, + UNIQUE KEY `UN_KEY` (`CUSTOMER_ID`,`CATEGORY_CODE`) USING BTREE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='客户项目分类字典表'; +-- epmet_data_statistical_display 、epmet_evaluation_index: + +alter table screen_project_category_org_daily add column `LEVEL` int(11) NOT NULL COMMENT '分类等级1、2....'; +alter table screen_project_category_grid_daily add column `LEVEL` int(11) NOT NULL COMMENT '分类等级1、2....'; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml index 88c12c8deb..fad1ca0443 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerRelationDao.xml @@ -34,4 +34,9 @@ #{customerId}, '%') + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml new file mode 100644 index 0000000000..7836274c05 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml @@ -0,0 +1,65 @@ + + + + + + + DELETE + FROM + fact_origin_project_category_daily + WHERE + CUSTOMER_ID = #{customerId} + + AND DATE_FORMAT(CREATED_TIME,'%Y%m%d') = #{dateId} + + + + + + + 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 6ba1ac05cf..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 @@ -142,9 +142,11 @@ WHERE fias.del_flag = 0 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") @@ -152,24 +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 2ba5e4ef54..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 @@ -142,6 +142,7 @@ 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") @@ -168,4 +169,25 @@ 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 d5f2e9b8a0..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} @@ -172,4 +173,25 @@ 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 87992f8ee7..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 @@ -198,6 +198,7 @@ AND figc.month_id = #{monthId} AND figc.index_code = #{indexCode} 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 8f93aa364b..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 @@ -173,4 +173,57 @@ AND gm.month_id = #{monthId} 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 26974bd968..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 @@ -132,7 +132,7 @@ - SELECT pm.AGENCY_ID, pm.PARENT_ID, @@ -146,8 +146,44 @@ LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = pm.AGENCY_ID WHERE pm.del_flag = '0' - 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 9bf7bc2570..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,7 +127,49 @@ LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = sm.AGENCY_ID WHERE sm.del_flag = '0' + 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 dbc3146388..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 @@ -390,4 +390,30 @@ WHERE DEL_FLAG = 0 and sca.AREA_CODE like CONCAT(#{areaCode},'%') + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index c6ad68ca8b..e5d0c1a183 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -359,4 +359,17 @@ AND cg.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 index bc84c6b2df..ba818db4ef 100644 --- 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 @@ -3,29 +3,6 @@ - - - - - - - - - - - - - - - - - - - - - - - delete from screen_project_category_grid_daily where customer_id = #{customerId} @@ -33,5 +10,37 @@ 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 index 5d8cd9a73a..07b8d2f5b8 100644 --- 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 @@ -2,31 +2,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - delete from screen_project_category_org_daily where customer_id = #{customerId} @@ -34,4 +9,58 @@ 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 index 82e0587dc5..51c75a1c17 100644 --- 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 @@ -40,4 +40,136 @@ 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 index 3604a5df25..a9caf4992e 100644 --- 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 @@ -18,4 +18,44 @@ + + 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/ScreenProjectProcessAttachmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectProcessAttachmentDao.xml index 8560281d3b..953f2bee72 100644 --- 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 @@ -26,5 +26,63 @@ + + 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 index 06023e11b6..fc19f60add 100644 --- 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 @@ -10,4 +10,67 @@ 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/issue/IssueProjectCategoryDictDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml new file mode 100644 index 0000000000..50185c99cb --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/IssueProjectCategoryDictDao.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + 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 bd307d1d78..ce72f989f2 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 @@ -287,4 +287,18 @@ AND DATE_FORMAT(ivd.CREATED_TIME,'%Y%m%d') = #{dateId} + + \ 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..ec1cf07215 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 @@ -106,4 +106,43 @@ 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/stats/CustomerProjectCategoryDictDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml new file mode 100644 index 0000000000..2802dc7625 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerProjectCategoryDictDao.xml @@ -0,0 +1,95 @@ + + + + + + + + + + + + delete from customer_project_category_dict + where CUSTOMER_ID = #{customerId} + limit 1000; + + + + insert into customer_project_category_dict + ( + ID, + CUSTOMER_ID, + CUSTOMER_TYPE, + CATEGORY_CODE, + CATEGORY_NAME, + PARENT_CATEGORY_CODE, + `LEVEL`, + SORT, + IS_DISABLE, + EPMET_CATEGORY_CODE, + ORIGIN_CREATED_TIME, + ORIGIN_UPDATED_TIME, + CATEGORY_ID, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{customerId}, + 'external', + #{item.categoryCode}, + #{item.categoryName}, + #{item.parentCategoryCode}, + #{item.level}, + #{item.sort}, + 'enable', + #{item.epmetCategoryCode}, + #{item.originCreatedTime}, + #{item.orginUpdatedTime}, + #{item.categoryId}, + 0, + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + 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/data-statistical/data-statistical-server/src/test/java/resources/数据对接.txt b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据对接.txt new file mode 100644 index 0000000000..7d03dd36f8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/数据对接.txt @@ -0,0 +1,12 @@ +截止到2021-03-25数据对接外部客户: +1、市北党建 +2、安宁e家 +3、大美孔村街道 +4、e锦水街道(没有自己的大屏) +5、微笑榆山街道(没有自己的大屏) +产品自己的客户上线的大屏: +1、城阳 +2、临沂龙湾社区 +3、平阴县 +孔村、锦水、榆山这三个街道的数据上报时间要早于平阴县计算的时间,目前已经按天上报和按月上报的,让孔村、榆山、锦水调整到2点前推送了。 + 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/java/com/epmet/service/impl/AreaCodeServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java index 5e865cfc44..f34ff30605 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/AreaCodeServiceImpl.java @@ -593,6 +593,7 @@ public class AreaCodeServiceImpl extends BaseServiceImpl list = childDao.selectByPCodeAndName(formDTO.getParentAreaCode().trim(), formDTO.getName().trim()); if (CollUtil.isNotEmpty(list)) { throw new RenException("name已存在"); 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 08233fc452..e571e5282c 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 @@ -230,7 +230,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)); @@ -242,7 +242,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) -> { @@ -259,11 +259,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(); @@ -291,7 +291,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); @@ -315,7 +315,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())) { @@ -324,7 +324,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl service.sendSmsMsg(sysSmsDTO); } } 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/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java index 4dc7c78948..9ea39f25a7 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/WxmpMessageExtServiceImpl.java @@ -9,6 +9,8 @@ import com.epmet.dto.result.WxmpTemplateListResultDTO; import com.epmet.service.UserMessageService; import com.epmet.service.WxmpMessageExtService; import com.epmet.service.WxmpMessageService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -24,6 +26,8 @@ import java.util.List; */ @Service public class WxmpMessageExtServiceImpl implements WxmpMessageExtService { + + private Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private WxmpMessageService wxmpMessageService; @Autowired @@ -59,7 +63,14 @@ public class WxmpMessageExtServiceImpl implements WxmpMessageExtService { wxmpMsgList.add(wxSubscribeMessageFormDTO); } } - wxmpMessageService.sendWxSubscribeMessage(wxmpMsgList); + if (wxmpMsgList.size() > 0){ + try { + wxmpMessageService.sendWxSubscribeMessage(wxmpMsgList); + }catch (Exception e){ + logger.error("微信消息发送失败,入参:{},错误信息:{}",wxmpMsgList,e.getMessage()); + } + + } return userMessageService.saveUserMessageList(userMsgList); } 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 BaseServiceImplcom.epmet epmet-commons-tools 2.0.0 + + + feign-form-spring + io.github.openfeign.form + + com.github.binarywang @@ -32,6 +38,21 @@ 2.0.0 compile + + io.github.openfeign.form + feign-form + 3.8.0 + + + io.github.openfeign.form + feign-form-spring + 3.8.0 + + + commons-fileupload + commons-fileupload + 1.3.3 + diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ApiServiceActions.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ApiServiceActions.java new file mode 100644 index 0000000000..e754e8f31e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ApiServiceActions.java @@ -0,0 +1,11 @@ +package com.epmet.constant; + +/** + * api service 常量列表 + */ +public interface ApiServiceActions { + + // 测试动作 + String DEMO_ACTION = "demoAction"; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java new file mode 100644 index 0000000000..dc17deca39 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java @@ -0,0 +1,22 @@ +package com.epmet.constant; + +/** + * 第三方平台动作常量 + * @author kamui + */ +public interface ThirdPlatformActions { + + /** + * 获取accessToken + */ + String GET_ACCESS_TOKEN = "GET_ACCESS_TOKEN"; + /** + * 项目协助 + */ + String PROJECT_ASSIST = "PROJECT_ASSIST"; + /** + * 上传文件 + */ + String UPLOAD_FILE = "UPLOAD_FILE"; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java new file mode 100644 index 0000000000..7a8efc43cd --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/ThirdPlatformDTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @auther: zhangyong + * @date: 2021-04-08 17:27 + */ +@Data +public class ThirdPlatformDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 平台名称 + */ + @NotBlank(message = "平台名称 不能为空") + private String platformName; + + /** + * 平台唯一KEY + */ + @NotBlank(message = "平台唯一KEY 不能为空") + private String platformKey; + + /** + * 平台秘钥 + */ + @NotBlank(message = "平台秘钥 不能为空") + private String platformSecret; + + /** + * apiservice + */ + @NotBlank(message = "apiservice 不能为空") + private String apiService; + + /** + * 基础url + */ + @NotBlank(message = "基础url 不能为空") + private String baseUrl; + + /** + * icon + */ + @NotBlank(message = "icon 不能为空") + private String icon; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java new file mode 100644 index 0000000000..d2defb259d --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CustomerFormDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 客户 共用入参 + **/ +@Data +public class CustomerFormDTO { + + /** + * 客户id + **/ + @NotBlank(message = "客户id 不能为空") + private String customerId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java new file mode 100644 index 0000000000..2fe4f8ed45 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformNameFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class PlatformNameFormDTO { + + /** + * 平台名称,用于模糊搜索 + **/ + @NotBlank(message = "平台名称 不能为空") + private String platformName; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java new file mode 100644 index 0000000000..9f7afda3ae --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformRegisterFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * 第三方平台-新增客户接入的第三方平台 + * + * @auther: zhangyong + * @date: 2021-04-08 17:27 + */ +@Data +public class PlatformRegisterFormDTO { + + /** + * 客户id + */ + @NotBlank(message = "客户id 不能为空") + private String customerId; + + /** + * 平台id列表 + */ + @NotNull(message = "平台id列表 不能为空") + private List platformIdList; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java new file mode 100644 index 0000000000..04cc64ae77 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/PlatformUnregisterFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 解除客户接入的平台 + * + * @auther: zhangyong + * @date: 2021-04-08 17:27 + */ +@Data +public class PlatformUnregisterFormDTO { + + /** + * 客户id + */ + @NotBlank(message = "客户id 不能为空") + private String customerId; + + /** + * 平台ID + */ + @NotBlank(message = "平台ID 不能为空") + private String platformId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java new file mode 100644 index 0000000000..ca273d70db --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java @@ -0,0 +1,107 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author kamui + */ +@Data +public class ProjectApplyAssistFormDTO implements Serializable { + + private static final long serialVersionUID = 2052722763454170462L; + private String customerId; + + @NotBlank(message = "平台ID不能为空") + private String platformId; + /** + * 标题 + */ + private String title; + /** + * 详细内容 + */ + @NotBlank(message = "详细内容不能为空") + private String detail; + /** + * 期望结束时间 + */ + private String expectEndTime; + /** + * 图片链接,英文逗号分割的字符串 + */ + private String imageLink; + /** + * 音频链接,英文逗号分割的字符串 + */ + private String voiceLink; + /** + * 视频链接,英文逗号分割的字符串 + */ + private String videoLink; + /** + * 当事人姓名 + */ + private String personName; + /** + * 当事人手机 + */ + private String mobile; + /** + * 详细地址 + */ + @NotBlank(message = "详细地址不能为空") + private String detailAddress; + /** + * 来源,需根据调用方,传对应的值, + * 封面新闻需传:“群众爆料”, + * 党建引领传:“党建引领 + */ + @NotBlank(message = "来源不能为空") + private String source; + /** + * 经度 + */ + @NotBlank(message = "经度不能为空") + private String longitude; + /** + * 纬度 + */ + @NotBlank(message = "纬度不能为空") + private String latitude; + /** + * 省 + */ + private String province; + /** + * 市 + */ + private String city; + /** + * 区县 + */ + private String area; + /** + * 街道 + */ + private String street; + /** + * 社区 + */ + private String houseEstate; + /** + * 外部事件id + */ + private String outEventId; + /** + * 外部用户id + */ + private String outUserId; + /** + * 通知接口的地址 + */ + private String notifyUrl; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectDetailDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectDetailDTO.java new file mode 100644 index 0000000000..8fb394aa93 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectDetailDTO.java @@ -0,0 +1,87 @@ +package com.epmet.dto.form; + +import lombok.Data; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import org.hibernate.validator.constraints.Length; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/3/18 17:12 + */ +@Data +public class ProjectDetailDTO implements Serializable { + private static final long serialVersionUID = -2172640364021337846L; + /** + * 议题标题 + */ + private String issueTitle; + + /** + * 议题状态(voting 已转项目:shift_project 已关闭:closed) + */ + private String issueStatus; + + /** + * 议题发起人电话 + * */ + private String issuePublisherMobile; + + /** + * 议题建议处理方式 + */ + private String issueSuggestion; + + /** + * 所属网格(网格所属机关单位名称-网格名称) + */ + private String belongsGridName; + + /** + * 议题发起人(山东路168-尹女士) + */ + private String issueInitiator; + + /** + * 话题内容 + */ + private String topicContent; + + /** + * 图片列表 + */ + private List photoList; + + /** + * 话题发表人(山东路168-尹女士) + */ + private String topicPublisher; + + /** + * 话题发表时间 (时间戳 毫秒级) + */ + private Long topicPublishTime; + + /** + * 话题发表人电话 + */ + private String topicPublisherMobile; + /** + * 公开答复 + */ + private String publicReply; + /** + * 内部备注 + */ + private String internalRemark; + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this, ToStringStyle.SIMPLE_STYLE); + } + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveOrUpdateCustSelPlatformFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveOrUpdateCustSelPlatformFormDTO.java new file mode 100644 index 0000000000..5ba026cd80 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SaveOrUpdateCustSelPlatformFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.util.List; + +@Data +public class SaveOrUpdateCustSelPlatformFormDTO { + + @NotBlank(message = "客户id不能为空") + private String customerId; + + @NotBlank(message = "actionKey不能为空") + private String actionKey; + + private List platforms; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/TPFDemoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/TPFDemoFormDTO.java new file mode 100644 index 0000000000..c790a4a529 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/TPFDemoFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * 第三方平台-demo form dto + */ +@Data +public class TPFDemoFormDTO { + + private String demoString; + + @NotBlank(message = "客户ID不能为空") + private String customerId; + + @NotBlank(message = "平台ID不能为空") + private String platformId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java new file mode 100644 index 0000000000..185eb5cab9 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java @@ -0,0 +1,53 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class ThirdPlatformFormDTO { + + // 根据客户和动作查询分组 + public interface ListAvailableByCustomerAndActionGroup {} + // 根据动作查询分组 + public interface ListSelectableByCustomerAndActionGroup {} + + // 保存客户选中的平台列表 + public interface SaveCustomerSelectedPlatformGroup {} + + // 列出客户选中的平台列表 + public interface ListSelectedPlatforms {} + + // 更新客户自定义的平台信息 + public interface UpdateCustomizePlatformInfo {} + + public interface SaveOrUpdateSelectedPlatformInfo {} + + @NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, + ListSelectableByCustomerAndActionGroup.class, + SaveCustomerSelectedPlatformGroup.class, + ListSelectedPlatforms.class, + UpdateCustomizePlatformInfo.class, + SaveOrUpdateSelectedPlatformInfo.class }) + private String customerId; + + @NotBlank(message = "动作不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, + ListSelectableByCustomerAndActionGroup.class, + SaveCustomerSelectedPlatformGroup.class, + SaveOrUpdateSelectedPlatformInfo.class }) + private String actionKey; + + @NotBlank(message = "平台ID不能为空", groups = { SaveCustomerSelectedPlatformGroup.class, + UpdateCustomizePlatformInfo.class, + SaveOrUpdateSelectedPlatformInfo.class }) + private String platformId; + + @NotBlank(message = "平台名称不能为空", groups = { UpdateCustomizePlatformInfo.class, + SaveOrUpdateSelectedPlatformInfo.class }) + private String platformName; + + @NotBlank(message = "平台图标不能为空", groups = { UpdateCustomizePlatformInfo.class, + SaveOrUpdateSelectedPlatformInfo.class }) + private String icon; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadFileFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadFileFormDTO.java new file mode 100644 index 0000000000..d5c060a4e5 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadFileFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form; + +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/3/25 9:57 + */ +@Data +public class UploadFileFormDTO implements Serializable { + private static final long serialVersionUID = 2911010733366812636L; + /** + * 客户ID + */ + private String customerId; + + /** + * 平台ID + */ + @NotBlank(message = "平台ID不能为空") + private String platformId; + + /** + * 文件 + */ + private MultipartFile file; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ProjectAssistResult.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ProjectAssistResult.java new file mode 100644 index 0000000000..f306ccd4da --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ProjectAssistResult.java @@ -0,0 +1,13 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class ProjectAssistResult { + + /** + * 任务id + */ + private String taskId; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java new file mode 100644 index 0000000000..6b0b163048 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class ThirdplatformResultDTO { + /** + * + */ + private String platformId; + + private String platformName; + + private String icon; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/UploadFileResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/UploadFileResultDTO.java new file mode 100644 index 0000000000..e3916e8a07 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/UploadFileResultDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/3/25 10:09 + */ +@Data +public class UploadFileResultDTO implements Serializable { + private static final long serialVersionUID = -4986665750488963082L; + private String url; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java new file mode 100644 index 0000000000..125bcb0f48 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdOpenFeignClient.java @@ -0,0 +1,64 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.ProjectDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.feign.fallback.EpmetThirdOpenFeignClientFallback; +import com.epmet.feign.fallback.GovProjectOpenFeignClientFallback; +import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; +import feign.codec.Encoder; +import feign.form.spring.SpringFormEncoder; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.context.annotation.Bean; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * 本服务对外开放的API,其他服务通过引用此client调用该服务 + * + * @author zhaoqifeng + * @date 2021/3/18 14:18 + */ +// @FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = EpmetThirdOpenFeignClientFallback.class,configuration = +// EpmetThirdOpenFeignClient.MultipartSupportConfig.class,url = "localhost:8110") +@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = EpmetThirdOpenFeignClientFallback.class, configuration = + EpmetThirdOpenFeignClient.MultipartSupportConfig.class) +public interface EpmetThirdOpenFeignClient { + /** + * 请求项目协助 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/3/18 11:08 + */ + @PostMapping("third/project/apply-assist") + Result applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO); + + /** + * 上传文件 + * @author zhaoqifeng + * @date 2021/3/25 18:36 + * @param file + * @param customerId + * @param platformId + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping(value= "third/project/uploadfile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + Result uploadFile(@RequestPart("file") MultipartFile file, @RequestParam("customerId") String customerId, @RequestParam( + "platformId") String platformId); + + class MultipartSupportConfig { + @Bean + public Encoder feignFormEncoder() { + return new SpringFormEncoder(); + } + } + + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java new file mode 100644 index 0000000000..4a139daabd --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java @@ -0,0 +1,37 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO; +import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; +import com.epmet.feign.fallback.ThirdOpenFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + +@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class) +//@FeignClient(name = ServiceConstant.EPMET_THIRD_SERVER, fallback = ThirdOpenFeignClientFallback.class, url = "http://localhost:8110") +public interface ThirdOpenFeignClient { + + /** + * @Description 保存或修改客户选中的第三方平台信息 + * @return + * @author wxz + * @date 2021.03.19 15:25 + */ + @PostMapping("/third/thirdplatform/customer/saveorupdate-selected-platforms") + Result saveOrUpdateSelectedPlatformsInfo(@RequestBody SaveOrUpdateCustSelPlatformFormDTO input); + + /** + * 根据客户id和动作,列出客户在指定动作下可用的第三方平台 + * 用途:工作端,运营端配置界面 + * + * @param input + * @return + */ + @PostMapping("/third/thirdplatform/customer/list-available-platforms-by-action") + Result> listAvailablePlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input); +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java new file mode 100644 index 0000000000..89f2245fce --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdOpenFeignClientFallback.java @@ -0,0 +1,52 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.ProjectDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.feign.EpmetThirdOpenFeignClient; +import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; +import org.springframework.stereotype.Component; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +/** + * + * @author zhaoqifeng + * @date 2021/3/18 14:17 + */ +@Component +public class EpmetThirdOpenFeignClientFallback implements EpmetThirdOpenFeignClient { + + /** + * 请求项目协助 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/3/18 11:08 + */ + @Override + public Result applyAssist(ProjectApplyAssistFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "applyAssist", formDTO); + } + + /** + * 上传文件 + * + * @param file + * @param customerId + * @param platformId + * @return com.epmet.commons.tools.utils.Result + * @author zhaoqifeng + * @date 2021/3/25 18:36 + */ + @Override + public Result uploadFile(MultipartFile file, String customerId, String platformId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "uploadFile", customerId); + } + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java new file mode 100644 index 0000000000..57a9c808c3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java @@ -0,0 +1,25 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.SaveOrUpdateCustSelPlatformFormDTO; +import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; +import com.epmet.feign.ThirdOpenFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class ThirdOpenFeignClientFallback implements ThirdOpenFeignClient { + @Override + public Result saveOrUpdateSelectedPlatformsInfo(SaveOrUpdateCustSelPlatformFormDTO input) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveOrUpdateSelectedPlatformsInfo", input); + } + + @Override + public Result> listAvailablePlatformsByCustomerAndAction(ThirdPlatformFormDTO input) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "listAvailablePlatformsByCustomerAndAction", input); + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index ee37509ddc..fdd764c6e0 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -148,13 +148,6 @@ compile - - - com.aliyun - alibaba-dingtalk-service-sdk - 1.0.1 - - diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java new file mode 100644 index 0000000000..36117287e1 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java @@ -0,0 +1,261 @@ +package com.epmet.apiservice; + +import com.alibaba.fastjson.JSON; +import com.epmet.apiservice.result.LZGridPlatformBaseResult; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.dao.ThirdplatformActionDao; +import com.epmet.dao.ThirdplatformCustomerRegisterDao; +import com.epmet.dao.ThirdplatformDao; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; +import com.epmet.dto.form.TPFDemoFormDTO; +import com.epmet.dto.form.UploadFileFormDTO; +import com.epmet.dto.result.ProjectAssistResult; +import com.epmet.dto.result.UploadFileResultDTO; +import com.epmet.entity.ThirdplatformActionEntity; +import com.epmet.entity.ThirdplatformCustomerRegisterEntity; +import com.epmet.entity.ThirdplatformEntity; +import lombok.extern.slf4j.Slf4j; +import org.springframework.data.redis.core.RedisTemplate; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * ApiService,对接第三方平台的抽象类。每一个子类都对应一个第三方平台,每个第三方平台都实现唯一一个子类 + * 每一个具体平台的ApiService都是该抽象类的子类,选择性实现抽象类中的某些需要实现方法,提供具体业务逻辑 + * 此抽象类中定义方法的具体返回类型,所有子类都要统一使用,在具体实现中做转换。若是不需要返回,返回null即可。 + */ +@Slf4j +public abstract class ApiService { + /** + * 重试次数 + */ + protected final int RETRY_TIME = 3; + + /** + * @Description 判断该客户是否注册了该平台 + * @return true:已注册该平台,可以使用;false:未注册,无法使用 + * @author wxz + * @date 2021.03.15 11:09 + */ + public boolean isRegistered(String customerId, String platformId) { + ThirdplatformCustomerRegisterDao tpcRegDao = SpringContextUtils.getBean(ThirdplatformCustomerRegisterDao.class); + ThirdplatformCustomerRegisterEntity tpcReg = tpcRegDao.getByCustomerIdAndPlatformId(customerId, platformId); + if (tpcReg == null) { + return false; + } + return true; + } + + /** + * 发送get请求。目前仅支持GET/POST + * @param platformId + * @param action + * @param params + * @param headers + * @return + */ + public String sendGetRequest(String platformId, String action, Map params, Map headers) { + // 1.获取token + String accessToken = getAccessToken(platformId); + //2.获取url + ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId); + ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class) + .getByPlatformIdAndActionKey(platformId, action); + + if (headers == null) { + headers = new HashMap<>(); + } + + // 填充access token到头当中 + headers.put("X-Access-Token", accessToken); + log.info("apiService sendGetRequest param:{},headers:{}",params,headers); + Result result = HttpClientManager.getInstance().sendGet(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()), + thirdplatform.getBaseUrl().startsWith("https://"), + params, + headers); + log.info("apiService sendGetRequest result:{}",JSON.toJSONString(result)); + if (result == null) { + throw new RenException("请求第三方平台,获取AccessToken失败。result为null"); + } + if (result.success()) { + throw new RenException("请求第三方平台,获取AccessToken失败。"); + } + LZGridPlatformBaseResult platformResult = JSON.parseObject(result.getData(), LZGridPlatformBaseResult.class); + judgeResultSuccess(platformResult); + return result.getData(); + } + + /** + * 发送post请求 + * @param platformId + * @param action + * @param jsonString + * @param headers + * @return + */ + public String sendPostRequest(String platformId, String action, String jsonString, Map headers) { + // 1.获取token + String accessToken = getAccessToken(platformId); + //2.获取url + ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId); + ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class) + .getByPlatformIdAndActionKey(platformId, action); + + if (headers == null) { + headers = new HashMap<>(); + } + + // 填充access token到头当中 + headers.put("X-Access-Token", accessToken); + + log.info("apiService sendPostRequest param:{},headers:{}",jsonString,headers); + Result result = HttpClientManager.getInstance().sendPost(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()), + thirdplatform.getBaseUrl().startsWith("https://"), + jsonString, + headers); + log.info("apiService sendPostRequest result:{}",JSON.toJSONString(result)); + if (result == null) { + throw new RenException("请求第三方平台,发送Post请求失败。result为null"); + } + if (!result.success()) { + throw new RenException("请求第三方平台,发送Post请求失败。错误信息:" + result.getMsg()); + } + + LZGridPlatformBaseResult platformResult = JSON.parseObject(result.getData(), LZGridPlatformBaseResult.class); + judgeResultSuccess(platformResult); + return result.getData(); + } + + public String sendPostRequestToUploadFile(String platformId, String action, File file, String fileName) { + // 1.获取token + String accessToken = getAccessToken(platformId); + //2.获取url + ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId); + ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class) + .getByPlatformIdAndActionKey(platformId, action); + + Map headers = new HashMap<>(); + + // 填充access token到头当中 + headers.put("X-Access-Token", accessToken); + log.info("apiService sendPostRequestToUploadFile fileName:{}",headers); + Result result = HttpClientManager.getInstance().uploadFile(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()), + thirdplatform.getBaseUrl().startsWith("https://"), + file, + fileName, + headers); + log.info("apiService sendPostRequestToUploadFile result:{}",JSON.toJSONString(result)); + if (result == null) { + throw new RenException("请求第三方平台,发送Post请求失败。result为null"); + } + if (!result.success()) { + throw new RenException("请求第三方平台,发送Post请求失败。错误信息:" + result.getMsg()); + } + + LZGridPlatformBaseResult platformResult = JSON.parseObject(result.getData(), LZGridPlatformBaseResult.class); + + // token过期重试逻辑,先不加 + //if ("402".equals(platformResult.getCode())) { + // // 如果token过期 + // deleteAccessTokenFromCache(platformId); + // getAccessToken(platformId); + // return sendPostRequest(platformId, action, jsonString, headers); + //} + judgeResultSuccess(platformResult); + return result.getData(); + } + + /** + * @Description 获取accessToken,由子类具体实现 + * @return + * @author wxz + * @date 2021.03.16 13:45 + */ + public abstract String getAccessToken(String platformId); + + /** + * @Description 从缓存中删除AccessToken + * @return + * @author wxz + * @date 2021.03.24 15:35 + */ + protected void deleteAccessTokenFromCache(String platformId) { + RedisTemplate stringRedisTemplate = SpringContextUtils.getBean("redisTemplate", RedisTemplate.class); + stringRedisTemplate.delete(RedisKeys.getThirdPlatformAccessTokenKey(platformId)); + } + + /** + * @Description 添加AccessToken到缓存 + * @return + * @author wxz + * @date 2021.03.24 15:32 + */ + protected void addAccessTokenToCache(String platformId, String accessToken, long expire, TimeUnit timeUnit) { + RedisTemplate stringRedisTemplate = SpringContextUtils.getBean("redisTemplate", RedisTemplate.class); + stringRedisTemplate.opsForValue().set(RedisKeys.getThirdPlatformAccessTokenKey(platformId), accessToken, expire, timeUnit); + } + + /** + * @Description 从缓存中取token + * @return + * @author wxz + * @date 2021.03.24 15:40 + */ + protected String getAccessTokenFromCache(String platformId) { + RedisTemplate stringRedisTemplate = SpringContextUtils.getBean("redisTemplate", RedisTemplate.class); + return stringRedisTemplate.opsForValue().get(platformId); + } + + /** + * @Description 判断客户是否注册了指定的平台,如果没有注册,则抛出异常 + * @return + * @author wxz + * @date 2021.03.15 21:39 + */ + public void judgeRegistered(String customerId, String platformId) { + if (!isRegistered(customerId, platformId)) { + throw new RenException(String.format("客户:%s没有配置第三方平台:%s", customerId, platformId)); + } + } + + /** + * @Description demo示例方法 + * @return + * @author wxz + * @date 2021.03.15 10:46 + */ + public String demoAction(TPFDemoFormDTO tpfDemoFormDTO) { + return "do success !!"; + } + + /** + * @Description 项目协同处理 + * @return 项目协同处理的Result。具体的平台返回的结果最终都要转化为这个ProjectAssistResult返回 + * @author wxz + * @date 2021.03.16 09:28 + */ + public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) { + return null; + } + + /** + * @Description 判断第三方平台返回结果成功失败。如果失败,则抛出异常 + * @return + * @author wxz + * @date 2021.03.22 10:32 + */ + public abstract void judgeResultSuccess(LZGridPlatformBaseResult result); + + public UploadFileResultDTO uploadFile(UploadFileFormDTO formDTO) { + return null; + } + + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java new file mode 100644 index 0000000000..63f718a0d5 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java @@ -0,0 +1,36 @@ +package com.epmet.apiservice.impl; + +import com.epmet.apiservice.ApiService; +import com.epmet.apiservice.result.LZGridPlatformBaseResult; +import com.epmet.dto.result.ProjectAssistResult; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; +import com.epmet.feign.OperCrmOpenFeignClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * demo api service + */ +@Component(value = "demoApiService") +public class DemoApiService extends ApiService { + + Logger logger = LoggerFactory.getLogger(DemoApiService.class); + + @Override + public String getAccessToken(String platformId) { + return null; + } + + @Override + public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) { + logger.info("DemoApiService发送项目协助到第三方平台成功"); + return null; + } + + @Override + public void judgeResultSuccess(LZGridPlatformBaseResult result) { + + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java new file mode 100644 index 0000000000..abbaad2255 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java @@ -0,0 +1,137 @@ +package com.epmet.apiservice.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.apiservice.ApiService; +import com.epmet.apiservice.result.LZGridPlatformBaseResult; +import com.epmet.commons.tools.enums.EnvEnum; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.constant.ThirdPlatformActions; +import com.epmet.dao.ThirdplatformActionDao; +import com.epmet.dao.ThirdplatformDao; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; +import com.epmet.dto.form.UploadFileFormDTO; +import com.epmet.dto.result.ProjectAssistResult; +import com.epmet.dto.result.UploadFileResultDTO; +import com.epmet.entity.ThirdplatformActionEntity; +import com.epmet.entity.ThirdplatformEntity; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.util.HashMap; +import java.util.concurrent.TimeUnit; + +/** + * 泸州网格化平台ApiService + */ +@Slf4j +@Component("luzhouGridPlatformApiService") +public class LuzhouGridPlatformApiService extends ApiService { + + @Override + public String getAccessToken(String platformId) { + String token = getAccessTokenFromCache(platformId); + if (StringUtils.isBlank(token)) { + ThirdplatformEntity thirdplatform = SpringContextUtils.getBean(ThirdplatformDao.class).selectById(platformId); + ThirdplatformActionEntity actionEntity = SpringContextUtils.getBean(ThirdplatformActionDao.class) + .getByPlatformIdAndActionKey(platformId, ThirdPlatformActions.GET_ACCESS_TOKEN); + + String baseUrl = thirdplatform.getBaseUrl(); + String platformKey = thirdplatform.getPlatformKey(); + String platformSecret = thirdplatform.getPlatformSecret(); + + HashMap params = new HashMap<>(); + params.put("appKey", platformKey); + params.put("appSecret", platformSecret); + Result result = null; + int tryTime = 0; + do { + result = HttpClientManager.getInstance().sendGet(baseUrl.concat(actionEntity.getApiUrl()), params); + } while ((result == null || !result.success()) && super.RETRY_TIME platformResult = JSON.parseObject(result.getData(), LZGridPlatformBaseResult.class); + judgeResultSuccess(platformResult); + + token = platformResult.getResult(); + addAccessTokenToCache(platformId, token, (long)(3600*1.8*1000), TimeUnit.MILLISECONDS); + } + return token; + } + + @Override + public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) { + String platformId = formDTO.getPlatformId(); + //开发环境由测试环境转发 所以 开发和本地 都使用测试环境地址 + //todo 项目回调地址 仍需要从参数中获取 + EnvEnum currentEnv = EnvEnum.getCurrentEnv(); + if (EnvEnum.PROD.getCode().equals(currentEnv.getCode())) { + formDTO.setNotifyUrl(EnvEnum.PROD.getUrl().concat("gov/project/project/platformcallback")); + } else { + formDTO.setNotifyUrl(EnvEnum.TEST.getUrl().concat("gov/project/project/platformcallback")); + } + + + + // 正式调用第三方平台 + String argsStr = JSON.toJSONString(formDTO); + String result = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, argsStr, null); + + // 开发阶段临时写死 + //String result = "{\"eventId\":\"test-task-id\"}"; + ProjectAssistResult projectAssistResult = new ProjectAssistResult(); + if (!StringUtils.isBlank(result)) { + // 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是 + // 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体, + // 所有apiService都要想办法转化成这个类型。 + LZGridPlatformBaseResult lzResult = JSON.parseObject(result, LZGridPlatformBaseResult.class); + + // 此处设置为第三方系统返回的唯一id + projectAssistResult.setTaskId(lzResult.getResult()); + } + log.info("projectAssist 泸州网格化平台项目协助发送成功"); + return projectAssistResult; + } + + @Override + public void judgeResultSuccess(LZGridPlatformBaseResult result) { + //LZGridPlatformBaseResult; + if (!"200".equalsIgnoreCase(result.getCode())) { + throw new RenException("泸州网格化平台:返回失败结果,错误码:" + result.getCode()); + } + } + + @Override + public UploadFileResultDTO uploadFile(UploadFileFormDTO formDTO) { + UploadFileResultDTO resultDTO = new UploadFileResultDTO(); + String platformId = formDTO.getPlatformId(); + try { + String fileName = formDTO.getFile().getOriginalFilename(); + // 正式调用第三方平台 + File file = new File(formDTO.getFile().getOriginalFilename()); + FileUtils.copyInputStreamToFile(formDTO.getFile().getInputStream(), file); + String result = sendPostRequestToUploadFile(platformId, ThirdPlatformActions.UPLOAD_FILE, file, fileName); + if (!StringUtils.isBlank(result)) { + // 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是 + // 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体, + // 所有apiService都要想办法转化成这个类型。 + LZGridPlatformBaseResult lzResult = JSON.parseObject(result, LZGridPlatformBaseResult.class); + + // 此处设置为第三方系统返回的唯一id + resultDTO.setUrl((String) lzResult.getResult()); + } + System.out.println("泸州网格化平台项目文件上传成功"); + } catch (Exception e) { + throw new RenException("上传失败"); + } + return resultDTO; + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformBaseResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformBaseResult.java new file mode 100644 index 0000000000..c0f4ed190a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformBaseResult.java @@ -0,0 +1,11 @@ +package com.epmet.apiservice.result; + +import lombok.Data; + +@Data +public class LZGridPlatformBaseResult { + private Boolean success; + private String code; + private R result; + // 有其他内容可直接写上 +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java new file mode 100644 index 0000000000..1ffd372576 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java @@ -0,0 +1,13 @@ +package com.epmet.apiservice.result; + +import lombok.Data; + +@Data +public class LZGridPlatformProjectAssistResult { + + /** + * 事件id + */ + private String eventId; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java new file mode 100644 index 0000000000..9eb8bd06bb --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java @@ -0,0 +1,75 @@ +package com.epmet.controller; + +import com.epmet.dto.form.UploadFileFormDTO; +import com.epmet.dto.result.ProjectAssistResult; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; +import com.epmet.dto.form.TPFDemoFormDTO; +import com.epmet.dto.result.UploadFileResultDTO; +import com.epmet.service.ProjectService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +/** + * 对接第三方平台业务Project相关的controller + * 我们系统当中每一个需要发送到第三方平台的操作,只对应这里的一个方法,根据参数传入platformId,内部根据配置获取指定的APiService进行具体平台的调用 + * 每一个平台都有自己的ApiSerivce + */ +@RestController +@RequestMapping("project") +public class ProjectController { + + @Autowired + private ProjectService projectService; + + /** + * @Description demo方法 + * @return + * @author wxz + * @date 2021.03.15 21:11 + */ + @PostMapping("demo-action") + public Result demoAction(@RequestBody TPFDemoFormDTO tpfDemoFormDTO) { + ValidatorUtils.validateEntity(tpfDemoFormDTO); + String r = projectService.demoAction(tpfDemoFormDTO); + return new Result().ok(r); + } + + /** + * @Description 请求项目协助 + * @return + * @author wxz + * @date 2021.03.15 21:13 + */ + @PostMapping("apply-assist") + public Result applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + ProjectAssistResult projectAssistResult = projectService.applyAssist(formDTO); + return new Result().ok(projectAssistResult); + } + + /** + * 上传文件 + * @author zhaoqifeng + * @date 2021/3/25 11:13 + * @param file + * @param customerId + * @param platformId + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping(value= "uploadfile" , consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + public Result uploadFile(@RequestPart("file") MultipartFile file, @RequestParam("customerId") String customerId, @RequestParam("platformId") String platformId) { + UploadFileFormDTO formDTO = new UploadFileFormDTO(); + formDTO.setFile(file); + formDTO.setPlatformId(platformId); + formDTO.setCustomerId(customerId); + ValidatorUtils.validateEntity(formDTO); + UploadFileResultDTO result = projectService.uploadFile(formDTO); + return new Result().ok(result); + } + + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java new file mode 100644 index 0000000000..1ddf6cbc40 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java @@ -0,0 +1,206 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.ThirdPlatformDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.ThirdplatformResultDTO; +import com.epmet.service.ThirdPlatformService; +import org.apache.commons.lang3.StringUtils; +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 java.util.List; + +/** + * 第三方平台维护相关api + */ +@RestController +@RequestMapping("thirdplatform") +public class ThirdPlatformController { + + @Autowired + private ThirdPlatformService thirdPlatformService; + + /** + * 根据客户id和动作,列出客户登记可用的第三方平台 + * 用途:工作端,运营端配置界面 + * + * @param input + * @return + */ + @PostMapping("customer/list-available-platforms-by-action") + public Result> listAvailablePlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input) { + ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListAvailableByCustomerAndActionGroup.class); + List platformRegs = thirdPlatformService.listAvailablePlatformsByCustomerAndAction(input.getCustomerId(), input.getActionKey()); + return new Result>().ok(platformRegs); + } + + /** + * @return + * @Description 根据客户id和动作,列出客户可选的第三方系统 + * @author wxz + * @date 2021.03.18 10:54 + */ + @PostMapping("customer/list-selectable-platforms-by-action") + public Result> listSelectablePlatformsByAction(@RequestBody ThirdPlatformFormDTO input) { + ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListSelectableByCustomerAndActionGroup.class); + List platformRegs = thirdPlatformService.listSelectableByCustomerAndActionGroup(input.getCustomerId(), input.getActionKey()); + return new Result>().ok(platformRegs); + } + + /** + * @Description 保存客户选中的平台列表 + * @return + * @author wxz + * @date 2021.03.18 18:04 + */ + @PostMapping("customer/save-selected-platforms") + public Result saveSelectedPlatforms(@RequestBody List input) { + input.stream().forEach(c -> ValidatorUtils.validateEntity(c, ThirdPlatformFormDTO.SaveCustomerSelectedPlatformGroup.class)); + thirdPlatformService.saveSelectedPlatforms(input); + return new Result(); + } + + /** + * @Description 更新客户自定义的平台信息 + * @return + * @author wxz + * @date 2021.03.18 23:45 + */ + @PostMapping("customer/update-customize-platform-info") + public Result updateCustomizePlatformInfo(@RequestBody ThirdPlatformFormDTO input) { + ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.UpdateCustomizePlatformInfo.class); + thirdPlatformService.updateCustomizePlatformInfo(input); + return new Result(); + } + + /** + * @Description 保存或修改客户选中的第三方平台信息 + * @return + * @author wxz + * @date 2021.03.19 15:25 + */ + @PostMapping("customer/saveorupdate-selected-platforms") + public Result saveOrUpdateSelectedPlatformsInfo(@RequestBody SaveOrUpdateCustSelPlatformFormDTO input) { + ValidatorUtils.validateEntity(input); + thirdPlatformService.saveOrUpdateSelectedPlatformInfo(input.getCustomerId(), input.getActionKey(), input.getPlatforms()); + return new Result(); + } + + /** + * 第三方平台-平台列表模糊查询 + * + * @param formsDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:13 2021-04-08 + **/ + @PostMapping("list-platforms") + public Result> listPlatforms(@RequestBody PlatformNameFormDTO formsDTO) { + ValidatorUtils.validateEntity(formsDTO); + return new Result>().ok(thirdPlatformService.listPlatforms(formsDTO.getPlatformName())); + } + + /** + * 第三方平台-修改平台 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 17:31 2021-04-08 + **/ + @PostMapping("update-platform") + public Result updatePlatform(@RequestBody ThirdPlatformDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (StringUtils.isBlank(formDTO.getId())) { + throw new RenException("主键不能为空"); + } + thirdPlatformService.updatePlatform(formDTO); + return new Result(); + } + + /** + * 第三方平台-新增平台 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 17:31 2021-04-08 + **/ + @PostMapping("add-platform") + public Result addPlatform(@RequestBody ThirdPlatformDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(thirdPlatformService.addPlatform(formDTO)); + } + + /** + * 第三方平台-客户可接入的平台列表 + * 注:该客户还没有注册的平台列表。从thirdplatform表中找该客户没注册的(不在thirdplatform_customer_register中,或者在其中,但是del_flag为1的)返回 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 09:46 2021-04-09 + **/ + @PostMapping("customer/registrable-platform-list") + public Result> registrablePlatformList(@RequestBody CustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(thirdPlatformService.listRegistrablePlatform(formDTO)); + } + + /** + * 第三方平台-客户已经接入的平台列表 + * 注:在thirdplatform_customer_register中的记录 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 09:46 2021-04-09 + **/ + @PostMapping("customer/registered-platform-list") + public Result> registeredPlatformList(@RequestBody CustomerFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(thirdPlatformService.listRegisteredPlatform(formDTO)); + } + + /** + * 第三方平台-解除客户接入的平台 + * 注:单个解除thirdplatform_customer_register表del_flag状态置为1 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 09:46 2021-04-09 + **/ + @PostMapping("customer/unregister-platform") + public Result unregisterPlatform(@RequestBody PlatformUnregisterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + thirdPlatformService.unregisterPlatformCustomer(formDTO); + return new Result(); + } + + /** + * 第三方平台-新增客户接入的第三方平台 + * 注:新增该客户要接入的第三方平台。thirdplatform_customer_register表新增数据。customized_xxx默认从thirdplatform表取过来 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:34 2021-04-09 + **/ + @PostMapping("customer/register-platform") + public Result registerPlatform(@RequestBody PlatformRegisterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (formDTO.getPlatformIdList().size() == NumConstant.ZERO) { + throw new RenException("formDTO.getPlatformIdList().size() == 0;平台id列表不能为空"); + } + thirdPlatformService.registerThirdPlatformCustomer(formDTO); + return new Result(); + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.java new file mode 100644 index 0000000000..50de9d3629 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.java @@ -0,0 +1,41 @@ +/** + * 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.ThirdplatformActionEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-15 + */ +@Mapper +public interface ThirdplatformActionDao extends BaseDao { + + /** + * @Description 根据平台id和action操作查询 + * @return + * @author wxz + * @date 2021.03.16 13:35 + */ + ThirdplatformActionEntity getByPlatformIdAndActionKey(@Param("platformId") String platformId, @Param("action") String action); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java new file mode 100644 index 0000000000..cf4640fcc8 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java @@ -0,0 +1,38 @@ +/** + * 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.ThirdplatformCustomerActionEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 客户针对指定操作所选用的第三方平台列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-18 + */ +@Mapper +public interface ThirdplatformCustomerActionDao extends BaseDao { + ThirdplatformCustomerActionEntity selectOneEntity(@Param("customerId") String customerId, + @Param("platformId") String platformId, + @Param("actionKey") String actionKey); + + int deleteByCustomerIdAndActionKey(@Param("customerId") String customerId, @Param("actionKey") String actionKey); +} \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java new file mode 100644 index 0000000000..3dc3001baf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java @@ -0,0 +1,58 @@ +/** + * 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.dto.form.PlatformUnregisterFormDTO; +import com.epmet.entity.ThirdplatformCustomerRegisterEntity; +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-15 + */ +@Mapper +public interface ThirdplatformCustomerRegisterDao extends BaseDao { + + ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); + + /** + * 批量新增 + * @param list + * @return int + * @Author zhangyong + * @Date 11:05 2021-04-09 + **/ + int batchInsertThirdplatformCustomerRegister(@Param("list") List list); + + /** + * 第三方平台-解除客户接入的平台 + * 注:单个解除.thirdplatform_customer_register表del_flag状态置为1 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 10:15 2021-04-09 + **/ + void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java new file mode 100644 index 0000000000..74b53823b3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java @@ -0,0 +1,89 @@ +/** + * 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.dto.ThirdPlatformDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; +import com.epmet.entity.ThirdplatformEntity; +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-15 + */ +@Mapper +public interface ThirdplatformDao extends BaseDao { + /** + * 动态sql查询 + * @param customerId + * @return + */ + List listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey); + + List listAvailablePlatformsByCustomerAndAction(@Param("customerId") String customerId, @Param("actionKey") String actionKey); + + List listSelectableByCustomerAndActionGroup(@Param("customerId") String customerId, @Param("actionKey") String actionKey); + + /** + * 第三方平台-平台列表模糊查询 + * + * @param platformName 平台名称,用于模糊搜索 + * @return java.util.List + * @Author zhangyong + * @Date 17:14 2021-04-08 + **/ + List selectListPlatforms(@Param("platformName") String platformName); + + /** + * 第三方平台-客户可接入的平台列表 + * 注:该客户还没有注册的平台列表。从thirdplatform表中找该客户没注册的(不在thirdplatform_customer_register中,或者在其中,但是del_flag为1的)返回 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List selectListRegistrablePlatform(@Param("customerId") String customerId); + + /** + * 第三方平台-客户已经接入的平台列表 + * 注:在thirdplatform_customer_register中的记录 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List selectListRegisteredPlatform(@Param("customerId") String customerId); + + /** + * 查询第三方平台 + * + * @param platformIds + * @return java.util.List + * @Author zhangyong + * @Date 10:51 2021-04-09 + **/ + List selectListThirdPlatform(@Param("platformIds") List platformIds); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java new file mode 100644 index 0000000000..97283b9c05 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java @@ -0,0 +1,52 @@ +/** + * 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-15 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("thirdplatform_action") +public class ThirdplatformActionEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String platformId; + + /** + * + */ + private String actionKey; + private String apiUrl; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java new file mode 100644 index 0000000000..8be40a1a0b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java @@ -0,0 +1,56 @@ +/** + * 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-18 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("thirdplatform_customer_action") +public class ThirdplatformCustomerActionEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 平台ID + */ + private String platformId; + + /** + * 动作key + */ + private String actionKey; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java new file mode 100644 index 0000000000..8f19691433 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.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.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-15 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("thirdplatform_customer_register") +public class ThirdplatformCustomerRegisterEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * + */ + private String customerId; + + /** + * + */ + private String platformId; + + private String customizedPlatformName; + + private String customizedPlatformIcon; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java new file mode 100644 index 0000000000..d5b20b8eab --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java @@ -0,0 +1,71 @@ +/** + * 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-15 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("thirdplatform") +public class ThirdplatformEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 平台名称 + */ + private String platformName; + + /** + * 平台唯一KEY + */ + private String platformKey; + + /** + * + */ + private String platformSecret; + + /** + * apiservice + */ + private String apiService; + + /** + * 基础url + */ + private String baseUrl; + + /** + * icon + */ + private String icon; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ApiServiceSelector.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ApiServiceSelector.java new file mode 100644 index 0000000000..6e45fc2122 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ApiServiceSelector.java @@ -0,0 +1,46 @@ +package com.epmet.service; + +import com.epmet.apiservice.ApiService; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.dao.ThirdplatformDao; +import com.epmet.entity.ThirdplatformEntity; + +/** + * ApiService选择器 + */ +public interface ApiServiceSelector { + + /** + * @Description 根据platformId查找platform对应的ApiService。如果找不到对应的api service,则返回null + * @return ApiService + * @author wxz + * @date 2021.03.15 20:59 + */ + default ApiService trySelectApiService(String platformId) { + ThirdplatformDao thirdplatformDao = SpringContextUtils.getBean(ThirdplatformDao.class); + ThirdplatformEntity thirdplatform = thirdplatformDao.selectById(platformId); + + if (thirdplatform == null) { + return null; + } + return (ApiService)SpringContextUtils.getBean(thirdplatform.getApiService()); + } + + /** + * @Description 根据platformId查找platform对应的ApiService。如果找不到对应的api service,则抛出RenException异常 + * @return ApiService + * @author wxz + * @date 2021.03.15 21:08 + */ + default ApiService selectApiService(String platformId) { + ThirdplatformDao thirdplatformDao = SpringContextUtils.getBean(ThirdplatformDao.class); + ThirdplatformEntity thirdplatform = thirdplatformDao.selectById(platformId); + + if (thirdplatform == null) { + throw new RenException(String.format("ID为%s的第三方平台不存在", platformId)); + } + return (ApiService)SpringContextUtils.getBean(thirdplatform.getApiService()); + } + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ProjectService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ProjectService.java new file mode 100644 index 0000000000..ce6c0cd3a2 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ProjectService.java @@ -0,0 +1,33 @@ +package com.epmet.service; + +import com.epmet.dto.form.UploadFileFormDTO; +import com.epmet.dto.result.ProjectAssistResult; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; +import com.epmet.dto.form.TPFDemoFormDTO; +import com.epmet.dto.result.UploadFileResultDTO; + +/** + * 该service用于封装project相关的代码 + */ +public interface ProjectService { + + String demoAction(TPFDemoFormDTO formDTO); + + /** + * 项目协同处理 + * @author wangxz + * @date 2021/3/25 10:59 + * @param formDTO + * @return com.epmet.dto.result.ProjectAssistResult + */ + ProjectAssistResult applyAssist(ProjectApplyAssistFormDTO formDTO); + + /** + * 文件上传 + * @author zhaoqifeng + * @date 2021/3/25 10:59 + * @param formDTO + * @return com.epmet.dto.result.UploadFileResultDTO + */ + UploadFileResultDTO uploadFile(UploadFileFormDTO formDTO); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java new file mode 100644 index 0000000000..570ce04d49 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java @@ -0,0 +1,103 @@ +package com.epmet.service; + +import com.epmet.dto.ThirdPlatformDTO; +import com.epmet.dto.form.CustomerFormDTO; +import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.form.PlatformRegisterFormDTO; +import com.epmet.dto.form.PlatformUnregisterFormDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; + +import java.util.List; + +public interface ThirdPlatformService { + + List listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey); + + List listSelectableByCustomerAndActionGroup(String customerId, String actionKey); + + /** + * @Description 保存客户选择的平台列表 + * @return + * @author wxz + * @date 2021.03.18 22:06 + */ + void saveSelectedPlatforms(List platforms); + + void updateCustomizePlatformInfo(ThirdPlatformFormDTO input); + + void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List platforms); + + /** + * 第三方平台-平台列表模糊查询 + * + * @param platformName 平台名称,用于模糊搜索 + * @return java.util.List + * @Author zhangyong + * @Date 17:14 2021-04-08 + **/ + List listPlatforms(String platformName); + + /** + * 第三方平台-修改平台 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 17:43 2021-04-08 + **/ + void updatePlatform(ThirdPlatformDTO formDTO); + + /** + * 第三方平台-新增平台 + * + * @param formDTO + * @return com.epmet.dto.ThirdPlatformDTO + * @Author zhangyong + * @Date 17:43 2021-04-08 + **/ + ThirdPlatformDTO addPlatform(ThirdPlatformDTO formDTO); + + /** + * 第三方平台-客户可接入的平台列表 + * 注:该客户还没有注册的平台列表。从thirdplatform表中找该客户没注册的(不在thirdplatform_customer_register中,或者在其中,但是del_flag为1的)返回 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List listRegistrablePlatform(CustomerFormDTO formDTO); + + /** + * 第三方平台-客户已经接入的平台列表 + * 注:在thirdplatform_customer_register中的记录 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 09:47 2021-04-09 + **/ + List listRegisteredPlatform(CustomerFormDTO formDTO); + + /** + * 第三方平台-解除客户接入的平台 + * 注:单个解除.thirdplatform_customer_register表del_flag状态置为1 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 10:15 2021-04-09 + **/ + void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO); + + /** + * 第三方平台-新增客户接入的第三方平台 + * 注:新增该客户要接入的第三方平台。thirdplatform_customer_register表新增数据。customized_xxx默认从thirdplatform表取过来 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 10:15 2021-04-09 + **/ + void registerThirdPlatformCustomer(PlatformRegisterFormDTO formDTO); +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java new file mode 100644 index 0000000000..dddf8a9909 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -0,0 +1,60 @@ +package com.epmet.service.impl; + +import com.epmet.apiservice.ApiService; +import com.epmet.dto.form.UploadFileFormDTO; +import com.epmet.dto.result.ProjectAssistResult; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; +import com.epmet.dto.form.TPFDemoFormDTO; +import com.epmet.dto.result.UploadFileResultDTO; +import com.epmet.service.ApiServiceSelector; +import com.epmet.service.ProjectService; +import org.springframework.stereotype.Service; + +@Service +public class ProjectServiceImpl implements ProjectService, ApiServiceSelector { + + @Override + public String demoAction(TPFDemoFormDTO formDTO) { + String customerId = formDTO.getCustomerId(); + String platformId = formDTO.getPlatformId(); + + // 注意,此处会如果找不到对应的ApiService会抛出异常 + ApiService apiService = selectApiService(platformId); + apiService.judgeRegistered(customerId, platformId); + + return apiService.demoAction(formDTO); + } + + @Override + public ProjectAssistResult applyAssist(ProjectApplyAssistFormDTO formDTO) { + String customerId = formDTO.getCustomerId(); + String platformId = formDTO.getPlatformId(); + + // 根据平台ID找到注意,此处会如果找不到对应的ApiService会抛出异常 + ApiService apiService = selectApiService(platformId); + // 判断该客户是否注册了该平台,如果没有的话,抛出异常 + apiService.judgeRegistered(customerId, platformId); + + return apiService.projectAssist(formDTO); + } + + /** + * 文件上传 + * + * @param formDTO + * @return com.epmet.dto.result.UploadFileResultDTO + * @author zhaoqifeng + * @date 2021/3/25 10:59 + */ + @Override + public UploadFileResultDTO uploadFile(UploadFileFormDTO formDTO) { + String customerId = formDTO.getCustomerId(); + String platformId = formDTO.getPlatformId(); + + // 根据平台ID找到注意,此处会如果找不到对应的ApiService会抛出异常 + ApiService apiService = selectApiService(platformId); + // 判断该客户是否注册了该平台,如果没有的话,抛出异常 + apiService.judgeRegistered(customerId, platformId); + return apiService.uploadFile(formDTO); + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java new file mode 100644 index 0000000000..3d6393e17e --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java @@ -0,0 +1,163 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.ThirdplatformCustomerActionDao; +import com.epmet.dao.ThirdplatformCustomerRegisterDao; +import com.epmet.dao.ThirdplatformDao; +import com.epmet.dto.ThirdPlatformDTO; +import com.epmet.dto.form.CustomerFormDTO; +import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.form.PlatformRegisterFormDTO; +import com.epmet.dto.form.PlatformUnregisterFormDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; +import com.epmet.entity.ThirdplatformCustomerActionEntity; +import com.epmet.entity.ThirdplatformCustomerRegisterEntity; +import com.epmet.entity.ThirdplatformEntity; +import com.epmet.service.ThirdPlatformService; +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.List; + +@Service +public class ThirdPlatformServiceImpl implements ThirdPlatformService { + + @Autowired + private ThirdplatformDao thirdplatformDao; + + @Autowired + private ThirdplatformCustomerActionDao thirdplatformCustomerActionDao; + + @Autowired + private ThirdplatformCustomerRegisterDao thirdplatformCustomerRegisterDao; + + @Override + public List listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey) { + return thirdplatformDao.listAvailablePlatformsByCustomerAndAction(customerId, actionKey); + } + + @Override + public List listSelectableByCustomerAndActionGroup(String customerId, String actionKey) { + return thirdplatformDao.listSelectableByCustomerAndActionGroup(customerId, actionKey); + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveSelectedPlatforms(List platforms) { + platforms.forEach(p -> { + ThirdplatformCustomerActionEntity thirdplatformCustomerActionEntity = thirdplatformCustomerActionDao.selectOneEntity(p.getCustomerId(), p.getPlatformId(), p.getActionKey()); + if (thirdplatformCustomerActionEntity == null) { + ThirdplatformCustomerActionEntity insert = new ThirdplatformCustomerActionEntity(); + insert.setActionKey(p.getActionKey()); + insert.setCustomerId(p.getCustomerId()); + insert.setPlatformId(p.getPlatformId()); + thirdplatformCustomerActionDao.insert(insert); + } + }); + } + + @Override + public void updateCustomizePlatformInfo(ThirdPlatformFormDTO input) { + ThirdplatformCustomerRegisterEntity exist = thirdplatformCustomerRegisterDao.getByCustomerIdAndPlatformId(input.getCustomerId(), input.getPlatformId()); + if (exist != null) { + exist.setCustomizedPlatformName(input.getPlatformName()); + exist.setCustomizedPlatformIcon(input.getIcon()); + thirdplatformCustomerRegisterDao.updateById(exist); + } + } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateSelectedPlatformInfo(String customerId, String actionKey, List platforms) { + // 1.物理删除客户-action所有对应关系 + thirdplatformCustomerActionDao.deleteByCustomerIdAndActionKey(customerId, actionKey); + + platforms.stream().forEach(pt -> { + // 2.更新用户自定义的平台信息 + updateThirdPlatformCustomerRegInfo(customerId, pt); + + // 3.重新建立customer-platform-action对应关系 + ThirdplatformCustomerActionEntity tpcaEntity = new ThirdplatformCustomerActionEntity(); + tpcaEntity.setPlatformId(pt.getPlatformId()); + tpcaEntity.setCustomerId(customerId); + tpcaEntity.setActionKey(actionKey); + thirdplatformCustomerActionDao.insert(tpcaEntity); + }); + + } + + /** + * @Description 更新第三方品台客户对应关系 + * @return + * @author wxz + * @date 2021.03.19 15:22 + */ + private void updateThirdPlatformCustomerRegInfo(String customerId, ThirdPlatformFormDTO platformFormDTO) { + LambdaQueryWrapper conditions = new QueryWrapper() + .lambda() + .eq(ThirdplatformCustomerRegisterEntity::getCustomerId, customerId) + .eq(ThirdplatformCustomerRegisterEntity::getPlatformId, platformFormDTO.getPlatformId()); + + ThirdplatformCustomerRegisterEntity entity = new ThirdplatformCustomerRegisterEntity(); + entity.setCustomizedPlatformName(platformFormDTO.getPlatformName()); + entity.setCustomizedPlatformIcon(platformFormDTO.getIcon()); + thirdplatformCustomerRegisterDao.update(entity, conditions); + } + + @Override + public List listPlatforms(String platformName) { + return thirdplatformDao.selectListPlatforms(platformName); + } + + @Override + public void updatePlatform(ThirdPlatformDTO formDTO) { + ThirdplatformEntity entity = ConvertUtils.sourceToTarget(formDTO, ThirdplatformEntity.class); + thirdplatformDao.updateById(entity); + } + + @Override + public ThirdPlatformDTO addPlatform(ThirdPlatformDTO formDTO) { + ThirdplatformEntity entity = ConvertUtils.sourceToTarget(formDTO, ThirdplatformEntity.class); + thirdplatformDao.insert(entity); + formDTO.setId(entity.getId()); + return formDTO; + } + + @Override + public List listRegistrablePlatform(CustomerFormDTO formDTO) { + return thirdplatformDao.selectListRegistrablePlatform(formDTO.getCustomerId()); + } + + @Override + public List listRegisteredPlatform(CustomerFormDTO formDTO) { + return thirdplatformDao.selectListRegisteredPlatform(formDTO.getCustomerId()); + } + + @Override + public void unregisterPlatformCustomer(PlatformUnregisterFormDTO formDTO) { + thirdplatformCustomerRegisterDao.unregisterPlatformCustomer(formDTO); + } + + @Override + public void registerThirdPlatformCustomer(PlatformRegisterFormDTO formDTO) { + List entityList = new ArrayList<>(); + + List thirdPlatforms = thirdplatformDao.selectListThirdPlatform(formDTO.getPlatformIdList()); + for (ThirdPlatformDTO dto : thirdPlatforms) { + ThirdplatformCustomerRegisterEntity entity = new ThirdplatformCustomerRegisterEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setPlatformId(dto.getId()); + entity.setCustomizedPlatformName(dto.getPlatformName()); + entity.setCustomizedPlatformIcon(dto.getIcon()); + entityList.add(entity); + } + if (entityList.size() > NumConstant.ZERO) { + thirdplatformCustomerRegisterDao.batchInsertThirdplatformCustomerRegister(entityList); + } + } +} 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/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.13__addPlatformDDLS.sql b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.13__addPlatformDDLS.sql new file mode 100644 index 0000000000..9cbbcb3c89 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/db/migration/V0.0.13__addPlatformDDLS.sql @@ -0,0 +1,61 @@ +CREATE TABLE `thirdplatform` ( + `ID` varchar(64) NOT NULL, + `PLATFORM_NAME` varchar(32) NOT NULL COMMENT '平台名称', + `PLATFORM_KEY` varchar(32) NOT NULL COMMENT '平台唯一KEY', + `PLATFORM_SECRET` varchar(64) DEFAULT NULL, + `ICON` varchar(255) DEFAULT NULL, + `API_SERVICE` varchar(32) NOT NULL COMMENT 'api service实例名称', + `BASE_URL` varchar(128) NOT NULL COMMENT '平台基础url', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识', + `REVISION` int(10) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台列表'; + + +CREATE TABLE `thirdplatform_customer_action` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户ID', + `PLATFORM_ID` varchar(64) NOT NULL COMMENT '平台ID', + `ACTION_KEY` varchar(64) NOT NULL COMMENT '动作key', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识', + `REVISION` int(10) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`), + UNIQUE KEY `plat_custm_act` (`PLATFORM_ID`,`CUSTOMER_ID`,`ACTION_KEY`,`DEL_FLAG`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户针对指定操作所选用的第三方平台列表'; + +CREATE TABLE `thirdplatform_customer_register` ( + `ID` varchar(64) NOT NULL, + `CUSTOMER_ID` varchar(64) DEFAULT NULL, + `PLATFORM_ID` varchar(64) DEFAULT NULL, + `CUSTOMIZED_PLATFORM_NAME` varchar(32) DEFAULT NULL, + `CUSTOMIZED_PLATFORM_ICON` varchar(255) DEFAULT NULL, + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识', + `REVISION` int(10) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='客户接入的平台列表'; + +CREATE TABLE `thirdplatform_action` ( + `ID` varchar(64) NOT NULL, + `PLATFORM_ID` varchar(64) DEFAULT NULL, + `ACTION_KEY` varchar(32) DEFAULT NULL, + `API_URL` varchar(64) NOT NULL COMMENT '动作对应的api的路径', + `DEL_FLAG` varchar(1) NOT NULL COMMENT '删除标识', + `REVISION` int(10) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='平台功能列表' diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml new file mode 100644 index 0000000000..39de22dca5 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml new file mode 100644 index 0000000000..f23ff18cc3 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + delete + from thirdplatform_customer_action + where CUSTOMER_ID = #{customerId} + and ACTION_KEY = #{actionKey} + + + + + + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml new file mode 100644 index 0000000000..9ab368a8bc --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + insert into thirdplatform_customer_register + ( + ID, + CUSTOMER_ID, + PLATFORM_ID, + CUSTOMIZED_PLATFORM_NAME, + CUSTOMIZED_PLATFORM_ICON, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.platformId}, + #{item.customizedPlatformName}, + #{item.customizedPlatformIcon}, + '0', + 0, + 'APP_USER', + now(), + 'APP_USER', + now() + ) + + + + + UPDATE thirdplatform_customer_register + SET DEL_FLAG = '1' + WHERE + DEL_FLAG = '0' + AND CUSTOMER_ID = #{customerId} AND PLATFORM_ID = #{platformId} + + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml new file mode 100644 index 0000000000..e27f550f11 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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-client/pom.xml b/epmet-module/gov-issue/gov-issue-client/pom.xml index f77ec89656..9d07717da1 100644 --- a/epmet-module/gov-issue/gov-issue-client/pom.xml +++ b/epmet-module/gov-issue/gov-issue-client/pom.xml @@ -29,5 +29,11 @@ 2.0.0 compile + + com.epmet + data-report-client + 2.0.0 + compile + - \ No newline at end of file + diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCategoryDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCategoryDTO.java new file mode 100644 index 0000000000..fd33177b01 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueCategoryDTO.java @@ -0,0 +1,101 @@ +/** + * 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 2020-12-08 + */ +@Data +public class IssueCategoryDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格ID: 议题所属网格Id + */ + private String gridId; + + /** + * 议题id + */ + private String issueId; + + /** + * 分类id + */ + private String categoryId; + + /** + * 分类对应的所有上级,英文逗号隔开 + */ + private String categoryPids; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 删除标识 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-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java new file mode 100644 index 0000000000..a93a616cbf --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java @@ -0,0 +1,116 @@ +/** + * 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 2020-12-08 + */ +@Data +public class IssueProjectCategoryDictDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id, 产品默认default + */ + private String customerId; + + /** + * 上级分类ID 顶级此列存储0 + */ + private String pid; + + /** + * 所有上级分类ID,用逗号分开 + */ + private String pids; + + /** + * 上级分类编码 + */ + private String parentCategoryCode; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 分类类别1,2,3,4.... + */ + private String categoryType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 删除标识 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-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectTagDictDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectTagDictDTO.java new file mode 100644 index 0000000000..b07cf0042e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectTagDictDTO.java @@ -0,0 +1,106 @@ +/** + * 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 2020-12-08 + */ +@Data +public class IssueProjectTagDictDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 分类id, 用户自己添加的标签此列可为空 + */ + private String categoryId; + + /** + * 是否是默认标签(0:是 1:否) + */ + private String isDefault; + + /** + * 议题对标签的引用次数 + */ + private Integer issueUseCount; + + /** + * 项目对标签的引用次数 + */ + private Integer projectUseCount; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer 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-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueTagsDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueTagsDTO.java new file mode 100644 index 0000000000..6ca1c51c6a --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueTagsDTO.java @@ -0,0 +1,96 @@ +/** + * 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 2020-12-08 + */ +@Data +public class IssueTagsDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 议题所属网格id + */ + private String gridId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 标签ID + */ + private String tagId; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer 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-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AddTagFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AddTagFormDTO.java new file mode 100644 index 0000000000..889c042c5f --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/AddTagFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import com.google.gson.internal.$Gson$Types; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/9 下午3:25 + */ +@Data +public class AddTagFormDTO implements Serializable { + + private static final long serialVersionUID = -3245317956853388308L; + + public interface AddTag{} + + @NotBlank(message = "标签名称不能为空",groups = AddTag.class) + private String tagName; + + private String customerId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CategoryTagInitFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CategoryTagInitFormDTO.java new file mode 100644 index 0000000000..ac83a9750a --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/CategoryTagInitFormDTO.java @@ -0,0 +1,16 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/10 10:00 + */ +@Data +public class CategoryTagInitFormDTO implements Serializable { + private static final long serialVersionUID = -3420775041990761296L; + private String customerId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/FirstCategoryFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/FirstCategoryFormDTO.java new file mode 100644 index 0000000000..065b0bd359 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/FirstCategoryFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.form; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 一级分类 新增/修改 + * @Auth zy + * @Date 2021-03-22 09:17 + */ +@Data +public class FirstCategoryFormDTO implements Serializable { + private static final long serialVersionUID = 3188828578545996470L; + + /** + * 客户Id + **/ + @NotBlank(message = "customerId不能为空") + private String customerId; + + /** + * 分类Id + * issue_project_category_dict 表主键,只有执行修改操作时,才会传入 + **/ + private String categoryId; + + /** + * 分类名称 + **/ + @Length(max=20,message = "分类名称不能超过20个字") + @Length(min=2,message = "分类名称不能少于2个字") + private String categoryName; + + /** + * 排序 + **/ + private Integer sort; + + /** + * 操作类型(add:新增 edit:编辑) + **/ + @NotBlank(message = "操作类型不能为空") + private String type; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java new file mode 100644 index 0000000000..d9339a0e97 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueCategoryTagListFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 获取议题的分类、标签列表-接口入参 + * @Author sun + */ +@Data +public class IssueCategoryTagListFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + @NotBlank(message = "议题ID不能为空",groups = {ProjectCategoryTagListFormDTO.CategoryTag.class}) + private String issueId; + + public interface CategoryTag{} + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueSaveCategoryFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueSaveCategoryFormDTO.java new file mode 100644 index 0000000000..299a2d25d2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueSaveCategoryFormDTO.java @@ -0,0 +1,34 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * 议题:保存/修改分类-接口入参 + * @Author sun + */ +@Data +public class IssueSaveCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + /** + * 议题Id + */ + @NotBlank(message = "议题ID不能为空",groups = {ProjectSaveCategoryFormDTO.SaveCategory.class}) + private String issueId; + /** + * 议题分类集合 + */ + private List categoryList; + + /** + * 客户Id + */ + private String customerId; + + public interface SaveCategory{} + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagFormDTO.java new file mode 100644 index 0000000000..f67bbe2c34 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/10 上午9:31 + */ +@Data +public class IssueTagFormDTO implements Serializable { + + private static final long serialVersionUID = -8678756265520573631L; + + private String id; + + private String name; + + private String categoryId; + + private String tagId; + + private String isDisable; + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsFormDTO.java new file mode 100644 index 0000000000..8cb89dc4d7 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsFormDTO.java @@ -0,0 +1,72 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/10 上午9:31 + */ +@Data +public class IssueTagsFormDTO implements Serializable { + + private static final long serialVersionUID = -8678756265520570931L; + + /** + * 主键ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 议题所属网格id + */ + private String gridId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 标签ID + */ + private String tagId; + + /** + * 标签名称 + */ + private String name; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 更新人 + */ + private String updatedBy; + + public IssueTagsFormDTO() { + this.delFlag = 0; + this.revision = 0; + this.createdBy = "APP_USER"; + this.updatedBy = "APP_USER"; + } +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsSaveFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsSaveFormDTO.java new file mode 100644 index 0000000000..bbf3b9110e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/IssueTagsSaveFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Author zxc + * @DateTime 2020/12/10 上午9:29 + */ +@Data +public class IssueTagsSaveFormDTO implements Serializable { + + private static final long serialVersionUID = 4122102633306198151L; + + public interface IssueTagsSaveForm{} + + @NotBlank(message = "议题ID不能为空",groups = {IssueTagsSaveForm.class}) + private String issueId; + + /** + * 标签集合 为空,清除此议题标签 + */ + private List tagList; + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SaveIssueCategoryFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SaveIssueCategoryFormDTO.java new file mode 100644 index 0000000000..8941320269 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SaveIssueCategoryFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 议题:保存/修改分类-接口入参 + * + * @Author sun + */ +@Data +public class SaveIssueCategoryFormDTO implements Serializable { + + private static final long serialVersionUID = 2599592072265715951L; + /** + * 分类Id + */ + private String id; + /** + * 分类名称 + */ + private String name; + + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SecondCategoryFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SecondCategoryFormDTO.java new file mode 100644 index 0000000000..7b3d389462 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/SecondCategoryFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 二级分类 新增/修改 + * @ClassName CommonGridIdListFormDTO + * @Auth zy + * @Date 2021-03-22 09:17 + */ +@Data +public class SecondCategoryFormDTO extends FirstCategoryFormDTO implements Serializable{ + private static final long serialVersionUID = 3188828578545996470L; + + /** + * 一级分类Id + **/ + private String parentCategoryId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java index cf576522ac..b44cdb4acd 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/ShiftProjectFormDTO.java @@ -1,6 +1,8 @@ package com.epmet.dto.form; +import com.epmet.dto.IssueCategoryDTO; import com.epmet.dto.IssueDTO; +import com.epmet.dto.IssueTagsDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import lombok.Data; import org.hibernate.validator.constraints.Length; @@ -42,6 +44,14 @@ public class ShiftProjectFormDTO implements Serializable { * 话题对象信息 */ private ResiTopicDTO topicDTO ; + /** + * 议题分类 + */ + private List categoryList; + /** + * 议题标签 + */ + private List tagList; } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagDifferentSetFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagDifferentSetFormDTO.java new file mode 100644 index 0000000000..93685f4a81 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagDifferentSetFormDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @Description 更新标签使用率入参DTO + * @ClassName TagDifferentSetFormDTO + * @Auth wangc + * @Date 2020-12-11 14:03 + */ +@Data +public class TagDifferentSetFormDTO implements Serializable { + private static final long serialVersionUID = -5232943723252172322L; + + private List plus; + + private List minus; + + @NotBlank(message = "客户Id不能为空") + private String customerId; + + @NotBlank(message = "用户Id不能为空") + private String userId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagListFormDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagListFormDTO.java new file mode 100644 index 0000000000..f09aaa4272 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/form/TagListFormDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/9 15:32 + */ +@Data +public class TagListFormDTO implements Serializable { + private static final long serialVersionUID = -6448213704058150588L; + private List categoryIdList; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AddTagResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AddTagResultDTO.java new file mode 100644 index 0000000000..f78f4154c9 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/AddTagResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.AllArgsConstructor; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/9 下午5:09 + */ +@Data +@AllArgsConstructor +public class AddTagResultDTO implements Serializable { + + private static final long serialVersionUID = 4769136806332933579L; + + private String tagId; + + public AddTagResultDTO() { + this.tagId = ""; + } +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/CustomerCategoryResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/CustomerCategoryResultDTO.java new file mode 100644 index 0000000000..5121a13471 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/CustomerCategoryResultDTO.java @@ -0,0 +1,48 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 客户分类列表 + * + * @Author ZY + * @DateTime 2021/03/23 + */ +@Data +public class CustomerCategoryResultDTO implements Serializable { + + private static final long serialVersionUID = 4769136806332933579L; + + /** + * 分类Id + */ + private String categoryId; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + /** + * 二级分类 + */ + private List children; + + /** + * pid + */ + private String pid; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagListResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagListResultDTO.java new file mode 100644 index 0000000000..cd78b59aaf --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagListResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * @Description 获取议题的分类、标签列表-接口返参 + * @Author sun + */ +@Data +public class IssueCategoryTagListResultDTO implements Serializable { + + private static final long serialVersionUID = 5957826616179876849L; + + /** + * 类别集合 + */ + private List categoryList = new ArrayList<>(); + /** + * 标签集合 + */ + private List tagList = new ArrayList<>(); + +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagResultDTO.java new file mode 100644 index 0000000000..bfd9eec5f4 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueCategoryTagResultDTO.java @@ -0,0 +1,45 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Objects; + +/** + * @Description 获取议题的分类、标签列表-接口返参 + * @Author sun + */ +@Data +public class IssueCategoryTagResultDTO implements Serializable { + + private static final long serialVersionUID = 5957826616179876849L; + + /** + * 分类或标签Id + */ + private String id; + /** + * 分类或标签名称 + */ + private String name; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + + //equals计算时忽略isDisable属性 + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + IssueCategoryTagResultDTO that = (IssueCategoryTagResultDTO) o; + return Objects.equals(id, that.id) && + Objects.equals(name, that.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueProjectTagsResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueProjectTagsResultDTO.java new file mode 100644 index 0000000000..55a738b52e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/IssueProjectTagsResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @DateTime 2020/12/10 下午2:13 + */ +@Data +public class IssueProjectTagsResultDTO implements Serializable { + + private static final long serialVersionUID = -5035269596436047038L; + + private String tagId; + + private String tagName; + + private String categoryId; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/TagListResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/TagListResultDTO.java new file mode 100644 index 0000000000..1590463176 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/TagListResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/12/9 15:33 + */ +@Data +public class TagListResultDTO implements Serializable { + private static final long serialVersionUID = -4247291364077634874L; + List defaulted; + List customized; +} diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java index f5d2786c93..eeccc8d836 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/GovIssueOpenFeignClient.java @@ -6,6 +6,8 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.fallback.GovIssueOpenFeignClientFallBack; +import com.epmet.project.dto.CustomerCategoryDTO; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; import com.epmet.resi.group.dto.group.form.AllIssueFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationDetailFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationHistoryFormDTO; @@ -208,6 +210,31 @@ public interface GovIssueOpenFeignClient { @PostMapping(value = "/gov/issue/issueapplication/queryuserpubauditingissues") Result> queryUserPubAuditingIssues(@RequestBody UserPubAuditingIssueFormDTO fomrDTO); + /** + * @description 调用issue库,查询分类Id对应的分类名称,按分类升序排列 + * @author sun + **/ + @PostMapping(value = "/gov/issue/issuecategory/projectcategorylist") + Result> projectCategoryList(@RequestBody ProjectCategoryTagListFormDTO formDTO); + + /** + * @description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @author sun + **/ + @PostMapping(value = "/gov/issue/issueprojectcategorydict/getprojectandcategoryinfo") + Result getProjectAndCategoryInfo(ProjectSaveCategoryFormDTO formDTO); + + /** + * @Description 更新标签热度 数据库/缓存 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 14:00 + */ + @PostMapping("/gov/issue/issueprojecttagdict/updatecitations") + Result updateCitations(@RequestBody TagDifferentSetFormDTO param); + + /** * @Description 检查邀请关系,如果确实存在邀请关系则返回邀请人Id * 符合条件: @@ -244,4 +271,26 @@ public interface GovIssueOpenFeignClient { @PostMapping("/gov/issue/issue/detail") Result queryIssueDetail(@RequestBody IssueDetailFormDTO formDTO); + + /** + * 获取客户 分类字典 信息 + * + * @param dto + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + @PostMapping(value = "/gov/issue/issueprojectcategorydict/getcustomercategorydict") + Result> getCustomerCategoryDict(@RequestBody CustomerCategoryDTO dto); + + /** + * @param topicIdList + * @Description 查询当前未成为议题的话题但是提交了转议题申请的 + * @author sun + */ + @PostMapping("/gov/issue/issueapplication/notissuetotopicids") + Result> notIssueToTopicIds(@RequestBody List topicIdList); + + @PostMapping(value = "/gov/issue/manage/votingissuedetail") + Result votingissuedetail(@RequestBody IssueDetailFormDTO issueDetail); } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java index 84b1220993..9ce37add49 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/feign/fallback/GovIssueOpenFeignClientFallBack.java @@ -7,6 +7,8 @@ import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.GovIssueOpenFeignClient; +import com.epmet.project.dto.CustomerCategoryDTO; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; import com.epmet.resi.group.dto.group.form.AllIssueFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationDetailFormDTO; import com.epmet.resi.group.dto.group.form.ApplicationHistoryFormDTO; @@ -192,6 +194,29 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "queryUserPubAuditingIssues", fomrDTO); } + /** + * @description 调用issue库,查询分类Id对应的分类名称,按分类升序排列 + * @author sun + **/ + @Override + public Result> projectCategoryList(ProjectCategoryTagListFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "projectCategoryList", formDTO); + } + + /** + * @description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @author sun + **/ + @Override + public Result getProjectAndCategoryInfo(ProjectSaveCategoryFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getProjectAndCategoryInfo", formDTO); + } + + @Override + public Result updateCitations(TagDifferentSetFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "updateCitations", param); + } + @Override public Result checkInviteRelationship(SharableIssueAndInviteeFormDTO param) { return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "checkInviteRelationship", param); @@ -211,4 +236,19 @@ public class GovIssueOpenFeignClientFallBack implements GovIssueOpenFeignClient public Result queryIssueDetail(IssueDetailFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "detail", formDTO); } + + @Override + public Result> getCustomerCategoryDict(CustomerCategoryDTO customerCategoryDTO) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "getCustomerCategoryDict", customerCategoryDTO); + } + + @Override + public Result> notIssueToTopicIds(List topicIdList) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "notIssueToTopicIds", topicIdList); + } + + @Override + public Result votingissuedetail(IssueDetailFormDTO issueDetail) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ISSUE_SERVER, "votingissuedetail", issueDetail); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 68e7b17d5b..cce26d7129 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -96,6 +96,24 @@ 2.0.0 compile + + com.epmet + data-report-client + 2.0.0 + compile + + + com.epmet + oper-crm-client + 2.0.0 + compile + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + compile + @@ -155,6 +173,9 @@ https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.1.130:9876;192.168.1.132:9876 @@ -192,6 +213,10 @@ https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + + 192.168.1.130:9876;192.168.1.132:9876 + epmet_message @@ -229,6 +254,8 @@ https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 + + 192.168.10.161:9876 @@ -266,8 +293,11 @@ SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + + + 192.168.11.187:9876;192.168.11.184:9876 - \ No newline at end of file + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/GovIssueRedisKeys.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/GovIssueRedisKeys.java index 1da3dc7911..c9890f47b5 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/GovIssueRedisKeys.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/GovIssueRedisKeys.java @@ -1,5 +1,9 @@ package com.epmet.constant; +import com.epmet.utils.ModuleConstants; + +import java.util.Optional; + /** * @Description gov-issue-server模块redis key * @Author yinzuomei @@ -18,5 +22,17 @@ public class GovIssueRedisKeys { public static String getWorkGrassrootsIssueRedDotKey(String gridId) { return rootPrefix.concat(String.format("gov:wxmp:work:grassroots:issue:%s",gridId)); } + + /** + * 议题项目标签key epmet:govern:customer:category:[customerId]:[categoryId] + * + * 自定义标签的categoryId统一为[customize] + * @param customerId + * @param categoryId + * @return + */ + public static String getGovernmentTagKey(String customerId,String categoryId){ + return rootPrefix.concat("govern:customer:category:").concat(customerId).concat(":").concat(Optional.ofNullable(categoryId).orElse(ModuleConstants.ASTERISK)); + } } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueApplicationController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueApplicationController.java index 63f5af6117..575b75a56b 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueApplicationController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueApplicationController.java @@ -164,4 +164,14 @@ public class IssueApplicationController { ValidatorUtils.validateEntity(fomrDTO, PageFormDTO.AddUserInternalGroup.class); return new Result>().ok(issueApplicationService.queryUserPubAuditingIssues(fomrDTO)); } + + /** + * @param topicIdList + * @Description 查询当前未成为议题的话题但是提交了转议题申请的 + * @author sun + */ + @PostMapping("notissuetotopicids") + public Result> notIssueToTopicIds(@RequestBody List topicIdList) { + return new Result>().ok(issueApplicationService.notIssueToTopicIds(topicIdList)); + } } \ No newline at end of file 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/controller/IssueCategoryController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java new file mode 100644 index 0000000000..cba3ed0825 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueCategoryController.java @@ -0,0 +1,138 @@ +/** + * 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.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.IssueCategoryDTO; +import com.epmet.dto.form.IssueCategoryTagListFormDTO; +import com.epmet.dto.form.IssueSaveCategoryFormDTO; +import com.epmet.dto.form.ProjectCategoryTagListFormDTO; +import com.epmet.dto.result.IssueCategoryTagListResultDTO; +import com.epmet.dto.result.ProjectCategoryTagResultDTO; +import com.epmet.excel.IssueCategoryExcel; +import com.epmet.service.IssueCategoryService; +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 2020-12-08 + */ +@RestController +@RequestMapping("issuecategory") +public class IssueCategoryController { + + @Autowired + private IssueCategoryService issueCategoryService; + + @GetMapping("page") + public Result> page(@RequestParam Map params) { + PageData page = issueCategoryService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id) { + IssueCategoryDTO data = issueCategoryService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueCategoryDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueCategoryService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueCategoryDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueCategoryService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueCategoryService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = issueCategoryService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IssueCategoryExcel.class); + } + + /** + * @param formDTO + * @return + * @Description 获取议题的分类、标签列表 + * @Author sun + **/ + @PostMapping("categorytaglist") + public Result categoryTagList(@RequestBody IssueCategoryTagListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, IssueCategoryTagListFormDTO.CategoryTag.class); + return new Result().ok(issueCategoryService.categoryTagList(formDTO)); + } + + /** + * @param formDTO + * @return + * @Description 查询分类Id集合对应的分类名称,按分类升序排列 + * @Author sun + **/ + @PostMapping("projectcategorylist") + public Result> projectCategoryList(@RequestBody ProjectCategoryTagListFormDTO formDTO) { + return new Result>().ok(issueCategoryService.projectCategoryList(formDTO)); + } + + /** + * @param formDTO + * @return + * @Description 议题:保存/修改分类 + * @Author sun + **/ + @PostMapping("save") + public Result saveCategory(@LoginUser TokenDto tokenDto, @RequestBody IssueSaveCategoryFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, IssueSaveCategoryFormDTO.SaveCategory.class); + issueCategoryService.saveCategory(formDTO); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java index 601b42aa66..673ff0a3fc 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueManageController.java @@ -168,6 +168,22 @@ public class IssueManageController { return new Result(); } + /** + * 议题管理-议题转项目-增加分类标签功能 + * @author zhaoqifeng + * @date 2020/12/9 9:58 + * @param tokenDTO + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("shiftproject-v2") + public Result shiftProjectV2(@LoginUser TokenDto tokenDTO, @RequestBody ShiftProjectFormDTO formDTO) { + formDTO.setStaffId(tokenDTO.getUserId()); + ValidatorUtils.validateEntity(formDTO); + issueService.shiftProjectV2(formDTO); + return new Result(); + } + /** * @Description 政府端查看议题进展 (已关闭单表查询,转议题跨服务查询) * @param issueId diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java new file mode 100644 index 0000000000..c4080d0f10 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectCategoryDictController.java @@ -0,0 +1,260 @@ +/** + * 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.annotation.LoginUser; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.enums.CommonOperateTypeEnum; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerCategoryListResultDTO; +import com.epmet.dto.result.CustomerCategoryResultDTO; +import com.epmet.dto.result.ProjectIssueCategoryResultDTO; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.excel.IssueProjectCategoryDictExcel; +import com.epmet.project.dto.CustomerCategoryDTO; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.utils.ModuleConstants; +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 2020-12-08 + */ +@RestController +@RequestMapping("issueprojectcategorydict") +public class IssueProjectCategoryDictController { + + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + + @GetMapping("page") + public Result> page(@RequestParam Map params) { + PageData page = issueProjectCategoryDictService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id) { + IssueProjectCategoryDictDTO data = issueProjectCategoryDictService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueProjectCategoryDictDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueProjectCategoryDictService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueProjectCategoryDictDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueProjectCategoryDictService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueProjectCategoryDictService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = issueProjectCategoryDictService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IssueProjectCategoryDictExcel.class); + } + + /** + * @param tokenDto + * @return + * @Description 客户分类列表查询,按分类升序排列 + * @Author sun + **/ + @PostMapping("list") + public Result> categoryList(@LoginUser TokenDto tokenDto) { + return new Result>().ok(issueProjectCategoryDictService.categoryList(tokenDto.getCustomerId())); + } + + /** + * 客户分类标签数据初始化 + * @author zhaoqifeng + * @date 2020/12/10 10:02 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("init") + public Result init(@RequestBody CategoryTagInitFormDTO formDTO) { + issueProjectCategoryDictService.init(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Description 批量查询分类信息 + * @Author sun + **/ + @PostMapping("getcategorylist") + public Result> getCategoryList(@RequestBody IssueProjectCategoryDictListFormDTO formDTO) { + return new Result>().ok(issueProjectCategoryDictService.getCategoryList(formDTO)); + } + + /** + * @param formDTO + * @return + * @Description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @Author sun + **/ + @PostMapping("getprojectandcategoryinfo") + public Result getProjectAndCategoryInfo(@RequestBody ProjectSaveCategoryFormDTO formDTO) { + return new Result().ok(issueProjectCategoryDictService.getProjectAndCategoryInfo(formDTO)); + } + + /** + * @param formDTO + * @return + * @Description 分类启用与禁用 + * @Author sun + **/ + @PostMapping("isdisablecategory") + public Result isDisableCategory(@LoginUser TokenDto tokenDto, @RequestBody IsDisableCategoryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, IsDisableCategoryFormDTO.IsDisableCategory.class); + formDTO.setUserId(tokenDto.getUserId()); + if(!ModuleConstants.ID_ENABLE.equals(formDTO.getType())&&!ModuleConstants.IS_DISABLE.equals(formDTO.getType())){ + throw new RuntimeException("参数错误,操作类型值错误!"); + } + issueProjectCategoryDictService.isDisableCategory(formDTO); + return new Result(); + } + + /** + * @param formDTO + * @return + * @Description 分类删除【存在客户在使用时不允许删除】 + * @Author sun + **/ + @PostMapping("delcategory") + public Result delCategory(@LoginUser TokenDto tokenDto, @RequestBody DelCategoryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, DelCategoryFormDTO.DelCategory.class); + formDTO.setUserId(tokenDto.getUserId()); + issueProjectCategoryDictService.delCategory(formDTO); + return new Result(); + } + + /** + * 获取客户 分类字典 信息 + * + * @param dto + * pid = 0 查询一级分类 + * pid != 0 查询二级分类 + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + @PostMapping("getcustomercategorydict") + public Result> getCustomerCategoryDict(@RequestBody CustomerCategoryDTO dto){ + return new Result>().ok(issueProjectCategoryDictService.listCategoryDict(dto.getCustomerId(), + dto.getPid())); + } + + /** + * 新增或修改一级分类信息,分类名称在同一个客户下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + @PostMapping("savefirstcategory") + public Result saveFirstCategory(@RequestBody SecondCategoryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (CommonOperateTypeEnum.ADD.getCode().equals(formDTO.getType())) { + return issueProjectCategoryDictService.saveFirstCategory(formDTO); + } else if (CommonOperateTypeEnum.EDIT.getCode().equals(formDTO.getType())){ + return issueProjectCategoryDictService.editFirstCategory(formDTO); + } + throw new RenException("操作类型为空,或错误。type:" + formDTO.getType()); + } + + /** + * 新增或修改二级分类信息,分类名称在同一个客户下同一 一级分类下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + @PostMapping("savesecondcategory") + public Result saveSecondCategory(@RequestBody SecondCategoryFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if (StringUtils.isBlank(formDTO.getParentCategoryId())) { + throw new RenException("一级分类Id 不能为空"); + } + if (CommonOperateTypeEnum.ADD.getCode().equals(formDTO.getType())) { + return issueProjectCategoryDictService.saveSecondCategory(formDTO); + } else if (CommonOperateTypeEnum.EDIT.getCode().equals(formDTO.getType())){ + return issueProjectCategoryDictService.editSecondCategory(formDTO); + } + throw new RenException("操作类型为空,或错误。type:" + formDTO.getType()); + } + + /** + * 客户分类列表 + * 按客户查询已有一级二级分类列表,升序排列,全部查询,不涉及分页 + * + * @param map + * customerId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 16:30 2021-03-23 + **/ + @PostMapping("customercategorylist") + public Result> customerCategoryList(@RequestBody Map map) { + if (StringUtils.isBlank(map.get(FieldConstant.CUSTOMER_ID_HUMP))) { + throw new RenException("客户id 不能为空"); + } + return new Result>().ok(issueProjectCategoryDictService.customerCategoryList(map.get(FieldConstant.CUSTOMER_ID_HUMP))); + } +} + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectTagDictController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectTagDictController.java new file mode 100644 index 0000000000..e87f9996d7 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueProjectTagDictController.java @@ -0,0 +1,125 @@ +/** + * 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.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +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.IssueProjectTagDictDTO; +import com.epmet.dto.form.TagDifferentSetFormDTO; +import com.epmet.dto.form.TagListFormDTO; +import com.epmet.dto.result.TagListResultDTO; +import com.epmet.excel.IssueProjectTagDictExcel; +import com.epmet.service.IssueProjectTagDictService; +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 2020-12-08 + */ +@RestController +@RequestMapping("issueprojecttagdict") +public class IssueProjectTagDictController { + + @Autowired + private IssueProjectTagDictService issueProjectTagDictService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = issueProjectTagDictService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + IssueProjectTagDictDTO data = issueProjectTagDictService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueProjectTagDictDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueProjectTagDictService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueProjectTagDictDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueProjectTagDictService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueProjectTagDictService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = issueProjectTagDictService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IssueProjectTagDictExcel.class); + } + + /** + * 标签列表 + * @author zhaoqifeng + * @date 2020/12/9 15:43 + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("list") + public Result list(@LoginUser TokenDto tokenDto, @RequestBody TagListFormDTO formDTO) { + return new Result().ok(issueProjectTagDictService.getTagList(tokenDto, formDTO)); + } + + /** + * @Description 更新标签热度 数据库/缓存 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 14:00 + */ + @PostMapping("updatecitations") + public Result updateCitations(@RequestBody TagDifferentSetFormDTO param){ + ValidatorUtils.validateEntity(param); + issueProjectTagDictService.updateTagHeat(param); + return new Result(); + } +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueTagsController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueTagsController.java new file mode 100644 index 0000000000..de6cfd4cc2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueTagsController.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.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +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.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.IssueTagsDTO; +import com.epmet.dto.form.AddTagFormDTO; +import com.epmet.dto.form.IssueTagsSaveFormDTO; +import com.epmet.dto.result.AddTagResultDTO; +import com.epmet.excel.IssueTagsExcel; +import com.epmet.service.IssueTagsService; +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 2020-12-08 + */ +@RestController +@RequestMapping("issuetags") +public class IssueTagsController { + + @Autowired + private IssueTagsService issueTagsService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = issueTagsService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + IssueTagsDTO data = issueTagsService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody IssueTagsDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + issueTagsService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody IssueTagsDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + issueTagsService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + issueTagsService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = issueTagsService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, IssueTagsExcel.class); + } + + /** + * @Description 标签添加 + * @Param form + * @author zxc + * @date 2020/12/9 下午3:29 + */ + @PostMapping("add") + public Result addTag(@RequestBody AddTagFormDTO form, @LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(form, AddTagFormDTO.AddTag.class); + AddTagResultDTO addTagResultDTO = issueTagsService.addTag(form, tokenDto); + return new Result().ok(addTagResultDTO); + } + + /** + * @Description 议题标签保存/修改 + * @Param form + * @Param tokenDto + * @author zxc + * @date 2020/12/10 上午9:37 + */ + @PostMapping("save") + public Result issueTagSave(@RequestBody IssueTagsSaveFormDTO form,@LoginUser TokenDto tokenDto){ + ValidatorUtils.validateEntity(form, IssueTagsSaveFormDTO.IssueTagsSaveForm.class); + issueTagsService.issueTagSave(form,tokenDto); + return new Result(); + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueApplicationDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueApplicationDao.java index 38ec62c1d6..33296076b6 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueApplicationDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueApplicationDao.java @@ -66,4 +66,12 @@ public interface IssueApplicationDao extends BaseDao { List selectUserPubAuditingIssues(UserPubAuditingIssueFormDTO formDTO); List selectByTopicId(@Param("topicId") String topicId); + + /** + * @param topicIdList + * @Description 查询当前未成为议题的话题但是提交了转议题申请的 + * @author sun + */ + List selectTopicIdList(@Param("topicIdList") List topicIdList); + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java new file mode 100644 index 0000000000..650e4ac227 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueCategoryDao.java @@ -0,0 +1,75 @@ +/** + * 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.dto.IssueCategoryDTO; +import com.epmet.dto.form.DelCategoryFormDTO; +import com.epmet.dto.form.ProjectCategoryTagListFormDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.dto.result.ProjectCategoryTagResultDTO; +import com.epmet.entity.IssueCategoryEntity; +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 2020-12-08 + */ +@Mapper +public interface IssueCategoryDao extends BaseDao { + + /** + * @Description 查询议题绑定的分类名称,按排序升序 + * @Author sun + **/ + List selectIssueCategoryList(@Param("issueId") String issueId); + + /** + * @param formDTO + * @return + * @Description 查询分类Id对应的分类名称,按分类升序排列 + * @Author sun + **/ + List selectProjectCategoryList(ProjectCategoryTagListFormDTO formDTO); + + /** + * 获取议题分类 + * @author zhaoqifeng + * @date 2020/12/9 10:46 + * @param issueId + * @return java.util.List + */ + List selectCategoryByIssue(@Param("issueId") String issueId); + + /** + * @Description 删除议题的分类信息 + * @Author sun + **/ + void delByIssueId(@Param("issueId") String issueId); + + /** + * @Description 查询客户分类有没有被议题使用 + * @Author sun + **/ + List selectIssueList(DelCategoryFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java new file mode 100644 index 0000000000..ff49f564b1 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectCategoryDictDao.java @@ -0,0 +1,170 @@ +/** + * 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.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.form.DelCategoryFormDTO; +import com.epmet.dto.form.IsDisableCategoryFormDTO; +import com.epmet.dto.form.IssueProjectCategoryDictListFormDTO; +import com.epmet.dto.result.CustomerCategoryListResultDTO; +import com.epmet.dto.result.CustomerCategoryResultDTO; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.LinkedList; +import java.util.List; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface IssueProjectCategoryDictDao extends BaseDao { + + /** + * @Description 客户分类列表查询,按分类升序排列,查询未被禁用的 + * @Author sun + **/ + List selectCustomerCategoryList(@Param("customerId") String customerId); + /** + * @Description 查询某个分类的下级分类 + * @Author sun + **/ + List subCategoryList(@Param("id") String categoryId, @Param("customerId") String customerId); + + /** + * 获取默认标签配置 + * @author zhaoqifeng + * @date 2020/12/10 10:06 + * @return java.util.List + */ + List selectCategoryListByCustomer(@Param("customerId") String customerId); + + /** + * @param formDTO + * @return + * @Description 批量查询分类信息 + * @Author sun + **/ + List selectCategoryList(IssueProjectCategoryDictListFormDTO formDTO); + + /** + * @Description 根据客户Id、类别名称、类型查询单个类别 默认查询二级分类 + * @param customerId + * @param categoryName + * @param categoryType + * @return com.epmet.entity.IssueProjectCategoryDictEntity + * @author wangc + * @date 2020.12.10 13:37 + */ + IssueProjectCategoryDictEntity selectSingleByCustomerIdAndCategoryNameAndCategoryType(@Param("customerId")String customerId,@Param("categoryName")String categoryName,@Param("categoryType")String categoryType); + + /** + * 获取客户 分类字典 信息 + * + * @param customerId + * @param pid pid = 0 查询一级分类 + * pid != 0 查询二级分类 + * + * @return java.util.List + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + List selectListCategoryDict(@Param("customerId") String customerId, @Param("pid") String pid); + + /** + * 查询客户某个分类信息 + * @author sun + */ + IssueProjectCategoryDictDTO selectByCustomerId(@Param("customerId") String customerId, @Param("categoryId") String categoryId); + + /** + * 删除一级或二级分类,二级分类下默认有的标签不作处理 + * @author sun + */ + int delCategory(DelCategoryFormDTO formDTO); + + /** + * 查询客户全部子类分类信息 + * @author sun + */ + List selectSubCustomerCategoryDict(@Param("customerId") String customerId, @Param("pid") String pid); + + /** + * 批量修改分类启用、禁用状态 + * @author sun + */ + int updateCustomerCategory(IsDisableCategoryFormDTO formDTO); + + /** + * 获取客户下 最大的分类编码(包含已被删除的编码) + * + * @param customerId + * @param parentCategoryCode + * = 0 查询一级分类的最大分类编码 + * = 10xx 根据上级分类编码,查询某个子级的最大分类编码 + * @return java.lang.Integer + * @Author zhangyong + * @Date 13:35 2021-03-23 + **/ + Integer getMaxCategoryCode(@Param("customerId") String customerId, @Param("parentCategoryCode") String parentCategoryCode); + + /** + * 判断同一个客户下有效数据中 分类名称是否重复 + * > 0 则为重复 + * + * + * @param customerId + * @param categoryName + * @param pid != null 表示 将查询范围,限制在某一个一级分类 及 一级分类下的有效数据 + * @param id 修改时,不一定会修改分类名称,所以需通过id 过滤自己 + * @return java.lang.Boolean + * @Author zhangyong + * @Date 14:11 2021-03-23 + **/ + Integer isCategoryName(@Param("customerId") String customerId, @Param("categoryName") String categoryName, + @Param("pid") String pid, @Param("id") String id); + + /** + * 获取客户所有的 分类字典 信息(包含已被禁用的) + * + * @param customerId + * @param pid pid = 0 查询一级分类 + * pid != 0 查询二级分类 + * + * @return java.util.List + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + LinkedList selectListAllCategoryDict(@Param("customerId") String customerId, @Param("pid") String pid); + + /** + * 根据 主键+customerId 修改议题项目分类字典 + * + * @param entity + * @return int + * @Author zhangyong + * @Date 09:53 2021-03-30 + **/ + int updateIssueProjectCategoryDict(IssueProjectCategoryDictEntity entity); +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectRelationDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectRelationDao.java index 017723d64a..437c5e3fe9 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectRelationDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectRelationDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IssueDTO; import com.epmet.entity.IssueProjectRelationEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -50,4 +51,9 @@ public interface IssueProjectRelationDao extends BaseDao selectRelationList(@Param("projectIdList") List projectIdList); + /** + * @Author sun + * @Description 根据项目id查询对应的议题基本信息 + **/ + IssueDTO selectProjectToIssue(@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/IssueProjectTagDictDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java new file mode 100644 index 0000000000..45fa05d7cf --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueProjectTagDictDao.java @@ -0,0 +1,143 @@ +/** + * 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.dto.form.IsDisableCategoryFormDTO; +import com.epmet.dto.form.IssueTagFormDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.entity.IssueProjectTagDictEntity; +import org.apache.ibatis.annotations.Mapper; +import org.springframework.data.repository.query.Param; + +import java.util.List; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Mapper +public interface IssueProjectTagDictDao extends BaseDao { + + /** + * @Description 更新标签使用次数 + * @Param tags + * @Param status 0:+1;1:-1 + * @author zxc + * @date 2020/12/10 上午10:29 + */ + void updateTagsUseCount(@Param("tags") List tags,@Param("customerId")String customerId,@Param("status")String status); + + /** + * @Description 更新标签使用次数 + * @param tagIds + * @param customerId + * @param score + * @return void + * @author wangc + * @date 2020.12.14 09:33 + */ + void updateTagUsage(@Param("tagIds") List tagIds,@Param("customerId")String customerId,@Param("score") Integer score); + + /** + * @Description 查询标签ID + * @Param newTags + * @Param customerId + * @author zxc + * @date 2020/12/10 下午2:16 + */ + List selectTagId(@Param("list") List newTags); + + /** + * 获取客户默认分类标签 + * @author zhaoqifeng + * @date 2020/12/10 9:26 + * @param customerId + * @param list + * @return java.util.List + */ + List selectDefaultList(@Param("customerId") String customerId, @Param("list") List list); + + /** + * 获取默认标签配置 + * @author zhaoqifeng + * @date 2020/12/10 10:09 + * @param customerId + * @return java.util.List + */ + List selectTagListByCustomer(@Param("customerId") String customerId); + + /** + * @Description 根据类别查询客户下默认标签 + * @param categories + * @param customerId + * @return java.util.List + * @author wangc + * @date 2020.12.10 10:07 + */ + List selectTagByCategory(@Param("categories") List categories,@Param("customerId") String customerId,@Param("targetCustomerId") String targetCustomerId); + + /** + * @Description 查询客户下的标签数量 + * @param customerId + * @return int + * @author wangc + * @date 2021.03.23 16:51 + */ + int selectCountByCustomerId(@Param("customerId") String customerId); + + /** + * @Description 查询客户下自定义标签 + * @param customerId + * @return java.util.List + * @author wangc + * @date 2021.03.23 16:56 + */ + List selectCustomizedByCustomerId(@Param("customerId") String customerId); + + /** + * @Description 根据传入的二级分类Id查询默认标签 + * 当categories为空时,查询全部默认分类的标签,排序规则:先按照二级分类的上级分类的Sort排序(asc),然后按照二级分类的Sort排序(asc),然后按照标签名拼音排序 + * 当categories不为空时,按照传入的二级分类的顺序排序,然后按照标签名拼音排序 + * @param customerId + * @param categories + * @return java.util.List + * @author wangc + * @date 2021.03.23 15:19 + */ + List selectDefault(@Param("customerId") String customerId,@Param("categories") List categories); + + /** + * @Description 根据客户Id和标签Id集合查询标签的基础信息(标签名、标签码,标签所属分类) + * 不管标签是否被禁用,都可以更新热度,因此这个查询不能加是否禁用的限制 + * @param customerId + * @param tagIds + * @return java.util.List + * @author wangc + * @date 2020.12.13 14:23 + */ + List selectTagsByCustomerIdAndTagIds(@Param("customerId") String customerId,@Param("tagIds")List tagIds); + + /** + * 批量修改标签的启用、禁用状态 + * @author sun + */ + int updateCustomerTag(IsDisableCategoryFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java new file mode 100644 index 0000000000..97d3bbea5e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueTagsDao.java @@ -0,0 +1,95 @@ +/** + * 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.dto.IssueTagsDTO; +import com.epmet.dto.form.AddTagFormDTO; +import com.epmet.dto.form.IssueTagFormDTO; +import com.epmet.dto.form.IssueTagsFormDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.entity.IssueTagsEntity; +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 2020-12-08 + */ +@Mapper +public interface IssueTagsDao extends BaseDao { + + /** + * @Description 查询议题绑定的标签,按绑定时间升序 + * @Author sun + **/ + List selectIssueTagList(@Param("issueId") String issueId); + + /** + * 获取议题标签 + * @author zhaoqifeng + * @date 2020/12/9 14:05 + * @param issueId + * @return java.util.List + */ + List selectTagsByIssue(@Param("issueId") String issueId); + + /** + * @Description 查询标签是否重名 + * @Param form + * @author zxc + * @date 2020/12/9 下午3:40 + */ + String selectTagNameCount(AddTagFormDTO form); + + /** + * @Description 根据IssueId查询标签 + * @Param issueId + * @author zxc + * @date 2020/12/10 上午10:05 + */ + List selectTagsByIssueId(@Param("issueId")String issueId); + + /** + * @Description 根据IssueId删除标签 + * @Param issueId + * @author zxc + * @date 2020/12/10 上午10:14 + */ + void deleteTagsByIssueId(@Param("issueId")String issueId); + + /** + * @Description 查询此议题一条标签记录 + * @Param issueId + * @author zxc + * @date 2020/12/10 下午1:49 + */ + IssueTagsDTO selectOneTagByIssueId(@Param("issueId")String issueId); + + /** + * @Description 插入新的标签 + * @Param needInsert + * @author zxc + * @date 2020/12/10 下午2:11 + */ + void insertNewTags(@Param("tags") List needInsert); +} \ 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/entity/IssueCategoryEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCategoryEntity.java new file mode 100644 index 0000000000..f0478e560f --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueCategoryEntity.java @@ -0,0 +1,71 @@ +/** + * 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 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_category") +public class IssueCategoryEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 网格ID: 议题所属网格Id + */ + private String gridId; + + /** + * 议题id + */ + private String issueId; + + /** + * 分类id + */ + private String categoryId; + + /** + * 分类对应的所有上级,英文逗号隔开 + */ + private String categoryPids; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java new file mode 100644 index 0000000000..b99f37a2bf --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java @@ -0,0 +1,86 @@ +/** + * 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 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_project_category_dict") +public class IssueProjectCategoryDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id, 产品默认default + */ + private String customerId; + + /** + * 上级分类ID 顶级此列存储0 + */ + private String pid; + + /** + * 所有上级分类ID,用逗号分开 + */ + private String pids; + + /** + * 上级分类编码 + */ + private String parentCategoryCode; + + /** + * 分类编码,分类编码+customer_id唯一 + */ + private String categoryCode; + + /** + * 分类名称 + */ + private String categoryName; + + /** + * 分类类别1,2,3,4.... + */ + private String categoryType; + + /** + * 排序 + */ + private Integer sort; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectTagDictEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectTagDictEntity.java new file mode 100644 index 0000000000..48d457624b --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectTagDictEntity.java @@ -0,0 +1,76 @@ +/** + * 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 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_project_tag_dict") +public class IssueProjectTagDictEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 标签名称 + */ + private String tagName; + + /** + * 分类id, 用户自己添加的标签此列可为空 + */ + private String categoryId; + + /** + * 是否是默认标签(0:是 1:否) + */ + private String isDefault; + + /** + * 议题对标签的引用次数 + */ + private Integer issueUseCount; + + /** + * 项目对标签的引用次数 + */ + private Integer projectUseCount; + + /** + * 是否禁用(enable:启用 disable:禁用) + */ + private String isDisable; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueTagsEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueTagsEntity.java new file mode 100644 index 0000000000..1dc56255fc --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueTagsEntity.java @@ -0,0 +1,66 @@ +/** + * 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 2020-12-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("issue_tags") +public class IssueTagsEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 议题所属网格id + */ + private String gridId; + + /** + * 议题ID + */ + private String issueId; + + /** + * 标签ID + */ + private String tagId; + + /** + * 标签名称 + */ + private String tagName; + +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueCategoryExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueCategoryExcel.java new file mode 100644 index 0000000000..1d74b3fe92 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueCategoryExcel.java @@ -0,0 +1,71 @@ +/** + * 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 2020-12-08 + */ +@Data +public class IssueCategoryExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "网格ID: 议题所属网格Id") + private String gridId; + + @Excel(name = "议题id") + private String issueId; + + @Excel(name = "分类id") + private String categoryId; + + @Excel(name = "分类对应的所有上级,英文逗号隔开") + private String categoryPids; + + @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-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectCategoryDictExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectCategoryDictExcel.java new file mode 100644 index 0000000000..4cef5ada59 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectCategoryDictExcel.java @@ -0,0 +1,77 @@ +/** + * 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 2020-12-08 + */ +@Data +public class IssueProjectCategoryDictExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户id, 产品默认default") + private String customerId; + + @Excel(name = "上级分类ID 顶级此列存储0") + private String pid; + + @Excel(name = "所有上级分类ID,用逗号分开") + private String pids; + + @Excel(name = "分类编码,分类编码+customer_id唯一") + private String categoryCode; + + @Excel(name = "分类名称") + private String categoryName; + + @Excel(name = "分类类别1,2,3,4....") + private String categoryType; + + @Excel(name = "排序") + private Integer sort; + + @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-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectTagDictExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectTagDictExcel.java new file mode 100644 index 0000000000..26fee432bd --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueProjectTagDictExcel.java @@ -0,0 +1,74 @@ +/** + * 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 2020-12-08 + */ +@Data +public class IssueProjectTagDictExcel { + + @Excel(name = "主键ID") + private String id; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "标签名称") + private String tagName; + + @Excel(name = "分类id, 用户自己添加的标签此列可为空") + private String categoryId; + + @Excel(name = "是否是默认标签(0:是 1:否)") + private String isDefault; + + @Excel(name = "议题对标签的引用次数") + private Integer issueUseCount; + + @Excel(name = "项目对标签的引用次数") + private Integer projectUseCount; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private Integer 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-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueTagsExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueTagsExcel.java new file mode 100644 index 0000000000..c790e5e6e2 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueTagsExcel.java @@ -0,0 +1,71 @@ +/** + * 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 2020-12-08 + */ +@Data +public class IssueTagsExcel { + + @Excel(name = "主键ID") + private String id; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "议题所属网格id") + private String gridId; + + @Excel(name = "议题ID") + private String issueId; + + @Excel(name = "标签ID") + private String tagId; + + @Excel(name = "标签名称") + private String tagName; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private Integer 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-issue/gov-issue-server/src/main/java/com/epmet/mq/listener/IssueProjectCategoryTagInitListener.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/listener/IssueProjectCategoryTagInitListener.java new file mode 100644 index 0000000000..beb1fa1473 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/listener/IssueProjectCategoryTagInitListener.java @@ -0,0 +1,67 @@ +package com.epmet.mq.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +import com.epmet.commons.tools.distributedlock.DistributedLock; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.dto.form.CategoryTagInitFormDTO; +import com.epmet.service.IssueProjectCategoryDictService; +import org.apache.rocketmq.common.message.MessageExt; +import org.apache.rocketmq.spring.annotation.MessageModel; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.redisson.api.RLock; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.concurrent.TimeUnit; + +/** + * 监听初始化客户动作,为客户初始化议题、项目的分类、标签数据 + */ +@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, + consumerGroup = ConsomerGroupConstants.ISSUE_PROJECT_CATEGORY_TAG, + messageModel = MessageModel.CLUSTERING, + selectorExpression = "*") +@Component +public class IssueProjectCategoryTagInitListener implements RocketMQListener { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + + @Autowired + private DistributedLock distributedLock; + + @Override + public void onMessage(MessageExt messageExt) { + String msg = new String(messageExt.getBody()); + logger.info("初始化客户-初始化客户自定义信息-收到消息内容:{}", msg); + InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); + + CategoryTagInitFormDTO dto = new CategoryTagInitFormDTO(); + dto.setCustomerId(msgObj.getCustomerId()); + + RLock lock = null; + try { + lock = distributedLock.getLock(String.format("lock:init_customer_home:%s", msgObj.getCustomerId()), + 30l, 30l, TimeUnit.SECONDS); + issueProjectCategoryDictService.init(dto); + } catch (RenException e) { + // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 + logger.error("【RocketMQ】初始化客户组件失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + } catch (Exception e) { + // 不是我们自己抛出的异常,可以让MQ重试 + logger.error("【RocketMQ】初始化客户组件失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + throw e; + } finally { + distributedLock.unLock(lock); + } + } +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueCategoryRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueCategoryRedis.java new file mode 100644 index 0000000000..f05e1bac72 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueCategoryRedis.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 2020-12-08 + */ +@Component +public class IssueCategoryRedis { + @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-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectCategoryDictRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectCategoryDictRedis.java new file mode 100644 index 0000000000..f4bfbe0967 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectCategoryDictRedis.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 2020-12-08 + */ +@Component +public class IssueProjectCategoryDictRedis { + @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-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java new file mode 100644 index 0000000000..5cfb9a1c5c --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java @@ -0,0 +1,480 @@ +/** + * 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.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.GovIssueRedisKeys; +import com.epmet.dao.IssueProjectCategoryDictDao; +import com.epmet.dao.IssueProjectTagDictDao; +import com.epmet.dto.form.CategoryTagInitFormDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.entity.IssueProjectTagDictEntity; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.service.IssueProjectTagDictService; +import com.epmet.utils.ModuleConstants; +import com.fasterxml.jackson.databind.ObjectMapper; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.dao.DataAccessException; +import org.springframework.data.redis.connection.RedisConnection; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ZSetOperations; +import org.springframework.lang.Nullable; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Component +@Slf4j +public class IssueProjectTagDictRedis { + @Autowired + private RedisUtils redisUtils; + @Autowired + private RedisTemplate redisTemplate; + @Autowired + private IssueProjectTagDictDao poolDao; + @Autowired + private IssueProjectCategoryDictDao categoryDictDao; + @Autowired + private IssueProjectCategoryDictService categoryDictService; + @Autowired + private IssueProjectTagDictService tagDictService; + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + + + /** + * @Description + * + * 排序规则: + * 1、默认标签,按照分类排序 + * 2、自定义标签,按照热度排序 + * + * @param customerId + * @param category + * @return + * @author wangc + * @date 2020.12.09 11:16 + */ + public Map> getDefaultTagsSortedByCategoryAndCustomizedTagsOrderByRank(String customerId,List category) { + if (StringUtils.isBlank(customerId)) { + log.error("customerId can not be null when obtain govern tags."); + throw new RenException("customerId can not be null when obtain govern tags."); + } + + //查询客户的“其他"分类的Id + IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); + //判断入参是否是只有一个分类Id并且是"其他"的Id + boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false); + + Map> result = new HashMap<>(); + //传入的categories不会只包含"其他"这个分类,因为情况下ifOtherOnly为true,直接传入null + List _default = poolDao.selectDefault(customerId,ifOtherOnly ? null : category); + if(!CollectionUtils.isEmpty(_default)){ + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,_default); + }else log.error("there is no default tag data in database , customerId : {}",customerId); + + + //如果keys集合为空,说明缓存中没有当前客户的标签排行信息,直接进行补偿 + Set> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); + if(!CollectionUtils.isEmpty(customizedTuples)){ + Map> customizedHeatMap = new HashMap<>(); + customizedTuples.forEach(tuple -> { + List queue = customizedHeatMap.get(tuple.getScore()); + if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); + queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); + customizedHeatMap.put(tuple.getScore(),queue); + }); + List customizedResult = new LinkedList<>(); + customizedHeatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { + customizedResult.addAll(customizedHeatMap.get(count)); + }); + result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult); + } + + + //默认、自定义标签,只要有一个是空就触发补偿 + //不信任缓存数据 + if(!CollectionUtils.isEmpty(result) && !CollectionUtils.isEmpty(result.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)) + && !CollectionUtils.isEmpty(result.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))) + return result; + + + + + log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId); + + Map> compensate = compensate(customerId, category, ifOtherOnly,result); + + if (CollectionUtils.isEmpty(compensate)) { + log.error("compensation failure or there is no tag data in database!!"); + throw new RenException("compensation failure or there is no tag data in database!!"); + } else { + log.warn("compensation completed!!"); + return compensate; + } + } + + + + + /** + * @Description FIXME 该方法保留,默认查询缓存,默认和自定义两种标签均按热度排序 + * FIXME 如果缓存中没有相关数据,则进行补偿,返回的数据为:1、默认标签(分类排序) 2、自定义标签(热度排序) + * FIXME 补偿机制均是在缓存中存储热度得分,因此在业务改变之前不要调用该方法 + * category为空,则补偿全部,返回默认标签和自定义标签 + * category仅包含"其他"这个分类的Id时,同上 + * category不为空且不只有"其他"这个分类的Id时,则返回集合中的类别标签以及自定义标签 + * 默认标签不按照热度排序,自定义标签按照热度排序 + * + * @param customerId + * @param category + * @return + * @author wangc + * @date 2020.12.09 11:16 + */ + public Map> getTagsOrderByRank(String customerId,List category) { + if (StringUtils.isBlank(customerId)) { + log.error("customerId can not be null when obtain govern tags."); + return null; + } + + IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); + boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false); + Set keys; + if (CollectionUtils.isEmpty(category) || ifOtherOnly) + keys = redisUtils.keys(GovIssueRedisKeys.getGovernmentTagKey(customerId, null)); + else keys = category.stream().map(key -> { + return GovIssueRedisKeys.getGovernmentTagKey(customerId, key); + }).collect(Collectors.toSet()); + //如果keys集合为空,说明缓存中没有当前客户的标签排行信息,直接进行补偿 + if (!CollectionUtils.isEmpty(keys)){ + keys.remove(GovIssueRedisKeys.getGovernmentTagKey(customerId,ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)); + List>> heatTuple = redisTemplate.executePipelined(new RedisCallback>>() { + @Nullable + @Override + public Set> doInRedis(RedisConnection connection) throws DataAccessException { + connection.openPipeline(); + keys.forEach(key -> { + connection.zSetCommands().zRangeByScoreWithScores(redisTemplate.getKeySerializer().serialize(key), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); + }); + return null; + } + }, redisTemplate.getValueSerializer()); + + Map> result = new HashMap<>(); + if (!CollectionUtils.isEmpty(heatTuple)) { + //热度Map 分数为key + Map> heatMap = new HashMap<>(); + heatTuple.forEach(tupleSet -> { + tupleSet.forEach(tuple -> { + Double heatScore = tuple.getScore(); + List queue = heatMap.get(heatScore); + if (CollectionUtils.isEmpty(queue)) queue = new LinkedList<>(); + queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); + heatMap.put(heatScore, queue); + }); + }); + List defaultResult = new LinkedList<>(); + heatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { + defaultResult.addAll(heatMap.get(count)); + }); + + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME, defaultResult); + } + Set> customizedTuples = redisUtils.zReverseRangeWithScores(GovIssueRedisKeys.getGovernmentTagKey(customerId, null), NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); + if(!CollectionUtils.isEmpty(customizedTuples)){ + Map> customizedHeatMap = new HashMap<>(); + customizedTuples.forEach(tuple -> { + List queue = customizedHeatMap.get(tuple.getValue()); + if((CollectionUtils.isEmpty(queue))) queue = new LinkedList<>(); + queue.add(parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class)); + customizedHeatMap.put((Double) tuple.getValue(),queue); + }); + List customizedResult = new LinkedList<>(); + customizedHeatMap.keySet().stream().sorted(Comparator.reverseOrder()).collect(Collectors.toList()).forEach(count -> { + customizedResult.addAll(customizedHeatMap.get(count)); + }); + result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,customizedResult); + } + return result; + + } + + log.warn("fetch customer govern tag cache blankly,customerId:{},now begin compensation...", customerId); + + Map> compensate = compensate(customerId, category, ifOtherOnly,null); + + if (CollectionUtils.isEmpty(compensate)) { + log.error("compensation failure or there is no tag data in database!!"); + return null; + } else { + log.warn("compensation completed!!"); + return compensate; + } + } + + + + /** + * @Description 如果之前查询的结果为空,说明默认与自定义都没有 + * + * + * @param customerId + * @param category + * @return + * @author wangc + * @date 2020.12.10 09:34 + */ + public Map> compensate(String customerId,List category,boolean ifOtherOnly,Map> preResult){ + + List db = new LinkedList<>(); + + CategoryTagInitFormDTO customerIdParam = new CategoryTagInitFormDTO(); + customerIdParam.setCustomerId(customerId); + if (!CollectionUtils.isEmpty(redisUtils.keys(GovIssueRedisKeys.getGovernmentTagKey(customerId, null)))){ + //缓存不为空 + if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME))) { + if (ifOtherOnly || CollectionUtils.isEmpty(category)) { + //补偿全部默认标签 + categoryDictService.init(customerIdParam); + db.addAll(poolDao.selectTagByCategory(null, customerId, customerId)); + } else { + if (NumConstant.ZERO <= poolDao.selectCountByCustomerId(customerId)) { + categoryDictService.init(customerIdParam); + } else { + //只插入category中的标签 + List missingTags = poolDao.selectTagByCategory(category, "default", customerId); + if(!CollectionUtils.isEmpty(missingTags)){ + tagDictService.insertBatch(missingTags); + db.addAll(missingTags);} + } + } + } + + }else{ + //缓存为空 + if (NumConstant.ZERO <= poolDao.selectCountByCustomerId(customerId)) { + categoryDictService.init(customerIdParam); + } + db.addAll(poolDao.selectTagByCategory(null, customerId, customerId)); + } + + if(CollectionUtils.isEmpty(preResult) || CollectionUtils.isEmpty(preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))){ + //先去数据库查询自定义,为空则是最终结果,不为空则补偿 + List customizedTags = poolDao.selectCustomizedByCustomerId(customerId); + if(!CollectionUtils.isEmpty(customizedTags)){ + db.addAll(customizedTags); + } + } + + + + + // key -> redisKey + // value -> [key : score ; value : object] + Map>> fulfilled = new HashMap<>(); + if(!CollectionUtils.isEmpty(db)) { + Map> categoryMap = db.stream().collect(Collectors.groupingBy(IssueProjectTagDictEntity::getCategoryId)); + //key -> categoryId + categoryMap.forEach((k, v) -> { + Map> scoreMap = new HashMap<>(); + String redisKey = GovIssueRedisKeys.getGovernmentTagKey(customerId, k); + v.forEach(tag -> { + List unit = scoreMap.get(tag.getIssueUseCount()); + if (CollectionUtils.isEmpty(unit)) unit = new LinkedList<>(); + IssueCategoryTagResultDTO object = ConvertUtils.sourceToTarget(tag, IssueCategoryTagResultDTO.class); + object.setName(tag.getTagName()); + unit.add(object); + scoreMap.put(tag.getIssueUseCount(), unit); + }); + fulfilled.put(redisKey, scoreMap); + }); + + + redisTemplate.executePipelined((RedisCallback) connection -> { + fulfilled.forEach((redisKey, map) -> { + map.forEach((score,list) -> { + list.forEach(factor -> { + connection.zSetCommands().zAdd(redisTemplate.getKeySerializer().serialize(redisKey), + score.doubleValue(), + redisTemplate.getValueSerializer().serialize(factor)); + }); + }); + + }); + return null; + }); + } + + Map> result = new HashMap<>(); + //默认标签:按照分类排序 Mapper返回的查询结果是有序的 + //result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME,CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> !StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME,o.getCategoryId())).map(entity -> { + // IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity,IssueCategoryTagResultDTO.class); + // tag.setName(entity.getTagName()); return tag;}).collect(Collectors.toList())); + if (!CollectionUtils.isEmpty(preResult) && !CollectionUtils.isEmpty(preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME))) { + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME, preResult.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)); + } else { + result.put(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME, poolDao.selectDefault(customerId, ifOtherOnly ? null : category)); + } + + //自定义标签:按照热度排序 sorted(Comparator.comparing(IssueProjectTagDictEntity :: getIssueUseCount).reversed()) + if (!CollectionUtils.isEmpty(preResult) && !CollectionUtils.isEmpty(preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME))) { + result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME, preResult.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME)); + } else { + result.put(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME, CollectionUtils.isEmpty(db) ? null : db.stream().filter(o -> StringUtils.equals(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME, o.getCategoryId())).sorted(Comparator.comparing(IssueProjectTagDictEntity::getIssueUseCount).reversed()).map(entity -> { + IssueCategoryTagResultDTO tag = ConvertUtils.sourceToTarget(entity, IssueCategoryTagResultDTO.class); + tag.setName(entity.getTagName()); + return tag; + }).collect(Collectors.toList())); + } + return result; + } + + /** + * @Description 标签使用次数修改 + * @Param customerId 客户ID + * @Param categoryId 标签ID 自定义标签的categoryId统一为[customize] + * @Param formDTO + * @Param status 标签次数更新状态 0:+1,1:-1 + * @author zxc + * @date 2020/12/9 下午2:54 + */ + public void editTagUseCount(String customerId,String categoryId, Object formDTO,String status){ + String key = GovIssueRedisKeys.getGovernmentTagKey(customerId, categoryId); + if (status.equals(NumConstant.ZERO_STR)){ + // 标签使用次数+1 + redisUtils.zIncrementScore(key, formDTO,NumConstant.ONE); + } + if (status.equals(NumConstant.ONE_STR)){ + //标签使用次数-1 + Double score = redisUtils.getScore(key, formDTO); + // 避免score为负数 + if (null != score && score > NumConstant.ZERO){ + redisUtils.zIncrementScore(key, formDTO,NumConstant.ONE_NEG); + } + } + } + + /** + * @Description 标签添加 + * @Param customerId + * @Param categoryId + * @Param o + * @author zxc + * @date 2020/12/9 下午3:19 + */ + public void addIssueProjectTag(String customerId,String categoryId,Object o){ + String key = GovIssueRedisKeys.getGovernmentTagKey(customerId, categoryId); + redisUtils.zSetAdd(key,o); + } + + public void batchIncrScore(Map>> param){ + if(CollectionUtils.isEmpty(param)) return; + redisTemplate.executePipelined((RedisCallback) connection -> { + param.forEach((operation,map) -> { + if(!CollectionUtils.isEmpty(map)){ + map.forEach((key,list) -> { + if(!CollectionUtils.isEmpty(list)){ + list.forEach(obj -> { + connection.zSetCommands().zIncrBy(redisTemplate.getKeySerializer().serialize(key), + StringUtils.equals(NumConstant.ONE_STR,operation) ? 1d : -1d , + redisTemplate.getValueSerializer().serialize(obj)); + }); + } + }); + } + }); + return null; + }); + } + + /** + * @Description 批量更新指定分类下的标签的禁用/启用属性 + * @param customerId 客户Id + * @param secondCategoryIds 二级分类集合 + * @param availableFlag enable | disabled + * @return void + * @author wangc + * @date 2021.03.22 16:20 + */ + public void updateTagAvailabilityBySecondCategoryIds(String customerId,ListsecondCategoryIds,String availableFlag){ + if(CollectionUtils.isEmpty(secondCategoryIds)) return; + secondCategoryIds.forEach(cid -> { + String key = GovIssueRedisKeys.getGovernmentTagKey(customerId, cid); + + Set> tagTuples = + redisUtils.zReverseRangeWithScores(key, NumConstant.ZERO_L, (long) (NumConstant.ONE_NEG)); + + if(!CollectionUtils.isEmpty(tagTuples)){ + Map> heatMap = new HashMap<>(); + tagTuples.forEach(tuple -> { + Set queue = heatMap.get(tuple.getValue()); + if((CollectionUtils.isEmpty(queue))) queue = new HashSet<>(); + IssueCategoryTagResultDTO ele = parseObject(tuple.getValue(), IssueCategoryTagResultDTO.class); + ele.setIsDisable(availableFlag); + queue.add(ele); + heatMap.put(tuple.getScore(),queue); + }); + + + redisUtils.delete(key); + + redisTemplate.executePipelined((RedisCallback) connection -> { + heatMap.forEach((score,set) -> { + set.forEach(o -> { + connection.zSetCommands().zIncrBy(redisTemplate.getKeySerializer().serialize(key), + score , + redisTemplate.getValueSerializer().serialize(o)); + }); + }); + return null; + }); + } + }); + } + + public T parseObject(Object o,Class clazz){ + ObjectMapper objectMapper = new ObjectMapper(); + T t = objectMapper.convertValue(o, clazz); + return t; + } +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueTagsRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueTagsRedis.java new file mode 100644 index 0000000000..3219ea7b57 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueTagsRedis.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 2020-12-08 + */ +@Component +public class IssueTagsRedis { + @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-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/IssueApplicationService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueApplicationService.java index 6c2df1b318..aecc10b0b5 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueApplicationService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueApplicationService.java @@ -143,4 +143,11 @@ public interface IssueApplicationService extends BaseService queryUserPubAuditingIssues(UserPubAuditingIssueFormDTO fomrDTO); + + /** + * @param topicIdList + * @Description 查询当前未成为议题的话题但是提交了转议题申请的 + * @author sun + */ + List notIssueToTopicIds(List topicIdList); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java new file mode 100644 index 0000000000..5717b27db0 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueCategoryService.java @@ -0,0 +1,135 @@ +/** + * 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.IssueCategoryDTO; +import com.epmet.dto.form.IssueCategoryTagListFormDTO; +import com.epmet.dto.form.IssueSaveCategoryFormDTO; +import com.epmet.dto.form.ProjectCategoryTagListFormDTO; +import com.epmet.dto.result.IssueCategoryTagListResultDTO; +import com.epmet.dto.result.ProjectCategoryTagResultDTO; +import com.epmet.entity.IssueCategoryEntity; + +import java.util.List; +import java.util.Map; + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface IssueCategoryService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueCategoryDTO + * @author generator + * @date 2020-12-08 + */ + IssueCategoryDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(IssueCategoryDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(IssueCategoryDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * @param formDTO + * @return + * @Description 获取议题的分类、标签列表 + * @Author sun + **/ + IssueCategoryTagListResultDTO categoryTagList(IssueCategoryTagListFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Description 查询分类Id集合对应的分类名称,按分类升序排列 + * @Author sun + **/ + List projectCategoryList(ProjectCategoryTagListFormDTO formDTO); + + /** + * 获取议题分类 + * @author zhaoqifeng + * @date 2020/12/9 10:48 + * @param issueId + * @return java.util.List + */ + List getCategoryByIssue(String issueId); + + + /** + * @param formDTO + * @return + * @Description 议题:保存/修改分类 + * @Author sun + **/ + void saveCategory(IssueSaveCategoryFormDTO formDTO); + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java new file mode 100644 index 0000000000..639888bc23 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectCategoryDictService.java @@ -0,0 +1,211 @@ +/** + * 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.commons.tools.utils.Result; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.CustomerCategoryListResultDTO; +import com.epmet.dto.result.CustomerCategoryResultDTO; +import com.epmet.dto.result.ProjectIssueCategoryResultDTO; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; +import java.util.Map; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface IssueProjectCategoryDictService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueProjectCategoryDictDTO + * @author generator + * @date 2020-12-08 + */ + IssueProjectCategoryDictDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(IssueProjectCategoryDictDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(IssueProjectCategoryDictDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * @param customerId + * @return + * @Description 客户分类列表查询,按分类升序排列 + * @Author sun + **/ + List categoryList(String customerId); + + /** + * 客户分类标签数据初始化 + * @author zhaoqifeng + * @date 2020/12/10 10:02 + * @param formDTO + * @return void + */ + void init(CategoryTagInitFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Description 批量查询分类信息 + * @Author sun + **/ + List getCategoryList(IssueProjectCategoryDictListFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @Author sun + **/ + ProjectIssueCategoryResultDTO getProjectAndCategoryInfo(ProjectSaveCategoryFormDTO formDTO); + + /** + * @Description 分类启用与禁用 + * @Author sun + **/ + void isDisableCategory(IsDisableCategoryFormDTO formDTO); + + /** + * @Description 分类删除 + * @Author sun + **/ + void delCategory(DelCategoryFormDTO formDTO); + + /** + * 获取客户 分类字典 信息 + * + * @param customerId + * @param pid pid = 0 查询一级分类 + * pid != 0 查询二级分类 + * + * @return java.util.List + * @Author zhangyong + * @Date 14:10 2021-03-22 + **/ + List listCategoryDict(String customerId, String pid); + + /** + * 新增一级分类信息,分类名称在同一个客户下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result 新增后的主键 + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + Result saveFirstCategory(SecondCategoryFormDTO formDTO); + + /** + * 修改一级分类信息,分类名称在同一个客户下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result 新增后的主键 + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + Result editFirstCategory(SecondCategoryFormDTO formDTO); + + /** + * 新增二级分类信息,分类名称在同一个客户下同一 一级分类下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result 新增后的主键 + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + Result saveSecondCategory(SecondCategoryFormDTO formDTO); + + /** + * 修改二级分类信息,分类名称在同一个客户下有效数据中不允许重复 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result 新增后的主键 + * @Author zhangyong + * @Date 10:27 2021-03-23 + **/ + Result editSecondCategory(SecondCategoryFormDTO formDTO); + + /** + * 客户分类列表 + * 按客户查询已有一级二级分类列表,升序排列,全部查询,不涉及分页 + * + * @param customerId + * @return java.util.List + * @Author zhangyong + * @Date 16:30 2021-03-23 + **/ + List customerCategoryList(String customerId); +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectTagDictService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectTagDictService.java new file mode 100644 index 0000000000..4e37aaf0d0 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueProjectTagDictService.java @@ -0,0 +1,127 @@ +/** + * 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.commons.tools.security.dto.TokenDto; +import com.epmet.dto.IssueProjectTagDictDTO; +import com.epmet.dto.form.TagDifferentSetFormDTO; +import com.epmet.dto.form.TagListFormDTO; +import com.epmet.dto.result.TagListResultDTO; +import com.epmet.entity.IssueProjectTagDictEntity; + +import java.util.List; +import java.util.Map; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface IssueProjectTagDictService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueProjectTagDictDTO + * @author generator + * @date 2020-12-08 + */ + IssueProjectTagDictDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(IssueProjectTagDictDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(IssueProjectTagDictDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * 标签列表 + * @author zhaoqifeng + * @date 2020/12/9 15:41 + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.TagListResultDTO + */ + TagListResultDTO getTagList(TokenDto tokenDto, TagListFormDTO formDTO); + + /** + * 获取默认标签配置 + * @author zhaoqifeng + * @date 2020/12/10 10:12 + * @param + * @return java.util.List + */ + List getTagListByCustomer(String customerId); + + /** + * @Description 更新标签热度 数据库/缓存 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 14:00 + */ + void updateTagHeat(TagDifferentSetFormDTO param); +} \ No newline at end of file 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..e22236e324 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); /** @@ -205,6 +212,15 @@ public interface IssueService extends BaseService { **/ void shiftProject(ShiftProjectFormDTO formDTO); + /** + * 议题管理-议题转项目-增加分类标签功能 + * @author zhaoqifeng + * @date 2020/12/9 10:01 + * @param formDTO + * @return void + */ + void shiftProjectV2(ShiftProjectFormDTO formDTO); + /** * @Description 已关闭列表 政府端 * @param issueListForm diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java new file mode 100644 index 0000000000..b7970e8793 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueTagsService.java @@ -0,0 +1,125 @@ +/** + * 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.commons.tools.security.dto.TokenDto; +import com.epmet.dto.IssueTagsDTO; +import com.epmet.dto.form.AddTagFormDTO; +import com.epmet.dto.form.IssueTagsSaveFormDTO; +import com.epmet.dto.result.AddTagResultDTO; +import com.epmet.entity.IssueTagsEntity; + +import java.util.List; +import java.util.Map; + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +public interface IssueTagsService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-12-08 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-12-08 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IssueTagsDTO + * @author generator + * @date 2020-12-08 + */ + IssueTagsDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void save(IssueTagsDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-12-08 + */ + void update(IssueTagsDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-12-08 + */ + void delete(String[] ids); + + /** + * 获取议题标签 + * @author zhaoqifeng + * @date 2020/12/9 14:07 + * @param issueId + * @return java.util.List + */ + List getTagsByIssue(String issueId); + + /** + * @Description 标签添加 + * @Param form + * @author zxc + * @date 2020/12/9 下午3:29 + */ + AddTagResultDTO addTag(AddTagFormDTO form, TokenDto tokenDto); + + /** + * @Description 议题标签保存/修改 + * @Param form + * @Param tokenDto + * @author zxc + * @date 2020/12/10 上午9:37 + */ + void issueTagSave(IssueTagsSaveFormDTO form, TokenDto tokenDto); +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueApplicationServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueApplicationServiceImpl.java index 71e62d3e1f..a699e58a61 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueApplicationServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueApplicationServiceImpl.java @@ -175,4 +175,15 @@ public class IssueApplicationServiceImpl extends BaseServiceImpl notIssueToTopicIds(List topicIdList) { + List idList = baseDao.selectTopicIdList(topicIdList); + return idList; + } + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java new file mode 100644 index 0000000000..c86e5d926d --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueCategoryServiceImpl.java @@ -0,0 +1,227 @@ +/** + * 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.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.IssueCategoryDao; +import com.epmet.dao.IssueTagsDao; +import com.epmet.dto.IssueCategoryDTO; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.IssueCategoryTagListResultDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.dto.result.ProjectCategoryTagResultDTO; +import com.epmet.entity.IssueCategoryEntity; +import com.epmet.entity.IssueEntity; +import com.epmet.redis.IssueCategoryRedis; +import com.epmet.service.IssueCategoryService; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.service.IssueService; +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.util.stream.Collectors; + +/** + * 议题所属分类表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class IssueCategoryServiceImpl extends BaseServiceImpl implements IssueCategoryService { + + @Autowired + private IssueCategoryRedis issueCategoryRedis; + @Autowired + private IssueTagsDao issueTagsDao; + @Autowired + private IssueService issueService; + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueCategoryDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueCategoryDTO.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 IssueCategoryDTO get(String id) { + IssueCategoryEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueCategoryDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueCategoryDTO dto) { + IssueCategoryEntity entity = ConvertUtils.sourceToTarget(dto, IssueCategoryEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueCategoryDTO dto) { + IssueCategoryEntity entity = ConvertUtils.sourceToTarget(dto, IssueCategoryEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param formDTO + * @return + * @Description 获取议题的分类、标签列表 + * @Author sun + **/ + @Override + public IssueCategoryTagListResultDTO categoryTagList(IssueCategoryTagListFormDTO formDTO) { + IssueCategoryTagListResultDTO resultDTO = new IssueCategoryTagListResultDTO(); + //1.查询议题绑定的分类名称,按排序升序 + List categoryList = baseDao.selectIssueCategoryList(formDTO.getIssueId()); + if (categoryList.size() > NumConstant.ZERO) { + resultDTO.setCategoryList(categoryList); + } + //2.查询议题绑定的标签,按绑定时间升序 + List tagList = issueTagsDao.selectIssueTagList(formDTO.getIssueId()); + if (tagList.size() > NumConstant.ZERO) { + resultDTO.setTagList(tagList); + } + return resultDTO; + } + + /** + * @param formDTO + * @return + * @Description 查询分类Id集合对应的分类名称,按分类升序排列 + * @Author sun + **/ + @Override + public List projectCategoryList(ProjectCategoryTagListFormDTO formDTO) { + return baseDao.selectProjectCategoryList(formDTO); + } + + /** + * 获取议题分类 + * + * @param issueId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/12/9 10:48 + */ + @Override + public List getCategoryByIssue(String issueId) { + return baseDao.selectCategoryByIssue(issueId); + } + + /** + * @param formDTO + * @return + * @Description 议题:保存/修改分类 + * @Author sun + **/ + @Override + public void saveCategory(IssueSaveCategoryFormDTO formDTO) { + + //0.如果传入的分类集合为空不管是否存在过历史分类数据,只执行一次删除操作 + if(formDTO.getCategoryList().size()< NumConstant.ONE){ + baseDao.delByIssueId(formDTO.getIssueId()); + return; + } + + //1.查询议题所属客户和所属网格信息 + IssueEntity issue = issueService.selectById(formDTO.getIssueId()); + if (null == issue) { + throw new RenException(String.format("根据议题Id获取议题信息失败,issueId->%s", formDTO.getIssueId())); + } + + //2.批量查询分类信息 + List categoryIdList = formDTO.getCategoryList().stream().map(SaveIssueCategoryFormDTO::getId).collect(Collectors.toList()); + IssueProjectCategoryDictListFormDTO dictDto = new IssueProjectCategoryDictListFormDTO(); + dictDto.setCustomerId(formDTO.getCustomerId()); + dictDto.setCstegoryIdList(categoryIdList); + List categoryList = issueProjectCategoryDictService.getCategoryList(dictDto); + if (null == categoryList) { + throw new RenException(String.format("议题分类信息保存,根据分类Id获取分类信息失败")); + } + + //3.汇总批量新增数据 + List entityList = new ArrayList<>(); + formDTO.getCategoryList().forEach(ca -> { + IssueCategoryEntity entity = new IssueCategoryEntity(); + entity.setCustomerId(issue.getCustomerId()); + entity.setGridId(issue.getGridId()); + entity.setIssueId(formDTO.getIssueId()); + entity.setCategoryId(ca.getId()); + categoryList.forEach(cl -> { + if (ca.getId().equals(cl.getId())) { + entity.setCategoryPids(cl.getPids()); + entity.setCategoryCode(cl.getCategoryCode()); + } + }); + entityList.add(entity); + }); + + //4.根据议题Id删除可能存在的分类信息 + baseDao.delByIssueId(formDTO.getIssueId()); + + //5.批量保存议题分类信息 + if (!insertBatch(entityList)) { + throw new RenException(String.format("议题分类信息保存失败")); + } + + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java new file mode 100644 index 0000000000..62d39412c3 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectCategoryDictServiceImpl.java @@ -0,0 +1,453 @@ +/** + * 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.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +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.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.IssueCategoryDao; +import com.epmet.dao.IssueProjectCategoryDictDao; +import com.epmet.dao.IssueProjectRelationDao; +import com.epmet.dao.IssueProjectTagDictDao; +import com.epmet.dto.IssueCategoryDTO; +import com.epmet.dto.IssueDTO; +import com.epmet.dto.IssueProjectCategoryDictDTO; +import com.epmet.dto.ProjectCategoryDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; +import com.epmet.entity.IssueProjectCategoryDictEntity; +import com.epmet.entity.IssueProjectTagDictEntity; +import com.epmet.feign.GovProjectOpenFeignClient; +import com.epmet.feign.OperCrmOpenFeignClient; +import com.epmet.project.dto.result.ProjectCategoryDictResultDTO; +import com.epmet.redis.IssueProjectCategoryDictRedis; +import com.epmet.redis.IssueProjectTagDictRedis; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.service.IssueProjectTagDictService; +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.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 议题项目分类字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class IssueProjectCategoryDictServiceImpl extends BaseServiceImpl implements IssueProjectCategoryDictService { + + private static Logger logger = LoggerFactory.getLogger(IssueProjectCategoryDictServiceImpl.class); + @Autowired + private IssueProjectCategoryDictRedis issueProjectCategoryDictRedis; + @Autowired + private IssueProjectRelationDao issueProjectRelationDao; + @Autowired + private IssueProjectTagDictService issueProjectTagDictService; + @Autowired + private IssueCategoryDao issueCategoryDao; + @Autowired + private GovProjectOpenFeignClient govProjectOpenFeignClient; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + @Autowired + private IssueProjectTagDictDao issueProjectTagDictDao; + @Autowired + private IssueProjectTagDictRedis dictRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueProjectCategoryDictDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueProjectCategoryDictDTO.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 IssueProjectCategoryDictDTO get(String id) { + IssueProjectCategoryDictEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueProjectCategoryDictDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueProjectCategoryDictDTO dto) { + IssueProjectCategoryDictEntity entity = ConvertUtils.sourceToTarget(dto, IssueProjectCategoryDictEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueProjectCategoryDictDTO dto) { + IssueProjectCategoryDictEntity entity = ConvertUtils.sourceToTarget(dto, IssueProjectCategoryDictEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param customerId + * @return + * @Description 客户分类列表查询,按分类升序排列,查询未被禁用的 + * @Author sun + **/ + @Override + public List categoryList(String customerId) { + List resultList = baseDao.selectCustomerCategoryList(customerId); + return resultList; + } + + /** + * @param formDTO + * @return + * @Description 批量查询分类信息 + * @Author sun + **/ + @Override + public List getCategoryList(IssueProjectCategoryDictListFormDTO formDTO) { + return baseDao.selectCategoryList(formDTO); + } + + /** + * @param formDTO + * @return + * @Description 查询项目所属客户和所属网格信息以及分类对应的分类信息 + * @Author sun + **/ + @Override + public ProjectIssueCategoryResultDTO getProjectAndCategoryInfo(ProjectSaveCategoryFormDTO formDTO) { + ProjectIssueCategoryResultDTO resultDTO = new ProjectIssueCategoryResultDTO(); + //1.根据项目id查询对应的议题基本信息 + IssueDTO dto = issueProjectRelationDao.selectProjectToIssue(formDTO.getProjectId()); + if (null == dto) { + throw new RenException(String.format("保存项目分类信息,获取项目对应的议题基本信息失败,projectId->%s", formDTO.getProjectId())); + } + ProjectIssueDTOResultDTO issueDTO = ConvertUtils.sourceToTarget(dto,ProjectIssueDTOResultDTO.class); + resultDTO.setIssueDTO(issueDTO); + //2.批量查询分类信息 + List categoryIdList = formDTO.getCategoryList().stream().map(SaveIssueCategoryFormDTO::getId).collect(Collectors.toList()); + IssueProjectCategoryDictListFormDTO dictDto = new IssueProjectCategoryDictListFormDTO(); + dictDto.setCustomerId(formDTO.getCustomerId()); + dictDto.setCstegoryIdList(categoryIdList); + List categoryList = getCategoryList(dictDto); + if (null == categoryList) { + throw new RenException(String.format("保存项目分类信息,根据分类Id获取分类信息失败")); + } + List list = ConvertUtils.sourceToTarget(categoryList,ProjectCategoryDTOResultDTO.class); + resultDTO.setCategoryList(list); + + return resultDTO; + } + + /** + * 客户分类标签数据初始化 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/12/10 10:02 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void init(CategoryTagInitFormDTO formDTO) { + List list = baseDao.selectCategoryListByCustomer(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(list)) { + //分类初始化 + List categoryList = baseDao.selectCategoryListByCustomer("default"); + categoryList.forEach(item -> { + item.setCustomerId(formDTO.getCustomerId()); + }); + this.insertBatch(categoryList); + //标签初始化 + List tagList = issueProjectTagDictService.getTagListByCustomer("default"); + tagList.forEach(item -> { + item.setCustomerId(formDTO.getCustomerId()); + }); + issueProjectTagDictService.insertBatch(tagList); + } + } + + /** + * @Description 分类启用与禁用 + * @Author sun + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void isDisableCategory(IsDisableCategoryFormDTO formDTO) { + //1.查询客户分类信息 + IssueProjectCategoryDictDTO dto = baseDao.selectByCustomerId(formDTO.getCustomerId(), formDTO.getCategoryId()); + if (null == dto) { + throw new RuntimeException("未查询到客户分类信息!"); + } + //2.汇总二级分类Id集合 + //待修改的分类Id汇总 + List categoryList = new ArrayList<>(); + //待修改的二级分类Id汇总 + List secondList = new ArrayList<>(); + if ("1".equals(dto.getCategoryType())) { + //2-1.查询子类信息 + List subList = baseDao.selectSubCustomerCategoryDict(formDTO.getCustomerId(), formDTO.getCategoryId()); + secondList = subList.stream().map(sub -> sub.getId()).collect(Collectors.toList()); + categoryList.add(formDTO.getCategoryId()); + } else { + secondList.add(formDTO.getCategoryId()); + } + categoryList.addAll(secondList); + formDTO.setCategoryList(categoryList); + formDTO.setSecondCategorylist(secondList); + + //3.修改标签、分类表数据状态 + //修改分类数据 + if (baseDao.updateCustomerCategory(formDTO) < NumConstant.ONE) { + logger.error(String.format("修改分类信息状态失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId())); + throw new RuntimeException("分类信息修改失败!"); + } + //修改把二级分类下默认的标签数据 + issueProjectTagDictDao.updateCustomerTag(formDTO); + //4.修改缓存中标签状态 + dictRedis.updateTagAvailabilityBySecondCategoryIds(formDTO.getCustomerId(),formDTO.getSecondCategorylist(),formDTO.getType()); + } + + /** + * @Description 分类删除 + * 分类客户没有使用过的可以直接删除 包括子类删除,只要客户用过 不管什么状态都不能再删除,允许删除的也跟标签没关系,不删标签 + * @Author sun + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void delCategory(DelCategoryFormDTO formDTO) { + //1.查询分类信息 + IssueProjectCategoryDictDTO dto = baseDao.selectByCustomerId(formDTO.getCustomerId(), formDTO.getCategoryId()); + if (null == dto) { + throw new RuntimeException("未查询到客户分类信息!"); + } + //2.判断分类有没有被客户的议题、项目使用过 + formDTO.setLevel(dto.getCategoryType()); + //2-1.判断议题有无使用 + List issueList = issueCategoryDao.selectIssueList(formDTO); + //已使用,不允许删除 + if (null != issueList && issueList.size() > NumConstant.ZERO) { + throw new RenException(EpmetErrorCode.CUSTOMER_CATEGORY.getCode(), EpmetErrorCode.CUSTOMER_CATEGORY.getMsg()); + } + //2-2.判断项目有无使用 + Result> resultList = govProjectOpenFeignClient.getProjectCategoryList(formDTO); + if (!resultList.success()) { + throw new RenException(resultList.getCode(), resultList.getMsg()); + } + if (null != resultList.getData() && resultList.getData().size() > NumConstant.ZERO) { + throw new RenException(EpmetErrorCode.CUSTOMER_CATEGORY.getCode(), EpmetErrorCode.CUSTOMER_CATEGORY.getMsg()); + } + + //3.分类未被使用,则删除一级、二级分类,二级分类下默认有的标签不作处理 + if (baseDao.delCategory(formDTO) < NumConstant.ONE) { + logger.error(String.format("分类删除失败,客户Id->%s,分类Id->%s", formDTO.getCustomerId(), formDTO.getCategoryId())); + throw new RuntimeException("分类删除失败!"); + } + + } + + @Override + public List listCategoryDict(String customerId, String pid) { + return baseDao.selectListCategoryDict(customerId, pid); + } + + @Override + public Result saveFirstCategory(SecondCategoryFormDTO formDTO) { + // 分类名称在同一个客户下有效数据中不允许重复 + Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), null,null); + if (NumConstant.ZERO < numCategoryName) { + throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); + } + IssueProjectCategoryDictEntity entity = this.packageFirstCategoryDictEntity(formDTO); + baseDao.insert(entity); + return new Result().ok(entity.getId()); + } + + /** + * 一级分类 组装字段 + * + * @param formDTO + * @return com.epmet.entity.IssueProjectCategoryDictEntity + * @Author zhangyong + * @Date 10:46 2021-03-23 + **/ + private IssueProjectCategoryDictEntity packageFirstCategoryDictEntity(SecondCategoryFormDTO formDTO) { + IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setPid(NumConstant.ZERO_STR ); + entity.setPids(NumConstant.ZERO_STR ); + entity.setParentCategoryCode(NumConstant.ZERO_STR); + // 查询 当前客户下最大的一级分类数。 + Integer maxCategoryCode = baseDao.getMaxCategoryCode(formDTO.getCustomerId(), NumConstant.ZERO_STR); + if (NumConstant.ZERO == maxCategoryCode) { + maxCategoryCode = 1001; + } else { + maxCategoryCode++; + } + entity.setCategoryCode(String.valueOf(maxCategoryCode)); + + entity.setCategoryName(formDTO.getCategoryName()); + entity.setCategoryType(NumConstant.ONE_STR); + entity.setSort(formDTO.getSort()); + entity.setIsDisable("enable"); + return entity; + } + + @Override + public Result editFirstCategory(SecondCategoryFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCategoryId())) { + throw new RenException("分类Id 不能为空"); + } + // 分类名称在同一个客户下有效数据中不允许重复 + Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), null, formDTO.getCategoryId()); + if (NumConstant.ZERO < numCategoryName) { + throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); + } + IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setCategoryName(formDTO.getCategoryName()); + entity.setSort(formDTO.getSort()); + entity.setId(formDTO.getCategoryId()); + baseDao.updateIssueProjectCategoryDict(entity); + return new Result<>(); + } + + @Override + public Result saveSecondCategory(SecondCategoryFormDTO formDTO) { + // 分类名称在同一个客户下同一 一级分类下有效数据中不允许重复 + Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), formDTO.getParentCategoryId(), null); + if (NumConstant.ZERO < numCategoryName) { + throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); + } + IssueProjectCategoryDictEntity entity = this.packageSecondCategoryDictEntity(formDTO); + baseDao.insert(entity); + return new Result().ok(entity.getId()); + } + + /** + * 二级分类 组装字段 + * + * @param formDTO + * @return com.epmet.entity.IssueProjectCategoryDictEntity + * @Author zhangyong + * @Date 10:46 2021-03-23 + **/ + private IssueProjectCategoryDictEntity packageSecondCategoryDictEntity(SecondCategoryFormDTO formDTO) { + IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setPid(formDTO.getParentCategoryId()); + entity.setPids(formDTO.getParentCategoryId()); + IssueProjectCategoryDictDTO parentCategoryCode = baseDao.selectByCustomerId(formDTO.getCustomerId(),formDTO.getParentCategoryId()); + if (null == parentCategoryCode) { + throw new RenException(String.format("获取一级分类信息失败,入参[客户id: %s, 一级分类Id: %s]",formDTO.getCustomerId(),formDTO.getParentCategoryId())); + } + entity.setParentCategoryCode(parentCategoryCode.getCategoryCode()); + // 查询 当前客户下最大的一级分类数。 + Integer maxCategoryCode = baseDao.getMaxCategoryCode(formDTO.getCustomerId(), parentCategoryCode.getCategoryCode()); + if (NumConstant.ZERO == maxCategoryCode) { + maxCategoryCode = Integer.valueOf(parentCategoryCode.getCategoryCode() + "1001"); + } else { + maxCategoryCode++; + } + entity.setCategoryCode(String.valueOf(maxCategoryCode)); + + entity.setCategoryName(formDTO.getCategoryName()); + entity.setCategoryType(NumConstant.TWO_STR); + entity.setSort(formDTO.getSort()); + entity.setIsDisable("enable"); + return entity; + } + + @Override + public Result editSecondCategory(SecondCategoryFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCategoryId())) { + throw new RenException("分类Id 不能为空"); + } + // 分类名称在同一个客户下同一 一级分类下有效数据中不允许重复 + Integer numCategoryName = baseDao.isCategoryName(formDTO.getCustomerId(), formDTO.getCategoryName(), formDTO.getParentCategoryId(), formDTO.getCategoryId()); + if (NumConstant.ZERO < numCategoryName) { + throw new RenException(EpmetErrorCode.CATEGORY_NAME.getCode(), EpmetErrorCode.CATEGORY_NAME.getMsg()); + } + IssueProjectCategoryDictEntity entity = new IssueProjectCategoryDictEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setCategoryName(formDTO.getCategoryName()); + entity.setSort(formDTO.getSort()); + entity.setId(formDTO.getCategoryId()); + baseDao.updateIssueProjectCategoryDict(entity); + return new Result<>(); + } + + @Override + public List customerCategoryList(String customerId) { + LinkedList parentCategoryDict = baseDao.selectListAllCategoryDict(customerId, NumConstant.ZERO_STR); + LinkedList childrenCategoryDict = baseDao.selectListAllCategoryDict(customerId, NumConstant.ONE_STR); + + for (CustomerCategoryResultDTO p : parentCategoryDict) { + List children = new ArrayList<>(); + for (CustomerCategoryResultDTO c : childrenCategoryDict) { + if (p.getCategoryId().equals(c.getPid())) { + CustomerCategoryResultDTO dto = new CustomerCategoryResultDTO(); + dto.setCategoryId(c.getCategoryId()); + dto.setCategoryName(c.getCategoryName()); + dto.setSort(c.getSort()); + dto.setIsDisable(c.getIsDisable()); + dto.setPid(c.getPid()); + children.add(dto); + } + } + p.setChildren(children); + } + return parentCategoryDict; + } +} diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java new file mode 100644 index 0000000000..cf5af822da --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueProjectTagDictServiceImpl.java @@ -0,0 +1,217 @@ +/** + * 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.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.GovIssueRedisKeys; +import com.epmet.dao.IssueProjectTagDictDao; +import com.epmet.dto.IssueProjectTagDictDTO; +import com.epmet.dto.form.CategoryTagInitFormDTO; +import com.epmet.dto.form.TagDifferentSetFormDTO; +import com.epmet.dto.form.TagListFormDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.dto.result.TagListResultDTO; +import com.epmet.entity.IssueProjectTagDictEntity; +import com.epmet.redis.IssueProjectTagDictRedis; +import com.epmet.service.IssueProjectCategoryDictService; +import com.epmet.service.IssueProjectTagDictService; +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.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 议题、项目标签字典表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class IssueProjectTagDictServiceImpl extends BaseServiceImpl implements IssueProjectTagDictService { + + private static Logger logger = LoggerFactory.getLogger(IssueProjectTagDictServiceImpl.class); + @Autowired + private IssueProjectTagDictRedis issueProjectTagDictRedis; + @Autowired + private IssueProjectCategoryDictService issueProjectCategoryDictService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueProjectTagDictDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueProjectTagDictDTO.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 IssueProjectTagDictDTO get(String id) { + IssueProjectTagDictEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueProjectTagDictDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueProjectTagDictDTO dto) { + IssueProjectTagDictEntity entity = ConvertUtils.sourceToTarget(dto, IssueProjectTagDictEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueProjectTagDictDTO dto) { + IssueProjectTagDictEntity entity = ConvertUtils.sourceToTarget(dto, IssueProjectTagDictEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 标签列表 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.dto.result.TagListResultDTO + * @author zhaoqifeng + * @date 2020/12/9 15:41 + */ + @Override + public TagListResultDTO getTagList(TokenDto tokenDto, TagListFormDTO formDTO) { + TagListResultDTO result = new TagListResultDTO(); + Map> map = issueProjectTagDictRedis.getDefaultTagsSortedByCategoryAndCustomizedTagsOrderByRank(tokenDto.getCustomerId(), + formDTO.getCategoryIdList()); + result.setDefaulted(map.get(ModuleConstants.DEFAULT_TAG_CATEGORY_NAME)); + List list = map.get(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME); + if (CollectionUtils.isNotEmpty(list)) { + result.setCustomized(list.stream().limit(NumConstant.ONE_THOUSAND).collect(Collectors.toList())); + } else { + result.setCustomized(Collections.emptyList()); + } + return result; + } + + /** + * 获取默认标签配置 + * + * @return java.util.List + * @author zhaoqifeng + * @date 2020/12/10 10:12 + */ + @Override + public List getTagListByCustomer(String customerId) { + return baseDao.selectTagListByCustomer(customerId); + } + + /** + * @Description 更新标签热度 数据库/缓存 + * @param param + * @return void + * @author wangc + * @date 2020.12.11 14:00 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void updateTagHeat(TagDifferentSetFormDTO param) { + //key : 1(plus) 0(minus) + //value : { + // key : redisKey + // value : List + // } + Map>> redisParam = new HashMap<>(); + + if(CollectionUtils.isNotEmpty(param.getMinus())){ + List tags = baseDao.selectTagsByCustomerIdAndTagIds(param.getCustomerId(),param.getMinus()); + if(CollectionUtils.isNotEmpty(tags)){ + Map> value = new HashMap<>(); + tags.forEach(tag -> { + String redisKey = GovIssueRedisKeys.getGovernmentTagKey(param.getCustomerId(),tag.getCategoryId()); + IssueCategoryTagResultDTO cache = new IssueCategoryTagResultDTO(); + cache.setId(tag.getId());cache.setName(tag.getTagName());cache.setIsDisable(tag.getIsDisable()); + if(CollectionUtils.isNotEmpty(value.get(redisKey))){ + value.get(redisKey).add(cache); + }else{ + List list = new LinkedList<>(); + list.add(cache); + value.put(redisKey,list); + } + }); + if(!value.isEmpty()) redisParam.put(NumConstant.ZERO_STR,value); + baseDao.updateTagUsage(param.getMinus(),param.getCustomerId(),NumConstant.ONE_NEG); + } + } + + if(CollectionUtils.isNotEmpty(param.getPlus())){ + List tags = baseDao.selectTagsByCustomerIdAndTagIds(param.getCustomerId(),param.getPlus()); + if(CollectionUtils.isNotEmpty(tags)){ + Map> value = new HashMap<>(); + tags.forEach(tag -> { + String redisKey = GovIssueRedisKeys.getGovernmentTagKey(param.getCustomerId(),tag.getCategoryId()); + IssueCategoryTagResultDTO cache = new IssueCategoryTagResultDTO(); + cache.setId(tag.getId());cache.setName(tag.getTagName());cache.setIsDisable(tag.getIsDisable()); + if(CollectionUtils.isNotEmpty(value.get(redisKey))){ + value.get(redisKey).add(cache); + }else{ + List list = new LinkedList<>(); + list.add(cache); + value.put(redisKey,list); + } + }); + if(!value.isEmpty()) redisParam.put(NumConstant.ONE_STR,value); + baseDao.updateTagUsage(param.getPlus(),param.getCustomerId(),NumConstant.ONE); + } + } + + issueProjectTagDictRedis.batchIncrScore(redisParam); + } + +} \ No newline at end of file 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 dccdc4026a..9b6bdb6688 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 @@ -112,6 +112,12 @@ public class IssueServiceImpl extends BaseServiceImpl imp private EpmetUserOpenFeignClient userOpenFeignClient; @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private IssueCategoryService issueCategoryService; + @Autowired + private IssueTagsService issueTagsService; + @Autowired + private IssueProjectTagDictService issueProjectTagDictService; @@ -444,6 +450,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){ @@ -894,6 +908,129 @@ public class IssueServiceImpl extends BaseServiceImpl imp } } + /** + * 议题管理-议题转项目-增加分类标签功能 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2020/12/9 10:01 + */ + @Override + public void shiftProjectV2(ShiftProjectFormDTO formDTO) { + + //获取议题分类 + List categoryList = issueCategoryService.getCategoryByIssue(formDTO.getIssueId()); + if (CollectionUtils.isEmpty(categoryList)) { + throw new RenException(EpmetErrorCode.CATEGORY_IS_NULL.getCode()); + } + + //公开回复内容审核 + if (StringUtils.isNotBlank(formDTO.getPublicReply())) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + taskDTO.setContent(formDTO.getPublicReply()); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + } + + //因需要保证议题表中的转项目时间与创建项目时间一致 因此先新增项目数据再更新议题数据 + //1:查询议题数据 + IssueEntity entity = baseDao.selectById(formDTO.getIssueId()); + if (null == entity) { + throw new RenException(IssueConstant.SELECT_EXCEPTION); + } + if (IssueConstant.ISSUE_SHIFT_PROJECT.equals(entity.getIssueStatus())) { + throw new RenException(IssueConstant.ISSUE_SHIFT_PROJECT_EXCEPTION); + } + if (!IssueConstant.ISSUE_VOTING.equals(entity.getIssueStatus())) { + throw new RenException(IssueConstant.ISSUE_VOTING_EXCEPTION); + } + formDTO.setIssueDTO(ConvertUtils.sourceToTarget(entity, IssueDTO.class)); + + //2:调用resi-group查询话题创建人数据(目前议题来源只有来自话题),为了到项目服务初始数据以及发送消息使用 + Result resultTopicDTO = resiGroupFeignClient.getTopicById(entity.getSourceId()); + if (!resultTopicDTO.success() || null == resultTopicDTO.getData()) { + throw new RenException(IssueConstant.SELECT_TOPIC_EXCEPTION); + } + ResiTopicDTO topicDTO = resultTopicDTO.getData(); + formDTO.setTopicDTO(topicDTO); + + //3:调用gov-project服务,新增项目各业务表初始数据 + formDTO.setCategoryList(categoryList); + List tagList = issueTagsService.getTagsByIssue(formDTO.getIssueId()); + formDTO.setTagList(tagList); + Result resultDTO = govProjectFeignClient.issueShiftProject(formDTO); + if (!resultDTO.success() || null == resultDTO.getData()) { + logger.error(resultDTO.getInternalMsg()); + throw new RenException(IssueConstant.GOV_PRJECT_EXCEPTION); + } + IssueProjectResultDTO issueProjectResultDTO = resultDTO.getData(); + //更新项目对标签的引用次数 + if (CollectionUtils.isNotEmpty(tagList)) { + tagList.forEach(item -> { + IssueProjectTagDictDTO tag = issueProjectTagDictService.get(item.getTagId()); + tag.setProjectUseCount(tag.getProjectUseCount() + NumConstant.ONE); + issueProjectTagDictService.update(tag); + }); + } + + //4:更新议题相关业务表数据 + //4.1:更新议题表数据 + entity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); + entity.setShiftedTime(issueProjectResultDTO.getShiftedTime()); + baseDao.updateById(entity); + + //4.2:议题处理进展表新增数据 + IssueProcessEntity processEntity = new IssueProcessEntity(); + processEntity.setIssueId(entity.getId()); + processEntity.setIssueStatus(IssueConstant.ISSUE_SHIFT_PROJECT); + processEntity.setOrgType(IssueConstant.ISSUE_GRID); + processEntity.setOrgId(entity.getGridId()); + processEntity.setOrgName(issueProjectResultDTO.getOrgName()); + issueProcessDao.insert(processEntity); + + //4.3:议题项目关系表新增数据 + IssueProjectRelationEntity relationEntity = new IssueProjectRelationEntity(); + relationEntity.setIssueId(entity.getId()); + relationEntity.setProjectId(issueProjectResultDTO.getProjectId()); + issueProjectRelationDao.insert(relationEntity); + + //5:调用epmet-message服务,给居民端话题创建人、议题发起人以及政府端工作人员发送消息 + if (!shiftProjectMessage(issueProjectResultDTO, formDTO, entity).success()) { + throw new RenException(IssueConstant.SAVE_MSG_EXCEPTION); + } + //5-1:2020.10.26 添加给居民端话题创建人、议题发起人以及政府端工作人员推送微信订阅消息功能 sun + if (!wxmpShiftProjectMessage(issueProjectResultDTO, formDTO, entity).success()) { + logger.error("议题转项目,推送微信订阅消息失败!"); + } + + //6:缓存中网格下表决中的议题总数减1 + govIssueRedis.subtractWorkGrassrootsIssueRedDotValue(entity.getGridId()); + try{ + issueVoteStatisticalService.syncVotingCacheToDbByParams(formDTO.getIssueId(),entity.getGridId(),null); + }catch(RenException e){ + logger.error(e.getInternalMsg()); + } + + + //7:发送话题转议题积分事件 + TopicEventFormDTO eventParam = new TopicEventFormDTO(); + eventParam.setTopicId(entity.getSourceId()); + eventParam.setEvent(EventEnum.TOPIC_SHIFTED_TO_PROJECT); + if(!resiGroupOpenFeignClient.sendEvent(eventParam).success()){ + logger.warn("com.epmet.service.impl.IssueServiceImpl.shiftProjectV2,话题被转为项目积分事件发送失败,参数:{}", JSON.toJSONString(formDTO)); + } + } + /** * @Description 议题转项目时给话题创建人、议题发起人、勾选的工作人员分别推送消息 * @author sun diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java new file mode 100644 index 0000000000..1d24217321 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueTagsServiceImpl.java @@ -0,0 +1,247 @@ +/** + * 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.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.IssueDao; +import com.epmet.dao.IssueProjectTagDictDao; +import com.epmet.dao.IssueTagsDao; +import com.epmet.dto.IssueTagsDTO; +import com.epmet.dto.form.AddTagFormDTO; +import com.epmet.dto.form.IssueTagFormDTO; +import com.epmet.dto.form.IssueTagsFormDTO; +import com.epmet.dto.form.IssueTagsSaveFormDTO; +import com.epmet.dto.result.AddTagResultDTO; +import com.epmet.dto.result.IssueCategoryTagResultDTO; +import com.epmet.entity.IssueEntity; +import com.epmet.entity.IssueProjectTagDictEntity; +import com.epmet.entity.IssueTagsEntity; +import com.epmet.redis.IssueProjectTagDictRedis; +import com.epmet.redis.IssueTagsRedis; +import com.epmet.service.IssueTagsService; +import com.epmet.utils.ModuleConstants; +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 org.springframework.util.CollectionUtils; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import static java.util.stream.Collectors.toList; + +/** + * 议题关联标签表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-12-08 + */ +@Service +public class IssueTagsServiceImpl extends BaseServiceImpl implements IssueTagsService { + + @Autowired + private IssueTagsRedis issueTagsRedis; + @Autowired + private IssueProjectTagDictDao issueProjectTagDictDao; + @Autowired + private IssueProjectTagDictRedis dictRedis; + @Autowired + private IssueDao issueDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IssueTagsDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IssueTagsDTO.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 IssueTagsDTO get(String id) { + IssueTagsEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IssueTagsDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(IssueTagsDTO dto) { + IssueTagsEntity entity = ConvertUtils.sourceToTarget(dto, IssueTagsEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(IssueTagsDTO dto) { + IssueTagsEntity entity = ConvertUtils.sourceToTarget(dto, IssueTagsEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * 获取议题标签 + * + * @param issueId + * @return java.util.List + * @author zhaoqifeng + * @date 2020/12/9 14:07 + */ + @Override + public List getTagsByIssue(String issueId) { + return baseDao.selectTagsByIssue(issueId); + } + + /** + * @Description 标签添加 + * @Param form + * @author zxc + * @date 2020/12/9 下午3:29 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public AddTagResultDTO addTag(AddTagFormDTO form, TokenDto tokenDto) { + form.setCustomerId(tokenDto.getCustomerId()); + String tagId = baseDao.selectTagNameCount(form); + if (StringUtils.isNotBlank(tagId)){ + return new AddTagResultDTO(tagId); + } + IssueProjectTagDictEntity entity = new IssueProjectTagDictEntity(); + entity.setCustomerId(form.getCustomerId()); + entity.setCategoryId(ModuleConstants.CUSTOMIZED_TAG_CATEGORY_NAME); + entity.setTagName(form.getTagName()); + entity.setIsDefault(NumConstant.ONE_STR); + entity.setIssueUseCount(NumConstant.ZERO); + entity.setProjectUseCount(NumConstant.ZERO); + entity.setIsDisable(ModuleConstants.ID_ENABLE); + issueProjectTagDictDao.insert(entity); + IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO(); + issueCategoryTagResultDTO.setId(entity.getId()); + issueCategoryTagResultDTO.setName(entity.getTagName()); + issueCategoryTagResultDTO.setIsDisable(entity.getIsDisable()); + dictRedis.addIssueProjectTag(entity.getCustomerId(),entity.getCategoryId(),issueCategoryTagResultDTO); + return new AddTagResultDTO(entity.getId()); + } + + /** + * @Description 议题标签保存/修改 + * @Param form + * @Param tokenDto + * @author zxc + * @date 2020/12/10 上午9:37 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void issueTagSave(IssueTagsSaveFormDTO form, TokenDto tokenDto) { + String customerId = tokenDto.getCustomerId(); + // 根据议题ID查询此议题原来有哪些标签 + List tags = baseDao.selectTagsByIssueId(form.getIssueId()); + if (CollectionUtils.isEmpty(form.getTagList())){ + // 清空此议题的标签 + if (!CollectionUtils.isEmpty(tags)){ + tags.forEach(t -> { + // 缓存标签 -1 + IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO(); + issueCategoryTagResultDTO.setName(t.getName()); + issueCategoryTagResultDTO.setId(t.getId()); + issueCategoryTagResultDTO.setIsDisable(t.getIsDisable()); + dictRedis.editTagUseCount(customerId,t.getCategoryId(),issueCategoryTagResultDTO,NumConstant.ONE_STR); + }); + // 数据库有关标签使用次数 -1 0:+1 ; 1:-1; + issueProjectTagDictDao.updateTagsUseCount(tags,customerId,NumConstant.ONE_STR); + } + // 删除数据库有关此议题标签 + baseDao.deleteTagsByIssueId(form.getIssueId()); + return; + } + // 不为空时走这 + List selectTags = form.getTagList(); + List newTags = issueProjectTagDictDao.selectTagId(selectTags); + IssueEntity issueEntity = issueDao.selectById(form.getIssueId()); + if (!CollectionUtils.isEmpty(newTags)){ + // 需要删除的标签 + List delList = tags.stream().filter(tag -> !newTags.contains(tag)).collect(toList()); + if (!CollectionUtils.isEmpty(delList)){ + delList.forEach(d -> { + IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO(); + issueCategoryTagResultDTO.setName(d.getName()); + issueCategoryTagResultDTO.setId(d.getId()); + issueCategoryTagResultDTO.setIsDisable(d.getIsDisable()); + dictRedis.editTagUseCount(customerId,d.getCategoryId(),issueCategoryTagResultDTO,NumConstant.ONE_STR); + }); + // 数据库有关标签使用次数 -1 0:+1 ; 1:-1; + issueProjectTagDictDao.updateTagsUseCount(delList,customerId,NumConstant.ONE_STR); + } + // 需要新增的标签 + List addList = newTags.stream().filter(tag -> !tags.contains(tag)).collect(toList()); + if (!CollectionUtils.isEmpty(addList)){ + addList.forEach(a -> { + // 缓存标签+1 + IssueCategoryTagResultDTO issueCategoryTagResultDTO = new IssueCategoryTagResultDTO(); + issueCategoryTagResultDTO.setName(a.getName()); + issueCategoryTagResultDTO.setId(a.getId()); + issueCategoryTagResultDTO.setIsDisable(a.getIsDisable()); + dictRedis.editTagUseCount(customerId,a.getCategoryId(),issueCategoryTagResultDTO,NumConstant.ZERO_STR); + }); + // 数据库对应标签 议题使用次数 +1 + issueProjectTagDictDao.updateTagsUseCount(addList,customerId,NumConstant.ZERO_STR); + } + // 删除数据库有关此议题标签 + baseDao.deleteTagsByIssueId(form.getIssueId()); + // 新增最新议题标签 + List needInsert = ConvertUtils.sourceToTarget(newTags, IssueTagsFormDTO.class); + needInsert.forEach(n -> { + n.setCustomerId(customerId); + n.setGridId(issueEntity.getGridId()); + n.setIssueId(form.getIssueId()); + }); + baseDao.insertNewTags(needInsert); + } + } + +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index 2eb7a22ad7..ff37731933 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -63,7 +63,6 @@ import java.time.LocalDateTime; import java.time.ZoneOffset; import java.util.*; import java.util.stream.Collectors; -import java.util.stream.Stream; /** * 议题表决统计表 @@ -256,8 +255,10 @@ public class IssueVoteStatisticalServiceImpl 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,34 +401,31 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl issueVoteStatisticalEntityList = ConvertUtils.sourceToTarget(summary, + if(CollectionUtils.isNotEmpty(toInsert)) { + List issueVoteStatisticalEntityList = ConvertUtils.sourceToTarget(toInsert, IssueVoteStatisticalEntity.class); insertBatch(issueVoteStatisticalEntityList); } + baseDao.insertBatch(toInsert); } - } - else if (ids.size() < statisiticalIds.size()) { + //} + //else if (ids.size() < statisiticalIds.size()) { //统计数大于议题数,数据出错 //找出多余数据,删除 //差集 - Set 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批量更新 @@ -498,6 +524,8 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml new file mode 100644 index 0000000000..f1027a6759 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueCategoryDao.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + DELETE + FROM + issue_category + WHERE + issue_id = #{issueId} + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml new file mode 100644 index 0000000000..3a29df5f14 --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectCategoryDictDao.xml @@ -0,0 +1,248 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE issue_project_category_dict + SET del_flag = '1', + updated_by = #{userId}, + updated_time = NOW() + WHERE + customer_id = #{customerId} + + AND id = #{categoryId} OR pid = #{categoryId} + + + AND id = #{categoryId} + + + + + UPDATE issue_project_category_dict + SET is_disable = #{type}, + updated_by = #{userId}, + updated_time = NOW() + WHERE + customer_id = #{customerId} + + id = #{ids} + + + + + + + + + + + + UPDATE issue_project_category_dict + SET + + PID = #{pid}, + + + PIDS = #{pids}, + + + PARENT_CATEGORY_CODE = #{parentCategoryCode}, + + + CATEGORY_CODE = #{categoryCode}, + + + CATEGORY_NAME = #{categoryName}, + + + CATEGORY_TYPE = #{categoryType}, + + + + SORT = #{sort}, + + + IS_DISABLE = #{isDisable}, + + UPDATED_TIME = NOW() + WHERE + customer_id = #{customerId} AND id = #{id} AND DEL_FLAG = '0' + + diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectRelationDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectRelationDao.xml index ae7ee4b255..44dac4af6c 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectRelationDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectRelationDao.xml @@ -46,4 +46,16 @@ ) + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml new file mode 100644 index 0000000000..6e63c32fab --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueProjectTagDictDao.xml @@ -0,0 +1,218 @@ + + + + + + + + UPDATE issue_project_tag_dict + + SET ISSUE_USE_COUNT = (CASE WHEN ISSUE_USE_COUNT = 0 THEN 0 ELSE (ISSUE_USE_COUNT - 1) END) + + + SET ISSUE_USE_COUNT = ISSUE_USE_COUNT + 1 + + + DEL_FLAG = 0 + AND + + id = #{t.id} + + + + + + UPDATE issue_project_tag_dict + SET issue_use_count = (CASE + WHEN issue_use_count IS NULL THEN IF(#{score} > 0 ,#{score} ,0) + WHEN issue_use_count 0 THEN 0 + ELSE issue_use_count + #{score} END) + + del_flag = 0 + AND + customer_id = #{customerId} + + id = #{tagId} + + + + + + + + + + + + + + + + + + + + + + UPDATE issue_project_tag_dict + SET is_disable = #{type}, + updated_by = #{userId}, + updated_time = NOW() + WHERE + customer_id = #{customerId} + + category_id = #{ids} + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueTagsDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueTagsDao.xml new file mode 100644 index 0000000000..064a02b31e --- /dev/null +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueTagsDao.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + DELETE FROM issue_tags + WHERE DEL_FLAG = 0 + AND ISSUE_ID = #{issueId} + + + + + + + + INSERT INTO issue_tags ( ID, CUSTOMER_ID, GRID_ID, ISSUE_ID, TAG_ID, TAG_NAME, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + + ( + REPLACE ( UUID(), '-', '' ), + #{l.customerId}, + #{l.gridId}, + #{l.issueId}, + #{l.tagId}, + #{l.name}, + #{l.delFlag}, + #{l.revision}, + #{l.createdBy}, + NOW(), + #{l.updatedBy}, + NOW() + ) + + + + \ 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 5a986e4576..dcad30689c 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 @@ + + + + SELECT + category_id + FROM + project_category + WHERE + del_flag = '0' + AND project_id = #{projectId} + + + + + + DELETE + FROM + project_category + WHERE + project_id = #{projectId} + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml index c47def3cc0..50f8bc6433 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml @@ -38,7 +38,7 @@ GROUP BY ps.PROJECT_ID) psp ON p.ID = psp.PROJECT_ID WHERE p.DEL_FLAG = '0' AND p.status = 'pending' - ORDER BY p.CREATED_TIME ASC + ORDER BY psp.created_time, p.created_time ASC LIMIT #{pageNo}, #{pageSize} + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubAttachmentDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubAttachmentDao.xml new file mode 100644 index 0000000000..119e821d5b --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubAttachmentDao.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubProcessDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubProcessDao.xml new file mode 100644 index 0000000000..ef4ca830ed --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubProcessDao.xml @@ -0,0 +1,111 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectTagsDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectTagsDao.xml new file mode 100644 index 0000000000..bf3fc03e65 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectTagsDao.xml @@ -0,0 +1,57 @@ + + + + + + + + + + delete from project_tags + where del_flag = '0' + and project_id = #{projectId} + + + + INSERT INTO project_tags + ( + ID, + CUSTOMER_ID, + PROJECT_ID, + TAG_ID, + TAG_NAME, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{item.customerId}, + #{item.projectId}, + #{item.tagId}, + #{item.tagName}, + 0, + 0, + #{item.createdBy}, + now(), + #{item.createdBy}, + now() + ) + + + \ No newline at end of file diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleContentDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleContentDTO.java index 88aa05b3a8..a8269648f3 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleContentDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/ArticleContentDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -54,10 +55,19 @@ public class ArticleContentDTO implements Serializable { private String content; /** - * 内容类型 图片:img;文字:text + * 内容类型 图片:img;文字:text;文件:file */ private String contentType; + /** + * desc: 请描述类的业务用途 + * + * @param null + * @return + * @author LiuJanJun + * @date 2021/3/29 5:42 下午 + */ + /** * 审核状态 通过:pass;失败:fail;审核中:auditing */ @@ -103,4 +113,4 @@ public class ArticleContentDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftContentDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftContentDTO.java index b0699b4c59..ee29b969c7 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftContentDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/DraftContentDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -54,7 +55,7 @@ public class DraftContentDTO implements Serializable { private String content; /** - * 内容类型 图片:img;文字:text + * 内容类型 图片:img;文字:text;文件:file */ private String contentType; @@ -103,4 +104,4 @@ public class DraftContentDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java index 7df78525c0..09c6818ac2 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/form/DraftContentFromDTO.java @@ -67,14 +67,19 @@ public class DraftContentFromDTO implements Serializable { */ private String draftContentId; /** - * 内容 + * 内容 当为非文字时,存放oss链接地址 */ @Length(max = 1000, message = "每段文字最长为1000个字") private String content; /** - * 内容类型 图片:img;文字:text + * 内容类型 图片:img;文字:text;文件:file */ private String contentType; + + /** + * 文件名称 + */ + private String fileName; } -} \ No newline at end of file +} diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/ArticleContentResultDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/ArticleContentResultDTO.java index 9b12f89213..38222f8295 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/ArticleContentResultDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/ArticleContentResultDTO.java @@ -15,7 +15,7 @@ public class ArticleContentResultDTO implements Serializable { private static final long serialVersionUID = 2853197212163051558L; /** - * 内容类型(图片:img;文字:text) + * 内容类型(图片:img;文字:text;文件:file) * */ private String contentType; @@ -23,4 +23,9 @@ public class ArticleContentResultDTO implements Serializable { * 内容 * */ private String content; + + /** + * 文件名称 + * */ + private String fileName; } diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftContentDetailDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftContentDetailDTO.java index d468ffb81a..21fce8fd5d 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftContentDetailDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/DraftContentDetailDTO.java @@ -24,10 +24,15 @@ public class DraftContentDetailDTO implements Serializable { private String content; /** - * 内容类型 图片:img;文字:text + * 内容类型 图片:img;文字:text;文件:file */ private String contentType; + /** + * 文件名称 + */ + private String fileName; + /** * 内容序号 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleContentDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleContentDTO.java index dbb98d9d3d..18844917ea 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleContentDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovArticleContentDTO.java @@ -14,10 +14,15 @@ import java.io.Serializable; public class GovArticleContentDTO implements Serializable { private static final long serialVersionUID = 1519014754254863006L; /** - * 内容类型,图片:img;文字:text + * 内容类型,图片:img;文字:text; 文件:file */ private String contentType; + /** + * 文件名称 + */ + private String fileName; + /** * 内容 */ diff --git a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovDraftContentDTO.java b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovDraftContentDTO.java index 4b4ae98c07..c575c4a561 100644 --- a/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovDraftContentDTO.java +++ b/epmet-module/gov-voice/gov-voice-client/src/main/java/com/epmet/dto/result/GovDraftContentDTO.java @@ -15,10 +15,15 @@ public class GovDraftContentDTO implements Serializable { private static final long serialVersionUID = 5653062658148122552L; /** - * 内容类型,图片:img;文字:text + * 内容类型 图片:img;文字:text;文件:file */ private String contentType; + /** + * 文件名称 + */ + private String fileName; + /** * 内容 */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java index 6ee205ec7d..4556654b51 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/constant/DraftConstant.java @@ -10,7 +10,7 @@ package com.epmet.constant; /** * 常量 - * + * * @author sun * @since 1.0.0 */ @@ -66,6 +66,10 @@ public interface DraftConstant { * 内容类型-文字 */ String TEXT = "text"; + /** + * 内容类型-文件 + */ + String FILE = "file"; /** * 草稿预览内容大小长度 diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleContentEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleContentEntity.java index f4a961b974..29661c7350 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleContentEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/ArticleContentEntity.java @@ -18,13 +18,10 @@ 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; - /** * 文章内容表 * @@ -54,10 +51,15 @@ public class ArticleContentEntity extends BaseEpmetEntity { private String content; /** - * 内容类型 图片:img;文字:text + * 内容类型 图片:img;文字:text;文件:file */ private String contentType; + /** + * 文件名称 + */ + private String fileName; + /** * 审核状态 通过:pass;失败:fail;审核中:auditing */ diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftContentEntity.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftContentEntity.java index a5ab64db0e..15a7ba4e76 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftContentEntity.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/entity/DraftContentEntity.java @@ -18,13 +18,10 @@ 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; - /** * 草稿内容表 * @@ -54,7 +51,7 @@ public class DraftContentEntity extends BaseEpmetEntity { private String content; /** - * 内容类型 图片:img;文字:text + * 内容类型 图片:img;文字:text;文件:file */ private String contentType; @@ -73,4 +70,9 @@ public class DraftContentEntity extends BaseEpmetEntity { */ private Integer orderNum; + /** + * 文件名称 + */ + private String fileName; + } diff --git a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java index 5c8ed40e39..d00baf70d3 100644 --- a/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java +++ b/epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java @@ -460,6 +460,9 @@ public class ArticleServiceImpl extends BaseServiceImpl SELECT ac.CONTENT_TYPE, - ac.CONTENT + ac.CONTENT, + ac.FILE_NAME FROM article_content ac WHERE @@ -275,6 +276,7 @@ + @@ -288,6 +290,7 @@ IFNULL(art.TAGS,'') AS tags, content2.CONTENT, content2.CONTENT_TYPE, + content2.FILE_NAME, (SELECT COUNT(1) FROM ARTICLE_VISIT_RECORD WHERE DEL_FLAG = '0' AND ARTICLE_ID = #{articleId} AND GRID_ID = #{gridId}) AS visitRecordCount, art.CUSTOMER_ID FROM @@ -297,6 +300,7 @@ content.ARTICLE_ID, content.CONTENT, content.CONTENT_TYPE, + content.FILE_NAME, content.ORDER_NUM FROM ARTICLE_CONTENT content @@ -333,4 +337,4 @@ AND a.draft_id = #{draftId} - \ 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-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java index 0f4313dfad..04508ac6df 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/OperCrmOpenFeignClient.java @@ -122,4 +122,15 @@ public interface OperCrmOpenFeignClient { **/ @GetMapping("/oper/crm/customer/getallsubcustomerids/{customerId}") Result> getAllSubCustomerIds(@PathVariable("customerId") String customerId); + + /** + * 获取外部客户,的父级 客户id + * + * @param customerId + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:57 2021-03-22 + **/ + @GetMapping("/oper/crm/customer/getexternalandparentcustomerid/{customerId}") + Result getExternalAndParentCustomerId(@PathVariable("customerId") String customerId); } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java index 5de09ce167..b718517d4b 100644 --- a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/feign/fallback/OperCrmOpenFeignClientFallback.java @@ -95,4 +95,9 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient { public Result> getAllSubCustomerIds(String customerId) { return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getAllSubCustomerIds", customerId); } + + @Override + public Result getExternalAndParentCustomerId(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getExternalAndParentCustomerId", customerId); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java index c5330a9abd..30fe309079 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerController.java @@ -376,4 +376,21 @@ public class CustomerController { } return new Result<>(); } + + /** + * 获取外部客户,的父级 客户id + * + * @param customerId + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:57 2021-03-22 + **/ + @GetMapping("getexternalandparentcustomerid/{customerId}") + public Result getExternalAndParentCustomerId(@PathVariable("customerId") String customerId){ + if(StringUtils.isNotBlank(customerId)){ + String resultDTO = customerService.getExternalAndParentCustomerId(customerId); + return new Result().ok(resultDTO); + } + return new Result<>(); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java index b7aed8f55a..02ae9d9890 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerDao.java @@ -48,7 +48,7 @@ public interface CustomerDao extends BaseDao { * @param customerIdList * @Author yinzuomei * @Description 根据客户id查询客户信息 - * @Date 2020/4/24 9:21 + * @Date 2020/4/24 9:21 **/ List selectListByIds(@Param("customerIdList") List customerIdList); @@ -98,4 +98,13 @@ public interface CustomerDao extends BaseDao { */ List selectAllCustomerList(@Param("customerName") String customerName); + /** + * 获取外部客户,的父级 客户id + * + * @param customerId + * @return java.lang.String + * @Author zhangyong + * @Date 14:57 2021-03-22 + **/ + String getExternalAndParentCustomerId(@Param("customerId") String customerId); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerThirdplatApiserviceDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerThirdplatApiserviceDao.java index 52f05556b1..a879264c54 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerThirdplatApiserviceDao.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerThirdplatApiserviceDao.java @@ -23,6 +23,8 @@ import com.epmet.entity.CustomerThirdplatApiserviceEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 客户所属的第三方平台的apiService列表 * @@ -33,4 +35,12 @@ import org.apache.ibatis.annotations.Param; public interface CustomerThirdplatApiserviceDao extends BaseDao { ThirdplatApiserviceResultDTO getByCustomerId(@Param("customerId") String customerId); + + /** + * @Description 列出该客户所有的ApiService + * @return + * @author wxz + * @date 2021.03.15 15:07 + */ + List listByCustomerId(String customerId); } \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java index 82e872e511..f1efa2d087 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerService.java @@ -226,4 +226,14 @@ public interface CustomerService extends BaseService { * @Date 2021/2/3 12:52 **/ CustomerRelationInfoResultDTO queryCustomerInfoByCustomerId(String customerId); + + /** + * 获取外部客户,的父级 客户id + * + * @param customerId + * @return java.lang.String + * @Author zhangyong + * @Date 14:57 2021-03-22 + **/ + String getExternalAndParentCustomerId(String customerId); } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerThirdplatApiServiceService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerThirdplatApiServiceService.java index a1f9fa91e9..59a9876535 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerThirdplatApiServiceService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerThirdplatApiServiceService.java @@ -3,6 +3,8 @@ package com.epmet.service; import com.epmet.dto.result.ThirdplatApiserviceResultDTO; import com.epmet.entity.CustomerThirdplatApiserviceEntity; +import java.util.List; + public interface CustomerThirdplatApiServiceService { /** diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 1fadbd8443..c2677c0504 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -785,4 +785,8 @@ public class CustomerServiceImpl extends BaseServiceImpl apiServiceMap = redisUtils.hGetAll(RedisKeys.getCustomerApiServiceKey(customerId)); if (!CollectionUtils.isEmpty(apiServiceMap)) { - apiService = BeanUtil.mapToBean(apiServiceMap, ThirdplatApiserviceResultDTO.class, true); + apiService = ConvertUtils.mapToEntity(apiServiceMap, ThirdplatApiserviceResultDTO.class); } if (apiService == null) { 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-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml index d50ab9ce85..7ef7c8261d 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerDao.xml @@ -120,4 +120,14 @@ AND customer_name LIKE concat('%', trim(#{customerName}), '%') + + diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerThirdplatApiserviceDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerThirdplatApiserviceDao.xml index 8390e5647f..86f93189e2 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerThirdplatApiserviceDao.xml +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/mapper/CustomerThirdplatApiserviceDao.xml @@ -29,5 +29,19 @@ where cta.CUSTOMER_ID = #{customerId} + + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionCustomizedListFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionCustomizedListFormDTO.java index 2c6e3c037a..7fac3528a4 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionCustomizedListFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/FunctionCustomizedListFormDTO.java @@ -54,6 +54,6 @@ public class FunctionCustomizedListFormDTO implements Serializable { /** * 页容量,默认20页 */ - @Min(value = 1, message = "每页条数必须大于必须大于0") + @Min(value = 1, message = "每页条数必须大于0") private Integer pageSize; } 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/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml index a9840f4e42..1e304190cf 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedDao.xml @@ -69,6 +69,7 @@ AND cu.FROM_APP = #{fromApp} ORDER BY cu.FROM_APP, f.CREATED_TIME DESC + LIMIT #{pageNo}, #{pageSize} 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/group/form/ExitGroupFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ExitGroupFormDTO.java new file mode 100644 index 0000000000..0c10e60de1 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/group/form/ExitGroupFormDTO.java @@ -0,0 +1,43 @@ +package com.epmet.resi.group.dto.group.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @author sun + * @Description 删除组员-接口入参 + */ +@NoArgsConstructor +@Data +public class ExitGroupFormDTO implements Serializable { + + private static final long serialVersionUID = 9033824126731443502L; + /** + * 屏蔽突然的话题及评论,勾选:yes;不勾选:no + */ + @NotBlank(message = "是否屏蔽话题及评论不能为空") + private String shieldFlag; + /** + * 组成员用户id + */ + @NotBlank(message = "被删除用户Id不能为空") + private String userId; + /** + * 小组ID + */ + @NotBlank(message = "小组Id不能为空") + private String groupId; + + /** + * 客户Id + */ + private String customerId; + + /** + * OPERATE_USER_ID操作人id + */ + private String operateUserId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ExitGroupRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ExitGroupRecordDTO.java new file mode 100644 index 0000000000..ad0cc7e1ef --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ExitGroupRecordDTO.java @@ -0,0 +1,97 @@ +/** + * 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.resi.group.dto.member; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 退群记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +@Data +public class ExitGroupRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组id + */ + private String groupId; + + /** + * 组成员用户id + */ + private String memberUserId; + + /** + * 屏蔽他的话题及评论 yes:屏蔽 no:不屏蔽 + */ + private String shieldFlag; + + /** + * 0:组长移除; + */ + private String leaveType; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 当前操作人id + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupLeaderTransferRecordDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupLeaderTransferRecordDTO.java new file mode 100644 index 0000000000..7bd1e2a490 --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/GroupLeaderTransferRecordDTO.java @@ -0,0 +1,97 @@ +/** + * 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.resi.group.dto.member; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 组长身份转让记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +@Data +public class GroupLeaderTransferRecordDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组id + */ + private String groupId; + + /** + * 原组长userId + */ + private String originalLeader; + + /** + * 新组长userId + */ + private String newLeader; + + /** + * 组长自主转让resi,工作人员转让gov + */ + private String type; + + /** + * 删除标识 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 当前操作人id即组长id + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file 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-client/src/main/java/com/epmet/resi/group/dto/member/form/ConfirmTransferFormDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/ConfirmTransferFormDTO.java new file mode 100644 index 0000000000..3fd80cd64c --- /dev/null +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/form/ConfirmTransferFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.resi.group.dto.member.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 确认转让组-(工作端通用)入参 + * + * @author yinzuomei@elink-cn.com + * @date 2021/3/30 10:06 + */ +@Data +public class ConfirmTransferFormDTO implements Serializable { + private static final long serialVersionUID = -6087185953287544147L; + + @NotBlank(message = "小组id不能为空") + private String groupId; + + @NotBlank(message = "新组长用户id不能为空") + private String newLeaderUserId; + + @NotBlank(message = "type不能为空:自主转让resi,工作人员转让gov") + private String type; + + /**************************以上是需要前端传入的参数*******************************************************/ + @NotBlank(message = "tokenDto中获取customerId为空") + private String customerId; + @NotBlank(message = "tokenDto中获取userId为空") + private String currentUserId; +} diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentDTO.java index ce8b30e3f6..d8763a36fd 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/topic/ResiTopicCommentDTO.java @@ -17,9 +17,10 @@ package com.epmet.resi.group.dto.topic; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -49,7 +50,7 @@ public class ResiTopicCommentDTO implements Serializable { private String topicId; /** - * 评论状态 + * 评论状态:讨论中:discussing;已屏蔽 :hidden */ private String status; diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java index 3c8a358f1c..d604e0abc6 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/ResiGroupOpenFeignClient.java @@ -198,4 +198,22 @@ public interface ResiGroupOpenFeignClient { @GetMapping("resi/group/topic/querytopicinfobyissueid/{issueId}") Result queryTopicInfoByIssueId(@PathVariable("issueId")String issueId); + + /** + * @param + * @return + * @Author sun + * @Description 根据话题Id查询话题信息 + **/ + @PostMapping("/resi/group/topic/gettopicbyid/{topicId}") + Result getTopicById(@PathVariable("topicId") String topicId); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取话题附件信息 + **/ + @PostMapping(value = "/resi/group/topic/topicattachmentlist") + Result topicAttachmentList(@RequestBody TopicAttachmentFormDTO formDTO); } diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java index 881569ea10..b53570bfa8 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/feign/fallback/ResiGroupOpenFeignClientFallback.java @@ -12,10 +12,7 @@ import com.epmet.resi.group.dto.group.result.GroupInfoResultDTO; import com.epmet.resi.group.dto.topic.MyCreateTopicsFormDTO; import com.epmet.resi.group.dto.topic.ResiTopicDTO; import com.epmet.resi.group.dto.topic.form.*; -import com.epmet.resi.group.dto.topic.result.IssueGridResultDTO; -import com.epmet.resi.group.dto.topic.result.MyPartIssueResultDTO; -import com.epmet.resi.group.dto.topic.result.ParticipatedTopicUnitResultDTO; -import com.epmet.resi.group.dto.topic.result.TopicBelongGroupResultDTO; +import com.epmet.resi.group.dto.topic.result.*; import com.epmet.resi.group.feign.ResiGroupOpenFeignClient; import com.epmet.resi.mine.dto.from.MyPartProjectsFormDTO; import org.springframework.stereotype.Component; @@ -139,4 +136,25 @@ public class ResiGroupOpenFeignClientFallback implements ResiGroupOpenFeignClien public Result queryTopicInfoByIssueId(String issueId) { return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "queryTopicInfoByIssueId", issueId); } + + /** + * @param topicId@return + * @Author sun + * @Description 根据话题Id查询话题信息 + **/ + @Override + public Result getTopicById(String topicId) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "getTopicById", topicId); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 获取话题附件信息 + **/ + @Override + public Result topicAttachmentList(TopicAttachmentFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.RESI_GROUP_SERVER, "topicAttachmentList", formDTO); + } } 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/comment/entity/ResiTopicCommentEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/entity/ResiTopicCommentEntity.java index 04cbfeff0d..7be28a6de1 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/entity/ResiTopicCommentEntity.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/comment/entity/ResiTopicCommentEntity.java @@ -20,13 +20,10 @@ package com.epmet.modules.comment.entity; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 话题评论表 * @@ -51,7 +48,7 @@ public class ResiTopicCommentEntity extends BaseEpmetEntity { private String topicId; /** - * 评论状态 + * 评论状态:讨论中:discussing;已屏蔽 :hidden */ private String status; diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupMemberConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupMemberConstant.java index fdd709ca73..15761d2eac 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupMemberConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/GroupMemberConstant.java @@ -13,7 +13,8 @@ public interface GroupMemberConstant { /** * 删除组成员时对应话题操作日志表设置默认的屏蔽理由 */ - String DELETE_MEMBER_REASON = "删除组成员,屏蔽该成员话题"; + String DELETE_MEMBER_REASON = "删除组员,屏蔽他的话题及评论"; String SLIENT_SUCCESS = "禁言成功"; + } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java index 29f89329e4..eff45ac9a5 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/constant/UserMessageConstant.java @@ -90,4 +90,13 @@ public interface UserMessageConstant { */ String SCANCODE_OPERATE = "通过扫码加入小组。"; + /** + * 新组长上任收到消息 + * */ + String NEW_LEADER_UP = "您已成为【%s】的组长,请查看。"; + + /** + * 原组长下台 + * */ + String ORIGINAL_LEADER_DOWN="您已失去【%s】的组长身份,请查看。"; } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ExitGroupController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ExitGroupController.java new file mode 100644 index 0000000000..a987253c0d --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/ExitGroupController.java @@ -0,0 +1,48 @@ +package com.epmet.modules.group.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +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.modules.group.service.ExitGroupService; +import com.epmet.resi.group.dto.group.form.ExitGroupFormDTO; +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; + +/** + * @author sun + * @dscription + */ +@Slf4j +@RestController +@RequestMapping("exitgroup") +public class ExitGroupController { + @Autowired + private ExitGroupService exitGroupService; + + + /** + * @param formDTO + * @Description 删除组员 + * @author sun + * 如果shieldFlag=yes, 则将讨论中的话题并且不存在正在审核的议题申请的置为已屏蔽 + * 不要忘了插入:exit_group_record + */ + @PostMapping("removemember") + public Result removeMember(@LoginUser TokenDto tokenDto, @RequestBody ExitGroupFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + if(!"yes".equals(formDTO.getShieldFlag())&&!"no".equals(formDTO.getShieldFlag())){ + throw new RenException("参数错误,是否屏蔽历史话题参数值错误"); + } + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setOperateUserId(tokenDto.getUserId()); + exitGroupService.removeMember(formDTO); + return new Result(); + } + +} 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/ExitGroupService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ExitGroupService.java new file mode 100644 index 0000000000..af8b7f30c7 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/ExitGroupService.java @@ -0,0 +1,18 @@ +package com.epmet.modules.group.service; + +import com.epmet.resi.group.dto.group.form.ExitGroupFormDTO; + +/** + * @author sun + * @dscription + */ +public interface ExitGroupService { + + /** + * @param formDTO + * @Description 删除组员 + * @author sun + */ + void removeMember(ExitGroupFormDTO formDTO); + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java new file mode 100644 index 0000000000..186531756b --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ExitGroupServiceImpl.java @@ -0,0 +1,197 @@ +package com.epmet.modules.group.service.impl; + +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserRoleFormDTO; +import com.epmet.dto.result.UserRoleResultDTO; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.GovIssueOpenFeignClient; +import com.epmet.modules.constant.GroupMemberConstant; +import com.epmet.modules.group.dao.ResiGroupDao; +import com.epmet.modules.group.dao.ResiGroupStatisticalDao; +import com.epmet.modules.group.entity.ResiGroupEntity; +import com.epmet.modules.group.entity.ResiGroupStatisticalEntity; +import com.epmet.modules.group.redis.ResiGroupRedis; +import com.epmet.modules.group.service.ExitGroupService; +import com.epmet.modules.member.dao.ExitGroupRecordDao; +import com.epmet.modules.member.dao.GroupMemeberOperationDao; +import com.epmet.modules.member.dao.ResiGroupMemberDao; +import com.epmet.modules.member.entity.ExitGroupRecordEntity; +import com.epmet.modules.topic.dao.ResiTopicCommentDao; +import com.epmet.modules.topic.dao.ResiTopicDao; +import com.epmet.modules.topic.entity.ResiTopicOperationEntity; +import com.epmet.modules.topic.service.ResiTopicOperationService; +import com.epmet.resi.group.constant.TopicConstant; +import com.epmet.resi.group.dto.group.form.ExitGroupFormDTO; +import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author sun + * @dscription + */ +@Slf4j +@Service +public class ExitGroupServiceImpl implements ExitGroupService { + + @Autowired + private ResiGroupMemberDao resiGroupMemberDao; + @Autowired + private GroupMemeberOperationDao groupMemeberOperationDao; + @Autowired + private ExitGroupRecordDao exitGroupRecordDao; + @Autowired + private ResiTopicDao resiTopicDao; + @Autowired + private GovIssueOpenFeignClient govIssueOpenFeignClient; + @Autowired + private ResiTopicCommentDao resiTopicCommentDao; + @Autowired + private ResiTopicOperationService resiTopicOperationService; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private ResiGroupStatisticalDao resiGroupStatisticalDao; + @Autowired + private ResiGroupRedis resiGroupRedis; + @Autowired + private ResiGroupDao resiGroupDao; + + /** + * @param formDTO + * @Description 删除组员 + * @author sun + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void removeMember(ExitGroupFormDTO formDTO) { + //0.组长自己不能删除自己 + if(formDTO.getUserId().equals(formDTO.getOperateUserId())){ + throw new RenException("群组长不能删除自己"); + } + + //1.校验被删除人员是否是当前小组内成员 + int num = resiGroupMemberDao.checkUserInGroup(formDTO.getUserId(), formDTO.getGroupId()); + if (num < NumConstant.ONE) { + throw new RenException("当前待删除人员不是本小组成员"); + } + + //2.判断是否屏蔽本小组内历史话题 + List delIdList = new ArrayList<>(); + if (Constant.YES.equals(formDTO.getShieldFlag())) { + //2-1.查询当前被删除人员发表过的话题还未成为议题的并且只是谈论中的数据 + List topicIdList = resiTopicDao.selectIdList(formDTO.getGroupId(), formDTO.getUserId()); + //2-2.查询当前未成为议题的话题但是提交了转议题申请的话题 + if (!CollectionUtils.isEmpty(topicIdList)) { + Result> listResult = govIssueOpenFeignClient.notIssueToTopicIds(topicIdList); + if (!listResult.success()) { + throw new RenException(listResult.getInternalMsg()); + } + //获取只是单纯的话题既没有被转成议题又不存在转议题申请待审核数据 + delIdList = topicIdList.stream().filter(o -> !listResult.getData().contains(o)).collect(Collectors.toList()); + } + //2-3.屏蔽这些单纯的话题 + if (delIdList.size() > NumConstant.ZERO) { + resiTopicDao.upTopicList(delIdList, formDTO.getOperateUserId()); + //2-4.话题操作日志表批量新增记录 + List list = new ArrayList<>(); + delIdList.forEach(d->{ + ResiTopicOperationEntity entity = new ResiTopicOperationEntity(); + entity.setOperationType(TopicConstant.HIDDEN); + entity.setOperationReason(GroupMemberConstant.DELETE_MEMBER_REASON); + entity.setTopicId(d); + list.add(entity); + }); + resiTopicOperationService.insertBatch(list); + } + } + //去重 + if(delIdList.size()>NumConstant.ZERO){ + delIdList = delIdList.stream().distinct().collect(Collectors.toList()); + } + int count = delIdList.size(); + + //3.判断是否屏蔽本小组内历史评论 + if (Constant.YES.equals(formDTO.getShieldFlag())) { + //3-1.查询别人的话题但自己评论过的话题Id + List commetTopicList = resiTopicCommentDao.selectTopicIds(formDTO.getGroupId(), formDTO.getUserId()); + delIdList.addAll(commetTopicList); + //3-2.本小组内屏蔽自己创建的话题发表过的评论以及别人发表的话题自己评论过的评论 + if (delIdList.size() > NumConstant.ZERO) { + resiTopicCommentDao.upTopicCommentList(delIdList, formDTO.getUserId(), formDTO.getOperateUserId()); + } + } + + //4.修改组成员出入群记录表数据状态、删除组成员关系表数据、新增退群记录表数据 + //4-1.修改组成员出入群记录表数据状态 + GroupMemeberOperationDTO operationDTO = new GroupMemeberOperationDTO(); + operationDTO.setGroupId(formDTO.getGroupId()); + operationDTO.setCustomerUserId(formDTO.getUserId()); + operationDTO.setOperateUserId(formDTO.getOperateUserId()); + if (groupMemeberOperationDao.upByGroupAndUserId(operationDTO) < NumConstant.ONE) { + throw new RenException(String.format("修改组成员出入群记录表数据失败,小组Id【%s】被修改人Id【%s】", formDTO.getGroupId(), formDTO.getUserId())); + } + //4-2.删除组成员关系表数据并修改状态 + if (resiGroupMemberDao.delByGroupAndUserId(formDTO.getGroupId(), formDTO.getUserId()) < NumConstant.ONE) { + throw new RenException(String.format("删除组成员关系表数据操作失败,小组Id【%s】被修改人Id【%s】", formDTO.getGroupId(), formDTO.getUserId())); + } + //4-3.新增退群记录表数据 + ExitGroupRecordEntity entity = new ExitGroupRecordEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setGroupId(formDTO.getGroupId()); + entity.setMemberUserId(formDTO.getUserId()); + entity.setShieldFlag(formDTO.getShieldFlag()); + entity.setLeaveType(NumConstant.ZERO_STR); + if (exitGroupRecordDao.insert(entity) < NumConstant.ONE) { + throw new RenException(String.format("新增退群记录表数据操作失败,小组Id【%s】被修改人Id【%s】", formDTO.getGroupId(), formDTO.getUserId())); + } + + //5.群组统计表修改数据 + //5-1.获取被删人员当前网格居民端角色信息 + ResiGroupEntity groupEntity = resiGroupDao.selectById(formDTO.getGroupId()); + UserRoleFormDTO dto = new UserRoleFormDTO(); + dto.setApp(AppClientConstant.APP_RESI); + dto.setUserId(formDTO.getUserId()); + dto.setCustomerId(formDTO.getCustomerId()); + dto.setGridId(groupEntity.getGridId()); + Result> resultUser = epmetUserOpenFeignClient.getUserRoleInfo(dto); + if (!resultUser.success()) { + throw new RenException(resultUser.getInternalMsg()); + } + List roleList = resultUser.getData(); + //5-2.群组统计表数据修改,缓存数据修改 + ResiGroupStatisticalEntity statisticalEntity = resiGroupStatisticalDao.selectByResiGroupId(formDTO.getGroupId()); + if (null == statisticalEntity) { + throw new RenException("未查询到群组统计数据,删除失败"); + } + statisticalEntity.setTotalMembers(statisticalEntity.getTotalMembers() - 1); + statisticalEntity.setTotalTopics(statisticalEntity.getTotalTopics()-count); + statisticalEntity.setTotalNormalMemebers(statisticalEntity.getTotalNormalMemebers() - 1); + roleList.forEach(r -> { + if (EpmetRoleKeyConstant.PARTYMEMBER.equals(r.getRoleKey())) {//党员总数减一 + statisticalEntity.setTotalPartyMembers(statisticalEntity.getTotalPartyMembers() - 1); + } + if (EpmetRoleKeyConstant.WARMHEARTED.equals(r.getRoleKey())) {//热心居民总数减一 + statisticalEntity.setTotalEarnestMemebers(statisticalEntity.getTotalEarnestMemebers() - 1); + } + }); + resiGroupStatisticalDao.updateById(statisticalEntity); + resiGroupRedis.delGroup(formDTO.getGroupId()); + resiGroupRedis.get(formDTO.getGroupId()); + + } + + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java index 0f64fe67d7..4ee54bcd43 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/service/impl/ResiGroupServiceImpl.java @@ -21,10 +21,7 @@ import com.alibaba.fastjson.JSON; 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.AppClientConstant; -import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.*; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; @@ -34,7 +31,10 @@ import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.security.user.LoginUserUtil; -import com.epmet.commons.tools.utils.*; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ReadFlagConstant; import com.epmet.dto.form.*; import com.epmet.dto.result.UserResiInfoResultDTO; @@ -80,6 +80,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.transaction.support.TransactionSynchronizationAdapter; +import org.springframework.transaction.support.TransactionSynchronizationManager; import org.springframework.util.CollectionUtils; import java.text.SimpleDateFormat; @@ -145,9 +147,6 @@ public class ResiGroupServiceImpl 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 +384,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 +535,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 +1012,7 @@ public class ResiGroupServiceImpl extends BaseServiceImpl + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.modules.member.controller; + +import com.epmet.modules.member.service.ExitGroupRecordService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 退群记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +@RestController +@RequestMapping("exitgroup") +public class ExitGroupRecordController { + + @Autowired + private ExitGroupRecordService exitGroupRecordService; + + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupLeaderTransferRecordController.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupLeaderTransferRecordController.java new file mode 100644 index 0000000000..98376bb68e --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/controller/GroupLeaderTransferRecordController.java @@ -0,0 +1,61 @@ +/** + * 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.modules.member.controller; + +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.modules.member.service.GroupLeaderTransferRecordService; +import com.epmet.resi.group.dto.member.form.ConfirmTransferFormDTO; +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; + + +/** + * 组长身份转让记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +@RestController +@RequestMapping("leadertransfer") +public class GroupLeaderTransferRecordController { + + @Autowired + private GroupLeaderTransferRecordService groupLeaderTransferRecordService; + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 确认转让组-(工作端通用) NEI:https://nei.netease.com/interface/detail/?pid=52286&id=355049 + * @Date 2021/3/30 10:08 + **/ + @PostMapping("confirmtransfer") + public Result confirmTransfer(@LoginUser TokenDto tokenDto, @RequestBody ConfirmTransferFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setCurrentUserId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(formDTO); + groupLeaderTransferRecordService.confirmTransfer(formDTO); + return new Result(); + } +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ExitGroupRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ExitGroupRecordDao.java new file mode 100644 index 0000000000..8169ded9f5 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/ExitGroupRecordDao.java @@ -0,0 +1,33 @@ +/** + * 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.modules.member.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.member.entity.ExitGroupRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 退群记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +@Mapper +public interface ExitGroupRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupLeaderTransferRecordDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupLeaderTransferRecordDao.java new file mode 100644 index 0000000000..aa9b14bc0a --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupLeaderTransferRecordDao.java @@ -0,0 +1,33 @@ +/** + * 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.modules.member.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.modules.member.entity.GroupLeaderTransferRecordEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 组长身份转让记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +@Mapper +public interface GroupLeaderTransferRecordDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java index 49ecf7fbbe..bf0f443668 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/dao/GroupMemeberOperationDao.java @@ -59,4 +59,10 @@ public interface GroupMemeberOperationDao extends BaseDao { * @date 2020/12/18 下午4:33 */ Integer checkUserInGroup(@Param("userId")String userId,@Param("groupId")String groupId); + + /** + * @Description 修改组成员数据状态 + * @author sun + */ + int delByGroupAndUserId(@Param("groupId")String groupId, @Param("userId")String userId); + + /** + * @return java.util.List + * @param groupId + * @param userId + * @author yinzuomei + * @description 查询当前用户被移出群的记录,按创建时间降序 + * @Date 2021/4/6 12:50 + **/ + List queryMemberRemovedRecs(@Param("groupId")String groupId, @Param("userId")String userId); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ExitGroupRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ExitGroupRecordEntity.java new file mode 100644 index 0000000000..2af81275a9 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/ExitGroupRecordEntity.java @@ -0,0 +1,63 @@ +/** + * 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.modules.member.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 退群记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("exit_group_record") +public class ExitGroupRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组id + */ + private String groupId; + + /** + * 组成员用户id + */ + private String memberUserId; + + /** + * 屏蔽他的话题及评论 yes:屏蔽 no:不屏蔽 + */ + private String shieldFlag; + + /** + * 0:组长移除; + */ + private String leaveType; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupLeaderTransferRecordEntity.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupLeaderTransferRecordEntity.java new file mode 100644 index 0000000000..652ac30046 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/entity/GroupLeaderTransferRecordEntity.java @@ -0,0 +1,63 @@ +/** + * 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.modules.member.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 组长身份转让记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("group_leader_transfer_record") +public class GroupLeaderTransferRecordEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 小组id + */ + private String groupId; + + /** + * 原组长userId + */ + private String originalLeader; + + /** + * 新组长userId + */ + private String newLeader; + + /** + * 组长自主转让resi,工作人员转让gov + */ + private String type; + +} diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java index d635bd1dea..f3d5f52942 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java @@ -18,23 +18,23 @@ package com.epmet.modules.member.redis; -import com.epmet.commons.tools.constant.FieldConstant; +import cn.hutool.core.bean.BeanUtil; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.UserResiInfoFormDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.modules.constant.ResiGroupRedisKeys; import com.epmet.modules.feign.EpmetUserFeignClient; import com.epmet.modules.group.service.ResiGroupService; import com.epmet.modules.member.service.ResiGroupMemberService; import com.epmet.modules.utils.ModuleConstant; -import com.epmet.resi.group.constant.TopicConstant; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; import com.epmet.resi.group.dto.member.result.ResiGroupMemberInfoRedisResultDTO; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -85,7 +85,7 @@ public class ResiGroupMemberRedis { } /** - * @Description 得到一个指定组内成员信息,如果redis中没有,则返回null + * @Description 得到一个指定组内成员信息,如果redis中没有,则去数据库查询并放入缓存 * @Param groupId * @Param userId * @return ResiGroupMemberInfoRedisDTO.class @@ -97,12 +97,24 @@ public class ResiGroupMemberRedis { ResiGroupMemberInfoRedisDTO memberCache = (ResiGroupMemberInfoRedisDTO) redisUtils.get(ResiGroupRedisKeys.getResiGroupMemberInfoKey(groupId,userId)); //如果缓存中没有该成员数据 - if(null == memberCache || StringUtils.isNotBlank(memberCache.getUserId())){ - Map param = new HashMap<>(); + if(null == memberCache || StringUtils.isBlank(memberCache.getUserId())){ + /*Map param = new HashMap<>(); param.put(TopicConstant.CUSTOMER_USER_ID,userId); param.put(TopicConstant.RESI_GROUP_ID,groupId); param.put(FieldConstant.DEL_FLAG, NumConstant.ZERO_STR); - List memberList = memberService.list(param); + List memberList = memberService.list(param);*/ + List memberList=new ArrayList<>(); + ResiGroupMemberDTO resiGroupMemberDTO=memberService.getResiGroupMember(groupId,userId); + if (null == resiGroupMemberDTO) { + //查询组员被移除的记录 + List delMemberList = memberService.queryMemberRemovedRecs(groupId, userId); + if (CollectionUtils.isNotEmpty(delMemberList)) { + logger.warn(String.format("groupId=%s,userId=%s,组员已被删除", groupId, userId)); + memberList.add(delMemberList.get(NumConstant.ZERO)); + } + }else{ + memberList.add(resiGroupMemberDTO); + } if(null != memberList && memberList.size() >= 1){ if(memberList.size() > 1) { memberList.sort(Comparator.comparing(ResiGroupMemberDTO::getCreatedTime, Collections.reverseOrder())); @@ -115,21 +127,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 +165,6 @@ public class ResiGroupMemberRedis { .concat(userId)); } } - memberCache.setGroupId(groupId); return memberCache; } @@ -190,4 +214,16 @@ public class ResiGroupMemberRedis { return null; } + /** + * @return void + * @param groupId + * @param userId + * @author yinzuomei + * @description 删除某个小组成员的缓存信息 + * @Date 2021/3/31 10:08 + **/ + public void deleteMemberCatche(String groupId, String userId) { + String key=ResiGroupRedisKeys.getResiGroupMemberInfoKey(groupId,userId); + redisUtils.delete(key); + } } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ExitGroupRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ExitGroupRecordService.java new file mode 100644 index 0000000000..b87212ba9f --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ExitGroupRecordService.java @@ -0,0 +1,95 @@ +/** + * 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.modules.member.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.member.entity.ExitGroupRecordEntity; +import com.epmet.resi.group.dto.member.ExitGroupRecordDTO; + +import java.util.List; +import java.util.Map; + +/** + * 退群记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +public interface ExitGroupRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-03-29 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-03-29 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ExitGroupRecordDTO + * @author generator + * @date 2021-03-29 + */ + ExitGroupRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-29 + */ + void save(ExitGroupRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-29 + */ + void update(ExitGroupRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-03-29 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupLeaderTransferRecordService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupLeaderTransferRecordService.java new file mode 100644 index 0000000000..9d4e947536 --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/GroupLeaderTransferRecordService.java @@ -0,0 +1,105 @@ +/** + * 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.modules.member.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.modules.member.entity.GroupLeaderTransferRecordEntity; +import com.epmet.resi.group.dto.member.GroupLeaderTransferRecordDTO; +import com.epmet.resi.group.dto.member.form.ConfirmTransferFormDTO; + +import java.util.List; +import java.util.Map; + +/** + * 组长身份转让记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +public interface GroupLeaderTransferRecordService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-03-29 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-03-29 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GroupLeaderTransferRecordDTO + * @author generator + * @date 2021-03-29 + */ + GroupLeaderTransferRecordDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-29 + */ + void save(GroupLeaderTransferRecordDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-29 + */ + void update(GroupLeaderTransferRecordDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-03-29 + */ + void delete(String[] ids); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 确认转让组-(工作端通用) + * @Date 2021/3/30 10:11 + **/ + void confirmTransfer(ConfirmTransferFormDTO formDTO); +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java index a7e1a10aee..5a9563141b 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/ResiGroupMemberService.java @@ -206,4 +206,23 @@ public interface ResiGroupMemberService extends BaseService + * @param groupId + * @param userId + * @author yinzuomei + * @description 查询当前用户被移出群的记录,按创建时间降序 + * @Date 2021/4/6 12:48 + **/ + List queryMemberRemovedRecs(String groupId, String userId); } diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ExitGroupRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ExitGroupRecordServiceImpl.java new file mode 100644 index 0000000000..181efcdbfc --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ExitGroupRecordServiceImpl.java @@ -0,0 +1,99 @@ +/** + * 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.modules.member.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.modules.member.dao.ExitGroupRecordDao; +import com.epmet.modules.member.entity.ExitGroupRecordEntity; +import com.epmet.modules.member.service.ExitGroupRecordService; +import com.epmet.resi.group.dto.member.ExitGroupRecordDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 退群记录表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-29 + */ +@Service +public class ExitGroupRecordServiceImpl extends BaseServiceImpl implements ExitGroupRecordService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ExitGroupRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ExitGroupRecordDTO.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 ExitGroupRecordDTO get(String id) { + ExitGroupRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ExitGroupRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ExitGroupRecordDTO dto) { + ExitGroupRecordEntity entity = ConvertUtils.sourceToTarget(dto, ExitGroupRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ExitGroupRecordDTO dto) { + ExitGroupRecordEntity entity = ConvertUtils.sourceToTarget(dto, ExitGroupRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupLeaderTransferRecordServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupLeaderTransferRecordServiceImpl.java new file mode 100644 index 0000000000..492047cf9b --- /dev/null +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/GroupLeaderTransferRecordServiceImpl.java @@ -0,0 +1,226 @@ +/** + * 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.modules.member.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dto.form.UserMessageFormDTO; +import com.epmet.feign.EpmetMessageOpenFeignClient; +import com.epmet.modules.constant.UserMessageConstant; +import com.epmet.modules.group.service.ResiGroupService; +import com.epmet.modules.member.dao.GroupLeaderTransferRecordDao; +import com.epmet.modules.member.entity.GroupLeaderTransferRecordEntity; +import com.epmet.modules.member.redis.ResiGroupMemberRedis; +import com.epmet.modules.member.service.GroupLeaderTransferRecordService; +import com.epmet.modules.member.service.ResiGroupMemberService; +import com.epmet.modules.utils.ModuleConstant; +import com.epmet.resi.group.constant.LeaderFlagConstant; +import com.epmet.resi.group.dto.group.ResiGroupDTO; +import com.epmet.resi.group.dto.member.GroupLeaderTransferRecordDTO; +import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; +import com.epmet.resi.group.dto.member.form.ConfirmTransferFormDTO; +import lombok.extern.slf4j.Slf4j; +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-29 + */ +@Slf4j +@Service +public class GroupLeaderTransferRecordServiceImpl extends BaseServiceImpl implements GroupLeaderTransferRecordService { + @Autowired + private ResiGroupMemberService resiGroupMemberService; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private ResiGroupService resiGroupService; + @Autowired + private ResiGroupMemberRedis resiGroupMemberRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GroupLeaderTransferRecordDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GroupLeaderTransferRecordDTO.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 GroupLeaderTransferRecordDTO get(String id) { + GroupLeaderTransferRecordEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GroupLeaderTransferRecordDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GroupLeaderTransferRecordDTO dto) { + GroupLeaderTransferRecordEntity entity = ConvertUtils.sourceToTarget(dto, GroupLeaderTransferRecordEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GroupLeaderTransferRecordDTO dto) { + GroupLeaderTransferRecordEntity entity = ConvertUtils.sourceToTarget(dto, GroupLeaderTransferRecordEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 确认转让组-(工作端通用) + * @Date 2021/3/30 10:11 + **/ + @Transactional(rollbackFor = Exception.class) + @Override + public void confirmTransfer(ConfirmTransferFormDTO formDTO) { + //原组长 + ResiGroupMemberDTO originalLeader = resiGroupMemberService.getGroupLeader(formDTO.getGroupId()); + if(formDTO.getNewLeaderUserId().equals(originalLeader.getCustomerUserId())){ + log.warn("候选人已经是组长"); + return; + } + //如果是居民端转让组,只能是当前组长操作 + if (ModuleConstant.APP_RESI.equals(formDTO.getType())) { + //当前用户如果不是组长,不允许提交 + if (!originalLeader.getCustomerUserId().equals(formDTO.getCurrentUserId())) { + //只有组长才可以操作 + throw new RenException(EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getCode(),EpmetErrorCode.GROUP_LEADER_CAN_EDIT_GROUP_INFO.getMsg()); + } + } + originalLeader.setGroupLeaderFlag(LeaderFlagConstant.GROUP_MEMBER); + resiGroupMemberService.update(originalLeader); + + //新组长赋值为组员 + ResiGroupMemberDTO newLeader=resiGroupMemberService.getResiGroupMember(formDTO.getGroupId(),formDTO.getNewLeaderUserId()); + newLeader.setGroupLeaderFlag(LeaderFlagConstant.GROUP_LEADER); + resiGroupMemberService.update(newLeader); + + //插入日志表 + GroupLeaderTransferRecordEntity entity = new GroupLeaderTransferRecordEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setGroupId(formDTO.getGroupId()); + //原组长userId + entity.setOriginalLeader(originalLeader.getCustomerUserId()); + entity.setNewLeader(formDTO.getNewLeaderUserId()); + entity.setType(formDTO.getType()); + insert(entity); + //发送站内信 + saveUserMessage(formDTO,originalLeader.getCustomerUserId()); + //新组长、原组长成员缓存更新 + this.updateGroupMemberInfo(originalLeader.getCustomerUserId(),formDTO.getNewLeaderUserId(),formDTO.getGroupId()); + } + + /** + * @return void + * @param originalLeaderUserId + * @param newLeaderUserId + * @param groupId + * @author yinzuomei + * @description 先删缓存,后查(没有会查数据库同时放进缓存) + * @Date 2021/3/31 10:09 + **/ + private void updateGroupMemberInfo(String originalLeaderUserId, String newLeaderUserId, String groupId) { + resiGroupMemberRedis.deleteMemberCatche(groupId,originalLeaderUserId); + resiGroupMemberRedis.deleteMemberCatche(groupId,newLeaderUserId); + resiGroupMemberRedis.get(groupId,originalLeaderUserId); + resiGroupMemberRedis.get(groupId,newLeaderUserId); + } + + private void saveUserMessage(ConfirmTransferFormDTO formDTO,String originalLeaderUserId) { + ResiGroupDTO resiGroupDTO=resiGroupService.get(formDTO.getGroupId()); + //组长自己操作: + //组长将组转给组员后,成为组长的组员收到站内信“您有一条小组消息 您已成为【某某小组】的组长,请查看。 + //工作人员操作: + //工作人员将组转给组员后,成为组长的组员收到站内信“您有一条小组消息 您已成为【某某小组】的组长,请查看。 + // 原组长收到站内信“您有一条小组消息 您已失去【某某小组】的组长身份,请查看。 + List msgList=new ArrayList<>(); + if(ModuleConstant.APP_GOV.equals(formDTO.getType())){ + //原组长 + UserMessageFormDTO originalLeader = new UserMessageFormDTO(); + originalLeader.setUserId(originalLeaderUserId); + originalLeader.setTitle(UserMessageConstant.GROUP_TITLE); + originalLeader.setReadFlag(ModuleConstant.UNREAD); + originalLeader.setApp(ModuleConstant.APP_RESI); + //小组所属的网格 + originalLeader.setGridId(resiGroupDTO.getGridId()); + originalLeader.setCustomerId(formDTO.getCustomerId()); + originalLeader.setMessageContent(String.format(UserMessageConstant.ORIGINAL_LEADER_DOWN,resiGroupDTO.getGroupName())); + + msgList.add(originalLeader); + } + //新组长 + UserMessageFormDTO newLeader = new UserMessageFormDTO(); + newLeader.setUserId(formDTO.getNewLeaderUserId()); + newLeader.setTitle(UserMessageConstant.GROUP_TITLE); + newLeader.setReadFlag(ModuleConstant.UNREAD); + newLeader.setApp(ModuleConstant.APP_RESI); + //小组所属的网格 + newLeader.setGridId(resiGroupDTO.getGridId()); + newLeader.setCustomerId(formDTO.getCustomerId()); + newLeader.setMessageContent(String.format(UserMessageConstant.NEW_LEADER_UP,resiGroupDTO.getGroupName())); + + msgList.add(newLeader); + if(!epmetMessageOpenFeignClient.saveUserMessageList(msgList).success()){ + log.warn("转让组发送站内信失败"); + } + } + +} \ No newline at end of file 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..7fd7e48259 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 @@ -35,7 +35,6 @@ import com.epmet.constant.ReadFlagConstant; import com.epmet.dto.IssueShareLinkVisitRecordDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.UserBaseInfoResultDTO; -import com.epmet.dto.result.UserBasicInfo; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; @@ -53,7 +52,6 @@ import com.epmet.modules.member.entity.ResiGroupMemberEntity; import com.epmet.modules.member.redis.ResiGroupMemberRedis; import com.epmet.modules.member.service.GroupMemeberOperationService; import com.epmet.modules.member.service.ResiGroupMemberService; -import com.epmet.modules.topic.dao.ResiTopicDao; import com.epmet.modules.topic.entity.TopicShareLinkVisitRecordEntity; import com.epmet.modules.topic.service.ResiTopicService; import com.epmet.modules.topic.service.TopicShareLinkVisitRecordService; @@ -70,8 +68,8 @@ import com.epmet.resi.group.dto.group.ResiGroupStatisticalInfoRedisDTO; import com.epmet.resi.group.dto.member.GroupMemeberOperationDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberDTO; import com.epmet.resi.group.dto.member.ResiGroupMemberInfoRedisDTO; -import com.epmet.resi.group.dto.member.form.*; import com.epmet.resi.group.dto.member.form.CommonGridIdListFormDTO; +import com.epmet.resi.group.dto.member.form.*; import com.epmet.resi.group.dto.member.result.ApplyingMemberResultDTO; import com.epmet.resi.group.dto.member.result.GridVotableCountResultDTO; import com.epmet.resi.group.dto.member.result.GroupMemberListResultDTO; @@ -226,7 +224,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl + * @author yinzuomei + * @description 查询当前用户被移出群的记录,按创建时间降序 + * @Date 2021/4/6 12:48 + **/ + @Override + public List queryMemberRemovedRecs(String groupId, String userId) { + return baseDao.queryMemberRemovedRecs(groupId,userId); + } + /** * @param groupMemberListFormDTO * @return com.epmet.commons.tools.utils.Result @@ -804,9 +839,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/java/com/epmet/modules/topic/dao/ResiTopicCommentDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentDao.java index 57ef0adc97..36b7513617 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicCommentDao.java @@ -67,4 +67,17 @@ public interface ResiTopicCommentDao extends BaseDao { * @date 2020/12/23 上午11:09 */ Integer selectCommentCountByUserId(@Param("userId") String userId); + + /** + * @Description 查询本小组内自己评论过的别人发表的话题Id集合 + * @author sun + */ + List selectTopicIds(@Param("groupId") String groupId, @Param("userId") String userId); + + /** + * @Description 屏蔽自己发表的话题且自己评论过的评论 + * @author sun + */ + void upTopicCommentList(@Param("delIdList") List delIdList, @Param("userId") String userId, @Param("operateUserId") String operateUserId); + } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java index ebbab2046a..abc817659d 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/dao/ResiTopicDao.java @@ -212,4 +212,16 @@ public interface ResiTopicDao extends BaseDao { String selectCustomerIdByTopicId(@Param("topicId")String topicId); ResiTopicDTO selectByIssueId(@Param("issueId") String issueId); + + /** + * @Description 查询当前小组里被删除人员创建的话题还未转为议题并且是讨论中的话题数据 + * @author sun + */ + List selectIdList(@Param("groupId") String groupId, @Param("userId") String userId); + + /** + * @Description 批量修改话题状态 + * @author sun + */ + int upTopicList(@Param("delIdList") List delIdList, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java index fbb9b92955..c930e96965 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicCommentServiceImpl.java @@ -397,15 +397,17 @@ public class ResiTopicCommentServiceImpl extends BaseServiceImpl + + + + UPDATE group_memeber_operation + SET operate_status = 'removed', + operate_user_id = #{operateUserId}, + updated_by = #{operateUserId}, + updated_time = NOW() + WHERE + group_id = #{groupId} + AND customer_user_id = #{customerUserId} + ORDER BY + created_time DESC + LIMIT 1 + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml index 92408b540b..183de49bad 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/member/ResiGroupMemberDao.xml @@ -69,7 +69,6 @@ resi_group_member rgm WHERE rgm.DEL_FLAG = '0' - AND rgm.ENTER_GROUP_TYPE = 'created' AND rgm.GROUP_LEADER_FLAG = 'leader' AND rgm.RESI_GROUP_ID = #{groupId} @@ -165,4 +164,31 @@ AND RESI_GROUP_ID = #{groupId} AND `STATUS` = 'approved' + + + + UPDATE resi_group_member + SET del_flag = '1', + status = 'removed' + WHERE + resi_group_id = #{groupId} + AND customer_user_id = #{userId} + ORDER BY + created_time DESC + LIMIT 1 + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentDao.xml index 87f46e1efc..21a0456e9f 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicCommentDao.xml @@ -54,20 +54,20 @@ + + + + + UPDATE resi_topic_comment + SET `status` = 'hidden', + updated_by = #{operateUserId}, + updated_time = NOW() + WHERE + del_flag = '0' + AND created_by = #{userId} + + topic_id = #{topicId} + + + diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml index c43610feb9..a527b720ef 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/mapper/topic/ResiTopicDao.xml @@ -576,5 +576,32 @@ where rt.DEL_FLAG='0' and rt.ISSUE_ID=#{issueId} + + + + + + UPDATE resi_topic + SET status = 'hidden', + updated_by = #{userId}, + updated_time = NOW() + WHERE + del_flag = '0' + + id = #{id} + + + diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/UserAccessServiceImpl.java b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/UserAccessServiceImpl.java index 3aea2fc5ee..1b1aa4c53d 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/UserAccessServiceImpl.java +++ b/epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/service/impl/UserAccessServiceImpl.java @@ -3,7 +3,6 @@ package com.epmet.service.impl; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; -import com.epmet.constant.StrangerResiGuideConstant; import com.epmet.dto.form.EnterGridFormDTO; import com.epmet.dto.form.UserEnterGridFormDTO; import com.epmet.dto.result.UserInfoOnEnterGridResultDTO; @@ -38,26 +37,6 @@ public class UserAccessServiceImpl implements UserAccessService { userInfoParams.setGridId(formDTO.getGridId()); Result userInfoResult = epmetUserFeignClient.getUserInfoAndRoles(userInfoParams); - if(userInfoResult.success()){ - //2:调用epmet-user服务查询数据 新建网格记录数据 - /*VisitedFormDTO visitedFormDTO = new VisitedFormDTO(); - visitedFormDTO.setGridId(userInfoParams.getGridId()); - visitedFormDTO.setCustomerId(userInfoParams.getCustomerId()); - visitedFormDTO.setUserId(userInfoParams.getUserId()); - if(null != userInfoResult.getData().getUserRoleList() && userInfoResult.getData().getUserRoleList().size() > 0){ - visitedFormDTO.setIsReg(NumConstant.ONE_STR); - }else{ - visitedFormDTO.setIsReg(NumConstant.ZERO_STR); - } - Result re = epmetUserFeignClient.saveVisitedRecord(visitedFormDTO); - if (!re.success()) { - log.warn(StrangerResiGuideConstant.EPMET_USER_EXCEPTION); - }*/ - }else{ - //getUserInfoAndRoles调用失败 - log.warn(StrangerResiGuideConstant.EPMET_USER_EXCEPTION); - } - return userInfoResult; } } diff --git a/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml b/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml index 4d85502367..a8a75e8d97 100644 --- a/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-guide/resi-guide-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /resi/guide @@ -100,7 +101,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: @@ -129,4 +130,4 @@ dingTalk: shutdown: graceful: enable: true #是否开启优雅停机 - waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 \ No newline at end of file + waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 diff --git a/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml b/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml index 12c7a97693..19a4ef53b8 100644 --- a/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-hall/resi-hall-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /resi/hall @@ -56,7 +57,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: diff --git a/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml b/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml index ec830e5a69..72ede48632 100644 --- a/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-home/resi-home-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /resi/home @@ -55,7 +56,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/advice/controller/AdviceController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/advice/controller/AdviceController.java index b9af883a21..45e2274be3 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/advice/controller/AdviceController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/advice/controller/AdviceController.java @@ -1,6 +1,5 @@ package com.epmet.modules.advice.controller; -import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.MyAdviceListFormDTO; @@ -14,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; -import java.util.Map; /** * @description: 用户建议controller @@ -27,9 +25,6 @@ public class AdviceController { @Autowired private AdviceService adviceService; - @Autowired - private LoginUserUtil loginUserUtil; - /** * @Description 提交建议 * @param dto diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java index 985b869cc8..1f09936352 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/EpmetUserFeignClient.java @@ -11,10 +11,7 @@ import com.epmet.modules.feign.fallback.EpmetUserFeignClientFallBack; import com.epmet.resi.mine.dto.from.MyResiUserInfoFormDTO; import com.epmet.resi.mine.dto.result.MyResiUserInfoResultDTO; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.*; import java.util.List; @@ -64,7 +61,7 @@ public interface EpmetUserFeignClient { * @Author sun **/ @PostMapping(value = "epmetuser/gridlatest/getgridsbyuserid/{userId}") - Result> getGridsByUserId(@PathVariable("userId") String userId); + Result> getGridsByUserId(@PathVariable("userId") String userId,@RequestParam("customerId") String customerId); /** * @Description 居民端获取个人信息 diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java index d4e41a1bf7..781cf39d24 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/feign/fallback/EpmetUserFeignClientFallBack.java @@ -72,8 +72,8 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { * @Author sun **/ @Override - public Result> getGridsByUserId(String userId) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getGridsByUserId", userId); + public Result> getGridsByUserId(String userId,String customerId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getGridsByUserId", userId,customerId); } /** diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java index 7ea7b24f3d..606d4d9d44 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/controller/ResiMineGridController.java @@ -45,7 +45,7 @@ public class ResiMineGridController { **/ @PostMapping("allgrids") public Result> allGrids(@LoginUser TokenDto tokenDto){ - return resiMineGridService.allGrids(tokenDto.getUserId()); + return resiMineGridService.allGrids(tokenDto.getUserId(),tokenDto.getCustomerId()); } /** diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java index e6d8a70398..994f21fa31 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/ResiMineGridService.java @@ -29,7 +29,7 @@ public interface ResiMineGridService { * @Description 获取用户访问过的所有网格列表 * @Author sun **/ - Result> allGrids(String userId); + Result> allGrids(String userId,String customerId); /** * @return diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java index 455b7c0cbf..de5e28a457 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/grid/service/impl/ResiMineGridServiceImpl.java @@ -76,10 +76,10 @@ public class ResiMineGridServiceImpl implements ResiMineGridService { * @Author sun **/ @Override - public Result> allGrids(String userId) { + public Result> allGrids(String userId,String customerId) { Result> result = new Result>(); //1:调用epmet-user服务,根据用户Id查询用户访问过的网格列表Id集合 - Result> resultGridIds = epmetUserFeignClient.getGridsByUserId(userId); + Result> resultGridIds = epmetUserFeignClient.getGridsByUserId(userId,customerId); if (!resultGridIds.success()) { throw new RenException(ModuleConstant.SELECT_EXCEPTION); } diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml b/epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml index 7ba08a2040..7257f2ea6f 100644 --- a/epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-mine/resi-mine-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /resi/mine @@ -83,7 +84,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedApplyController.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedApplyController.java index e2da03019c..67d5b26038 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedApplyController.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/controller/ResiWarmheartedApplyController.java @@ -138,7 +138,7 @@ public class ResiWarmheartedApplyController { @PostMapping("approve") public Result approve(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmAuditApproveFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - return resiWarmheartedApplyService.approve(formDTO); + return resiWarmheartedApplyService.approve(tokenDTO, formDTO); } /** @@ -160,7 +160,7 @@ public class ResiWarmheartedApplyController { @PostMapping("getdetail") public Result getDetail(@LoginUser TokenDto tokenDTO, @RequestBody ResiWarmGetDetailFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - return resiWarmheartedApplyService.getDetail(formDTO); + return resiWarmheartedApplyService.getDetail(tokenDTO, formDTO); } /** diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java index 7bd90437b1..b3c9498380 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/ResiWarmheartedApplyService.java @@ -19,6 +19,7 @@ package com.epmet.modules.warmhearted.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.modules.warmhearted.entity.ResiWarmheartedApplyEntity; import com.epmet.resi.partymember.dto.warmhearted.ResiWarmheartedApplyDTO; @@ -140,7 +141,7 @@ public interface ResiWarmheartedApplyService extends BaseService getDetail(ResiWarmGetDetailFormDTO formDTO); + Result getDetail(TokenDto tokenDTO, ResiWarmGetDetailFormDTO formDTO); /** * @param gridIdList diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java index 233a81d423..cc9dfa5198 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/warmhearted/service/impl/ResiWarmheartedApplyServiceImpl.java @@ -20,13 +20,11 @@ package com.epmet.modules.warmhearted.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.AppClientConstant; -import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.*; 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.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.PartyMemberConstant; @@ -155,8 +153,13 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl result1 = epmetUserFeignClient.getUserResiInfoDTO(userResiInfoFormDTO); if (!result1.success() || null == result1.getData()) { - result.setCode(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); - result.setMsg(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg()); + if (StrConstant.SPECIAL_CUSTOMER.equals(formDTO.getCustomerId())) { + result.setCode(8201); + result.setMsg("请完善学员信息"); + } else { + result.setCode(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); + result.setMsg(EpmetErrorCode.CANNOT_AUDIT_WARM.getMsg()); + } return result; } //1:热心居民申请行为记录表新增数据 @@ -200,7 +203,12 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl msgList = new ArrayList<>(); @@ -487,7 +523,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl getDetail(ResiWarmGetDetailFormDTO formDTO) { + public Result getDetail(TokenDto tokenDTO, ResiWarmGetDetailFormDTO formDTO) { Result result = new Result<>(); //1:根据申请Id查询热心居民申请审核详情 ResiWarmheartedApplyEntity entity = baseDao.selectById(formDTO.getApplyId()); if (null == entity) { - result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); + if (StrConstant.SPECIAL_CUSTOMER.equals(tokenDTO.getCustomerId())) { + result.error("根据申请Id未查询到组长申请详情信息"); + } else { + result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); + } return result; } //2:修改申请数据状态为已读 @@ -518,7 +562,11 @@ public class ResiWarmheartedApplyServiceImpl extends BaseServiceImpl resultUserInfo = epmetUserFeignClient.getUserResiInfoDTO(userResiInfoFormDTO); if (!resultUserInfo.success() || null == resultUserInfo.getData()) { - result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); + if (StrConstant.SPECIAL_CUSTOMER.equals(tokenDTO.getCustomerId())) { + result.error("根据申请Id未查询到组长申请详情信息"); + } else { + result.error(ResiWarmheartedVisitConstant.SELECT_EXCEPTION); + } return result; } UserResiInfoResultDTO userInfo = resultUserInfo.getData(); diff --git a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/bootstrap.yml b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/bootstrap.yml index efd4689143..0978c177e1 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-partymember/resi-partymember-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /resi/partymember @@ -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/resi-voice/resi-voice-server/src/main/resources/bootstrap.yml b/epmet-module/resi-voice/resi-voice-server/src/main/resources/bootstrap.yml index cbac285587..9d398946ba 100644 --- a/epmet-module/resi-voice/resi-voice-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-voice/resi-voice-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /resi/voice @@ -51,7 +52,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true hystrix: diff --git a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml index 247b417689..0bd40dcca7 100644 --- a/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml +++ b/epmet-openapi/epmet-openapi-adv/epmet-openapi-adv-server/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /adv @@ -112,7 +113,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true @@ -136,4 +137,4 @@ pagehelper: dingTalk: robot: webHook: @dingTalk.robot.webHook@ - secret: @dingTalk.robot.secret@ \ No newline at end of file + secret: @dingTalk.robot.secret@ diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/RSASignature.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/RSASignature.java deleted file mode 100644 index c79906908d..0000000000 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/util/RSASignature.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.epmet.openapi.scan.common.util; - -import org.apache.commons.codec.binary.Base64; -import org.bouncycastle.util.encoders.UrlBase64; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.crypto.Cipher; -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.security.KeyFactory; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.Signature; -import java.security.cert.Certificate; -import java.security.cert.CertificateFactory; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; - -/** - * @author jianjun liu - * @date 2020-06-05 16:48 - **/ - -public class RSASignature { - private static final Logger LOGGER = LoggerFactory.getLogger(RSASignature.class); - public static final String KEY_ALGORITHM = "RSA"; - public static final String SIGNATURE_ALGORITHM = "SHA1WithRSA"; - public static final String ENCODING = "utf-8"; - public static final String X509 = "X.509"; - - /** - * 获取私钥 - * - * @param key - * @return - * @throws Exception - */ - public static PrivateKey getPrivateKey(String key) throws Exception { - byte[] keyBytes = Base64.decodeBase64(key.getBytes(ENCODING)); - PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes); - KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); - PrivateKey privateKey = keyFactory.generatePrivate(keySpec); - return privateKey; - } - - /** - * 获取公钥 - * - * @param key - * @return - * @throws Exception - */ - public static PublicKey getPublicKey(String key) throws Exception { - byte[] keyBytes = Base64.decodeBase64(key.getBytes(ENCODING)); - CertificateFactory certificateFactory = CertificateFactory.getInstance(X509); - InputStream in = new ByteArrayInputStream(keyBytes); - Certificate certificate = certificateFactory.generateCertificate(in); - PublicKey publicKey = certificate.getPublicKey(); - return publicKey; - } - - /** - * 使用公钥对明文进行加密,返回BASE64编码的字符串 - * - * @param publicKey - * @param plainText - * @return - */ - public static String encrypt(String publicKey, String plainText) { - try { - KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); - byte[] encodedKey = Base64.decodeBase64(publicKey.getBytes(ENCODING)); - PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); - Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); - cipher.init(Cipher.ENCRYPT_MODE, pubKey); - byte[] enBytes = cipher.doFinal(plainText.getBytes()); - return new String(Base64.encodeBase64(enBytes)); - } catch (Exception e) { - LOGGER.error("rsa encrypt exception: {}", e.getMessage(), e); - } - return null; - } - - /** - * 使用私钥对明文密文进行解密 - * - * @param privateKey - * @param enStr - * @return - */ - public static String decrypt(String privateKey, String enStr) { - try { - PrivateKey priKey = getPrivateKey(privateKey); - Cipher cipher = Cipher.getInstance(KEY_ALGORITHM); - cipher.init(Cipher.DECRYPT_MODE, priKey); - byte[] deBytes = cipher.doFinal(Base64.decodeBase64(enStr)); - return new String(deBytes); - } catch (Exception e) { - LOGGER.error("rsa decrypt exception: {}", e.getMessage(), e); - } - return null; - } - - /** - * RSA私钥签名 - * - * @param content 待签名数据 - * @param privateKey 私钥 - * @return 签名值 - */ - public static String signByPrivateKey(String content, String privateKey) { - try { - PrivateKey priKey = getPrivateKey(privateKey); - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initSign(priKey); - signature.update(content.getBytes(ENCODING)); - byte[] signed = signature.sign(); - return new String(UrlBase64.encode(signed), ENCODING); - } catch (Exception e) { - LOGGER.error("sign error, content: {}", content, e); - } - return null; - } - - /** - * 公钥验签 - * - * @param content - * @param sign - * @param publicKey - * @return - */ - public static boolean verifySignByPublicKey(String content, String sign, String publicKey) { - try { - KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); - byte[] encodedKey = Base64.decodeBase64(publicKey.getBytes(ENCODING)); - PublicKey pubKey = keyFactory.generatePublic(new X509EncodedKeySpec(encodedKey)); - - Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); - signature.initVerify(pubKey); - signature.update(content.getBytes(ENCODING)); - - return signature.verify(UrlBase64.decode(sign.getBytes(ENCODING))); - - } catch (Exception e) { - LOGGER.error("verify sign error, content: {}, sign: {}", content, sign, e); - } - return false; - } - -} diff --git a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml index e9de135959..0aa0583c97 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml +++ b/epmet-openapi/epmet-openapi-scan/src/main/resources/bootstrap.yml @@ -1,5 +1,6 @@ server: port: @server.port@ + version: @version@ servlet: context-path: /epmetscan @@ -54,7 +55,7 @@ feign: config: default: loggerLevel: BASIC - httpclient: + okhttp: enabled: true diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java index b4dae41cbd..ef4b246fc4 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SubmitAdviceFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.form; import lombok.Data; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.Pattern; import java.io.Serializable; import java.util.List; @@ -36,6 +37,7 @@ public class SubmitAdviceFormDTO implements Serializable { /** * 电话号码可为空 存*,不为空需校验 */ + @Pattern(regexp = "^1[3456789]\\d{9}$", message = "请输入正确的手机号") private String phone; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index d48703ffb4..5f5ae5b5ce 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -486,4 +486,23 @@ public interface EpmetUserOpenFeignClient { */ @PostMapping(value = "/epmetuser/user/saveuserinfo") Result saveUserInfo(@RequestBody UserInfoFormDTO formDTO); + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param customerId + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:35 + **/ + @GetMapping(value = "/epmetuser/govstaffrole/querycustomergovrolelist/{customerId}") + Result> queryCustomerGovRoleList(@PathVariable("customerId")String customerId); + + /** + * @return UserRoleResultDTO + * @Description 根据用户Id、来源app、客户Id查询用户角色 + * @Param userRoleFormDTO + * @Author sun + **/ + @PostMapping(value = "/epmetuser/userrole/getuserroleinfo") + Result> getUserRoleInfo(@RequestBody UserRoleFormDTO userRoleFormDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 195f1a0c38..328b98f1f3 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -337,8 +337,25 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveUserInfo", formDTO); } + /** + * @param customerId + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:35 + **/ + @Override + public Result> queryCustomerGovRoleList(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryCustomerGovRoleList", customerId); + } + @Override public Result initGovStaffRolesForCustomer(String customerId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initGovStaffRolesForCustomer", customerId); } + + @Override + public Result> getUserRoleInfo(UserRoleFormDTO userRoleFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfo", userRoleFormDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java index 2214369866..1e91d3cb14 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserConstant.java @@ -85,4 +85,16 @@ public interface UserConstant { * user_wechat表更新数据失败 */ String UPDATE_USER_WECHAT = "更新用户微信信息失败"; + /** + * 先生 + */ + String MAN = "先生"; + /** + * 女士 + */ + String WOMAN = "女士"; + /** + * 先生/女士 + */ + String MAN_WOMAN = "先生/女士"; } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java deleted file mode 100644 index c21ba28c1f..0000000000 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/constant/UserRedisKeys.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.epmet.constant; - -import org.apache.commons.lang3.StringUtils; - -/** - * @Description - * @ClassName UserRedisKeys - * @Auth wangc - * @Date 2020-07-22 17:16 - */ -public class UserRedisKeys { - - /** - * 党群e事通redis前缀 - */ - private static String rootPrefix = "epmet:"; - - /** - * @Description 用户缓存Key - * @Param 用户Id - * @return epmet:resi:user:userId - * @Author wangc - * @Date 2020.04.13 11:27 - **/ - public static String getResiUserKey(String userId){ - return rootPrefix.concat("resi:user:").concat(userId); - } - - /** - * @Description 用户勋章缓存 epmet:badge:user:[customerId]:[userId] - * @param userId - * @return epmet:badge:user:[customerId]:[userId] - * @author wangc - * @date 2020.11.05 13:34 - */ - public static String getResiUserBadgeKey(String customerId,String userId){ - return rootPrefix.concat("badge:user:").concat(customerId).concat(":").concat( StringUtils.isBlank(userId) ? "*" : userId );} -} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java index 40cab6cb5a..37df7c9140 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java @@ -9,6 +9,7 @@ import com.epmet.dto.form.GovStaffRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; +import com.epmet.dto.result.RoleInfoResultDTO; import com.epmet.service.GovStaffRoleService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; @@ -112,4 +113,15 @@ public class GovStaffRoleController { return new Result>().ok(roles); } + /** + * @return com.epmet.commons.tools.utils.Result> + * @param customerId + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:37 + **/ + @GetMapping("querycustomergovrolelist/{customerId}") + Result> queryCustomerGovRoleList(@PathVariable("customerId") String customerId){ + return new Result>().ok(govStaffRoleService.queryCustomerGovRoleList(customerId)); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java index ba8fd626ce..c470d793a9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java @@ -114,8 +114,8 @@ public class GridLatestController { * @Author sun **/ @PostMapping("getgridsbyuserid/{userId}") - public Result> getGridsByUserId(@PathVariable("userId") String userId){ - return gridLatestService.getGridsByUserId(userId); + public Result> getGridsByUserId(@PathVariable("userId") String userId,@RequestParam("customerId") String customerId){ + return gridLatestService.getGridsByUserId(userId,customerId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java index e33e672739..8ad9e5da00 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserAdviceController.java @@ -25,8 +25,8 @@ 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.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.UserAdviceDTO; import com.epmet.dto.form.AdviceListFormDTO; import com.epmet.dto.form.MyAdviceListFormDTO; @@ -47,7 +47,6 @@ import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; -import java.util.regex.Pattern; /** @@ -181,11 +180,7 @@ public class UserAdviceController { @PostMapping("submitadvice") public Result submitAdvice(@RequestBody SubmitAdviceFormDTO dto){ ValidatorUtils.validateEntity(dto); - if (StringUtils.isNotBlank(dto.getPhone())){ - if (!Pattern.matches("^1[3456789]\\d{9}$",dto.getPhone())){ - throw new RenException("手机号格式错误"); - } - }else { + if (StringUtils.isBlank(dto.getPhone())) { dto.setPhone("*"); } userAdviceService.submitAdvice(dto,loginUserUtil.getLoginUserId()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java index e4f54f6aa7..41e4a1114a 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserResiInfoController.java @@ -33,7 +33,6 @@ import com.epmet.dto.result.IssueInitiatorResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.excel.UserResiInfoExcel; import com.epmet.service.UserResiInfoService; -import jdk.nashorn.internal.parser.Token; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -202,6 +201,16 @@ public class UserResiInfoController { return new Result(); } + /** + * @Description 在分享链接之后完成注册居民之后调用的接口 + * 作用 + * + * 更改邀请浏览记录里"是否通过邀请链接注册居民" + * @param param + * @return void + * @author wangc + * @date 2020.12.18 16:34 + */ @PostMapping("submitinlink") public Result submitInLink(@RequestBody AfterRegisterResidentInSharableLinkFormDTO param, @LoginUser TokenDto token){ param.setInviteeId(token.getUserId()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java index 84450fc6f1..979ac85a5f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java @@ -55,7 +55,7 @@ public interface GridLatestDao extends BaseDao { * @Description 根据用户Id查询用户访问过的网格列表Id集合 * @Author sun **/ - List selectAllGridsByUserId(@Param("userId") String userId); + List selectAllGridsByUserId(@Param("userId") String userId,@Param("customerId") String customerId); /** * @Description 查询一个客户下的所有用户:注册居民、陌生人 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java index 4570711923..160e1a4afc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/RegisterRelationDao.java @@ -18,11 +18,11 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.RegisterRelationDTO; import com.epmet.entity.RegisterRelationEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; + import java.util.List; /** @@ -44,4 +44,15 @@ public interface RegisterRelationDao extends BaseDao { * @date 2020.07.23 15:31 **/ RegisterRelationEntity selectRegisteredGridIdByUserId(@Param("userId") String userId); + + + RegisterRelationEntity selectRegisteredGridIdByUserIdAndCustomerId(@Param("userId") String userId, @Param("customerId")String customerId); + + /** + * @Description 根据userId查询注册网格ID + * @Param userId + * @author zxc + * @date 2021/3/16 下午3:05 + */ + String selectRegisterGridIdByUserId(@Param("userId")String userId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java index d29a25ec0f..0ffa41aaa0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java @@ -1,13 +1,12 @@ package com.epmet.redis; - import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.constant.BadgeConstant; -import com.epmet.constant.UserRedisKeys; import com.epmet.dao.BadgeDao; import com.epmet.dto.form.UserBadgeUnitFormDTO; import com.epmet.dto.result.UserBadgeInfoResultDTO; @@ -110,7 +109,7 @@ public class UserBadgeRedis { */ public List obtainUserBadge2List(String userId,String customerId) { List cache = - redisUtils.lrange(UserRedisKeys.getResiUserBadgeKey(customerId,userId), NumConstant.ZERO, NumConstant.ONE_NEG, UserBadgeUnitFormDTO.class); + redisUtils.lrange(RedisKeys.getResiUserBadgeKey(customerId, userId), NumConstant.ZERO, NumConstant.ONE_NEG, UserBadgeUnitFormDTO.class); if(!CollectionUtils.isEmpty(cache)) return cache; //补偿 cache = badgeService.getUserSortedBadge(userId,customerId); @@ -118,7 +117,7 @@ public class UserBadgeRedis { final List sortedBadges = cache; redisTemplate.executePipelined((RedisCallback>) connection ->{ sortedBadges.forEach(badge -> { - connection.listCommands().rPush(UserRedisKeys.getResiUserBadgeKey(customerId, userId).getBytes(), + connection.listCommands().rPush(RedisKeys.getResiUserBadgeKey(customerId, userId).getBytes(), redisTemplate.getValueSerializer().serialize(badge)); }); return null; @@ -142,7 +141,7 @@ public class UserBadgeRedis { List cacheBlank = new LinkedList<>(); userIds.forEach(userId -> { List badges = - redisUtils.lrange(UserRedisKeys.getResiUserBadgeKey(customerId,userId), NumConstant.ZERO, NumConstant.ONE_NEG, UserBadgeUnitFormDTO.class); + redisUtils.lrange(RedisKeys.getResiUserBadgeKey(customerId, userId), NumConstant.ZERO, NumConstant.ONE_NEG, UserBadgeUnitFormDTO.class); if(CollectionUtils.isEmpty(badges)){cacheBlank.add(userId);}else{result.put(userId,badges);} }); if(!CollectionUtils.isEmpty(cacheBlank)){ @@ -158,7 +157,7 @@ public class UserBadgeRedis { redisTemplate.executePipelined((RedisCallback>) connection ->{ covert.forEach(badge -> { - connection.listCommands().rPush(UserRedisKeys.getResiUserBadgeKey(customerId, k).getBytes(), + connection.listCommands().rPush(RedisKeys.getResiUserBadgeKey(customerId, k).getBytes(), redisTemplate.getValueSerializer().serialize(badge)); }); return null; @@ -179,14 +178,14 @@ public class UserBadgeRedis { */ public long pushOrRemoveUserBadge4List(String userId, String badgeId, String customerId) { if(StringUtils.isNotBlank(userId)) return illumeOrExtinguishStronglyConsistent(userId,customerId); - List orient = redisUtils.lrange(UserRedisKeys.getResiUserBadgeKey(customerId,userId), NumConstant.ZERO, NumConstant.ONE_NEG, UserBadgeUnitFormDTO.class); + List orient = redisUtils.lrange(RedisKeys.getResiUserBadgeKey(customerId, userId), NumConstant.ZERO, NumConstant.ONE_NEG, UserBadgeUnitFormDTO.class); UserBadgeUnitFormDTO unit = null; if (!CollectionUtils.isEmpty(orient)) { Optional opt = orient.stream().filter(badge -> StringUtils.equals(badgeId, badge.getBadgeId())).findFirst(); if (opt.isPresent()) { unit = opt.get(); - return redisUtils.lrem(UserRedisKeys.getResiUserBadgeKey(customerId, userId), NumConstant.ONE, unit); + return redisUtils.lrem(RedisKeys.getResiUserBadgeKey(customerId, userId), NumConstant.ONE, unit); } } @@ -207,7 +206,7 @@ public class UserBadgeRedis { if (poolOpt.isPresent()) unit = ConvertUtils.sourceToTarget(poolOpt.get(), UserBadgeUnitFormDTO.class); else return NumConstant.ZERO; } - redisUtils.leftPush(UserRedisKeys.getResiUserBadgeKey(customerId, userId), unit,-1); + redisUtils.leftPush(RedisKeys.getResiUserBadgeKey(customerId, userId), unit, -1); return NumConstant.ONE; } @@ -220,11 +219,11 @@ public class UserBadgeRedis { */ public long illumeOrExtinguishStronglyConsistent(String userId, String customerId){ List db = badgeService.getUserSortedBadge(userId,customerId); - redisUtils.delete(UserRedisKeys.getResiUserBadgeKey(customerId,userId)); + redisUtils.delete(RedisKeys.getResiUserBadgeKey(customerId, userId)); if(CollectionUtils.isNotEmpty(db)) { redisTemplate.executePipelined((RedisCallback>) connection -> { db.forEach(badge -> { - connection.listCommands().rPush(UserRedisKeys.getResiUserBadgeKey(customerId, userId).getBytes(), + connection.listCommands().rPush(RedisKeys.getResiUserBadgeKey(customerId, userId).getBytes(), redisTemplate.getValueSerializer().serialize(badge)); }); return null; @@ -241,7 +240,7 @@ public class UserBadgeRedis { * @date 2020.11.09 10:02 */ public void batchClearUserBadgeCache(String customerId){ - Set key = redisUtils.keys(UserRedisKeys.getResiUserBadgeKey(customerId, null)); + Set key = redisUtils.keys(RedisKeys.getResiUserBadgeKey(customerId, null)); if(CollectionUtils.isEmpty(key)) return; final Set keys = key; redisTemplate.executePipelined((RedisCallback) connection ->{ @@ -257,7 +256,7 @@ public class UserBadgeRedis { @Override public List doInRedis(RedisConnection connection) throws DataAccessException { connection.openPipeline(); - Set keys = connection.keys(redisTemplate.getKeySerializer().serialize(UserRedisKeys.getResiUserBadgeKey(customerId, null))); + Set keys = connection.keys(redisTemplate.getKeySerializer().serialize(RedisKeys.getResiUserBadgeKey(customerId, null))); return null; } },redisTemplate.getKeySerializer()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java index ec6d1eb485..25ea2917af 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBaseInfoRedis.java @@ -19,10 +19,10 @@ package com.epmet.redis; import cn.hutool.core.bean.BeanUtil; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.constant.UserRedisKeys; import com.epmet.dao.GridLatestDao; import com.epmet.dao.RegisterRelationDao; import com.epmet.dao.UserBaseInfoDao; @@ -80,7 +80,7 @@ public class UserBaseInfoRedis { **/ public void set(UserBaseInfoResultDTO baseInfo){ if(StringUtils.isBlank(baseInfo.getUserId())) return; - String key = UserRedisKeys.getResiUserKey(baseInfo.getUserId()); + String key = RedisKeys.getResiUserKey(baseInfo.getUserId()); //bean to map Map map = BeanUtil.beanToMap(baseInfo, false, true); //用户缓存的有效期为七天 @@ -90,7 +90,7 @@ public class UserBaseInfoRedis { public UserBaseInfoResultDTO get(String userId){ if(StringUtils.isNotBlank(userId)) { - Map map = redisUtils.hGetAll(UserRedisKeys.getResiUserKey(userId)); + Map map = redisUtils.hGetAll(RedisKeys.getResiUserKey(userId)); if (null != map && !map.isEmpty()) { //缓存中有数据,直接返回 return BeanUtil.mapToBean(map, UserBaseInfoResultDTO.class, true); @@ -110,7 +110,7 @@ public class UserBaseInfoRedis { public UserBaseInfoResultDTO getUserInfo(String userId){ if(StringUtils.isNotBlank(userId)){ //获取居民缓存key - Map map = redisUtils.hGetAll(UserRedisKeys.getResiUserKey(userId)); + Map map = redisUtils.hGetAll(RedisKeys.getResiUserKey(userId)); if(null != map && !map.isEmpty()) { //缓存中有数据,直接返回 return BeanUtil.mapToBean(map, UserBaseInfoResultDTO.class, true); @@ -190,6 +190,97 @@ public class UserBaseInfoRedis { return null; } + + /** + * @Description 缓存中获取用户基本信息 + * @param userId + * @return + * @author wangc + * @date 2020.07.23 14:58 + **/ + public UserBaseInfoResultDTO getUserInfo(String userId,String customerId){ + if(StringUtils.isNotBlank(userId)){ + //获取居民缓存key + Map map = redisUtils.hGetAll(RedisKeys.getResiUserKey(userId)); + if(null != map && !map.isEmpty()) { + //缓存中有数据,直接返回 + return BeanUtil.mapToBean(map, UserBaseInfoResultDTO.class, true); + } + //缓存中没有数据,先查数据库,放入缓存后再返回 + UserBaseInfoResultDTO baseInfo = userBaseInfoDao.selectListByUserIdList(userId); + + if(null != baseInfo && StringUtils.isNotBlank(baseInfo.getId())){ + + //如果没有首次注册网格,则没有网格名称(xx机关-xx网格)、显示昵称(xx网格-x先生/女士) + RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserIdAndCustomerId(userId,customerId); + if(null != relation && StringUtils.isNotBlank(relation.getGridId())){ + baseInfo.setCustomerId(relation.getCustomerId()); + BelongGridNameFormDTO gridParam = new BelongGridNameFormDTO(); + gridParam.setGridId(relation.getGridId()); + baseInfo.setRegisteredGridId(relation.getGridId()); + Result gridResult = + govOrgOpenFeignClient.getGridNameByGridId(gridParam); + if(gridResult.success() && null != gridResult.getData() + && StringUtils.isNotBlank(gridResult.getData().getBelongsGridName())){ + String gridFullName = gridResult.getData().getBelongsGridName(); + baseInfo.setRegisteredGridName(gridFullName); + StringBuffer buffer = new StringBuffer(gridFullName.split(ModuleConstant.DASH)[NumConstant.ONE]).append(ModuleConstant.DASH).append(baseInfo.getSurname()); + switch (baseInfo.getGender()) { + case NumConstant.ONE_STR: + buffer.append(ModuleConstant.RESI_USER_NICKNAME_SUFFIX_MALE); + break; + case NumConstant.TWO_STR: + buffer.append(ModuleConstant.RESI_USER_NICKNAME_SUFFIX_FEMALE); + break; + default: + buffer.append(ModuleConstant.RESI_USER_NICKNAME_SUFFIX_GENDER_UNKNOWN); + } + baseInfo.setShowName(buffer.toString()); + } + } + else{ + //如果没有居民注册记录,说明当前用户是陌生人,需要从陌生人网格访问列表中查询所属的客户Id + LatestGridInfoResultDTO gridLatest = + gridLatestDao.selectLatestGridInfoByUserId(userId); + if(null != gridLatest){ + baseInfo.setCustomerId(gridLatest.getCustomerId()); + } + } + set(baseInfo); + return baseInfo; + }else{ + //如果没有,说明这里是陌生人 + //陌生人不放入缓存,也不更新用户基础信息表 + baseInfo = new UserBaseInfoResultDTO(); + baseInfo.setUserId(userId); + List wechatInfo = userWechatDao.selectByUserId(userId); + if(null != wechatInfo && !wechatInfo.isEmpty()){ + baseInfo.setNickname(wechatInfo.get(NumConstant.ZERO).getNickname()); + if(StringUtils.isBlank(baseInfo.getNickname())){ + baseInfo.setNickname(ModuleConstant.EMPTY_STR); + } + }else{ + return null; + } + RegisterRelationEntity relation = registerRelationDao.selectRegisteredGridIdByUserIdAndCustomerId(userId,customerId); + if(null != relation && StringUtils.isNotBlank(relation.getGridId())){ + baseInfo.setCustomerId(relation.getCustomerId()); + }else{ + LatestGridInfoResultDTO gridLatest = + gridLatestDao.selectLatestGridInfoByUserId(userId); + if(null != gridLatest){ + baseInfo.setCustomerId(gridLatest.getCustomerId()); + } + } + } + + return baseInfo; + + } + + return null; + } + /** * @Description 更新缓存 * @param entity @@ -273,7 +364,7 @@ public class UserBaseInfoRedis { public void clearUserCache(List userIds){ userIds.forEach(id ->{ if(StringUtils.isNotBlank(id)) { - redisUtils.delete(UserRedisKeys.getResiUserKey(id)); + redisUtils.delete(RedisKeys.getResiUserKey(id)); } }); } @@ -298,4 +389,4 @@ public class UserBaseInfoRedis { } } } -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserResiInfoRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserResiInfoRedis.java index 1ce33a14da..d4fd65f10d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserResiInfoRedis.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserResiInfoRedis.java @@ -33,18 +33,6 @@ public class UserResiInfoRedis { @Autowired private RedisUtils redisUtils; - public void delete(Object[] ids) { - - } - - public void set(){ - - } - - public String get(String id){ - return null; - } - public void setUserResiMobileCode(String userId, String mobile, String verificationCode){ String key = RedisKeys.getResiRegisterMobileCodeKey(userId, mobile, verificationCode); //手机验证码放入缓存中 有效时间30分钟 @@ -61,4 +49,4 @@ public class UserResiInfoRedis { redisUtils.deleteByPattern(key); } -} \ No newline at end of file +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 346fad61b2..6ee17905c2 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -23,6 +23,7 @@ import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.ResiGovRoleListResultDTO; +import com.epmet.dto.result.RoleInfoResultDTO; import com.epmet.entity.GovStaffRoleEntity; import java.util.List; @@ -140,4 +141,13 @@ public interface GovStaffRoleService extends BaseService { void saveSortOrder(List roleIdList); List listRolesByRoleKey(String roleKey); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:37 + **/ + List queryCustomerGovRoleList(String customerId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java index 1395099c22..e9ff239d1e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java @@ -121,7 +121,7 @@ public interface GridLatestService extends BaseService { * @Description 根据用户Id查询用户访问过的网格列表Id集合 * @Author sun **/ - Result> getGridsByUserId(String userId); + Result> getGridsByUserId(String userId,String customerId); /** * @Description 查询客户下所有用户包括陌生人 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/RegisterRelationService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/RegisterRelationService.java index e40e9ea607..96814c5fce 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/RegisterRelationService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/RegisterRelationService.java @@ -112,4 +112,6 @@ public interface RegisterRelationService extends BaseService { **/ List queryUserBaseInfo(List userIdList); + /** + * @Description 查询用户信息 + * @Param userIdList + * @author zxc + * @date 2021/3/16 下午2:52 + */ + List queryUserBaseInfoPlus(List userIdList); + /** * @return void * @param diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index b42127bdbd..6be3f08be4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -20,20 +20,17 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.GovStaffRoleDao; import com.epmet.dao.GovStaffRoleTemplateDao; import com.epmet.dao.RoleDao; import com.epmet.dto.GovStaffRoleDTO; import com.epmet.dto.form.InitDefaultOperationsFormDTO; -import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.GovStaffRoleTemplateDTO; -import com.epmet.dto.result.ResiGovRoleListResultDTO; -import com.epmet.dto.result.ResiGovRoleResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.GovStaffRoleEntity; import com.epmet.feign.GovAccessFeignClient; import com.epmet.redis.GovStaffRoleRedis; @@ -243,4 +240,28 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRolesByRoleKey(String roleKey) { return govStaffRoleDao.listRolesByRoleKey(roleKey); } + + /** + * @param customerId + * @return java.util.List + * @author yinzuomei + * @description 获取当前客户下-工作端角色列表 + * @Date 2021/3/29 15:37 + **/ + @Override + public List queryCustomerGovRoleList(String customerId) { + List resultList=new ArrayList<>(); + GovStaffRoleDTO govStaffRoleDTO=new GovStaffRoleDTO(); + govStaffRoleDTO.setCustomerId(customerId); + List roleList = this.getGovStaffRoleList(govStaffRoleDTO); + roleList.forEach(role->{ + RoleInfoResultDTO resultDTO=new RoleInfoResultDTO(); + resultDTO.setFullTimeOnly(role.getFullTimeOnly()); + resultDTO.setRoleId(role.getId()); + resultDTO.setRoleName(role.getRoleName()); + resultDTO.setRoleKey(role.getRoleKey()); + resultList.add(resultDTO); + }); + return resultList; + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java index 46bd30dfff..e25a4600eb 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java @@ -176,8 +176,8 @@ public class GridLatestServiceImpl extends BaseServiceImpl> getGridsByUserId(String userId) { - List gridList = baseDao.selectAllGridsByUserId(userId); + public Result> getGridsByUserId(String userId,String customerId) { + List gridList = baseDao.selectAllGridsByUserId(userId,customerId); return new Result>().ok(gridList); } @@ -210,7 +210,7 @@ public class GridLatestServiceImpl extends BaseServiceImpl { if(StringUtils.isNotBlank(info.getUserId())){ - UserBaseInfoResultDTO cache = userBaseInfoRedis.getUserInfo(info.getUserId()); + UserBaseInfoResultDTO cache = userBaseInfoRedis.getUserInfo(info.getUserId(),customerUserFormDTO.getCustomerId()); if(null != cache) { info.setRegisteredGrid(StringUtils.isBlank(cache.getRegisteredGridName()) ? ModuleConstant.EMPTY_STR : cache.getRegisteredGridName()); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java index f8a78f8c14..ca7b3db589 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/RegisterRelationServiceImpl.java @@ -339,4 +339,9 @@ public class RegisterRelationServiceImpl extends BaseServiceImpl oneUserIds = new ArrayList<>(); oneUserIds.add(userId); - List userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(oneUserIds); + List userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfoPlus(oneUserIds); + log.info("user【"+userId+"】基本信息:"+userBaseInfoResultDTOS.toString()); if (!CollectionUtils.isEmpty(userIds)) { AtomicReference status = new AtomicReference<>(true); userIds.forEach(u -> { - if(u.equals(userId)){ + if(u.getUserId().equals(userId)){ status.set(false); } }); @@ -232,6 +233,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { badges.add(dto); }); } + log.info("即将插入的徽章信息:"+badges); resiUserBadgeDao.insertResiUserBadge(badges); } } @@ -342,7 +344,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { //居民端 CertificationDetailResultDTO resiResult = userBadgeDao.selectBadgeAuthRecord(tokenDto.getUserId(), certificationDetailFormDTO.getBadgeId(),certificationDetailFormDTO.getRecordId()); if(null == resiResult){ - UserBaseInfoResultDTO userInfo = userBaseInfoRedis.getUserInfo(tokenDto.getUserId()); + UserBaseInfoResultDTO userInfo = userBaseInfoRedis.getUserInfo(tokenDto.getUserId(),certificationDetailFormDTO.getCustomerId()); resiResult = ConvertUtils.sourceToTarget(userInfo,CertificationDetailResultDTO.class); if(null != resiResult) resiResult.setIdcard(userInfo.getIdNum()); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java index 2072097574..c93e6fd99c 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserBaseInfoServiceImpl.java @@ -17,6 +17,7 @@ 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.commons.mybatis.service.impl.BaseServiceImpl; @@ -40,6 +41,7 @@ import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.redis.UserBaseInfoRedis; import com.epmet.resi.partymember.dto.partymember.PartymemberInfoDTO; import com.epmet.resi.partymember.feign.ResiPartyMemberOpenFeignClient; +import com.epmet.service.RegisterRelationService; import com.epmet.service.UserBaseInfoService; import com.epmet.util.ModuleConstant; import org.apache.commons.lang3.StringUtils; @@ -77,6 +79,8 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl page(Map params) { @@ -147,7 +151,9 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl queryUserBaseInfoPlus(List userIdList) { + if (CollectionUtils.isEmpty(userIdList)){ + return new ArrayList<>(); + } + List result = new ArrayList<>(); + userIdList.forEach(id -> { + UserBaseInfoResultDTO baseInfo = userBaseInfoRedis.getUserInfo(id); + if (null != baseInfo && StringUtils.isEmpty(baseInfo.getRegisteredGridId())){ + String gridId = registerRelationService.selectRegisterGridIdByUserId(id); + if (StringUtils.isNotEmpty(gridId)){ + baseInfo.setRegisteredGridId(gridId); + }else { + throw new RenException("查询用户【"+id+"】所属网格失败"); + } + } + result.add(baseInfo); + }); + return result; + } + /** * @return void * @author yinzuomei @@ -350,6 +377,10 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl list = userWechatDao.selectByUserId(param.getUserId()); @@ -359,13 +390,13 @@ public class UserBaseInfoServiceImpl extends BaseServiceImpl govOrgResult = govOrgOpenFeignClient.userInfoExt(result); - if(govOrgResult.success() && null != govOrgResult.getData()){ - return govOrgResult.getData();} - + if (govOrgResult.success() && null != govOrgResult.getData()) { + return govOrgResult.getData(); + } return result; } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java index 9c973e7b78..4221d063f9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserResiInfoServiceImpl.java @@ -24,18 +24,15 @@ import com.epmet.common.token.util.UserUtil; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.EpmetRoleKeyConstant; import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; -import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; -import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; -import com.epmet.commons.tools.enums.EventEnum; +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.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.SendMqMsgUtils; import com.epmet.constant.SmsTemplateConstant; +import com.epmet.constant.UserConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.UserCustomerDao; import com.epmet.dao.UserResiInfoDao; @@ -46,6 +43,7 @@ import com.epmet.dto.UserRoleDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.IssueInitiatorResultDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserResiInfoResultDTO; import com.epmet.entity.UserBaseInfoEntity; import com.epmet.entity.UserResiInfoEntity; @@ -163,8 +161,36 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl getUserResiInfoDTO(UserResiInfoFormDTO userResiInfoFormDTO) { - UserResiInfoResultDTO userResiInfoDTO = baseDao.selectUserResiInfoDTO(userResiInfoFormDTO); - return new Result().ok(userResiInfoDTO); + //先查缓存 否则查询数据库 这个方法里有 + UserBaseInfoResultDTO userBaseInfoResultDTO = userBaseInfoService.queryUserBaseInfoFromCache(userResiInfoFormDTO.getUserId()); + if (userBaseInfoResultDTO != null){ + UserResiInfoResultDTO resultDTO = new UserResiInfoResultDTO(); + resultDTO.setUserId(userBaseInfoResultDTO.getUserId()); + resultDTO.setRegMobile(userBaseInfoResultDTO.getMobile()); + resultDTO.setSurname(userBaseInfoResultDTO.getSurname()); + resultDTO.setName(userBaseInfoResultDTO.getName()); + resultDTO.setStreet(userBaseInfoResultDTO.getStreet()); + resultDTO.setDistrict(userBaseInfoResultDTO.getDistrict()); + resultDTO.setBuildingAddress(userBaseInfoResultDTO.getBuildingAddress()); + resultDTO.setNickName(userBaseInfoResultDTO.getNickname()); + resultDTO.setShowName(StrConstant.EPMETY_STR); + if (StringUtils.isNotBlank(userBaseInfoResultDTO.getStreet()) && StringUtils.isNotBlank(userBaseInfoResultDTO.getSurname())){ + String gender = null; + if (NumConstant.ONE_STR.equals(userBaseInfoResultDTO.getGender())) { + gender = UserConstant.MAN; + } else if (NumConstant.TWO_STR.equals(userBaseInfoResultDTO.getGender())) { + gender = UserConstant.WOMAN; + } else { + gender = UserConstant.MAN_WOMAN; + } + String leaderName = userBaseInfoResultDTO.getStreet().concat(StrConstant.HYPHEN).concat(userBaseInfoResultDTO.getSurname()).concat(gender); + resultDTO.setShowName(leaderName); + } + + resultDTO.setHeadPhoto(userBaseInfoResultDTO.getHeadImgUrl()); + return new Result().ok(resultDTO); + } + return new Result().ok(null); } /** @@ -271,10 +297,10 @@ public class UserResiInfoServiceImpl extends BaseServiceImpl diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml index 44dbb58269..c3f7bf7682 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/RegisterRelationDao.xml @@ -33,6 +33,7 @@ + + + + + + + \ 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 06491cfb66..f3498237a6 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 @@ -74,7 +74,7 @@