From 0d4a1ee11eed68dcc27c77642dbcc277be888e61 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 16 Mar 2021 09:52:51 +0800 Subject: [PATCH 01/51] =?UTF-8?q?=E5=AE=8C=E6=88=90ApiService=E4=BD=93?= =?UTF-8?q?=E7=B3=BB=E8=AE=BE=E8=AE=A1=EF=BC=8C=E5=87=86=E5=A4=87=E6=8E=A5?= =?UTF-8?q?=E5=85=A5=E5=85=B7=E4=BD=93=E7=9A=84=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/redis/RedisKeys.java | 9 +++ .../com/epmet/constant/ApiServiceActions.java | 11 ++++ .../epmet/dto/form/ProjectAssistFormDTO.java | 15 +++++ .../com/epmet/dto/form/TPFDemoFormDTO.java | 20 ++++++ .../java/com/epmet/apiservice/ApiService.java | 63 +++++++++++++++++++ .../epmet/apiservice/impl/DemoApiService.java | 31 +++++++++ .../impl/LuzhouGridPlatformApiService.java | 19 ++++++ .../LZGridPlatformProjectAssistResult.java | 4 ++ .../result/ProjectAssistResult.java | 8 +++ .../com/epmet/controller/BizController.java | 54 ++++++++++++++++ .../com/epmet/dao/ThirdplatformActionDao.java | 33 ++++++++++ .../dao/ThirdplatformCustomerRegisterDao.java | 36 +++++++++++ .../java/com/epmet/dao/ThirdplatformDao.java | 33 ++++++++++ .../entity/ThirdplatformActionEntity.java | 51 +++++++++++++++ .../ThirdplatformCustomerRegisterEntity.java | 51 +++++++++++++++ .../com/epmet/entity/ThirdplatformEntity.java | 61 ++++++++++++++++++ .../com/epmet/service/ApiServiceSelector.java | 46 ++++++++++++++ .../com/epmet/service/ProjectService.java | 15 +++++ .../service/impl/ProjectServiceImpl.java | 40 ++++++++++++ .../mapper/ThirdplatformActionDao.xml | 19 ++++++ .../ThirdplatformCustomerRegisterDao.xml | 36 +++++++++++ .../resources/mapper/ThirdplatformDao.xml | 21 +++++++ .../epmet/feign/OperCrmOpenFeignClient.java | 9 +++ .../OperCrmOpenFeignClientFallback.java | 5 ++ .../epmet/controller/CustomerController.java | 13 ++++ .../dao/CustomerThirdplatApiserviceDao.java | 10 +++ .../CustomerThirdplatApiServiceService.java | 9 +++ ...ustomerThirdplatApiServiceServiceImpl.java | 19 ++++++ .../mapper/CustomerThirdplatApiserviceDao.xml | 14 +++++ 29 files changed, 755 insertions(+) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ApiServiceActions.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectAssistFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/TPFDemoFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/ProjectAssistResult.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/BizController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ApiServiceSelector.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ProjectService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.xml create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml 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..220d621195 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 @@ -370,4 +370,13 @@ public class RedisKeys { public static String getCustomerApiServiceKey(String customerId) { return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId); } + + /** + * 一个客户对应多个第三方平台,多个ApiService的key + * @param customerId + * @return + */ + public static String listCustomerApiServiceListKey(String customerId) { + return rootPrefix.concat("customer:thirdplat:apiservicelist:").concat(customerId); + } } 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/dto/form/ProjectAssistFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectAssistFormDTO.java new file mode 100644 index 0000000000..543524f1b1 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectAssistFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class ProjectAssistFormDTO { + + 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/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-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..da169d165a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/ApiService.java @@ -0,0 +1,63 @@ +package com.epmet.apiservice; + +import com.epmet.apiservice.result.ProjectAssistResult; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.dao.ThirdplatformCustomerRegisterDao; +import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.TPFDemoFormDTO; +import com.epmet.entity.ThirdplatformCustomerRegisterEntity; + +/** + * ApiService,对接第三方平台的抽象类 + * 每一个具体平台的ApiService都是该抽象类的子类,选择性实现抽象类中的某些方法,提供具体业务逻辑 + */ +public abstract class ApiService { + + /** + * @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; + } + + /** + * @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(ProjectAssistFormDTO 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..6c1aca3917 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/DemoApiService.java @@ -0,0 +1,31 @@ +package com.epmet.apiservice.impl; + +import com.epmet.apiservice.ApiService; +import com.epmet.apiservice.result.ProjectAssistResult; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.constant.ApiServiceActions; +import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.TPFDemoFormDTO; +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); + + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + + @Override + public ProjectAssistResult projectAssist(ProjectAssistFormDTO formDTO) { + logger.info("DemoApiService发送项目协助到第三方平台成功"); + return null; + } +} 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..4081bfad61 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/impl/LuzhouGridPlatformApiService.java @@ -0,0 +1,19 @@ +package com.epmet.apiservice.impl; + +import com.epmet.apiservice.ApiService; +import com.epmet.apiservice.result.ProjectAssistResult; +import com.epmet.dto.form.ProjectAssistFormDTO; +import org.springframework.stereotype.Component; + +/** + * 泸州网格化平台ApiService + */ +@Component("luzhouGridPlatformApiService") +public class LuzhouGridPlatformApiService extends ApiService { + + @Override + public ProjectAssistResult projectAssist(ProjectAssistFormDTO formDTO) { + System.out.println("泸州网格化平台项目协助发送成功"); + return null; + } +} 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..ef74410885 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/LZGridPlatformProjectAssistResult.java @@ -0,0 +1,4 @@ +package com.epmet.apiservice.result; + +public class LZGridPlatformProjectAssistResult { +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/ProjectAssistResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/ProjectAssistResult.java new file mode 100644 index 0000000000..2da96d1e17 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/ProjectAssistResult.java @@ -0,0 +1,8 @@ +package com.epmet.apiservice.result; + +import lombok.Data; + +@Data +public class ProjectAssistResult { + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/BizController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/BizController.java new file mode 100644 index 0000000000..ed83a196bf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/BizController.java @@ -0,0 +1,54 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.TPFDemoFormDTO; +import com.epmet.service.ProjectService; +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.lang.management.MemoryManagerMXBean; + +/** + * 对接第三方平台业务相关的controller + * 我们系统当中每一个需要发送到第三方平台的操作,只对应这里的一个方法,根据参数传入platformId,内部根据配置获取指定的APiService进行具体平台的调用 + * 每一个平台都有自己的ApiSerivce + */ +@RestController +@RequestMapping("biz") +public class BizController { + + @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("project-assist") + public Result projectAssist(@RequestBody ProjectAssistFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + projectService.projectAssist(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..9b309c15fc --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformActionDao.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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.ThirdplatformActionEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-15 + */ +@Mapper +public interface ThirdplatformActionDao extends BaseDao { + +} \ 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..e3a39cbbe2 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerRegisterDao.java @@ -0,0 +1,36 @@ +/** + * 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.constant.ThirdPlatformConstant; +import com.epmet.entity.ThirdplatformCustomerRegisterEntity; +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 ThirdplatformCustomerRegisterDao extends BaseDao { + + ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); +} \ No newline at end of file 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..593d20923f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformDao.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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.ThirdplatformEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-15 + */ +@Mapper +public interface ThirdplatformDao extends BaseDao { + +} \ No newline at end of file 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..88c7a8cd2f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.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-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; + +} 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..b3b77fb626 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerRegisterEntity.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-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; + +} 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..4fede6dcdf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.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.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; + +} 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..25d4f6de51 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ProjectService.java @@ -0,0 +1,15 @@ +package com.epmet.service; + +import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.TPFDemoFormDTO; +import org.springframework.stereotype.Service; + +/** + * 该service用于封装project相关的代码 + */ +public interface ProjectService { + + String demoAction(TPFDemoFormDTO formDTO); + + void projectAssist(ProjectAssistFormDTO 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..fb57663d72 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -0,0 +1,40 @@ +package com.epmet.service.impl; + +import com.epmet.apiservice.ApiService; +import com.epmet.apiservice.result.ProjectAssistResult; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.TPFDemoFormDTO; +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 void projectAssist(ProjectAssistFormDTO formDTO) { + String customerId = formDTO.getCustomerId(); + String platformId = formDTO.getPlatformId(); + + // 注意,此处会如果找不到对应的ApiService会抛出异常 + ApiService apiService = selectApiService(platformId); + apiService.judgeRegistered(customerId, platformId); + + System.out.println(apiService); + + ProjectAssistResult projectAssistResult = apiService.projectAssist(formDTO); + } +} 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..03cf514cda --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformActionDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ 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..c8545d01ee --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerRegisterDao.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/ThirdplatformDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml new file mode 100644 index 0000000000..0bc68d7af2 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file 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..f4dec72cac 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,13 @@ public interface OperCrmOpenFeignClient { **/ @GetMapping("/oper/crm/customer/getallsubcustomerids/{customerId}") Result> getAllSubCustomerIds(@PathVariable("customerId") String customerId); + + /** + * @Description 根据客户id列出该客户所有的apiService + * @return + * @author wxz + * @date 2021.03.15 15:13 + */ + @PostMapping("list-apiservice-by-customerid") + Result> listApiServiceByCustomerId(@RequestBody ApiServiceFormDTO form); } 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..134ffcb242 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> listApiServiceByCustomerId(ApiServiceFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "listApiServiceByCustomerId", form); + } } 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..461c06f3f6 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,17 @@ public class CustomerController { } return new Result<>(); } + + /** + * @Description 根据客户id列出该客户所有的apiService + * @return + * @author wxz + * @date 2021.03.15 15:13 + */ + @PostMapping("list-apiservice-by-customerid") + public Result> listApiServiceByCustomerId(@RequestBody ApiServiceFormDTO form) { + ValidatorUtils.validateEntity(form, ApiServiceFormDTO.GetByCustomerId.class); + String customerId = form.getCustomerId(); + return new Result>().ok(customerThirdplatApiServiceService.listByCustomerId(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/CustomerThirdplatApiServiceService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerThirdplatApiServiceService.java index a1f9fa91e9..eb6adbe6ec 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 { /** @@ -13,4 +15,11 @@ public interface CustomerThirdplatApiServiceService { */ ThirdplatApiserviceResultDTO getByCustomerId(String customerId); + /** + * 根据客户id列出第三方平台列表 + * @param customerId + * @return + */ + List listByCustomerId(String customerId); + } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java index 9cfa19a820..9613f30f60 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java @@ -8,9 +8,12 @@ import com.epmet.dto.result.ThirdplatApiserviceResultDTO; import com.epmet.entity.CustomerThirdplatApiserviceEntity; import com.epmet.service.CustomerThirdplatApiServiceService; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.util.ArrayList; +import java.util.List; import java.util.Map; @Service @@ -22,6 +25,10 @@ public class CustomerThirdplatApiServiceServiceImpl implements CustomerThirdplat @Autowired private CustomerThirdplatApiserviceDao thirdplatApiserviceDao; + @Autowired + private RedisTemplate tpasRedisTemplate; + + @Override public ThirdplatApiserviceResultDTO getByCustomerId(String customerId) { ThirdplatApiserviceResultDTO apiService = null; @@ -39,4 +46,16 @@ public class CustomerThirdplatApiServiceServiceImpl implements CustomerThirdplat return apiService; } + + @Override + public List listByCustomerId(String customerId) { + List apiServices = tpasRedisTemplate.opsForList().range(RedisKeys.listCustomerApiServiceListKey(customerId), 0, -1); + if (!CollectionUtils.isEmpty(apiServices)) { + return apiServices; + } + + apiServices = thirdplatApiserviceDao.listByCustomerId(customerId); + tpasRedisTemplate.opsForList().rightPushAll(RedisKeys.listCustomerApiServiceListKey(customerId), apiServices); + return apiServices; + } } 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 From cb6c0078ac0c314797d567125b593d0743dc3a94 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 16 Mar 2021 15:44:26 +0800 Subject: [PATCH 02/51] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=B9=B3=E5=8F=B0=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E5=B9=B3=E5=8F=B0=E4=B8=8D=E9=80=9A=EF=BC=8C=E5=BE=85?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application.yml | 2 +- .../epmet/commons/tools/redis/RedisKeys.java | 9 ++ .../epmet/constant/ThirdPlatformActions.java | 13 ++ .../java/com/epmet/apiservice/ApiService.java | 123 ++++++++++++++++++ .../impl/LuzhouGridPlatformApiService.java | 11 +- .../com/epmet/dao/ThirdplatformActionDao.java | 10 +- .../entity/ThirdplatformActionEntity.java | 1 + .../com/epmet/entity/ThirdplatformEntity.java | 5 + .../mapper/ThirdplatformActionDao.xml | 17 +++ 9 files changed, 188 insertions(+), 3 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java 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-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 220d621195..3a2e5b0fa9 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 @@ -379,4 +379,13 @@ public class RedisKeys { 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-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..43390a2e14 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/constant/ThirdPlatformActions.java @@ -0,0 +1,13 @@ +package com.epmet.constant; + +/** + * 第三方平台动作常量 + */ +public interface ThirdPlatformActions { + + // 获取accessToken + String GET_ACCESS_TOKEN = "GET_ACCESS_TOKEN"; + // 项目协助 + String PROJECT_ASSIST = "PROJECT_ASSIST"; + +} 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 index da169d165a..c0326a98a5 100644 --- 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 @@ -2,11 +2,26 @@ package com.epmet.apiservice; import com.epmet.apiservice.result.ProjectAssistResult; 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.constant.ThirdPlatformActions; +import com.epmet.dao.PaUserDao; +import com.epmet.dao.ThirdplatformActionDao; import com.epmet.dao.ThirdplatformCustomerRegisterDao; +import com.epmet.dao.ThirdplatformDao; import com.epmet.dto.form.ProjectAssistFormDTO; import com.epmet.dto.form.TPFDemoFormDTO; +import com.epmet.entity.ThirdplatformActionEntity; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; +import com.epmet.entity.ThirdplatformEntity; +import org.apache.commons.lang3.StringUtils; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.http.HttpMethod; + +import java.util.HashMap; +import java.util.Map; /** * ApiService,对接第三方平台的抽象类 @@ -29,6 +44,114 @@ public abstract class ApiService { 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); + + Result result = HttpClientManager.getInstance().sendGet(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()), + thirdplatform.getBaseUrl().startsWith("https://"), + params, + headers); + + if (result == null) { + throw new RenException("请求第三方平台,获取AccessToken失败。result为null"); + } + if (result.success()) { + throw new RenException("请求第三方平台,获取AccessToken失败。"); + } + 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); + + Result result = HttpClientManager.getInstance().sendPost(thirdplatform.getBaseUrl().concat(actionEntity.getApiUrl()), + thirdplatform.getBaseUrl().startsWith("https://"), + jsonString, + headers); + + if (result == null) { + throw new RenException("请求第三方平台,获取AccessToken失败。result为null"); + } + if (result.success()) { + throw new RenException("请求第三方平台,获取AccessToken失败。"); + } + return result.getData(); + } + + /** + * @Description 获取accessToken + * @return + * @author wxz + * @date 2021.03.16 13:45 + */ + private String getAccessToken(String platformId) { + RedisTemplate rt = SpringContextUtils.getBean("redisTemplate", RedisTemplate.class); + String token = rt.opsForValue().get(RedisKeys.getThirdPlatformAccessTokenKey(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 = HttpClientManager.getInstance().sendGet(baseUrl.concat(actionEntity.getApiUrl()), params); + if (result == null) { + throw new RenException("请求第三方平台,获取AccessToken失败。result为null"); + } + if (result.success()) { + throw new RenException("请求第三方平台,获取AccessToken失败。"); + } + token = result.getData(); + rt.opsForValue().set(RedisKeys.getThirdPlatformAccessTokenKey(platformId), token); + } + return token; + } + /** * @Description 判断客户是否注册了指定的平台,如果没有注册,则抛出异常 * @return 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 index 4081bfad61..646ce55af9 100644 --- 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 @@ -1,8 +1,11 @@ package com.epmet.apiservice.impl; +import com.alibaba.fastjson.JSON; import com.epmet.apiservice.ApiService; import com.epmet.apiservice.result.ProjectAssistResult; +import com.epmet.constant.ThirdPlatformActions; import com.epmet.dto.form.ProjectAssistFormDTO; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; /** @@ -13,7 +16,13 @@ public class LuzhouGridPlatformApiService extends ApiService { @Override public ProjectAssistResult projectAssist(ProjectAssistFormDTO formDTO) { + String platformId = formDTO.getPlatformId(); + String result = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, "{}", null); + ProjectAssistResult projectAssistResult = null; + if (!StringUtils.isBlank(result)) { + projectAssistResult = JSON.parseObject(result, ProjectAssistResult.class); + } System.out.println("泸州网格化平台项目协助发送成功"); - return null; + return projectAssistResult; } } 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 index 9b309c15fc..50de9d3629 100644 --- 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 @@ -20,6 +20,7 @@ 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; /** * @@ -29,5 +30,12 @@ import org.apache.ibatis.annotations.Mapper; */ @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/entity/ThirdplatformActionEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformActionEntity.java index 88c7a8cd2f..97283b9c05 100644 --- 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 @@ -47,5 +47,6 @@ public class ThirdplatformActionEntity extends BaseEpmetEntity { * */ private String actionKey; + private String apiUrl; } 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 index 4fede6dcdf..d756c81b88 100644 --- 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 @@ -58,4 +58,9 @@ public class ThirdplatformEntity extends BaseEpmetEntity { */ private String apiService; + /** + * 基础url + */ + private String baseUrl; + } 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 index 03cf514cda..39de22dca5 100644 --- 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 @@ -7,6 +7,7 @@ + @@ -15,5 +16,21 @@ + + \ No newline at end of file From 47a41ed1fc1b91f792f0c81655cd06612eb3e52d Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 16 Mar 2021 16:47:32 +0800 Subject: [PATCH 03/51] =?UTF-8?q?controller=E5=91=BD=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...rmDTO.java => ProjectApplyAssistFormDTO.java} | 2 +- .../java/com/epmet/apiservice/ApiService.java | 6 ++---- .../epmet/apiservice/impl/DemoApiService.java | 7 ++----- .../impl/LuzhouGridPlatformApiService.java | 4 ++-- ...BizController.java => ProjectController.java} | 16 +++++++--------- .../java/com/epmet/service/ProjectService.java | 5 ++--- .../epmet/service/impl/ProjectServiceImpl.java | 8 ++++---- 7 files changed, 20 insertions(+), 28 deletions(-) rename epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/{ProjectAssistFormDTO.java => ProjectApplyAssistFormDTO.java} (84%) rename epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/{BizController.java => ProjectController.java} (79%) diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectAssistFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java similarity index 84% rename from epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectAssistFormDTO.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java index 543524f1b1..bbbe9d17c5 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectAssistFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ProjectApplyAssistFormDTO.java @@ -5,7 +5,7 @@ import lombok.Data; import javax.validation.constraints.NotBlank; @Data -public class ProjectAssistFormDTO { +public class ProjectApplyAssistFormDTO { private String customerId; 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 index c0326a98a5..4c581a916d 100644 --- 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 @@ -7,18 +7,16 @@ 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.PaUserDao; import com.epmet.dao.ThirdplatformActionDao; import com.epmet.dao.ThirdplatformCustomerRegisterDao; import com.epmet.dao.ThirdplatformDao; -import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; import com.epmet.dto.form.TPFDemoFormDTO; import com.epmet.entity.ThirdplatformActionEntity; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; import com.epmet.entity.ThirdplatformEntity; import org.apache.commons.lang3.StringUtils; import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.http.HttpMethod; import java.util.HashMap; import java.util.Map; @@ -180,7 +178,7 @@ public abstract class ApiService { * @author wxz * @date 2021.03.16 09:28 */ - public ProjectAssistResult projectAssist(ProjectAssistFormDTO formDTO) { + public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO 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 index 6c1aca3917..9dcc3854c5 100644 --- 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 @@ -2,10 +2,7 @@ package com.epmet.apiservice.impl; import com.epmet.apiservice.ApiService; import com.epmet.apiservice.result.ProjectAssistResult; -import com.epmet.commons.tools.exception.RenException; -import com.epmet.constant.ApiServiceActions; -import com.epmet.dto.form.ProjectAssistFormDTO; -import com.epmet.dto.form.TPFDemoFormDTO; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; import com.epmet.feign.OperCrmOpenFeignClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -24,7 +21,7 @@ public class DemoApiService extends ApiService { private OperCrmOpenFeignClient operCrmOpenFeignClient; @Override - public ProjectAssistResult projectAssist(ProjectAssistFormDTO formDTO) { + public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) { logger.info("DemoApiService发送项目协助到第三方平台成功"); return null; } 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 index 646ce55af9..8ff454f60d 100644 --- 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 @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.apiservice.ApiService; import com.epmet.apiservice.result.ProjectAssistResult; import com.epmet.constant.ThirdPlatformActions; -import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; @@ -15,7 +15,7 @@ import org.springframework.stereotype.Component; public class LuzhouGridPlatformApiService extends ApiService { @Override - public ProjectAssistResult projectAssist(ProjectAssistFormDTO formDTO) { + public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) { String platformId = formDTO.getPlatformId(); String result = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, "{}", null); ProjectAssistResult projectAssistResult = null; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/BizController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java similarity index 79% rename from epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/BizController.java rename to epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java index ed83a196bf..af4d756ca2 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/BizController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ProjectController.java @@ -2,7 +2,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; import com.epmet.dto.form.TPFDemoFormDTO; import com.epmet.service.ProjectService; import org.springframework.beans.factory.annotation.Autowired; @@ -11,16 +11,14 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import java.lang.management.MemoryManagerMXBean; - /** - * 对接第三方平台业务相关的controller + * 对接第三方平台业务Project相关的controller * 我们系统当中每一个需要发送到第三方平台的操作,只对应这里的一个方法,根据参数传入platformId,内部根据配置获取指定的APiService进行具体平台的调用 * 每一个平台都有自己的ApiSerivce */ @RestController -@RequestMapping("biz") -public class BizController { +@RequestMapping("project") +public class ProjectController { @Autowired private ProjectService projectService; @@ -39,13 +37,13 @@ public class BizController { } /** - * @Description 发送项目协同处理方法 + * @Description 请求项目协助 * @return * @author wxz * @date 2021.03.15 21:13 */ - @PostMapping("project-assist") - public Result projectAssist(@RequestBody ProjectAssistFormDTO formDTO) { + @PostMapping("apply-assist") + public Result applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); projectService.projectAssist(formDTO); return new Result(); 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 index 25d4f6de51..c190dc71ae 100644 --- 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 @@ -1,8 +1,7 @@ package com.epmet.service; -import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; import com.epmet.dto.form.TPFDemoFormDTO; -import org.springframework.stereotype.Service; /** * 该service用于封装project相关的代码 @@ -11,5 +10,5 @@ public interface ProjectService { String demoAction(TPFDemoFormDTO formDTO); - void projectAssist(ProjectAssistFormDTO formDTO); + void projectAssist(ProjectApplyAssistFormDTO 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 index fb57663d72..91ebd234c3 100644 --- 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 @@ -2,8 +2,7 @@ package com.epmet.service.impl; import com.epmet.apiservice.ApiService; import com.epmet.apiservice.result.ProjectAssistResult; -import com.epmet.commons.tools.exception.RenException; -import com.epmet.dto.form.ProjectAssistFormDTO; +import com.epmet.dto.form.ProjectApplyAssistFormDTO; import com.epmet.dto.form.TPFDemoFormDTO; import com.epmet.service.ApiServiceSelector; import com.epmet.service.ProjectService; @@ -25,12 +24,13 @@ public class ProjectServiceImpl implements ProjectService, ApiServiceSelector { } @Override - public void projectAssist(ProjectAssistFormDTO formDTO) { + public void projectAssist(ProjectApplyAssistFormDTO formDTO) { String customerId = formDTO.getCustomerId(); String platformId = formDTO.getPlatformId(); - // 注意,此处会如果找不到对应的ApiService会抛出异常 + // 根据平台ID找到注意,此处会如果找不到对应的ApiService会抛出异常 ApiService apiService = selectApiService(platformId); + // 判断该客户是否注册了该平台,如果没有的话,抛出异常 apiService.judgeRegistered(customerId, platformId); System.out.println(apiService); From 5d5f16364864c99dba180ee84379ad4eb3d06943 Mon Sep 17 00:00:00 2001 From: wxz Date: Tue, 16 Mar 2021 17:10:46 +0800 Subject: [PATCH 04/51] =?UTF-8?q?=E5=91=BD=E5=90=8D=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/apiservice/ApiService.java | 5 +++-- .../epmet/apiservice/impl/LuzhouGridPlatformApiService.java | 5 ++++- .../main/java/com/epmet/controller/ProjectController.java | 2 +- .../src/main/java/com/epmet/service/ProjectService.java | 6 +++++- .../java/com/epmet/service/impl/ProjectServiceImpl.java | 4 +--- 5 files changed, 14 insertions(+), 8 deletions(-) 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 index 4c581a916d..0a6ac8de63 100644 --- 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 @@ -22,8 +22,9 @@ import java.util.HashMap; import java.util.Map; /** - * ApiService,对接第三方平台的抽象类 - * 每一个具体平台的ApiService都是该抽象类的子类,选择性实现抽象类中的某些方法,提供具体业务逻辑 + * ApiService,对接第三方平台的抽象类。每一个子类都对应一个第三方平台,每个第三方平台都实现唯一一个子类 + * 每一个具体平台的ApiService都是该抽象类的子类,选择性实现抽象类中的某些需要实现方法,提供具体业务逻辑 + * 此抽象类中定义方法的具体返回类型,所有子类都要统一使用,在具体实现中做转换。若是不需要返回,返回null即可。 */ public abstract class ApiService { 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 index 8ff454f60d..433deb8f7a 100644 --- 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 @@ -20,7 +20,10 @@ public class LuzhouGridPlatformApiService extends ApiService { String result = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, "{}", null); ProjectAssistResult projectAssistResult = null; if (!StringUtils.isBlank(result)) { - projectAssistResult = JSON.parseObject(result, ProjectAssistResult.class); + // 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是 + // 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体, + // 所有apiService都要想办法转化成这个类型。 + //projectAssistResult = JSON.parseObject(result, ProjectAssistResult.class); } System.out.println("泸州网格化平台项目协助发送成功"); return projectAssistResult; 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 index af4d756ca2..746205b85c 100644 --- 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 @@ -45,7 +45,7 @@ public class ProjectController { @PostMapping("apply-assist") public Result applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - projectService.projectAssist(formDTO); + projectService.applyAssist(formDTO); return new Result(); } 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 index c190dc71ae..9ac4b55558 100644 --- 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 @@ -10,5 +10,9 @@ public interface ProjectService { String demoAction(TPFDemoFormDTO formDTO); - void projectAssist(ProjectApplyAssistFormDTO formDTO); + /** + * + * @param formDTO + */ + void applyAssist(ProjectApplyAssistFormDTO 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 index 91ebd234c3..4401c6fba2 100644 --- 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 @@ -24,7 +24,7 @@ public class ProjectServiceImpl implements ProjectService, ApiServiceSelector { } @Override - public void projectAssist(ProjectApplyAssistFormDTO formDTO) { + public void applyAssist(ProjectApplyAssistFormDTO formDTO) { String customerId = formDTO.getCustomerId(); String platformId = formDTO.getPlatformId(); @@ -33,8 +33,6 @@ public class ProjectServiceImpl implements ProjectService, ApiServiceSelector { // 判断该客户是否注册了该平台,如果没有的话,抛出异常 apiService.judgeRegistered(customerId, platformId); - System.out.println(apiService); - ProjectAssistResult projectAssistResult = apiService.projectAssist(formDTO); } } From bf3cd3b7428ee9260aef5f419a7b147a03808290 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Tue, 16 Mar 2021 17:43:05 +0800 Subject: [PATCH 05/51] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E8=8F=9C=E5=8D=95-?= =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/GovCustomerMenuDTO.java | 81 +++++++++++ .../com/epmet/dto/form/MenuConfigFormDTO.java | 27 ++++ .../controller/GovCustomerMenuController.java | 129 +++++++++++++++++ .../com/epmet/dao/GovCustomerMenuDao.java | 55 ++++++++ .../main/java/com/epmet/dao/GovMenuDao.java | 9 ++ .../epmet/entity/GovCustomerMenuEntity.java | 51 +++++++ .../com/epmet/excel/GovCustomerMenuExcel.java | 62 ++++++++ .../com/epmet/redis/GovCustomerMenuRedis.java | 47 +++++++ .../epmet/service/GovCustomerMenuService.java | 126 +++++++++++++++++ .../impl/GovCustomerMenuServiceImpl.java | 132 ++++++++++++++++++ .../service/impl/GovMenuServiceImpl.java | 30 +++- .../resources/mapper/GovCustomerMenuDao.xml | 29 ++++ .../src/main/resources/mapper/GovMenuDao.xml | 14 ++ 13 files changed, 785 insertions(+), 7 deletions(-) create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/GovCustomerMenuDTO.java create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuConfigFormDTO.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovCustomerMenuController.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/dao/GovCustomerMenuDao.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/entity/GovCustomerMenuEntity.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/excel/GovCustomerMenuExcel.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/redis/GovCustomerMenuRedis.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/GovCustomerMenuService.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/GovCustomerMenuServiceImpl.java create mode 100644 epmet-module/gov-access/gov-access-server/src/main/resources/mapper/GovCustomerMenuDao.xml 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-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..5e60482a5f --- /dev/null +++ b/epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/GovCustomerMenuController.java @@ -0,0 +1,129 @@ +/** + * 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.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 tableId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 16:26 2021-03-16 + **/ + @GetMapping("getcustomerids/{tableid}") + public Result> getcustomerids(@PathVariable("tableid") String tableId){ + List data = govCustomerMenuService.getcustomerIds(tableId); + 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..cfa42e4975 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()); + menuList = getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value()); govMenuRedis.setUserMenuNavList(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient(), menuList); } @@ -195,6 +197,21 @@ public class GovMenuServiceImpl extends BaseServiceImpl + * @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 public Set getUserPermissions(TokenDto tokenDto) { //用户权限列表 @@ -243,5 +260,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} + From 3a3a1cab733ae07715ed8a77303fa9adc621ff15 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Wed, 17 Mar 2021 09:42:36 +0800 Subject: [PATCH 06/51] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E7=BC=93=E5=AD=98key?= =?UTF-8?q?=EF=BC=8C=E7=94=B1userId=20=E6=94=B9=E4=B8=BA=20customerId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/GovMenuServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 cfa42e4975..1f16ad89e9 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 @@ -187,11 +187,11 @@ public class GovMenuServiceImpl extends BaseServiceImpl getUserMenuNavList(TokenDto tokenDto) { - List menuList = govMenuRedis.getUserMenuNavList(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient()); + List menuList = govMenuRedis.getUserMenuNavList(tokenDto.getCustomerId(), tokenDto.getApp(), tokenDto.getClient()); if(menuList == null){ menuList = getCustomerMenuList(tokenDto.getCustomerId(), MenuTypeEnum.MENU.value()); - govMenuRedis.setUserMenuNavList(tokenDto.getUserId(), tokenDto.getApp(), tokenDto.getClient(), menuList); + govMenuRedis.setUserMenuNavList(tokenDto.getCustomerId(), tokenDto.getApp(), tokenDto.getClient(), menuList); } return menuList; From 41e26e774a2573954984f75fa31c856754e810b5 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Wed, 17 Mar 2021 10:13:39 +0800 Subject: [PATCH 07/51] =?UTF-8?q?=E6=94=B9=E6=88=90post=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/controller/GovCustomerMenuController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 index 5e60482a5f..a3cb9f8946 100644 --- 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 @@ -121,7 +121,7 @@ public class GovCustomerMenuController { * @Author zhangyong * @Date 16:26 2021-03-16 **/ - @GetMapping("getcustomerids/{tableid}") + @PostMapping("getcustomerids/{tableid}") public Result> getcustomerids(@PathVariable("tableid") String tableId){ List data = govCustomerMenuService.getcustomerIds(tableId); return new Result>().ok(data); From 440472f1ec77aeab4034eae923d23eeb0180f630 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 17 Mar 2021 10:53:07 +0800 Subject: [PATCH 08/51] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/ThirdPlatformFormDTO.java | 19 ++++++++ ...hirdplatformCustomerRegisterResultDTO.java | 18 ++++++++ .../impl/LuzhouGridPlatformApiService.java | 15 +++++-- .../LZGridPlatformProjectAssistResult.java | 9 ++++ .../result/ProjectAssistResult.java | 5 +++ .../epmet/controller/ProjectController.java | 5 ++- .../controller/ThirdPlatformController.java | 43 +++++++++++++++++++ .../dao/ThirdplatformCustomerRegisterDao.java | 10 +++++ .../com/epmet/service/ProjectService.java | 3 +- .../epmet/service/ThirdPlatformService.java | 11 +++++ .../service/impl/ProjectServiceImpl.java | 4 +- .../impl/ThirdPlatformServiceImpl.java | 21 +++++++++ .../ThirdplatformCustomerRegisterDao.xml | 22 ++++++++++ 13 files changed, 177 insertions(+), 8 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java 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..3f488e75c1 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/ThirdPlatformFormDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class ThirdPlatformFormDTO { + + // 列出注册关系分组 + public static interface ListRegRelsGroups {} + + @NotBlank(message = "客户ID不能为空", groups = { ListRegRelsGroups.class }) + private String customerId; + + @NotBlank(message = "客户ID不能为空", groups = { ListRegRelsGroups.class }) + private String actionKey; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java new file mode 100644 index 0000000000..d637837fbc --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result; + +import lombok.Data; + +@Data +public class ThirdplatformCustomerRegisterResultDTO { + /** + * + */ + private String customerId; + + /** + * + */ + private String platformId; + + private String platformName; +} 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 index 433deb8f7a..b38a3e6758 100644 --- 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 @@ -2,6 +2,7 @@ package com.epmet.apiservice.impl; import com.alibaba.fastjson.JSON; import com.epmet.apiservice.ApiService; +import com.epmet.apiservice.result.LZGridPlatformProjectAssistResult; import com.epmet.apiservice.result.ProjectAssistResult; import com.epmet.constant.ThirdPlatformActions; import com.epmet.dto.form.ProjectApplyAssistFormDTO; @@ -17,13 +18,21 @@ public class LuzhouGridPlatformApiService extends ApiService { @Override public ProjectAssistResult projectAssist(ProjectApplyAssistFormDTO formDTO) { String platformId = formDTO.getPlatformId(); - String result = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, "{}", null); - ProjectAssistResult projectAssistResult = null; + + // 正式调用第三方平台 + //String result = sendPostRequest(platformId, ThirdPlatformActions.PROJECT_ASSIST, "{}", null); + + // 开发阶段临时写死 + String result = "{\"eventId\":\"test-task-id\"}"; + ProjectAssistResult projectAssistResult = new ProjectAssistResult(); if (!StringUtils.isBlank(result)) { // 此处要经过一系列业务处理,将第三方平台返回的数据进行解析,等处理最后转换成ProjectAssistResult类型,返回。ProjectAssistResult这个类型是 // 所有apiService的projectAssist方法返回值的统一类型,是我们的epmet-cloud所需要的数据的实体, // 所有apiService都要想办法转化成这个类型。 - //projectAssistResult = JSON.parseObject(result, ProjectAssistResult.class); + LZGridPlatformProjectAssistResult lzResult = JSON.parseObject(result, LZGridPlatformProjectAssistResult.class); + + // 此处设置为第三方系统返回的唯一id + projectAssistResult.setTaskId(lzResult.getEventId()); } System.out.println("泸州网格化平台项目协助发送成功"); return projectAssistResult; 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 index ef74410885..1ffd372576 100644 --- 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 @@ -1,4 +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/apiservice/result/ProjectAssistResult.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/ProjectAssistResult.java index 2da96d1e17..de992bdd0f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/ProjectAssistResult.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/apiservice/result/ProjectAssistResult.java @@ -5,4 +5,9 @@ import lombok.Data; @Data public class ProjectAssistResult { + /** + * 任务id + */ + private String taskId; + } 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 index 746205b85c..3899ed9fda 100644 --- 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 @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.apiservice.result.ProjectAssistResult; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.ProjectApplyAssistFormDTO; @@ -45,8 +46,8 @@ public class ProjectController { @PostMapping("apply-assist") public Result applyAssist(@RequestBody ProjectApplyAssistFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - projectService.applyAssist(formDTO); - return new Result(); + ProjectAssistResult projectAssistResult = projectService.applyAssist(formDTO); + return new Result().ok(projectAssistResult); } } 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..64c7f0e7f0 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java @@ -0,0 +1,43 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.ThirdPlatformFormDTO; +import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.service.ThirdPlatformService; +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; + + /** + * 列出第三方平台注册关系 + * @param input + * @return + */ + @PostMapping("list-reg-rels") + public Result> listRegsteredPlatforms(@RequestBody ThirdPlatformFormDTO input) { + ValidatorUtils.validateEntity(input); + List platformRegs = thirdPlatformService.listByCustomerId(input.getCustomerId(), input.getActionKey()); + return new Result>().ok(platformRegs); + } + + //@PostMapping("register") + + + +} 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 index e3a39cbbe2..b5ffe5cf82 100644 --- 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 @@ -19,10 +19,13 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.constant.ThirdPlatformConstant; +import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * * @@ -32,5 +35,12 @@ import org.apache.ibatis.annotations.Param; @Mapper public interface ThirdplatformCustomerRegisterDao extends BaseDao { + /** + * 动态sql查询 + * @param customerId + * @return + */ + List listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey); + ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); } \ No newline at end of file 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 index 9ac4b55558..1e9d75fdc1 100644 --- 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 @@ -1,5 +1,6 @@ package com.epmet.service; +import com.epmet.apiservice.result.ProjectAssistResult; import com.epmet.dto.form.ProjectApplyAssistFormDTO; import com.epmet.dto.form.TPFDemoFormDTO; @@ -14,5 +15,5 @@ public interface ProjectService { * * @param formDTO */ - void applyAssist(ProjectApplyAssistFormDTO formDTO); + ProjectAssistResult applyAssist(ProjectApplyAssistFormDTO 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..74b4cab44f --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/ThirdPlatformService.java @@ -0,0 +1,11 @@ +package com.epmet.service; + +import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; + +import java.util.List; + +public interface ThirdPlatformService { + + List listByCustomerId(String customerId, String actionKey); + +} \ No newline at end of file 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 index 4401c6fba2..f652f6b995 100644 --- 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 @@ -24,7 +24,7 @@ public class ProjectServiceImpl implements ProjectService, ApiServiceSelector { } @Override - public void applyAssist(ProjectApplyAssistFormDTO formDTO) { + public ProjectAssistResult applyAssist(ProjectApplyAssistFormDTO formDTO) { String customerId = formDTO.getCustomerId(); String platformId = formDTO.getPlatformId(); @@ -33,6 +33,6 @@ public class ProjectServiceImpl implements ProjectService, ApiServiceSelector { // 判断该客户是否注册了该平台,如果没有的话,抛出异常 apiService.judgeRegistered(customerId, platformId); - ProjectAssistResult projectAssistResult = apiService.projectAssist(formDTO); + return apiService.projectAssist(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..40556ebaca --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ThirdPlatformServiceImpl.java @@ -0,0 +1,21 @@ +package com.epmet.service.impl; + +import com.epmet.dao.ThirdplatformCustomerRegisterDao; +import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.service.ThirdPlatformService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class ThirdPlatformServiceImpl implements ThirdPlatformService { + + @Autowired + private ThirdplatformCustomerRegisterDao thirdplatformCustomerRegisterDao; + + @Override + public List listByCustomerId(String customerId, String actionKey) { + return thirdplatformCustomerRegisterDao.listDTOS(customerId, actionKey); + } +} 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 index c8545d01ee..10edc458e3 100644 --- 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 @@ -32,5 +32,27 @@ and DEL_FLAG = 0 + + \ No newline at end of file From f1fc9d552b205a6a0dd661835217085ea6928518 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Wed, 17 Mar 2021 16:31:01 +0800 Subject: [PATCH 09/51] =?UTF-8?q?=E7=89=B9=E6=AE=8A=E5=AE=A2=E6=88=B7-?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E5=92=8C=E7=83=AD=E5=BF=83=E5=B1=85=E6=B0=91?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=90=8D=E7=A7=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/ProjectSubAttachmentDTO.java | 126 ++++++++++++++++ .../com/epmet/dto/ProjectSubProcessDTO.java | 136 ++++++++++++++++++ .../com/epmet/dto/form/SendToFormDTO.java | 49 +++++++ .../dto/result/ProcessListV2ResultDTO.java | 5 + .../dto/result/ProjectDetailResultDTO.java | 4 + .../com/epmet/dto/result/SubProcessDTO.java | 40 ++++++ .../ProjectSubAttachmentController.java | 85 +++++++++++ .../ProjectSubProcessController.java | 85 +++++++++++ .../controller/ProjectTraceController.java | 16 +++ .../epmet/dao/ProjectSubAttachmentDao.java | 33 +++++ .../com/epmet/dao/ProjectSubProcessDao.java | 33 +++++ .../entity/ProjectSubAttachmentEntity.java | 96 +++++++++++++ .../epmet/entity/ProjectSubProcessEntity.java | 106 ++++++++++++++ .../service/ProjectSubAttachmentService.java | 95 ++++++++++++ .../service/ProjectSubProcessService.java | 95 ++++++++++++ .../epmet/service/ProjectTraceService.java | 10 ++ .../service/impl/ProjectServiceImpl.java | 3 + .../impl/ProjectSubAttachmentServiceImpl.java | 100 +++++++++++++ .../impl/ProjectSubProcessServiceImpl.java | 100 +++++++++++++ .../service/impl/ProjectTraceServiceImpl.java | 14 ++ .../mapper/ProjectSubAttachmentDao.xml | 28 ++++ .../resources/mapper/ProjectSubProcessDao.xml | 30 ++++ 22 files changed, 1289 insertions(+) create mode 100644 epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubAttachmentDTO.java create mode 100644 epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubProcessDTO.java create mode 100644 epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SendToFormDTO.java create mode 100644 epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubAttachmentController.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubProcessController.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubAttachmentDao.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubAttachmentEntity.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubProcessEntity.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubAttachmentService.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubAttachmentServiceImpl.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java create mode 100644 epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubAttachmentDao.xml create mode 100644 epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubProcessDao.xml diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubAttachmentDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubAttachmentDTO.java new file mode 100644 index 0000000000..e966d0f026 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubAttachmentDTO.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.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 外部系统事件附件 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-17 + */ +@Data +public class ProjectSubAttachmentDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 项目ID + */ + private String projectId; + + /** + * 子节点ID + */ + private String subId; + + /** + * 事件ID + */ + private String taskId; + + /** + * 附件名 + */ + private String attachmentName; + + /** + * 文件大小 单位b + */ + private Integer attachmentSize; + + /** + * 文件格式 + */ + private String attachmentFormat; + + /** + * 类型 + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + + /** + * 排序 + */ + private Integer sort; + + /** + * 删除标识 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-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubProcessDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubProcessDTO.java new file mode 100644 index 0000000000..5edffc797a --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectSubProcessDTO.java @@ -0,0 +1,136 @@ +/** + * 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-17 + */ +@Data +public class ProjectSubProcessDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * 项目ID + */ + private String projectId; + + /** + * 节点ID + */ + private String processId; + + /** + * 项目人员关联表ID + */ + private String staffId; + + /** + * 系统ID + */ + private String platformId; + + /** + * 系统名 + */ + private String platformName; + + /** + * 第三方平台返回的项目关联ID(事件Id) + */ + private String taskId; + + /** + * 事件处理详细内容 + */ + private String result; + + /** + * 外部状态:1待处理,2待核实,3已上报,4已完结,5处理中,6待分发,7归档,8催办,9超时 + */ + private String externalStatus; + + /** + * 外部状态描述 + */ + private String externalStatusDesc; + + /** + * 内部状态:待处理 pending,结案closed + */ + private String internalStatus; + + /** + * 处理日期 + */ + private Date handleDate; + + /** + * 处理人姓名 + */ + private String handleUserName; + + /** + * 删除标识 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-project/gov-project-client/src/main/java/com/epmet/dto/form/SendToFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SendToFormDTO.java new file mode 100644 index 0000000000..4060fc2c43 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/SendToFormDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dto.form; + +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.Valid; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/3/17 14:31 + */ +@Data +public class SendToFormDTO implements Serializable { + private static final long serialVersionUID = -2556534032778491105L; + @NotBlank(message = "项目Id不能为空") + private String projectId; + + @NotBlank(message = "项目人员关联Id不能为空") + private String projectStaffId; + + @Length(max=1000,message = "公开答复内容不能超过1000位") + private String publicReply; + + @NotBlank(message = "内部备注不能为空") + @Length(max=1000,message = "内部备注不能超过1000位") + private String internalRemark; + + @NotBlank(message = "外部系统ID不能为空") + private String platformId; + + @NotBlank(message = "外部系统名不能为空") + private String platformName; + + @Valid + private List staffList; + + /** + * 公开答复对应文件集合 + */ + private List publicFile; + /** + * 内部备注对应文件集合 + */ + private List internalFile; +} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java index 1e7460c5ad..2f3da4a57f 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java @@ -13,6 +13,7 @@ import java.util.List; @Data public class ProcessListV2ResultDTO implements Serializable { + private static final long serialVersionUID = 5762152044573235897L; /** * 项目ID */ @@ -47,6 +48,10 @@ public class ProcessListV2ResultDTO implements Serializable { * 内部备注 */ private String internalRemark; + /** + * 子节点 + */ + private List subProcess; /** * diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java index 7f309667f0..71bf83682a 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java @@ -60,6 +60,10 @@ public class ProjectDetailResultDTO implements Serializable { * 当前跟进部门 */ private List departmentList; + /** + * 是否能发送到外部系统 + */ + private Boolean isSend; @NoArgsConstructor @Data diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java new file mode 100644 index 0000000000..9a2c3406f7 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java @@ -0,0 +1,40 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/3/17 14:45 + */ +@Data +public class SubProcessDTO implements Serializable { + private static final long serialVersionUID = -3292921180067385861L; + /** + * 外部平台名 + */ + private String platformName; + /** + * 处理状态 + */ + private String externalStatus; + /** + * 处理时间 + */ + private String processTime; + /** + * 处理人 + */ + private String handleUserName; + /** + * 处理内容 + */ + private String result; + private List subFile; + + + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubAttachmentController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubAttachmentController.java new file mode 100644 index 0000000000..cf760dab22 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubAttachmentController.java @@ -0,0 +1,85 @@ +/** + * 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.page.PageData; +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.ProjectSubAttachmentDTO; +import com.epmet.service.ProjectSubAttachmentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 外部系统事件附件 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-17 + */ +@RestController +@RequestMapping("projectsubattachment") +public class ProjectSubAttachmentController { + + @Autowired + private ProjectSubAttachmentService projectSubAttachmentService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = projectSubAttachmentService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ProjectSubAttachmentDTO data = projectSubAttachmentService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ProjectSubAttachmentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + projectSubAttachmentService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ProjectSubAttachmentDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + projectSubAttachmentService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + projectSubAttachmentService.delete(ids); + return new Result(); + } + + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubProcessController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubProcessController.java new file mode 100644 index 0000000000..f91488f983 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectSubProcessController.java @@ -0,0 +1,85 @@ +/** + * 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.page.PageData; +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.ProjectSubProcessDTO; +import com.epmet.service.ProjectSubProcessService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.Map; + + +/** + * 节点事件关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-17 + */ +@RestController +@RequestMapping("projectsubprocess") +public class ProjectSubProcessController { + + @Autowired + private ProjectSubProcessService projectSubProcessService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = projectSubProcessService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + ProjectSubProcessDTO data = projectSubProcessService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody ProjectSubProcessDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + projectSubProcessService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody ProjectSubProcessDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + projectSubProcessService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + projectSubProcessService.delete(ids); + return new Result(); + } + + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java index db5d13ab24..c7d3a8c09a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTraceController.java @@ -319,5 +319,21 @@ public class ProjectTraceController { return new Result(); } + /** + * 发送到外部平台 + * @author zhaoqifeng + * @date 2021/3/17 14:34 + * @param tokenDTO + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("sendto") + @RequirePermission(requirePermission = RequirePermissionEnum.WORK_PROJECT_TRACE_TRANSFER) + public Result sendTo(@LoginUser TokenDto tokenDTO, @RequestBody SendToFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + projectTraceService.sendTo(tokenDTO, formDTO); + return new Result(); + } + } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubAttachmentDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubAttachmentDao.java new file mode 100644 index 0000000000..58b5a192c8 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubAttachmentDao.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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.ProjectSubAttachmentEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 外部系统事件附件 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-17 + */ +@Mapper +public interface ProjectSubAttachmentDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java new file mode 100644 index 0000000000..0d36cd36c3 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.ProjectSubProcessEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 节点事件关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-17 + */ +@Mapper +public interface ProjectSubProcessDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubAttachmentEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubAttachmentEntity.java new file mode 100644 index 0000000000..f0f0ac20ba --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubAttachmentEntity.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.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-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("project_sub_attachment") +public class ProjectSubAttachmentEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 项目ID + */ + private String projectId; + + /** + * 子节点ID + */ + private String subId; + + /** + * 事件ID + */ + private String taskId; + + /** + * 附件名 + */ + private String attachmentName; + + /** + * 文件大小 单位b + */ + private Integer attachmentSize; + + /** + * 文件格式 + */ + private String attachmentFormat; + + /** + * 类型 + */ + private String attachmentType; + + /** + * 附件地址 + */ + private String attachmentUrl; + + /** + * 语音或视频时长,秒 + */ + private Integer duration; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubProcessEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubProcessEntity.java new file mode 100644 index 0000000000..ee451e6416 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectSubProcessEntity.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.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-17 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("project_sub_process") +public class ProjectSubProcessEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 项目ID + */ + private String projectId; + + /** + * 节点ID + */ + private String processId; + + /** + * 项目人员关联表ID + */ + private String staffId; + + /** + * 系统ID + */ + private String platformId; + + /** + * 系统名 + */ + private String platformName; + + /** + * 第三方平台返回的项目关联ID(事件Id) + */ + private String taskId; + + /** + * 事件处理详细内容 + */ + private String result; + + /** + * 外部状态:1待处理,2待核实,3已上报,4已完结,5处理中,6待分发,7归档,8催办,9超时 + */ + private String externalStatus; + + /** + * 外部状态描述 + */ + private String externalStatusDesc; + + /** + * 内部状态:待处理 pending,结案closed + */ + private String internalStatus; + + /** + * 处理日期 + */ + private Date handleDate; + + /** + * 处理人姓名 + */ + private String handleUserName; + +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubAttachmentService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubAttachmentService.java new file mode 100644 index 0000000000..94ee34d06f --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubAttachmentService.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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.ProjectSubAttachmentDTO; +import com.epmet.entity.ProjectSubAttachmentEntity; + +import java.util.List; +import java.util.Map; + +/** + * 外部系统事件附件 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-17 + */ +public interface ProjectSubAttachmentService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-03-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-03-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ProjectSubAttachmentDTO + * @author generator + * @date 2021-03-17 + */ + ProjectSubAttachmentDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-17 + */ + void save(ProjectSubAttachmentDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-17 + */ + void update(ProjectSubAttachmentDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-03-17 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java new file mode 100644 index 0000000000..c329a3aa95 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.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.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.ProjectSubProcessDTO; +import com.epmet.entity.ProjectSubProcessEntity; + +import java.util.List; +import java.util.Map; + +/** + * 节点事件关联表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-17 + */ +public interface ProjectSubProcessService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2021-03-17 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2021-03-17 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return ProjectSubProcessDTO + * @author generator + * @date 2021-03-17 + */ + ProjectSubProcessDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-17 + */ + void save(ProjectSubProcessDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2021-03-17 + */ + void update(ProjectSubProcessDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2021-03-17 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java index 3b5d227ea4..f692900851 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectTraceService.java @@ -149,4 +149,14 @@ public interface ProjectTraceService { * @author sun */ void responseV2(TokenDto tokenDto, ProjectResponseFormDTO formDTO); + + /** + * 发送到外部平台 + * @author zhaoqifeng + * @date 2021/3/17 14:33 + * @param tokenDto + * @param formDTO + * @return void + */ + void sendTo(TokenDto tokenDto, SendToFormDTO formDTO); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 309377bb4b..ec471bd67b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -280,6 +280,7 @@ public class ProjectServiceImpl extends BaseServiceImpl departmentList = projectStaffService.getDepartmentNameList(projectStaffDTO); if (null != departmentList && departmentList.size() > NumConstant.ZERO) { + //TODO external_system值为1时,根据departmentList里的projectStaffId在project_sub_process表找最新的一条记录,如果没有记录或者INTERNAL_STATUS是closed,processable + // 的值为true resultDTO.setProcessable(true); } else { resultDTO.setProcessable(false); diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubAttachmentServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubAttachmentServiceImpl.java new file mode 100644 index 0000000000..b87f5238ac --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubAttachmentServiceImpl.java @@ -0,0 +1,100 @@ +/** + * 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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.ProjectSubAttachmentDao; +import com.epmet.dto.ProjectSubAttachmentDTO; +import com.epmet.entity.ProjectSubAttachmentEntity; +import com.epmet.service.ProjectSubAttachmentService; +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-17 + */ +@Service +public class ProjectSubAttachmentServiceImpl extends BaseServiceImpl implements ProjectSubAttachmentService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ProjectSubAttachmentDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ProjectSubAttachmentDTO.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 ProjectSubAttachmentDTO get(String id) { + ProjectSubAttachmentEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ProjectSubAttachmentDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ProjectSubAttachmentDTO dto) { + ProjectSubAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ProjectSubAttachmentEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProjectSubAttachmentDTO dto) { + ProjectSubAttachmentEntity entity = ConvertUtils.sourceToTarget(dto, ProjectSubAttachmentEntity.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/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java new file mode 100644 index 0000000000..d3cb6457c1 --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java @@ -0,0 +1,100 @@ +/** + * 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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dao.ProjectSubProcessDao; +import com.epmet.dto.ProjectSubProcessDTO; +import com.epmet.entity.ProjectSubProcessEntity; +import com.epmet.service.ProjectSubProcessService; +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-17 + */ +@Service +public class ProjectSubProcessServiceImpl extends BaseServiceImpl implements ProjectSubProcessService { + + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, ProjectSubProcessDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, ProjectSubProcessDTO.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 ProjectSubProcessDTO get(String id) { + ProjectSubProcessEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, ProjectSubProcessDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(ProjectSubProcessDTO dto) { + ProjectSubProcessEntity entity = ConvertUtils.sourceToTarget(dto, ProjectSubProcessEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProjectSubProcessDTO dto) { + ProjectSubProcessEntity entity = ConvertUtils.sourceToTarget(dto, ProjectSubProcessEntity.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/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java index f2801b0c25..9009eedc3c 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java @@ -182,4 +182,18 @@ public class ProjectTraceServiceImpl implements ProjectTraceService { projectService.responseV2(formDTO); } + /** + * 发送到外部平台 + * + * @param tokenDto + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2021/3/17 14:33 + */ + @Override + public void sendTo(TokenDto tokenDto, SendToFormDTO formDTO) { + + } + } 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..7bbb56d5bc --- /dev/null +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectSubProcessDao.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 9c1a1d89efa7f8ed83ed2b47b97f27a7b882aaaa Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 18 Mar 2021 13:35:04 +0800 Subject: [PATCH 10/51] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/ThirdPlatformFormDTO.java | 10 ++++--- ...ltDTO.java => ThirdplatformResultDTO.java} | 9 ++---- .../controller/ThirdPlatformController.java | 28 +++++++++++++------ .../dao/ThirdplatformCustomerRegisterDao.java | 10 +------ .../java/com/epmet/dao/ThirdplatformDao.java | 11 +++++++- .../com/epmet/entity/ThirdplatformEntity.java | 5 ++++ .../epmet/service/ThirdPlatformService.java | 4 +-- .../impl/ThirdPlatformServiceImpl.java | 9 +++--- .../ThirdplatformCustomerRegisterDao.xml | 24 ---------------- .../resources/mapper/ThirdplatformDao.xml | 27 ++++++++++++++++++ 10 files changed, 79 insertions(+), 58 deletions(-) rename epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/{ThirdplatformCustomerRegisterResultDTO.java => ThirdplatformResultDTO.java} (57%) 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 index 3f488e75c1..c2ff1a3666 100644 --- 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 @@ -7,13 +7,15 @@ import javax.validation.constraints.NotBlank; @Data public class ThirdPlatformFormDTO { - // 列出注册关系分组 - public static interface ListRegRelsGroups {} + // 根据客户和动作查询分组 + public interface ListByCustomerAndActionGroup {} + // 根据动作查询分组 + public interface ListByActionGroup {} - @NotBlank(message = "客户ID不能为空", groups = { ListRegRelsGroups.class }) + @NotBlank(message = "客户ID不能为空", groups = { ListByCustomerAndActionGroup.class }) private String customerId; - @NotBlank(message = "客户ID不能为空", groups = { ListRegRelsGroups.class }) + @NotBlank(message = "客户ID不能为空", groups = { ListByCustomerAndActionGroup.class, ListByActionGroup.class }) private String actionKey; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java similarity index 57% rename from epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java rename to epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java index d637837fbc..6b0b163048 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformCustomerRegisterResultDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/ThirdplatformResultDTO.java @@ -3,16 +3,13 @@ package com.epmet.dto.result; import lombok.Data; @Data -public class ThirdplatformCustomerRegisterResultDTO { - /** - * - */ - private String customerId; - +public class ThirdplatformResultDTO { /** * */ private String platformId; private String platformName; + + private String icon; } 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 index 64c7f0e7f0..a8196d2520 100644 --- 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 @@ -3,7 +3,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.ThirdPlatformFormDTO; -import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.service.ThirdPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -20,20 +20,32 @@ import java.util.List; @RequestMapping("thirdplatform") public class ThirdPlatformController { - @Autowired private ThirdPlatformService thirdPlatformService; /** - * 列出第三方平台注册关系 + * 根据客户id和动作,列出客户开通可用的第三方平台 * @param input * @return */ - @PostMapping("list-reg-rels") - public Result> listRegsteredPlatforms(@RequestBody ThirdPlatformFormDTO input) { - ValidatorUtils.validateEntity(input); - List platformRegs = thirdPlatformService.listByCustomerId(input.getCustomerId(), input.getActionKey()); - return new Result>().ok(platformRegs); + @PostMapping("customer/list-platforms-by-action") + public Result> listPlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input) { + ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListByCustomerAndActionGroup.class); + List platformRegs = thirdPlatformService.listDTOS(input.getCustomerId(), input.getActionKey()); + return new Result>().ok(platformRegs); + } + + /** + * @Description 根据动作列出平台列表 + * @return + * @author wxz + * @date 2021.03.18 10:54 + */ + @PostMapping("list-platforms-by-action") + public Result> listPlatformsByAction(@RequestBody ThirdPlatformFormDTO input) { + ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListByActionGroup.class); + List platformRegs = thirdPlatformService.listDTOS(null, input.getActionKey()); + return new Result>().ok(platformRegs); } //@PostMapping("register") 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 index b5ffe5cf82..cbae094292 100644 --- 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 @@ -18,8 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.constant.ThirdPlatformConstant; -import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -35,12 +34,5 @@ import java.util.List; @Mapper public interface ThirdplatformCustomerRegisterDao extends BaseDao { - /** - * 动态sql查询 - * @param customerId - * @return - */ - List listDTOS(@Param("customerId") String customerId, @Param("actionKey") String actionKey); - ThirdplatformCustomerRegisterEntity getByCustomerIdAndPlatformId(@Param("customerId") String customerId, @Param("platformId") String platformId); } \ No newline at end of file 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 index 593d20923f..e86e63b7f2 100644 --- 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 @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +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; /** * @@ -29,5 +33,10 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ThirdplatformDao extends BaseDao { - + /** + * 动态sql查询 + * @param customerId + * @return + */ + List listDTOS(@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/entity/ThirdplatformEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformEntity.java index d756c81b88..d5b20b8eab 100644 --- 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 @@ -63,4 +63,9 @@ public class ThirdplatformEntity extends BaseEpmetEntity { */ private String baseUrl; + /** + * icon + */ + private String icon; + } 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 index 74b4cab44f..8110c4b5b3 100644 --- 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 @@ -1,11 +1,11 @@ package com.epmet.service; -import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import java.util.List; public interface ThirdPlatformService { - List listByCustomerId(String customerId, String actionKey); + List listDTOS(String customerId, String actionKey); } \ No newline at end of file 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 index 40556ebaca..5e23671983 100644 --- 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 @@ -1,7 +1,8 @@ package com.epmet.service.impl; import com.epmet.dao.ThirdplatformCustomerRegisterDao; -import com.epmet.dto.result.ThirdplatformCustomerRegisterResultDTO; +import com.epmet.dao.ThirdplatformDao; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.service.ThirdPlatformService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -12,10 +13,10 @@ import java.util.List; public class ThirdPlatformServiceImpl implements ThirdPlatformService { @Autowired - private ThirdplatformCustomerRegisterDao thirdplatformCustomerRegisterDao; + private ThirdplatformDao thirdplatformDao; @Override - public List listByCustomerId(String customerId, String actionKey) { - return thirdplatformCustomerRegisterDao.listDTOS(customerId, actionKey); + public List listDTOS(String customerId, String actionKey) { + return thirdplatformDao.listDTOS(customerId, actionKey); } } 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 index 10edc458e3..4e5577228e 100644 --- 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 @@ -31,28 +31,4 @@ and PLATFORM_ID = #{platformId} and DEL_FLAG = 0 - - - - \ No newline at end of file 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 index 0bc68d7af2..0db6eba1f2 100644 --- 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 @@ -9,6 +9,7 @@ + @@ -17,5 +18,31 @@ + \ No newline at end of file From 6f9bbcfaa991d301d25c78f187244702551a83e4 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 18 Mar 2021 13:42:59 +0800 Subject: [PATCH 11/51] =?UTF-8?q?trace/projectdetail=20api=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/ProjectDetailFromDTO.java | 5 +++++ .../com/epmet/constant/ProjectConstant.java | 2 ++ .../com/epmet/dao/ProjectSubProcessDao.java | 14 +++++++++++++- .../service/ProjectSubProcessService.java | 8 ++++++++ .../service/impl/ProjectServiceImpl.java | 19 ++++++++++++++++--- .../impl/ProjectSubProcessServiceImpl.java | 11 +++++++++++ .../service/impl/ProjectTraceServiceImpl.java | 1 + .../resources/mapper/ProjectSubProcessDao.xml | 18 ++++++++++++++++++ 8 files changed, 74 insertions(+), 4 deletions(-) diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectDetailFromDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectDetailFromDTO.java index 28178701c5..7bf6e633a8 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectDetailFromDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ProjectDetailFromDTO.java @@ -22,4 +22,9 @@ public class ProjectDetailFromDTO implements Serializable { * 用户ID */ private String userId; + + /** + * 客户ID + */ + private String customerId; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index c883ad7153..6bae43e57b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -158,4 +158,6 @@ public interface ProjectConstant { String INTERNAL = "internal"; String NOT_EXIST_PROJECT = "未查询带此项目信息......"; + + String EXTERNAL_SYSTEM = "external_system"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java index 0d36cd36c3..43dcf571db 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ProjectSubProcessDTO; import com.epmet.entity.ProjectSubProcessEntity; 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 ProjectSubProcessDao extends BaseDao { - + + /** + * @Description 查询最新记录 + * @Param projectStaffIds + * @author zxc + * @date 2021/3/18 上午11:17 + */ + ProjectSubProcessDTO selectSubProcess(@Param("projectStaffIds") List projectStaffIds); + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java index c329a3aa95..b58f9c8a5a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java @@ -92,4 +92,12 @@ public interface ProjectSubProcessService extends BaseService projectStaffIds); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index ec471bd67b..65da591036 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -107,6 +107,8 @@ public class ProjectServiceImpl extends BaseServiceImpl departmentList = projectStaffService.getDepartmentNameList(projectStaffDTO); if (null != departmentList && departmentList.size() > NumConstant.ZERO) { - //TODO external_system值为1时,根据departmentList里的projectStaffId在project_sub_process表找最新的一条记录,如果没有记录或者INTERNAL_STATUS是closed,processable - // 的值为true - resultDTO.setProcessable(true); + //TODO external_system值为1时,根据departmentList里的projectStaffId在project_sub_process表找最新的一条记录, + // 如果没有记录或者INTERNAL_STATUS是closed,processable的值为true + if (resultDTO.getIsSend()){ + List projectStaffIds = departmentList.stream().map(m -> m.getProjectStaffId()).distinct().collect(Collectors.toList()); + ProjectSubProcessDTO projectSubProcessDTO = projectSubProcessService.selectSubProcess(projectStaffIds); + resultDTO.setProcessable((null == projectSubProcessDTO || projectSubProcessDTO.getInternalStatus().equals(ProjectConstant.CLOSED)) ? true : false); + }else { + resultDTO.setProcessable(false); + } } else { resultDTO.setProcessable(false); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java index d3cb6457c1..ed03aefbc4 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java @@ -97,4 +97,15 @@ public class ProjectSubProcessServiceImpl extends BaseServiceImpl projectStaffIds) { + return null; + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java index 9009eedc3c..c3c88b663f 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java @@ -67,6 +67,7 @@ public class ProjectTraceServiceImpl implements ProjectTraceService { @Override public ProjectDetailResultDTO getProjectDetail(TokenDto tokenDto, ProjectDetailFromDTO fromDTO) { fromDTO.setUserId(tokenDto.getUserId()); + fromDTO.setCustomerId(tokenDto.getCustomerId()); return projectService.getProjectDetail(fromDTO); } 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 index 7bbb56d5bc..f81f5e23f8 100644 --- 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 @@ -26,5 +26,23 @@ + + + \ No newline at end of file From f970eeb74ee1743a7ffb7033da92e87e863013e8 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 18 Mar 2021 14:17:31 +0800 Subject: [PATCH 12/51] =?UTF-8?q?trace/projectdetail=20api=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/ProjectServiceImpl.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 65da591036..5e07865804 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -301,12 +301,20 @@ public class ProjectServiceImpl extends BaseServiceImpl NumConstant.ZERO) { //TODO external_system值为1时,根据departmentList里的projectStaffId在project_sub_process表找最新的一条记录, // 如果没有记录或者INTERNAL_STATUS是closed,processable的值为true - if (resultDTO.getIsSend()){ + if (parameterValue.equals(NumConstant.ONE_STR)) { List projectStaffIds = departmentList.stream().map(m -> m.getProjectStaffId()).distinct().collect(Collectors.toList()); + // 根据departmentList里的projectStaffId在project_sub_process表找最新的一条记录 ProjectSubProcessDTO projectSubProcessDTO = projectSubProcessService.selectSubProcess(projectStaffIds); - resultDTO.setProcessable((null == projectSubProcessDTO || projectSubProcessDTO.getInternalStatus().equals(ProjectConstant.CLOSED)) ? true : false); - }else { - resultDTO.setProcessable(false); + if (null == projectSubProcessDTO || projectSubProcessDTO.getInternalStatus().equals(ProjectConstant.CLOSED)) { + resultDTO.setProcessable(true); + resultDTO.setIsSend(true); + } else { + resultDTO.setProcessable(false); + resultDTO.setIsSend(false); + } + } else { + resultDTO.setProcessable(true); + resultDTO.setIsSend(false); } } else { resultDTO.setProcessable(false); From 2d72f75c8d8c615a74c444034c6f95d7b8628c02 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 18 Mar 2021 14:25:42 +0800 Subject: [PATCH 13/51] =?UTF-8?q?project=5Fprocess=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/ProjectProcessDTO.java | 5 +++++ .../src/main/java/com/epmet/entity/ProjectProcessEntity.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessDTO.java index 689b3317d1..aa8bfd0387 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/ProjectProcessDTO.java @@ -134,4 +134,9 @@ public class ProjectProcessDTO implements Serializable { */ private String orgIdPath; + /** + * 是否发送到外部系统 + */ + private Integer isSend; + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessEntity.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessEntity.java index a862140529..9569803906 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessEntity.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/entity/ProjectProcessEntity.java @@ -108,4 +108,9 @@ public class ProjectProcessEntity extends BaseEpmetEntity { */ private String orgIdPath; + /** + * 是否发送到外部系统 + */ + private Integer isSend; + } From 56cd038c34fb6f3c0b4097232a1d79f34f88585e Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 18 Mar 2021 14:26:48 +0800 Subject: [PATCH 14/51] =?UTF-8?q?=E5=8D=87=E7=BA=A7auth=EF=BC=9A=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=94=9F=E4=BA=A7=E7=8E=AF=E5=A2=83=20jcet=20g?= =?UTF-8?q?=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/service/impl/SsoServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3f77b56af1..f051924c9e 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/SsoServiceImpl.java @@ -166,7 +166,7 @@ public class SsoServiceImpl implements SsoService { //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()); } From f1be2842b8944c85a22992b7d83037b7c8f3a13a Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 18 Mar 2021 15:53:15 +0800 Subject: [PATCH 15/51] =?UTF-8?q?trace/processList-v2=20api=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/ProcessListV2ResultDTO.java | 6 ++++ .../com/epmet/dto/result/SubProcessDTO.java | 1 + .../com/epmet/dao/ProjectSubProcessDao.java | 9 +++++ .../service/ProjectSubProcessService.java | 9 +++++ .../impl/ProjectSubProcessServiceImpl.java | 14 +++++++- .../service/impl/ProjectTraceServiceImpl.java | 15 +++++--- .../resources/mapper/ProjectProcessDao.xml | 3 +- .../resources/mapper/ProjectSubProcessDao.xml | 36 +++++++++++++++++++ 8 files changed, 87 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java index 2f3da4a57f..cea1ce6288 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProcessListV2ResultDTO.java @@ -44,6 +44,11 @@ public class ProcessListV2ResultDTO implements Serializable { */ private String publicReply; + /** + * 是否发送到外部系统 0否 1是 + */ + private Integer isSend; + /** * 内部备注 */ @@ -73,5 +78,6 @@ public class ProcessListV2ResultDTO implements Serializable { this.internalRemark = ""; this.publicFile = new ArrayList<>(); this.internalFile = new ArrayList<>(); + this.subProcess = new ArrayList<>(); } } diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java index 9a2c3406f7..a5a8f871f8 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java @@ -29,6 +29,7 @@ public class SubProcessDTO implements Serializable { * 处理人 */ private String handleUserName; + private String subId; /** * 处理内容 */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java index 43dcf571db..dd887c38be 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ProjectSubProcessDTO; +import com.epmet.dto.result.SubProcessDTO; import com.epmet.entity.ProjectSubProcessEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -42,4 +43,12 @@ public interface ProjectSubProcessDao extends BaseDao { */ ProjectSubProcessDTO selectSubProcess(@Param("projectStaffIds") List projectStaffIds); + /** + * @Description 查询进展和附件 + * @Param processId + * @author zxc + * @date 2021/3/18 下午2:57 + */ + List selectSubProcessAndAttachment(@Param("processId") String processId); + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java index b58f9c8a5a..9d1aba55f9 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java @@ -20,6 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.ProjectSubProcessDTO; +import com.epmet.dto.result.SubProcessDTO; import com.epmet.entity.ProjectSubProcessEntity; import java.util.List; @@ -100,4 +101,12 @@ public interface ProjectSubProcessService extends BaseService projectStaffIds); + + /** + * @Description 查询进展和附件 + * @Param processId + * @author zxc + * @date 2021/3/18 下午2:57 + */ + List selectSubProcessAndAttachment(String processId); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java index ed03aefbc4..3314826387 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.ProjectSubProcessDao; import com.epmet.dto.ProjectSubProcessDTO; +import com.epmet.dto.result.SubProcessDTO; import com.epmet.entity.ProjectSubProcessEntity; import com.epmet.service.ProjectSubProcessService; import org.apache.commons.lang3.StringUtils; @@ -105,7 +106,18 @@ public class ProjectSubProcessServiceImpl extends BaseServiceImpl projectStaffIds) { - return null; + return baseDao.selectSubProcess(projectStaffIds); + } + + /** + * @Description 查询进展和附件 + * @Param processId + * @author zxc + * @date 2021/3/18 下午2:57 + */ + @Override + public List selectSubProcessAndAttachment(String processId) { + return baseDao.selectSubProcessAndAttachment(processId); } } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java index c3c88b663f..0faaefda73 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -11,10 +12,7 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.entity.ProjectStaffEntity; import com.epmet.feign.GovOrgFeignClient; -import com.epmet.service.ProjectProcessService; -import com.epmet.service.ProjectService; -import com.epmet.service.ProjectStaffService; -import com.epmet.service.ProjectTraceService; +import com.epmet.service.*; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -45,6 +43,8 @@ public class ProjectTraceServiceImpl implements ProjectTraceService { private ProjectProcessDao projectProcessDao; @Autowired private ProjectProcessAttachmentDao attachmentDao; + @Autowired + private ProjectSubProcessService projectSubProcessService; @Override public List getPendProjectList(TokenDto tokenDto, ProjectListFromDTO fromDTO) { @@ -144,6 +144,13 @@ public class ProjectTraceServiceImpl implements ProjectTraceService { log.warn(ProjectConstant.NOT_EXIST_PROJECT); return new ArrayList<>(); } + // 是否发送到外部系统 0否 1是 + processList.forEach(p -> { + if (p.getIsSend().equals(NumConstant.ONE)){ + p.setSubProcess(projectSubProcessService.selectSubProcessAndAttachment(p.getProcessId())); + } + }); + // 查询进展附件列表 List files = attachmentDao.selectAttachByProjectId(formDTO.getProjectId()); if (!CollectionUtils.isEmpty(files)){ diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectProcessDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectProcessDao.xml index 27bb86c807..131ba02434 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectProcessDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectProcessDao.xml @@ -94,7 +94,8 @@ UNIX_TIMESTAMP(created_time) AS processTime, DEPARTMENT_NAME, PUBLIC_REPLY, - INTERNAL_REMARK + INTERNAL_REMARK, + IS_SEND FROM project_process WHERE DEL_FLAG = '0' AND PROJECT_ID = #{projectId} 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 index f81f5e23f8..893fb54b1c 100644 --- 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 @@ -44,5 +44,41 @@ + + + + + + + + + + + + + \ No newline at end of file From c5fd4f60adb2ab735a9f2bd5242fdf31e84f45d2 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 18 Mar 2021 16:01:22 +0800 Subject: [PATCH 16/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0=E5=AF=B9=E6=8E=A5=E7=9A=84=E8=AE=BE?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/ThirdPlatformFormDTO.java | 8 +-- .../controller/ThirdPlatformController.java | 26 ++++----- .../dao/ThirdplatformCustomerActionDao.java | 33 +++++++++++ .../java/com/epmet/dao/ThirdplatformDao.java | 4 ++ .../ThirdplatformCustomerActionEntity.java | 56 +++++++++++++++++++ .../ThirdplatformCustomerRegisterEntity.java | 4 ++ .../epmet/service/ThirdPlatformService.java | 3 +- .../impl/ThirdPlatformServiceImpl.java | 10 +++- .../mapper/ThirdplatformCustomerActionDao.xml | 20 +++++++ .../ThirdplatformCustomerRegisterDao.xml | 4 ++ .../resources/mapper/ThirdplatformDao.xml | 42 ++++++++++++++ 11 files changed, 189 insertions(+), 21 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/ThirdplatformCustomerActionEntity.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml 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 index c2ff1a3666..475a09a4de 100644 --- 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 @@ -8,14 +8,14 @@ import javax.validation.constraints.NotBlank; public class ThirdPlatformFormDTO { // 根据客户和动作查询分组 - public interface ListByCustomerAndActionGroup {} + public interface ListAvailableByCustomerAndActionGroup {} // 根据动作查询分组 - public interface ListByActionGroup {} + public interface ListSelectableByCustomerAndActionGroup {} - @NotBlank(message = "客户ID不能为空", groups = { ListByCustomerAndActionGroup.class }) + @NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class }) private String customerId; - @NotBlank(message = "客户ID不能为空", groups = { ListByCustomerAndActionGroup.class, ListByActionGroup.class }) + @NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, ListSelectableByCustomerAndActionGroup.class }) private String actionKey; } 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 index a8196d2520..92976c57e1 100644 --- 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 @@ -24,32 +24,32 @@ public class ThirdPlatformController { private ThirdPlatformService thirdPlatformService; /** - * 根据客户id和动作,列出客户开通可用的第三方平台 + * 根据客户id和动作,列出客户登记可用的第三方平台 + * * @param input * @return */ - @PostMapping("customer/list-platforms-by-action") - public Result> listPlatformsByCustomerAndAction(@RequestBody ThirdPlatformFormDTO input) { - ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListByCustomerAndActionGroup.class); - List platformRegs = thirdPlatformService.listDTOS(input.getCustomerId(), input.getActionKey()); + @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); } /** - * @Description 根据动作列出平台列表 * @return + * @Description 根据客户id和动作,列出客户可选的第三方系统 * @author wxz * @date 2021.03.18 10:54 - */ - @PostMapping("list-platforms-by-action") - public Result> listPlatformsByAction(@RequestBody ThirdPlatformFormDTO input) { - ValidatorUtils.validateEntity(input, ThirdPlatformFormDTO.ListByActionGroup.class); - List platformRegs = thirdPlatformService.listDTOS(null, input.getActionKey()); - return new Result>().ok(platformRegs); + */ + @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); } //@PostMapping("register") - } 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..4b937061fd --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ThirdplatformCustomerActionDao.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.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.ThirdplatformCustomerActionEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 客户针对指定操作所选用的第三方平台列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-03-18 + */ +@Mapper +public interface ThirdplatformCustomerActionDao extends BaseDao { + +} \ No newline at end of file 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 index e86e63b7f2..8b5e7840cc 100644 --- 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 @@ -39,4 +39,8 @@ public interface ThirdplatformDao extends BaseDao { * @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); } \ No newline at end of file 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 index b3b77fb626..8f19691433 100644 --- 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 @@ -48,4 +48,8 @@ public class ThirdplatformCustomerRegisterEntity extends BaseEpmetEntity { */ private String platformId; + private String customizedPlatformName; + + private String customizedPlatformIcon; + } 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 index 8110c4b5b3..aa86027db9 100644 --- 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 @@ -6,6 +6,7 @@ import java.util.List; public interface ThirdPlatformService { - List listDTOS(String customerId, String actionKey); + List listAvailablePlatformsByCustomerAndAction(String customerId, String actionKey); + List listSelectableByCustomerAndActionGroup(String customerId, String actionKey); } \ No newline at end of file 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 index 5e23671983..9a7ed8bb3c 100644 --- 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 @@ -1,6 +1,5 @@ package com.epmet.service.impl; -import com.epmet.dao.ThirdplatformCustomerRegisterDao; import com.epmet.dao.ThirdplatformDao; import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.service.ThirdPlatformService; @@ -16,7 +15,12 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService { private ThirdplatformDao thirdplatformDao; @Override - public List listDTOS(String customerId, String actionKey) { - return thirdplatformDao.listDTOS(customerId, actionKey); + 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); } } 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..33c76cfd7a --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ThirdplatformCustomerActionDao.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ 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 index 4e5577228e..e4cdddc98d 100644 --- 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 @@ -7,6 +7,8 @@ + + @@ -20,6 +22,8 @@ select tcr.id, customer_id, platform_id, + customized_platform_name, + customized_platform_icon, del_flag, revision, created_by, 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 index 0db6eba1f2..beec9ed36d 100644 --- 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 @@ -45,4 +45,46 @@ + + + \ No newline at end of file From a66f848d956b58910150c106a6a4952b229c350f Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 18 Mar 2021 16:09:46 +0800 Subject: [PATCH 17/51] =?UTF-8?q?trace/processList-v2=20api=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/ProjectSubProcessServiceImpl.java | 8 ++++++++ .../com/epmet/service/impl/ProjectTraceServiceImpl.java | 1 + 2 files changed, 9 insertions(+) diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java index 3314826387..ffbae9a85f 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java @@ -31,7 +31,9 @@ import com.epmet.service.ProjectSubProcessService; import org.apache.commons.lang3.StringUtils; 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; @@ -106,6 +108,9 @@ public class ProjectSubProcessServiceImpl extends BaseServiceImpl projectStaffIds) { + if (CollectionUtils.isEmpty(projectStaffIds)){ + return null; + } return baseDao.selectSubProcess(projectStaffIds); } @@ -117,6 +122,9 @@ public class ProjectSubProcessServiceImpl extends BaseServiceImpl selectSubProcessAndAttachment(String processId) { + if (StringUtils.isEmpty(processId)){ + return new ArrayList<>(); + } return baseDao.selectSubProcessAndAttachment(processId); } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java index 0faaefda73..c7d29968da 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java @@ -147,6 +147,7 @@ public class ProjectTraceServiceImpl implements ProjectTraceService { // 是否发送到外部系统 0否 1是 processList.forEach(p -> { if (p.getIsSend().equals(NumConstant.ONE)){ + // 赋值 子节点 p.setSubProcess(projectSubProcessService.selectSubProcessAndAttachment(p.getProcessId())); } }); From 57900ec03fc5e09f6e71f799a64e0b8a792c6b06 Mon Sep 17 00:00:00 2001 From: wangchao Date: Thu, 18 Mar 2021 16:19:31 +0800 Subject: [PATCH 18/51] =?UTF-8?q?issueVoteStats=E4=BB=BB=E5=8A=A1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dao/IssueVoteDetailDao.java | 18 ++++ .../com/epmet/redis/IssueVoteDetailRedis.java | 37 +++++++- .../impl/IssueVoteStatisticalServiceImpl.java | 86 ++++++++++++------- .../resources/mapper/IssueVoteDetailDao.xml | 36 ++++++++ 4 files changed, 141 insertions(+), 36 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java index 622a68e6cd..c5c96901ea 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueVoteDetailDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.IssueVoteDetailDTO; import com.epmet.dto.form.VoteFormDTO; +import com.epmet.dto.form.VoteRedisFormDTO; import com.epmet.dto.result.IssueAttitudeCountResultDTO; import com.epmet.dto.result.MyPartIssuesResultDTO; import com.epmet.entity.IssueVoteDetailEntity; @@ -95,4 +96,21 @@ public interface IssueVoteDetailDao extends BaseDao { * @Date 2020/11/18 14:35 **/ IssueVoteDetailDTO selectUserIssueDet(@Param("userId") String userId, @Param("issueId") String issueId); + + /** + * @Description 统计出一个议题的所有支持数和反对数 + * @param issueId + * @return com.epmet.dto.form.VoteRedisFormDTO + * @author wangc + * @date 2021.03.03 18:09 + */ + VoteRedisFormDTO selectInfo4Cache(@Param("issueId") String issueId); + /** + * @Description 批量统计出议题的所有支持数和反对数 + * @param issueIds + * @return java.util.Set + * @author wangc + * @date 2021.03.18 14:58 + */ + List selectBatchVoteCount(@Param("issueIds")Set issueIds); } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java index 268ddfbf88..a4a1439936 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/redis/IssueVoteDetailRedis.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.IssueConstant; +import com.epmet.dao.IssueVoteDetailDao; import com.epmet.dto.IssueDTO; import com.epmet.dto.form.CommonGridIdFormDTO; import com.epmet.dto.form.VoteRedisFormDTO; @@ -29,14 +30,20 @@ import com.epmet.feign.ResiGroupFeignClient; import com.epmet.service.IssueService; import com.epmet.service.IssueVoteDetailService; import com.epmet.utils.ModuleConstants; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import java.lang.reflect.Field; +import java.util.List; import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; import static com.epmet.commons.tools.redis.RedisUtils.NOT_EXPIRE; @@ -59,13 +66,37 @@ public class IssueVoteDetailRedis { @Autowired private IssueService issueService; + @Autowired + private RedisTemplate redisTemplate; + @Autowired private IssueVoteDetailService issueVoteDetailService; + @Autowired + private IssueVoteDetailDao issueVoteDetailDao; + public void delete(Object[] ids) { } + public void deleteBatch(List issueIds){ + if(CollectionUtils.isEmpty(issueIds)) return ; + Set keys = issueIds.stream().map(id -> { + return IssueConstant.REDIS_KEY + id; + }).collect(Collectors.toSet()); + + redisTemplate.executePipelined((RedisCallback) connection ->{ + keys.forEach( ser -> {connection.del(redisTemplate.getKeySerializer().serialize(ser));}); + return null; + }); + } + + + public void delete(String issueId){ + redisUtils.delete(IssueConstant.REDIS_KEY +issueId); + } + + public void set(VoteRedisFormDTO vote){ @@ -185,10 +216,8 @@ public class IssueVoteDetailRedis { } //如果缓存中没有,去表决详情中计算出实时数据,并放入缓存中 //无需查询issue_vote_statistical中的数据,因为不是实时数据,可能不准确,有定时任务会自动同步 - VoteRedisFormDTO voteCache = new VoteRedisFormDTO(); - voteCache.setIssueId(issueId); - voteCache.setSupportAmount(issueVoteDetailService.getVotingCount(issueId,IssueConstant.SUPPORT)); - voteCache.setOppositionAmount(issueVoteDetailService.getVotingCount(issueId,IssueConstant.OPPOSE)); + VoteRedisFormDTO voteCache = issueVoteDetailDao.selectInfo4Cache(issueId); + if(StringUtils.isBlank(voteCache.getIssueId())) voteCache.setIssueId(issueId); IssueDTO issue = issueService.get(issueId); if(null != issue){ CommonGridIdFormDTO gridId = new CommonGridIdFormDTO(); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index fc8a5138de..003b0acd9e 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,6 +255,7 @@ 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); 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); @@ -287,9 +288,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 +302,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 +352,15 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl setToInsert = toInsert.stream().map(IssueVoteStatisticalDTO::getIssueId).collect(Collectors.toSet()); +*/ + /* Set setToInsert = toInsert.stream().map(IssueVoteStatisticalDTO::getIssueId).collect(Collectors.toSet()); Set issuesNeverVotedIds = new HashSet(); issuesNeverVotedIds.addAll(ids); @@ -372,30 +398,27 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl redundantIds = new HashSet(); - redundantIds.addAll(statisiticalIds); - redundantIds.removeAll(ids); + //Set redundantIds = new HashSet(); + //redundantIds.addAll(statisiticalIds); + //redundantIds.removeAll(ids); //将redundantIds的议题统计信息删除 //因为statisiticalIds是通过ids查询出,因此不会出现这种情况 } else { //数据吻合,全部更新 List listToUpdate = new ArrayList<>(); - Map> gridIssueMap = - issues.stream().collect(Collectors.groupingBy(IssueDTO::getGridId)); - setVotableCountsAndUpdateCache(listToUpdate,issues,votableCountMap); // listToUpdate批量更新 @@ -518,8 +541,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl + 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 From 48f093e704b668011829c8533187af7e6b4a8a23 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Thu, 18 Mar 2021 16:23:53 +0800 Subject: [PATCH 19/51] =?UTF-8?q?trace/processList-v2=20api=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/result/SubProcessDTO.java | 1 + .../com/epmet/dao/ProjectSubProcessDao.java | 4 ++-- .../service/ProjectSubProcessService.java | 4 ++-- .../impl/ProjectSubProcessServiceImpl.java | 8 ++++---- .../service/impl/ProjectTraceServiceImpl.java | 19 +++++++++++++------ .../resources/mapper/ProjectSubProcessDao.xml | 11 ++++++++--- 6 files changed, 30 insertions(+), 17 deletions(-) diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java index a5a8f871f8..4ef4534545 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/SubProcessDTO.java @@ -30,6 +30,7 @@ public class SubProcessDTO implements Serializable { */ private String handleUserName; private String subId; + private String processId; /** * 处理内容 */ diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java index dd887c38be..e030f34669 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectSubProcessDao.java @@ -45,10 +45,10 @@ public interface ProjectSubProcessDao extends BaseDao { /** * @Description 查询进展和附件 - * @Param processId + * @Param processIds * @author zxc * @date 2021/3/18 下午2:57 */ - List selectSubProcessAndAttachment(@Param("processId") String processId); + List selectSubProcessAndAttachment(@Param("processIds")List processIds); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java index 9d1aba55f9..d822ed2c39 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectSubProcessService.java @@ -104,9 +104,9 @@ public interface ProjectSubProcessService extends BaseService selectSubProcessAndAttachment(String processId); + List selectSubProcessAndAttachment(List processIds); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java index ffbae9a85f..0bdbbdb8df 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectSubProcessServiceImpl.java @@ -116,16 +116,16 @@ public class ProjectSubProcessServiceImpl extends BaseServiceImpl selectSubProcessAndAttachment(String processId) { - if (StringUtils.isEmpty(processId)){ + public List selectSubProcessAndAttachment(List processIds) { + if (CollectionUtils.isEmpty(processIds)){ return new ArrayList<>(); } - return baseDao.selectSubProcessAndAttachment(processId); + return baseDao.selectSubProcessAndAttachment(processIds); } } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java index c7d29968da..c35a1e33fc 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTraceServiceImpl.java @@ -144,13 +144,20 @@ public class ProjectTraceServiceImpl implements ProjectTraceService { log.warn(ProjectConstant.NOT_EXIST_PROJECT); return new ArrayList<>(); } + List processIds = processList.stream().filter(f -> f.getIsSend().equals(NumConstant.ONE)).map(m -> m.getProcessId()).collect(Collectors.toList()); + List subProcess = projectSubProcessService.selectSubProcessAndAttachment(processIds); // 是否发送到外部系统 0否 1是 - processList.forEach(p -> { - if (p.getIsSend().equals(NumConstant.ONE)){ - // 赋值 子节点 - p.setSubProcess(projectSubProcessService.selectSubProcessAndAttachment(p.getProcessId())); - } - }); + if (!CollectionUtils.isEmpty(subProcess)){ + processList.forEach(p -> { + subProcess.forEach(s -> { + if (p.getProcessId().equals(s.getProcessId())){ + List process = new ArrayList<>(); + process.add(s); + p.setSubProcess(process); + } + }); + }); + } // 查询进展附件列表 List files = attachmentDao.selectAttachByProjectId(formDTO.getProjectId()); 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 index 893fb54b1c..f503a81c5d 100644 --- 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 @@ -51,6 +51,7 @@ + @@ -60,11 +61,15 @@ psp.EXTERNAL_STATUS as externalStatus, psp.CREATED_TIME AS processTime, psp.HANDLE_USER_NAME as handleUserName, - psp.RESULT as result + psp.RESULT as result, + psp.process_id as processId FROM project_sub_process psp - WHERE psp.DEL_FLAG = 0 - AND psp.PROCESS_ID = #{processId} + AND ( + + psp.PROCESS_ID = #{processId} + + ) + select tca.id, + tca.customer_id, + tca.platform_id, + tca.action_key, + tca.del_flag, + tca.revision, + tca.created_by, + tca.created_time, + tca.updated_by, + tca.updated_time + from thirdplatform_customer_action tca + where tca.CUSTOMER_ID = #{customerId} + and tca.PLATFORM_ID = #{platformId} + and tca.ACTION_KEY = #{actionKey} + and tca.DEL_FLAG = 0 + + \ No newline at end of file From 40afaa0c5c873923d0b233b0ce5de3954d750b60 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 19 Mar 2021 00:08:52 +0800 Subject: [PATCH 22/51] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E4=BA=86=E6=95=B0=E6=8D=AE=E5=BA=93=E5=A4=96=E7=BD=91=E5=9C=B0?= =?UTF-8?q?=E5=9D=80=EF=BC=8C=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/epmet-third/epmet-third-server/pom.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 87fd48048b..fdd764c6e0 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -221,14 +221,14 @@ - + epmet_third_user EpmEt-db-UsEr 0 - 118.190.150.119 - 47379 + 192.168.1.130 + 6379 123456 false From 683326487fe576af3df9b37a8c3f2ec29995e2f1 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Fri, 19 Mar 2021 10:13:01 +0800 Subject: [PATCH 23/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=8E=A5=E5=8F=A3=20-=20=E5=85=A5=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/form/MenuFormDTO.java | 22 +++++++++++++++++++ .../controller/GovCustomerMenuController.java | 9 ++++---- 2 files changed, 27 insertions(+), 4 deletions(-) create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/dto/form/MenuFormDTO.java 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 index a3cb9f8946..77d498fb37 100644 --- 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 @@ -28,6 +28,7 @@ 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; @@ -116,14 +117,14 @@ public class GovCustomerMenuController { /** * 根据gov_menu表主键,查询拥有这项菜单的所有客户(customerIds) * - * @param tableId + * @param formDTO * @return com.epmet.commons.tools.utils.Result> * @Author zhangyong * @Date 16:26 2021-03-16 **/ - @PostMapping("getcustomerids/{tableid}") - public Result> getcustomerids(@PathVariable("tableid") String tableId){ - List data = govCustomerMenuService.getcustomerIds(tableId); + @PostMapping("getcustomerids") + public Result> getcustomerids(@RequestBody MenuFormDTO formDTO){ + List data = govCustomerMenuService.getcustomerIds(formDTO.getTableId()); return new Result>().ok(data); } } From 05d82052a01a3794f40c72c2871a597a8d4c640f Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 19 Mar 2021 10:30:33 +0800 Subject: [PATCH 24/51] =?UTF-8?q?trace/projectDetail=20api=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/result/ProjectDetailResultDTO.java | 5 +++++ .../main/java/com/epmet/dao/ProjectProcessDao.java | 8 ++++++++ .../com/epmet/service/ProjectProcessService.java | 8 ++++++++ .../service/impl/ProjectProcessServiceImpl.java | 13 +++++++++++++ .../com/epmet/service/impl/ProjectServiceImpl.java | 1 + .../src/main/resources/mapper/ProjectProcessDao.xml | 10 ++++++++++ 6 files changed, 45 insertions(+) diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java index 71bf83682a..61c23453d9 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDetailResultDTO.java @@ -65,6 +65,11 @@ public class ProjectDetailResultDTO implements Serializable { */ private Boolean isSend; + /** + * 当前流转到外部系统的ID + */ + private List platformIds; + @NoArgsConstructor @Data public static class DepartmentNameListBean { diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectProcessDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectProcessDao.java index 80fa2b05a0..46974a22f6 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectProcessDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectProcessDao.java @@ -86,4 +86,12 @@ public interface ProjectProcessDao extends BaseDao { * @date 2020/12/21 下午4:18 */ List selectProcessList(@Param("projectId")String projectId); + + /** + * @Description 查询当前流转到外部系统的ID + * @Param projectId + * @author zxc + * @date 2021/3/19 上午10:18 + */ + List selectPlatFormIds(@Param("projectId") String projectId); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java index 3a7643f3a5..582726205a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/ProjectProcessService.java @@ -159,4 +159,12 @@ public interface ProjectProcessService extends BaseService **/ void transferV2(TransferFormDTO formDTO); + /** + * @Description 查询当前流转到外部系统的ID + * @Param projectId + * @author zxc + * @date 2021/3/19 上午10:18 + */ + List selectPlatFormIds(String projectId); + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java index 8575f2d4a8..5f57a00488 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectProcessServiceImpl.java @@ -730,4 +730,17 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl selectPlatFormIds(String projectId) { + List platFormIds = baseDao.selectPlatFormIds(projectId); + if (CollectionUtils.isEmpty(platFormIds))return new ArrayList<>(); + return platFormIds; + } + } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 5e07865804..44dcff034b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -288,6 +288,7 @@ public class ProjectServiceImpl extends BaseServiceImpl + + + \ No newline at end of file From 4ef62337867c0589342a3a2981d3504fc92d5ec6 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 19 Mar 2021 10:34:24 +0800 Subject: [PATCH 25/51] =?UTF-8?q?trace/projectDetail=20api=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/service/impl/ProjectServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 44dcff034b..6b53b1ef2a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -288,6 +288,7 @@ public class ProjectServiceImpl extends BaseServiceImpl Date: Fri, 19 Mar 2021 16:01:09 +0800 Subject: [PATCH 26/51] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/IssueVoteStatisticalServiceImpl.java | 5 ++++- .../member/service/impl/ResiGroupMemberServiceImpl.java | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java index 003b0acd9e..258f91bd74 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueVoteStatisticalServiceImpl.java @@ -258,6 +258,7 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl issues = @@ -265,18 +266,20 @@ public class IssueVoteStatisticalServiceImpl extends BaseServiceImpl ids = issues.stream().map(IssueDTO::getId).collect(Collectors.toSet()); List gridIds = issues.stream().map(IssueDTO::getGridId).distinct().collect(Collectors.toList()); CommonGridIdListFormDTO gridIdList = new CommonGridIdListFormDTO(); gridIdList.setGridIds(gridIds); + // 根据网格Id查询网格下所有加入组的组员 Result votableCountResult = resiGroupFeignClient.votableCounts(gridIdList); Map votableCountMap1 = null; if(votableCountResult.success() && null != votableCountResult.getData() && null != votableCountResult.getData().getVotableCountMap()){ votableCountMap1 = votableCountResult.getData().getVotableCountMap(); } final Map votableCountMap = votableCountMap1; - + //查询指定议题的统计数据 List statisticalList = baseDao.selectListByIds(ids); if (null != statisticalList && statisticalList.size() > NumConstant.ZERO) { diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java index d420a7205b..33c2af52a6 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/service/impl/ResiGroupMemberServiceImpl.java @@ -814,9 +814,11 @@ public class ResiGroupMemberServiceImpl extends BaseServiceImpl votableCountMap = new HashMap<>(); + // 给每个网格初始化 加入小组人数:0 gridList.getGridIds().forEach(gridId -> { votableCountMap.put(gridId, NumConstant.ZERO ); }); + // 查询 每个网格的人数 STATE = approved的 List list = baseDao.getMembersCountInGrids(gridList.getGridIds()); if(null == list || list.size() < NumConstant.ZERO){ result.setVotableCountMap(votableCountMap); From 7b3c63a2e2d981545c8860b86a5ba9b984c3950a Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 19 Mar 2021 16:49:11 +0800 Subject: [PATCH 27/51] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E6=AC=A1?= =?UTF-8?q?=E6=80=A7=E4=BF=9D=E5=AD=98=E5=AE=A2=E6=88=B7-=E7=AC=AC?= =?UTF-8?q?=E4=B8=89=E6=96=B9=E5=B9=B3=E5=8F=B0-action=E7=9A=84=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/ThirdPlatformFormDTO.java | 17 ++++-- .../com/epmet/feign/ThirdOpenFeignClient.java | 26 +++++++++ .../ThirdOpenFeignClientFallback.java | 18 ++++++ .../controller/ThirdPlatformController.java | 12 ++++ .../dao/ThirdplatformCustomerActionDao.java | 2 + .../epmet/service/ThirdPlatformService.java | 2 + .../impl/ThirdPlatformServiceImpl.java | 52 +++++++++++++++++ .../mapper/ThirdplatformCustomerActionDao.xml | 7 +++ .../com/epmet/dto/form/ParameterFormDTO.java | 7 +++ .../dto/form/ThirdPlatformConfigFormDTO.java | 30 ++++++++++ .../gov-project/gov-project-server/pom.xml | 5 ++ .../epmet/constant/ParameterKeyConstant.java | 6 ++ .../CustomerProjectParameterController.java | 26 +++++++++ .../CustomerProjectParameterService.java | 7 +++ .../CustomerProjectParameterServiceImpl.java | 56 +++++++++++++++++-- 15 files changed, 262 insertions(+), 11 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java create mode 100644 epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java 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 index f1793c1fb3..185eb5cab9 100644 --- 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 @@ -21,26 +21,33 @@ public class ThirdPlatformFormDTO { // 更新客户自定义的平台信息 public interface UpdateCustomizePlatformInfo {} + public interface SaveOrUpdateSelectedPlatformInfo {} + @NotBlank(message = "客户ID不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, ListSelectableByCustomerAndActionGroup.class, SaveCustomerSelectedPlatformGroup.class, ListSelectedPlatforms.class, - UpdateCustomizePlatformInfo.class }) + UpdateCustomizePlatformInfo.class, + SaveOrUpdateSelectedPlatformInfo.class }) private String customerId; @NotBlank(message = "动作不能为空", groups = { ListAvailableByCustomerAndActionGroup.class, ListSelectableByCustomerAndActionGroup.class, - SaveCustomerSelectedPlatformGroup.class }) + SaveCustomerSelectedPlatformGroup.class, + SaveOrUpdateSelectedPlatformInfo.class }) private String actionKey; @NotBlank(message = "平台ID不能为空", groups = { SaveCustomerSelectedPlatformGroup.class, - UpdateCustomizePlatformInfo.class }) + UpdateCustomizePlatformInfo.class, + SaveOrUpdateSelectedPlatformInfo.class }) private String platformId; - @NotBlank(message = "平台名称不能为空", groups = { UpdateCustomizePlatformInfo.class }) + @NotBlank(message = "平台名称不能为空", groups = { UpdateCustomizePlatformInfo.class, + SaveOrUpdateSelectedPlatformInfo.class }) private String platformName; - @NotBlank(message = "平台图标不能为空", groups = { UpdateCustomizePlatformInfo.class }) + @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/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..f81e1b0db7 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/ThirdOpenFeignClient.java @@ -0,0 +1,26 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.ThirdPlatformFormDTO; +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 List input); + +} 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..abd22929ee --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java @@ -0,0 +1,18 @@ +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.ThirdPlatformFormDTO; +import com.epmet.feign.ThirdOpenFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +public class ThirdOpenFeignClientFallback implements ThirdOpenFeignClient { + @Override + public Result saveOrUpdateSelectedPlatformsInfo(List input) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "saveOrUpdateSelectedPlatformsInfo", input); + } +} 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 index e3f1998793..9288625bee 100644 --- 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 @@ -76,4 +76,16 @@ public class ThirdPlatformController { return new Result(); } + /** + * @Description 保存或修改客户选中的第三方平台信息 + * @return + * @author wxz + * @date 2021.03.19 15:25 + */ + @PostMapping("customer/saveorupdate-selected-platforms") + public Result saveOrUpdateSelectedPlatformsInfo(@RequestBody List input) { + input.stream().forEach(i -> ValidatorUtils.validateEntity(i, ThirdPlatformFormDTO.SaveOrUpdateSelectedPlatformInfo.class)); + thirdPlatformService.saveOrUpdateSelectedPlatformInfo(input); + return new Result(); + } } 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 index 49ac3a5431..cf4640fcc8 100644 --- 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 @@ -33,4 +33,6 @@ public interface ThirdplatformCustomerActionDao extends BaseDao platforms); void updateCustomizePlatformInfo(ThirdPlatformFormDTO input); + + void saveOrUpdateSelectedPlatformInfo(List platforms); } \ No newline at end of file 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 index ad4e81254e..39d3e33cae 100644 --- 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 @@ -1,18 +1,25 @@ package com.epmet.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.dao.ThirdplatformCustomerActionDao; import com.epmet.dao.ThirdplatformCustomerRegisterDao; import com.epmet.dao.ThirdplatformDao; import com.epmet.dto.form.ThirdPlatformFormDTO; import com.epmet.dto.result.ThirdplatformResultDTO; +import com.epmet.entity.ThirdplatformActionEntity; import com.epmet.entity.ThirdplatformCustomerActionEntity; import com.epmet.entity.ThirdplatformCustomerRegisterEntity; import com.epmet.service.ThirdPlatformService; +import jodd.util.CollectionUtil; 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.validation.constraints.NotBlank; import java.util.List; +import java.util.stream.Collectors; @Service public class ThirdPlatformServiceImpl implements ThirdPlatformService { @@ -60,4 +67,49 @@ public class ThirdPlatformServiceImpl implements ThirdPlatformService { thirdplatformCustomerRegisterDao.updateById(exist); } } + + @Transactional(rollbackFor = Exception.class) + @Override + public void saveOrUpdateSelectedPlatformInfo(List platforms) { + if (CollectionUtils.isEmpty(platforms)) { + return; + } + + // 1.物理删除客户-action所有对应关系 + int deletedCount = thirdplatformCustomerActionDao.deleteByCustomerIdAndActionKey(platforms.get(0).getCustomerId(), platforms.get(0).getActionKey()); + + platforms.stream().forEach(pt -> { + String customerId = pt.getCustomerId(); + String platformId = pt.getPlatformId(); + + // 2.更新用户自定义的平台信息 + updateThirdPlatformCustomerRegInfo(pt); + + // 3.重新建立customer-platform-action对应关系 + ThirdplatformCustomerActionEntity tpcaEntity = new ThirdplatformCustomerActionEntity(); + tpcaEntity.setPlatformId(platformId); + tpcaEntity.setCustomerId(customerId); + tpcaEntity.setActionKey(pt.getActionKey()); + thirdplatformCustomerActionDao.insert(tpcaEntity); + }); + + } + + /** + * @Description 更新第三方品台客户对应关系 + * @return + * @author wxz + * @date 2021.03.19 15:22 + */ + private void updateThirdPlatformCustomerRegInfo(ThirdPlatformFormDTO platformFormDTO) { + LambdaQueryWrapper conditions = new QueryWrapper() + .lambda() + .eq(ThirdplatformCustomerRegisterEntity::getCustomerId, platformFormDTO.getCustomerId()) + .eq(ThirdplatformCustomerRegisterEntity::getPlatformId, platformFormDTO.getPlatformId()); + + ThirdplatformCustomerRegisterEntity entity = new ThirdplatformCustomerRegisterEntity(); + entity.setCustomizedPlatformName(platformFormDTO.getPlatformName()); + entity.setCustomizedPlatformIcon(platformFormDTO.getIcon()); + thirdplatformCustomerRegisterDao.update(entity, conditions); + } } 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 index 4decbb7c0f..f23ff18cc3 100644 --- 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 @@ -16,6 +16,13 @@ + + delete + from thirdplatform_customer_action + where CUSTOMER_ID = #{customerId} + and ACTION_KEY = #{actionKey} + + + select + ID, + CUSTOMER_ID, + PROJECT_ID, + PROCESS_ID, + PROJECT_STAFF_ID, + PLATFORM_ID, + PLATFORM_NAME, + TASK_ID, + RESULT, + EXTERNAL_STATUS, + EXTERNAL_STATUS_DESC, + INTERNAL_STATUS, + HANDLE_DATE, + HANDLE_USER_NAME + from project_sub_process + where + DEL_FLAG = '0' + AND PLATFORM_ID = #{platformId} + order by CREATED_TIME DESC limit 1 + + \ No newline at end of file From b4d30dc027df653f9daae8e83268ac4483815068 Mon Sep 17 00:00:00 2001 From: wangchao Date: Sat, 20 Mar 2021 00:19:05 +0800 Subject: [PATCH 30/51] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/IssueAuditController.java | 8 ++++++++ .../src/main/java/com/epmet/service/IssueService.java | 9 ++++++++- .../java/com/epmet/service/impl/IssueServiceImpl.java | 8 ++++++++ .../group/dto/member/ResiGroupMemberInfoRedisDTO.java | 5 +++-- .../modules/member/redis/ResiGroupMemberRedis.java | 5 ++--- .../com/epmet/controller/UserResiInfoController.java | 10 ++++++++++ 6 files changed, 39 insertions(+), 6 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java index d6519fb6e9..f3320a96b8 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/controller/IssueAuditController.java @@ -115,6 +115,14 @@ public class IssueAuditController { return new Result>().ok(issueApplicationHistoryService.applicationHistoryWork(applicationHistoryWorkFormDTO)); } + /** + * @Description 工作端议题审核 + * @param token + * @param param + * @return java.lang.String + * @author wangc + * @date 2021.03.19 23:40 + */ @PostMapping("audit") public Result audit(@LoginUser TokenDto token, @RequestBody IssueAuditionFormDTO param){ return new Result().ok(issueService.audit(token,param)); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java index 0c58cfc807..4b14996149 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/IssueService.java @@ -152,7 +152,14 @@ public interface IssueService extends BaseService { * @date 2020.11.19 10:02 */ FirstTopicShiftedToIssueApplicationResultDTO topicShiftedToIssueV2(IssueShiftedFromTopicFormDTO issueShiftedFromTopicFormDTO); - + /** + * @Description 工作端议题审核 + * @param token + * @param param + * @return java.lang.String + * @author wangc + * @date 2021.03.19 23:40 + */ String audit(TokenDto token, IssueAuditionFormDTO param); /** diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 40fb145f77..b7d6c57015 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -443,6 +443,14 @@ public class IssueServiceImpl extends BaseServiceImpl imp return result; } + /** + * @Description 工作端议题审核 + * @param token + * @param param + * @return java.lang.String + * @author wangc + * @date 2021.03.19 23:40 + */ @Override @Transactional(rollbackFor = Exception.class) public String audit(TokenDto token, IssueAuditionFormDTO param){ diff --git a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberInfoRedisDTO.java b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberInfoRedisDTO.java index 1bbabfc036..cb468c33fe 100644 --- a/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberInfoRedisDTO.java +++ b/epmet-module/resi-group/resi-group-client/src/main/java/com/epmet/resi/group/dto/member/ResiGroupMemberInfoRedisDTO.java @@ -51,7 +51,7 @@ public class ResiGroupMemberInfoRedisDTO implements Serializable { * */ private String memberMobile; /** - * 组Id,不存在redis的value中,存在redis的key中 + * 组Id * */ private String groupId; @@ -64,7 +64,8 @@ public class ResiGroupMemberInfoRedisDTO implements Serializable { "userShowName": "山东路-尹女士", "groupLeaderFlag": "leader", "enterGroupType": "created", - "memberStatus": "approved" + "memberStatus": "approved", + "groupId":"***" } * * diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/member/redis/ResiGroupMemberRedis.java index d635bd1dea..c2c735c70b 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 @@ -85,7 +85,7 @@ public class ResiGroupMemberRedis { } /** - * @Description 得到一个指定组内成员信息,如果redis中没有,则返回null + * @Description 得到一个指定组内成员信息,如果redis中没有,则去数据库查询并放入缓存 * @Param groupId * @Param userId * @return ResiGroupMemberInfoRedisDTO.class @@ -97,7 +97,7 @@ public class ResiGroupMemberRedis { ResiGroupMemberInfoRedisDTO memberCache = (ResiGroupMemberInfoRedisDTO) redisUtils.get(ResiGroupRedisKeys.getResiGroupMemberInfoKey(groupId,userId)); //如果缓存中没有该成员数据 - if(null == memberCache || StringUtils.isNotBlank(memberCache.getUserId())){ + if(null == memberCache || StringUtils.isBlank(memberCache.getUserId())){ Map param = new HashMap<>(); param.put(TopicConstant.CUSTOMER_USER_ID,userId); param.put(TopicConstant.RESI_GROUP_ID,groupId); @@ -140,7 +140,6 @@ public class ResiGroupMemberRedis { .concat(userId)); } } - memberCache.setGroupId(groupId); return memberCache; } 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..9275fb8707 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 @@ -202,6 +202,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()); From a43dec39d7e8e665003d40c6dafcab90610301d8 Mon Sep 17 00:00:00 2001 From: wangchao Date: Sat, 20 Mar 2021 01:56:40 +0800 Subject: [PATCH 31/51] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/redis/IssueProjectTagDictRedis.java | 12 ++++++++++++ .../epmet/service/impl/ProjectTagsServiceImpl.java | 4 +++- 2 files changed, 15 insertions(+), 1 deletion(-) 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 index 7e4d3b456a..dac93747f7 100644 --- 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 @@ -358,6 +358,18 @@ public class IssueProjectTagDictRedis { redisUtils.zSetAdd(key,o); } + /** + * @Description 给客户下的分类/标签批量增加/减少热度 + * param : + * key : 0 代表减一 1 代表加一 + * value : + * key : 某一客户下分类/标签的redisKey + * value : 需要修改的分类/标签 + * @param param + * @return void + * @author wangc + * @date 2021.03.20 01:04 + */ public void batchIncrScore(Map>> param){ if(CollectionUtils.isEmpty(param)) return; redisTemplate.executePipelined((RedisCallback) connection -> { diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTagsServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTagsServiceImpl.java index 4154c9bd24..87edc5e00b 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTagsServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectTagsServiceImpl.java @@ -41,6 +41,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.Arrays; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -142,8 +143,9 @@ public class ProjectTagsServiceImpl extends BaseServiceImpl replaceNews = new LinkedList<>(newIds); differentSet.setPlus(newIds.removeAll(orientIds) ? newIds : null); - differentSet.setMinus(orientIds.removeAll(newIds) ? orientIds : null); + differentSet.setMinus(orientIds.removeAll(replaceNews) ? orientIds : null); } Result result = issueClient.updateCitations(differentSet); if(!result.success()) throw new RenException(result.getInternalMsg()); From f8bec68b4e10b255b85423e02a57d24fa48070ea Mon Sep 17 00:00:00 2001 From: wangchao Date: Sat, 20 Mar 2021 02:16:17 +0800 Subject: [PATCH 32/51] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/redis/IssueProjectTagDictRedis.java | 1 + 1 file changed, 1 insertion(+) 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 index dac93747f7..997dfc8451 100644 --- 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 @@ -98,6 +98,7 @@ public class IssueProjectTagDictRedis { } IssueProjectCategoryDictEntity otherCategory = categoryDictDao.selectSingleByCustomerIdAndCategoryNameAndCategoryType(customerId, ModuleConstants.CATEGORY_NAME_OTHERS, null); + //是否传入的类别Id中只包含"其他"分类,因为自定义分类和默认分类排序规则不一样 boolean ifOtherOnly = null == otherCategory ? false : (!CollectionUtils.isEmpty(category) && category.size() == NumConstant.ONE && category.contains(otherCategory.getId()) ? true : false); Map> result = new HashMap<>(); From 8ed45e0ed0714f111729158f43ae73a9f3771bc1 Mon Sep 17 00:00:00 2001 From: wangchao Date: Sat, 20 Mar 2021 02:38:36 +0800 Subject: [PATCH 33/51] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/redis/IssueProjectTagDictRedis.java | 7 +++---- .../java/com/epmet/controller/ProjectTagsController.java | 8 ++++++++ 2 files changed, 11 insertions(+), 4 deletions(-) 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 index 997dfc8451..0be8c5106d 100644 --- 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 @@ -128,10 +128,9 @@ public class IssueProjectTagDictRedis { 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))) + if(!CollectionUtils.isEmpty(result)) return result; @@ -155,7 +154,7 @@ public class IssueProjectTagDictRedis { * @Description FIXME 该方法保留,默认查询缓存,默认和自定义两种标签均按热度排序 * FIXME 如果缓存中没有相关数据,则进行补偿,返回的数据为:1、默认标签(分类排序) 2、自定义标签(热度排序) * FIXME 补偿机制均是在缓存中存储热度得分,因此在业务改变之前不要调用该方法 - * category为空,则补偿全部,返回默认标签和自定义标签 + * category为空,返回默认标签和自定义标签 * category仅包含"其他"这个分类的Id时,同上 * category不为空且不只有"其他"这个分类的Id时,则返回集合中的类别标签以及自定义标签 * 默认标签不按照热度排序,自定义标签按照热度排序 diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTagsController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTagsController.java index 80fad9fab5..870c50be7d 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTagsController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/ProjectTagsController.java @@ -64,6 +64,14 @@ public class ProjectTagsController { return new Result().ok(data); } + /** + * @Description 保存项目与标签的关联并更新标签热度 + * @param dto + * @param token + * @return com.epmet.commons.tools.utils.Result + * @author wangc + * @date 2021.03.20 02:34 + */ @PostMapping("save") public Result save(@RequestBody ProjectTagHookFormDTO dto, @LoginUser TokenDto token){ dto.setCustomerId(token.getCustomerId()); From 070c228db323942fd473d7f68e76f74cb0052bd3 Mon Sep 17 00:00:00 2001 From: wangchao Date: Sun, 21 Mar 2021 23:37:37 +0800 Subject: [PATCH 34/51] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/service/impl/ProjectServiceImpl.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 309377bb4b..e3c0f23a2d 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -1107,6 +1107,17 @@ public class ProjectServiceImpl extends BaseServiceImpl Date: Mon, 22 Mar 2021 00:40:31 +0800 Subject: [PATCH 35/51] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/topic/impl/TopicServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java index 83e3b9da38..3046f2d6c6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -74,7 +74,7 @@ public class TopicServiceImpl implements TopicService { agencies.forEach(agency -> { initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); }); - + //计算网格-组映射关系 List topics = topicDao.selectGroupOrderByGrid(targetDate,customerId); topics.forEach(groupTopic -> { if(null != groupTopic.getTopics() && groupTopic.getTopics().size() == NumConstant.ONE && StringUtils.isBlank(groupTopic.getTopics().get(NumConstant.ZERO).getTopicId())){ From efe7e7405f7afc84d3aef2860ac24683c683fea6 Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 22 Mar 2021 00:43:00 +0800 Subject: [PATCH 36/51] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/topic/impl/TopicServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3046f2d6c6..c832202e70 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/topic/impl/TopicServiceImpl.java @@ -74,7 +74,7 @@ public class TopicServiceImpl implements TopicService { agencies.forEach(agency -> { initAgencyGridMap(agency.getAgencyId(),agency,subGridOfAgency); }); - //计算网格-组映射关系 + //计算网格-组-话题映射关系 List topics = topicDao.selectGroupOrderByGrid(targetDate,customerId); topics.forEach(groupTopic -> { if(null != groupTopic.getTopics() && groupTopic.getTopics().size() == NumConstant.ONE && StringUtils.isBlank(groupTopic.getTopics().get(NumConstant.ZERO).getTopicId())){ From 41e37f6a69aedd52ddcd84657558c23c35948c5a Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 22 Mar 2021 08:59:35 +0800 Subject: [PATCH 37/51] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=201.=E8=BF=90?= =?UTF-8?q?=E8=90=A5=E7=AB=AF=E6=9F=A5=E8=AF=A2=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E9=A1=B9=E7=9B=AE=E5=8D=8F=E5=8A=A9=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/ThirdOpenFeignClient.java | 11 +++++ .../ThirdOpenFeignClientFallback.java | 6 +++ .../controller/ThirdPlatformController.java | 2 +- .../dto/form/ThirdPlatformConfigFormDTO.java | 9 +++- .../result/ThirdPlatformConfigResultDTO.java | 21 +++++++++ .../CustomerProjectParameterController.java | 22 +++++++++- .../CustomerProjectParameterService.java | 3 ++ .../CustomerProjectParameterServiceImpl.java | 44 ++++++++++++++++++- 8 files changed, 113 insertions(+), 5 deletions(-) create mode 100644 epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java 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 index 2459873c91..144000cc8a 100644 --- 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 @@ -3,6 +3,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; 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; @@ -23,4 +24,14 @@ public interface ThirdOpenFeignClient { @PostMapping("/third/thirdplatform/customer/saveorupdate-selected-platforms") Result saveOrUpdateSelectedPlatformsInfo(@RequestBody List 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/ThirdOpenFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java index abd22929ee..9322354512 100644 --- 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 @@ -4,6 +4,7 @@ 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.ThirdPlatformFormDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.feign.ThirdOpenFeignClient; import org.springframework.stereotype.Component; @@ -15,4 +16,9 @@ public class ThirdOpenFeignClientFallback implements ThirdOpenFeignClient { public Result saveOrUpdateSelectedPlatformsInfo(List 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/src/main/java/com/epmet/controller/ThirdPlatformController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/ThirdPlatformController.java index 9288625bee..7a630a4347 100644 --- 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 @@ -24,7 +24,7 @@ public class ThirdPlatformController { private ThirdPlatformService thirdPlatformService; /** - * 根据客户id和动作,列出客户登记可用的第三方平台 + * 根据客户id和动作,列出客户在指定动作下可用的第三方平台 * 用途:工作端,运营端配置界面 * * @param input diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java index 519c1a1371..d816340cc6 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java @@ -12,10 +12,15 @@ public class ThirdPlatformConfigFormDTO { public interface SaveThirdplatformConfig { } - @NotBlank(message = "客户ID不能为空", groups = {SaveThirdplatformConfig.class}) + public interface LoadThirdplatformConfig { } + + @NotBlank(message = "客户ID不能为空", groups = { + SaveThirdplatformConfig.class, + LoadThirdplatformConfig.class}) private String customerId; - @NotBlank(message = "项目协助发送开关状态不能为空", groups = {SaveThirdplatformConfig.class}) + @NotBlank(message = "项目协助发送开关状态不能为空", groups = { + SaveThirdplatformConfig.class}) private String sendProjectSwitch; private List customerSelectedPlatformList; diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java new file mode 100644 index 0000000000..95669e988e --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class ThirdPlatformConfigResultDTO { + + private String sendProjectSwitch; + private List customerSelectedPlatformList = new ArrayList(); + + @Data + public static class CustomerSelectedPlatform { + private String customerId; + private String platformId; + private String platformName; + private String icon; + } +} diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java index aeb93e41c8..16f3cee2e8 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java @@ -25,17 +25,18 @@ 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.constant.ParameterKeyConstant; import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ThirdPlatformConfigFormDTO; import com.epmet.dto.result.ParameterResultDTO; +import com.epmet.dto.result.ThirdPlatformConfigResultDTO; import com.epmet.excel.CustomerProjectParameterExcel; import com.epmet.service.CustomerProjectParameterService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; -import javax.validation.constraints.NotBlank; import java.util.List; import java.util.Map; @@ -152,6 +153,12 @@ public class CustomerProjectParameterController { return new Result(); } + /** + * @Description 保存项目第三方平台的配置 + * @return + * @author wxz + * @date 2021.03.19 17:10 + */ @PostMapping("save-thirdplatform-config") public Result saveThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) { ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.SaveThirdplatformConfig.class); @@ -161,4 +168,17 @@ public class CustomerProjectParameterController { customerProjectParameterService.saveThirdplatformConfig(customerId, sendProjectSwitch, platformList); return new Result(); } + + /** + * @Description 保存项目第三方平台的配置 + * @return + * @author wxz + * @date 2021.03.19 17:10 + */ + @PostMapping("load-thirdplatform-config") + public Result loadThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) { + ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.LoadThirdplatformConfig.class); + ThirdPlatformConfigResultDTO resultDTO = customerProjectParameterService.loadThirdplatformConfig(input.getCustomerId(), ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND); + return new Result().ok(resultDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java index 4f1d6e9ea8..e7473100f0 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java @@ -23,6 +23,7 @@ import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ThirdPlatformConfigFormDTO; import com.epmet.dto.result.ParameterResultDTO; +import com.epmet.dto.result.ThirdPlatformConfigResultDTO; import com.epmet.entity.CustomerProjectParameterEntity; import java.util.List; @@ -173,4 +174,6 @@ public interface CustomerProjectParameterService extends BaseService platformList); + + ThirdPlatformConfigResultDTO loadThirdplatformConfig(String customerId, String parameterKey); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java index ab36ac3469..3595f23a94 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java @@ -21,9 +21,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.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.constant.ParameterKeyConstant; import com.epmet.constant.ThirdPlatformActions; import com.epmet.dao.CustomerProjectParameterDao; @@ -32,6 +34,8 @@ import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ThirdPlatformConfigFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO; import com.epmet.dto.result.ParameterResultDTO; +import com.epmet.dto.result.ThirdPlatformConfigResultDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.entity.CustomerProjectParameterEntity; import com.epmet.feign.ThirdOpenFeignClient; import com.epmet.redis.CustomerProjectParameterRedis; @@ -332,6 +336,44 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl> listResult = thirdOpenFeignClient.listAvailablePlatformsByCustomerAndAction(form); + + if (listResult == null || !listResult.success()) { + throw new RenException("调用Third服务,获取第三方平台列表失败"); + } + List platforms = listResult.getData(); + + // 2.本地查询 + CustomerProjectParameterEntity params = new CustomerProjectParameterEntity(); + params.setCustomerId(customerId); + params.setParameterKey(parameterKey); + String value = baseDao.selectParameterValueByKey(params); + value = StringUtils.isBlank(value) ? "0" : value; + + ThirdPlatformConfigResultDTO result = new ThirdPlatformConfigResultDTO(); + result.setSendProjectSwitch(value); + + platforms.forEach(p -> { + ThirdPlatformConfigResultDTO.CustomerSelectedPlatform platform = new ThirdPlatformConfigResultDTO.CustomerSelectedPlatform(); + platform.setCustomerId(customerId); + platform.setIcon(p.getIcon()); + platform.setPlatformId(p.getPlatformId()); + platform.setPlatformName(p.getPlatformName()); + result.getCustomerSelectedPlatformList().add(platform); + }); + + return result; } } \ No newline at end of file From ef7e198e12ed3a5fbc4a5d43e09dfd1ac4c65825 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 22 Mar 2021 09:34:17 +0800 Subject: [PATCH 38/51] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=201.=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=AE=A2=E6=88=B7=E7=AC=AC=E4=B8=89=E6=96=B9=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E9=85=8D=E7=BD=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/ThirdOpenFeignClient.java | 14 +++++- .../ThirdOpenFeignClientFallback.java | 6 +++ .../dto/form/ThirdPlatformConfigFormDTO.java | 9 +++- .../result/ThirdPlatformConfigResultDTO.java | 21 +++++++++ .../CustomerProjectParameterController.java | 15 +++++++ .../CustomerProjectParameterService.java | 3 ++ .../CustomerProjectParameterServiceImpl.java | 44 ++++++++++++++++++- 7 files changed, 107 insertions(+), 5 deletions(-) create mode 100644 epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java 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 index 2459873c91..ab5c26cc4b 100644 --- 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 @@ -3,6 +3,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; 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; @@ -10,8 +11,8 @@ 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") +//@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 { /** @@ -23,4 +24,13 @@ public interface ThirdOpenFeignClient { @PostMapping("/third/thirdplatform/customer/saveorupdate-selected-platforms") Result saveOrUpdateSelectedPlatformsInfo(@RequestBody List 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/ThirdOpenFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/ThirdOpenFeignClientFallback.java index abd22929ee..9322354512 100644 --- 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 @@ -4,6 +4,7 @@ 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.ThirdPlatformFormDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.feign.ThirdOpenFeignClient; import org.springframework.stereotype.Component; @@ -15,4 +16,9 @@ public class ThirdOpenFeignClientFallback implements ThirdOpenFeignClient { public Result saveOrUpdateSelectedPlatformsInfo(List 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/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java index 519c1a1371..d816340cc6 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/ThirdPlatformConfigFormDTO.java @@ -12,10 +12,15 @@ public class ThirdPlatformConfigFormDTO { public interface SaveThirdplatformConfig { } - @NotBlank(message = "客户ID不能为空", groups = {SaveThirdplatformConfig.class}) + public interface LoadThirdplatformConfig { } + + @NotBlank(message = "客户ID不能为空", groups = { + SaveThirdplatformConfig.class, + LoadThirdplatformConfig.class}) private String customerId; - @NotBlank(message = "项目协助发送开关状态不能为空", groups = {SaveThirdplatformConfig.class}) + @NotBlank(message = "项目协助发送开关状态不能为空", groups = { + SaveThirdplatformConfig.class}) private String sendProjectSwitch; private List customerSelectedPlatformList; diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java new file mode 100644 index 0000000000..3e08815493 --- /dev/null +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ThirdPlatformConfigResultDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.util.ArrayList; +import java.util.List; + +@Data +public class ThirdPlatformConfigResultDTO { + + private String sendProjectSwitch; + private List customerSelectedPlatformList = new ArrayList(); + + @Data + public static class CustomerSelectedPlatform { + private String customerId; + private String platformId; + private String platformName; + private String icon; + } +} \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java index aeb93e41c8..de479f7344 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/controller/CustomerProjectParameterController.java @@ -25,10 +25,12 @@ 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.constant.ParameterKeyConstant; import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ThirdPlatformConfigFormDTO; import com.epmet.dto.result.ParameterResultDTO; +import com.epmet.dto.result.ThirdPlatformConfigResultDTO; import com.epmet.excel.CustomerProjectParameterExcel; import com.epmet.service.CustomerProjectParameterService; import org.springframework.beans.factory.annotation.Autowired; @@ -161,4 +163,17 @@ public class CustomerProjectParameterController { customerProjectParameterService.saveThirdplatformConfig(customerId, sendProjectSwitch, platformList); return new Result(); } + + /** + * @Description 保存项目第三方平台的配置 + * @return + * @author wxz + * @date 2021.03.19 17:10 + */ + @PostMapping("load-thirdplatform-config") + public Result loadThirdplatformConfig(@RequestBody ThirdPlatformConfigFormDTO input) { + ValidatorUtils.validateEntity(input, ThirdPlatformConfigFormDTO.LoadThirdplatformConfig.class); + ThirdPlatformConfigResultDTO resultDTO = customerProjectParameterService.loadThirdplatformConfig(input.getCustomerId(), ParameterKeyConstant.THIRD_PLATFORM_PROJECT_SEND); + return new Result().ok(resultDTO); + } } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java index 4f1d6e9ea8..e7473100f0 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/CustomerProjectParameterService.java @@ -23,6 +23,7 @@ import com.epmet.dto.CustomerProjectParameterDTO; import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ThirdPlatformConfigFormDTO; import com.epmet.dto.result.ParameterResultDTO; +import com.epmet.dto.result.ThirdPlatformConfigResultDTO; import com.epmet.entity.CustomerProjectParameterEntity; import java.util.List; @@ -173,4 +174,6 @@ public interface CustomerProjectParameterService extends BaseService platformList); + + ThirdPlatformConfigResultDTO loadThirdplatformConfig(String customerId, String parameterKey); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java index ab36ac3469..3595f23a94 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/CustomerProjectParameterServiceImpl.java @@ -21,9 +21,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.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.constant.ParameterKeyConstant; import com.epmet.constant.ThirdPlatformActions; import com.epmet.dao.CustomerProjectParameterDao; @@ -32,6 +34,8 @@ import com.epmet.dto.form.ParameterFormDTO; import com.epmet.dto.form.ThirdPlatformConfigFormDTO; import com.epmet.dto.form.ThirdPlatformFormDTO; import com.epmet.dto.result.ParameterResultDTO; +import com.epmet.dto.result.ThirdPlatformConfigResultDTO; +import com.epmet.dto.result.ThirdplatformResultDTO; import com.epmet.entity.CustomerProjectParameterEntity; import com.epmet.feign.ThirdOpenFeignClient; import com.epmet.redis.CustomerProjectParameterRedis; @@ -332,6 +336,44 @@ public class CustomerProjectParameterServiceImpl extends BaseServiceImpl> listResult = thirdOpenFeignClient.listAvailablePlatformsByCustomerAndAction(form); + + if (listResult == null || !listResult.success()) { + throw new RenException("调用Third服务,获取第三方平台列表失败"); + } + List platforms = listResult.getData(); + + // 2.本地查询 + CustomerProjectParameterEntity params = new CustomerProjectParameterEntity(); + params.setCustomerId(customerId); + params.setParameterKey(parameterKey); + String value = baseDao.selectParameterValueByKey(params); + value = StringUtils.isBlank(value) ? "0" : value; + + ThirdPlatformConfigResultDTO result = new ThirdPlatformConfigResultDTO(); + result.setSendProjectSwitch(value); + + platforms.forEach(p -> { + ThirdPlatformConfigResultDTO.CustomerSelectedPlatform platform = new ThirdPlatformConfigResultDTO.CustomerSelectedPlatform(); + platform.setCustomerId(customerId); + platform.setIcon(p.getIcon()); + platform.setPlatformId(p.getPlatformId()); + platform.setPlatformName(p.getPlatformName()); + result.getCustomerSelectedPlatformList().add(platform); + }); + + return result; } } \ No newline at end of file From 5d642275cb4cc28287db0bc9e921d008f27bf1db Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 22 Mar 2021 09:34:38 +0800 Subject: [PATCH 39/51] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=20=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=85=8D=E7=BD=AE=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/feign/ThirdOpenFeignClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index ab5c26cc4b..de647e726e 100644 --- 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 @@ -11,8 +11,8 @@ 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") +@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 { /** From a6e8a50744655b67d6d5a67e6f02019ab8fa140b Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Mon, 22 Mar 2021 10:34:29 +0800 Subject: [PATCH 40/51] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml index 84d66f138b..71da21f685 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueVoteStatisticalDailyDao.xml @@ -23,6 +23,9 @@ + + + SELECT - * + rgm.ID, + rgm.CUSTOMER_USER_ID, + rgm.RESI_GROUP_ID, + rgm.GROUP_LEADER_FLAG, + rgm.ENTER_GROUP_TYPE, + rgm.GROUP_INVITATION_ID, + rgm.GROUP_LEADER_FLAG, + rgm.STATUS FROM resi_group_member rgm WHERE 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/redis/UserBadgeRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserBadgeRedis.java index d29a25ec0f..49390b11df 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 @@ -7,7 +7,6 @@ import com.epmet.commons.tools.constant.NumConstant; 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; 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 315341ae84..076791fcba 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 @@ -22,7 +22,6 @@ import com.epmet.commons.tools.constant.NumConstant; 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; @@ -389,4 +388,4 @@ public class UserBaseInfoRedis { } } } -} \ No newline at end of file +} From cbc4ab149b8e41a05db5ec81b861c981a43b7de9 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 22 Mar 2021 17:27:32 +0800 Subject: [PATCH 51/51] =?UTF-8?q?=E6=8E=A8=E8=8D=90=E5=B0=8F=E7=BB=84-?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E7=BB=84=E9=95=BF=E4=BF=A1=E6=81=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BC=98=E5=8C=96=20=E7=9B=B4=E6=8E=A5=E4=BB=8E?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E5=8F=96=E7=94=A8=E6=88=B7=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/redis/UserBadgeRedis.java | 24 +++++++++---------- .../com/epmet/redis/UserBaseInfoRedis.java | 11 +++++---- 2 files changed, 18 insertions(+), 17 deletions(-) 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 49390b11df..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,9 +1,9 @@ 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; @@ -109,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); @@ -117,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; @@ -141,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)){ @@ -157,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; @@ -178,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); } } @@ -206,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; } @@ -219,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; @@ -240,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 ->{ @@ -256,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 076791fcba..d5b8a993eb 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,6 +19,7 @@ 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; @@ -79,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); //用户缓存的有效期为七天 @@ -89,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); @@ -109,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); @@ -200,7 +201,7 @@ public class UserBaseInfoRedis { public UserBaseInfoResultDTO getUserInfo(String userId,String customerId){ 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); @@ -363,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)); } }); }