From a8b43430e9d5494a6cc6dd00864adb0b158046ec Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 15 Jul 2020 21:13:58 +0800 Subject: [PATCH 001/157] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- .../epmet-third-server/deploy/docker-compose-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 58e0013a0e..ac9c6b2813 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.13 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.14 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml index 1b21690631..60cf655960 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.13 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.14 ports: - "8110:8110" network_mode: host # 使用现有网络 From bfde3ff857cc23bb2985bfb71e75448c43cbb543 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 15 Jul 2020 23:04:14 +0800 Subject: [PATCH 002/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/deploy/docker-compose-prod.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-gateway/deploy/docker-compose-prod.yml b/epmet-gateway/deploy/docker-compose-prod.yml index 35a4e7e1e2..cec8fb60da 100644 --- a/epmet-gateway/deploy/docker-compose-prod.yml +++ b/epmet-gateway/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.25 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-gateway:0.3.26 ports: - "8080:8080" network_mode: host # 使用现有网络 From 34a92d232c9b3dbfa6d74c41b30dcf74f173e9d7 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 22 Jul 2020 13:25:54 +0800 Subject: [PATCH 003/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E6=8E=88=E6=9D=83=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/ModuleConstant.java | 2 +- .../ComponentVerifyTicketServiceImpl.java | 33 ++++++++++--------- .../wxapi/constant/WxMaCodeConstant.java | 4 +-- .../main/resources/mapper/CustomerMpDao.xml | 2 +- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java index 5e72094a57..c157efc7ce 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -65,7 +65,7 @@ public interface ModuleConstant { String COMPONENT_APP_ID = "component_appid"; String AUTHORIZER_APP_ID = "authorizer_appid"; String AUTHORIZER_INFO = "authorizer_info"; - String MINI_PROGRAM_INFO = "miniprograminfo"; + String MINI_PROGRAM_INFO = "MiniProgramInfo"; String BUSINESS_INFO = "business_info"; String CATEGORIES = "categories"; String NETWORK = "network"; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 30517d5cb7..ad4cd17964 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -378,7 +378,6 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String client = authCodeAndTime.getClientType(); String expiresIn = authCodeAndTime.getExpiresIn(); String customerId = tokenDto.getCustomerId(); - customerId = "f530774b31e0609a3c7f0f83794cda0c"; Date expiresInTime = this.countExpirationTime(expiresIn); if (StringUtils.isBlank(customerId)||StringUtils.isBlank(client)||StringUtils.isBlank(authCode)||StringUtils.isBlank(expiresIn)){ log.info("客户ID = "+customerId+", 客户端类型为 = "+client+", 授权码为 = "+authCode+", 有效期 = "+expiresIn); @@ -456,18 +455,20 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe //todo 小程序配置的类目信息插入 List categoryInfoList = new ArrayList<>(); List categories = (List) miniProgramInfo.get(ModuleConstant.CATEGORIES); - categories.forEach(category -> { - category.forEach((key,value) -> { - MiniCategoryInfoFormDTO categoryInfo = new MiniCategoryInfoFormDTO(); - categoryInfo.setCustomerId(customerId); - categoryInfo.setClientType(clientType); - categoryInfo.setCategorySort(key.toString()); - categoryInfo.setCategoryName(value.toString()); - categoryInfo.setPrimaryId(primaryId); - categoryInfoList.add(categoryInfo); + if (categories.size() != NumConstant.ZERO) { + categories.forEach(category -> { + category.forEach((key, value) -> { + MiniCategoryInfoFormDTO categoryInfo = new MiniCategoryInfoFormDTO(); + categoryInfo.setCustomerId(customerId); + categoryInfo.setClientType(clientType); + categoryInfo.setCategorySort(key.toString()); + categoryInfo.setCategoryName(value.toString()); + categoryInfo.setPrimaryId(primaryId); + categoryInfoList.add(categoryInfo); + }); }); - }); - miniCategoryInfoDao.insertCategoryInfo(categoryInfoList); + miniCategoryInfoDao.insertCategoryInfo(categoryInfoList); + } }else { log.info("授权方为公众号 并 开始插入信息"); PaInfoFormDTO paInfoFormDTO = this.mapToEntity(authorizerInfo, PaInfoFormDTO.class); @@ -499,7 +500,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe */ @Transactional(rollbackFor = Exception.class) public void updateCustomerMpAppIdAndCreateOpenPlatform(String customerId,String authAppId,String clientType){ - log.info("开始创建开放平台账号并绑定"); + /*log.info("开始创建开放平台账号并绑定"); Integer authCount = customerMpDao.selectAuthCount(customerId); String openPlatformId = null; Map authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); @@ -561,7 +562,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_FOUR: throw new RenException(TO_LIMIT); } - } + }*/ AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); formDTO.setClientType(clientType); formDTO.setAuthAppId(authAppId); @@ -569,12 +570,12 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe //回填customer_mp的appId 只需以上三个字段 customerMpDao.updateAppIDByCustomerIdAndClient(formDTO); //插入 binding_account - BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO(); + /*BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO(); bindingAccount.setOpenPlatformAccountId(openPlatformId); bindingAccount.setAuthAppId(authAppId); bindingAccount.setClientType(clientType); bindingAccount.setCustomerId(customerId); - bindingAccountDao.insertBindingAccount(bindingAccount); + bindingAccountDao.insertBindingAccount(bindingAccount);*/ log.info("创建绑定账号结束"); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index e98f7a4701..4190008538 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -41,8 +41,8 @@ public interface WxMaCodeConstant { * pre_auth_code:预授权码 * redirect_uri:回调url(获取授权码) */ -// String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s"; - String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s#wechat_redirect"; + String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s"; +// String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s#wechat_redirect"; /** * 创建开放平台帐号并绑定公众号/小程序 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index 4612ca8c88..da99a3dd4f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -37,7 +37,7 @@ WHERE customer_id = #{customerId} AND del_flag = '0' - AND client = #{client} + AND client = #{clientType} From de1397aa69417208039cc2a7ce7ad77b06d30271 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 22 Jul 2020 13:27:11 +0800 Subject: [PATCH 004/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 494df190a6..38da38240a 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.39 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.40 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 6c831bfb2f..52e4c682f9 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.39 + 0.0.40 com.epmet From 4dd06014920c74cfe69c0c382a0b30e632437447 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Jul 2020 13:49:06 +0800 Subject: [PATCH 005/157] =?UTF-8?q?=E7=BB=9F=E4=B8=80=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- .../gov-org/gov-org-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-org/gov-org-server/pom.xml | 2 +- .../resi-guide/resi-guide-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/resi-guide/resi-guide-server/pom.xml | 2 +- epmet-user/epmet-user-server/deploy/docker-compose-dev.yml | 2 +- epmet-user/epmet-user-server/pom.xml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index b2609df0b1..03a7a57ee3 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.43 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.44 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index ab11a183fc..7c5f5d6a62 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.43 + 0.3.44 com.epmet epmet-cloud diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml index d1c7b78043..0b247eae18 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.75 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-org-server:0.3.76 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 191856ef70..3d9f8fd97c 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.75 + 0.3.76 com.epmet gov-org diff --git a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml index a8b5a7a663..20aac7e3ec 100644 --- a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-guide-server: container_name: resi-guide-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-guide-server:0.3.17 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-guide-server:0.3.18 ports: - "8091:8091" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-guide/resi-guide-server/pom.xml b/epmet-module/resi-guide/resi-guide-server/pom.xml index d93427f6b0..48851b561e 100644 --- a/epmet-module/resi-guide/resi-guide-server/pom.xml +++ b/epmet-module/resi-guide/resi-guide-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.17 + 0.3.18 com.epmet resi-guide diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index 88d224e76e..a16884cdcd 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.76 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.77 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 2c3f938f56..9ec79e461e 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.76 + 0.3.77 com.epmet epmet-user From ce08601023d3887e4e18354822fca05117e3dcdc Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Jul 2020 14:40:55 +0800 Subject: [PATCH 006/157] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E3=80=81=E6=9C=BA=E5=85=B3=E3=80=81=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E3=80=81=E7=BB=B4=E5=BA=A6=E5=88=9D=E5=A7=8B=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0"=E4=BF=AE=E6=94=B9"=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E7=9A=84=E7=BB=B4=E5=BA=A6=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=EF=BC=8C=E6=8C=89=E7=85=A7=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dao/crm/CustomerDao.java | 2 + .../epmet/dao/org/CustomerDepartmentDao.java | 1 + .../com/epmet/dao/org/CustomerGridDao.java | 8 ++ .../epmet/dao/org/StatsCustomerAgencyDao.java | 2 + .../com/epmet/dao/stats/DimAgencyDao.java | 2 + .../com/epmet/dao/stats/DimCustomerDao.java | 2 + .../com/epmet/dao/stats/DimDepartmentDao.java | 2 + .../java/com/epmet/dao/stats/DimGridDao.java | 2 + .../epmet/service/crm/CustomerService.java | 1 + .../service/crm/impl/CustomerServiceImpl.java | 5 + .../service/impl/StatsDimServiceImpl.java | 129 +++++++++++++++--- .../service/org/CustomerAgencyService.java | 2 + .../org/CustomerDepartmentService.java | 2 + .../service/org/CustomerGridService.java | 8 ++ .../org/impl/CustomerAgencyServiceImpl.java | 5 + .../impl/CustomerDepartmentServiceImpl.java | 5 + .../org/impl/CustomerGridServiceImpl.java | 5 + .../epmet/service/stats/DimAgencyService.java | 5 +- .../service/stats/DimCustomerService.java | 5 +- .../service/stats/DimDepartmentService.java | 4 +- .../epmet/service/stats/DimGridService.java | 5 +- .../stats/impl/DimAgencyServiceImpl.java | 22 ++- .../stats/impl/DimCustomerServiceImpl.java | 22 ++- .../stats/impl/DimDepartmentServiceImpl.java | 22 ++- .../stats/impl/DimGridServiceImpl.java | 16 ++- .../main/resources/mapper/crm/CustomerDao.xml | 23 ++++ .../mapper/org/CustomerDepartmentDao.xml | 20 +++ .../resources/mapper/org/CustomerGridDao.xml | 21 +++ .../mapper/org/StatsCustomerAgencyDao.xml | 25 ++++ .../resources/mapper/stats/DimAgencyDao.xml | 21 +++ .../resources/mapper/stats/DimCustomerDao.xml | 15 ++ .../mapper/stats/DimDepartmentDao.xml | 17 +++ .../resources/mapper/stats/DimGridDao.xml | 17 +++ 33 files changed, 410 insertions(+), 33 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java index bfe699c25e..f3618f4e06 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/crm/CustomerDao.java @@ -43,4 +43,6 @@ public interface CustomerDao extends BaseDao { List listValidCustomersByCreateTime( @Param("createTimeFrom") Date createTimeFrom, @Param("createTimeTo") Date createTimeTo); + + List listValidCustomersByUpdateTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java index 2b9b4705ab..8db5a46efb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerDepartmentDao.java @@ -38,4 +38,5 @@ public interface CustomerDepartmentDao extends BaseDao @Param("createdTimeFrom") Date createdTimeFrom, @Param("createdTimeTo") Date createdTimeTo); + List listDepartmentsByUpdatedTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java index faccf553a2..9f26b8b98d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java @@ -59,4 +59,12 @@ public interface CustomerGridDao extends BaseDao { * @author zxc */ List getCustomerGridIdList(@Param("customerId") String customerId, @Param("dateId") String dateId); + + /** + * 根据更新时间查询列表 + * @param startTime + * @param endTime + * @return + */ + List listUpdatedGridsByUpdateTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java index b3de9cfd02..eb02051e91 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/StatsCustomerAgencyDao.java @@ -20,4 +20,6 @@ public interface StatsCustomerAgencyDao extends BaseDao { List selectAllAgency(); List selectSubAgencyByPid(@Param("pid")String pid); + + List listAgenciesByUpdatedTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java index 419a54ef2c..8788232a7b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimAgencyDao.java @@ -124,4 +124,6 @@ public interface DimAgencyDao extends BaseDao { String getPidByAgencyId(@Param("agencyId") String agencyId); DimAgencyEntity getLatestCreatedAgencyDimEntity(); + + DimAgencyEntity getLatestUpdatedAgencyDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java index 1834b73ffc..8bd2c3cf8d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimCustomerDao.java @@ -47,4 +47,6 @@ public interface DimCustomerDao extends BaseDao { void insertOne(DimCustomerEntity dim); DimCustomerEntity getLatestCreatedDimEntity(); + + DimCustomerEntity getLatestUpdatedDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java index 5098869983..0b58bc2220 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java @@ -42,4 +42,6 @@ public interface DimDepartmentDao extends BaseDao { List getDepartmentListByCustomerId(@Param("customerId") String customerId); DimDepartmentEntity getLatestCreatedDimEntity(); + + DimDepartmentEntity getLatestUpdatedDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java index 669e8a08a0..c1671131b1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimGridDao.java @@ -58,4 +58,6 @@ public interface DimGridDao extends BaseDao { * @author zxc */ List selectSubAgencyId(@Param("formDTO")List formDTO); + + DimGridEntity getLastUpdatedGridDim(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java index e562a08365..dbc2cc03f9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/CustomerService.java @@ -9,4 +9,5 @@ public interface CustomerService { List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo); + List listValidCustomersByUpdatedTime(Date updatedTime, Date initTime); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java index 3db2f197bd..056df4e50e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/crm/impl/CustomerServiceImpl.java @@ -22,4 +22,9 @@ public class CustomerServiceImpl implements CustomerService { public List listValidCustomersByCreateTime(Date createTimeFrom, Date createTimeTo) { return customerDao.listValidCustomersByCreateTime(createTimeFrom, createTimeTo); } + + @Override + public List listValidCustomersByUpdatedTime(Date startTime, Date endTime) { + return customerDao.listValidCustomersByUpdateTime(startTime, endTime); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java index dde7d9f14e..5c09458416 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java @@ -1,8 +1,6 @@ package com.epmet.service.impl; -import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.RobotConstant; -import com.epmet.constant.StatsSubject; import com.epmet.entity.crm.CustomerEntity; import com.epmet.entity.org.CustomerAgencyEntity; import com.epmet.entity.org.CustomerDepartmentEntity; @@ -18,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.stream.Collectors; @@ -54,6 +53,17 @@ public class StatsDimServiceImpl implements StatsDimService { @Override public void initGridDim() { + List newDimGrids = getNewDimGrids(); + List changedGrids = getChangedGrids(); + + dimGridService.initGridDims(newDimGrids, changedGrids); + } + + /** + * 初始化新建网格 + * @return + */ + public List getNewDimGrids() { DimGridEntity lastDimEntity = dimGridService.getLastCreatedGridDim(); List grids; Date now = new Date(); @@ -65,10 +75,36 @@ public class StatsDimServiceImpl implements StatsDimService { grids = customerGridService.listGridsByCreateTime(lastInitTime, now); } - List gridDims = convertCustomerGrid2GridDim(grids, now); - if (!CollectionUtils.isEmpty(gridDims)) { - dimGridService.initGridDims(gridDims); + return convertCustomerGrid2GridDim(grids, now); + } + + /** + * 初始化变更的网格 + * @return + */ + public List getChangedGrids() { + DimGridEntity lastUpdatedGridDim = dimGridService.getLastUpdatedGridDim(); + + List updatedGrids; + Date now = new Date(); + if (lastUpdatedGridDim != null) { + Date lastInitTime = lastUpdatedGridDim.getUpdatedTime(); + updatedGrids = customerGridService.listUpdatedGridsByUpdateTime(lastInitTime, now); + ArrayList dimGrids = new ArrayList<>(); + for (CustomerGridEntity updatedGrid : updatedGrids) { + DimGridEntity dimGrid = dimGridService.selectById(updatedGrid.getId()); + if (dimGrid != null) { + dimGrid.setGridName(updatedGrid.getGridName()); + dimGrid.setUpdatedTime(now); + dimGrid.setUpdatedBy(RobotConstant.DIMENSION_ROBOT); + dimGrids.add(dimGrid); + } + } + + return dimGrids; } + + return new ArrayList<>(); } /** @@ -98,19 +134,41 @@ public class StatsDimServiceImpl implements StatsDimService { */ @Override public void initAgencyDim() { + Date now = new Date(); + List agencies2Add = listAgencies2Add(now); + List agencies2Update = listAgencies2Update(now); + dimAgencyService.initAgencyDims(agencies2Add, agencies2Update, now); + } + + /** + * 查询需要添加的机关ç + * @return + */ + public List listAgencies2Add(Date endDate) { DimAgencyEntity latestCreatedAgencyDim = dimAgencyService.getLatestCreatedAgencyDimEntity(); - Date now = new Date(); Date lastInitTime = null; if (latestCreatedAgencyDim != null) { lastInitTime = latestCreatedAgencyDim.getCreatedTime(); } - List agencies = customerAgencyService.listAgenciesByCreateTime(lastInitTime, now); - if (!CollectionUtils.isEmpty(agencies)) { - dimAgencyService.initAgencyDims(agencies, now); + return customerAgencyService.listAgenciesByCreateTime(lastInitTime, endDate); + } + + /** + * 查询需要更新的机关 + * @return + */ + public List listAgencies2Update(Date endDate) { + DimAgencyEntity latestUpdatedAgencyDim = dimAgencyService.getLatestUpdatedAgencyDimEntity(); + + if (latestUpdatedAgencyDim != null) { + // 不是首次初始化,可以更新 + Date updatedTime = latestUpdatedAgencyDim.getUpdatedTime(); + return customerAgencyService.listAgenciesByUpdatedTime(updatedTime, endDate); } + return new ArrayList<>(); } /** @@ -118,24 +176,59 @@ public class StatsDimServiceImpl implements StatsDimService { */ @Override public void initCustomerDim() { + Date now = new Date(); + List newCustomers = listNewCustomers(now); + List updatedCustomers = listUpdatedCustomers(now); +// System.out.println(666); + dimCustomerService.initCustomerDims(newCustomers, updatedCustomers, now); + } + + /** + * 查询新增的客户列表 + * @param initTime + * @return + */ + public List listNewCustomers(Date initTime) { DimCustomerEntity lastCreateDim = dimCustomerService.getLatestCreatedDimEntity(); - Date now = new Date(); Date lastInitTime = null; if (lastCreateDim != null) { lastInitTime = lastCreateDim.getCreatedTime(); } - List customers = customerService.listValidCustomersByCreateTime(lastInitTime, now); - if (!CollectionUtils.isEmpty(customers)) { - dimCustomerService.initCustomerDims(customers, now); + List customers = customerService.listValidCustomersByCreateTime(lastInitTime, initTime); + + return customers; + } + + /** + * 查询更新的客户列表 + * @param initTime + * @return + */ + public List listUpdatedCustomers(Date initTime) { + DimCustomerEntity lastCreatedDim = dimCustomerService.getLatestUpdatedDimEntity(); + if (lastCreatedDim != null) { + // 说明不是首次初始化 + List customers = customerService.listValidCustomersByUpdatedTime(lastCreatedDim.getUpdatedTime(), initTime); + return customers; } + return new ArrayList<>(); } + /** + * 初始化部门维度 + */ @Override public void initDepartmentDim() { + Date now = new Date(); + List newDepartments = listNewDepartments(now); + List updatedDepartments = listUpdatedDepartments(now); + dimDepartmentService.initDepartmentDims(newDepartments, updatedDepartments, now); + } + public List listNewDepartments(Date initTime) { DimDepartmentEntity lastCreatedDeptDim = dimDepartmentService.getLatestCreatedDimEntity(); Date now = new Date(); @@ -144,10 +237,14 @@ public class StatsDimServiceImpl implements StatsDimService { if (lastCreatedDeptDim != null) { lastInitTime = lastCreatedDeptDim.getCreatedTime(); } + return departmentService.listDepartmentsByCreatedTime(lastInitTime, now); + } - List departments = departmentService.listDepartmentsByCreatedTime(lastInitTime, now); - if (!CollectionUtils.isEmpty(departments)) { - dimDepartmentService.initDepartmentDims(departments, now); + public List listUpdatedDepartments(Date initTime) { + DimDepartmentEntity lastUpdatedDeptDim = dimDepartmentService.getLatestUpdatedDimEntity(); + if (lastUpdatedDeptDim != null) { + return departmentService.listDepartmentsByUpdatedTime(lastUpdatedDeptDim.getCreatedTime(), initTime); } + return new ArrayList<>(); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java index 034499e955..96669f2ae9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerAgencyService.java @@ -7,4 +7,6 @@ import java.util.List; public interface CustomerAgencyService { List listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime); + + List listAgenciesByUpdatedTime(Date updatedTime, Date now); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java index 1aa2c2f7db..15178715ed 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerDepartmentService.java @@ -8,4 +8,6 @@ import java.util.List; public interface CustomerDepartmentService { List listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo); + + List listDepartmentsByUpdatedTime(Date createdTime, Date initTime); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java index 00b46e8b75..b2b7a5b129 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java @@ -32,4 +32,12 @@ public interface CustomerGridService { * @author zxc */ List getCustomerGridIdList(String customerId, String dateId); + + /** + * 根据更新时间查询变更过的网格列表 + * @param lastInitTime + * @param now + * @return + */ + List listUpdatedGridsByUpdateTime(Date lastInitTime, Date now); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java index 2912ca0cca..4813309176 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerAgencyServiceImpl.java @@ -22,4 +22,9 @@ public class CustomerAgencyServiceImpl implements CustomerAgencyService { public List listAgenciesByCreateTime(Date statsStartTime, Date statsEndTime) { return customerAgencyDao.listAgenciesByCreateTime(statsStartTime, statsEndTime); } + + @Override + public List listAgenciesByUpdatedTime(Date startTime, Date endTime) { + return customerAgencyDao.listAgenciesByUpdatedTime(startTime, endTime); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java index ac430a3abd..0a7a4e380a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerDepartmentServiceImpl.java @@ -28,4 +28,9 @@ public class CustomerDepartmentServiceImpl implements CustomerDepartmentService public List listDepartmentsByCreatedTime(Date createdTimeFrom, Date createdTimeTo) { return departmentDao.listDepartmentsByCreatedTime(createdTimeFrom, createdTimeTo); } + + @Override + public List listDepartmentsByUpdatedTime(Date startTime, Date endTime) { + return departmentDao.listDepartmentsByUpdatedTime(startTime, endTime); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java index fc95a3de29..5bab5596a7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java @@ -46,4 +46,9 @@ public class CustomerGridServiceImpl implements CustomerGridService { public List getCustomerGridIdList(String customerId, String dateId) { return customerGridDao.getCustomerGridIdList(customerId, dateId); } + + @Override + public List listUpdatedGridsByUpdateTime(Date lastInitTime, Date now) { + return customerGridDao.listUpdatedGridsByUpdateTime(lastInitTime, now); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java index df58489fd0..aad2cae314 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimAgencyService.java @@ -107,9 +107,8 @@ public interface DimAgencyService extends BaseService { /** * 初始化机关维度 - * @param agencies */ - void initAgencyDims(List agencies, Date initTime); + void initAgencyDims(List agencies2Add, List agencies2Update, Date initTime); /** * @Description 查询所有机关以及它下级机关的信息 @@ -175,4 +174,6 @@ public interface DimAgencyService extends BaseService { String getPidByAgencyId(String agencyId); DimAgencyEntity getLatestCreatedAgencyDimEntity(); + + DimAgencyEntity getLatestUpdatedAgencyDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java index d3562d01db..9d53593957 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimCustomerService.java @@ -110,9 +110,10 @@ public interface DimCustomerService extends BaseService { /** * 添加客户维度 - * @param customers */ - void initCustomerDims(List customers, Date initTime); + void initCustomerDims(List newCustomers, List updatedCustomers, Date initTime); DimCustomerEntity getLatestCreatedDimEntity(); + + DimCustomerEntity getLatestUpdatedDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java index fe839ac0c9..767d5b8ffe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java @@ -95,7 +95,7 @@ public interface DimDepartmentService extends BaseService { */ void delete(String[] ids); - void initDepartmentDims(List departments, Date initTime); + void initDepartmentDims(List newDepartments, List updatedDepartments, Date initTime); /** * desc: 根据客户Id获取 部门数据 @@ -108,4 +108,6 @@ public interface DimDepartmentService extends BaseService { List getDepartmentListByCustomerId(String customerId); DimDepartmentEntity getLatestCreatedDimEntity(); + + DimDepartmentEntity getLatestUpdatedDimEntity(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java index 312659eb96..b937efdf9e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimGridService.java @@ -101,9 +101,8 @@ public interface DimGridService extends BaseService { /** * 初始化网格维度 - * @param gridDims */ - void initGridDims(List gridDims); + void initGridDims(List newDimGrids, List changedGrids); /** * desc: 根据客户Id获取 该客户下所有的网格数据 @@ -128,4 +127,6 @@ public interface DimGridService extends BaseService { * @author zxc */ List selectSubAgencyId(List formDTO); + + DimGridEntity getLastUpdatedGridDim(); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java index 0d21b5525f..d40987c1bc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java @@ -123,12 +123,25 @@ public class DimAgencyServiceImpl extends BaseServiceImpl agencies, Date initTime) { - for (CustomerAgencyEntity agency : agencies) { + public void initAgencyDims(List agencies2Add, List agencies2Update, Date initTime) { + // 添加新增的机关维度 + for (CustomerAgencyEntity agency : agencies2Add) { initAgencyAllDim(agency, initTime); initAgencySelfDim(agency, initTime); } + // 更新变更过的机关维度 + for (CustomerAgencyEntity agency : agencies2Update) { + DimAgencyEntity existsDimAgency = baseDao.selectById(agency.getId()); + if (existsDimAgency != null) { + //说明是已存在的,不是新增的 + existsDimAgency.setAgencyName(agency.getOrganizationName()); + existsDimAgency.setUpdatedTime(initTime); + existsDimAgency.setUpdatedBy(RobotConstant.DIMENSION_ROBOT); + baseDao.updateById(existsDimAgency); + } + } + lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_AGENCY); } @@ -255,4 +268,9 @@ public class DimAgencyServiceImpl extends BaseServiceImpl customers, Date initTime) { - for (CustomerEntity customer : customers) { + public void initCustomerDims(List newCustomers, List updatedCustomers, Date initTime) { + // 添加新增的客户维度 + for (CustomerEntity customer : newCustomers) { DimCustomerEntity dim = new DimCustomerEntity(); dim.setCustomerName(customer.getCustomerName()); dim.setCreatedBy(RobotConstant.DIMENSION_ROBOT); @@ -131,6 +132,18 @@ public class DimCustomerServiceImpl extends BaseServiceImpl departments, Date initTime) { - for (CustomerDepartmentEntity department : departments) { + public void initDepartmentDims(List newDepartments, List updatedDepartments, Date initTime) { + // 新增科室初始化 + for (CustomerDepartmentEntity department : newDepartments) { DimDepartmentEntity dim = new DimDepartmentEntity(); dim.setAgencyId(department.getAgencyId()); dim.setCustomerId(department.getCustomerId()); @@ -122,6 +123,18 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl gridDims) { - for (DimGridEntity gridDim : gridDims) { - baseDao.insert(gridDim); + public void initGridDims(List newDimGrids, List changedGrids) { + for (DimGridEntity newGridDim : newDimGrids) { + baseDao.insert(newGridDim); + } + + for (DimGridEntity updatedGridDim : changedGrids) { + baseDao.updateById(updatedGridDim); } lastExecRecordDao.updateExecTimeBySubject(new Date(), StatsSubject.DIM_GRID); @@ -156,4 +159,9 @@ public class DimGridServiceImpl extends BaseServiceImpl selectSubAgencyId(List formDTO) { return baseDao.selectSubAgencyId(formDTO); } + + @Override + public DimGridEntity getLastUpdatedGridDim() { + return baseDao.getLastUpdatedGridDim(); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml index 0aac258069..382edefac3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/crm/CustomerDao.xml @@ -41,4 +41,27 @@ CONVERT ( c.CUSTOMER_NAME USING gbk ) ASC + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml index 6d3bc43ce3..365ae56b8a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerDepartmentDao.xml @@ -16,4 +16,24 @@ + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 6a5253e473..48c5176a78 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -47,4 +47,25 @@ AND customer_id = #{customerId} AND DATE_FORMAT( created_time, '%Y%m%d' ) #{dateId} + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml index 3e22e1b5c3..268782eb3d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/StatsCustomerAgencyDao.xml @@ -75,4 +75,29 @@ grid.ID + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml index 74c52efaa6..dedf82d8fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimAgencyDao.xml @@ -277,4 +277,25 @@ LIMIT 1 + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml index 7b8ad49e3c..13bc6a3e01 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerDao.xml @@ -25,4 +25,19 @@ ORDER BY CREATED_TIME DESC LIMIT 1 + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml index 68de10bef6..4f0a68ed28 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimDepartmentDao.xml @@ -35,4 +35,21 @@ ORDER BY CREATED_TIME DESC LIMIT 1 + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml index 783230dc55..eef43456f7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml @@ -52,4 +52,21 @@ + + \ No newline at end of file From e5fd83d4a4a1927e003d57650f80f11be78dd793 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Jul 2020 14:43:35 +0800 Subject: [PATCH 007/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-statistical-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/data-statistical/data-statistical-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index 811a2df85c..873f4e756a 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.39 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.40 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 971d0c956a..b3d31465fc 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.39 + 0.3.40 data-statistical com.epmet From f2bd7b494ea89b82a027401358cc52526097430b Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 22 Jul 2020 14:56:59 +0800 Subject: [PATCH 008/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-customer=5Fmp=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ComponentVerifyTicketServiceImpl.java | 80 +------------------ .../main/resources/mapper/CustomerMpDao.xml | 2 +- 2 files changed, 4 insertions(+), 78 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index ad4cd17964..cdc7b1d456 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -32,9 +32,7 @@ import org.springframework.web.bind.annotation.RequestBody; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import java.io.IOException; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.util.*; @@ -139,7 +137,6 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe break; case ModuleConstant.AUTHORIZED: //授权成功 // 更改customer_mp 授权信息,appId,并绑定 -// String authAppId = result.get(ModuleConstant.APP_ID); String authCode = result.get(ModuleConstant.AUTHORIZATION_CODE_HUMP); log.info("=============================="+authCode); AuthCodeResultDTO authCodeResultDTO = authCodeDao.selectCustomerIdByAuthCode(authCode); @@ -148,10 +145,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe Map authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); String authAppId = authorizerRefreshToken.get("authorizerAppid").toString(); this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authAppId,clientType); -// this.authInfoByAuthCode(authCode, customerId,clientType); authCodeDao.updateAppId(customerId,clientType,authAppId); this.saveAuthAccountInfo(customerId,authAppId,clientType); -// customerMpDao.updateAuthorizationFlag(authAppId); case ModuleConstant.UNAUTHORIZED://用户取消授权 //todo 取消授权 String authorizerAppId = result.get(ModuleConstant.AUTHORIZER_APP_ID_HUMP); @@ -494,89 +489,20 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe } /** - * @Description 1.创建开放平台账号并绑定 2.回填 customer_mp appId + * @Description 回填 customer_mp appId , 更改授权状态 * @param * @author zxc */ @Transactional(rollbackFor = Exception.class) public void updateCustomerMpAppIdAndCreateOpenPlatform(String customerId,String authAppId,String clientType){ - /*log.info("开始创建开放平台账号并绑定"); - Integer authCount = customerMpDao.selectAuthCount(customerId); - String openPlatformId = null; - Map authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); - String authorizerAccessToken = authorizerRefreshToken.get("authorizerAccessToken").toString(); - if (authCount==NumConstant.ZERO){ - log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); - //没有任何一个小程序/公众号授权,【先创建,再绑定】 - JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); - // 此处的 access_token 为 【authorizer_access_token】 - String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); - Map map = JSON.parseObject(data, Map.class); - CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); - createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); - createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG)); - createOpen.setOpenAppId(map.get(ModuleConstant.OPEN_APP_ID)); - switch (createOpen.getErrCode()){ - case NumConstant.ONE: - log.info(CREATE_AND_BIND_SUCCESS); - break; - case NumConstant.ONE_NEG: - throw new RenException(SYSTEM_ERROR); - case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: - throw new RenException(INVALID_APP_ID); - case ModuleConstant.EIGHTY_NINE_THOUSAND: - throw new RenException(ACCOUNT_HAS_BOUND_OPEN); - } - CreateOpenFormDTO coForm = new CreateOpenFormDTO(); - coForm.setOpenid(map.get(ModuleConstant.OPEN_APP_ID)); - coForm.setCustomerId(customerId); - //插入 open_platform_account 表 - openPlatformAccountDao.insertOpenPlatFormAccount(coForm); - openPlatformId = coForm.getId(); - }else if (authCount>NumConstant.ZERO){ - log.info("该客户已创建过开放平台账号,直接绑定"); - String openAppId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); - JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.LOW_APP_ID,componentAppId); - jsonObject.put(ModuleConstant.OPEN_APP_ID,openAppId); - String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_BIND_OPEN + authorizerRefreshToken, JSON.toJSONString(jsonObject)).getData(); - Map map = JSON.parseObject(data, Map.class); - CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); - createOpen.setErrCode(Integer.valueOf(map.get(ModuleConstant.ERR_CODE))); - createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG)); - switch (createOpen.getErrCode()){ - case NumConstant.ONE: - log.info(BIND_SUCCESS); - break; - case NumConstant.ONE_NEG: - throw new RenException(SYSTEM_ERROR); - case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: - throw new RenException(INVALID_APP_ID); - case ModuleConstant.EIGHTY_NINE_THOUSAND: - throw new RenException(ACCOUNT_HAS_BOUND_OPEN); - case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_ONE: - throw new RenException(NOT_SAME_CONTRACTOR); - case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_THREE: - throw new RenException(NOT_ALLOWED_OPERATE); - case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_FOUR: - throw new RenException(TO_LIMIT); - } - }*/ + log.info("==========回填customer_mp开始=========="); AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); formDTO.setClientType(clientType); formDTO.setAuthAppId(authAppId); formDTO.setCustomerId(customerId); //回填customer_mp的appId 只需以上三个字段 customerMpDao.updateAppIDByCustomerIdAndClient(formDTO); - //插入 binding_account - /*BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO(); - bindingAccount.setOpenPlatformAccountId(openPlatformId); - bindingAccount.setAuthAppId(authAppId); - bindingAccount.setClientType(clientType); - bindingAccount.setCustomerId(customerId); - bindingAccountDao.insertBindingAccount(bindingAccount);*/ - log.info("创建绑定账号结束"); + log.info("==========回填customer_mp结束=========="); } /** diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index da99a3dd4f..e64d023ba7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -51,7 +51,7 @@ + SELECT + id, + user_id, + wx_open_id, + open_id, + phone + FROM + pa_user_visited + WHERE + del_flag = '0' + AND wx_open_id = #{openId} + ORDER BY + created_time DESC + LIMIT 1 + \ No newline at end of file From 37ed64a475d40375f08f61a2c64f170dd65004b8 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Jul 2020 16:12:37 +0800 Subject: [PATCH 014/157] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E7=99=BB?= =?UTF-8?q?=E9=99=86=E6=95=B4=E4=BD=93=E8=B0=83=E6=95=B4-=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 57814cb264..1e2906d58c 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.42 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.43 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index bd8ded77d4..f9d1f17f4d 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.42 + 0.0.43 com.epmet From 961f7dddb2b3a46dd9284a1b25097976e2329e3b Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Jul 2020 16:33:40 +0800 Subject: [PATCH 015/157] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9=20=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- .../main/java/com/epmet/service/impl/PaCustomerServiceImpl.java | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 1e2906d58c..1eef80877b 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.43 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.44 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index f9d1f17f4d..37b8a2296a 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.43 + 0.0.44 com.epmet diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java index e19b00a3d3..577b025dff 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java @@ -193,6 +193,7 @@ public class PaCustomerServiceImpl extends BaseServiceImpl Date: Wed, 22 Jul 2020 17:46:32 +0800 Subject: [PATCH 016/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E6=8E=88=E6=9D=83=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dao/AuthorizationInfoDao.java | 17 ++++++++++++++++- .../main/java/com/epmet/redis/RedisThird.java | 5 +++-- .../impl/ComponentVerifyTicketServiceImpl.java | 8 ++++---- .../resources/mapper/AuthorizationInfoDao.xml | 12 ++++++++++++ 4 files changed, 35 insertions(+), 7 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java index 3e98b5a623..ad1bca18b5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.AuthorizationInfoDTO; import com.epmet.dto.form.AuthorizationInfoFormDTO; import com.epmet.dto.form.AuthorizerAccessTokenFormDTO; +import com.epmet.dto.result.AuthCodeResultDTO; import com.epmet.dto.result.WillOverDueResultDTO; import com.epmet.entity.AuthorizationInfoEntity; import org.apache.ibatis.annotations.Mapper; @@ -49,7 +50,7 @@ public interface AuthorizationInfoDao extends BaseDao { * @param customerId * @author zxc */ - void updateOldAuthorizationInfo(@Param("customerId")String customerId); +// void updateOldAuthorizationInfo(@Param("customerId")String customerId); /** * 根据客户ID,客户端类型获取授权信息 @@ -60,6 +61,13 @@ public interface AuthorizationInfoDao extends BaseDao { * @return com.epmet.dto.AuthorizationInfoDTO */ AuthorizationInfoDTO getAuthInfoByCustomer(@Param("customerId") String customerId, @Param("clientType") String clientType); + + /** + * @Description 逻辑删除授权信息 + * @param customerId + * @param clientType + * @author zxc + */ void updateOldAuthorizationInfo(@Param("customerId")String customerId,@Param("clientType")String clientType); /** @@ -83,4 +91,11 @@ public interface AuthorizationInfoDao extends BaseDao { */ void updateOldAuthorizerAccessToken(@Param("customerId")String customerId,@Param("clientType")String clientType); + /** + * @Description 根据 authAppId 查询客户ID和客户端类型 + * @param authAppId + * @author zxc + */ + AuthCodeResultDTO selectCustomerIdByAuthAppId(@Param("authAppId")String authAppId); + } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java index 9317ce418e..4d1e3f9386 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java @@ -121,8 +121,9 @@ public class RedisThird { * @author zxc */ public void setAuthInfo(AuthorizationInfoResultDTO authInfo,String customerId,String clientType){ - String key = ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY+ThirdRedisKeyConstant.COLON+customerId+ThirdRedisKeyConstant.COLON+clientType; - redisUtils.set(key,authInfo,-1); + Map map = BeanUtil.beanToMap(authInfo, false, true); + String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + customerId+ThirdRedisKeyConstant.COLON + clientType; + redisUtils.hMSet(key, map,NOT_EXPIRE); } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index feafd23b93..c73a85b980 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -138,19 +138,20 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe case ModuleConstant.AUTHORIZED: //授权成功 // 更改customer_mp 授权信息,appId,并绑定 String authCode = result.get(ModuleConstant.AUTHORIZATION_CODE_HUMP); + String authAppId = result.get(ModuleConstant.AUTHORIZER_APP_ID_HUMP); log.info("=============================="+authCode); - AuthCodeResultDTO authCodeResultDTO = authCodeDao.selectCustomerIdByAuthCode(authCode); + AuthCodeResultDTO authCodeResultDTO = authorizationInfoDao.selectCustomerIdByAuthAppId(authAppId); String clientType = authCodeResultDTO.getClientType(); String customerId = authCodeResultDTO.getCustomerId(); - Map authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); - String authAppId = authorizerRefreshToken.get("authorizerAppid").toString(); this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authAppId,clientType); authCodeDao.updateAppId(customerId,clientType,authAppId); this.saveAuthAccountInfo(customerId,authAppId,clientType); + break; case ModuleConstant.UNAUTHORIZED://用户取消授权 //todo 取消授权 String authorizerAppId = result.get(ModuleConstant.AUTHORIZER_APP_ID_HUMP); customerMpDao.updateAuthorizationFlag(authorizerAppId); + break; } } catch (Exception e) { log.error(e.getMessage()); @@ -372,7 +373,6 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String authCode = authCodeAndTime.getAuthCode(); String client = authCodeAndTime.getClientType(); String expiresIn = authCodeAndTime.getExpiresIn(); -// String customerId = tokenDto.getCustomerId(); String customerId = this.getLoginUserCustomerId(tokenDto); Date expiresInTime = this.countExpirationTime(expiresIn); if (StringUtils.isBlank(customerId)||StringUtils.isBlank(client)||StringUtils.isBlank(authCode)||StringUtils.isBlank(expiresIn)){ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml index 406a9fd06c..a45ff3501e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -78,4 +78,16 @@ AND EXPIRES_IN_TIME > NOW() + + + \ No newline at end of file From efe314c1259a0da996993e807581f8fc677694b4 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 22 Jul 2020 17:48:52 +0800 Subject: [PATCH 017/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 1eef80877b..3df46acfcb 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.44 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.45 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 37b8a2296a..18c8e57871 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.44 + 0.0.45 com.epmet From 0df413c28d5179bccf118fffcc4f3aa816c0a23d Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Jul 2020 18:07:10 +0800 Subject: [PATCH 018/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-statistical-server/deploy/docker-compose-dev.yml | 2 +- .../data-statistical-server/deploy/docker-compose-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index 873f4e756a..e86909b2c8 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.40 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.41 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml index 287e3ae732..4d3be03e5d 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.40 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/data-statistical-server:0.3.41 ports: - "8108:8108" network_mode: host # 使用现有网络 From 148b6349fc2fa98f006677daf0feda4b80755f28 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 22 Jul 2020 18:07:38 +0800 Subject: [PATCH 019/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/data-statistical/data-statistical-server/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index b3d31465fc..1709484e94 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.40 + 0.3.41 data-statistical com.epmet From 8d2486aa78428c7246b462bd6d5553940f2b864a Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Jul 2020 18:10:22 +0800 Subject: [PATCH 020/157] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=99=BB?= =?UTF-8?q?=E9=99=86=E8=8E=B7=E5=8F=96=E4=B8=A4=E4=B8=AA=E5=BF=85=E8=A6=81?= =?UTF-8?q?token?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/wxapi/service/impl/WxLoginServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java index 8ae28634de..87f7563298 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.constant.ThirdRedisKeyConstant; import com.epmet.dto.UserWechatDTO; import com.epmet.wxapi.constant.WxLoginConstant; import com.epmet.wxapi.service.WxLoginService; @@ -45,7 +46,7 @@ public class WxLoginServiceImpl implements WxLoginService { map.put("js_code", wxCode); map.put("grant_type", "authorization_code"); map.put("component_appid", componentAppId); - String componentAccessToken = (String) redisUtils.get("epmet:wechartthird:componentaccesstoken"); + String componentAccessToken = (String) redisUtils.get(ThirdRedisKeyConstant.ACCESS_TOKEN_REDIS_KEY); map.put("component_access_token", componentAccessToken); String resultStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.WXCODE_BY_OPENID, map).getData(); HashMap hashMap = JSON.parseObject(resultStr, HashMap.class); @@ -58,9 +59,9 @@ public class WxLoginServiceImpl implements WxLoginService { //2.换取用户基本信息 //小程序access_token - String access_token = (String) redisUtils.get("epmet:wechartthird:authinfo" + ":" + customerId + ":" + clientType); + Map accessMap = redisUtils.hGetAll(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + ":" + customerId + ":" + clientType); Map hash = new HashMap<>(); - hash.put("access_token", access_token); + hash.put("access_token", accessMap.get("authorizer_access_token")); hash.put("openid", openid); hash.put("lang", "zh_CN"); String getStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.OPENID_TO_INFORMATION, map).getData(); From 126a8d6fa98919f47c0c1c957ed01dd007ca64a1 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 22 Jul 2020 18:11:08 +0800 Subject: [PATCH 021/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-redis=E7=9A=84key=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/dao/AuthorizationInfoDao.java | 5 ++--- .../src/main/java/com/epmet/redis/RedisThird.java | 2 +- .../epmet/service/impl/ComponentVerifyTicketServiceImpl.java | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java index ad1bca18b5..8dfecfe821 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java @@ -64,11 +64,10 @@ public interface AuthorizationInfoDao extends BaseDao { /** * @Description 逻辑删除授权信息 - * @param customerId - * @param clientType + * @param authAppId * @author zxc */ - void updateOldAuthorizationInfo(@Param("customerId")String customerId,@Param("clientType")String clientType); + void updateOldAuthorizationInfo(@Param("authAppId")String authAppId); /** * @Description 查询即将过期的 authorizer_access_token diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java index 4d1e3f9386..e367e13227 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java @@ -122,7 +122,7 @@ public class RedisThird { */ public void setAuthInfo(AuthorizationInfoResultDTO authInfo,String customerId,String clientType){ Map map = BeanUtil.beanToMap(authInfo, false, true); - String key = ThirdRedisKeyConstant.AUTHORIZER_REFRESH_TOKEN_REDIS_KEY + customerId+ThirdRedisKeyConstant.COLON + clientType; + String key = ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + customerId+ThirdRedisKeyConstant.COLON + clientType; redisUtils.hMSet(key, map,NOT_EXPIRE); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index c73a85b980..2204c77aa4 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -280,7 +280,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe authInfoDTO.setCustomerId(customerId); authInfoDTO.setClientType(clientType); //先逻辑删除,在插入 - authorizationInfoDao.updateOldAuthorizationInfo(customerId,clientType); + authorizationInfoDao.updateOldAuthorizationInfo(authAppId); authorizationInfoDao.insertAuthorizationInfo(authInfoDTO); // 2. 权限列表 log.info(START_INSERT_FUNC_INFO); From beef21db9ea01c90fa9d4fb757b9a77c98ed6305 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 22 Jul 2020 18:12:23 +0800 Subject: [PATCH 022/157] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 3df46acfcb..2525de3787 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.45 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.46 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 18c8e57871..a534663307 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.45 + 0.0.46 com.epmet From 66cbc1d79618cbfd604f277788eb4278f929541b Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Wed, 22 Jul 2020 18:16:34 +0800 Subject: [PATCH 023/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 2525de3787..33754b2f79 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.46 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.47 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index a534663307..a362db7840 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.46 + 0.0.47 com.epmet From d4a7fed6d06654bb54e9a4573c7fc65c3414bccc Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 23 Jul 2020 08:53:57 +0800 Subject: [PATCH 024/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E6=8E=88=E6=9D=83=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dao/AuthorizationInfoDao.java | 7 ------- .../src/main/resources/mapper/AuthorizationInfoDao.xml | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java index 8dfecfe821..f4fde172f6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java @@ -45,13 +45,6 @@ public interface AuthorizationInfoDao extends BaseDao { */ void insertAuthorizationInfo(AuthorizationInfoFormDTO formDTO); - /** - * @Description 逻辑删除授权信息 - * @param customerId - * @author zxc - */ -// void updateOldAuthorizationInfo(@Param("customerId")String customerId); - /** * 根据客户ID,客户端类型获取授权信息 * @author zhaoqifeng diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml index a45ff3501e..cee136fb42 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -25,7 +25,7 @@ - update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType} + update authorization_info set del_flag = 1 where authorizer_appid = #{authAppId} From 49af760b8495b55e924f2f7f655c68be77f87045 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 23 Jul 2020 08:55:41 +0800 Subject: [PATCH 025/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 33754b2f79..de278b5785 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.47 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.48 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index a362db7840..2850f4ecc3 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.47 + 0.0.48 com.epmet From 25d61deee3ab52998db38b32a18ced4d33d55de9 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 23 Jul 2020 09:29:25 +0800 Subject: [PATCH 026/157] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/utils/HttpClientManager.java | 23 +++-- .../epmet/dto/CodeOperationHistoryDTO.java | 2 +- .../com/epmet/dto/form/UploadListFormDTO.java | 4 +- .../epmet-third/epmet-third-server/pom.xml | 6 ++ .../com/epmet/controller/CodeController.java | 4 +- .../entity/CodeOperationHistoryEntity.java | 2 +- .../service/impl/CodeCustomerServiceImpl.java | 2 +- .../epmet/service/impl/CodeServiceImpl.java | 86 ++++++++++--------- .../wxapi/constant/WxMaCodeConstant.java | 7 ++ .../com/epmet/wxapi/param/WxMaDomainDTO.java | 23 +++++ .../service/impl/WxMaCodeServiceImpl.java | 30 +++---- .../src/main/resources/bootstrap.yml | 15 ++-- .../main/resources/mapper/CodeCustomerDao.xml | 4 +- .../mapper/CodeOperationHistoryDao.xml | 6 +- .../mapper/ComponentAccessTokenDao.xml | 2 +- .../epmet/feign/OperCrmOpenFeignClient.java | 2 +- 16 files changed, 136 insertions(+), 82 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaDomainDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 714dcdf71d..880dec240e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -20,7 +20,9 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpRequestBase; import org.apache.http.client.utils.URIBuilder; +import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.FileBody; import org.apache.http.impl.client.CloseableHttpClient; @@ -36,6 +38,8 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -139,11 +143,20 @@ public class HttpClientManager { try { HttpPost httppost = new HttpPost(url); httppost.setConfig(requestConfig); - httppost.addHeader("Content-Type", "application/json; charset=utf-8"); - FileBody fileBody = new FileBody(file); - HttpEntity reqEntity = MultipartEntityBuilder.create() - .addPart("media", fileBody).build(); - httppost.setEntity(reqEntity); + String boundaryStr = "------------" + System.currentTimeMillis(); + httppost.addHeader("Connection", "keep-alive"); + httppost.addHeader("Accept", "*/*"); + httppost.addHeader("Content-Type", "multipart/form-data;boundary=" + boundaryStr); + httppost.addHeader("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); + MultipartEntityBuilder meb = MultipartEntityBuilder.create(); + meb.setBoundary(boundaryStr).setCharset(StandardCharsets.UTF_8).setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + meb.addBinaryBody("media", file, ContentType.APPLICATION_OCTET_STREAM, file.getName()); + HttpEntity entity = meb.build(); + httppost.setEntity(entity); +// FileBody fileBody = new FileBody(file); +// HttpEntity reqEntity = MultipartEntityBuilder.create() +// .addPart("media", fileBody).build(); +// httppost.setEntity(reqEntity); return execute(httppost); } catch (Exception e) { log.error("send exception", e); diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java index c668daeaea..65fa58f1cd 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeOperationHistoryDTO.java @@ -61,7 +61,7 @@ public class CodeOperationHistoryDTO implements Serializable { /** * 描述 */ - private String describe; + private String description; /** * 乐观锁 diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java index 64f3483f55..64a2b42e87 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/UploadListFormDTO.java @@ -38,9 +38,9 @@ public class UploadListFormDTO implements Serializable { /** * 页数 */ - private Integer page; + private Integer pageNo; /** * 页面条数 */ - private Integer limit; + private Integer pageSize; } diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index bb130098a6..de4b100e9b 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -135,6 +135,12 @@ 2.0.0 compile + + com.epmet + epmet-oss-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java index c24e502e47..e2b7901ed6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java @@ -49,7 +49,7 @@ public class CodeController { * @date 2020/7/17 16:22 */ @PostMapping("getextjson") - public Result getExtJson(CodeUploadFormDTO formDTO) { + public Result getExtJson(@RequestBody CodeUploadFormDTO formDTO) { String extJson = codeService.getExtJson(formDTO); return new Result().ok(extJson); } @@ -175,7 +175,7 @@ public class CodeController { * @date 2020/7/17 11:20 */ @PostMapping("mediaupload") - public Result mediaUpload(@RequestBody MediaUploadFormDTO formDTO) { + public Result mediaUpload(MediaUploadFormDTO formDTO) { String result = codeService.mediaUpload(formDTO); return new Result().ok(result); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java index fe56ddd312..706351f4f7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeOperationHistoryEntity.java @@ -61,6 +61,6 @@ public class CodeOperationHistoryEntity extends BaseEpmetEntity { /** * 描述 */ - private String describe; + private String description; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java index f2e9d5fd4c..1962b917a9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeCustomerServiceImpl.java @@ -107,7 +107,7 @@ public class CodeCustomerServiceImpl extends BaseServiceImpl list = baseDao.selectCodeList(formDTO); PageInfo pageInfo = new PageInfo<>(list); return new PageData<>(list, pageInfo.getTotal()); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index 4b9bfe1757..da2474e2f9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -13,8 +13,12 @@ import com.epmet.dao.AuthorizationInfoDao; import com.epmet.dao.ComponentAccessTokenDao; import com.epmet.dto.*; import com.epmet.dto.form.*; -import com.epmet.dto.result.*; +import com.epmet.dto.result.CodeHistoryResultDTO; +import com.epmet.dto.result.QrCodeResultDTO; +import com.epmet.dto.result.ReasonResultDTO; +import com.epmet.dto.result.TemplateListResultDTO; import com.epmet.feign.OperCrmOpenFeignClient; +import com.epmet.feign.OssFeignClient; import com.epmet.service.*; import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; import com.epmet.wxapi.param.WxMaCodeCommitReq; @@ -24,8 +28,6 @@ import com.epmet.wxapi.result.*; import com.epmet.wxapi.service.WxMaCodeService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import com.google.gson.JsonElement; -import com.google.gson.JsonParser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -63,6 +65,8 @@ public class CodeServiceImpl implements CodeService { private CodeMediaService codeMediaService; @Autowired private CodeExtService codeExtService; + @Autowired + private OssFeignClient ossFeignClient; @Override public List templateList() { @@ -101,7 +105,7 @@ public class CodeServiceImpl implements CodeService { @Transactional(rollbackFor = Exception.class) public void upload(CodeUploadFormDTO formDTO) { //是否授权 - if (customerMpService.getAuthFlag(formDTO.getCustomerId(), formDTO.getClientType())) { + if (!customerMpService.getAuthFlag(formDTO.getCustomerId(), formDTO.getClientType())) { throw new RenException("未授权"); } //获取小程序调用令牌 @@ -148,6 +152,7 @@ public class CodeServiceImpl implements CodeService { CodeCustomerDTO codeCustomerDTO = ConvertUtils.sourceToTarget(formDTO, CodeCustomerDTO.class); codeCustomerDTO.setCustomerName(customerInfo.getData().getCustomerName()); codeCustomerDTO.setExtJson(formDTO.getExtJson()); + codeCustomerDTO.setAppId(authInfo.getAuthorizerAppid()); codeCustomerDTO.setStatus(CodeConstant.UNAUDITED); codeCustomerService.save(codeCustomerDTO); @@ -158,37 +163,36 @@ public class CodeServiceImpl implements CodeService { public PageData uploadList(UploadListFormDTO formDTO) { //获取小程序调用令牌 AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); - if (null == authInfo) { - throw new RenException("未授权"); - } - List auditingList = codeCustomerService.getAuditingCodeList(); - auditingList.forEach(code -> { - //获取审核结果信息 - CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId()); - //调用微信API获取最新审核状态 - WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq(); - request.setAuditId(auditResult.getAuditId()); - WxResult wxAuditResult = wxMaCodeService.getAuditStatus(authInfo.getAuthorizerAccessToken(), request); - if (wxAuditResult.success()) { - WxMaAuditStatusResult result = wxAuditResult.getData(); - if (result.getStatus() == NumConstant.ZERO) { - code.setStatus(CodeConstant.AUDIT_SUCCESS); - auditResult.setResult(CodeConstant.AUDIT_SUCCESS); - codeOperationHistoryService.updateDescribe(code.getId(), "审核成功"); - } else if (result.getStatus() == NumConstant.ONE) { - code.setStatus(CodeConstant.AUDIT_FAILED); - auditResult.setResult(CodeConstant.AUDIT_FAILED); - auditResult.setReason(result.getReason()); - codeOperationHistoryService.updateDescribe(code.getId(), result.getReason()); - } else if (result.getStatus() == NumConstant.FOUR) { - code.setStatus(CodeConstant.DELAY); - auditResult.setResult(CodeConstant.DELAY); - codeOperationHistoryService.updateDescribe(code.getId(), "审核延后"); + if (null != authInfo) { + List auditingList = codeCustomerService.getAuditingCodeList(); + auditingList.forEach(code -> { + //获取审核结果信息 + CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId()); + //调用微信API获取最新审核状态 + WxMaCodeAuditStatusReq request = new WxMaCodeAuditStatusReq(); + request.setAuditId(auditResult.getAuditId()); + WxResult wxAuditResult = wxMaCodeService.getAuditStatus(authInfo.getAuthorizerAccessToken(), request); + if (wxAuditResult.success()) { + WxMaAuditStatusResult result = wxAuditResult.getData(); + if (result.getStatus() == NumConstant.ZERO) { + code.setStatus(CodeConstant.AUDIT_SUCCESS); + auditResult.setResult(CodeConstant.AUDIT_SUCCESS); + codeOperationHistoryService.updateDescribe(code.getId(), "审核成功"); + } else if (result.getStatus() == NumConstant.ONE) { + code.setStatus(CodeConstant.AUDIT_FAILED); + auditResult.setResult(CodeConstant.AUDIT_FAILED); + auditResult.setReason(result.getReason()); + codeOperationHistoryService.updateDescribe(code.getId(), result.getReason()); + } else if (result.getStatus() == NumConstant.FOUR) { + code.setStatus(CodeConstant.DELAY); + auditResult.setResult(CodeConstant.DELAY); + codeOperationHistoryService.updateDescribe(code.getId(), "审核延后"); + } + codeCustomerService.update(code); + codeAuditResultService.update(auditResult); } - codeCustomerService.update(code); - codeAuditResultService.update(auditResult); - } - }); + }); + } return codeCustomerService.getCodeList(formDTO); } @@ -197,7 +201,7 @@ public class CodeServiceImpl implements CodeService { //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } //获取小程序调用令牌 @@ -232,7 +236,7 @@ public class CodeServiceImpl implements CodeService { //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } //获取审核结果信息 @@ -277,7 +281,7 @@ public class CodeServiceImpl implements CodeService { //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } //获取小程序调用令牌 @@ -308,7 +312,7 @@ public class CodeServiceImpl implements CodeService { //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); @@ -343,7 +347,7 @@ public class CodeServiceImpl implements CodeService { //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //是否授权 - if (customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { + if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); } //获取小程序调用令牌 @@ -383,7 +387,7 @@ public class CodeServiceImpl implements CodeService { CodeMediaDTO codeMediaDTO = new CodeMediaDTO(); codeMediaDTO.setCodeId(formDTO.getCodeId()); codeMediaDTO.setMediaId(wxResult.getData().getMediaId()); - codeMediaDTO.setMediaName(formDTO.getMedia().getName()); + codeMediaDTO.setMediaName(formDTO.getMedia().getOriginalFilename()); codeMediaDTO.setMediaType(wxResult.getData().getType()); codeMediaService.save(codeMediaDTO); return wxResult.getData().getMediaId(); @@ -399,7 +403,7 @@ public class CodeServiceImpl implements CodeService { operationDTO.setCodeId(codeId); operationDTO.setVersion(version); operationDTO.setOperation(operation); - operationDTO.setDescribe(describe); + operationDTO.setDescription(describe); codeOperationHistoryService.save(operationDTO); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index 4190008538..104b447b5a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -143,4 +143,11 @@ public interface WxMaCodeConstant { * 新增临时素材 */ String MEDIA_UPLOAD_URL = "https://api.weixin.qq.com/wxa/setwebviewdomain"; + + /** + * 新增临时素材 + */ + String GET_TEMPLATE_URL = "https://api.weixin.qq.com/wxa/gettemplatelist"; + + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaDomainDTO.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaDomainDTO.java new file mode 100644 index 0000000000..694dd0f262 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaDomainDTO.java @@ -0,0 +1,23 @@ +package com.epmet.wxapi.param; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/17 17:44 + */ +@Data +@Component +@ConfigurationProperties(prefix = "third.domain") +public class WxMaDomainDTO { + private List requestDomain; + private List wsRequestDomain; + private List uploadDomain; + private List downloadDomain; + private List webviewDomain; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java index dfc9bb5cc9..3ffe8aa295 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.wxapi.service.WxMaCodeService; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -18,6 +19,8 @@ import java.io.File; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; /** @@ -30,21 +33,14 @@ import java.util.List; public class WxMaCodeServiceImpl implements WxMaCodeService { private static final String ERR_CODE = "errcode"; private static final String ERR_MSG = "errmsg"; - @Value("${third.domain.requestdomain}") - private List requestDomain; - @Value("${third.domain.wsrequestdomain}") - private List wsRequestDomain; - @Value("${third.domain.uploaddomain}") - private List uploadDomain; - @Value("${third.domain.downloaddomain}") - private List downloadDomain; - @Value("${third.domain.webviewdomain}") - private List webviewDomain; + + @Autowired + private WxMaDomainDTO wxMaDomainDTO; @Override public WxResult> getTemplateList(String accessToken) { WxResult> result = new WxResult<>(); - String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; + String url = WxMaCodeConstant.GET_TEMPLATE_URL + "?" + "access_token=" + accessToken; Result templateListResult = HttpClientManager.getInstance().sendGet(url, null); if (!templateListResult.success()) { result.setErrorCode(templateListResult.getCode()); @@ -54,7 +50,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { Gson gson = new Gson(); WxMaTemplateListResult templateList = gson.fromJson(templateListResult.getData(), WxMaTemplateListResult.class); result.setErrorCode(templateList.getErrCode()); - result.setErrorMsg(templateList.getErrMsg()); + result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(templateList.getErrCode())); result.setData(templateList.getTemplateList()); return result; } @@ -224,10 +220,10 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { String url = WxMaCodeConstant.MODIFY_DOMAIN_URL + "?" + "access_token=" + accessToken; WxMaModifyDomainReq request = new WxMaModifyDomainReq(); request.setAction("set"); - request.setRequestDomain(requestDomain); - request.setUploadDomain(uploadDomain); - request.setWsRequestDomain(wsRequestDomain); - request.setDownloadDomain(downloadDomain); + request.setRequestDomain(wxMaDomainDTO.getRequestDomain()); + request.setUploadDomain(wxMaDomainDTO.getUploadDomain()); + request.setWsRequestDomain(wxMaDomainDTO.getWsRequestDomain()); + request.setDownloadDomain(wxMaDomainDTO.getDownloadDomain()); Result modifyResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); if (!modifyResult.success()) { result.setErrorCode(modifyResult.getCode()); @@ -246,7 +242,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { String url = WxMaCodeConstant.SET_WEBVIEW_DOMAIN_URL + "?" + "access_token=" + accessToken; WxMaSetWebviewDomainReq request = new WxMaSetWebviewDomainReq(); request.setAction("set"); - request.setWebViewDomain(webviewDomain); + request.setWebViewDomain(wxMaDomainDTO.getWebviewDomain()); Result modifyResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); if (!modifyResult.success()) { result.setErrorCode(modifyResult.getCode()); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml index 34cba72036..82188b3697 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/bootstrap.yml @@ -105,8 +105,13 @@ third: aesKey: d6dbde92c67e11eabac1c03fd56f7847qazxswedcvg token: 1ae5f230c67f11eabac1c03fd56f7847 domain: - requestdomain: "https://epmet-cloud.elinkservice.cn" - wsrequestdomain: "https://epmet-cloud.elinkservice.cn" - uploaddomain: "https://epmet-cloud.elinkservice.cn" - downloaddomain: "https://epmet-cloud.elinkservice.cn" - webviewdomain: "https://epmet-cloud.elinkservice.cn" \ No newline at end of file + requestDomain: + - https://epmet-cloud.elinkservice.cn + wsRequestDomain: + - https://epmet-cloud.elinkservice.cn + uploadDomain: + - https://epmet-cloud.elinkservice.cn + downloadDomain: + - https://epmet-cloud.elinkservice.cn + webviewDomain: + - https://epmet-cloud.elinkservice.cn \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml index 22d77316e6..dbfe38c5e7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeCustomerDao.xml @@ -31,8 +31,8 @@ cc.USER_VERSION AS "version", cc.USER_DESC AS "codeInfo", cc.STATUS, - DATE_FORMAT(cc.CREATED_TIME,'%Y-%m-%d') AS "uploadTime", - IFNULL(DATE_FORMAT(car.CREATED_TIME,'%Y-%m-%d'),'') AS "auditTime", + DATE_FORMAT(cc.CREATED_TIME,'%Y-%m-%d %T') AS "uploadTime", + IFNULL(DATE_FORMAT(car.CREATED_TIME,'%Y-%m-%d %T'),'') AS "auditTime", car.AUDIT_ID FROM code_customer cc LEFT JOIN code_audit_result car ON cc.ID = car.CODE_ID AND car.DEL_FLAG = '0' diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml index 277beabe35..5e33c62878 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml @@ -9,7 +9,7 @@ - + @@ -19,7 +19,7 @@ UPDATE code_operation_history SET - `DESCRIBE` = #{describe} + `DESCRIPTION` = #{description} WHERE CODE_ID = #{codeId} AND OPERATION = 'audit' @@ -28,7 +28,7 @@ DATE_FORMAT(coh.CREATED_TIME, '%Y-%m-%d') AS "operationTime", coh.VERSION, coh.OPERATION, - coh.`DESCRIBE` + coh.`DESCRIPTION` FROM code_operation_history coh INNER JOIN code_customer cc ON coh.CODE_ID = cc.ID WHERE diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml index 53e1820b8a..c48019c3a3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentAccessTokenDao.xml @@ -28,7 +28,7 @@ COMPONENT_ACCESS_TOKEN FROM component_access_token - WHERE delFlag = '0' + WHERE DEL_FLAG = '0' 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 b14ab6036d..5b220aa698 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 @@ -21,6 +21,6 @@ public interface OperCrmOpenFeignClient { * @param dto * @return */ - @PostMapping("/oper/crm/getcostomerInfo") + @PostMapping("/oper/crm/customer/getcostomerInfo") Result getCustomerInfo(CustomerDTO dto); } From 0dc1f889ab05c03c2e579f0bb5c2e54b1e4de419 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 23 Jul 2020 09:31:19 +0800 Subject: [PATCH 027/157] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/feign/OssFeignClient.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java index 1a64ebab62..a22f95bf71 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java @@ -8,6 +8,7 @@ package com.epmet.feign; +import com.epmet.commons.tools.constant.ServiceConstant; import feign.codec.Encoder; import feign.form.spring.SpringFormEncoder; import com.epmet.commons.tools.utils.Result; @@ -25,7 +26,7 @@ import org.springframework.web.multipart.MultipartFile; * @author Mark sunlightcs@gmail.c om * @since 1.1.0 */ -@FeignClient(name = "renren-oss-server", configuration = OssFeignClient.MultipartSupportConfig.class) +@FeignClient(name = ServiceConstant.EPMET_OSS_SERVER, configuration = OssFeignClient.MultipartSupportConfig.class) public interface OssFeignClient { /** * 文件上传 From bd81d756dacf566bfbcbbb4f68a94d6609f08036 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 23 Jul 2020 09:37:41 +0800 Subject: [PATCH 028/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-authInfo=E7=9A=84key=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/constant/ThirdRedisKeyConstant.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java index 13fa20c226..c6cbaa6894 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRedisKeyConstant.java @@ -44,7 +44,7 @@ public interface ThirdRedisKeyConstant { /** * authorization_info 授权信息 */ - String AUTH_INFO_REDIS_KEY = "epmet:wechartthird:authinfo"; + String AUTH_INFO_REDIS_KEY = "epmet:wechartthird:authinfo:"; } From 70125cc30389962569fa9e137f9f22f2efd8e9df Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 23 Jul 2020 09:38:53 +0800 Subject: [PATCH 029/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index de278b5785..9d6ee7c695 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.48 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.49 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 2efc3df332..d32deba4f6 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.48 + 0.0.49 com.epmet From b46d0075aa3f47301a50e8b36d2c8433782eb028 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 23 Jul 2020 09:41:10 +0800 Subject: [PATCH 030/157] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/utils/HttpClientManager.java | 18 +++--------------- .../deploy/docker-compose-dev.yml | 2 +- .../epmet-third/epmet-third-server/pom.xml | 2 +- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 880dec240e..69a3f68157 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -66,9 +66,9 @@ public class HttpClientManager { .setConnectTimeout(connectionTimeout) .build();//设置请求和传输超时时间 - public static HttpClientManager getInstance() { - return SingleClass.instance; - } +// public static HttpClientManager getInstance() { +// return SingleClass.instance; +// } private static class SingleClass { private final static HttpClientManager instance = new HttpClientManager(); @@ -309,18 +309,6 @@ public class HttpClientManager { return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } - public static void main(String[] args) { - String url = "http://localhost:8107/epmetscan/api/textSyncScan"; - TextTaskDTO p = new TextTaskDTO(); - p.setDataId("1"); - p.setContent("neirong1"); - List list = new ArrayList<>(); - list.add(p); - TextScanParamDTO param = new TextScanParamDTO(); - param.setTasks(list); - Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param)); - System.out.println(JSON.toJSONString(result)); - } } diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index de278b5785..9d6ee7c695 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.48 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.49 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 2efc3df332..d32deba4f6 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.48 + 0.0.49 com.epmet From 6cf3f8e86979ba7066ba4d05aa124a621c8bb09a Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 23 Jul 2020 09:46:47 +0800 Subject: [PATCH 031/157] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/utils/HttpClientManager.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 69a3f68157..e247820ac8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.dto.form.DingTalkTextMsg; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.scan.param.TextScanParamDTO; -import com.epmet.commons.tools.scan.param.TextTaskDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.ArrayUtils; @@ -24,7 +22,6 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; @@ -38,7 +35,6 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; @@ -66,9 +62,9 @@ public class HttpClientManager { .setConnectTimeout(connectionTimeout) .build();//设置请求和传输超时时间 -// public static HttpClientManager getInstance() { -// return SingleClass.instance; -// } + public static HttpClientManager getInstance() { + return SingleClass.instance; + } private static class SingleClass { private final static HttpClientManager instance = new HttpClientManager(); From f66bbc51a0c768de13bd7e0ade2778ab27fa2a31 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Thu, 23 Jul 2020 09:54:39 +0800 Subject: [PATCH 032/157] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 3 + .../epmet-heart/epmet-heart-client/pom.xml | 6 + .../dto/form/resi/ResiActContentFormDTO.java | 46 ++++ .../dto/form/resi/ResiActDetailFormDTO.java | 38 ++++ .../result/resi/ResiActContentResultDTO.java | 56 +++++ .../result/resi/ResiActDetailResultDTO.java | 140 +++++++++++++ ...tDTO.java => ResiActLiveRecResultDTO.java} | 18 +- .../resi/ResiActRefusedDetailResultDTO.java | 99 +++++++++ .../result/resi/ResiActSummaryResultDTO.java | 55 +++++ .../result/resi/ResiLeaderboardResultDTO.java | 60 ++++++ .../com/epmet/feign/EpmetUserFeignClient.java | 32 +++ .../EpmetUserFeignClientFallBack.java | 25 +++ .../controller/ResiActListController.java | 92 +++++++- .../controller/ResiVolunteerController.java | 40 ++++ .../main/java/com/epmet/dao/ActInfoDao.java | 31 +++ .../java/com/epmet/dao/ActLiveRecDao.java | 29 ++- .../java/com/epmet/dao/ActSummaryDao.java | 15 +- .../com/epmet/dao/ActUserRelationDao.java | 22 +- .../java/com/epmet/dao/HeartUserInfoDao.java | 29 ++- .../com/epmet/service/ActInfoService.java | 21 +- .../com/epmet/service/ActLiveRecService.java | 15 +- .../com/epmet/service/ActSummaryService.java | 15 +- .../epmet/service/ActUserRelationService.java | 17 +- .../epmet/service/HeartUserInfoService.java | 18 +- .../service/impl/ActInfoServiceImpl.java | 198 ++++++++++++++++-- .../service/impl/ActLiveRecServiceImpl.java | 51 ++++- .../service/impl/ActSummaryServiceImpl.java | 13 +- .../impl/ActUserRelationServiceImpl.java | 31 ++- .../impl/HeartUserInfoServiceImpl.java | 39 +++- .../utils/ActUserRelationStatusConstant.java | 38 ++++ .../epmet/utils/ActUserStatusConstant.java | 49 +++++ .../com/epmet/utils/ValidityVerification.java | 90 ++++++++ .../src/main/resources/mapper/ActInfoDao.xml | 69 ++++++ .../main/resources/mapper/ActLiveRecDao.xml | 30 ++- .../main/resources/mapper/ActSummaryDao.xml | 17 +- .../resources/mapper/ActUserRelationDao.xml | 24 ++- .../resources/mapper/HeartUserInfoDao.xml | 28 ++- 37 files changed, 1537 insertions(+), 62 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java rename epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/{ActClockListResultDTO.java => ResiActLiveRecResultDTO.java} (78%) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 63cab186d4..59a602b124 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -74,6 +74,9 @@ public enum EpmetErrorCode { IMG_SCAN_FAILED(8504,"图片审核失败,请重新上传"), PROJECT_IS_CLOSED(8601,"项目已结案"), + // 爱心互助 居民端 + NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), + // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR(8702, "添加客户根级组织失败"), diff --git a/epmet-module/epmet-heart/epmet-heart-client/pom.xml b/epmet-module/epmet-heart/epmet-heart-client/pom.xml index 8701e1a09d..454488ddc2 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/pom.xml +++ b/epmet-module/epmet-heart/epmet-heart-client/pom.xml @@ -26,6 +26,12 @@ io.springfox springfox-swagger-ui + + com.epmet + epmet-user-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java new file mode 100644 index 0000000000..e1bd5fc097 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActContentFormDTO.java @@ -0,0 +1,46 @@ +package com.epmet.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 活动内容(活动详情-已结束-回顾稿) 入参 + * + * @Auther: zhangyong + * @Date: 2020-07-21 18:12 + */ +@Data +public class ResiActContentFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动Id + */ + @NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + private String actId; + + /** + * 页码,从1开始 + */ + @Min(value = 1, message = "页码必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + private Integer pageNo; + + /** + * 页容量,默认20页 + */ + @Min(value = 1, message = "每页条数必须大于必须大于0", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + private Integer pageSize; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java new file mode 100644 index 0000000000..10a03cfd90 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActDetailFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 活动详情 入参 + * + * @Auther: zhangyong + * @Date: 2020-07-21 18:12 + */ +@Data +public class ResiActDetailFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动Id + */ + @NotBlank(message = "活动Id不能为空", groups = { ResiActBaseFormDTO.AddUserInternalGroup.class }) + private String actId; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.java new file mode 100644 index 0000000000..4d6e9bbf3f --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActContentResultDTO.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.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 活动内容 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 + */ +@Data +public class ResiActContentResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actContentId; + + /** + * 内容 + */ + private String content; + + /** + * 内容类型 图片:img;文字:text + */ + private String contentType; + + /** + * 内容顺序 从1开始 + */ + private Integer orderNum; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java new file mode 100644 index 0000000000..18dba0c301 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActDetailResultDTO.java @@ -0,0 +1,140 @@ +/** + * 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.result.resi; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 活动详情 + * + * @author zhangyong + * @since v1.0.0 2020-07-20 + */ +@Data +public class ResiActDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actId; + + /** + * 标题 + */ + private String title; + + /** + * 联系人 + */ + private String contacts; + + /** + * 联系电话 + */ + private String tel; + + /** + * 报名截止时间(yyyy-MM-dd HH:mm) + */ + private String signUpEndTime; + + /** + * 活动开始时间(yyyy-MM-dd HH:mm) + */ + private String actStartTime; + + /** + * 活动结束时间(yyyy-MM-dd HH:mm) + */ + private String actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额类型(true:固定名额 false: 不限制名额) + */ + private Boolean actQuotaCategory; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * 已报名人数 + */ + private Integer signupNum; + + /** + * 积分奖励 + */ + private Integer reward; + + /** + * 招募要求 + */ + private String requirement; + + /** + * 活动详情 + */ + private List actContent; + + /** + * 用户当前状态(sign_up-我要报名,canceld-取消报名,enough-已报满,end_sign_up-截止报名,in_progress-已开始; finished-已结束,canceled-已取消) + */ + private String currentUserStatus; + + /** + * 用户是否是志愿者身份 (true:是,false 不是) + */ + private Boolean userVolunteerFlag; + + /** + * 是否需要是志愿者(true:只有志愿者才可以参加活动,false: 只要是居民就可以参加活动) + */ + private Boolean volunteerLimit; + + /** + * 活动实际开始时间(yyyy-MM-dd HH:mm) + */ + private String actualStartTime; + + /** + * 活动实际结束时间(yyyy-MM-dd HH:mm) + */ + private String actualEndTime; + + /** + * 主办方 + */ + private String sponsor; + + /** + * 是否已签到(true已签到,false未签到) + */ + private Boolean isSignUp; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java similarity index 78% rename from epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java rename to epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java index cb3cc26361..8798dfb0ef 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ActClockListResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActLiveRecResultDTO.java @@ -22,27 +22,25 @@ import lombok.Data; import java.io.Serializable; import java.util.List; + /** - * 打卡列表 + * 活动详情-已结束-现场实况列表 * - * @author zhangyong - * @since v1.0.0 2020-07-14 + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 */ @Data -public class ActClockListResultDTO implements Serializable { +public class ResiActLiveRecResultDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 活动打卡人次 + * 现场实况次数 */ - private Integer clockNum; + private Integer actLiveNum; /** * 打卡列表 */ - private List clocks; - - - + private List actLives; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java new file mode 100644 index 0000000000..34d18ae9d2 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActRefusedDetailResultDTO.java @@ -0,0 +1,99 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 活动详情-未通过 + * + * @author zhangyong + * @since v1.0.0 2020-07-20 + */ +@Data +public class ResiActRefusedDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String actId; + + /** + * 标题 + */ + private String title; + + /** + * 报名截止时间(yyyy-MM-dd HH:mm) + */ + private String signUpEndTime; + + /** + * 活动开始时间(yyyy-MM-dd HH:mm) + */ + private String actStartTime; + + /** + * 活动结束时间(yyyy-MM-dd HH:mm) + */ + private String actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额类型(true:固定名额 false: 不限制名额) + */ + private Boolean actQuotaCategory; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * 联系人 + */ + private String contacts; + + /** + * 联系电话 + */ + private String tel; + + /** + * 积分奖励 + */ + private Integer reward; + + /** + * 主办方 + */ + private String sponsor; + + /** + * 未通过原因 + */ + private String failureReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.java new file mode 100644 index 0000000000..f52006de80 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiActSummaryResultDTO.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.dto.result.resi; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 活动回顾列表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 + */ +@Data +public class ResiActSummaryResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String summaryId; + + /** + * 内容 + */ + private String content; + + /** + * 内容类型 图片:img;文字:text + */ + private String contentType; + + /** + * 内容顺序 从1开始 + */ + private Integer orderNum; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java new file mode 100644 index 0000000000..d3d50da078 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/resi/ResiLeaderboardResultDTO.java @@ -0,0 +1,60 @@ +/** + * 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.result.resi; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 爱心榜 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 + */ +@Data +public class ResiLeaderboardResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 微信昵称 + */ + private String nickname; + + /** + * 微信头像 + */ + private String headImg; + + /** + * 是否是志愿者(true:是志愿者,false: 不是志愿者) + */ + private Boolean volunteerFlag; + + /** + * 爱心时长(单位:小时) + */ + private Integer kindnessTime; + + /** + * 参加次数 + */ + private Integer participationNum; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java new file mode 100644 index 0000000000..96663f3503 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -0,0 +1,32 @@ +package com.epmet.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + + +/** + * 用户模块 + * + * @author zhangyong + * @date 2020/7/22 14:51 + */ +@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class) +public interface EpmetUserFeignClient { + + /** + * @param userIds + * @return com.epmet.commons.tools.utils.Result> + * @author zhangyong + * @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) + * @Date 2020/7/22 9:30 + **/ + @PostMapping("epmetuser/userbaseinfo/queryuserbaseinfo") + Result> heartQueryUserBaseInfo(@RequestBody List userIds); +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java new file mode 100644 index 0000000000..656c446b05 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -0,0 +1,25 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.UserWechatDTO; +import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.feign.EpmetUserFeignClient; +import org.springframework.stereotype.Component; + +import java.util.List; + + +/** + * @author zhangyong + * @date 2020/7/22 14:51 + */ +@Component +public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { + + @Override + public Result> heartQueryUserBaseInfo(List userIds) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "heartQueryUserBaseInfo", userIds); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java index 235dbca23b..478bcfaa58 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java @@ -5,7 +5,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.resi.*; import com.epmet.dto.result.resi.*; -import com.epmet.service.ActInfoService; +import com.epmet.service.*; import com.epmet.commons.tools.utils.Result; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.*; import java.util.List; /** - * 居民端-活动列表相关api + * 居民端-活动相关api * * @author yinzuomei@elink-cn.com * @date 2020/7/19 23:17 @@ -25,6 +25,18 @@ public class ResiActListController { @Autowired private ActInfoService actInfoService; + @Autowired + private ActUserRelationService actUserRelationService; + + @Autowired + private ActSummaryService actSummaryService; + + @Autowired + private ActLiveRecService actLiveRecService; + + @Autowired + private HeartUserInfoService heartUserInfoService; + /** * 活动列表(包含状态:报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;) * @@ -135,6 +147,64 @@ public class ResiActListController { return actInfoService.actLookBack(formDto); } + // + + /** + * 活动详情 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("detail") + public Result detail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) { + return actInfoService.actDetail(tokenDto, formDto); + } + + /** + * 活动详情-未通过 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("rejectdetail") + public Result rejectDetail(@LoginUser TokenDto tokenDto, @RequestBody ResiActDetailFormDTO formDto) { + return actInfoService.rejectDetail(tokenDto, formDto); + } + + /** + * 活动详情-已结束-回顾稿 + * + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("summary/list") + public Result summaryList(@RequestBody ResiActContentFormDTO formDto) { + return actSummaryService.summaryList(formDto); + } + + /** + * 活动详情-已结束-现场实况列表 + * + * @param actId + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + @PostMapping("livereclist") + public Result liveRecList(@RequestBody String actId) { + return actLiveRecService.liveRecList(actId); + } + + // + /** * 取消活动报名 * @@ -147,7 +217,7 @@ public class ResiActListController { @PostMapping("cancelsignup") public Result cancelSignUp(@LoginUser TokenDto tokenDto, @RequestBody ResiActUserCancelSignUpFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - return actInfoService.cancelSignUp(tokenDto, formDTO); + return actUserRelationService.cancelSignUp(tokenDto, formDTO); } /** @@ -165,4 +235,20 @@ public class ResiActListController { return actInfoService.checkSignInAddress(formDTO); } + /** + * 爱心榜 + * 显示报名参加过活动的用户/志愿者 + * 排序规则:按照爱心时长一致,按照参加次数排序 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:42 2020-07-22 + **/ + @PostMapping("leaderboard") + public Result> leaderboard(@RequestBody ResiActBaseFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return heartUserInfoService.leaderboard(formDTO); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java new file mode 100644 index 0000000000..8d3508fce6 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -0,0 +1,40 @@ +/** + * 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.dao.VolunteerInfoDao; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + + +/** + * 居民端-志愿者相关api + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-19 + */ +@RestController +@RequestMapping("/resi/volunteer") +public class ResiVolunteerController { + + @Autowired + private VolunteerInfoDao volunteerInfoDao; + + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index dfe34da353..1d4cf03f8b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.form.resi.ResiActBaseFormDTO; +import com.epmet.dto.form.resi.ResiActDetailFormDTO; import com.epmet.dto.form.resi.ResiLatestActFormDTO; import com.epmet.dto.form.resi.ResiMyActFormDTO; import com.epmet.dto.result.resi.*; @@ -184,4 +185,34 @@ public interface ActInfoDao extends BaseDao { * @Date 2020/7/22 17:08 **/ ActSignUpStatResultDTO getActSignUpStat(String actId); + + /** + * 活动详情 + * + * @param formDto + * @return com.epmet.dto.result.resi.ResiActDetailResultDTO + * @Author zhangyong + * @Date 09:20 2020-07-22 + **/ + ResiActDetailResultDTO selectActInfoDetail(ResiActDetailFormDTO formDto); + + /** + * 活动详情-未通过 + * + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + ResiActRefusedDetailResultDTO selectActRejectDetail(ResiActDetailFormDTO formDto); + + /** + * 从活动内容表,查询活动内容 + * + * @param actId + * @return java.util.List + * @Author zhangyong + * @Date 09:56 2020-07-22 + **/ + List selectListActContent(@Param("actId") String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java index dec7d0055b..61d04aa888 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java @@ -18,8 +18,14 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ActLivePicDTO; +import com.epmet.dto.ActLiveRecDTO; +import com.epmet.dto.form.resi.ResiActContentFormDTO; import com.epmet.entity.ActLiveRecEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 活动实况记录 @@ -29,5 +35,24 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActLiveRecDao extends BaseDao { - -} \ No newline at end of file + + /** + * 根据活动id,查询活动下的所有活动实况 + * + * @param actId + * @return java.util.List + * @Author zhangyong + * @Date 16:27 2020-07-22 + **/ + List selectListActLives(@Param("actId") String actId); + + /** + * 根据实况id,查询每条实况对应的多张图片 + * + * @param liveIds + * @return java.util.List + * @Author zhangyong + * @Date 17:04 2020-07-22 + **/ + List selectListActLiveImg(@Param("liveId") List liveIds); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java index 9ebc0e3fed..cb4993d0b0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSummaryDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.result.resi.ResiActSummaryResultDTO; import com.epmet.entity.ActSummaryEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSummaryDao extends BaseDao { - -} \ No newline at end of file + + /** + * 活动详情-已结束-回顾稿 + * + * @param formDto + * @return com.epmet.dto.result.resi.ResiActSummaryResultDTO + * @Author zhangyong + * @Date 15:11 2020-07-22 + **/ + ResiActSummaryResultDTO selectListSummary(ResiActContentFormDTO formDto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index facb735601..ccc5981b5a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -61,4 +61,24 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/22 18:20 **/ Integer selectCountUser(@Param("actId") String actId, @Param("status")String status); -} \ No newline at end of file + + /** + * 根据活动id,查询活动已报名的人数 + * + * @param actId + * @return Integer + * @Author zhangyong + * @Date 10:51 2020-07-22 + **/ + Integer selectActSignupNum(@Param("actId") String actId); + + /** + * 将用户与活动的状态修改为 已取消 + * + * @param userRelationDTO + * @return void + * @Author zhangyong + * @Date 14:39 2020-07-22 + **/ + void updateUserStatusToCanceld(ActUserRelationDTO userRelationDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java index 8ec5974ac9..4a22ba2ce6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java @@ -19,8 +19,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.HeartUserInfoDTO; +import com.epmet.dto.form.resi.ResiActBaseFormDTO; import com.epmet.entity.HeartUserInfoEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 用户信息 @@ -39,4 +43,27 @@ public interface HeartUserInfoDao extends BaseDao { * @Date 2020/7/21 22:48 **/ HeartUserInfoDTO selectByUserId(String userId); -} \ No newline at end of file + + + /** + * 查询用户是否是志愿者:1是志愿者,0不是志愿者 + * + * @param userId + * @return java.lang.Integer + * @Author zhangyong + * @Date 13:53 2020-07-22 + **/ + Integer selectUserVolunteerFlag(@Param("userId") String userId); + + /** + * 爱心榜 + * 显示报名参加过活动的用户/志愿者 + * 排序规则:按照爱心时长一致,按照参加次数排序 + * + * @param formDTO + * @return java.util.List + * @Author zhangyong + * @Date 18:06 2020-07-22 + **/ + List selectListLeaderboard(ResiActBaseFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java index 32c0978916..ec70e7e44b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java @@ -192,13 +192,24 @@ public interface ActInfoService extends BaseService { Result> actLookBack(ResiActBaseFormDTO formDTO); /** - * 取消活动报名 + * 活动详情 * * @param tokenDto - * @param formDTO - * @return com.epmet.commons.tools.utils.Result + * @param formDto + * @return com.epmet.commons.tools.utils.Result * @Author zhangyong - * @Date 09:29 2020-07-20 + * @Date 13:39 2020-07-21 + **/ + Result actDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto); + + /** + * 活动详情-未通过 + * + * @param tokenDto + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 **/ - Result cancelSignUp(TokenDto tokenDto, ResiActUserCancelSignUpFormDTO formDTO); + Result rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java index aa89cb830a..a0b32263c4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java @@ -19,7 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActLiveRecDTO; +import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLiveRecEntity; import java.util.List; @@ -92,4 +95,14 @@ public interface ActLiveRecService extends BaseService { * @date 2020-07-19 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * 活动详情-已结束-现场实况列表 + * + * @param actId + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result liveRecList(String actId); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java index 6cc0b1e450..863626d44f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSummaryService.java @@ -19,7 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActSummaryDTO; +import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.result.resi.ResiActSummaryResultDTO; import com.epmet.entity.ActSummaryEntity; import java.util.List; @@ -92,4 +95,14 @@ public interface ActSummaryService extends BaseService { * @date 2020-07-19 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * 活动详情-已结束-回顾稿 + * + * @param formDto + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:39 2020-07-21 + **/ + Result summaryList(ResiActContentFormDTO formDto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java index a93a4936cd..17d7d0c93b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java @@ -19,7 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; import com.epmet.entity.ActUserRelationEntity; import org.apache.ibatis.annotations.Param; @@ -123,4 +126,16 @@ public interface ActUserRelationService extends BaseService { * @Date 2020/7/21 22:48 **/ HeartUserInfoDTO getByUserId(String userId); -} \ No newline at end of file + + + /** + * 爱心榜 + * 显示报名参加过活动的用户/志愿者 + * 排序规则:按照爱心时长一致,按照参加次数排序 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 17:42 2020-07-22 + **/ + Result> leaderboard(ResiActBaseFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java index a1b23bed6b..550e13d878 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java @@ -29,23 +29,26 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.ActInfoDao; +import com.epmet.dao.ActUserRelationDao; +import com.epmet.dao.HeartUserInfoDao; +import com.epmet.dao.VolunteerInfoDao; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.form.resi.*; import com.epmet.dto.result.resi.*; import com.epmet.entity.ActInfoEntity; +import com.epmet.entity.ActUserRelationEntity; import com.epmet.redis.ActInfoRedis; import com.epmet.service.ActInfoService; import com.epmet.service.ActUserRelationService; +import com.epmet.utils.ActUserRelationStatusConstant; +import com.epmet.utils.ActUserStatusConstant; import com.epmet.utils.CaculateDistance; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 活动信息 @@ -62,6 +65,12 @@ public class ActInfoServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -189,17 +198,165 @@ public class ActInfoServiceImpl extends BaseServiceImpl actDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto) { + formDto.setUserId(tokenDto.getUserId()); + // 从活动表查询活动信息 + ResiActDetailResultDTO detailResultDTO = baseDao.selectActInfoDetail(formDto); + // 获取活动内容 + detailResultDTO.setActContent(baseDao.selectListActContent(formDto.getActId())); + // 查询用户是否是志愿者 + Integer volunteerFlag = heartUserInfoDao.selectUserVolunteerFlag(formDto.getUserId()); + detailResultDTO.setUserVolunteerFlag(volunteerFlag == 1); + + // 获取用户报名状态 + String currentUserStatus = getCurrentUserStatus(formDto.getActId(), formDto.getUserId()); + detailResultDTO.setCurrentUserStatus(currentUserStatus); + return new Result().ok(detailResultDTO); + } + + /** + * 返回当前活动下,用户状态: + * (sign_up-我要报名,canceld-取消报名,enough-已报满,end_sign_up-截止报名,in_progress-已开始; finished-已结束,canceled-已取消) + * + * @param actId 活动id + * @param userId 用户id + * @return java.lang.String + * @Author zhangyong + * @Date 2020/7/22 10:54 + **/ + private String getCurrentUserStatus(String actId, String userId) { + Date currentTime = new Date(); + ActInfoEntity actInfoEntity =baseDao.selectById(actId); + // 活动已取消 + if (ActUserStatusConstant.CANCELED.equals(actInfoEntity.getActStatus())) { + return ActUserStatusConstant.CANCELED; + } + // 活动已经结束 + if (ActUserStatusConstant.FINISHED.equals(actInfoEntity.getActStatus())) { + return ActUserStatusConstant.FINISHED; + } + + // 查询用户是否报名该活动 + QueryWrapper actUserRelationWrapper = new QueryWrapper<>(); + actUserRelationWrapper.eq("ACT_ID", actId) + .eq("USER_ID", userId) + .orderByDesc("CREATED_TIME").last("limit 1"); + ActUserRelationEntity actUserRelationEntity = actUserRelationDao.selectOne(actUserRelationWrapper); + // 查询活动已报名的人数 + Integer signUpNum = actUserRelationDao.selectActSignupNum(actId); + + if (null == actUserRelationEntity) { + return getCurrentUserStatusNotSignUp(actInfoEntity, signUpNum, currentTime); + } else { + return getCurrentUserStatusHasSignUp(actInfoEntity, actUserRelationEntity, signUpNum, currentTime); + } + } + + /** + * 用户未报名活动时,判断用户活动状态 + * + * @param actInfoEntity 当前活动 + * @param signUpNum 活动报名人数 + * @param currentTime 当前时间 + * @return java.lang.String + * @author zhangyong + * @date 2020/7/22 10:54 + */ + private String getCurrentUserStatusNotSignUp(ActInfoEntity actInfoEntity, Integer signUpNum, Date currentTime) { + if (currentTime.before(actInfoEntity.getSignUpEndTime())) { + /*报名结束前*/ + if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) || actInfoEntity.getActQuota() > signUpNum) { + // 我要报名(不限名额或者未报满的) + return ActUserStatusConstant.SIGN_UP; + } else { + // 已报满(限制名额且已经报满的) + return ActUserStatusConstant.ENOUGH; + } + } else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) { + /*报名结束,活动未开始:显示:截止报名*/ + return ActUserStatusConstant.END_SIGN_UP; + } else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) { + // 活动打卡时间段内: 显示:已开始 + return ActUserStatusConstant.IN_PROGRESS; + } else { + return ActUserStatusConstant.FINISHED; + } + } + + /** + * 用户已报名活动时,判断用户活动状态 + * + * @param actInfoEntity 当前活动 + * @param actUserRelationEntity 用户活动关系 + * @param signUpNum 活动报名人数 + * @param currentTime 当前时间 + * @return java.lang.String + * @author zhangyong + * @date 2020/7/22 17:11 + */ + private String getCurrentUserStatusHasSignUp(ActInfoEntity actInfoEntity, ActUserRelationEntity actUserRelationEntity, Integer signUpNum, Date currentTime) { + String actUserStatus = actUserRelationEntity.getStatus(); + + // 已确认过积分,直接返回 + if (ActUserRelationStatusConstant.AGREE.equals(actUserRelationEntity.getRewardFlag()) + || ActUserRelationStatusConstant.DENY.equals(actUserRelationEntity.getRewardFlag())) { + return ActUserStatusConstant.POINTS_CONFIRM; + } + + if (currentTime.after(actInfoEntity.getActEndTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) { + /*活动结束;打卡未截止*/ + // (未审核的、审核未通过、取消报名的)- 已结束 + if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus) + || ActUserRelationStatusConstant.REFUSED.equals(actUserStatus) + || ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) { + return ActUserStatusConstant.FINISHED; + } + } else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) { + /* 活动打卡时间段内 */ + + // (未审核的、审核未通过、取消报名的)- 已开始 + if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus) + || ActUserRelationStatusConstant.REFUSED.equals(actUserStatus) + || ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) { + return ActUserStatusConstant.IN_PROGRESS; + } + } else if (currentTime.before(actInfoEntity.getSignUpEndTime())) { + /* 报名截至时间前 */ + //(未审核、审核通过的)底部显示按钮 取消报名 + if (ActUserRelationStatusConstant.AUDITING.equals(actUserStatus) || ActUserRelationStatusConstant.PASSED.equals(actUserStatus)) { + return ActUserStatusConstant.CANCELD; + } + // 活动限制名额,且报名人数已满 已报满 + if (Boolean.FALSE.equals(actInfoEntity.getActQuotaCategory()) && signUpNum >= actInfoEntity.getActQuota()) { + return ActUserStatusConstant.ENOUGH; + } + // (报名审核未通过或者已经取消报名的)可再次报名-我要报名 + if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus) || ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) { + return ActUserStatusConstant.SIGN_UP; + } + } else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) { + /* 报名截止但 活动未开始 */ + // 已经取消报名的-报名截止 + if (ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) { + return ActUserStatusConstant.END_SIGN_UP; + } + // 已报名审核不通过 -报名截止 + if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)) { + return ActUserStatusConstant.END_SIGN_UP; + } + // 已报名且审核通过、未审核 -取消报名 + if (ActUserRelationStatusConstant.PASSED.equals(actUserStatus) || ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)) { + return ActUserStatusConstant.CANCELD; + } + } + return ActUserStatusConstant.FINISHED; + } + + @Override + public Result rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto) { + formDto.setUserId(tokenDto.getUserId()); + ResiActRefusedDetailResultDTO detail = baseDao.selectActRejectDetail(formDto); + return new Result().ok(detail); } @Override @@ -207,11 +364,10 @@ public class ActInfoServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -101,4 +108,40 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl liveRecList(String actId) { + // 查询实况记录 + List actLives = baseDao.selectListActLives(actId); + List userIds = new ArrayList<>(); + List liveIds = new ArrayList<>(); + for (ActLiveRecDTO actLive : actLives){ + userIds.add(actLive.getUserId()); + liveIds.add(actLive.getId()); + } + // 查询用户微信基础信息 + Result> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds); + // 根据活动实况id,查询对应实况的图片集合 + List actLiveImg = baseDao.selectListActLiveImg(liveIds); + // 数据汇总 + ResiActLiveRecResultDTO resultDto = new ResiActLiveRecResultDTO(); + List dataContainer = new ArrayList<>(); + for (int k = 0; k < actLives.size(); k++) { + Map map = new HashMap<>(); + map.put("nickname", userWxInfos.getData().get(k).getNickname()); + map.put("headImg", userWxInfos.getData().get(k).getHeadImgUrl()); + map.put("desc", actLives.get(k).getDesc()); + map.put("createdTime", actLives.get(k).getCreatedTime()); + // 查询打卡对应图片 + List imgUrlList = new ArrayList<>(); + for (ActLivePicDTO urlDto : actLiveImg) { + if (actLives.get(k).getId().equals(urlDto.getLiveId())) { + imgUrlList.add(urlDto.getPicUrl()); + } + } + map.put("images", imgUrlList); + dataContainer.add(map); + } + return new Result().ok(resultDto); + } + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java index 4bb9ad328f..d3f9087afc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSummaryServiceImpl.java @@ -20,11 +20,15 @@ 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.commons.tools.utils.Result; import com.epmet.dao.ActSummaryDao; import com.epmet.dto.ActSummaryDTO; +import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.result.resi.ResiActSummaryResultDTO; import com.epmet.entity.ActSummaryEntity; import com.epmet.redis.ActSummaryRedis; import com.epmet.service.ActSummaryService; @@ -101,4 +105,11 @@ public class ActSummaryServiceImpl extends BaseServiceImpl summaryList(ResiActContentFormDTO formDto) { + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); + return new Result().ok(baseDao.selectListSummary(formDto)); + } + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java index 06cb2f96ed..cfea34e14e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java @@ -21,13 +21,19 @@ 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.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.ActUserRelationDao; +import com.epmet.dto.ActUserLogDTO; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; import com.epmet.entity.ActUserRelationEntity; import com.epmet.redis.ActUserRelationRedis; +import com.epmet.service.ActUserLogService; import com.epmet.service.ActUserRelationService; +import com.epmet.utils.ActUserRelationStatusConstant; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -48,6 +54,8 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl page(Map params) { @@ -140,5 +148,24 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl page(Map params) { @@ -113,4 +122,32 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl> leaderboard(ResiActBaseFormDTO formDTO) { + // 获取排好序的 排行榜 + List leaderboardList = baseDao.selectListLeaderboard(formDTO); + // 根据用户ID获取微信昵称、头像 + List userIds = new ArrayList<>(); + for (HeartUserInfoDTO list : leaderboardList){ + userIds.add(list.getUserId()); + } + // 查询用户微信基础信息 + Result> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds); + + List resultDTOS = new ArrayList<>(); + for (HeartUserInfoDTO list : leaderboardList){ + ResiLeaderboardResultDTO dto = new ResiLeaderboardResultDTO(); + dto.setKindnessTime(list.getKindnessTime()); + dto.setVolunteerFlag(list.getVolunteerFlag()); + dto.setParticipationNum(list.getParticipationNum()); + List wxInfo = userWxInfos.getData(); + for (UserBaseInfoResultDTO wx : wxInfo){ + if (list.getUserId().equals(wx.getUserId())){ + dto.setHeadImg(wx.getHeadImgUrl()); + dto.setNickname(wx.getNickname()); + } + } + } + return new Result>().ok(resultDTOS); + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java new file mode 100644 index 0000000000..dcde4657a7 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java @@ -0,0 +1,38 @@ +package com.epmet.utils; + +/** + * @Description 用户活动关系表当前状态 + * @Auther: zhangyong + * @Date: 2020-07-21 17:36 + */ +public interface ActUserRelationStatusConstant { + /** + * 已报名/待审核 + */ + String AUDITING="auditing"; + + /** + * 审核通过 + */ + String PASSED="passed"; + + /** + * 审核不通过 + */ + String REFUSED = "refused"; + + /** + * 取消报名 + */ + String CANCELD = "canceld"; + + /** + * 给积分 + */ + String AGREE = "agree"; + + /** + * 不给积分 + */ + String DENY = "deny"; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java new file mode 100644 index 0000000000..7d2334a9b0 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java @@ -0,0 +1,49 @@ +package com.epmet.utils; + +/** + * 用户当前状态(sign_up-我要报名,canceld-取消报名,enough-已报满,end_sign_up-截止报名,in_progress-已开始; finished-已结束,canceled-已取消,points_confirm-已确认积分) + * @Auther: zhangyong + * @Date: 2020-07-21 17:36 + */ +public interface ActUserStatusConstant { + + /** + * 我要报名 + */ + String SIGN_UP = "sign_up"; + + /** + * 取消报名 + */ + String CANCELD = "canceld"; + + /** + * 已报满 + */ + String ENOUGH = "enough"; + + /** + * 截止报名 + */ + String END_SIGN_UP = "end_sign_up"; + + /** + * 已开始 + */ + String IN_PROGRESS = "in_progress"; + + /** + * 已结束 + */ + String FINISHED = "finished"; + + /** + * 已取消 + */ + String CANCELED = "canceled"; + + /** + * 已确认积分 + */ + String POINTS_CONFIRM = "points_confirm"; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java new file mode 100644 index 0000000000..2b56bdc176 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java @@ -0,0 +1,90 @@ +package com.epmet.utils; + +import com.alibaba.nacos.client.utils.StringUtils; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.scan.param.ImgScanParamDTO; +import com.epmet.commons.tools.scan.param.ImgTaskDTO; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; +import org.springframework.beans.factory.annotation.Value; +import lombok.extern.slf4j.Slf4j; + +import java.util.List; +import java.util.UUID; + +/** + * 文字、图片合法性校验 + * + * @author zhangyong + * @date 2020-07-15 14:26 + */ +@Slf4j +public class ValidityVerification { + + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + @Value("${openapi.scan.method.imgSyncScan}") + private String imgSyncScanMethod; + + /** + * 文本校验 + * @param context 被校验的文本,,不能超过10000 + * @param businessEnum 业务枚举,定义校验失败后,输出的日志信息 + * @return void + * @auther zhangyong + * @Date 14:42 2020-07-15 + **/ + public void textScanVerification(String context, String businessEnum){ + if (StringUtils.isNotBlank(context)) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(context); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + // 业务枚举:例如:评论话题失败,评论内容为:%s" + log.error(String.format(businessEnum, context)); + throw new RenException(EpmetErrorCode.TEXT_SCAN_FAILED.getCode()); + } + } + } + } + + /** + * 图片列表校验 + * @param imgList 被校验的图片列表 + * @return void + * @auther zhangyong + * @Date 14:42 2020-07-15 + **/ + public void imgScanVerification(List imgList){ + if (NumConstant.ZERO != imgList.size()){ + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + imgList.forEach(url -> { + ImgTaskDTO task = new ImgTaskDTO(); + task.setDataId(UUID.randomUUID().toString().replace("-", "")); + task.setUrl(url); + imgScanParamDTO.getTasks().add(task); + }); + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()){ + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!imgScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode()); + } + } + } + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 3f9eb4a072..4b50ae3bd4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -375,4 +375,73 @@ ai.DEL_FLAG = '0' AND ai.id =#{actId} + + + + + + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml index 6ebfea5ed7..6e0281baf5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml @@ -19,5 +19,33 @@ + + - \ No newline at end of file + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml index f71666b3c1..6ff1b956d0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSummaryDao.xml @@ -17,5 +17,18 @@ - - \ No newline at end of file + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index f7531ff65a..0cd324f25c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -61,4 +61,26 @@ AND aur.`STATUS` =#{status} AND aur.ACT_ID = #{actId} - \ No newline at end of file + + + + + + UPDATE act_user_relation + SET + STATUS = #{status}, + CANCEL_TIME = NOW(), + CANCEL_REASON = #{cancelReason} + WHERE + DEL_FLAG = '0' + AND ACT_ID = #{actId} + AND USER_ID = #{userId} + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml index 341370c3f7..1c4fdba03f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml @@ -29,4 +29,30 @@ hui.DEL_FLAG = '0' AND hui.USER_ID =#{userId} - \ No newline at end of file + + + + + + + From 05cac1ea4f065bd4f6121c74877cd2a2edbe1f8b Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 23 Jul 2020 09:58:26 +0800 Subject: [PATCH 033/157] =?UTF-8?q?=E7=A7=AF=E5=88=86=E8=A7=84=E5=88=99?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/StrConstant.java | 5 + .../tools/enums/CommonOperateTypeEnum.java | 42 ++++ .../main/java/com/epmet/dto/PointRuleDTO.java | 126 ----------- .../epmet/dto/form/PointDetailFormDTO.java | 21 ++ .../com/epmet/dto/form/PointRuleFormDTO.java | 71 +++++++ .../epmet/dto/form/PointRuleListFormDTO.java | 23 ++ .../dto/result/CustomerFunctionResultDTO.java | 18 ++ .../dto/result/PointDetailResultDTO.java | 24 +++ .../epmet/dto/result/PointRuleResultDTO.java | 23 ++ .../epmet-point/epmet-point-server/pom.xml | 12 ++ .../com/epmet/common/enu/PointUnitEnum.java | 42 ++++ .../com/epmet/common/enu/SysResponseEnum.java | 43 ++++ .../epmet/controller/BackDoorController.java | 40 ++++ .../epmet/controller/PointRuleController.java | 100 +++++++++ .../main/java/com/epmet/dao/PointRuleDao.java | 23 +- ...rateLogDao.java => RuleOperateLogDao.java} | 4 +- .../com/epmet/entity/PointRuleEntity.java | 32 ++- ...gEntity.java => RuleOperateLogEntity.java} | 14 +- .../com/epmet/service/PointRuleService.java | 76 ++----- .../epmet/service/SysOperateLogService.java | 4 +- .../service/impl/PointRuleServiceImpl.java | 199 ++++++++++++------ .../impl/SysOperateLogServiceImpl.java | 22 +- .../resources/db/migration/epmet_point.sql | 52 ++--- .../main/resources/mapper/PointRuleDao.xml | 19 +- ...perateLogDao.xml => RuleOperateLogDao.xml} | 4 +- .../feign/OperCustomizeOpenFeignClient.java | 10 +- .../OperCustomizeOpenFeignClientFallback.java | 18 +- .../CustomerFunctionController.java | 6 +- .../service/CustomerFunctionService.java | 2 +- .../impl/CustomerFunctionServiceImpl.java | 41 +++- 30 files changed, 788 insertions(+), 328 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java delete mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java create mode 100644 epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java rename epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/{SysOperateLogDao.java => RuleOperateLogDao.java} (88%) rename epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/{SysOperateLogEntity.java => RuleOperateLogEntity.java} (88%) rename epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/{SysOperateLogDao.xml => RuleOperateLogDao.xml} (87%) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index b4a81ce53a..a7ae559a01 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -48,4 +48,9 @@ public interface StrConstant { * 中文顿号 */ String COMMA_ZH = "、"; + + /** + * 反斜杠 + */ + String SEPARATOR = "/"; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java new file mode 100644 index 0000000000..1dc0b571c5 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CommonOperateTypeEnum.java @@ -0,0 +1,42 @@ +package com.epmet.commons.tools.enums; + +/** + * 通用操作类型 枚举类 + * dev|test|prod + * + * @author jianjun liu + * @date 2020-07-03 11:14 + **/ +public enum CommonOperateTypeEnum { + ADD("add", "添加"), + EDIT("edit", "编辑"), + DEL("del", "删除"), + ; + + private String code; + private String desc; + + + CommonOperateTypeEnum(String code, String name) { + this.code = code; + this.desc = name; + } + + public static CommonOperateTypeEnum getEnum(String code) { + CommonOperateTypeEnum[] values = CommonOperateTypeEnum.values(); + for (CommonOperateTypeEnum value : values) { + if (code != null && value.getCode().equals(code)) { + return value; + } + } + return null; + } + + public String getCode() { + return code; + } + + public String getDesc() { + return desc; + } +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java deleted file mode 100644 index 25251dd36a..0000000000 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/PointRuleDTO.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Copyright 2018 人人开源 https://www.renren.io - *

- * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - *

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

- * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.epmet.dto; - -import java.io.Serializable; -import java.util.Date; -import lombok.Data; - - -/** - * 积分规则表 - * - * @author generator generator@elink-cn.com - * @since v1.0.0 2020-07-20 - */ -@Data -public class PointRuleDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 主键 - */ - private String id; - - /** - * 客户ID - */ - private String customerId; - - /** - * 规则名称 与事件名称保持一致即可 - */ - private String ruleName; - - /** - * 规则说明 事件说明 - */ - private String ruleDesc; - - /** - * 事件CODE 来自事件表 - */ - private String eventCode; - - /** - * 事件名称 来自事件表 - */ - private String eventName; - - /** - * 操作类型 加积分:add;减积分:subtract - */ - private String operateType; - - /** - * 积分上限 - */ - private Integer upLimit; - - /** - * 积分上限描述 - */ - private String upLimitDesc; - - /** - * 获得积分值 - */ - private Integer pointNum; - - /** - * 获得积分单位 次:time;分钟:minute;小时:hour - */ - private String pointUnit; - - /** - * 是否启用 0-否,1-是 - */ - private String enabledFlag; - - /** - * 删除标识 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/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java new file mode 100644 index 0000000000..d8a7fee9cb --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointDetailFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** +* desc:积分规则Id详情获取 规则列表 + * @author jianjun liu + * @date 2020-07-22 15:28 + **/ +@Data +public class PointDetailFormDTO implements Serializable { + private static final long serialVersionUID = 7587939716742608164L; + /** + * 积分规则Id + */ + @NotBlank(message = "积分规则Id不能为空") + private String ruleId; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java new file mode 100644 index 0000000000..fca065c9d6 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java @@ -0,0 +1,71 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * desc:积分规则保存/修改 规则列表 + * + * @author jianjun liu + * @date 2020-07-22 15:28 + **/ +@Data +public class PointRuleFormDTO implements Serializable { + private static final long serialVersionUID = -3228252683629912008L; + /** + * 积分规则Id + */ + @NotBlank(message = "积分规则Id不能为空", groups = UpdateGroup.class) + private String ruleId; + /** + * 积分 + */ + @NotBlank(message = "积分不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String point; + + /** + * 是否开启 + */ + @NotBlank(message = "是否开启不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String enabledFlag; + /** + * 上限开启 + */ + @NotBlank(message = "积分上限不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String upLimit; + + /** + * 积分规则Id + */ + @NotBlank(message = "客户Id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String customerId; + + //=======系统添加时的属性====== + /** + * 规则说明 事件说明 + */ + @NotBlank(message = "规则描述不能为空", groups = AddGroup.class) + private String ruleDesc; + + /** + * 事件CODE 来自事件表 + */ + @NotBlank(message = "事件code不能为空", groups = AddGroup.class) + private String eventCode; + + /** + * 操作类型 加积分:add;减积分:subtract + */ + @NotBlank(message = "操作类型不能为空", groups = AddGroup.class) + private String operateType; + /** + * 获得积分单位 次:time;分钟:minute;小时:hour + */ + @NotBlank(message = "积分单位不能为空", groups = AddGroup.class) + private String pointUnit; + +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java new file mode 100644 index 0000000000..93566a19b3 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleListFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** +* desc:根据功能Id获取 规则列表 + * @author jianjun liu + * @date 2020-07-22 15:28 + **/ +@Data +public class PointRuleListFormDTO implements Serializable { + private static final long serialVersionUID = -1918653281170340608L; + /** + * 功能Id + */ + @NotBlank(message = "功能Id不能为空") + private String functionId; + @NotBlank(message = "客户Id不能为空") + private String customerId; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java new file mode 100644 index 0000000000..817b94d7c1 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/CustomerFunctionResultDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:积分规则-获取客户功能列表 result + * @author jianjun liu + * @date 2020-07-22 14:43 + **/ +@Data +public class CustomerFunctionResultDTO implements Serializable { + private static final long serialVersionUID = -3761765064811136295L; + + private String functionId; + private String functionName; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java new file mode 100644 index 0000000000..8ed856dc91 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointDetailResultDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:积分规则-详情 result + * @author jianjun liu + * @date 2020-07-22 14:43 + **/ +@Data +public class PointDetailResultDTO implements Serializable { + + private static final long serialVersionUID = 2426172750860788081L; + private String ruleId; + private String ruleName; + private String ruleDesc; + private Integer point; + private String pointUnit; + private String upLimit; + private String enabledFlag; + private String upLimitDesc; +} diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java new file mode 100644 index 0000000000..bf8e546806 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/result/PointRuleResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:积分规则-列表 result + * @author jianjun liu + * @date 2020-07-22 14:43 + **/ +@Data +public class PointRuleResultDTO implements Serializable { + + private static final long serialVersionUID = -2327977101138032573L; + private String ruleId; + private String ruleName; + private String ruleDesc; + /** + * 拼接好的 积分值/单位 + */ + private String pointValue; +} diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index 49ccab5b90..a6eef46a98 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -69,6 +69,18 @@ 2.0.0 compile + + com.epmet + oper-customize-client + 2.0.0 + compile + + + com.epmet + epmet-user-client + 2.0.0 + compile + diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java new file mode 100644 index 0000000000..ab1d97453c --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java @@ -0,0 +1,42 @@ +package com.epmet.common.enu; + +/** + * 系积分系统-积分单位枚举类 + * dev|test|prod + * + * @author jianjun liu + * @date 2020-07-03 11:14 + **/ +public enum PointUnitEnum { + TIME("time", "次"), + MINUTE("minute", "分种"), + HOUR("hour", "小时"), + ; + + private String code; + private String name; + + + PointUnitEnum(String code, String name) { + this.code = code; + this.name = name; + } + + public static PointUnitEnum getEnum(String code) { + PointUnitEnum[] values = PointUnitEnum.values(); + for (PointUnitEnum value : values) { + if (code != null && value.getCode().equals(code)) { + return value; + } + } + return null; + } + + public String getCode() { + return code; + } + + public String getName() { + return name; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java new file mode 100644 index 0000000000..e7ff400906 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java @@ -0,0 +1,43 @@ +package com.epmet.common.enu; + +/** + * @author jianjun liu + * @date 2020-06-04 21:39 + **/ +public enum SysResponseEnum { + /** + * + * 业务代码枚举类 + * + * 编码样式:【CCCBBOOXX】 + * 编码示例说明: + * CCC 中心编码&业务系统 (112(与端口号一致)-积分系统服务) + * BB 业务类型(00-默认 ) + * OO 操作类型(00-默认) + * XX 具体编码(00-成功,01-失败,02-参数错误,10-异常 99-系统错误) + * + */ + /*通用枚举 */ + EXCEPTION(10001,"系统异常"), + + + /*积分规则 业务 01*/ + THIRD_SERVICE_ERROR(112010001,"调用第三方接口异常"), + POINT_RULE_IS_NOT_EXIST(112010002,"积分规则不存在"), + ; + + private Integer code; + private String msg; + SysResponseEnum(Integer code, String msg){ + this.code = code; + this.msg = msg; + } + + public Integer getCode() { + return code; + } + + public String getMsg() { + return msg; + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java new file mode 100644 index 0000000000..9d2b01d291 --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java @@ -0,0 +1,40 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.dto.form.PointRuleFormDTO; +import com.epmet.service.PointRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author jianjun liu + * @date 2020-06-04 20:39 + **/ +@RestController +@RequestMapping("opback") +public class BackDoorController { + @Autowired + private PointRuleService pointRuleService; + + /** + * desc:添加规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "sysadd") + public Result add(@RequestBody PointRuleFormDTO formDTO) { + TokenDto tokenDTO = new TokenDto(); + tokenDTO.setUserId("default"); + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + pointRuleService.add(tokenDTO, formDTO); + return new Result().ok(true); + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java new file mode 100644 index 0000000000..a0c7f479dd --- /dev/null +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/PointRuleController.java @@ -0,0 +1,100 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.dto.form.PointDetailFormDTO; +import com.epmet.dto.form.PointRuleFormDTO; +import com.epmet.dto.form.PointRuleListFormDTO; +import com.epmet.dto.result.CustomerFunctionResultDTO; +import com.epmet.dto.result.PointDetailResultDTO; +import com.epmet.dto.result.PointRuleResultDTO; +import com.epmet.service.PointRuleService; +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; + +/** + * 积分规则controller + * + * @author jianjun liu + * @date 2020-07-22 14:39 + **/ +@RestController +@RequestMapping("rule") +public class PointRuleController { + @Autowired + private PointRuleService pointRuleService; + + /** + * desc:积分规则-获取客户有积分规则的功能列表 + * + * @param tokenDTO + * @return + */ + @PostMapping(value = "functionlist") + public Result> getFunctionList(@LoginUser TokenDto tokenDTO) { + return new Result>().ok(pointRuleService.getFunctionList(tokenDTO.getCustomerId())); + } + + /** + * desc:根据功能id获取积分规则 + * + * @param tokenDTO + * @param formDTO + * @return + */ + @PostMapping(value = "list") + public Result> list(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleListFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(pointRuleService.list(formDTO)); + } + + /** + * desc:根据规则id获取积分规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "detail") + public Result detail(@RequestBody PointDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result().ok(pointRuleService.detail(formDTO)); + } + + /** + * desc:根据功能id获取积分规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "update") + public Result update(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, UpdateGroup.class); + pointRuleService.update(tokenDTO,formDTO); + return new Result().ok(true); + } + + /** + * desc:添加规则 + * + * @param formDTO + * @return + */ + @PostMapping(value = "add") + public Result add(@LoginUser TokenDto tokenDTO, @RequestBody PointRuleFormDTO formDTO) { + formDTO.setCustomerId(tokenDTO.getCustomerId()); + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + pointRuleService.add(tokenDTO,formDTO); + return new Result().ok(true); + } +} diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java index 3ab8e48b42..2c8f5a214a 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/PointRuleDao.java @@ -18,8 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.PointRuleListFormDTO; import com.epmet.entity.PointRuleEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 积分规则表 @@ -29,5 +33,22 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface PointRuleDao extends BaseDao { - + + /** + * desc:获取该客户下有规则的功能Id + * + * @param customerId + * @return + */ + List selectFunctionIds(@Param("customerId") String customerId); + + /** + * desc:获取该客户下有规则的功能Id + * + * @param formDTO + * @return + */ + List selectListByFunctionId(PointRuleListFormDTO formDTO); + + int updateByCustomerId(PointRuleEntity entity); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java similarity index 88% rename from epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java rename to epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java index 2721c88716..a959af0219 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/SysOperateLogDao.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/dao/RuleOperateLogDao.java @@ -18,7 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.entity.SysOperateLogEntity; +import com.epmet.entity.RuleOperateLogEntity; import org.apache.ibatis.annotations.Mapper; /** @@ -28,6 +28,6 @@ import org.apache.ibatis.annotations.Mapper; * @since v1.0.0 2020-07-20 */ @Mapper -public interface SysOperateLogDao extends BaseDao { +public interface RuleOperateLogDao extends BaseDao { } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java index affd55595e..c2132a4292 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java @@ -18,12 +18,11 @@ 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; +import java.util.Objects; /** * 积分规则表 @@ -58,11 +57,6 @@ public class PointRuleEntity extends BaseEpmetEntity { */ private String eventCode; - /** - * 事件名称 来自事件表 - */ - private String eventName; - /** * 操作类型 加积分:add;减积分:subtract */ @@ -81,7 +75,7 @@ public class PointRuleEntity extends BaseEpmetEntity { /** * 获得积分值 */ - private Integer pointNum; + private Integer point; /** * 获得积分单位 次:time;分钟:minute;小时:hour @@ -93,4 +87,26 @@ public class PointRuleEntity extends BaseEpmetEntity { */ private String enabledFlag; + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + if (!super.equals(o)) return false; + PointRuleEntity entity = (PointRuleEntity) o; + return customerId.equals(entity.customerId) && + ruleName.equals(entity.ruleName) && + ruleDesc.equals(entity.ruleDesc) && + eventCode.equals(entity.eventCode) && + operateType.equals(entity.operateType) && + upLimit.equals(entity.upLimit) && + upLimitDesc.equals(entity.upLimitDesc) && + point.equals(entity.point) && + pointUnit.equals(entity.pointUnit) && + enabledFlag.equals(entity.enabledFlag); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode(), customerId, ruleName, ruleDesc, eventCode, operateType, upLimit, upLimitDesc, point, pointUnit, enabledFlag); + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java similarity index 88% rename from epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java rename to epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java index 4068bba53b..573a9f52da 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/SysOperateLogEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 积分系统操作记录表 * @@ -34,7 +31,7 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper=false) @TableName("sys_operate_log") -public class SysOperateLogEntity extends BaseEpmetEntity { +public class RuleOperateLogEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; @@ -44,14 +41,9 @@ public class SysOperateLogEntity extends BaseEpmetEntity { private String customerId; /** - * 操作对象ID - */ - private String objectId; - - /** - * 对象类型 规则:rule + * 规则ID */ - private String objectType; + private String ruleId; /** * 操作类型 新建:add,编辑:edit,删除:del; diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java index 3c84c43cad..fa53b5be05 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/PointRuleService.java @@ -18,12 +18,16 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; -import com.epmet.dto.PointRuleDTO; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.PointDetailFormDTO; +import com.epmet.dto.form.PointRuleFormDTO; +import com.epmet.dto.form.PointRuleListFormDTO; +import com.epmet.dto.result.CustomerFunctionResultDTO; +import com.epmet.dto.result.PointDetailResultDTO; +import com.epmet.dto.result.PointRuleResultDTO; import com.epmet.entity.PointRuleEntity; import java.util.List; -import java.util.Map; /** * 积分规则表 @@ -34,62 +38,22 @@ import java.util.Map; public interface PointRuleService extends BaseService { /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-07-20 + * desc:根据用户id获取积分规则-功能列表 + * @param customerId + * @return */ - PageData page(Map params); + List getFunctionList(String customerId); - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-20 - */ - List list(Map params); + /** + * desc:根据客户Id 及功能Id获取规则列表 + * @param formDTO + * @return + */ + List list(PointRuleListFormDTO formDTO); - /** - * 单条查询 - * - * @param id - * @return PointRuleDTO - * @author generator - * @date 2020-07-20 - */ - PointRuleDTO get(String id); + PointDetailResultDTO detail(PointDetailFormDTO formDTO); - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-20 - */ - void save(PointRuleDTO dto); + void update(TokenDto tokenDTO, PointRuleFormDTO formDTO); - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-20 - */ - void update(PointRuleDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-07-20 - */ - void delete(String[] ids); + void add(TokenDto tokenDTO, PointRuleFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java index 962df38027..46e78037ec 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/SysOperateLogService.java @@ -20,7 +20,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.SysOperateLogDTO; -import com.epmet.entity.SysOperateLogEntity; +import com.epmet.entity.RuleOperateLogEntity; import java.util.List; import java.util.Map; @@ -31,7 +31,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-07-20 */ -public interface SysOperateLogService extends BaseService { +public interface SysOperateLogService extends BaseService { /** * 默认分页 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index c64ccfdc35..8e40169645 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java @@ -17,23 +17,40 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import com.alibaba.fastjson.JSON; +import com.epmet.common.enu.PointUnitEnum; +import com.epmet.common.enu.SysResponseEnum; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.enums.CommonOperateTypeEnum; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; import com.epmet.dao.PointRuleDao; -import com.epmet.dto.PointRuleDTO; +import com.epmet.dao.RuleOperateLogDao; +import com.epmet.dto.CustomerStaffDTO; +import com.epmet.dto.form.CustomerFunctionListFormDTO; +import com.epmet.dto.form.PointDetailFormDTO; +import com.epmet.dto.form.PointRuleFormDTO; +import com.epmet.dto.form.PointRuleListFormDTO; +import com.epmet.dto.result.CustomerFunctionResultDTO; +import com.epmet.dto.result.DefaultFunctionListResultDTO; +import com.epmet.dto.result.PointDetailResultDTO; +import com.epmet.dto.result.PointRuleResultDTO; import com.epmet.entity.PointRuleEntity; +import com.epmet.entity.RuleOperateLogEntity; +import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.PointRuleService; -import org.apache.commons.lang3.StringUtils; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; -import java.util.Arrays; +import java.util.ArrayList; import java.util.List; -import java.util.Map; +import java.util.stream.Collectors; /** * 积分规则表 @@ -41,60 +58,116 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-07-20 */ +@Slf4j @Service public class PointRuleServiceImpl extends BaseServiceImpl implements PointRuleService { - - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, PointRuleDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, PointRuleDTO.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 PointRuleDTO get(String id) { - PointRuleEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, PointRuleDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(PointRuleDTO dto) { - PointRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointRuleEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(PointRuleDTO dto) { - PointRuleEntity entity = ConvertUtils.sourceToTarget(dto, PointRuleEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - + @Autowired + private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; + @Autowired + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private RuleOperateLogDao ruleOperateLogDao; + + @Override + public List getFunctionList(String customerId) { + List result = new ArrayList<>(); + CustomerFunctionListFormDTO formDTO = new CustomerFunctionListFormDTO(); + formDTO.setCustomerId(customerId); + Result> openedFunctionResult = operCustomizeOpenFeignClient.getOpenedFunctionList(formDTO); + if (!openedFunctionResult.success()) { + log.warn("getFunctionList getOpenedFunctionList fail,result:{}", JSON.toJSONString(openedFunctionResult)); + throw new RenException(SysResponseEnum.THIRD_SERVICE_ERROR.getCode(), SysResponseEnum.THIRD_SERVICE_ERROR.getMsg()); + } + List resultData = openedFunctionResult.getData(); + if (CollectionUtils.isEmpty(resultData)) { + log.warn("getFunctionList customerId:{} have opened any function", customerId); + return result; + } + List functionIds = baseDao.selectFunctionIds(customerId); + if (CollectionUtils.isEmpty(functionIds)) { + log.warn("getFunctionList customerId:{} have any pointRules", customerId); + return result; + } + return resultData.stream().filter(function -> functionIds.contains(function.getFunctionId())) + .map(fun -> ConvertUtils.sourceToTarget(fun, CustomerFunctionResultDTO.class)) + .collect(Collectors.toList()); + } + + @Override + public List list(PointRuleListFormDTO formDTO) { + List result = new ArrayList<>(); + List list = baseDao.selectListByFunctionId(formDTO); + if (CollectionUtils.isEmpty(list)) { + log.warn("list functionId:{} return empty", formDTO.getFunctionId()); + return result; + } + result = list.stream().map(pointRuleEntity -> { + PointRuleResultDTO resultDTO = new PointRuleResultDTO(); + resultDTO.setRuleId(pointRuleEntity.getId()); + resultDTO.setRuleName(pointRuleEntity.getRuleName()); + resultDTO.setRuleDesc(pointRuleEntity.getRuleDesc()); + PointUnitEnum pointUnitEnum = PointUnitEnum.getEnum(pointRuleEntity.getPointUnit()); + if (pointRuleEntity == null || pointRuleEntity.getPoint() == null) { + log.error("list ruleId:{} have not pointUnit or pointNum,pointRule:{}", JSON.toJSONString(pointRuleEntity)); + return null; + } + resultDTO.setPointValue(pointRuleEntity.getPoint().toString().concat(StrConstant.SEPARATOR).concat(pointUnitEnum.getCode())); + return resultDTO; + }).filter(fun -> fun != null).collect(Collectors.toList()); + return result; + } + + @Override + public PointDetailResultDTO detail(PointDetailFormDTO formDTO) { + PointRuleEntity pointRuleEntity = baseDao.selectById(formDTO.getRuleId()); + if (pointRuleEntity == null) { + throw new RenException(SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getCode(), SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getMsg()); + } + return ConvertUtils.sourceToTarget(pointRuleEntity, PointDetailResultDTO.class); + } + + @Override + public void update(TokenDto tokenDTO, PointRuleFormDTO formDTO) { + PointRuleEntity entityDB = baseDao.selectById(formDTO.getRuleId()); + //数据库不存在或者客户Id不相等 则抛出异常 + if (entityDB == null || !entityDB.getCustomerId().equals(formDTO.getCustomerId())) { + throw new RenException(SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getCode(), SysResponseEnum.POINT_RULE_IS_NOT_EXIST.getMsg()); + } + PointRuleEntity entityNew = ConvertUtils.sourceToTarget(formDTO, PointRuleEntity.class); + if (entityDB.equals(entityNew)) { + log.warn("update ignore tow entity is same"); + return; + } + insertOperateRecord(tokenDTO, formDTO, entityDB, CommonOperateTypeEnum.EDIT.getCode()); + baseDao.updateByCustomerId(entityNew); + } + + @Override + public void add(TokenDto tokenDTO, PointRuleFormDTO formDTO) { + PointRuleEntity entity = ConvertUtils.sourceToTarget(formDTO, PointRuleEntity.class); + if (tokenDTO == null){ + insertOperateRecord(tokenDTO, formDTO, null, CommonOperateTypeEnum.ADD.getCode()); + } + baseDao.insert(entity); + } + + private void insertOperateRecord(TokenDto tokenDTO, PointRuleFormDTO formDTO, PointRuleEntity entityDB, String opType) { + CustomerStaffDTO userInfo = getCustomerStaff(tokenDTO.getUserId()); + RuleOperateLogEntity record = new RuleOperateLogEntity(); + record.setCustomerId(formDTO.getCustomerId()); + record.setRuleId(entityDB.getId()); + record.setOpType(opType); + record.setOpUser(userInfo.getRealName()); + record.setBefordData(JSON.toJSONString(entityDB)); + record.setAfterData(JSON.toJSONString(formDTO)); + ruleOperateLogDao.insert(record); + } + + private CustomerStaffDTO getCustomerStaff(String userId) { + Result resultStaff = epmetUserOpenFeignClient.getCustomerStaff(userId); + if (!resultStaff.success() || null == resultStaff.getData()) { + throw new RenException(SysResponseEnum.THIRD_SERVICE_ERROR.getMsg()); + } + return resultStaff.getData(); + } } \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java index 59604433bf..b309d3f7a0 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/SysOperateLogServiceImpl.java @@ -20,12 +20,12 @@ 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.commons.tools.constant.FieldConstant; -import com.epmet.dao.SysOperateLogDao; +import com.epmet.dao.RuleOperateLogDao; import com.epmet.dto.SysOperateLogDTO; -import com.epmet.entity.SysOperateLogEntity; +import com.epmet.entity.RuleOperateLogEntity; import com.epmet.service.SysOperateLogService; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -42,11 +42,11 @@ import java.util.Map; * @since v1.0.0 2020-07-20 */ @Service -public class SysOperateLogServiceImpl extends BaseServiceImpl implements SysOperateLogService { +public class SysOperateLogServiceImpl extends BaseServiceImpl implements SysOperateLogService { @Override public PageData page(Map params) { - IPage page = baseDao.selectPage( + IPage page = baseDao.selectPage( getPage(params, FieldConstant.CREATED_TIME, false), getWrapper(params) ); @@ -55,15 +55,15 @@ public class SysOperateLogServiceImpl extends BaseServiceImpl list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + List entityList = baseDao.selectList(getWrapper(params)); return ConvertUtils.sourceToTarget(entityList, SysOperateLogDTO.class); } - private QueryWrapper getWrapper(Map params){ + private QueryWrapper getWrapper(Map params){ String id = (String)params.get(FieldConstant.ID_HUMP); - QueryWrapper wrapper = new QueryWrapper<>(); + QueryWrapper wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); return wrapper; @@ -71,21 +71,21 @@ public class SysOperateLogServiceImpl extends BaseServiceImpl - - + @@ -23,6 +22,18 @@ - - + + + + UPDATE point_rule + SET + POINT = #{point,jdbcType=INTEGER}, + ENABLED_FLAG = #{enabledFlag,jdbcType=VARCHAR}, + UP_LIMIT = #{upLimit,jdbcType=INTEGER} + WHERE id = #{id,jdbcType=VARCHAR} and CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} + \ No newline at end of file diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml similarity index 87% rename from epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml rename to epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml index 0fe2621044..e20a977e8f 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/SysOperateLogDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml @@ -1,9 +1,9 @@ - + - + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index 9e81857ef7..8707b1cf55 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -1,9 +1,13 @@ package com.epmet.feign; -import org.springframework.cloud.openfeign.FeignClient; - import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.CustomerFunctionListFormDTO; +import com.epmet.dto.result.DefaultFunctionListResultDTO; import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; + +import java.util.List; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -13,5 +17,5 @@ import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback; */ @FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeOpenFeignClientFallback.class) public interface OperCustomizeOpenFeignClient { - + Result> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index 5c2271f1b3..d8e2fa7249 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -1,7 +1,16 @@ 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.CustomerFunctionListFormDTO; +import com.epmet.dto.result.DefaultFunctionListResultDTO; import com.epmet.feign.OperCustomizeOpenFeignClient; +import org.springframework.http.MediaType; import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -12,10 +21,13 @@ import org.springframework.stereotype.Component; @Component public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFeignClient { /** - * 从缓存中查询已登录用户的基本信息以及角色等相关信息 + * 获取客户已开通的功能列表 * * @return */ - //@PostMapping(value = "/epmetuser/user/loginuserdetails", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) - //Result getLoginUserDetails(@RequestBody LoginUserDetailsFormDTO dto); + @Override + @PostMapping(value = "/oper/customize/customerfunction/getOpenedFunctionList", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + public Result> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO){ + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getOpenedFunctionList", formDTO); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java index 7c2bbda050..71e165696b 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java @@ -133,8 +133,8 @@ public class CustomerFunctionController { * @param formDTO * @return */ - @PostMapping("customeropenedfunction") - public Result> customerOpenedFunction(@RequestBody CustomerFunctionListFormDTO formDTO) { - return new Result>().ok(customerFunctionService.customerOpenedFunction(formDTO)); + @PostMapping("openedfunctionlist") + public Result> getOpenedFunctionList(@RequestBody CustomerFunctionListFormDTO formDTO) { + return new Result>().ok(customerFunctionService.getOpenedFunctionList(formDTO)); } } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java index 17fcb2be66..70b5c55404 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFunctionService.java @@ -118,5 +118,5 @@ public interface CustomerFunctionService extends BaseService customerOpenedFunction(CustomerFunctionListFormDTO formDTO); + List getOpenedFunctionList(CustomerFunctionListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java index 7c68f32ec1..dadf4257ea 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java @@ -17,11 +17,13 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; @@ -41,15 +43,15 @@ import com.epmet.entity.CustomerFunctionEntity; import com.epmet.feign.OperCrmFeignClient; import com.epmet.redis.CustomerFunctionRedis; import com.epmet.service.CustomerFunctionService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 客户功能权限表 @@ -57,6 +59,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-10 */ +@Slf4j @Service public class CustomerFunctionServiceImpl extends BaseServiceImpl implements CustomerFunctionService { @@ -211,8 +214,34 @@ public class CustomerFunctionServiceImpl extends BaseServiceImpl customerOpenedFunction(CustomerFunctionListFormDTO formDTO) { - return null; + public List getOpenedFunctionList(CustomerFunctionListFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCustomerId())){ + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + List result = new ArrayList<>(); + //查询所有已上架功能列表(默认、定制功能) + List funList = functionDao.selectFunctionList(); + if(CollectionUtils.isEmpty(funList)){ + return result; + } + //查询当前客户已拥有的功能 + List openedList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId()); + if(CollectionUtils.isEmpty(openedList)){ + log.warn("getOpenedFunctionList customerId:{} have any function",formDTO.getCustomerId()); + return result; + } + Set openedFunIdSet = openedList.stream().map(CustomerFunctionDTO::getFunctionId).collect(Collectors.toSet()); + for (FunctionDTO function : funList) { + if (openedFunIdSet.contains(function.getId())) { + DefaultFunctionListResultDTO resultDTO = ConvertUtils.sourceToTarget(function, DefaultFunctionListResultDTO.class); + if (resultDTO == null) { + log.error("getOpenedFunctionList convert return null,function:{}", JSON.toJSONString(function)); + continue; + } + result.add(resultDTO); + } + } + return result; } } \ No newline at end of file From db5907c478534ca235b4a597f9ae5c4104a8c119 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Jul 2020 13:36:14 +0800 Subject: [PATCH 034/157] =?UTF-8?q?1.=E8=BF=90=E8=90=A5=E7=AB=AF=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AE=A2=E6=88=B7=EF=BC=8C=E4=B8=BA=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=AE=A1=E7=90=86=E5=91=98=EF=BC=8C=E6=AD=A4?= =?UTF-8?q?=E6=97=B6=E8=AE=BE=E7=BD=AE=E7=9A=84=E6=98=AFroot=5Fmanager?= =?UTF-8?q?=E8=B7=9F=E7=AE=A1=E7=90=86=E5=91=98=202.=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E7=AB=AF=E4=B8=BA=E5=B7=A5=E4=BD=9C=E4=BA=BA=E5=91=98=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=A7=92=E8=89=B2=E6=97=B6=EF=BC=8C=E4=B8=8D=E6=98=BE?= =?UTF-8?q?=E7=A4=BAroot=5Fmanager=E6=A0=B9=E7=AE=A1=E7=90=86=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/controller/CustomerController.java | 2 +- .../service/impl/CustomerServiceImpl.java | 3 ++- .../com/epmet/constant/RoleKeyConstants.java | 5 +++++ .../impl/CustomerStaffServiceImpl.java | 20 +++++++++++-------- .../db/migration/V0.0.4__add_rootmanager.sql | 1 + .../main/resources/mapper/StaffRoleDao.xml | 10 +++++----- 6 files changed, 26 insertions(+), 15 deletions(-) create mode 100644 epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql 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 c8c17dcfad..508f0ba09b 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 @@ -197,7 +197,7 @@ public class CustomerController { /** * - * 添加管理员 + * 添加根管理员(不能被取消角色的管理员) * @param form * @return */ diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 2dc57cd47f..ecafef1a96 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -250,7 +250,8 @@ public class CustomerServiceImpl extends BaseServiceImpl getRoleResult = epmetUserFeignClient.getRoleOfCustomer(customerRoleForm); if (!getRoleResult.success()) { log.error("查询客户具有指定RoleKey的角色信息失败:".concat(getRoleResult.toString())); diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java index 4d82df0d1f..3a8361be2c 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/constant/RoleKeyConstants.java @@ -9,6 +9,11 @@ public class RoleKeyConstants { */ public static final String ROLE_KEY_MANAGER = "manager"; + /** + * 根管理员(不能通过工作端取消的角色,且不会再工作端显示) + */ + public static final String ROLE_KEY_ROOT_MANAGER = "root_manager"; + /** * 党建负责人 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index a0f3aab8e2..09760dac92 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -31,6 +31,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerStaffConstant; +import com.epmet.constant.RoleKeyConstants; import com.epmet.constant.UserConstant; import com.epmet.constant.UserRoleConstant; import com.epmet.dao.CustomerStaffDao; @@ -244,14 +245,17 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl roleList = govStaffRoleService.getGovStaffRoleList(govStaffRoleDTO); //获取工作人员角色 List staffRoles = govStaffRoleService.listRolesByStaffId(fromDTO.getStaffId(), fromDTO.getAgencyId()); - List staffRoleList = roleList.stream().map(p -> { - StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); - staffRoleResultDTO.setRoleId(p.getId()); - staffRoleResultDTO.setRoleName(p.getRoleName()); - staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly()); - staffRoleResultDTO.setSelected(false); - return staffRoleResultDTO; - }).collect(Collectors.toList()); + List staffRoleList = roleList + .stream() + .filter(p -> !RoleKeyConstants.ROLE_KEY_ROOT_MANAGER.equals(p.getRoleKey())) + .map(p -> { + StaffRoleResultDTO staffRoleResultDTO = new StaffRoleResultDTO(); + staffRoleResultDTO.setRoleId(p.getId()); + staffRoleResultDTO.setRoleName(p.getRoleName()); + staffRoleResultDTO.setFullTimeOnly(p.getFullTimeOnly()); + staffRoleResultDTO.setSelected(false); + return staffRoleResultDTO; + }).collect(Collectors.toList()); staffRoleList.forEach(role -> staffRoles.forEach(staffRole -> { if (role.getRoleId().equals(staffRole.getId())) { diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql new file mode 100644 index 0000000000..31f2f20fdb --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.4__add_rootmanager.sql @@ -0,0 +1 @@ +INSERT INTO epmet_user.gov_staff_role_template (ID, ROLE_KEY, ROLE_NAME, ORG_TYPE, FULL_TIME_ONLY, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) VALUES (uuid(), 'root_manager', '根管理员', 'agency', 1, 0, 0, 'APP_USER', now(), 'APP_USER', now()); \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index 94ae4b700d..e16b649d47 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -17,11 +17,11 @@ update - staff_role - set DEL_FLAG = '1' - where STAFF_ID = #{staffId} - and ORG_ID = #{orgId} - and DEL_FLAG = '0' + staff_role sr inner join gov_staff_role gsr on (sr.ROLE_ID = gsr.ID and gsr.ROLE_KEY != 'root_manager') + set sr.DEL_FLAG = '1' + where sr.STAFF_ID = #{staffId} + and sr.ORG_ID = #{orgId} + and sr.DEL_FLAG = '0' From 0d18cceefba5bd37bdbc1ff48f8a37e2721453b5 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Jul 2020 13:38:43 +0800 Subject: [PATCH 035/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oper-crm/oper-crm-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/oper-crm/oper-crm-server/pom.xml | 2 +- epmet-user/epmet-user-server/deploy/docker-compose-dev.yml | 2 +- epmet-user/epmet-user-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml index 1c4f6845ca..73ed7cfe6a 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.28 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.29 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/pom.xml b/epmet-module/oper-crm/oper-crm-server/pom.xml index d1eaf5367f..e839c0930c 100644 --- a/epmet-module/oper-crm/oper-crm-server/pom.xml +++ b/epmet-module/oper-crm/oper-crm-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.28 + 0.3.29 com.epmet oper-crm diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index a16884cdcd..a36c2b854d 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.77 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.78 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 9ec79e461e..263fd803f6 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.77 + 0.3.78 com.epmet epmet-user From fb203f736cb253ffb6cc868602e36d2681532ac9 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Thu, 23 Jul 2020 13:51:26 +0800 Subject: [PATCH 036/157] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/resi/ResiActInsertLiveFormDTO.java | 93 +++++++++++++ .../dto/form/resi/ResiActSignInFormDTO.java | 100 ++++++++++++++ .../ResiVolunteerAuthenticateFormDTO.java | 106 +++++++++++++++ .../controller/ResiActListController.java | 31 +++++ .../controller/ResiVolunteerController.java | 18 ++- .../com/epmet/dao/ActUserRelationDao.java | 4 +- .../com/epmet/service/ActLiveRecService.java | 75 +++-------- .../epmet/service/ActSignInRecService.java | 71 ++-------- .../epmet/service/VolunteerInfoService.java | 71 ++-------- .../service/impl/ActLiveRecServiceImpl.java | 93 +++++-------- .../service/impl/ActSignInRecServiceImpl.java | 124 ++++++++++-------- .../impl/ActUserRelationServiceImpl.java | 4 +- .../impl/VolunteerInfoServiceImpl.java | 66 +++------- .../utils/ActUserRelationStatusConstant.java | 5 + .../resources/mapper/ActUserRelationDao.xml | 19 ++- 15 files changed, 530 insertions(+), 350 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java new file mode 100644 index 0000000000..d84b3b4698 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java @@ -0,0 +1,93 @@ +/** + * 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.form.resi; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 活动-添加实况 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-23 + */ +@Data +public class ResiActInsertLiveFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动ID + */ + @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 活动签到描述 + */ + private String desc; + + /** + * 活动签到位置经度 + */ + @NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal longitude; + + /** + * 活动签到位置纬度 + */ + @NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal latitude; + + /** + * 活动签到地址 + */ + @NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private String address; + + /** + * 图片 + */ + private List images; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java new file mode 100644 index 0000000000..a587969ca2 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.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.dto.form.resi; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.awt.*; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 活动签到 入参 + * + * @author zhangyong + * @since v1.0.0 2020-07-23 + */ +@Data +public class ResiActSignInFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 活动ID + */ + @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 活动签到描述 + */ + private String desc; + + /** + * 活动签到位置经度 + */ + @NotBlank(message = "活动签到位置经度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal longitude; + + /** + * 活动签到位置纬度 + */ + @NotBlank(message = "活动签到位置纬度不能为空", groups = { AddUserInternalGroup.class }) + private BigDecimal latitude; + + /** + * 活动签到地址 + */ + @NotBlank(message = "活动签到地址不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private String address; + + /** + * 图片 + */ + private List images; + + /** + * 0不同步实况1同步到实况记录 + */ + @NotBlank(message = "是否同步到实况记录不能为空", groups = { AddUserInternalGroup.class, AddUserShowGroup.class}) + private Integer syncLive; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java new file mode 100644 index 0000000000..26b8591599 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java @@ -0,0 +1,106 @@ +package com.epmet.dto.form.resi; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 志愿者认证 入参 + * + * @Auther: zhangyong + * @Date: 2020-07-23 09:57 + */ + +@Data +public class ResiVolunteerAuthenticateFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + /** + * 添加用户操作的用户可见异常分组 + * 该分组用于校验需要返回给前端错误信息提示的列,需要继承CustomerClientShowGroup + * 返回错误码为8999,提示信息为DTO中具体的列的校验注解message的内容 + */ + public interface AddUserShowGroup extends CustomerClientShowGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 姓 + */ + @NotBlank(message = "姓不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String surname; + + /** + * 名 + */ + @NotBlank(message = "名不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String name; + + /** + * 性别(1男2女0未知) + */ + @NotBlank(message = "性别不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String gender; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String mobile; + + /** + * 身份证号码 + */ + @NotBlank(message = "身份证号码不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String idNum; + + /** + * 街道 + */ + @NotBlank(message = "街道不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String street; + + /** + * 小区名 + */ + @NotBlank(message = "小区名不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String district; + + /** + * 楼栋单元 + */ + @NotBlank(message = "楼栋单元不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String buildingAddress; + + /** + * 志愿者自我介绍 + */ + private String volunteerIntroduce; + + /** + * 昵称 + */ + @NotBlank(message = "昵称不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String nickname; + + /** + * 头像 + */ + @NotBlank(message = "头像不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) + private String headImgUrl; + + /** + * 志愿者签名 + */ + private String volunteerSignature; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java index 478bcfaa58..7231d7132a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java @@ -37,6 +37,9 @@ public class ResiActListController { @Autowired private HeartUserInfoService heartUserInfoService; + @Autowired + private ActSignInRecService actSignInRecService; + /** * 活动列表(包含状态:报名中:signing_up;已报满:enough;截止报名: end_sign_up; 已开始: in_progress; 已结束:finished;) * @@ -251,4 +254,32 @@ public class ResiActListController { return heartUserInfoService.leaderboard(formDTO); } + /** + * 活动-添加实况 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:29 2020-07-23 + **/ + @PostMapping("insertlive") + public Result inSertlive(@LoginUser TokenDto tokenDto, @RequestBody ResiActInsertLiveFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return actLiveRecService.inSertlive(tokenDto, formDTO); + } + + /** + * 活动-签到 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:29 2020-07-23 + **/ + @PostMapping("signin") + public Result actSignIn(@LoginUser TokenDto tokenDto, @RequestBody ResiActSignInFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return actSignInRecService.actSignIn(tokenDto, formDTO); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java index 8d3508fce6..f93e0da287 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java @@ -17,8 +17,16 @@ package com.epmet.controller; -import com.epmet.dao.VolunteerInfoDao; +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; +import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; +import com.epmet.service.VolunteerInfoService; 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; @@ -34,7 +42,11 @@ import org.springframework.web.bind.annotation.RestController; public class ResiVolunteerController { @Autowired - private VolunteerInfoDao volunteerInfoDao; - + private VolunteerInfoService volunteerInfoService; + @PostMapping("authenticate") + public Result authenticate(@LoginUser TokenDto tokenDto, @RequestBody ResiVolunteerAuthenticateFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return volunteerInfoService.authenticate(tokenDto, formDTO); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index ccc5981b5a..1f21cd951a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -73,12 +73,12 @@ public interface ActUserRelationDao extends BaseDao { Integer selectActSignupNum(@Param("actId") String actId); /** - * 将用户与活动的状态修改为 已取消 + * 根据用户id和活动id,修改 用户活动关系表 * * @param userRelationDTO * @return void * @Author zhangyong * @Date 14:39 2020-07-22 **/ - void updateUserStatusToCanceld(ActUserRelationDTO userRelationDTO); + void updateUserRelationByActIdAndUserId(ActUserRelationDTO userRelationDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java index a0b32263c4..4185eedf75 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java @@ -19,9 +19,12 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActLiveRecDTO; import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLiveRecEntity; @@ -36,66 +39,6 @@ import java.util.Map; */ public interface ActLiveRecService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return ActLiveRecDTO - * @author generator - * @date 2020-07-19 - */ - ActLiveRecDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void save(ActLiveRecDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void update(ActLiveRecDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-07-19 - */ - void delete(String[] ids); - /** * 活动详情-已结束-现场实况列表 * @@ -105,4 +48,16 @@ public interface ActLiveRecService extends BaseService { * @Date 13:39 2020-07-21 **/ Result liveRecList(String actId); + + /** + * 活动-添加实况 + * 返回实况id,主要是因为,当签到并转发实况时,表中需要存储【实况ID】 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 13:40 2020-07-23 + **/ + Result inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java index c8119da389..84aec10141 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java @@ -19,7 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActSignInRecDTO; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.entity.ActSignInRecEntity; import java.util.List; @@ -32,64 +35,14 @@ import java.util.Map; * @since v1.0.0 2020-07-19 */ public interface ActSignInRecService extends BaseService { - - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return ActSignInRecDTO - * @author generator - * @date 2020-07-19 - */ - ActSignInRecDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void save(ActSignInRecDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void update(ActSignInRecDTO dto); - /** - * 批量删除 + * 活动-签到 * - * @param ids - * @return void - * @author generator - * @date 2020-07-19 - */ - void delete(String[] ids); -} \ No newline at end of file + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:29 2020-07-23 + **/ + Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java index e7874814d2..6938871d5b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java @@ -19,7 +19,10 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.VolunteerInfoDTO; +import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.entity.VolunteerInfoEntity; import java.util.List; @@ -34,62 +37,14 @@ import java.util.Map; public interface VolunteerInfoService extends BaseService { /** - * 默认分页 + * 志愿者认证 * - * @param params - * @return PageData - * @author generator - * @date 2020-07-19 - */ - PageData page(Map params); - - /** - * 默认查询 - * - * @param params - * @return java.util.List - * @author generator - * @date 2020-07-19 - */ - List list(Map params); - - /** - * 单条查询 - * - * @param id - * @return VolunteerInfoDTO - * @author generator - * @date 2020-07-19 - */ - VolunteerInfoDTO get(String id); - - /** - * 默认保存 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void save(VolunteerInfoDTO dto); - - /** - * 默认更新 - * - * @param dto - * @return void - * @author generator - * @date 2020-07-19 - */ - void update(VolunteerInfoDTO dto); - - /** - * 批量删除 - * - * @param ids - * @return void - * @author generator - * @date 2020-07-19 - */ - void delete(String[] ids); -} \ No newline at end of file + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 10:09 2020-07-23 + **/ + Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO); + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java index 967bdf16e2..b5038ce2ab 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java @@ -17,24 +17,24 @@ 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.page.PageData; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.ActLivePicDao; import com.epmet.dao.ActLiveRecDao; +import com.epmet.dao.ActUserLogDao; +import com.epmet.dao.ActUserRelationDao; import com.epmet.dto.ActLivePicDTO; import com.epmet.dto.ActLiveRecDTO; -import com.epmet.dto.UserWechatDTO; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; +import com.epmet.entity.ActLivePicEntity; import com.epmet.entity.ActLiveRecEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.ActLiveRecRedis; import com.epmet.service.ActLiveRecService; -import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -56,57 +56,8 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ActLiveRecDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ActLiveRecDTO.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 ActLiveRecDTO get(String id) { - ActLiveRecEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ActLiveRecDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(ActLiveRecDTO dto) { - ActLiveRecEntity entity = ConvertUtils.sourceToTarget(dto, ActLiveRecEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ActLiveRecDTO dto) { - ActLiveRecEntity entity = ConvertUtils.sourceToTarget(dto, ActLiveRecEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } + @Autowired + private ActLivePicDao actLivePicDao; @Override public Result liveRecList(String actId) { @@ -144,4 +95,30 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl().ok(resultDto); } + @Override + @Transactional(rollbackFor = Exception.class) + public Result inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + // 存储活动实况记录表 + ActLiveRecEntity actLiveRecEntity = new ActLiveRecEntity(); + actLiveRecEntity.setActId(formDTO.getActId()); + actLiveRecEntity.setUserId(formDTO.getUserId()); + actLiveRecEntity.setLongitude(formDTO.getLongitude()); + actLiveRecEntity.setLatitude(formDTO.getLatitude()); + actLiveRecEntity.setAddress(formDTO.getAddress()); + actLiveRecEntity.setDesc(formDTO.getDesc()); + baseDao.insert(actLiveRecEntity); + + //存储活动实况图片 + List imgList = formDTO.getImages(); + for (int i = 0; i < imgList.size(); i++) { + String imgUrl = imgList.get(i); + ActLivePicEntity actLivePicEntity = new ActLivePicEntity(); + actLivePicEntity.setLiveId(actLiveRecEntity.getId()); + actLivePicEntity.setPicUrl(imgUrl); + actLivePicEntity.setSort(i + NumConstant.ONE); + actLivePicDao.insert(actLivePicEntity); + } + return new Result().ok(actLiveRecEntity.getId()); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java index ac608c807a..88719c0b99 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java @@ -17,25 +17,30 @@ 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.page.PageData; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dao.ActSignInPicDao; import com.epmet.dao.ActSignInRecDao; -import com.epmet.dto.ActSignInRecDTO; +import com.epmet.dao.ActUserLogDao; +import com.epmet.dao.ActUserRelationDao; +import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; +import com.epmet.entity.ActSignInPicEntity; import com.epmet.entity.ActSignInRecEntity; +import com.epmet.entity.ActUserLogEntity; import com.epmet.redis.ActSignInRecRedis; +import com.epmet.service.ActLiveRecService; import com.epmet.service.ActSignInRecService; -import org.apache.commons.lang3.StringUtils; +import com.epmet.utils.ActUserRelationStatusConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import java.util.Arrays; import java.util.List; -import java.util.Map; /** * 活动签到记录 @@ -49,56 +54,67 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, ActSignInRecDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, ActSignInRecDTO.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; - } + @Autowired + private ActUserRelationDao actUserRelationDao; - @Override - public ActSignInRecDTO get(String id) { - ActSignInRecEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, ActSignInRecDTO.class); - } + @Autowired + private ActUserLogDao actUserLogDao; - @Override - @Transactional(rollbackFor = Exception.class) - public void save(ActSignInRecDTO dto) { - ActSignInRecEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInRecEntity.class); - insert(entity); - } + @Autowired + private ActSignInPicDao actSignInPicDao; - @Override - @Transactional(rollbackFor = Exception.class) - public void update(ActSignInRecDTO dto) { - ActSignInRecEntity entity = ConvertUtils.sourceToTarget(dto, ActSignInRecEntity.class); - updateById(entity); - } + @Autowired + private ActLiveRecService actLiveRecService; @Override @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); + public Result actSignIn(TokenDto tokenDto, ResiActSignInFormDTO formDTO) { + formDTO.setUserId(tokenDto.getUserId()); + // 更新用户活动关系表 SIGN_IN_FLAG字段更新为已签到 + ActUserRelationDTO actUserRelationDTO = new ActUserRelationDTO(); + actUserRelationDTO.setActId(formDTO.getActId()); + actUserRelationDTO.setUserId(formDTO.getUserId()); + actUserRelationDTO.setSignInFlag(ActUserRelationStatusConstant.SIGNED_IN); + actUserRelationDao.updateUserRelationByActIdAndUserId(actUserRelationDTO); + + // 存储用户活动关系日志表 + ActUserLogEntity actUserLogEntity = new ActUserLogEntity(); + actUserLogEntity.setActId(formDTO.getActId()); + actUserLogEntity.setUserId(formDTO.getUserId()); + actUserLogEntity.setOperationType(ActUserRelationStatusConstant.SIGNED_IN); + actUserLogDao.insert(actUserLogEntity); + + //" 实况id,当sync_live=1时此列有值" + String liveId = ""; + if (formDTO.getSyncLive() == 1){ + // 签到内容同步到实况 + ResiActInsertLiveFormDTO liveFormDTO = ConvertUtils.sourceToTarget(formDTO, ResiActInsertLiveFormDTO.class); + Result inSertlive = actLiveRecService.inSertlive(tokenDto, liveFormDTO); + liveId = inSertlive.getData(); + } + + // 存储活动签到记录表 + ActSignInRecEntity actSignInRecEntity = new ActSignInRecEntity(); + actSignInRecEntity.setActId(formDTO.getActId()); + actSignInRecEntity.setUserId(formDTO.getUserId()); + actSignInRecEntity.setLongitude(formDTO.getLongitude()); + actSignInRecEntity.setLatitude(formDTO.getLatitude()); + actSignInRecEntity.setAddress(formDTO.getAddress()); + actSignInRecEntity.setDesc(formDTO.getDesc()); + actSignInRecEntity.setSyncLive(formDTO.getSyncLive()); + actSignInRecEntity.setLiveId(liveId); + baseDao.insert(actSignInRecEntity); + + //存储活动签到图片 + List imgList = formDTO.getImages(); + for (int i = 0; i < imgList.size(); i++) { + String imgUrl = imgList.get(i); + ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity(); + actLivePicEntity.setSignInId(actSignInRecEntity.getId()); + actLivePicEntity.setPicUrl(imgUrl); + actLivePicEntity.setSort(i + NumConstant.ONE); + actSignInPicDao.insert(actLivePicEntity); + } + return new Result(); } - -} \ No newline at end of file +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java index cfea34e14e..5169f119df 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java @@ -153,11 +153,11 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, VolunteerInfoDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, VolunteerInfoDTO.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 VolunteerInfoDTO get(String id) { - VolunteerInfoEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, VolunteerInfoDTO.class); + public Result authenticate(TokenDto tokenDto, ResiVolunteerAuthenticateFormDTO formDTO) { + // 检查是否是志愿者 + // 是志愿者 + // 更新志愿者信息表 + // 更新用户基础信息表 + // 更新用户微信表 + + // 不是志愿者 + // 插入志愿者信息表 + // 更新用户基础信息表 + // 更新用户微信表 + return null; } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(VolunteerInfoDTO dto) { - VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(VolunteerInfoDTO dto) { - VolunteerInfoEntity entity = ConvertUtils.sourceToTarget(dto, VolunteerInfoEntity.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/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java index dcde4657a7..1ecbcecca1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java @@ -35,4 +35,9 @@ public interface ActUserRelationStatusConstant { * 不给积分 */ String DENY = "deny"; + + /** + * 已签到 + */ + String SIGNED_IN = "signed_in"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index 0cd324f25c..d5300a49da 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -72,12 +72,23 @@ GROUP BY re.ACT_ID - + UPDATE act_user_relation SET - STATUS = #{status}, - CANCEL_TIME = NOW(), - CANCEL_REASON = #{cancelReason} + + STATUS = #{status}, + + + CANCEL_TIME = NOW(), + CANCEL_REASON = #{cancelReason}, + + + SIGN_IN_FLAG = #{signInFlag}, + + + UPDATED_BY = #{userId}, + + UPDATED_TIME = NOW() WHERE DEL_FLAG = '0' AND ACT_ID = #{actId} From 47164c985c1c5c689467062f90db8fc7b2a8010a Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Jul 2020 14:22:33 +0800 Subject: [PATCH 037/157] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E5=88=B7=E6=96=B0redis=E6=9D=83=E9=99=90=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E4=B8=A2=E5=A4=B1root=5Fmanager=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-user-server/deploy/docker-compose-dev.yml | 2 +- epmet-user/epmet-user-server/pom.xml | 2 +- .../src/main/java/com/epmet/dao/StaffRoleDao.java | 2 ++ .../main/java/com/epmet/service/StaffRoleService.java | 2 ++ .../epmet/service/impl/CustomerStaffServiceImpl.java | 10 +++++++++- .../com/epmet/service/impl/StaffRoleServiceImpl.java | 8 +++++--- .../src/main/resources/mapper/StaffRoleDao.xml | 8 ++++++++ 7 files changed, 28 insertions(+), 6 deletions(-) diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index a36c2b854d..f6cc6fc0ea 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.78 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.79 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 263fd803f6..bf248b8b05 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.78 + 0.3.79 com.epmet epmet-user diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java index 5cf2cd03b7..6de16bc4f8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/StaffRoleDao.java @@ -98,4 +98,6 @@ public interface StaffRoleDao extends BaseDao { * @return java.util.List */ List selectStaffRoles(@Param("staffId") String staffId); + + List listStaffRoleEntytiesByStaffIdAndOrgId(@Param("agencyId") String agencyId, @Param("staffId") String staffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java index f3913d588b..e6c238a53f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StaffRoleService.java @@ -148,4 +148,6 @@ public interface StaffRoleService extends BaseService { * @return java.util.List */ List getStaffRoles(String staffId); + + List getStaffRoleEntytiesByStaffIdAndOrgId(String agencyId, String staffId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 09760dac92..6be1620f68 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -56,6 +56,7 @@ import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; @@ -341,11 +342,18 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl staffRoleEntytiesByStaffIdAndOrgId = staffRoleService.getStaffRoleEntytiesByStaffIdAndOrgId(fromDTO.getAgencyId(), fromDTO.getStaffId()); + List roleIds = new ArrayList<>(); + if (!CollectionUtils.isEmpty(staffRoleEntytiesByStaffIdAndOrgId)) { + roleIds = staffRoleEntytiesByStaffIdAndOrgId.stream().map(sr -> sr.getRoleId()).collect(Collectors.toList()); + } + // redis缓存角色修改 UpdateCachedRolesFormDTO updateRolesForm = new UpdateCachedRolesFormDTO(); updateRolesForm.setOrgId(fromDTO.getAgencyId()); updateRolesForm.setStaffId(fromDTO.getStaffId()); - updateRolesForm.setRoleIds(fromDTO.getRoles()); + updateRolesForm.setRoleIds(roleIds); try { Result result = authFeignClient.updateCachedRoles(updateRolesForm); if (!result.success()) { diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java index 38a4924eef..231ab010ea 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StaffRoleServiceImpl.java @@ -19,7 +19,6 @@ 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.annotation.DataFilter; import com.epmet.commons.mybatis.entity.DataScope; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; @@ -36,9 +35,7 @@ import com.epmet.dto.form.RolesUsersListFormDTO; import com.epmet.dto.result.CustomerStaffRoleResultDTO; import com.epmet.dto.result.CustomerStaffRoleListResultDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; -import com.epmet.dto.result.GovStaffRoleTemplateDTO; import com.epmet.dto.result.StaffRolesResultDTO; -import com.epmet.entity.GovStaffRoleEntity; import com.epmet.entity.StaffRoleEntity; import com.epmet.redis.StaffRoleRedis; import com.epmet.service.StaffRoleService; @@ -180,4 +177,9 @@ public class StaffRoleServiceImpl extends BaseServiceImpl getStaffRoleEntytiesByStaffIdAndOrgId(String agencyId, String staffId) { + return baseDao.listStaffRoleEntytiesByStaffIdAndOrgId(agencyId, staffId); + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml index e16b649d47..b02425c697 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/StaffRoleDao.xml @@ -156,4 +156,12 @@ AND gsr.del_flag = '0' AND sr.staff_id = #{staffId} + + \ No newline at end of file From 1862b53271f95d5ee150f7379e3f8d5ff5490b30 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Thu, 23 Jul 2020 14:29:20 +0800 Subject: [PATCH 038/157] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=9A=E6=A0=B9=E6=8D=AE=E7=94=A8=E6=88=B7ID=EF=BC=8C?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E7=94=A8=E6=88=B7=E6=89=80=E5=B1=9E=E8=A7=92?= =?UTF-8?q?=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/EpmetUserFeignClient.java | 14 ++++++++++++++ .../EpmetUserFeignClientFallBack.java | 6 ++++++ .../epmet/controller/UserRoleController.java | 14 +++++++++++++- .../main/java/com/epmet/dao/UserRoleDao.java | 15 +++++++++++++-- .../com/epmet/service/UserRoleService.java | 11 ++++++++++- .../service/impl/UserRoleServiceImpl.java | 7 ++++++- .../src/main/resources/mapper/UserRoleDao.xml | 19 ++++++++++++++++++- 7 files changed, 80 insertions(+), 6 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index 96663f3503..f98f1bc474 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -3,8 +3,11 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -29,4 +32,15 @@ public interface EpmetUserFeignClient { **/ @PostMapping("epmetuser/userbaseinfo/queryuserbaseinfo") Result> heartQueryUserBaseInfo(@RequestBody List userIds); + + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:13 2020-07-23 + **/ + @PostMapping(value = "epmetuser/userrole/getuserroleinfobyuserid/{userId}", consumes = MediaType.APPLICATION_JSON_VALUE) + Result> getUserRoleInfoByUserId(@PathVariable("userId") String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index 656c446b05..71447cb0a6 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserWechatDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.feign.EpmetUserFeignClient; import org.springframework.stereotype.Component; @@ -22,4 +23,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result> heartQueryUserBaseInfo(List userIds) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "heartQueryUserBaseInfo", userIds); } + + @Override + public Result> getUserRoleInfoByUserId(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfoByUserId", userId); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java index f442da6e7f..f73fc1b52f 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java @@ -120,4 +120,16 @@ public class UserRoleController { } -} \ No newline at end of file + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:24 2020-07-23 + **/ + @PostMapping("getuserroleinfobyuserid/{userId}") + public Result> getUserRoleInfoByUserId(@PathVariable String userId) { + return userRoleService.getUserRoleInfoByUserId(userId); + } +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java index 989c20b2f1..58b864bce3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserRoleDao.java @@ -18,16 +18,18 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserRoleDTO; import com.epmet.dto.form.UserRoleFormDTO; import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.entity.UserRoleEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 用户角色关系表 + * 用户角色关系表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-03-30 @@ -52,4 +54,13 @@ public interface UserRoleDao extends BaseDao { **/ List getUserRoleList(UserRoleFormDTO userRoleFormDTO); -} \ No newline at end of file + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:24 2020-07-23 + **/ + Result> getUserRoleInfoByUserId(@Param("userId") String userId); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java index a22191edb0..c431331236 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/UserRoleService.java @@ -113,4 +113,13 @@ public interface UserRoleService extends BaseService { */ Result saveUserRole(UserRoleDTO userRoleDTO); -} \ No newline at end of file + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:24 2020-07-23 + **/ + Result> getUserRoleInfoByUserId(String userId); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java index 3650de51fc..4c0eafdad9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/UserRoleServiceImpl.java @@ -132,4 +132,9 @@ public class UserRoleServiceImpl extends BaseServiceImpl> getUserRoleInfoByUserId(String userId) { + return baseDao.getUserRoleInfoByUserId(userId); + } + +} diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml index af3e8cbfbb..803fa40621 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/UserRoleDao.xml @@ -71,4 +71,21 @@ - \ No newline at end of file + + From cc3343c9e22493822654e90696d7f0d1d424c702 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Jul 2020 14:31:45 +0800 Subject: [PATCH 039/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oper-crm/oper-crm-server/deploy/docker-compose-test.yml | 2 +- epmet-user/epmet-user-server/deploy/docker-compose-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml index ddaa785107..ef1e3d8974 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/oper-crm-server:0.3.25 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/oper-crm-server:0.3.29 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-test.yml b/epmet-user/epmet-user-server/deploy/docker-compose-test.yml index 0cc2683457..c0efd1fb64 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-test.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-user-server:0.3.75 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-user-server:0.3.79 ports: - "8087:8087" network_mode: host # 不会创建新的网络 From 84a292d10b3243c08f9883f2435d6177b17d3311 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Thu, 23 Jul 2020 15:15:56 +0800 Subject: [PATCH 040/157] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/SubmitAuditFormDTO.java | 24 ++++- .../epmet/service/impl/CodeServiceImpl.java | 19 +++- .../param/WxMaCodeSubmitAuditRequest.java | 101 +----------------- .../service/impl/WxMaCodeServiceImpl.java | 5 +- .../mapper/CodeOperationHistoryDao.xml | 2 +- 5 files changed, 43 insertions(+), 108 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java index e88d58e3f9..82867159cf 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java @@ -43,84 +43,100 @@ public class SubmitAuditFormDTO implements Serializable { /** * 用户生成内容场景(UGC)信息安全声明 */ - private List ugcDeclare; + private UgcDeclareBean ugcDeclare; @NoArgsConstructor @Data - private static class ItemListBean { + public static class ItemListBean { /** * 小程序的页面,可通过获取小程序的页面列表接口获得 */ + @SerializedName("address") private String address; /** * 小程序的标签,用空格分隔,标签至多 10 个,标签长度至多 20 */ + @SerializedName("tag") private String tag; /** * 一级类目名称 */ + @SerializedName("first_class") private String firstClass; /** * 二级类目名称 */ + @SerializedName("second_class") private String secondClass; /** * 三级类目名称 */ + @SerializedName("third_class") private String thirdClass; /** * 一级类目的 ID */ + @SerializedName("first_id") private String firstId; /** * 二级类目的 ID */ + @SerializedName("second_id") private String secondId; /** * 三级类目的 ID */ + @SerializedName("third_id") private String thirdId; /** * 小程序页面的标题,标题长度至多 32 */ + @SerializedName("title") private String title; } @NoArgsConstructor @Data - private static class PreviewInfoBean { + public static class PreviewInfoBean { /** * 录屏mediaid列表,可以通过提审素材上传接口获得 */ + @SerializedName("Video_id_list") private List videoIdList; /** * 截屏mediaid列表,可以通过提审素材上传接口获得 */ + @SerializedName("pic_id_list") private List picIdList; } @NoArgsConstructor @Data - private static class UgcDeclareBean { + public static class UgcDeclareBean { /** * UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段 */ + @SerializedName("scene") private List scene; /** * 当scene选其他时的说明,不超时256字 */ + @SerializedName("other_scene_desc") private String otherSceneDesc; /** * 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关 */ + @SerializedName("method") private List method; /** * 是否有审核团队, 0.无,1.有,默认0 */ + @SerializedName("has_audit_team") private Integer hasAuditTeam; /** * 说明当前对UGC内容的审核机制,不超过256字 */ + @SerializedName("audit_desc") private String auditDesc; } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index da2474e2f9..8e18dadcbf 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -161,11 +161,11 @@ public class CodeServiceImpl implements CodeService { @Override public PageData uploadList(UploadListFormDTO formDTO) { - //获取小程序调用令牌 - AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); - if (null != authInfo) { - List auditingList = codeCustomerService.getAuditingCodeList(); + List auditingList = codeCustomerService.getAuditingCodeList(); + if (null != auditingList && auditingList.size() > NumConstant.ZERO) { auditingList.forEach(code -> { + //获取小程序调用令牌 + AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(code.getCustomerId(), code.getClientType()); //获取审核结果信息 CodeAuditResultDTO auditResult = codeAuditResultService.getAuditResultByCodeId(code.getId()); //调用微信API获取最新审核状态 @@ -182,10 +182,12 @@ public class CodeServiceImpl implements CodeService { code.setStatus(CodeConstant.AUDIT_FAILED); auditResult.setResult(CodeConstant.AUDIT_FAILED); auditResult.setReason(result.getReason()); + auditResult.setScreenShot(result.getScreenshot()); codeOperationHistoryService.updateDescribe(code.getId(), result.getReason()); } else if (result.getStatus() == NumConstant.FOUR) { code.setStatus(CodeConstant.DELAY); auditResult.setResult(CodeConstant.DELAY); + auditResult.setReason(result.getReason()); codeOperationHistoryService.updateDescribe(code.getId(), "审核延后"); } codeCustomerService.update(code); @@ -210,7 +212,13 @@ public class CodeServiceImpl implements CodeService { throw new RenException("未授权"); } //调用微信API上提交审核 - WxMaCodeSubmitAuditRequest request = ConvertUtils.sourceToTarget(formDTO, WxMaCodeSubmitAuditRequest.class); + WxMaCodeSubmitAuditRequest request = new WxMaCodeSubmitAuditRequest(); + request.setVersionDesc(formDTO.getVersionDesc()); + request.setFeedbackInfo(formDTO.getFeedbackInfo()); + request.setFeedbackStuff(formDTO.getFeedbackStuff()); + request.setItemList(formDTO.getItemList()); + request.setPreviewInfo(formDTO.getPreviewInfo()); + request.setUgcDeclare(formDTO.getUgcDeclare()); WxResult wxResult = wxMaCodeService.submitAudit(authInfo.getAuthorizerAccessToken(), request); if (!wxResult.success()) { saveOperation(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getId(), codeCustomerDTO.getUserVersion(), CodeConstant.OPER_SUBMIT, @@ -374,6 +382,7 @@ public class CodeServiceImpl implements CodeService { @Override public String mediaUpload(MediaUploadFormDTO formDTO) { try { +// Result uploadDTOResult = ossFeignClient.upload(formDTO.getMedia()); File file = MultipartFileToFileUtils.multipartFileToFile(formDTO.getMedia()); //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java index c9fa07b8e4..1c63b9ed3a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java @@ -1,5 +1,6 @@ package com.epmet.wxapi.param; +import com.epmet.dto.form.SubmitAuditFormDTO; import com.google.gson.annotations.SerializedName; import lombok.Data; import lombok.NoArgsConstructor; @@ -36,110 +37,16 @@ public class WxMaCodeSubmitAuditRequest implements Serializable { * 审核项列表(选填,至多填写 5 项) */ @SerializedName("item_list") - private List itemList; + private List itemList; /** * 预览信息(小程序页面截图和操作录屏) */ @SerializedName("preview_info") - private List previewInfo; + private List previewInfo; /** * 用户生成内容场景(UGC)信息安全声明 */ @SerializedName("ugc_declare") - private List ugcDeclare; + private SubmitAuditFormDTO.UgcDeclareBean ugcDeclare; - @NoArgsConstructor - @Data - private static class ItemListBean { - /** - * 小程序的页面,可通过获取小程序的页面列表接口获得 - */ - @SerializedName("address") - private String address; - /** - * 小程序的标签,用空格分隔,标签至多 10 个,标签长度至多 20 - */ - @SerializedName("tag") - private String tag; - /** - * 一级类目名称 - */ - @SerializedName("first_class") - private String firstClass; - /** - * 二级类目名称 - */ - @SerializedName("second_class") - private String secondClass; - /** - * 三级类目名称 - */ - @SerializedName("third_class") - private String thirdClass; - /** - * 一级类目的 ID - */ - @SerializedName("first_id") - private String firstId; - /** - * 二级类目的 ID - */ - @SerializedName("second_id") - private String secondId; - /** - * 三级类目的 ID - */ - @SerializedName("third_id") - private String thirdId; - /** - * 小程序页面的标题,标题长度至多 32 - */ - @SerializedName("title") - private String title; - } - - @NoArgsConstructor - @Data - private static class PreviewInfoBean { - /** - * 录屏mediaid列表,可以通过提审素材上传接口获得 - */ - @SerializedName("Video_id_list") - private List videoIdList; - /** - * 截屏mediaid列表,可以通过提审素材上传接口获得 - */ - @SerializedName("pic_id_list") - private List picIdList; - } - - @NoArgsConstructor - @Data - private static class UgcDeclareBean { - /** - * UGC场景 0,不涉及用户生成内容, 1.用户资料,2.图片,3.视频,4.文本,5其他, 可多选,当scene填0时无需填写下列字段 - */ - @SerializedName("scene") - private List scene; - /** - * 当scene选其他时的说明,不超时256字 - */ - @SerializedName("other_scene_desc") - private String otherSceneDesc; - /** - * 内容安全机制 1.使用平台建议的内容安全API,2.使用其他的内容审核产品,3.通过人工审核把关,4.未做内容审核把关 - */ - @SerializedName("method") - private List method; - /** - * 是否有审核团队, 0.无,1.有,默认0 - */ - @SerializedName("has_audit_team") - private Integer hasAuditTeam; - /** - * 说明当前对UGC内容的审核机制,不超过256字 - */ - @SerializedName("audit_desc") - private String auditDesc; - } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java index 3ffe8aa295..e0ae3823e5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -10,12 +10,14 @@ import com.epmet.wxapi.result.*; import com.epmet.wxapi.service.WxMaCodeService; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import com.google.gson.JsonObject; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.io.File; +import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; @@ -149,7 +151,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { @Override public WxResult getAuditStatus(String accessToken, WxMaCodeAuditStatusReq request) { WxResult result = new WxResult<>(); - String url = WxMaCodeConstant.COMMIT_URL + "?" + "access_token=" + accessToken; + String url = WxMaCodeConstant.GET_AUDIT_STATUS_URL + "?" + "access_token=" + accessToken; Result statusResult = HttpClientManager.getInstance().sendPostByJSON(url, toJson(request)); if (!statusResult.success()) { result.setErrorCode(statusResult.getCode()); @@ -209,6 +211,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { return result; } Gson gson = new Gson(); + InputStream inputStream = gson.fromJson(statusResult.getData(), InputStream.class); WxMaNewsResult newsResult = gson.fromJson(statusResult.getData(), WxMaNewsResult.class); result.ok(newsResult); return result; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml index 5e33c62878..66041c4ea0 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml @@ -19,7 +19,7 @@ UPDATE code_operation_history SET - `DESCRIPTION` = #{description} + `DESCRIPTION` = #{describe} WHERE CODE_ID = #{codeId} AND OPERATION = 'audit' From b0e8c6724f4a9578427a172a7ef8750eb4bf5841 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 23 Jul 2020 15:16:07 +0800 Subject: [PATCH 041/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=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 --- .../java/com/epmet/dao/CustomerMpDao.java | 2 +- .../ComponentVerifyTicketServiceImpl.java | 81 ++++++++++++++++++- .../resources/mapper/AuthorizationInfoDao.xml | 1 + .../resources/mapper/BindingAccountDao.xml | 2 +- .../main/resources/mapper/CustomerMpDao.xml | 4 +- .../mapper/OpenFlatformAccountDao.xml | 4 +- 6 files changed, 86 insertions(+), 8 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java index 593194e2c7..b6c9376f6d 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java @@ -58,7 +58,7 @@ public interface CustomerMpDao extends BaseDao { * @param customerId * @author zxc */ - Integer selectAuthCount(@Param("customerId")String customerId); + List selectAuthCount(@Param("customerId")String customerId); /** * @Description 回填customer_mp的appId diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 2204c77aa4..43e251dd5e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -143,7 +143,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe AuthCodeResultDTO authCodeResultDTO = authorizationInfoDao.selectCustomerIdByAuthAppId(authAppId); String clientType = authCodeResultDTO.getClientType(); String customerId = authCodeResultDTO.getCustomerId(); - this.updateCustomerMpAppIdAndCreateOpenPlatform(customerId,authAppId,clientType); + this.createAndBindOpenAccount(customerId,authAppId,clientType); + this.updateCustomerMpAppId(customerId,authAppId,clientType); authCodeDao.updateAppId(customerId,clientType,authAppId); this.saveAuthAccountInfo(customerId,authAppId,clientType); break; @@ -495,7 +496,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe * @author zxc */ @Transactional(rollbackFor = Exception.class) - public void updateCustomerMpAppIdAndCreateOpenPlatform(String customerId,String authAppId,String clientType){ + public void updateCustomerMpAppId(String customerId,String authAppId,String clientType){ log.info("==========回填customer_mp开始=========="); AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); formDTO.setClientType(clientType); @@ -506,6 +507,82 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe log.info("==========回填customer_mp结束=========="); } + public void createAndBindOpenAccount(String customerId,String authAppId,String clientType){ + log.info("开始创建开放平台账号并绑定"); + List authCount = customerMpDao.selectAuthCount(customerId); + String openPlatformId = null; + if (authCount.size()>0){ + openPlatformId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); + } + Map authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); + String authorizerAccessToken = authorizerRefreshToken.get("authorizerAccessToken").toString(); + if (authCount.size()==NumConstant.ZERO){ + log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); + //没有任何一个小程序/公众号授权,【先创建,再绑定】 + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); + // 此处的 access_token 为 【authorizer_access_token】 + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + openPlatformId = map.get(ModuleConstant.OPEN_APP_ID).toString(); + CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); + createOpen.setErrCode((Integer)map.get(ModuleConstant.ERR_CODE)); + createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG).toString()); + createOpen.setOpenAppId(map.get(ModuleConstant.OPEN_APP_ID).toString()); + switch (createOpen.getErrCode()){ + case NumConstant.ZERO: + log.info(CREATE_AND_BIND_SUCCESS); + CreateOpenFormDTO coForm = new CreateOpenFormDTO(); + coForm.setOpenid(map.get(ModuleConstant.OPEN_APP_ID).toString()); + coForm.setCustomerId(customerId); + //插入 open_platform_account 表 + openPlatformAccountDao.insertOpenPlatFormAccount(coForm); + break; + case NumConstant.ONE_NEG: + throw new RenException(SYSTEM_ERROR); + case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: + throw new RenException(INVALID_APP_ID); + case ModuleConstant.EIGHTY_NINE_THOUSAND: + throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + } + }else if (authCount.size()>NumConstant.ZERO && !authCount.contains(authAppId)){ + log.info("该客户已创建过开放平台账号,直接绑定"); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); + jsonObject.put(ModuleConstant.OPEN_APP_ID,openPlatformId); + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_BIND_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); + createOpen.setErrCode((Integer)map.get(ModuleConstant.ERR_CODE)); + createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG).toString()); + switch (createOpen.getErrCode()){ + case NumConstant.ZERO: + log.info(BIND_SUCCESS); + break; + case NumConstant.ONE_NEG: + throw new RenException(SYSTEM_ERROR); + case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: + throw new RenException(INVALID_APP_ID); + case ModuleConstant.EIGHTY_NINE_THOUSAND: + throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_ONE: + throw new RenException(NOT_SAME_CONTRACTOR); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_THREE: + throw new RenException(NOT_ALLOWED_OPERATE); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_FOUR: + throw new RenException(TO_LIMIT); + } + } + //插入 binding_account + BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO(); + bindingAccount.setOpenPlatformAccountId(openPlatformId); + bindingAccount.setAuthAppId(authAppId); + bindingAccount.setClientType(clientType); + bindingAccount.setCustomerId(customerId); + bindingAccountDao.insertBindingAccount(bindingAccount); + log.info("创建绑定账号结束"); + } + /** * @Description map 转 Entity * @param map diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml index cee136fb42..1bdc899f4f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -68,6 +68,7 @@ update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType} + - SELECT - COUNT(*) AS notAuthCount + app_id AS authAppId FROM customer_mp WHERE diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml index efaa55adad..3cc916bb31 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml @@ -12,7 +12,7 @@ VALUES ( REPLACE ( UUID(), '-', '' ), - #{openAppId}, + #{openid}, #{customerId}, #{delFlag}, #{revision}, @@ -28,7 +28,7 @@ SELECT open_app_id AS openAppId FROM - open_flatform_account + open_platform_account WHERE del_flag = 0 AND customer_id = #{customerId} From 4c3f675e1f495593398899b0f67719f53061b161 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Jul 2020 15:35:48 +0800 Subject: [PATCH 042/157] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=AD=E5=B7=A5=E4=BD=9C=E7=AB=AFappid=20s?= =?UTF-8?q?ecret?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 03a7a57ee3..86a249e48c 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.44 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.45 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 7c5f5d6a62..ce0e69d247 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.44 + 0.3.45 com.epmet epmet-cloud @@ -180,8 +180,10 @@ wx07674c23af51b521 a2fd0d29b007cbbcf8c8dda8c693d99b - wx3d1372029eb816a3 - 651f02d71ed3f123dfb584b8bf0f4d8b + + wx2679392c4cc2af22 + e5e72147737cfeb2b0f3a43624cadb3f From 08ee702eb35f33bd003d7ffa411f9194b1f240ab Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 23 Jul 2020 16:05:24 +0800 Subject: [PATCH 043/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E5=88=B7=E6=96=B0authorizer=5Facce?= =?UTF-8?q?ss=5Ftoken?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java | 5 +++++ .../epmet/service/impl/ComponentVerifyTicketServiceImpl.java | 3 ++- .../src/main/resources/mapper/AuthorizationInfoDao.xml | 1 - 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java index 2e5528ea64..08f038f317 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizerAccessTokenFormDTO.java @@ -34,6 +34,11 @@ public class AuthorizerAccessTokenFormDTO implements Serializable { */ private String authAppid; + /** + * 客户端类型:resi居民端,work:工作端 + */ + private String clientType; + /** * 客户ID */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 43e251dd5e..b96ba88280 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -350,8 +350,9 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe formDTO.setExpiresInTime(expiresInTime); formDTO.setCustomerId(customerId); formDTO.setAuthAppid(authAppId); + formDTO.setClientType(clientType); //先逻辑删除,在插入 - authorizationInfoDao.updateOldAuthorizerAccessToken(willOverDueDTO.getCustomerId(),clientType); + authorizationInfoDao.updateOldAuthorizerAccessToken(customerId,clientType); authorizationInfoDao.insertAuthorizerAccessToken(formDTO); //缓存 refreshAuthorizerAccessToken diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml index 1bdc899f4f..cc9a4ecaf3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -41,7 +41,6 @@ WHERE del_flag = 0 AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) 900 - AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) > 0 From f05c44dd1fe39ccd31762b5059664adbb7a67f90 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 23 Jul 2020 16:08:29 +0800 Subject: [PATCH 044/157] =?UTF-8?q?heart-work:=E6=8A=A5=E5=90=8D=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8-=E8=AF=A6=E6=83=85api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/ActUserLogDTO.java | 18 +-- .../dto/form/work/AactUserDetailFormDTO.java | 27 ++++ .../epmet/dto/result/work/AuditResult.java | 26 ++++ .../work/AuditingUserDetailResultDTO.java | 103 +++++++++++++++ .../epmet/dto/result/work/CancelResult.java | 29 +++++ .../dto/result/work/HistoricalActInfo.java | 34 +++++ .../result/work/HistoricalAuditResult.java | 30 +++++ .../controller/WorkActUserController.java | 30 +++-- .../java/com/epmet/dao/ActUserLogDao.java | 23 +++- .../com/epmet/dao/ActUserRelationDao.java | 27 ++++ .../com/epmet/entity/ActUserLogEntity.java | 18 ++- .../com/epmet/service/WorkActUserService.java | 10 ++ .../service/impl/WorkActUserServiceImpl.java | 120 +++++++++++++++++- .../main/resources/mapper/ActUserLogDao.xml | 28 +++- .../resources/mapper/ActUserRelationDao.xml | 35 +++++ 15 files changed, 521 insertions(+), 37 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AactUserDetailFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditResult.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CancelResult.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalActInfo.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalAuditResult.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java index a6f783b20f..aecb1b1750 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -50,13 +51,14 @@ public class ActUserLogDTO implements Serializable { /** * 操作类型(已报名/待审核auditing, -审核通过passed, -审核不通过refused -取消报名canceld, -发放积分rewarded -拒绝发放积分refuse_reward -重新处理processing -) + * 审核通过passed, + * 审核不通过refused + * 取消报名canceld, + * 已签到signedin + * 发放积分rewarded + * 拒绝发放积分refuse_reward + * 重新处理processing + * ) */ private String operationType; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AactUserDetailFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AactUserDetailFormDTO.java new file mode 100644 index 0000000000..3e653e76c1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AactUserDetailFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.form.work; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 报名审核-人员详情-入参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/22 22:22 + */ +@Data +public class AactUserDetailFormDTO implements Serializable { + private static final long serialVersionUID = 5791290477143999176L; + + public interface AddUserInternalGroup { + } + + /** + * 列表页返回的主键 + */ + @NotBlank(message = "主键不能为空", groups = {AddUserInternalGroup.class}) + private String actUserRelationId; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditResult.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditResult.java new file mode 100644 index 0000000000..480cc75f71 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditResult.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 审核结果(已通过/已拒绝) + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 14:01 + */ +@Data +public class AuditResult implements Serializable { + private static final long serialVersionUID = -656845099071435835L; + /** + * 审核通过/拒绝的时间yyyy-MM-dd HH:mm:ss + */ + private Date auditTime; + + /** + * 拒绝原因,status=passed时返回空字符串 + */ + private String refusedReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java new file mode 100644 index 0000000000..b04972b890 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java @@ -0,0 +1,103 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 报名审核-待审核人员详情-返参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/22 22:24 + */ +@Data +public class AuditingUserDetailResultDTO implements Serializable { + private static final long serialVersionUID = 6259802533450991971L; + /** + * 活动id + */ + private String actId; + /** + * 用户id + */ + private String userId; + + /** + * 姓名 + */ + private String realName; + + /** + * 性别1男2女0未知 + */ + private String gender; + + /** + * true: 是志愿者 false : 不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 联系方式 + */ + private String mobile; + + /** + * 身份证号 + */ + private String idNum; + + /** + * 居住地址 + */ + private String address; + + /** + * 待审核auditing, 审核通过passed, 审核不通过refused 取消报名canceld, + */ + private String status; + + /** + * 报名时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date signUpTime; + + /** + * 返回文本:已拒绝5次 + */ + private String refusedCountDesc; + + /** + * 最近一次拒绝原因 + */ + private String latestRefusedReason; + + /** + * 最近一次拒绝的时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date latestAuditTime; + + /** + * 历史活动情况 + */ + private HistoricalActInfo historicalActInfo; + + + /** + * 取消信息(已取消界面 用) + */ + private CancelResult cancelResult; + /** + * 审核结果(已通过/已拒绝) + */ + private AuditResult auditResult; + + /** + * 审核历史(待审核界面需要显示) + */ + private HistoricalAuditResult historicalAuditResult; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CancelResult.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CancelResult.java new file mode 100644 index 0000000000..bf128fc0b1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CancelResult.java @@ -0,0 +1,29 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 取消信息(已取消界面 用) + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 13:53 + */ +@Data +public class CancelResult implements Serializable { + private static final long serialVersionUID = -4638522326622908384L; + + /** + * 取消的原因:当status=canceld,才有值 + */ + private String cancelReason; + + /** + * 取消的时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date cancelTime; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalActInfo.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalActInfo.java new file mode 100644 index 0000000000..6054511006 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalActInfo.java @@ -0,0 +1,34 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 用户历史活动情况 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 12:39 + */ +@Data +public class HistoricalActInfo implements Serializable { + private static final long serialVersionUID = -7554295919888726898L; + /** + * 实际参加活动个数 + */ + private Integer signInActNum; + /** + * 报名活动个数 + */ + private Integer signUpActNum; + /** + * 获得积分活动个数 + */ + private Integer obtainPointsActNum; + + public HistoricalActInfo(){ + this.signInActNum=0; + this.signUpActNum=0; + this.obtainPointsActNum=0; + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalAuditResult.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalAuditResult.java new file mode 100644 index 0000000000..54f307c152 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/HistoricalAuditResult.java @@ -0,0 +1,30 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 审核历史(待审核界面需要显示) + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 14:03 + */ +@Data +public class HistoricalAuditResult implements Serializable { + /** + * 最近一次拒绝原因 + */ + private String latestRefusedReason; + /** + * 最近一次拒绝的时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date latestAuditTime; + /** + * 返回文本:已拒绝5次 + */ + private String refusedCountDesc; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java index 78e5f52ce4..44a3151650 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java @@ -2,6 +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.work.AactUserDetailFormDTO; import com.epmet.dto.form.work.AuditingActUserFormDTO; import com.epmet.dto.result.work.*; import com.epmet.service.WorkActUserService; @@ -36,8 +37,7 @@ public class WorkActUserController { @PostMapping("auditinglist") public Result> getAuditingList(@RequestBody AuditingActUserFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - List list=workActUserService.getAuditingList(formDTO); - return new Result>().ok(list); + return new Result>().ok(workActUserService.getAuditingList(formDTO)); } @@ -51,8 +51,7 @@ public class WorkActUserController { @PostMapping("passedlist") public Result> getPassedList(@RequestBody AuditingActUserFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - List list=workActUserService.getPassedList(formDTO); - return new Result>().ok(list); + return new Result>().ok(workActUserService.getPassedList(formDTO)); } /** @@ -65,8 +64,7 @@ public class WorkActUserController { @PostMapping("rejectedlist") public Result> getRejectedlist(@RequestBody AuditingActUserFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - List list=workActUserService.getRejectedlist(formDTO); - return new Result>().ok(list); + return new Result>().ok(workActUserService.getRejectedlist(formDTO)); } /** @@ -77,10 +75,9 @@ public class WorkActUserController { * @Date 2020/7/22 16:23 **/ @PostMapping("canceledlist") - public Result getCanceledList(@RequestBody AuditingActUserFormDTO formDTO){ + public Result> getCanceledList(@RequestBody AuditingActUserFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - List list=workActUserService.getCanceledList(formDTO); - return new Result>().ok(list); + return new Result>().ok(workActUserService.getCanceledList(formDTO)); } /** @@ -93,8 +90,19 @@ public class WorkActUserController { @PostMapping("signupstat") public Result getActSignUpStat(@RequestBody AuditingActUserFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); - ActSignUpStatResultDTO resultDTO=workActUserService.getActSignUpStat(formDTO.getActId()); - return new Result().ok(resultDTO); + return new Result().ok(workActUserService.getActSignUpStat(formDTO.getActId())); } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 报名审核-人员详情 + * @Date 2020/7/22 22:44 + **/ + @PostMapping("userdetail") + public Result queryAuditingUserDetail(@RequestBody AactUserDetailFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, AactUserDetailFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActUserService.queryAuditingUserDetail(formDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java index 52b3034e75..6e02e27e48 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java @@ -18,8 +18,10 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ActUserLogDTO; import com.epmet.entity.ActUserLogEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 用户活动关系日志表 @@ -29,5 +31,24 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActUserLogDao extends BaseDao { - + + /** + * @return java.lang.Integer + * @param actId + * @param userId + * @author yinzuomei + * @description 被拒绝的总次数 + * @Date 2020/7/23 14:13 + **/ + Integer selectRefusedCount(@Param("actId") String actId, @Param("userId") String userId); + + /** + * @return com.epmet.dto.ActUserLogDTO + * @param actId + * @param userId + * @author yinzuomei + * @description 最后被拒绝的记录 + * @Date 2020/7/23 14:13 + **/ + ActUserLogDTO selectLatestRefused(@Param("actId") String actId, @Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index facb735601..0aa11f07ef 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -61,4 +61,31 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/22 18:20 **/ Integer selectCountUser(@Param("actId") String actId, @Param("status")String status); + + /** + * @return java.lang.Integer + * @param userId + * @author yinzuomei + * @description 实际参加活动个数(已经签到的) + * @Date 2020/7/23 15:56 + **/ + Integer countSignInActNum(String userId); + + /** + * @return java.lang.Integer + * @param userId + * @author yinzuomei + * @description 报名活动个数(act_user_realation) + * @Date 2020/7/23 15:57 + **/ + Integer countSignUpActNum(String userId); + + /** + * @return java.lang.Integer + * @param userId + * @author yinzuomei + * @description 获得积分活动个数 + * @Date 2020/7/23 15:57 + **/ + Integer countObtainPointsActNum(String userId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java index 101f3c9556..ac05ba61d1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 用户活动关系日志表 * @@ -50,13 +47,14 @@ public class ActUserLogEntity extends BaseEpmetEntity { /** * 操作类型(已报名/待审核auditing, -审核通过passed, -审核不通过refused -取消报名canceld, -发放积分rewarded -拒绝发放积分refuse_reward -重新处理processing -) + * 审核通过passed, + * 审核不通过refused + * 取消报名canceld, + * 已签到signedin + * 发放积分rewarded + * 拒绝发放积分refuse_reward + * 重新处理processing + * ) */ private String operationType; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java index 82b846a23a..640be2d5cf 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java @@ -1,5 +1,6 @@ package com.epmet.service; +import com.epmet.dto.form.work.AactUserDetailFormDTO; import com.epmet.dto.form.work.AuditingActUserFormDTO; import com.epmet.dto.result.work.*; @@ -56,4 +57,13 @@ public interface WorkActUserService { * @Date 2020/7/22 17:02 **/ ActSignUpStatResultDTO getActSignUpStat(String actId); + + /** + * @return com.epmet.dto.result.work.AuditingUserDetailResultDTO + * @param formDTO + * @author yinzuomei + * @description 报名审核-待审核人员详情 + * @Date 2020/7/22 22:44 + **/ + AuditingUserDetailResultDTO queryAuditingUserDetail(AactUserDetailFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index a28beae020..0a7004388b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -1,10 +1,15 @@ package com.epmet.service.impl; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ActConstant; import com.epmet.dao.ActInfoDao; +import com.epmet.dao.ActUserLogDao; +import com.epmet.dao.ActUserRelationDao; +import com.epmet.dto.ActUserLogDTO; import com.epmet.dto.ActUserRelationDTO; import com.epmet.dto.HeartUserInfoDTO; +import com.epmet.dto.form.work.AactUserDetailFormDTO; import com.epmet.dto.form.work.AuditingActUserFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.work.*; @@ -37,6 +42,10 @@ public class WorkActUserServiceImpl implements WorkActUserService { private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Autowired private ActInfoDao actInfoDao; + @Autowired + private ActUserLogDao actUserLogDao; + @Autowired + private ActUserRelationDao actUserRelationDao; /** * @param formDTO * @return java.util.List @@ -56,7 +65,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { //查询出待审核的人员id集合 List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_AUDITING); //根据待审核的人员集合,查询出用户基本信息 - List userInfoList=this.queryUserBaseInfo(userIdList); + List userInfoList=this.queryUserBaseInfoList(userIdList); for(ActUserRelationDTO actUserRelationDTO:actUserRelationDTOList){ AuditingActUserResultDTO auditingDTO=new AuditingActUserResultDTO(); auditingDTO.setActUserRelationId(actUserRelationDTO.getId()); @@ -98,7 +107,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { //查询已通过审核的人员id集合 List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_PASSED); //根据已通过的人员集合,查询出用户基本信息 - List userInfoList=this.queryUserBaseInfo(userIdList); + List userInfoList=this.queryUserBaseInfoList(userIdList); for(ActUserRelationDTO actUserRelationDTO:actUserRelationDTOList){ PassedActUserResultDTO passedDTO=new PassedActUserResultDTO(); passedDTO.setActUserRelationId(actUserRelationDTO.getId()); @@ -141,7 +150,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { //查询已拒绝审核的人员id集合 List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_REFUSED); //根据已拒绝的人员集合,查询出用户基本信息 - List userInfoList=this.queryUserBaseInfo(userIdList); + List userInfoList=this.queryUserBaseInfoList(userIdList); for(ActUserRelationDTO actUserRelationDTO:actUserRelationDTOList){ RejectedActUserResultDTO rejectedDTO=new RejectedActUserResultDTO(); rejectedDTO.setActUserRelationId(actUserRelationDTO.getId()); @@ -185,7 +194,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { //查询已取消审核的人员id集合 List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_CANCELD); //根据已取消的人员集合,查询出用户基本信息 - List userInfoList=this.queryUserBaseInfo(userIdList); + List userInfoList=this.queryUserBaseInfoList(userIdList); for(ActUserRelationDTO actUserRelationDTO:actUserRelationDTOList){ CanceledActUserResultDTO cancelDTO=new CanceledActUserResultDTO(); cancelDTO.setActUserRelationId(actUserRelationDTO.getId()); @@ -241,6 +250,89 @@ public class WorkActUserServiceImpl implements WorkActUserService { return actInfo; } + /** + * @param formDTO + * @return com.epmet.dto.result.work.AuditingUserDetailResultDTO + * @author yinzuomei + * @description 报名审核-待审核人员详情 + * @Date 2020/7/22 22:44 + **/ + @Override + public AuditingUserDetailResultDTO queryAuditingUserDetail(AactUserDetailFormDTO formDTO) { + ActUserRelationDTO actUserRelationDTO=actUserRelationService.get(formDTO.getActUserRelationId()); + UserBaseInfoResultDTO userBaseInfo=queryUserBaseInfo(actUserRelationDTO.getUserId()); + AuditingUserDetailResultDTO resultDTO=new AuditingUserDetailResultDTO(); + //基本信息赋值 + resultDTO.setActId(actUserRelationDTO.getActId()); + resultDTO.setUserId(actUserRelationDTO.getUserId()); + resultDTO.setRealName(userBaseInfo.getRealName()); + resultDTO.setGender(userBaseInfo.getGender()); + resultDTO.setMobile(userBaseInfo.getMobile()); + resultDTO.setIdNum(userBaseInfo.getIdNum()); + resultDTO.setAddress(userBaseInfo.getStreet()+userBaseInfo.getDistrict()+userBaseInfo.getBuildingAddress()); + resultDTO.setSignUpTime(actUserRelationDTO.getCreatedTime()); + /** + * 当前状态(已报名/待审核auditing, + 审核通过passed, + 审核不通过refused + 取消报名canceld, + ) + */ + resultDTO.setStatus(actUserRelationDTO.getStatus()); + HistoricalActInfo historicalActInfo=this.getHistoricalActInfo(actUserRelationDTO.getUserId()); + resultDTO.setHistoricalActInfo(historicalActInfo); + if(ActConstant.ACT_USER_STATUS_AUDITING.equals(resultDTO.getStatus())){ + //被拒绝过,才赋值 + Integer refusedCount=actUserLogDao.selectRefusedCount(actUserRelationDTO.getActId(),actUserRelationDTO.getUserId()); + if(null!=refusedCount&&refusedCount>0){ + ActUserLogDTO latestRefused=actUserLogDao.selectLatestRefused(actUserRelationDTO.getActId(),actUserRelationDTO.getUserId()); + HistoricalAuditResult historicalAuditResult=new HistoricalAuditResult(); + historicalAuditResult.setLatestAuditTime(latestRefused.getCreatedTime()); + historicalAuditResult.setLatestRefusedReason(latestRefused.getReason()); + historicalAuditResult.setRefusedCountDesc(String.format("已拒绝%s次",refusedCount)); + resultDTO.setHistoricalAuditResult(historicalAuditResult); + } + }else if(ActConstant.ACT_USER_STATUS_PASSED.equals(resultDTO.getStatus())||ActConstant.ACT_USER_STATUS_REFUSED.equals(resultDTO.getStatus())){ + AuditResult auditResult=new AuditResult(); + auditResult.setAuditTime(actUserRelationDTO.getAuditTime()); + auditResult.setRefusedReason(actUserRelationDTO.getFailureReason()); + resultDTO.setAuditResult(auditResult); + }else if(ActConstant.ACT_USER_STATUS_CANCELD.equals(resultDTO.getStatus())){ + CancelResult cancelResult=new CancelResult(); + cancelResult.setCancelReason(actUserRelationDTO.getCancelReason()); + cancelResult.setCancelTime(actUserRelationDTO.getCancelTime()); + resultDTO.setCancelResult(cancelResult); + } + return resultDTO; + } + + /** + * @return com.epmet.dto.result.work.HistoricalActInfo + * @param userId + * @author yinzuomei + * @description 用户历史活动情况 + * @Date 2020/7/23 15:56 + **/ + private HistoricalActInfo getHistoricalActInfo(String userId) { + HistoricalActInfo historicalActInfo=new HistoricalActInfo(); + /** + * 实际参加活动个数(已经签到的) + */ + Integer signInActNum=actUserRelationDao.countSignInActNum(userId); + historicalActInfo.setSignInActNum(signInActNum); + /** + * 报名活动个数(act_user_realation) + */ + Integer signUpActNum=actUserRelationDao.countSignUpActNum(userId); + historicalActInfo.setSignUpActNum(signUpActNum); + /** + * 获得积分活动个数 + */ + Integer obtainPointsActNum=actUserRelationDao.countObtainPointsActNum(userId); + historicalActInfo.setObtainPointsActNum(obtainPointsActNum); + return historicalActInfo; + } + private Boolean getVolunteerFlag(String userId) { HeartUserInfoDTO heartUserInfoDTO=heartUserInfoService.getByUserId(userId); //true: 是志愿者 false : 不是志愿者 @@ -257,7 +349,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) * @Date 2020/7/22 10:38 **/ - private List queryUserBaseInfo(List userIdList) { + private List queryUserBaseInfoList(List userIdList) { List userInfoList=new ArrayList<>(); if(null==userIdList||userIdList.size()==0){ return userInfoList; @@ -271,4 +363,22 @@ public class WorkActUserServiceImpl implements WorkActUserService { } return userInfoList; } + + /** + * @return com.epmet.dto.result.UserBaseInfoResultDTO + * @param userId + * @author yinzuomei + * @description 根据用户id获取用户基本信息 + * @Date 2020/7/23 12:52 + **/ + private UserBaseInfoResultDTO queryUserBaseInfo(String userId) { + List userIdList = new ArrayList<>(); + userIdList.add(userId); + //调用epemet_user服务获取用户的基本信息 + Result> resultUserList = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + if (!resultUserList.success() || resultUserList.getData().size() < 1 || null == resultUserList.getData().get(0)) { + throw new RenException("查询用户基本信息失败"); + } + return resultUserList.getData().get(0); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml index 67716c10d3..5df946833d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml @@ -16,6 +16,30 @@ - - + + + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index f7531ff65a..ff144eb5d6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -61,4 +61,39 @@ AND aur.`STATUS` =#{status} AND aur.ACT_ID = #{actId} + + + + + + + + + \ No newline at end of file From 37726c95ec15d7784114529d20dfb2b6cae7052a Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 23 Jul 2020 16:08:49 +0800 Subject: [PATCH 045/157] =?UTF-8?q?epmet-third=E3=80=81auth=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 10 +++++----- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 86a249e48c..feee4e4cb4 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.45 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.46 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index ce0e69d247..2184b88588 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.45 + 0.3.46 com.epmet epmet-cloud @@ -180,10 +180,10 @@ wx07674c23af51b521 a2fd0d29b007cbbcf8c8dda8c693d99b - - wx2679392c4cc2af22 - e5e72147737cfeb2b0f3a43624cadb3f + wx3d1372029eb816a3 + 651f02d71ed3f123dfb584b8bf0f4d8b + diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 9d6ee7c695..b2e925ea54 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.49 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.50 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index d32deba4f6..cd83aeb22a 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.49 + 0.0.50 com.epmet From 6471044f6ecf2f8534830cdd935f2e926c04eac8 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 23 Jul 2020 16:18:16 +0800 Subject: [PATCH 046/157] =?UTF-8?q?=E7=A7=AF=E5=88=86=E8=A7=84=E5=88=99?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/StrConstant.java | 10 + epmet-gateway/pom.xml | 4 +- .../src/main/resources/bootstrap.yml | 2 + .../java/com/epmet/dto/form/EventFormDTO.java | 4 +- .../com/epmet/controller/EventController.java | 10 +- .../java/com/epmet/entity/EventEntity.java | 5 +- .../java/com/epmet/enu/SysResponseEnum.java | 6 +- .../epmet/service/impl/EventServiceImpl.java | 11 - .../db/migration/epmet_common_service.sql | 37 +- .../src/main/resources/mapper/EventDao.xml | 2 +- .../com/epmet/dto/form/PointRuleFormDTO.java | 40 +- .../com/epmet/common/enu/PointUnitEnum.java | 8 +- .../com/epmet/common/enu/SysResponseEnum.java | 1 + .../com/epmet/config/MqSubcribeConfig.java | 4 +- .../epmet/controller/BackDoorController.java | 23 +- .../com/epmet/entity/PointRuleEntity.java | 28 +- .../epmet/entity/RuleOperateLogEntity.java | 4 +- .../service/impl/PointRuleServiceImpl.java | 47 ++- .../resources/db/migration/epmet_point.sql | 6 +- .../main/resources/mapper/PointRuleDao.xml | 4 +- .../resources/mapper/RuleOperateLogDao.xml | 5 +- .../feign/OperCustomizeOpenFeignClient.java | 6 +- .../OperCustomizeOpenFeignClientFallback.java | 3 - .../CustomerFunctionController.java | 2 +- .../impl/CustomerFunctionServiceImpl.java | 357 +++++++++--------- 25 files changed, 340 insertions(+), 289 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java index a7ae559a01..ef2e916937 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/StrConstant.java @@ -53,4 +53,14 @@ public interface StrConstant { * 反斜杠 */ String SEPARATOR = "/"; + + /** + * true + */ + String TRUE = "true"; + + /** + * true + */ + String FALSE = "false"; } diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 057ba37342..7839322d12 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -282,7 +282,7 @@ lb://epmet-heart-server - http://127.0.0.1:8112 + lb://epmet-point-server @@ -367,7 +367,7 @@ lb://epmet-heart-server - http://127.0.0.1:8112 + lb://epmet-point-server diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index c2105542bb..851ac62764 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -353,6 +353,8 @@ renren: - /resi/group/** - /resi/partymember/** - /gov/grid/** + - /heart/** + - /point/** management: endpoints: web: diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java index 2c72dd5e4b..10aadcb475 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/EventFormDTO.java @@ -77,8 +77,8 @@ public class EventFormDTO implements Serializable { /** * 事件功能分组ID 来自oper_customize.customer_function表 */ - @NotBlank(message = "事件功能分组ID不能为空",groups = {AddGroup.class}) - private String eventGroupId; + @NotBlank(message = "功能分组ID不能为空",groups = {AddGroup.class}) + private String functionId; /** * 是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值 diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java index f07730295b..a9a8108669 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java @@ -49,11 +49,11 @@ public class EventController { * "classId":"epmet_heart", * "appId":"202007161443499985fa2d397436d10356542134c8f008c48", * "appName":"党群e事通开发测试", - * "eventCode":"epmet_heart_active_send_point", - * "eventName":"活动发放积分", - * "eventDesc":"给参加活动的人发放积分", - * "eventGroupId":"1234", - * "isCommon":"1" + * "eventCode":"register_volunteer", + * "eventName":"认证志愿者", + * "eventDesc":"给注册志愿者的人发放积分", + * "functionId":"43addd0735230c01eedbb38d721076b0", + * "isCommon":"0" * } */ @PostMapping("addEvent") diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java index 391b11ad40..7db253d389 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/entity/EventEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 事件表 * @@ -71,7 +68,7 @@ public class EventEntity extends BaseEpmetEntity { /** * 事件功能分组ID 来自oper_customize.customer_function表 */ - private String eventGroupId; + private String functionId; /** * 是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值 diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java index a34883da65..373689f711 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/enu/SysResponseEnum.java @@ -11,17 +11,17 @@ public enum SysResponseEnum { * * 编码样式:【CCCBBOOXX】 * 编码示例说明: - * CCC 中心编码&业务系统 (120-内容扫描服务中心服务) + * CCC 中心编码&业务系统 (103-内容扫描服务中心服务) * BB 业务类型(00-默认 ) * OO 操作类型(00-默认) * */ /*通用枚举 */ - EXCEPTION(12001,"系统异常"), + EXCEPTION(10301,"系统异常"), /*事件 业务 01*/ - EVENT_HAS_ALREADY_EXIST(120010001,"事件已存在无需重复添加"), + EVENT_HAS_ALREADY_EXIST(103010001,"事件已存在无需重复添加"), ; private Integer code; diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java index fed5a58ed3..53f892b9a5 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java @@ -18,13 +18,10 @@ package com.epmet.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.EventDao; import com.epmet.dto.form.EventFormDTO; import com.epmet.entity.EventEntity; -import com.epmet.enu.SysResponseEnum; import com.epmet.service.EventService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -41,15 +38,7 @@ public class EventServiceImpl extends BaseServiceImpl imp @Override public void addEvent(EventFormDTO formDTO) { - if (baseDao.getCountByEventCode(formDTO.getEventCode()) > 0) { - log.warn("addEvent fail,msg:{}", SysResponseEnum.EVENT_HAS_ALREADY_EXIST.getMsg()); - return; - } - EventEntity eventEntity = ConvertUtils.sourceToTarget(formDTO, EventEntity.class); - if (eventEntity == null) { - throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); - } baseDao.insert(eventEntity); } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql index bcf0b493c7..2702dde08b 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/db/migration/epmet_common_service.sql @@ -418,21 +418,22 @@ INSERT INTO `calender` VALUES ('ffe45e7059c67874f88498cfcfd19b4c', 0, '20200424' SET FOREIGN_KEY_CHECKS = 1; #add by liujianjun 2020-07-16 -CREATE TABLE event( - ID VARCHAR(64) NOT NULL COMMENT '主键' , - CLASS_ID VARCHAR(32) COMMENT '消息网关事件类别ID 从消息网关获取事件类型Id' , - APP_ID VARCHAR(128) COMMENT '消息网关APP_ID' , - APP_NAME VARCHAR(32) COMMENT '消息网关APP_NAME' , - EVENT_CODE VARCHAR(32) COMMENT '事件标识 与消息网关事件tag一致' , - EVENT_NAME VARCHAR(32) COMMENT '事件名称' , - EVENT_DESC VARCHAR(64) COMMENT '事件说明' , - EVENT_GROUP_ID VARCHAR(512) COMMENT '事件功能分组ID 来自oper_customize.customer_function表' , - IS_COMMON VARCHAR(1) COMMENT '是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值' , - DEL_FLAG VARCHAR(1) COMMENT '删除标识 0-否,1-是' , - REVISION INT COMMENT '乐观锁 查询时添加版本号,新加的事件需要更新版本号' , - CREATED_BY VARCHAR(32) COMMENT '创建人' , - CREATED_TIME DATETIME COMMENT '创建时间' , - UPDATED_BY VARCHAR(32) COMMENT '更新人' , - UPDATED_TIME DATETIME COMMENT '更新时间' , - PRIMARY KEY (ID) -) COMMENT = '事件表'; +CREATE TABLE `event` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CLASS_ID` varchar(32) DEFAULT NULL COMMENT '消息网关事件类别ID 从消息网关获取事件类型Id', + `APP_ID` varchar(128) DEFAULT NULL COMMENT '消息网关APP_ID', + `APP_NAME` varchar(32) DEFAULT NULL COMMENT '消息网关APP_NAME', + `EVENT_CODE` varchar(32) DEFAULT NULL COMMENT '事件标识 与消息网关事件tag一致', + `EVENT_NAME` varchar(32) DEFAULT NULL COMMENT '事件名称', + `EVENT_DESC` varchar(64) DEFAULT NULL COMMENT '事件说明', + `FUNCTION_ID` varchar(64) DEFAULT NULL COMMENT '功能ID 来自oper_customize.customer_function表', + `IS_COMMON` varchar(1) DEFAULT NULL COMMENT '是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值', + `DEL_FLAG` varchar(1) DEFAULT NULL COMMENT '删除标识 0-否,1-是', + `REVISION` int(11) DEFAULT NULL COMMENT '乐观锁 查询时添加版本号,新加的事件需要更新版本号', + `CREATED_BY` varchar(32) DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime DEFAULT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`), + UNIQUE KEY `unx_event_code` (`EVENT_CODE`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='事件表'; diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml index 9865ab0efa..e5418337ad 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/EventDao.xml @@ -11,7 +11,7 @@ - + diff --git a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java index fca065c9d6..5d3c6dabfa 100644 --- a/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java +++ b/epmet-module/epmet-point/epmet-point-client/src/main/java/com/epmet/dto/form/PointRuleFormDTO.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup; import lombok.Data; import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; /** @@ -16,33 +17,51 @@ import java.io.Serializable; @Data public class PointRuleFormDTO implements Serializable { private static final long serialVersionUID = -3228252683629912008L; + + /** + * 客户Id + */ + @NotBlank(message = "客户Id不能为空", groups = {AddGroup.class, UpdateGroup.class}) + private String customerId; + /** * 积分规则Id */ @NotBlank(message = "积分规则Id不能为空", groups = UpdateGroup.class) private String ruleId; + + /** + * 功能Id + */ + @NotBlank(message = "功能Id不能为空", groups = {AddGroup.class}) + private String functionId; + + /** + * 积分规则名称 + */ + @NotBlank(message = "积分规则名称不能为空", groups = AddGroup.class) + private String ruleName; /** * 积分 */ - @NotBlank(message = "积分不能为空", groups = {AddGroup.class, UpdateGroup.class}) - private String point; + @NotNull(message = "积分不能为空", groups = {UpdateGroup.class}) + private Integer point; /** * 是否开启 */ - @NotBlank(message = "是否开启不能为空", groups = {AddGroup.class, UpdateGroup.class}) + @NotBlank(message = "是否开启不能为空", groups = {UpdateGroup.class}) private String enabledFlag; /** - * 上限开启 + * 是否启用 */ - @NotBlank(message = "积分上限不能为空", groups = {AddGroup.class, UpdateGroup.class}) - private String upLimit; + @NotNull(message = "积分上限不能为空", groups = {UpdateGroup.class}) + private Integer upLimit; /** - * 积分规则Id + * 积分上限描述 */ - @NotBlank(message = "客户Id不能为空", groups = {AddGroup.class, UpdateGroup.class}) - private String customerId; + private String upLimitDesc; //=======系统添加时的属性====== /** @@ -58,9 +77,8 @@ public class PointRuleFormDTO implements Serializable { private String eventCode; /** - * 操作类型 加积分:add;减积分:subtract + * 操作类型 加积分:plus;减积分:minus */ - @NotBlank(message = "操作类型不能为空", groups = AddGroup.class) private String operateType; /** * 获得积分单位 次:time;分钟:minute;小时:hour diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java index ab1d97453c..eefb1d8b4d 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/PointUnitEnum.java @@ -14,12 +14,12 @@ public enum PointUnitEnum { ; private String code; - private String name; + private String desc; PointUnitEnum(String code, String name) { this.code = code; - this.name = name; + this.desc = name; } public static PointUnitEnum getEnum(String code) { @@ -36,7 +36,7 @@ public enum PointUnitEnum { return code; } - public String getName() { - return name; + public String getDesc() { + return desc; } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java index e7ff400906..5ae3c00775 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/common/enu/SysResponseEnum.java @@ -24,6 +24,7 @@ public enum SysResponseEnum { /*积分规则 业务 01*/ THIRD_SERVICE_ERROR(112010001,"调用第三方接口异常"), POINT_RULE_IS_NOT_EXIST(112010002,"积分规则不存在"), + POINT_ENABLE_FLAG_PARAM_ERROR(112010003,"积分规则开启状态参数错误"), ; private Integer code; diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java index e7e1a33c7f..d8e6ceac75 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/config/MqSubcribeConfig.java @@ -30,8 +30,8 @@ public class MqSubcribeConfig { event.setBelongAppId("202007161443499985fa2d397436d10356542134c8f008c48"); event.setEventClass("epmet_heart"); event.setEventTag("active_send_point"); - String callbackUrl = "http://192.168.51.49/point/callback/sendPoint"; - callbackUrl = ""; + String callbackUrl = "http://192.168.1.119/point/callback/sendPoint"; + //callbackUrl = ""; event.setCallbackUrl(callbackUrl); List subscribeFormDTOList = new ArrayList<>(); subscribeFormDTOList.add(event); diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java index 9d2b01d291..5c9dc10f67 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/BackDoorController.java @@ -1,6 +1,7 @@ package com.epmet.controller; -import com.epmet.commons.tools.security.dto.TokenDto; +import com.alibaba.fastjson.JSON; +import com.epmet.common.enu.PointUnitEnum; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; @@ -28,13 +29,23 @@ public class BackDoorController { * @param formDTO * @return */ - @PostMapping(value = "sysadd") + @PostMapping(value = "addpointrule") public Result add(@RequestBody PointRuleFormDTO formDTO) { - TokenDto tokenDTO = new TokenDto(); - tokenDTO.setUserId("default"); - formDTO.setCustomerId(tokenDTO.getCustomerId()); ValidatorUtils.validateEntity(formDTO, AddGroup.class); - pointRuleService.add(tokenDTO, formDTO); + pointRuleService.add(null, formDTO); return new Result().ok(true); } + + public static void main(String[] args) { + PointRuleFormDTO formDTO = new PointRuleFormDTO(); + formDTO.setPoint(0); + formDTO.setUpLimit(0); + //微笑山东 + formDTO.setCustomerId("57a648d230bf459b18ea23fc278c3de7"); + formDTO.setRuleDesc("认证志愿者会获得积分"); + formDTO.setEventCode("register_volunteer"); + formDTO.setPointUnit(PointUnitEnum.TIME.getCode()); + System.out.println(JSON.toJSONString(formDTO)); + + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java index c2132a4292..dff7131269 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/PointRuleEntity.java @@ -57,6 +57,11 @@ public class PointRuleEntity extends BaseEpmetEntity { */ private String eventCode; + /** + * 功能分组Id + */ + private String functionId; + /** * 操作类型 加积分:add;减积分:subtract */ @@ -93,20 +98,21 @@ public class PointRuleEntity extends BaseEpmetEntity { if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; PointRuleEntity entity = (PointRuleEntity) o; - return customerId.equals(entity.customerId) && - ruleName.equals(entity.ruleName) && - ruleDesc.equals(entity.ruleDesc) && - eventCode.equals(entity.eventCode) && - operateType.equals(entity.operateType) && - upLimit.equals(entity.upLimit) && - upLimitDesc.equals(entity.upLimitDesc) && - point.equals(entity.point) && - pointUnit.equals(entity.pointUnit) && - enabledFlag.equals(entity.enabledFlag); + return Objects.equals(customerId, entity.customerId) && + Objects.equals(ruleName, entity.ruleName) && + Objects.equals(ruleDesc, entity.ruleDesc) && + Objects.equals(eventCode, entity.eventCode) && + Objects.equals(functionId, entity.functionId) && + Objects.equals(operateType, entity.operateType) && + Objects.equals(upLimit, entity.upLimit) && + Objects.equals(upLimitDesc, entity.upLimitDesc) && + Objects.equals(point, entity.point) && + Objects.equals(pointUnit, entity.pointUnit) && + Objects.equals(enabledFlag, entity.enabledFlag); } @Override public int hashCode() { - return Objects.hash(super.hashCode(), customerId, ruleName, ruleDesc, eventCode, operateType, upLimit, upLimitDesc, point, pointUnit, enabledFlag); + return Objects.hash(super.hashCode(), customerId, ruleName, ruleDesc, eventCode, functionId, operateType, upLimit, upLimitDesc, point, pointUnit, enabledFlag); } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java index 573a9f52da..b1bfa7c61a 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/entity/RuleOperateLogEntity.java @@ -30,7 +30,7 @@ import lombok.EqualsAndHashCode; */ @Data @EqualsAndHashCode(callSuper=false) -@TableName("sys_operate_log") +@TableName("rule_operate_log") public class RuleOperateLogEntity extends BaseEpmetEntity { private static final long serialVersionUID = 1L; @@ -58,7 +58,7 @@ public class RuleOperateLogEntity extends BaseEpmetEntity { /** * 变更前数据 JSON串 */ - private String befordData; + private String beforeData; /** * 变更后数据 JSON串 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java index 8e40169645..a0ef4fed91 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/service/impl/PointRuleServiceImpl.java @@ -21,6 +21,8 @@ import com.alibaba.fastjson.JSON; import com.epmet.common.enu.PointUnitEnum; import com.epmet.common.enu.SysResponseEnum; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.enums.CommonOperateTypeEnum; import com.epmet.commons.tools.exception.RenException; @@ -44,8 +46,10 @@ import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.PointRuleService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.ArrayList; @@ -111,7 +115,7 @@ public class PointRuleServiceImpl extends BaseServiceImpl fun != null).collect(Collectors.toList()); return result; @@ -123,43 +127,60 @@ public class PointRuleServiceImpl extends BaseServiceImpl UPDATE point_rule diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml index e20a977e8f..0569aa74b5 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/mapper/RuleOperateLogDao.xml @@ -6,11 +6,10 @@ - - + - + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index 8707b1cf55..81a0e35046 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -6,6 +6,9 @@ import com.epmet.dto.form.CustomerFunctionListFormDTO; import com.epmet.dto.result.DefaultFunctionListResultDTO; import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import java.util.List; @@ -17,5 +20,6 @@ import java.util.List; */ @FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeOpenFeignClientFallback.class) public interface OperCustomizeOpenFeignClient { - Result> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO); + @PostMapping(value = "/oper/customize/customerfunction/getOpenedFunctionList", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result> getOpenedFunctionList(@RequestBody CustomerFunctionListFormDTO formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index d8e2fa7249..ba959f424b 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -6,9 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.CustomerFunctionListFormDTO; import com.epmet.dto.result.DefaultFunctionListResultDTO; import com.epmet.feign.OperCustomizeOpenFeignClient; -import org.springframework.http.MediaType; import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.PostMapping; import java.util.List; @@ -26,7 +24,6 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe * @return */ @Override - @PostMapping(value = "/oper/customize/customerfunction/getOpenedFunctionList", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) public Result> getOpenedFunctionList(CustomerFunctionListFormDTO formDTO){ return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getOpenedFunctionList", formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java index 71e165696b..45f4a7ed95 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFunctionController.java @@ -133,7 +133,7 @@ public class CustomerFunctionController { * @param formDTO * @return */ - @PostMapping("openedfunctionlist") + @PostMapping("getOpenedFunctionList") public Result> getOpenedFunctionList(@RequestBody CustomerFunctionListFormDTO formDTO) { return new Result>().ok(customerFunctionService.getOpenedFunctionList(formDTO)); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java index dadf4257ea..8d57b09cdb 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFunctionServiceImpl.java @@ -17,7 +17,6 @@ package com.epmet.service.impl; -import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -63,185 +62,181 @@ import java.util.stream.Collectors; @Service public class CustomerFunctionServiceImpl extends BaseServiceImpl implements CustomerFunctionService { - @Autowired - private CustomerFunctionRedis customerFunctionRedis; - @Autowired - private FunctionDao functionDao; - @Autowired - private OperCrmFeignClient operCrmFeignClient; - - @Override - public PageData page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, CustomerFunctionDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); - - return ConvertUtils.sourceToTarget(entityList, CustomerFunctionDTO.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 CustomerFunctionDTO get(String id) { - CustomerFunctionEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, CustomerFunctionDTO.class); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void save(CustomerFunctionDTO dto) { - CustomerFunctionEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionEntity.class); - insert(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void update(CustomerFunctionDTO dto) { - CustomerFunctionEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionEntity.class); - updateById(entity); - } - - @Override - @Transactional(rollbackFor = Exception.class) - public void delete(String[] ids) { - // 逻辑删除(@TableLogic 注解) - baseDao.deleteBatchIds(Arrays.asList(ids)); - } - - /** - * @param formDTO - * @return - * @Author sun - * @Description 运营端-获取客户功能(已勾选、未勾选)详情列表 - **/ - @Override - public CustomerFunctionListResultDTO customerFunctionList(CustomerFunctionListFormDTO formDTO) { - CustomerFunctionListResultDTO resultDTO = new CustomerFunctionListResultDTO(); - //1:调用oper-crm服务。查询客户基本信息 - Result result = operCrmFeignClient.queryCustomerInfo(formDTO.getCustomerId()); - if (!result.success() || null == result.getData()) { - throw new RenException(CustomerFunctionConstant.SELECT_CUSTOMER_EXCEPTION); - } - CustomerDTO customerDTO = result.getData(); - resultDTO.setCustomerId(customerDTO.getId()); - resultDTO.setCustomerName(customerDTO.getCustomerName()); - resultDTO.setLogo(customerDTO.getLogo()); - - //2:查询所有已上架功能列表(默认、定制功能) - List funList = functionDao.selectShopFunctionList(NumConstant.ONE); - if(null==funList||funList.size() csList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId()); - - //4:封装数据,客户已拥有但已下架的功能不展示 - List defaultFunctionList = new ArrayList<>(); - List customizedFunctionList = new ArrayList<>(); - funList.forEach(fun -> { - //默认功能 - if (fun.getFunctionGroup() == NumConstant.ZERO) { - DefaultFunctionListResultDTO df = new DefaultFunctionListResultDTO(); - df.setFunctionId(fun.getId()); - df.setFunctionName(fun.getFunctionName()); - csList.forEach(cs -> { - if (fun.getId().equals(cs.getFunctionId())) { - df.setFlag(true); - } - }); - defaultFunctionList.add(df); - } - //定制功能 - if (fun.getFunctionGroup() == NumConstant.ONE) { - CustomizedFunctionListResultDTO cf = new CustomizedFunctionListResultDTO(); - cf.setFunctionId(fun.getId()); - cf.setFunctionName(fun.getFunctionName()); - csList.forEach(cs -> { - if (fun.getId().equals(cs.getFunctionId())) { - cf.setFlag(true); - } - }); - customizedFunctionList.add(cf); - } - }); - resultDTO.setDefaultFunctionList(defaultFunctionList); - resultDTO.setCustomizedFunctionList(customizedFunctionList); - return resultDTO; - } - - /** - * @param formDTO - * @return - * @Author sun - * @Description 运营端-保存客户功能关系数据 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public void saveCustomerFunction(SaveCustomerFunctionFormDTO formDTO) { - //1:逻辑删除旧的客户功能关联数据 - baseDao.updateByCustomerId(formDTO.getCustomerId()); - - //2:批量新增新的客户功能关系数据 - List entityList = new ArrayList<>(); - formDTO.getDefaultFunctionList().forEach(dfId -> { - CustomerFunctionEntity entity = new CustomerFunctionEntity(); - entity.setCustomerId(formDTO.getCustomerId()); - entity.setFunctionId(dfId); - entityList.add(entity); - }); - formDTO.getCustomizedFunctionList().forEach(cfId -> { - CustomerFunctionEntity entity = new CustomerFunctionEntity(); - entity.setCustomerId(formDTO.getCustomerId()); - entity.setFunctionId(cfId); - entityList.add(entity); - }); - insertBatch(entityList); - } - - @Override - public List getOpenedFunctionList(CustomerFunctionListFormDTO formDTO) { - if (StringUtils.isBlank(formDTO.getCustomerId())){ - throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); - } - List result = new ArrayList<>(); - //查询所有已上架功能列表(默认、定制功能) - List funList = functionDao.selectFunctionList(); - if(CollectionUtils.isEmpty(funList)){ - return result; - } - //查询当前客户已拥有的功能 - List openedList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId()); - if(CollectionUtils.isEmpty(openedList)){ - log.warn("getOpenedFunctionList customerId:{} have any function",formDTO.getCustomerId()); - return result; - } - Set openedFunIdSet = openedList.stream().map(CustomerFunctionDTO::getFunctionId).collect(Collectors.toSet()); - for (FunctionDTO function : funList) { - if (openedFunIdSet.contains(function.getId())) { - DefaultFunctionListResultDTO resultDTO = ConvertUtils.sourceToTarget(function, DefaultFunctionListResultDTO.class); - if (resultDTO == null) { - log.error("getOpenedFunctionList convert return null,function:{}", JSON.toJSONString(function)); - continue; - } - result.add(resultDTO); - } - } - return result; - } + @Autowired + private CustomerFunctionRedis customerFunctionRedis; + @Autowired + private FunctionDao functionDao; + @Autowired + private OperCrmFeignClient operCrmFeignClient; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomerFunctionDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerFunctionDTO.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 CustomerFunctionDTO get(String id) { + CustomerFunctionEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomerFunctionDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerFunctionDTO dto) { + CustomerFunctionEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerFunctionDTO dto) { + CustomerFunctionEntity entity = ConvertUtils.sourceToTarget(dto, CustomerFunctionEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 运营端-获取客户功能(已勾选、未勾选)详情列表 + **/ + @Override + public CustomerFunctionListResultDTO customerFunctionList(CustomerFunctionListFormDTO formDTO) { + CustomerFunctionListResultDTO resultDTO = new CustomerFunctionListResultDTO(); + //1:调用oper-crm服务。查询客户基本信息 + Result result = operCrmFeignClient.queryCustomerInfo(formDTO.getCustomerId()); + if (!result.success() || null == result.getData()) { + throw new RenException(CustomerFunctionConstant.SELECT_CUSTOMER_EXCEPTION); + } + CustomerDTO customerDTO = result.getData(); + resultDTO.setCustomerId(customerDTO.getId()); + resultDTO.setCustomerName(customerDTO.getCustomerName()); + resultDTO.setLogo(customerDTO.getLogo()); + + //2:查询所有已上架功能列表(默认、定制功能) + List funList = functionDao.selectShopFunctionList(NumConstant.ONE); + if (null == funList || funList.size() < NumConstant.ONE) { + return resultDTO; + } + + //3:查询当前客户已拥有的功能 + List csList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId()); + + //4:封装数据,客户已拥有但已下架的功能不展示 + List defaultFunctionList = new ArrayList<>(); + List customizedFunctionList = new ArrayList<>(); + funList.forEach(fun -> { + //默认功能 + if (fun.getFunctionGroup() == NumConstant.ZERO) { + DefaultFunctionListResultDTO df = new DefaultFunctionListResultDTO(); + df.setFunctionId(fun.getId()); + df.setFunctionName(fun.getFunctionName()); + csList.forEach(cs -> { + if (fun.getId().equals(cs.getFunctionId())) { + df.setFlag(true); + } + }); + defaultFunctionList.add(df); + } + //定制功能 + if (fun.getFunctionGroup() == NumConstant.ONE) { + CustomizedFunctionListResultDTO cf = new CustomizedFunctionListResultDTO(); + cf.setFunctionId(fun.getId()); + cf.setFunctionName(fun.getFunctionName()); + csList.forEach(cs -> { + if (fun.getId().equals(cs.getFunctionId())) { + cf.setFlag(true); + } + }); + customizedFunctionList.add(cf); + } + }); + resultDTO.setDefaultFunctionList(defaultFunctionList); + resultDTO.setCustomizedFunctionList(customizedFunctionList); + return resultDTO; + } + + /** + * @param formDTO + * @return + * @Author sun + * @Description 运营端-保存客户功能关系数据 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public void saveCustomerFunction(SaveCustomerFunctionFormDTO formDTO) { + //1:逻辑删除旧的客户功能关联数据 + baseDao.updateByCustomerId(formDTO.getCustomerId()); + + //2:批量新增新的客户功能关系数据 + List entityList = new ArrayList<>(); + formDTO.getDefaultFunctionList().forEach(dfId -> { + CustomerFunctionEntity entity = new CustomerFunctionEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setFunctionId(dfId); + entityList.add(entity); + }); + formDTO.getCustomizedFunctionList().forEach(cfId -> { + CustomerFunctionEntity entity = new CustomerFunctionEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setFunctionId(cfId); + entityList.add(entity); + }); + insertBatch(entityList); + } + + @Override + public List getOpenedFunctionList(CustomerFunctionListFormDTO formDTO) { + if (StringUtils.isBlank(formDTO.getCustomerId())) { + throw new RenException(EpmetErrorCode.INTERNAL_VALIDATE_ERROR.getMsg()); + } + List result = new ArrayList<>(); + //查询所有已上架功能列表(默认、定制功能) + List funList = functionDao.selectFunctionList(); + if (CollectionUtils.isEmpty(funList)) { + return result; + } + //查询当前客户已拥有的功能 + List openedList = baseDao.selectCustomerFunctionList(formDTO.getCustomerId()); + if (CollectionUtils.isEmpty(openedList)) { + log.warn("getOpenedFunctionList customerId:{} have any function", formDTO.getCustomerId()); + return result; + } + Set openedFunIdSet = openedList.stream().map(CustomerFunctionDTO::getFunctionId).collect(Collectors.toSet()); + return funList.stream().filter(fun -> openedFunIdSet.contains(fun.getId())) + .map(fun -> { + DefaultFunctionListResultDTO resultDTO = new DefaultFunctionListResultDTO(); + resultDTO.setFunctionId(fun.getId()); + resultDTO.setFunctionName(fun.getFunctionName()); + return resultDTO; + }).collect(Collectors.toList()); + } } \ No newline at end of file From 669306f6db0fca17d6792b6d455eea1ec6c01ee4 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Jul 2020 16:31:30 +0800 Subject: [PATCH 047/157] =?UTF-8?q?=E4=BF=AE=E6=94=B9footbar=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=EF=BC=8C=E5=A2=9E=E5=8A=A0app=5Ftype,order=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=EF=BC=8C=E7=94=A8=E4=BA=8E=E5=8C=BA=E5=88=86app?= =?UTF-8?q?=EF=BC=8C=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/FootBarFormDTO.java | 15 +++++++++++++++ .../com/epmet/controller/AppController.java | 13 ++++++++----- .../epmet/dto/form/CustomerFootBarFormDTO.java | 4 ++++ .../controller/CustomerFootBarController.java | 4 +++- .../java/com/epmet/dao/CustomerFootBarDao.java | 3 ++- .../epmet/service/CustomerFootBarService.java | 2 +- .../impl/CustomerFootBarServiceImpl.java | 4 ++-- .../migration/V0.0.2__add_footbar_columns.sql | 11 +++++++++++ .../resources/mapper/CustomerFootBarDao.xml | 18 +++++++++++++++++- 9 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/FootBarFormDTO.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.2__add_footbar_columns.sql diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/FootBarFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/FootBarFormDTO.java new file mode 100644 index 0000000000..c51b38cd87 --- /dev/null +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/FootBarFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +@Data +public class FootBarFormDTO { + //@NotBlank(message = "客户ID不能为空") + private String customerId; + + // 哪一个端:gov,resi + @NotBlank(message = "app类型不能为空") + private String appType; +} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java index 93fef03372..cc1d87e70b 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java @@ -3,6 +3,7 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.dto.form.FootBarFormDTO; import com.epmet.feign.OperCustomizeFeignClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; @@ -22,15 +23,17 @@ public class AppController { /** * 查询 - * @param formDTO * @return */ @PostMapping("getcustomerfootbars") - public Result> getCustomerFootBars(@RequestBody CustomerFootBarFormDTO formDTO) { - Result> result = operCustomizeFeign.getCustomerfootbars(formDTO); + public Result> getCustomerFootBars(@RequestBody FootBarFormDTO input) { + CustomerFootBarFormDTO form = new CustomerFootBarFormDTO(); + form.setCustomerId(input.getCustomerId()); + form.setAppType(input.getAppType()); + Result> result = operCustomizeFeign.getCustomerfootbars(form); if (CollectionUtils.isEmpty(result.getData())) { - formDTO.setCustomerId("default"); - result = operCustomizeFeign.getCustomerfootbars(formDTO); + form.setCustomerId("default"); + result = operCustomizeFeign.getCustomerfootbars(form); } return result; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java index 73b4c7b500..1d5218fd4b 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/CustomerFootBarFormDTO.java @@ -10,4 +10,8 @@ public class CustomerFootBarFormDTO { //@NotBlank(message = "客户ID不能为空") private String customerId; + // 哪一个端:gov,resi + @NotBlank(message = "app类型不能为空") + private String appType; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java index 895cbf6840..1be0943b60 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/CustomerFootBarController.java @@ -35,6 +35,7 @@ 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.LinkedList; import java.util.List; import java.util.Map; @@ -104,8 +105,9 @@ public class CustomerFootBarController { public Result> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); String customerId = formDTO.getCustomerId(); + String appType = formDTO.getAppType(); - List footbars = customerFootBarService.listCustomerFootBars(customerId); + List footbars = customerFootBarService.listCustomerFootBars(customerId, appType); List barDTOS = new LinkedList<>(); footbars.forEach(barEntity -> { CustomerFootBarDTO barDTO = new CustomerFootBarDTO(); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java index f22bc917ad..480e148b60 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerFootBarDao.java @@ -33,5 +33,6 @@ import java.util.List; @Mapper public interface CustomerFootBarDao extends BaseDao { - List listCustomerFootBars(@Param("customerId") String customerId); + List listCustomerFootBars(@Param("customerId") String customerId, + @Param("appType") String appType); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java index f3a793793d..f38eab950d 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/CustomerFootBarService.java @@ -93,5 +93,5 @@ public interface CustomerFootBarService extends BaseService listCustomerFootBars(String customerId); + List listCustomerFootBars(String customerId, String appType); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java index 15336d92fc..417555be13 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/CustomerFootBarServiceImpl.java @@ -102,8 +102,8 @@ public class CustomerFootBarServiceImpl extends BaseServiceImpl listCustomerFootBars(String customerId) { - return baseDao.listCustomerFootBars(customerId); + public List listCustomerFootBars(String customerId, String appType) { + return baseDao.listCustomerFootBars(customerId, appType); } } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.2__add_footbar_columns.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.2__add_footbar_columns.sql new file mode 100644 index 0000000000..dc5ac2da3f --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.2__add_footbar_columns.sql @@ -0,0 +1,11 @@ +alter table customer_foot_bar add column `app_type` varchar(20) not null after `CUSTOMER_ID`; +alter table customer_foot_bar add column `order` int(2) not null after `SELECTED_ICON_PATH`; + +update customer_foot_bar set `app_type`='gov' , `order`=1 where CUSTOMER_ID='default' and BAR_KEY='work'; +update customer_foot_bar set `app_type`='gov' , `order`=2 where CUSTOMER_ID='default' and BAR_KEY='org'; +update customer_foot_bar set `app_type`='gov' , `order`=3 where CUSTOMER_ID='default' and BAR_KEY='data'; +update customer_foot_bar set `app_type`='gov' , `order`=4 where CUSTOMER_ID='default' and BAR_KEY='find'; + +INSERT INTO epmet_oper_customize.customer_foot_bar (ID, CUSTOMER_ID, app_type, BAR_KEY, BAR_NAME, PAGE_TITLE, ICON_PATH, SELECTED_ICON_PATH, `order`, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) VALUES (uuid(), 'default', 'resi', 'garden', '党建园地', '党建园地', null, null, 1, 0, 0, 'APP_USER', now(), 'APP_USER', now()); +INSERT INTO epmet_oper_customize.customer_foot_bar (ID, CUSTOMER_ID, app_type, BAR_KEY, BAR_NAME, PAGE_TITLE, ICON_PATH, SELECTED_ICON_PATH, `order`, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) VALUES (uuid(), 'default', 'resi', 'issue', '党群议事', '党群议事', null, null, 2, 0, 0, 'APP_USER', now(), 'APP_USER', now()); +INSERT INTO epmet_oper_customize.customer_foot_bar (ID, CUSTOMER_ID, app_type, BAR_KEY, BAR_NAME, PAGE_TITLE, ICON_PATH, SELECTED_ICON_PATH, `order`, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME) VALUES (uuid(), 'default', 'resi', 'group', '楼院小组', '楼院小组', null, null, 3, 0, 0, 'APP_USER', now(), 'APP_USER', now()); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml index a11df38ba6..e026e29859 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml @@ -21,13 +21,29 @@ From 0d9d30ef15451c54d8e18f13140c0158b71c4c57 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 23 Jul 2020 17:04:08 +0800 Subject: [PATCH 048/157] =?UTF-8?q?heart-work:=E6=8A=A5=E5=90=8D=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8-=E4=BA=BA=E5=91=98=E5=8E=86=E5=8F=B2=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E6=83=85=E5=86=B5api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/work/UserHistoricalActFormDTO.java | 22 ++++++++ .../result/work/UserHistoricalActInfoDTO.java | 56 +++++++++++++++++++ .../work/UserHistoricalActResultDTO.java | 54 ++++++++++++++++++ .../controller/WorkActUserController.java | 14 +++++ .../com/epmet/dao/ActUserRelationDao.java | 10 ++++ .../com/epmet/service/WorkActUserService.java | 10 ++++ .../service/impl/WorkActUserServiceImpl.java | 27 +++++++++ .../resources/mapper/ActUserRelationDao.xml | 27 +++++++++ 8 files changed, 220 insertions(+) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/UserHistoricalActFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActInfoDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActResultDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/UserHistoricalActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/UserHistoricalActFormDTO.java new file mode 100644 index 0000000000..26e2944e35 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/UserHistoricalActFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.dto.form.work; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 报名审核-人员历史活动情况入参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 16:12 + */ +@Data +public class UserHistoricalActFormDTO implements Serializable { + public interface AddUserInternalGroup {} + /** + * 居民端用户id + */ + @NotBlank(message = "居民端用户id不能为空", groups = {AddUserInternalGroup.class}) + private String userId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActInfoDTO.java new file mode 100644 index 0000000000..c4bbb1f100 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActInfoDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 历史活动列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 16:19 + */ +@Data +public class UserHistoricalActInfoDTO implements Serializable { + private static final long serialVersionUID = 3703921511083310251L; + /** + * 活动id + */ + private String actId; + /** + * 活动标题 + */ + private String title; + /** + * 活动地址 + */ + private String actAddress; + /** + * 签到时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signInTime; + /** + * 服务时长单位120分钟 + */ + private Integer kindNessTime; + /** + * 可得积分 + */ + private Integer reward; + /** + * 正常发放:agree, 拒绝发放:deny + */ + private String rewardFlag; + /** + * 拒绝给分的理由 + */ + private String denyRewardReason; + + /** + * 已处理: handled; 默认"",重新处理时reward_flag置为空字符串 + */ + private String processFlag; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActResultDTO.java new file mode 100644 index 0000000000..a6046ffd63 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/UserHistoricalActResultDTO.java @@ -0,0 +1,54 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 16:15 + */ +@Data +public class UserHistoricalActResultDTO implements Serializable { + private static final long serialVersionUID = 7437428110692437615L; + /** + * 居民端用户id + */ + private String userId; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * 昵称 + */ + private String nickName; + + /** + * 姓名 + */ + private String realName; + + /** + * 实际参加活动个数 + */ + private Integer signInActNum; + /** + * 报名活动个数 + */ + private Integer signUpActNum; + /** + * 获得积分活动个数 + */ + private Integer obtainPointsActNum; + + /** + *历史活动列表 + */ + private List actInfoList; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java index 44a3151650..2e280d6cce 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.work.AactUserDetailFormDTO; import com.epmet.dto.form.work.AuditingActUserFormDTO; +import com.epmet.dto.form.work.UserHistoricalActFormDTO; import com.epmet.dto.result.work.*; import com.epmet.service.WorkActUserService; import org.springframework.beans.factory.annotation.Autowired; @@ -105,4 +106,17 @@ public class WorkActUserController { ValidatorUtils.validateEntity(formDTO, AactUserDetailFormDTO.AddUserInternalGroup.class); return new Result().ok(workActUserService.queryAuditingUserDetail(formDTO)); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 报名审核-人员历史活动情况 + * @Date 2020/7/23 16:12 + **/ + @PostMapping("historicalact") + public Result queryUserHistoricalAct(@RequestBody UserHistoricalActFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, UserHistoricalActFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActUserService.queryUserHistoricalAct(formDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index 547ea17bc7..2c901f5717 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -19,6 +19,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.result.work.UserHistoricalActInfoDTO; import com.epmet.entity.ActUserRelationEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -108,4 +109,13 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/23 15:57 **/ Integer countObtainPointsActNum(String userId); + + /** + * @return java.util.List + * @param userId + * @author yinzuomei + * @description 根据userId,查询参与活动记录 + * @Date 2020/7/23 16:46 + **/ + List selectAllByUserId(String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java index 640be2d5cf..cfa875b824 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java @@ -2,6 +2,7 @@ package com.epmet.service; import com.epmet.dto.form.work.AactUserDetailFormDTO; import com.epmet.dto.form.work.AuditingActUserFormDTO; +import com.epmet.dto.form.work.UserHistoricalActFormDTO; import com.epmet.dto.result.work.*; import java.util.List; @@ -66,4 +67,13 @@ public interface WorkActUserService { * @Date 2020/7/22 22:44 **/ AuditingUserDetailResultDTO queryAuditingUserDetail(AactUserDetailFormDTO formDTO); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 报名审核-人员历史活动情况 + * @Date 2020/7/23 16:16 + **/ + UserHistoricalActResultDTO queryUserHistoricalAct(UserHistoricalActFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index 0a7004388b..50dd295bf1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.dto.ActUserRelationDTO; import com.epmet.dto.HeartUserInfoDTO; import com.epmet.dto.form.work.AactUserDetailFormDTO; import com.epmet.dto.form.work.AuditingActUserFormDTO; +import com.epmet.dto.form.work.UserHistoricalActFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.work.*; import com.epmet.feign.EpmetUserOpenFeignClient; @@ -306,6 +307,32 @@ public class WorkActUserServiceImpl implements WorkActUserService { return resultDTO; } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 报名审核-人员历史活动情况 + * @Date 2020/7/23 16:16 + **/ + @Override + public UserHistoricalActResultDTO queryUserHistoricalAct(UserHistoricalActFormDTO formDTO) { + UserHistoricalActResultDTO resultDTO=new UserHistoricalActResultDTO(); + UserBaseInfoResultDTO userBaseInfoResultDTO=this.queryUserBaseInfo(formDTO.getUserId()); + //基本信息 + resultDTO.setUserId(formDTO.getUserId()); + resultDTO.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + resultDTO.setNickName(userBaseInfoResultDTO.getNickname()); + resultDTO.setRealName(userBaseInfoResultDTO.getRealName()); + //参与活动统计值 + HistoricalActInfo historicalActInfo=getHistoricalActInfo(formDTO.getUserId()); + resultDTO.setSignInActNum(historicalActInfo.getSignInActNum()); + resultDTO.setSignUpActNum(historicalActInfo.getSignUpActNum()); + resultDTO.setObtainPointsActNum(historicalActInfo.getObtainPointsActNum()); + //历史活动列表 + resultDTO.setActInfoList(actUserRelationDao.selectAllByUserId(formDTO.getUserId())); + return resultDTO; + } + /** * @return com.epmet.dto.result.work.HistoricalActInfo * @param userId diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index 5d54c3309b..1c60d1b7af 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -129,4 +129,31 @@ and REWARD_FLAG='agree' AND acu.USER_ID = #{userId} + + + From 97c97299bf0401403e5e6009fd92dfbe13d09b0b Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Jul 2020 17:30:36 +0800 Subject: [PATCH 049/157] =?UTF-8?q?resi=5Fmine=EF=BC=8C=E5=A2=9E=E5=8A=A0a?= =?UTF-8?q?pp/footbars=E6=8E=A5=E5=8F=A3=EF=BC=8C=E7=94=A8=E4=BA=8E?= =?UTF-8?q?=E8=8E=B7=E5=8F=96footbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...BarFormDTO.java => GovFootBarFormDTO.java} | 8 +--- .../com/epmet/controller/AppController.java | 11 +++--- .../epmet/feign/OperCustomizeFeignClient.java | 21 ---------- .../OperCustomizeFeignClientFallBack.java | 22 ----------- .../feign/OperCustomizeOpenFeignClient.java | 11 ++++++ .../OperCustomizeOpenFeignClientFallback.java | 11 ++++++ .../epmet/entity/CustomerFootBarEntity.java | 4 ++ .../resources/mapper/CustomerFootBarDao.xml | 6 ++- .../mine/dto/from/ResiFootBarFormDTO.java | 10 +++++ .../resi-mine/resi-mine-server/pom.xml | 7 ++++ .../modules/app/controller/AppController.java | 39 +++++++++++++++++++ 11 files changed, 95 insertions(+), 55 deletions(-) rename epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/{FootBarFormDTO.java => GovFootBarFormDTO.java} (56%) delete mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java delete mode 100644 epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java create mode 100644 epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/ResiFootBarFormDTO.java create mode 100644 epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/app/controller/AppController.java diff --git a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/FootBarFormDTO.java b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/GovFootBarFormDTO.java similarity index 56% rename from epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/FootBarFormDTO.java rename to epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/GovFootBarFormDTO.java index c51b38cd87..79951ec2a3 100644 --- a/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/FootBarFormDTO.java +++ b/epmet-module/gov-mine/gov-mine-client/src/main/java/com/epmet/dto/form/GovFootBarFormDTO.java @@ -5,11 +5,7 @@ import lombok.Data; import javax.validation.constraints.NotBlank; @Data -public class FootBarFormDTO { +public class GovFootBarFormDTO { //@NotBlank(message = "客户ID不能为空") private String customerId; - - // 哪一个端:gov,resi - @NotBlank(message = "app类型不能为空") - private String appType; -} +} \ No newline at end of file diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java index cc1d87e70b..d1ab11b618 100644 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java +++ b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/controller/AppController.java @@ -1,10 +1,11 @@ package com.epmet.controller; +import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.form.CustomerFootBarFormDTO; -import com.epmet.dto.form.FootBarFormDTO; -import com.epmet.feign.OperCustomizeFeignClient; +import com.epmet.dto.form.GovFootBarFormDTO; +import com.epmet.feign.OperCustomizeOpenFeignClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.PostMapping; @@ -19,17 +20,17 @@ import java.util.List; public class AppController { @Autowired - private OperCustomizeFeignClient operCustomizeFeign; + private OperCustomizeOpenFeignClient operCustomizeFeign; /** * 查询 * @return */ @PostMapping("getcustomerfootbars") - public Result> getCustomerFootBars(@RequestBody FootBarFormDTO input) { + public Result> getCustomerFootBars(@RequestBody GovFootBarFormDTO input) { CustomerFootBarFormDTO form = new CustomerFootBarFormDTO(); form.setCustomerId(input.getCustomerId()); - form.setAppType(input.getAppType()); + form.setAppType(AppClientConstant.APP_GOV); Result> result = operCustomizeFeign.getCustomerfootbars(form); if (CollectionUtils.isEmpty(result.getData())) { form.setCustomerId("default"); diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java deleted file mode 100644 index a645d0d44b..0000000000 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/OperCustomizeFeignClient.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.epmet.feign; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerFootBarDTO; -import com.epmet.dto.form.CustomerFootBarFormDTO; -import com.epmet.feign.fallback.OperCustomizeFeignClientFallBack; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -import java.util.List; - -@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeFeignClientFallBack.class) -public interface OperCustomizeFeignClient { - - @PostMapping(value = "/oper/customize/customerfootbar/customerfootbars", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) - Result> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO); - -} diff --git a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java b/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java deleted file mode 100644 index 6f343f3857..0000000000 --- a/epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/feign/fallback/OperCustomizeFeignClientFallBack.java +++ /dev/null @@ -1,22 +0,0 @@ -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.CustomerFootBarDTO; -import com.epmet.dto.form.CustomerFootBarFormDTO; -import com.epmet.dto.form.CustomerHomeFormDTO; -import com.epmet.dto.result.HomeDesignByCustomerResultDTO; -import com.epmet.feign.OperCustomizeFeignClient; -import org.springframework.stereotype.Component; - -import java.util.List; - -@Component -public class OperCustomizeFeignClientFallBack implements OperCustomizeFeignClient { - - @Override - public Result> getCustomerfootbars(CustomerFootBarFormDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCustomerfootbars",formDTO); - } -} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index 9e81857ef7..de1c9c2f83 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -1,9 +1,17 @@ package com.epmet.feign; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; import org.springframework.cloud.openfeign.FeignClient; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 @@ -14,4 +22,7 @@ import com.epmet.feign.fallback.OperCustomizeOpenFeignClientFallback; @FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeOpenFeignClientFallback.class) public interface OperCustomizeOpenFeignClient { + @PostMapping(value = "/oper/customize/customerfootbar/customerfootbars", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) + Result> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO); + } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index 7b912afc73..0659ab1725 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -1,8 +1,15 @@ 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.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; import com.epmet.feign.OperCustomizeOpenFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -11,4 +18,8 @@ import org.springframework.stereotype.Component; */ @Component public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFeignClient { + @Override + public Result> getCustomerfootbars(CustomerFootBarFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCustomerfootbars", formDTO); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java index 8bfc92afb1..2161fc4bdc 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/CustomerFootBarEntity.java @@ -48,6 +48,8 @@ public class CustomerFootBarEntity extends BaseEpmetEntity { */ private String barKey; + private String appType; + /** * 页面标题 */ @@ -63,4 +65,6 @@ public class CustomerFootBarEntity extends BaseEpmetEntity { */ private String selectedIconPath; + private Integer order; + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml index e026e29859..e41b42ddb3 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerFootBarDao.xml @@ -7,9 +7,11 @@ + + @@ -26,6 +28,7 @@ app_type, bar_key, bar_name, + app_type, page_title, icon_path, selected_icon_path, @@ -35,7 +38,8 @@ created_by, created_time, updated_by, - updated_time + updated_time, + `order` FROM customer_foot_bar diff --git a/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/ResiFootBarFormDTO.java b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/ResiFootBarFormDTO.java new file mode 100644 index 0000000000..b29c4099d7 --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-client/src/main/java/com/epmet/resi/mine/dto/from/ResiFootBarFormDTO.java @@ -0,0 +1,10 @@ +package com.epmet.resi.mine.dto.from; + +import lombok.Data; + +@Data +public class ResiFootBarFormDTO { + + private String customerId; + +} diff --git a/epmet-module/resi-mine/resi-mine-server/pom.xml b/epmet-module/resi-mine/resi-mine-server/pom.xml index 37e10716a0..c5d6204657 100644 --- a/epmet-module/resi-mine/resi-mine-server/pom.xml +++ b/epmet-module/resi-mine/resi-mine-server/pom.xml @@ -83,6 +83,13 @@ 2.0.0 compile + + + com.epmet + oper-customize-client + 2.0.0 + compile + diff --git a/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/app/controller/AppController.java b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/app/controller/AppController.java new file mode 100644 index 0000000000..a446f0dc1b --- /dev/null +++ b/epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/modules/app/controller/AppController.java @@ -0,0 +1,39 @@ +package com.epmet.modules.app.controller; + +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerFootBarDTO; +import com.epmet.dto.form.CustomerFootBarFormDTO; +import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.resi.mine.dto.from.ResiFootBarFormDTO; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.CollectionUtils; +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; + +@RestController +@RequestMapping("app") +public class AppController { + + @Autowired + private OperCustomizeOpenFeignClient operCustomizeFeign; + + @PostMapping("footbar") + public Result getResiFootBars(@RequestBody ResiFootBarFormDTO input) { + CustomerFootBarFormDTO form = new CustomerFootBarFormDTO(); + form.setCustomerId(input.getCustomerId()); + form.setAppType(AppClientConstant.APP_RESI); + Result> result = operCustomizeFeign.getCustomerfootbars(form); + if (CollectionUtils.isEmpty(result.getData())) { + form.setCustomerId("default"); + result = operCustomizeFeign.getCustomerfootbars(form); + } + return result; + + } + +} From 59780e83d0ced2f5091445c8a842d9e1892f4198 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Jul 2020 17:32:17 +0800 Subject: [PATCH 050/157] =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=B7=E6=89=8B?= =?UTF-8?q?=E6=9C=BA=E6=B3=A8=E5=86=8C=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PublicUserLoginController.java | 14 +++++++ .../epmet/service/PublicUserLoginService.java | 9 +++++ .../impl/PublicUserLoginServiceImpl.java | 40 +++++++++++++++++-- .../epmet/dto/result/RegisterResultDTO.java | 31 ++++++++++++++ .../epmet/feign/EpmetThirdFeignClient.java | 15 +++++-- .../EpmetThirdFeignClientFallback.java | 11 +++-- .../controller/PaCustomerController.java | 7 +--- .../com/epmet/service/PaCustomerService.java | 2 +- .../service/impl/PaCustomerServiceImpl.java | 11 ++++- .../service/impl/WxLoginServiceImpl.java | 12 ++++-- 10 files changed, 128 insertions(+), 24 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterResultDTO.java diff --git a/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java index d083b2a26b..85163f625c 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/PublicUserLoginController.java @@ -9,6 +9,7 @@ import com.epmet.constant.PublicUserLoginConstant; import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO; import com.epmet.dto.form.PublicSendSmsCodeFormDTO; +import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.PublicUserLoginService; import org.springframework.beans.factory.annotation.Autowired; @@ -70,5 +71,18 @@ public class PublicUserLoginController { return new Result().ok(publicUserLoginService.loginByPhone(tokenDTO, formDTO)); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-手机号注册 + **/ + @PostMapping(value = "/register") + public Result register(@LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, RegisterFormDTO.AddUserInternalGroup.class, RegisterFormDTO.AddUserShowGroup.class); + formDTO.setUserId(tokenDTO.getUserId()); + return new Result().ok(publicUserLoginService.register(formDTO)); + } + } diff --git a/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java b/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java index 0ee6449c90..80fd7ea305 100644 --- a/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/PublicUserLoginService.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.LoginByPhoneFormDTO; import com.epmet.dto.form.PaWxCodeFormDTO; import com.epmet.dto.form.PublicSendSmsCodeFormDTO; +import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.result.UserTokenResultDTO; /** @@ -38,4 +39,12 @@ public interface PublicUserLoginService { **/ UserTokenResultDTO loginByPhone(TokenDto tokenDTO, LoginByPhoneFormDTO formDTO); + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-手机号注册 + **/ + UserTokenResultDTO register(RegisterFormDTO formDTO); + } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index 6d0e615944..f626ec6814 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -1,8 +1,10 @@ package com.epmet.service.impl; import com.epmet.common.token.constant.LoginConstant; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.DateUtils; @@ -14,10 +16,7 @@ import com.epmet.dto.PaCustomerDTO; import com.epmet.dto.PaUserDTO; import com.epmet.dto.PaUserWechatDTO; import com.epmet.dto.form.*; -import com.epmet.dto.result.CustomerUserResultDTO; -import com.epmet.dto.result.SaveUserResultDTO; -import com.epmet.dto.result.SendVerificationCodeResultDTO; -import com.epmet.dto.result.UserTokenResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetThirdFeignClient; import com.epmet.jwt.JwtTokenProperties; @@ -33,8 +32,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -242,4 +243,35 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { return userTokenResultDTO; } + /** + * @param formDTO + * @return + * @Author sun + * @Description 公众号-手机号注册 + **/ + @Override + public UserTokenResultDTO register(RegisterFormDTO formDTO) { + //1.调用epmet-third服务,完成信息注册 + Result result = epmetThirdFeignClient.register(formDTO); + if (!result.success()) { + logger.error("调用epmet_third服务初始化用户信息失败"); + throw new RenException(result.getCode()); + } + RegisterResultDTO resultDTO = result.getData(); + + //2.直接生成一个新的token放入缓存中(不管缓存中是否存在旧的token,都重新生成) + //2-1.生成token + String token = this.generateGovWxmpToken(resultDTO.getUserId()); + //2-2.token存入redis + String openid = resultDTO.getOpenId(); + String unionId = (null == resultDTO.getUnionId() ? "" : resultDTO.getUnionId()); + this.saveLatestGovTokenDto("", resultDTO.getUserId(), openid, unionId, token); + + //3.返回token + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + return userTokenResultDTO; + } + + } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterResultDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterResultDTO.java new file mode 100644 index 0000000000..2198a52459 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/RegisterResultDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author sun + * @Description 公众号-手机号注册-接口返参 + */ +@Data +public class RegisterResultDTO implements Serializable { + + private static final long serialVersionUID = 3253989119352850315L; + + /** + * userId + */ + private String userId; + + /** + * 用户微信openid + */ + private String openId; + + /** + * 用户微信unionId + */ + private String unionId; + +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java index 5a91825392..ff62e37885 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/EpmetThirdFeignClient.java @@ -3,12 +3,10 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.UserWechatDTO; +import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.form.SaveUserVisitedFormDTO; import com.epmet.dto.form.WxLoginFormDTO; -import com.epmet.dto.result.CustomerUserResultDTO; -import com.epmet.dto.result.InitCustomerResultDTO; -import com.epmet.dto.result.PublicCustomerResultDTO; -import com.epmet.dto.result.SaveUserResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.fallback.EpmetThirdFeignClientFallback; import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.springframework.cloud.openfeign.FeignClient; @@ -106,4 +104,13 @@ public interface EpmetThirdFeignClient { **/ @PostMapping(value = "third/customermp/getcustomermsg/{appId}") Result getCustomerMsg(@PathVariable("appId") String appId); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 用户登陆,新增访问记录数据 + **/ + @PostMapping(value = "third/pacustomer/register") + Result register(@RequestBody RegisterFormDTO formDTO); } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java index fda713210f..d3d97faa1a 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/feign/fallback/EpmetThirdFeignClientFallback.java @@ -4,12 +4,10 @@ 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.UserWechatDTO; +import com.epmet.dto.form.RegisterFormDTO; import com.epmet.dto.form.SaveUserVisitedFormDTO; import com.epmet.dto.form.WxLoginFormDTO; -import com.epmet.dto.result.CustomerUserResultDTO; -import com.epmet.dto.result.InitCustomerResultDTO; -import com.epmet.dto.result.PublicCustomerResultDTO; -import com.epmet.dto.result.SaveUserResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetThirdFeignClient; import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.springframework.stereotype.Component; @@ -65,4 +63,9 @@ public class EpmetThirdFeignClientFallback implements EpmetThirdFeignClient { public Result getCustomerMsg(String appId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "getCustomerMsg", appId); } + + @Override + public Result register(RegisterFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_THIRD_SERVER, "register", formDTO); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java index 519a1a4cc4..8ed2ff7fd9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/PaCustomerController.java @@ -45,11 +45,8 @@ public class PaCustomerController { * @Description 公众号-手机号注册 **/ @PostMapping("register") - public Result register(@LoginUser TokenDto tokenDTO, @RequestBody RegisterFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, RegisterFormDTO.AddUserInternalGroup.class, RegisterFormDTO.AddUserShowGroup.class); - formDTO.setUserId(tokenDTO.getUserId()); - paCustomerService.register(formDTO); - return new Result(); + public Result register(@RequestBody RegisterFormDTO formDTO) { + return new Result().ok(paCustomerService.register(formDTO)); } /** diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java index 87bd164d01..addf9d6d53 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PaCustomerService.java @@ -105,7 +105,7 @@ public interface PaCustomerService extends BaseService { * @Author sun * @Description 公众号-手机号注册 **/ - void register(RegisterFormDTO formDTO); + RegisterResultDTO register(RegisterFormDTO formDTO); /** * @return diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java index 577b025dff..62fdde3a8c 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java @@ -154,7 +154,8 @@ public class PaCustomerServiceImpl extends BaseServiceImpl hashMap = JSON.parseObject(resultStr, HashMap.class); - if (null != hashMap.get("errorCode")) { + if (null != hashMap.get("errcode")) { logger.error("wxcode换取openid接口调用失败"); - throw new RenException(hashMap.get("errorMsg")); + throw new RenException(hashMap.get("errmsg")); } String openid = hashMap.get("openid"); String sessionKey = hashMap.get("session_key"); @@ -60,15 +60,19 @@ public class WxLoginServiceImpl implements WxLoginService { //2.换取用户基本信息 //小程序access_token Map accessMap = redisUtils.hGetAll(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + ":" + customerId + ":" + clientType); + if(null==accessMap.get("authorizer_access_token")){ + logger.error("获取缓存中小程序access_token失败"); + throw new RenException("access_token获取失败"); + } Map hash = new HashMap<>(); hash.put("access_token", accessMap.get("authorizer_access_token")); hash.put("openid", openid); hash.put("lang", "zh_CN"); String getStr = HttpClientManager.getInstance().sendGet(WxLoginConstant.OPENID_TO_INFORMATION, map).getData(); HashMap resultMap = JSON.parseObject(getStr, HashMap.class); - if (null != resultMap.get("errorCode")) { + if (null != resultMap.get("errcode")) { logger.error("openid和access_token换取微信用户基本信息接口调用失败"); - throw new RenException(resultMap.get("errorMsg")); + throw new RenException(resultMap.get("errormsg")); } //3.返回结果 From 3629bd26620144579d898d39d1d3be0986454e45 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 23 Jul 2020 17:33:30 +0800 Subject: [PATCH 051/157] =?UTF-8?q?=E7=A7=AF=E5=88=86=E8=A7=84=E5=88=99?= =?UTF-8?q?=E6=B6=88=E8=B4=B9=E6=B6=88=E6=81=AF=E6=8E=A5=E5=8F=A3=E6=9A=82?= =?UTF-8?q?=E5=AD=98=EF=BC=9B2=E6=8E=A5=E5=85=A5=E9=92=89=E9=92=89?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=97=A5=E5=BF=97=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/mq/eventmsg/BasePointEventMsg.java | 45 +++++++++++++ .../epmet-heart/epmet-heart-server/pom.xml | 9 +++ .../src/main/resources/logback-spring.xml | 8 ++- .../epmet-point/epmet-point-server/pom.xml | 9 +++ .../controller/MqPointCallbackController.java | 63 ++++++++++++++++++- .../src/main/resources/logback-spring.xml | 8 ++- 6 files changed, 137 insertions(+), 5 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java new file mode 100644 index 0000000000..435234f7dd --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/BasePointEventMsg.java @@ -0,0 +1,45 @@ +package com.epmet.commons.tools.dto.form.mq.eventmsg; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:积分相关事件消息体 + * + * @author lyn + * @date 2020/7/23 16:34 + */ +@Data +public class BasePointEventMsg implements Serializable { + private static final long serialVersionUID = 4037225404113743943L; + + /** + * 操作人机关id + */ + private String opAgencyId; + + /** + * 客户Id + */ + private String customerId; + /** + * 被操作用户id + */ + private String userId; + + /** + * 加减分标识 plus/minus + */ + private String actionFlag; + + /** + * 积分值 + */ + private Integer point; + + /** + * 是否是通用事件,通用事件不走规则 + */ + private Boolean isCommon; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/pom.xml b/epmet-module/epmet-heart/epmet-heart-server/pom.xml index e245a2cdc9..892bc020c0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/pom.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/pom.xml @@ -138,6 +138,9 @@ producerService/producer/sendMsg 202007161443499985fa2d397436d10356542134c8f008c48 52d9d9b0e7d0eb5b8b81c205b579e07c + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 @@ -176,6 +179,9 @@ producerService/producer/sendMsg 202007161443499985fa2d397436d10356542134c8f008c48 52d9d9b0e7d0eb5b8b81c205b579e07c + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 @@ -214,6 +220,9 @@ producerService/producer/sendMsg 202007161443499985fa2d397436d10356542134c8f008c48 52d9d9b0e7d0eb5b8b81c205b579e07c + + https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c + SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml index 512e302761..aacc15fdab 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/logback-spring.xml @@ -5,6 +5,8 @@ + + ${appname} @@ -125,11 +127,13 @@ 15 - - + ERROR ACCEPT DENY + ${webHook} + ${secret} + ${appname} diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index a6eef46a98..170eaf13f1 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -137,6 +137,9 @@ false + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 @@ -169,6 +172,9 @@ true + + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 @@ -201,6 +207,9 @@ true + + https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c + SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java index aeaca6e25d..51146befb0 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java +++ b/epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/controller/MqPointCallbackController.java @@ -2,12 +2,17 @@ package com.epmet.controller; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.dto.form.mq.ReceiveMqMsg; +import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.service.UserPointActionLogService; import dto.form.SendPointFormDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -16,7 +21,6 @@ import org.springframework.web.bind.annotation.RestController; * * @date: 2020/7/21 9:04 * @author: jianjun liu - * email:liujianjun@git.elinkit.com.cn */ @Slf4j @RestController @@ -24,6 +28,9 @@ import org.springframework.web.bind.annotation.RestController; public class MqPointCallbackController { private Logger logger = LogManager.getLogger(MqPointCallbackController.class); + @Autowired + private UserPointActionLogService userPointActionLogService; + /** * desc:爱心活动积分发放 * @@ -38,8 +45,62 @@ public class MqPointCallbackController { return "success"; } SendPointFormDTO formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), SendPointFormDTO.class); + try { + //TODO 调用调整积分方法去给用户加减积分 userPointActionLogService. + } catch (Exception e) { + logger.error("activeSendPoint consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); + } log.info("activeSendPoint consumer success,formDTO:{}", JSON.toJSONString(formDTO)); return "success"; } + + /** + * desc:爱心互助-志愿者注册消息 + * + * @param mqMsg + * @return + */ + @RequestMapping("registervolunteer") + public String registerVolunteer(ReceiveMqMsg mqMsg) { + log.debug("registerVolunteer receive mqMsg:{}", JSON.toJSONString(mqMsg)); + if (mqMsg == null || StringUtils.isBlank(mqMsg.getMsg())) { + log.warn("registerVolunteer mqMsg is empty"); + return "success"; + } + BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class); + try { + //TODO 调用调整积分方法去给用户加减积分 userPointActionLogService. + } catch (Exception e) { + logger.error("registerVolunteer consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); + } + log.info("registerVolunteer consumer success,formDTO:{}", JSON.toJSONString(formDTO)); + return "success"; + } + + /** + * desc:爱心互助-发布实况消息 + * + * @param mqMsg + * @return + */ + @RequestMapping("pubactivelive") + public String pubActiveLive(ReceiveMqMsg mqMsg) { + log.debug("pubActiveLive receive mqMsg:{}", JSON.toJSONString(mqMsg)); + if (mqMsg == null || StringUtils.isBlank(mqMsg.getMsg())) { + log.warn("pubActiveLive mqMsg is empty"); + return "success"; + } + BasePointEventMsg formDTO = ConvertUtils.sourceToTarget(mqMsg.getMsg(), BasePointEventMsg.class); + try { + //TODO 调用调整积分方法去给用户加减积分 userPointActionLogService. + } catch (Exception e) { + logger.error("pubActiveLive consume fail,msg:{}",JSON.toJSONString(mqMsg.getMsg())); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getMsg()); + } + log.info("pubActiveLive consumer success,formDTO:{}", JSON.toJSONString(formDTO)); + return "success"; + } } diff --git a/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml b/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml index e862b078ef..916c58edbb 100644 --- a/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml +++ b/epmet-module/epmet-point/epmet-point-server/src/main/resources/logback-spring.xml @@ -5,6 +5,8 @@ + + ${appname} @@ -125,11 +127,13 @@ 15 - - + ERROR ACCEPT DENY + ${webHook} + ${secret} + ${appname} From 86f5bb822d4c6711557f8c7f34fe681d84c6809f Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 23 Jul 2020 17:34:32 +0800 Subject: [PATCH 052/157] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index feee4e4cb4..8fadcbfa6d 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.46 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.47 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 2184b88588..11a9728472 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.46 + 0.3.47 com.epmet epmet-cloud diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index b2e925ea54..24787c6ab8 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.50 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.51 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index cd83aeb22a..8a074b1f2b 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.50 + 0.0.51 com.epmet From 423a9fef1d2f547a9f155bb4a2570b4edbf2f5b3 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Thu, 23 Jul 2020 17:35:01 +0800 Subject: [PATCH 053/157] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF=E6=8E=A5=E5=8F=A33?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 2 + .../main/java/com/epmet/dto/ActInfoDTO.java | 9 +- .../dto/form/resi/ActUserClockLogFormDTO.java | 81 -------------- .../form/resi/ResiActRegistrationFormDTO.java | 61 +++++++++++ .../dto/form/resi/ResiActSignInFormDTO.java | 1 - .../ResiVolunteerAuthenticateFormDTO.java | 13 ++- .../com/epmet/feign/EpmetUserFeignClient.java | 14 +++ .../EpmetUserFeignClientFallBack.java | 8 +- .../controller/ResiActListController.java | 14 +++ .../main/java/com/epmet/dao/ActInfoDao.java | 10 ++ .../java/com/epmet/dao/ActUserLogDao.java | 12 ++- .../java/com/epmet/dao/HeartUserInfoDao.java | 10 ++ .../java/com/epmet/dao/VolunteerInfoDao.java | 26 ++++- .../com/epmet/entity/VolunteerInfoEntity.java | 4 +- .../com/epmet/service/ActInfoService.java | 12 +++ .../com/epmet/service/ActUserLogService.java | 12 ++- .../epmet/service/ActUserRelationService.java | 12 +++ .../epmet/service/HeartUserInfoService.java | 10 ++ .../service/impl/ActInfoServiceImpl.java | 5 + .../service/impl/ActUserLogServiceImpl.java | 6 +- .../impl/ActUserRelationServiceImpl.java | 102 +++++++++++++++++- .../impl/HeartUserInfoServiceImpl.java | 5 + .../impl/VolunteerInfoServiceImpl.java | 39 +++++-- .../src/main/resources/mapper/ActInfoDao.xml | 13 +++ .../main/resources/mapper/ActUserLogDao.xml | 12 ++- .../resources/mapper/HeartUserInfoDao.xml | 23 ++++ .../resources/mapper/VolunteerInfoDao.xml | 28 ++++- .../com/epmet/controller/UserController.java | 14 +++ 28 files changed, 453 insertions(+), 105 deletions(-) delete mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActRegistrationFormDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 59a602b124..b977a2e76f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -76,6 +76,8 @@ public enum EpmetErrorCode { // 爱心互助 居民端 NOT_IN_THE_SIGN_IN_RANGE(8510, "您还未进入指定的签到范围~"), + NON_CERTIFIED_VOLUNTEER(8511, "活动报名失败,请先认证志愿者"), + ACT_TIME_CONFLICT(8512, "活动时间冲突"), // 该错误不会提示给前端,只是后端传输错误信息用。 ACCESS_SQL_FILTER_MISSION_ARGS(8701, "缺少生成权限过滤SQL所需参数"), diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java index ad18a98c8b..5b6859f190 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java @@ -247,4 +247,11 @@ public class ActInfoDTO implements Serializable { */ private String delFlag; -} \ No newline at end of file + // 虚字段 + + /** + * 用户id + */ + private String userId; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java deleted file mode 100644 index fa7e943ebf..0000000000 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ActUserClockLogFormDTO.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * 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.form.resi; - -import lombok.Data; - -import javax.validation.constraints.NotBlank; -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; - -/** - * 用户活动打卡参数 - * - * @author zhangyong - * @since v1.0.0 2020-07-14 - */ -@Data -public class ActUserClockLogFormDTO implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 用户ID - */ - private String userId; - /** - * 活动ID - */ - @NotBlank(message = "活动ID不能为空") - private String actId; - /** - * 打卡类型(0-打卡,1-更新打卡) - */ - @NotBlank(message = "打卡类型不能为空") - private String clockType; - /** - * 打卡位置经度 - */ - @NotBlank(message = "打卡位置经度不能为空") - private BigDecimal clockLongitude; - /** - * 打卡位置纬度 - */ - @NotBlank(message = "打卡位置纬度不能为空") - private BigDecimal clockLatitude; - /** - * 打卡地址 - */ - @NotBlank(message = "打卡地址不能为空") - private String clockAddress; - /** - * 打卡描述 - */ - @NotBlank(message = "打卡描述不能为空") - private String clockDesc; - /** - * 打卡是否有效(0-否,1-是) - */ - @NotBlank(message = "打卡是否有效不能为空") - private String effectiveFlag; - /** - * 打卡图片 - */ - private ArrayList images; -} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActRegistrationFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActRegistrationFormDTO.java new file mode 100644 index 0000000000..378b38e40c --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActRegistrationFormDTO.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.dto.form.resi; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 活动报名参数 + * + * @author zhangyong + * @since v1.0.0 2020-07-20 + */ +@Data +public class ResiActRegistrationFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + //>>>>>>>>>>>>>>>>>校验分组开始>>>>>>>>>>>>>>>>>>>>> + /** + * 添加用户操作的内部异常分组 + * 出现错误会提示给前端7000错误码,返回信息为:服务器开小差... + */ + public interface AddUserInternalGroup {} + + // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + + /** + * 用户Id + */ + private String userId; + + /** + * 活动ID + */ + @NotBlank(message = "活动ID不能为空", groups = { AddUserInternalGroup.class }) + private String actId; + + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空", groups = { AddUserInternalGroup.class }) + private String customerId; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java index a587969ca2..54363137f7 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java @@ -21,7 +21,6 @@ import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.constraints.NotBlank; -import java.awt.*; import java.io.Serializable; import java.math.BigDecimal; import java.util.List; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java index 26b8591599..497f36f06e 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiVolunteerAuthenticateFormDTO.java @@ -34,6 +34,17 @@ public class ResiVolunteerAuthenticateFormDTO implements Serializable { // <<<<<<<<<<<<<<<<<<<校验分组结束<<<<<<<<<<<<<<<<<<<<<<<< + /** + * 用户id + */ + private String userId; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class }) + private String customerId; + /** * 姓 */ @@ -97,7 +108,7 @@ public class ResiVolunteerAuthenticateFormDTO implements Serializable { * 头像 */ @NotBlank(message = "头像不能为空", groups = {AddUserInternalGroup.class, AddUserShowGroup.class }) - private String headImgUrl; + private String avatarUrl; /** * 志愿者签名 diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index f98f1bc474..c8e1660cd3 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -1,7 +1,10 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.form.UserRoleFormDTO; +import com.epmet.dto.form.WxUserInfoFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; @@ -43,4 +46,15 @@ public interface EpmetUserFeignClient { **/ @PostMapping(value = "epmetuser/userrole/getuserroleinfobyuserid/{userId}", consumes = MediaType.APPLICATION_JSON_VALUE) Result> getUserRoleInfoByUserId(@PathVariable("userId") String userId); + + /** + * 同步-居民基础信息、用户微信信息 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:37 2020-07-23 + **/ + @PostMapping("epmetuser/user/updateUserBaseAndWxUserInfo") + Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index 71447cb0a6..1238fceed5 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -1,9 +1,10 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.UserWechatDTO; +import com.epmet.dto.form.WxUserInfoFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.feign.EpmetUserFeignClient; @@ -28,4 +29,9 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { public Result> getUserRoleInfoByUserId(String userId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfoByUserId", userId); } + + @Override + public Result updateUserBaseAndWxUserInfo(WxUserInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateUserBaseAndWxUserInfo", formDTO); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java index 7231d7132a..721723b58e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java @@ -282,4 +282,18 @@ public class ResiActListController { return actSignInRecService.actSignIn(tokenDto, formDTO); } + /** + * 活动报名 + * + * @param tokenDto + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 16:46 2020-07-23 + **/ + @PostMapping("registration") + public Result registration(@LoginUser TokenDto tokenDto, @RequestBody ResiActRegistrationFormDTO formDTO) { + return actUserRelationService.registration(tokenDto, formDTO); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index 1d4cf03f8b..802096fd8f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java @@ -215,4 +215,14 @@ public interface ActInfoDao extends BaseDao { * @Date 09:56 2020-07-22 **/ List selectListActContent(@Param("actId") String actId); + + /** + * 查询当前报名的活动开始时间-结束时间,是否与其他已报名,未结束的活动,存在交集情况 + * + * @param actInfoDTO + * @return java.lang.Integer + * @Author zhangyong + * @Date 17:17 2020-07-23 + **/ + Integer checkActTime(ActInfoDTO actInfoDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java index 6e02e27e48..348a259dde 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserLogDao.java @@ -51,4 +51,14 @@ public interface ActUserLogDao extends BaseDao { * @Date 2020/7/23 14:13 **/ ActUserLogDTO selectLatestRefused(@Param("actId") String actId, @Param("userId") String userId); -} \ No newline at end of file + + /** + * 查询我累计【报名过】的活动次数 + * + * @param userId + * @return java.lang.Integer + * @Author zhangyong + * @Date 16:12 2020-07-23 + **/ + Integer countActTimesOfParticipation(@Param("userId") String userId); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java index 4a22ba2ce6..71e1fc67cd 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java @@ -66,4 +66,14 @@ public interface HeartUserInfoDao extends BaseDao { * @Date 18:06 2020-07-22 **/ List selectListLeaderboard(ResiActBaseFormDTO formDTO); + + /** + * 根据用户id,修改用户信息表 + * + * @param dto + * @return void + * @Author zhangyong + * @Date 16:27 2020-07-23 + **/ + void updateHeartUserInfoByUserId(HeartUserInfoDTO dto); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java index 2d23a8d37c..5ceec37857 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/VolunteerInfoDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.VolunteerInfoEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 志愿者信息 @@ -29,5 +30,26 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface VolunteerInfoDao extends BaseDao { - -} \ No newline at end of file + + /** + * 查询用户是否是志愿者身份 + * >0 是 + * 0 不是 + * + * @param userId + * @return java.lang.String + * @Author zhangyong + * @Date 14:33 2020-07-23l + **/ + Integer queryVolunteerFlagByUserId(@Param("userId") String userId); + + /** + * 根据用户ID,修改志愿者信息 + * + * @param entity + * @return void + * @Author zhangyong + * @Date 15:05 2020-07-23 + **/ + void updateVolunteerInfoByUserId(VolunteerInfoEntity entity); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/VolunteerInfoEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/VolunteerInfoEntity.java index 6d1a11c42b..484e911fe1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/VolunteerInfoEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/VolunteerInfoEntity.java @@ -44,8 +44,8 @@ public class VolunteerInfoEntity extends BaseEpmetEntity { private String userId; /** - * 客户id - */ + * 客户id + */ private String customerId; /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java index ec70e7e44b..4f67a60cd8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActInfoService.java @@ -26,6 +26,8 @@ import com.epmet.dto.result.resi.*; import com.epmet.entity.ActInfoEntity; import com.epmet.commons.tools.utils.Result; + +import java.util.Date; import java.util.List; import java.util.Map; @@ -212,4 +214,14 @@ public interface ActInfoService extends BaseService { * @Date 13:39 2020-07-21 **/ Result rejectDetail(TokenDto tokenDto, ResiActDetailFormDTO formDto); + + /** + * 查询当前报名的活动开始时间-结束时间,是否与其他已报名,未结束的活动,存在交集情况 + * + * @param actInfoDTO + * @return java.lang.Integer + * @Author zhangyong + * @Date 17:17 2020-07-23 + **/ + Integer checkActTime(ActInfoDTO actInfoDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserLogService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserLogService.java index 8edb4ef9c5..4eb8fbe83d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserLogService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserLogService.java @@ -92,4 +92,14 @@ public interface ActUserLogService extends BaseService { * @date 2020-07-19 */ void delete(String[] ids); -} \ No newline at end of file + + /** + * 查询我累计报名过的活动次数 + * + * @param userId + * @return java.lang.Integer + * @Author zhangyong + * @Date 16:12 2020-07-23 + **/ + Integer countActTimesOfParticipation(String userId); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java index 17d7d0c93b..f3a135ee6a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActUserRelationService.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.resi.ResiActRegistrationFormDTO; import com.epmet.dto.form.resi.ResiActUserCancelSignUpFormDTO; import com.epmet.entity.ActUserRelationEntity; import org.apache.ibatis.annotations.Param; @@ -138,4 +139,15 @@ public interface ActUserRelationService extends BaseService { * @Date 17:42 2020-07-22 **/ Result> leaderboard(ResiActBaseFormDTO formDTO); + + /** + * 根据用户id,修改用户信息表 + * + * @param dto + * @return void + * @Author zhangyong + * @Date 16:27 2020-07-23 + **/ + void updateHeartUserInfoByUserId(HeartUserInfoDTO dto); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java index 550e13d878..18e96e4c23 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java @@ -370,4 +370,9 @@ public class ActInfoServiceImpl extends BaseServiceImpl page(Map params) { @@ -168,4 +193,79 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl NumConstant.ZERO){ + satisfy = true; + } else { + logger.info("活动报名失败,请先认证志愿者"); + throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode()); + } + } else { + // 活动不限制志愿者身份,但要求是 居民身份 + Result> userRoleInfo = epmetUserFeignClient.getUserRoleInfoByUserId(formDTO.getUserId()); + for (UserRoleResultDTO roleResultDTO :userRoleInfo.getData()){ + if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(roleResultDTO.getRoleKey())){ + satisfy = true; + } + } + if (!satisfy){ + logger.info("活动报名失败,请完善居民信息"); + throw new RenException(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); + } + } + if (satisfy){ + this.actStartSignUp(actInfoDTO, formDTO); + } + return new Result(); + } + + private void actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO){ + boolean signUp = true; + Integer auditingNum = actUserLogService.countActTimesOfParticipation(formDTO.getUserId()); + if (auditingNum > NumConstant.ZERO){ + // 2.判断本次报名的活动与之前未结束的活动报名时间 是否产生交集,产生则 报名失败 + actInfoDTO.setUserId(formDTO.getUserId()); + Integer actTimeFlag = actInfoService.checkActTime(actInfoDTO); + if (actTimeFlag > NumConstant.ZERO){ + signUp = false; + logger.info("活动报名失败,活动时间冲突"); + throw new RenException(EpmetErrorCode.ACT_TIME_CONFLICT.getCode()); + } + } else { + // 3.第一次报名 + HeartUserInfoEntity entity = new HeartUserInfoEntity(); + entity.setCustomerId(formDTO.getCustomerId()); + entity.setUserId(formDTO.getUserId()); + entity.setVolunteerFlag(true); + entity.setKindnessTime(NumConstant.ZERO); + entity.setParticipationNum(NumConstant.ZERO); + entity.setObtainPointNum(NumConstant.ZERO); + heartUserInfoDao.insert(entity); + } + if (signUp){ + // 4.插入用户活动关系表 + ActUserRelationEntity entity = new ActUserRelationEntity(); + entity.setActId(formDTO.getActId()); + entity.setUserId(formDTO.getUserId()); + entity.setStatus(ActUserRelationStatusConstant.AUDITING); + baseDao.insert(entity); + + // 5.插入活动日志表 + ActUserLogEntity userLogEntity = new ActUserLogEntity(); + userLogEntity.setActId(formDTO.getActId()); + userLogEntity.setUserId(formDTO.getUserId()); + userLogEntity.setOperationType(ActUserRelationStatusConstant.AUDITING); + actUserLogService.insert(userLogEntity); + } + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java index 72e98f3ab0..fead42e055 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java @@ -150,4 +150,9 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl>().ok(resultDTOS); } + + @Override + public void updateHeartUserInfoByUserId(HeartUserInfoDTO dto) { + baseDao.updateHeartUserInfoByUserId(dto); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index 88dd354a4c..84e78622c8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -20,16 +20,21 @@ 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.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.VolunteerInfoDao; +import com.epmet.dto.HeartUserInfoDTO; import com.epmet.dto.VolunteerInfoDTO; +import com.epmet.dto.form.WxUserInfoFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.entity.VolunteerInfoEntity; +import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.VolunteerInfoRedis; +import com.epmet.service.HeartUserInfoService; import com.epmet.service.VolunteerInfoService; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -52,19 +57,33 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl NumConstant.ZERO){ + // 是志愿者:更新志愿者信息表 + baseDao.updateVolunteerInfoByUserId(volunteerInfoEntity); + } else { + // 不是志愿者:插入志愿者信息表 + baseDao.insert(volunteerInfoEntity); + // 更新用户信息表的 是否是志愿者标识 + HeartUserInfoDTO userInfoDTO = new HeartUserInfoDTO(); + userInfoDTO.setUserId(tokenDto.getUserId()); + userInfoDTO.setVolunteerFlag(true); + heartUserInfoService.updateHeartUserInfoByUserId(userInfoDTO); + } + // 更新用户基础信息表 并 更新用户微信表 + WxUserInfoFormDTO wxUserInfoFormDTO = ConvertUtils.sourceToTarget(formDTO, WxUserInfoFormDTO.class); + return epmetUserFeignClient.updateUserBaseAndWxUserInfo(wxUserInfoFormDTO); } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 4b50ae3bd4..2680e43176 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -444,4 +444,17 @@ AND c.ACT_ID = #{actId} ORDER BY c.ORDER_NUM ASC + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml index 5df946833d..ed56feda4b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserLogDao.xml @@ -42,4 +42,14 @@ order by acl.CREATED_TIME desc limit 1 - \ No newline at end of file + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml index 1c4fdba03f..107007c2dc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml @@ -55,4 +55,27 @@ ORDER BY ui.KINDNESS_TIME DESC, ui.PARTICIPATION_NUM DESC LIMIT #{pageNo}, #{pageSize} + + + UPDATE heart_user_info + SET + + VOLUNTEER_FLAG = 1, + + + KINDNESS_TIME = #{kindnessTime}, + + + PARTICIPATION_NUM = #{participationNum}, + + + OBTAIN_POINT_NUM = #{obtainPointNum}, + + + UPDATED_BY = #{userId}, + + UPDATED_TIME = now() + WHERE DEL_FLAG = '0' + AND USER_ID = #{userId} + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml index 48854253bb..3555334a07 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml @@ -17,5 +17,31 @@ + - \ No newline at end of file + + UPDATE volunteer_info + SET + + CUSTOMER_ID = #{customerId}, + + + VOLUNTEER_INTRODUCE = #{volunteerIntroduce}, + + + VOLUNTEER_SIGNATURE = #{volunteerSignature}, + + + UPDATED_BY = #{userId}, + + UPDATED_TIME = now() + WHERE DEL_FLAG = '0' + AND USER_ID = #{userId} + + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java index 9c0f40c8ef..3d028bdfe7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserController.java @@ -132,4 +132,18 @@ public class UserController { return new Result().ok(userService.saveWxUser(formDTO)); } + /** + * 居民端个人信息-同步用户微信信息 + * 供Feign调用 + * + * @param wxUserInfoFormDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:51 2020-07-23 + **/ + @PostMapping("updateUserBaseAndWxUserInfo") + public Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO wxUserInfoFormDTO) { ; + ValidatorUtils.validateEntity(wxUserInfoFormDTO); + return userService.updateWxUserInfo(wxUserInfoFormDTO); + } } From 9d96c331a6b390160caa6dc4a389204762b3ffda Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Jul 2020 17:48:53 +0800 Subject: [PATCH 054/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-mine/gov-mine-server/deploy/docker-compose-dev.yml | 2 +- .../oper-customize-server/deploy/docker-compose-dev.yml | 2 +- .../resi-mine/resi-mine-server/deploy/docker-compose-dev.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml index f1539c2d78..cb7563abee 100644 --- a/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-mine/gov-mine-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-mine-server: container_name: gov-mine-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.32 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-mine-server:0.3.33 ports: - "8098:8098" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml index 3ddc8108ca..859970bc4c 100644 --- a/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-customize/oper-customize-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-customize-server: container_name: oper-customize-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-customize-server:0.3.23 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-customize-server:0.3.24 ports: - "8089:8089" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml index 8e4d0f9d56..7863b22fa0 100644 --- a/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml +++ b/epmet-module/resi-mine/resi-mine-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-mine-server: container_name: resi-mine-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/resi-mine-server:0.3.29 + image: 192.168.1.130:10080/epmet-cloud-dev/resi-mine-server:0.3.30 ports: - "8094:8094" network_mode: host # 使用现有网络 From 1b0b069a2366e56a5d11051a836230e07de7f936 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 23 Jul 2020 17:50:18 +0800 Subject: [PATCH 055/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/gov-mine/gov-mine-server/pom.xml | 2 +- epmet-module/oper-customize/oper-customize-server/pom.xml | 2 +- epmet-module/resi-mine/resi-mine-server/pom.xml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/gov-mine/gov-mine-server/pom.xml b/epmet-module/gov-mine/gov-mine-server/pom.xml index 53ce3a23bc..7a38a7a7e5 100644 --- a/epmet-module/gov-mine/gov-mine-server/pom.xml +++ b/epmet-module/gov-mine/gov-mine-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.32 + 0.3.33 com.epmet gov-mine diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index 47611b8c4a..73c01696fa 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.23 + 0.3.24 com.epmet oper-customize diff --git a/epmet-module/resi-mine/resi-mine-server/pom.xml b/epmet-module/resi-mine/resi-mine-server/pom.xml index c5d6204657..73700bf6ec 100644 --- a/epmet-module/resi-mine/resi-mine-server/pom.xml +++ b/epmet-module/resi-mine/resi-mine-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.29 + 0.3.30 com.epmet resi-mine From c06ff8ce42643575e6a6f597757e7293827e3480 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Thu, 23 Jul 2020 17:50:18 +0800 Subject: [PATCH 056/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-component=5Fverify=5Fticket?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=8C=E7=BB=91=E5=AE=9A=E5=BC=80=E6=94=BE?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E8=B4=A6=E6=88=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dao/ComponentVerifyTicketDao.java | 4 +- .../com/epmet/dao/OpenPlatformAccountDao.java | 7 + .../ComponentVerifyTicketServiceImpl.java | 148 +++++++++--------- .../wxapi/constant/WxMaCodeConstant.java | 7 + .../mapper/ComponentVerifyTicketDao.xml | 6 +- .../mapper/OpenFlatformAccountDao.xml | 5 + 6 files changed, 102 insertions(+), 75 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java index 9c29569f0e..87cb38b046 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentVerifyTicketDao.java @@ -39,10 +39,10 @@ public interface ComponentVerifyTicketDao extends BaseDao result = WXXmlToMapUtil.xmlToMap(msg); - String infotype = result.get(ModuleConstant.INFO_TYPE); //获取infotype,注:微信开放平台文档中标明固定为:"component_verify_ticket",但参考其他代码,还包含authorized??? + String infotype = result.get(ModuleConstant.INFO_TYPE); log.info(infotype); switch (infotype){ case ModuleConstant.TICKET_UNDERLINE_KEY: //接收票据 【component_verify_ticket】 @@ -131,7 +131,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe ticketFormDTO.setComponentAppId(componentAppId); ticketFormDTO.setComponentVerifyTicket(ComponentVerifyTicket); //先逻辑删 - ticketDao.updateOldComponentVerifyTicket(); + ticketDao.deleteOldComponentVerifyTicket(); ticketDao.insertComponentVerifyTicket(ticketFormDTO); log.info(ModuleConstant.TICKET_UNDERLINE_KEY+":"+ComponentVerifyTicket); break; @@ -509,79 +509,87 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe } public void createAndBindOpenAccount(String customerId,String authAppId,String clientType){ - log.info("开始创建开放平台账号并绑定"); - List authCount = customerMpDao.selectAuthCount(customerId); - String openPlatformId = null; - if (authCount.size()>0){ - openPlatformId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); - } Map authorizerRefreshToken = redisThird.getAuthorizerRefreshToken(customerId + ThirdRedisKeyConstant.COLON + clientType); String authorizerAccessToken = authorizerRefreshToken.get("authorizerAccessToken").toString(); - if (authCount.size()==NumConstant.ZERO){ - log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); - //没有任何一个小程序/公众号授权,【先创建,再绑定】 - JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); - // 此处的 access_token 为 【authorizer_access_token】 - String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); - Map map = JSON.parseObject(data, Map.class); - openPlatformId = map.get(ModuleConstant.OPEN_APP_ID).toString(); - CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); - createOpen.setErrCode((Integer)map.get(ModuleConstant.ERR_CODE)); - createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG).toString()); - createOpen.setOpenAppId(map.get(ModuleConstant.OPEN_APP_ID).toString()); - switch (createOpen.getErrCode()){ - case NumConstant.ZERO: - log.info(CREATE_AND_BIND_SUCCESS); - CreateOpenFormDTO coForm = new CreateOpenFormDTO(); - coForm.setOpenid(map.get(ModuleConstant.OPEN_APP_ID).toString()); - coForm.setCustomerId(customerId); - //插入 open_platform_account 表 - openPlatformAccountDao.insertOpenPlatFormAccount(coForm); - break; - case NumConstant.ONE_NEG: - throw new RenException(SYSTEM_ERROR); - case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: - throw new RenException(INVALID_APP_ID); - case ModuleConstant.EIGHTY_NINE_THOUSAND: - throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + JSONObject bindInfoForm = new JSONObject(); + bindInfoForm.put(ModuleConstant.LOW_APP_ID,authAppId); + String bindResult = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_OPEN_GET + authorizerAccessToken, JSON.toJSONString(bindInfoForm)).getData(); + Map bindInfo = JSON.parseObject(bindResult, Map.class); + boolean bindStatus = bindInfo.containsKey(ModuleConstant.OPEN_APP_ID); + if (bindStatus != true) { + log.info("开始创建开放平台账号并绑定"); + List authCount = customerMpDao.selectAuthCount(customerId); + String openPlatformId = null; + if (authCount.size() > 0) { + openPlatformId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); } - }else if (authCount.size()>NumConstant.ZERO && !authCount.contains(authAppId)){ - log.info("该客户已创建过开放平台账号,直接绑定"); - JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); - jsonObject.put(ModuleConstant.OPEN_APP_ID,openPlatformId); - String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_BIND_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); - Map map = JSON.parseObject(data, Map.class); - CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); - createOpen.setErrCode((Integer)map.get(ModuleConstant.ERR_CODE)); - createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG).toString()); - switch (createOpen.getErrCode()){ - case NumConstant.ZERO: - log.info(BIND_SUCCESS); - break; - case NumConstant.ONE_NEG: - throw new RenException(SYSTEM_ERROR); - case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: - throw new RenException(INVALID_APP_ID); - case ModuleConstant.EIGHTY_NINE_THOUSAND: - throw new RenException(ACCOUNT_HAS_BOUND_OPEN); - case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_ONE: - throw new RenException(NOT_SAME_CONTRACTOR); - case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_THREE: - throw new RenException(NOT_ALLOWED_OPERATE); - case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_FOUR: - throw new RenException(TO_LIMIT); + if (authCount.size() == NumConstant.ZERO) { + log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); + //没有任何一个小程序/公众号授权,【先创建,再绑定】 + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID, authAppId); + // 此处的 access_token 为 【authorizer_access_token】 + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + openPlatformId = map.get(ModuleConstant.OPEN_APP_ID).toString(); + CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); + createOpen.setErrCode((Integer) map.get(ModuleConstant.ERR_CODE)); + createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG).toString()); + createOpen.setOpenAppId(map.get(ModuleConstant.OPEN_APP_ID).toString()); + switch (createOpen.getErrCode()) { + case NumConstant.ZERO: + log.info(CREATE_AND_BIND_SUCCESS); + CreateOpenFormDTO coForm = new CreateOpenFormDTO(); + coForm.setOpenid(map.get(ModuleConstant.OPEN_APP_ID).toString()); + coForm.setCustomerId(customerId); + //插入 open_platform_account 表 + openPlatformAccountDao.deleteOldOpenPlatFprmAccount(customerId); + openPlatformAccountDao.insertOpenPlatFormAccount(coForm); + break; + case NumConstant.ONE_NEG: + throw new RenException(SYSTEM_ERROR); + case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: + throw new RenException(INVALID_APP_ID); + case ModuleConstant.EIGHTY_NINE_THOUSAND: + throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + } + } else if (authCount.size() > NumConstant.ZERO && !authCount.contains(authAppId)) { + log.info("该客户已创建过开放平台账号,直接绑定"); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID, authAppId); + jsonObject.put(ModuleConstant.OPEN_APP_ID, openPlatformId); + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_BIND_OPEN + authorizerAccessToken, JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + CreateOpenResultDTO createOpen = new CreateOpenResultDTO(); + createOpen.setErrCode((Integer) map.get(ModuleConstant.ERR_CODE)); + createOpen.setErrMsg(map.get(ModuleConstant.ERR_MSG).toString()); + switch (createOpen.getErrCode()) { + case NumConstant.ZERO: + log.info(BIND_SUCCESS); + break; + case NumConstant.ONE_NEG: + throw new RenException(SYSTEM_ERROR); + case ModuleConstant.FORTY_THOUSAND_AND_THIRTEEN: + throw new RenException(INVALID_APP_ID); + case ModuleConstant.EIGHTY_NINE_THOUSAND: + throw new RenException(ACCOUNT_HAS_BOUND_OPEN); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_ONE: + throw new RenException(NOT_SAME_CONTRACTOR); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_THREE: + throw new RenException(NOT_ALLOWED_OPERATE); + case ModuleConstant.EIGHTY_NINE_THOUSAND_AND_FOUR: + throw new RenException(TO_LIMIT); + } } + //插入 binding_account + BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO(); + bindingAccount.setOpenPlatformAccountId(openPlatformId); + bindingAccount.setAuthAppId(authAppId); + bindingAccount.setClientType(clientType); + bindingAccount.setCustomerId(customerId); + bindingAccountDao.insertBindingAccount(bindingAccount); + log.info("创建绑定账号结束"); } - //插入 binding_account - BindingAccountFormDTO bindingAccount = new BindingAccountFormDTO(); - bindingAccount.setOpenPlatformAccountId(openPlatformId); - bindingAccount.setAuthAppId(authAppId); - bindingAccount.setClientType(clientType); - bindingAccount.setCustomerId(customerId); - bindingAccountDao.insertBindingAccount(bindingAccount); - log.info("创建绑定账号结束"); } /** diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index 104b447b5a..7cf0284911 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -40,6 +40,8 @@ public interface WxMaCodeConstant { * component_appid:第三方AppId * pre_auth_code:预授权码 * redirect_uri:回调url(获取授权码) + * 上面url为扫码形式 + * 下面注释url为按钮形式 */ String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/cgi-bin/componentloginpage?component_appid=%s&pre_auth_code=%s&redirect_uri=%s"; // String API_AUTH_REGISTER_URL = "https://mp.weixin.qq.com/safe/bindcomponent?action=bindcomponent&auth_type=3&no_scan=1&component_appid=%s&pre_auth_code=%s&redirect_uri=%s#wechat_redirect"; @@ -59,6 +61,11 @@ public interface WxMaCodeConstant { */ String API_GET_AUTHORIZER_INFO = "https://api.weixin.qq.com/cgi-bin/component/api_get_authorizer_info?component_access_token="; + /** + * 获取公众号/小程序所绑定的开放平台帐号 + */ + String API_OPEN_GET = "https://api.weixin.qq.com/cgi-bin/open/get?access_token="; + /** * 为授权的小程序帐号上传小程序代码. */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml index ba33593a48..c875223478 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/ComponentVerifyTicketDao.xml @@ -21,9 +21,9 @@ - - update component_verify_ticket set del_flag = 1 - + + DELETE FROM component_verify_ticket WHERE del_flag = 0 + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml index 3cc916bb31..4b4842e478 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/OpenFlatformAccountDao.xml @@ -23,6 +23,11 @@ ) + + + UPDATE open_platform_account set del_flag = 1 where customer_id = #{customerId} + + + + + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorGridInfo.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorGridInfo.java new file mode 100644 index 0000000000..d0d0fa1d86 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorGridInfo.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 20:58 + */ +@Data +public class ActSponsorGridInfo implements Serializable { + private static final long serialVersionUID = -2797565581047800011L; + /** + * 网格Id + */ + private String gridId = ""; + /** + * 机关-网格名称 + */ + private String agencyGridName = ""; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorResultDTO.java new file mode 100644 index 0000000000..f7f7c955a1 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/ActSponsorResultDTO.java @@ -0,0 +1,28 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 20:46 + */ +@Data +public class ActSponsorResultDTO implements Serializable { + /** + * 机关组织Id + */ + private String agencyId = ""; + /** + * 机关组织名称 + */ + private String agencyName = ""; + /** + * 机关下网格列表信息 + */ + private List agencyGridList; +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java index 4fbf1e6f59..c5c421b5a3 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java @@ -156,4 +156,14 @@ public interface GovOrgOpenFeignClient { */ @PostMapping("/gov/org/grid/gridsbystaffid/{staffId}") Result> listGridsbystaffid(@PathVariable("staffId") String staffId); + + /** + * @return com.epmet.commons.tools.utils.Result + * @param staffId + * @author yinzuomei + * @description 发布活动-主办方列表 + * @Date 2020/7/23 20:47 + **/ + @PostMapping("/gov/org/customeragency/querysponsorlist/{staffId}") + Result querySponsorList(@PathVariable("staffId") String staffId); } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java index 48fa9c84dc..dcc848725f 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.java @@ -90,4 +90,16 @@ public class GovOrgOpenFeignClientFallback implements GovOrgOpenFeignClient { public Result> listGridsbystaffid(String staffId) { return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "listGridsbystaffid", staffId); } + + /** + * @param staffId + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 发布活动-主办方列表 + * @Date 2020/7/23 20:47 + **/ + @Override + public Result querySponsorList(String staffId) { + return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "querySponsorList", staffId); + } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java index 6177a24ce6..83250c4c17 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java @@ -181,4 +181,16 @@ public class CustomerAgencyController { public Result getPublishAgencyList(@PathVariable("staffId") String staffId) { return new Result().ok(customerAgencyService.getPublishAgencyList(staffId)); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param staffId + * @author yinzuomei + * @description 发布活动-主办方列表 + * @Date 2020/7/23 20:50 + **/ + @PostMapping("querysponsorlist/{staffId}") + Result querySponsorList(@PathVariable("staffId") String staffId){ + return new Result().ok(customerAgencyService.querySponsorList(staffId)); + } } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java index 7f980cb8c8..8cfef54079 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerStaffAgencyDao.java @@ -18,7 +18,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerStaffAgencyDTO; +import com.epmet.dto.result.ActSponsorGridInfo; import com.epmet.dto.result.StaffListResultDTO; import com.epmet.entity.CustomerStaffAgencyEntity; import org.apache.ibatis.annotations.Mapper; @@ -80,4 +82,22 @@ public interface CustomerStaffAgencyDao extends BaseDao selectActSponsorGrid(String staffId); + + /** + * @return com.epmet.dto.CustomerAgencyDTO + * @param staffId + * @author yinzuomei + * @description 根据staffId,查询我所属的组织信息 + * @Date 2020/7/23 21:10 + **/ + CustomerAgencyDTO selectMyAgency(String staffId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java index 66586aeec4..cacba8512e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java @@ -169,4 +169,13 @@ public interface CustomerAgencyService extends BaseService * @Description 党建声音-政府端-可选发布单位接口调用-根据人员角色查询对应的不同发布单位 **/ PublishAgencyListResultDTO getPublishAgencyList(String staffId); + + /** + * @return com.epmet.dto.result.ActSponsorResultDTO + * @param staffId + * @author yinzuomei + * @description 发布活动-主办方列表 + * @Date 2020/7/23 20:50 + **/ + ActSponsorResultDTO querySponsorList(String staffId); } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java index 23b07f5b93..69a1d4ec87 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java @@ -810,5 +810,25 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl list=customerStaffAgencyDao.selectActSponsorGrid(staffId); + resultDTO.setAgencyGridList(list); + return resultDTO; + } + } \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml index 21d9cf139c..222d4cc6d3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerStaffAgencyDao.xml @@ -117,4 +117,28 @@ + + + + \ No newline at end of file From ddbff44121a4a479041792afda32a42e29ad465f Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Thu, 23 Jul 2020 23:30:20 +0800 Subject: [PATCH 062/157] =?UTF-8?q?heart-work:=E5=B7=B2=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E3=80=81=E5=B7=B2=E5=8F=96=E6=B6=88=E6=B4=BB=E5=8A=A8=E5=88=97?= =?UTF-8?q?=E8=A1=A8api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/result/work/CanceledActResultDTO.java | 55 ++++++++++++++++++ .../dto/result/work/FinishedActResultDTO.java | 56 +++++++++++++++++++ .../epmet/controller/WorkActController.java | 31 +++++++++- .../main/java/com/epmet/dao/ActInfoDao.java | 20 +++++++ .../com/epmet/service/WorkActService.java | 20 +++++++ .../service/impl/WorkActServiceImpl.java | 28 +++++++++- .../src/main/resources/mapper/ActInfoDao.xml | 40 +++++++++++++ 7 files changed, 246 insertions(+), 4 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java new file mode 100644 index 0000000000..887a457b4e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActResultDTO.java @@ -0,0 +1,55 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 23:09 + */ +@Data +public class CanceledActResultDTO implements Serializable { + private static final long serialVersionUID = 7026227776577088524L; + /** + *活动id + */ + private String actId; + + /** + *活动标题 + */ + private String title; + + /** + * 活动封面 + */ + private String coverPic; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 取消活动的时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date cancelTime; + + /** + * 活动取消的原因 + */ + private String cancelReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java new file mode 100644 index 0000000000..25f9d7e46b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActResultDTO.java @@ -0,0 +1,56 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/23 23:19 + */ +@Data +public class FinishedActResultDTO implements Serializable { + private static final long serialVersionUID = -8967999331248723146L; + + /** + *活动id + */ + private String actId; + + /** + *活动标题 + */ + private String title; + + /** + * 活动封面 + */ + private String coverPic; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + /** + * 活动实际开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actualStartTime; + + /** + * 活动实际结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actualEndTime; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index e7ce6b50a8..2e14ec9aac 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -3,11 +3,14 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.work.ActListCommonFormDTO; +import com.epmet.dto.result.work.CanceledActResultDTO; +import com.epmet.dto.result.work.FinishedActResultDTO; import com.epmet.dto.result.work.InProgressActResultDTO; import com.epmet.dto.result.work.SponsorResultDTO; import com.epmet.service.WorkActService; 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; @@ -45,8 +48,34 @@ public class WorkActController { * @Date 2020/7/23 21:24 **/ @PostMapping("inprogresslist") - public Result> queryInProgressList(ActListCommonFormDTO formDTO){ + public Result> queryInProgressList(@RequestBody ActListCommonFormDTO formDTO){ ValidatorUtils.validateEntity(formDTO,ActListCommonFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActService.queryInProgressList(formDTO)); } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 已取消-活动列表 + * @Date 2020/7/23 23:11 + **/ + @PostMapping("canceledlist") + public Result> queryCanceledlist(@RequestBody ActListCommonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,ActListCommonFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActService.queryCanceledList(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 已结束-活动列表 + * @Date 2020/7/23 23:21 + **/ + @PostMapping("finishedlist") + public Result> queryFinishedList(@RequestBody ActListCommonFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,ActListCommonFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActService.queryFinishedList(formDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index 6166d5ffdd..700c114b6d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java @@ -25,6 +25,8 @@ import com.epmet.dto.form.resi.ResiLatestActFormDTO; import com.epmet.dto.form.resi.ResiMyActFormDTO; import com.epmet.dto.result.resi.*; import com.epmet.dto.result.work.ActSignUpStatResultDTO; +import com.epmet.dto.result.work.CanceledActResultDTO; +import com.epmet.dto.result.work.FinishedActResultDTO; import com.epmet.dto.result.work.InProgressActResultDTO; import com.epmet.entity.ActInfoEntity; import org.apache.ibatis.annotations.Mapper; @@ -235,4 +237,22 @@ public interface ActInfoDao extends BaseDao { * @Date 2020/7/23 21:58 **/ List selectInprogress(String customerId); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 已取消-活动列表 + * @Date 2020/7/23 23:13 + **/ + List selectCanceledList(String customerId); + + /** + * @return java.util.List + * @param customerId + * @author yinzuomei + * @description 已结束-活动列表 + * @Date 2020/7/23 23:21 + **/ + List selectFinishedList(String customerId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index 4a623371c8..3945c19213 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -1,6 +1,8 @@ package com.epmet.service; import com.epmet.dto.form.work.ActListCommonFormDTO; +import com.epmet.dto.result.work.CanceledActResultDTO; +import com.epmet.dto.result.work.FinishedActResultDTO; import com.epmet.dto.result.work.InProgressActResultDTO; import com.epmet.dto.result.work.SponsorResultDTO; @@ -30,4 +32,22 @@ public interface WorkActService { * @Date 2020/7/23 21:24 **/ List queryInProgressList(ActListCommonFormDTO formDTO); + + /** + * @return java.util.List + * @param formDTO + * @author yinzuomei + * @description 已取消-活动列表 + * @Date 2020/7/23 23:11 + **/ + List queryCanceledList(ActListCommonFormDTO formDTO); + + /** + * @return java.util.List + * @param formDTO + * @author yinzuomei + * @description 已结束-活动列表 + * @Date 2020/7/23 23:21 + **/ + List queryFinishedList(ActListCommonFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 161d838d57..cdeb80c3d3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -6,9 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dao.ActInfoDao; import com.epmet.dto.form.work.ActListCommonFormDTO; import com.epmet.dto.result.ActSponsorResultDTO; -import com.epmet.dto.result.work.Grid; -import com.epmet.dto.result.work.InProgressActResultDTO; -import com.epmet.dto.result.work.SponsorResultDTO; +import com.epmet.dto.result.work.*; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.WorkActService; import org.apache.commons.lang3.StringUtils; @@ -106,6 +104,30 @@ public class WorkActServiceImpl implements WorkActService { return list; } + /** + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @description 已取消-活动列表 + * @Date 2020/7/23 23:11 + **/ + @Override + public List queryCanceledList(ActListCommonFormDTO formDTO) { + return actInfoDao.selectCanceledList(formDTO.getCustomerId()); + } + + /** + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @description 已结束-活动列表 + * @Date 2020/7/23 23:21 + **/ + @Override + public List queryFinishedList(ActListCommonFormDTO formDTO) { + return actInfoDao.selectFinishedList(formDTO.getCustomerId()); + } + public static void main(String[] args) { SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index e16f3b8369..2ddf0c9398 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -488,4 +488,44 @@ and ai.CUSTOMER_ID=#{customerId} order by ai.CREATED_TIME desc + + + + + + From 1e6fd9417defbf55fad465bc9aa6f9130cfd7cf5 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Fri, 24 Jul 2020 09:06:28 +0800 Subject: [PATCH 063/157] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/constant/ActConstant.java | 57 ++++++++++++++- .../service/impl/ActInfoServiceImpl.java | 70 +++++++++---------- .../service/impl/ActSignInRecServiceImpl.java | 6 +- .../impl/ActUserRelationServiceImpl.java | 10 +-- .../utils/ActUserRelationStatusConstant.java | 43 ------------ .../epmet/utils/ActUserStatusConstant.java | 49 ------------- 6 files changed, 96 insertions(+), 139 deletions(-) delete mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserRelationStatusConstant.java delete mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ActUserStatusConstant.java diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java index a13c2bed23..96e45bad87 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java @@ -88,14 +88,30 @@ public interface ActConstant { */ String ACT_USER_STATUS_CANCELD="canceld"; - /*操作类型(已报名/待审核auditing, + /** + * (5)act_user_relation表的REWARD_FLAG:给积分agree + */ + String ACT_USER_STATUS_AGREE="agree"; + + /** + * (6)act_user_relation表的REWARD_FLAG:不给积分deny + */ + String ACT_USER_STATUS_DENY="deny"; + + /** + * (7)act_user_relation表的SIGN_IN_FLAG:已签到 + */ + String ACT_USER_STATUS_SIGNED_IN="signed_in"; + + /*act_user_log表:操作类型( + 已报名/待审核auditing, 审核通过passed, 审核不通过refused 取消报名canceld, 已签到signedin - 发放积分rewarded + 发放积分rewarded 拒绝发放积分refuse_reward - 重新处理processing + 重新处理processing )*/ String ACT_USER_LOG_OPER_AUDITING="auditing"; String ACT_USER_LOG_OPER_PASSED="passed"; @@ -111,4 +127,39 @@ public interface ActConstant { */ String PASSEDTYPE_AUTO="auto"; String PASSEDTYPE_MANUAL="manual"; + + /** + * (1)用户活动页面按钮控制:我要报名 + */ + String CURRENT_STATUS_USER_SIGN_UP = "sign_up"; + + /** + * (2)用户活动页面按钮控制:已报满 + */ + String CURRENT_STATUS_USER_ENOUGH = "enough"; + + /** + * (3)用户活动页面按钮控制:截止报名 + */ + String CURRENT_STATUS_USER_END_SIGN_UP = "end_sign_up"; + + /** + * (4)用户活动页面按钮控制:已开始 + */ + String CURRENT_STATUS_USER_IN_PROGRESS = "in_progress"; + + /** + * (5)用户活动页面按钮控制:已结束 + */ + String CURRENT_STATUS_USER_FINISHED = "finished"; + + /** + * (6)用户活动页面按钮控制:已取消 + */ + String CURRENT_STATUS_USER_CANCELED = "canceled"; + + /** + * (7)用户活动页面按钮控制:已确认积分 + */ + String CURRENT_STATUS_USER_POINTS_CONFIRM = "points_confirm"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java index 18e96e4c23..79d97f2bfa 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java @@ -20,18 +20,18 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; 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.ActConstant; import com.epmet.dao.ActInfoDao; import com.epmet.dao.ActUserRelationDao; import com.epmet.dao.HeartUserInfoDao; -import com.epmet.dao.VolunteerInfoDao; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.form.resi.*; import com.epmet.dto.result.resi.*; @@ -40,8 +40,6 @@ import com.epmet.entity.ActUserRelationEntity; import com.epmet.redis.ActInfoRedis; import com.epmet.service.ActInfoService; import com.epmet.service.ActUserRelationService; -import com.epmet.utils.ActUserRelationStatusConstant; -import com.epmet.utils.ActUserStatusConstant; import com.epmet.utils.CaculateDistance; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -228,12 +226,12 @@ public class ActInfoServiceImpl extends BaseServiceImpl signUpNum) { // 我要报名(不限名额或者未报满的) - return ActUserStatusConstant.SIGN_UP; + return ActConstant.CURRENT_STATUS_USER_SIGN_UP; } else { // 已报满(限制名额且已经报满的) - return ActUserStatusConstant.ENOUGH; + return ActConstant.CURRENT_STATUS_USER_ENOUGH; } } else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) { /*报名结束,活动未开始:显示:截止报名*/ - return ActUserStatusConstant.END_SIGN_UP; + return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP; } else if (currentTime.after(actInfoEntity.getSignInStartTime()) && currentTime.before(actInfoEntity.getSignInEndTime())) { // 活动打卡时间段内: 显示:已开始 - return ActUserStatusConstant.IN_PROGRESS; + return ActConstant.CURRENT_STATUS_USER_IN_PROGRESS; } else { - return ActUserStatusConstant.FINISHED; + return ActConstant.CURRENT_STATUS_USER_FINISHED; } } @@ -298,58 +296,58 @@ public class ActInfoServiceImpl extends BaseServiceImpl= actInfoEntity.getActQuota()) { - return ActUserStatusConstant.ENOUGH; + return ActConstant.CURRENT_STATUS_USER_ENOUGH; } // (报名审核未通过或者已经取消报名的)可再次报名-我要报名 - if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus) || ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) { - return ActUserStatusConstant.SIGN_UP; + if (ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus) || ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) { + return ActConstant.CURRENT_STATUS_USER_SIGN_UP; } } else if (currentTime.after(actInfoEntity.getSignUpEndTime()) && currentTime.before(actInfoEntity.getActStartTime())) { /* 报名截止但 活动未开始 */ // 已经取消报名的-报名截止 - if (ActUserRelationStatusConstant.CANCELD.equals(actUserStatus)) { - return ActUserStatusConstant.END_SIGN_UP; + if (ActConstant.ACT_USER_STATUS_CANCELD.equals(actUserStatus)) { + return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP; } // 已报名审核不通过 -报名截止 - if (ActUserRelationStatusConstant.REFUSED.equals(actUserStatus)) { - return ActUserStatusConstant.END_SIGN_UP; + if (ActConstant.ACT_USER_STATUS_REFUSED.equals(actUserStatus)) { + return ActConstant.CURRENT_STATUS_USER_END_SIGN_UP; } // 已报名且审核通过、未审核 -取消报名 - if (ActUserRelationStatusConstant.PASSED.equals(actUserStatus) || ActUserRelationStatusConstant.AUDITING.equals(actUserStatus)) { - return ActUserStatusConstant.CANCELD; + if (ActConstant.ACT_USER_STATUS_PASSED.equals(actUserStatus) || ActConstant.ACT_USER_STATUS_AUDITING.equals(actUserStatus)) { + return ActConstant.ACT_USER_STATUS_CANCELD; } } - return ActUserStatusConstant.FINISHED; + return ActConstant.CURRENT_STATUS_USER_FINISHED; } @Override diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java index 88719c0b99..5cc716d8b4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.constant.ActConstant; import com.epmet.dao.ActSignInPicDao; import com.epmet.dao.ActSignInRecDao; import com.epmet.dao.ActUserLogDao; @@ -35,7 +36,6 @@ import com.epmet.entity.ActUserLogEntity; import com.epmet.redis.ActSignInRecRedis; import com.epmet.service.ActLiveRecService; import com.epmet.service.ActSignInRecService; -import com.epmet.utils.ActUserRelationStatusConstant; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -74,14 +74,14 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl Date: Fri, 24 Jul 2020 10:38:36 +0800 Subject: [PATCH 064/157] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E8=BF=90?= =?UTF-8?q?=E8=90=A5=E7=AB=AF=E5=AE=A2=E6=88=B7=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E6=9C=89=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98->=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E6=9C=89?= =?UTF-8?q?=E6=A0=B9=E7=AE=A1=E7=90=86=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/CustomerServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index ecafef1a96..238a90a94a 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -158,7 +158,7 @@ public class CustomerServiceImpl extends BaseServiceImpl>> managersResult = epmetUserFeignClient.getStaffsInRoleOfOrgs(staffRoleFormDTO); if (managersResult.success()) { Map> rootAgencyManagerMap = managersResult.getData(); From da49ee682d0e59678a4feb1c233ae60db7bbba60 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Jul 2020 10:39:02 +0800 Subject: [PATCH 065/157] =?UTF-8?q?heart-work:act=5Fuser=5Flog=E5=88=A0?= =?UTF-8?q?=E9=99=A4*=20=E5=8F=91=E6=94=BE=E7=A7=AF=E5=88=86rewarded=20?= =?UTF-8?q?=E6=8B=92=E7=BB=9D=E5=8F=91=E6=94=BE=E7=A7=AF=E5=88=86refuse=5F?= =?UTF-8?q?reward=20=E9=87=8D=E6=96=B0=E5=A4=84=E7=90=86processing?= =?UTF-8?q?=E8=BF=99=E4=B8=89=E4=B8=AA=E6=93=8D=E4=BD=9C=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=EF=BC=8C=E5=9C=A8act=5Fpoint=5Flog=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/ActUserLogDTO.java | 3 --- .../src/main/java/com/epmet/constant/ActConstant.java | 6 ------ .../src/main/java/com/epmet/entity/ActUserLogEntity.java | 3 --- 3 files changed, 12 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java index aecb1b1750..fa3ec4ecd8 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java @@ -55,9 +55,6 @@ public class ActUserLogDTO implements Serializable { * 审核不通过refused * 取消报名canceld, * 已签到signedin - * 发放积分rewarded - * 拒绝发放积分refuse_reward - * 重新处理processing * ) */ private String operationType; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java index a13c2bed23..b15e4c5893 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java @@ -93,18 +93,12 @@ public interface ActConstant { 审核不通过refused 取消报名canceld, 已签到signedin - 发放积分rewarded - 拒绝发放积分refuse_reward - 重新处理processing )*/ String ACT_USER_LOG_OPER_AUDITING="auditing"; String ACT_USER_LOG_OPER_PASSED="passed"; String ACT_USER_LOG_OPER_REFUSED="refused"; String ACT_USER_LOG_OPER_CANCELD="canceld"; String ACT_USER_LOG_OPER_SIGNEDIN="signedin"; - String ACT_USER_LOG_OPER_REWARDED="rewarded"; - String ACT_USER_LOG_OPER_REFUSE_REWARD="refuse_reward"; - String ACT_USER_LOG_OPER_PROCESSING="processing"; /** * 审核通过类型:auto, manual diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java index ac05ba61d1..49716d0dac 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java @@ -51,9 +51,6 @@ public class ActUserLogEntity extends BaseEpmetEntity { * 审核不通过refused * 取消报名canceld, * 已签到signedin - * 发放积分rewarded - * 拒绝发放积分refuse_reward - * 重新处理processing * ) */ private String operationType; From 9a0a053664669eb7120d2a19696a6fd869574600 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 24 Jul 2020 10:39:18 +0800 Subject: [PATCH 066/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/oper-crm/oper-crm-server/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/oper-crm/oper-crm-server/pom.xml b/epmet-module/oper-crm/oper-crm-server/pom.xml index e839c0930c..6f9b5a7942 100644 --- a/epmet-module/oper-crm/oper-crm-server/pom.xml +++ b/epmet-module/oper-crm/oper-crm-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.29 + 0.3.30 com.epmet oper-crm From e480d51ab2a525b37aa07df4958306857a5394df Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 24 Jul 2020 10:43:14 +0800 Subject: [PATCH 067/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oper-crm/oper-crm-server/deploy/docker-compose-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml index 73ed7cfe6a..c401ef7909 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.29 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.30 ports: - "8090:8090" network_mode: host # 使用现有网络 From 185c7efca405dc8118636b245a074489d6051fcc Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Jul 2020 11:01:23 +0800 Subject: [PATCH 068/157] =?UTF-8?q?heart-work:=E5=B7=B2=E7=BB=93=E6=9D=9F?= =?UTF-8?q?=E4=BA=BA=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/work/CanceledUserResultDTO.java | 62 ++++++++++++++ .../dto/result/work/JoinedUserResultDTO.java | 82 +++++++++++++++++++ .../controller/WorkActUserController.java | 26 ++++++ .../main/java/com/epmet/dao/ActInfoDao.java | 23 +++++- .../com/epmet/service/WorkActUserService.java | 18 ++++ .../service/impl/WorkActUserServiceImpl.java | 72 ++++++++++++++++ .../src/main/resources/mapper/ActInfoDao.xml | 49 +++++++++++ .../resources/mapper/ActUserRelationDao.xml | 12 ++- 8 files changed, 337 insertions(+), 7 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledUserResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledUserResultDTO.java new file mode 100644 index 0000000000..6a02a9796d --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledUserResultDTO.java @@ -0,0 +1,62 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 已结束-已取消报名人员列表 返参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 10:51 + */ +@Data +public class CanceledUserResultDTO implements Serializable { + private static final long serialVersionUID = 5261680369821817096L; + /** + * 主键 + */ + private String actUserRelationId; + + /** + * 活动id + */ + private String actId; + + /** + * 用户id + */ + private String userId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + /** + * true: 是志愿者 false : 不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 取消时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date cancelTime; + + /** + * 取消原因 + */ + private String cancelReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java new file mode 100644 index 0000000000..821364850a --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/JoinedUserResultDTO.java @@ -0,0 +1,82 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 已结束-已参加人员列表 返参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/24 9:54 + */ +@Data +public class JoinedUserResultDTO implements Serializable { + private static final long serialVersionUID = 3120376299314043862L; + /** + * 主键 + */ + private String actUserRelationId; + + /** + * 活动id + */ + private String actId; + + /** + * 用户id + */ + private String userId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true已签到 false:未签到 + */ + private Boolean signInFlag; + + /** + * true: 是志愿者 false : 不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 报名时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpTime; + + /** + * 积分说明,接口直接返回:积分+5 或者 积分+0 + */ + private String pointsDes; + + /** + * 活动奖励积分 + */ + @JsonIgnore + private Integer reward; + + /** + * 已给分:agree, 不给分:deny 默认"" + */ + @JsonIgnore + private String rewardFlag; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java index e3a6c97e49..ff87861170 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java @@ -148,4 +148,30 @@ public class WorkActUserController { workActUserService.auditRefuse(formDTO); return new Result(); } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 已结束-已参加人员列表 + * @Date 2020/7/24 10:17 + **/ + @PostMapping("joinuserlist") + public Result> queryJoinUserList(@RequestBody AuditingActUserFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.queryJoinUserList(formDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param formDTO + * @author yinzuomei + * @description 已结束-已取消报名人员列表 + * @Date 2020/7/24 10:53 + **/ + @PostMapping("canceleduserlist") + public Result> queryCanceledUserList(@RequestBody AuditingActUserFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.queryCanceledUserList(formDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index 700c114b6d..86bbf2afde 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java @@ -24,10 +24,7 @@ import com.epmet.dto.form.resi.ResiActDetailFormDTO; import com.epmet.dto.form.resi.ResiLatestActFormDTO; import com.epmet.dto.form.resi.ResiMyActFormDTO; import com.epmet.dto.result.resi.*; -import com.epmet.dto.result.work.ActSignUpStatResultDTO; -import com.epmet.dto.result.work.CanceledActResultDTO; -import com.epmet.dto.result.work.FinishedActResultDTO; -import com.epmet.dto.result.work.InProgressActResultDTO; +import com.epmet.dto.result.work.*; import com.epmet.entity.ActInfoEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -255,4 +252,22 @@ public interface ActInfoDao extends BaseDao { * @Date 2020/7/23 23:21 **/ List selectFinishedList(String customerId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 已结束-已参加人员列表 + * @Date 2020/7/24 10:18 + **/ + List queryJoinUserList(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 已结束-已取消报名人员列表 + * @Date 2020/7/24 10:55 + **/ + List queryCanceledUserList(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java index 0d125567c4..035f4792a3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java @@ -95,4 +95,22 @@ public interface WorkActUserService { * @Date 2020/7/23 18:14 **/ void auditRefuse(AuditUserFormDTO formDTO); + + /** + * @return java.util.List + * @param formDTO + * @author yinzuomei + * @description 已结束-已参加人员列表 + * @Date 2020/7/24 10:17 + **/ + List queryJoinUserList(AuditingActUserFormDTO formDTO); + + /** + * @return java.util.List + * @param formDTO + * @author yinzuomei + * @description 已结束-已取消报名人员列表 + * @Date 2020/7/24 10:54 + **/ + List queryCanceledUserList(AuditingActUserFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index d98eafc875..0061c0186b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -434,6 +434,78 @@ public class WorkActUserServiceImpl implements WorkActUserService { this.saveUserMessage(actUserRelationEntity,ActConstant.ACT_USER_STATUS_REFUSED,actInfo); } + /** + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @description 已结束-已参加人员列表 + * @Date 2020/7/24 10:17 + **/ + @Override + public List queryJoinUserList(AuditingActUserFormDTO formDTO) { + List list=actInfoDao.queryJoinUserList(formDTO.getActId()); + if(null!=list&&list.size()>0){ + //查询已通过审核的人员id集合 + List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_PASSED); + //根据已通过的人员集合,查询出用户基本信息 + List userInfoList=this.queryUserBaseInfoList(userIdList); + for(JoinedUserResultDTO joinedUserResultDTO:list){ + //积分描述赋值 + if(ActConstant.ACT_USER_STATUS_AGREE.equals(joinedUserResultDTO.getRewardFlag())){ + joinedUserResultDTO.setPointsDes(String.format("积分+%s",joinedUserResultDTO.getReward())); + }else if(ActConstant.ACT_USER_STATUS_DENY.equals(joinedUserResultDTO.getRewardFlag())){ + joinedUserResultDTO.setPointsDes("积分+0"); + } + //志愿者标识赋值 + joinedUserResultDTO.setVolunteerFlag(this.getVolunteerFlag(joinedUserResultDTO.getUserId())); + //基础信息赋值 + for(UserBaseInfoResultDTO userBaseInfo:userInfoList){ + if(joinedUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){ + joinedUserResultDTO.setRealName(userBaseInfo.getRealName()); + joinedUserResultDTO.setNickName(userBaseInfo.getNickname()); + joinedUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); + break; + } + + } + } + } + return list; + } + + /** + * @param formDTO + * @return java.util.List + * @author yinzuomei + * @description 已结束-已取消报名人员列表 + * @Date 2020/7/24 10:54 + **/ + @Override + public List queryCanceledUserList(AuditingActUserFormDTO formDTO) { + List list=actInfoDao.queryCanceledUserList(formDTO.getActId()); + if(null!=list&&list.size()>0){ + //查询已取消报名的人员id集合 + List userIdList=actUserRelationService.getUserIdList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_CANCELD); + //根据已取消报名的人员集合,查询出用户基本信息 + List userInfoList=this.queryUserBaseInfoList(userIdList); + for(CanceledUserResultDTO canceledUserResultDTO:list){ + //志愿者标识赋值 + canceledUserResultDTO.setVolunteerFlag(this.getVolunteerFlag(canceledUserResultDTO.getUserId())); + //基础信息赋值 + for(UserBaseInfoResultDTO userBaseInfo:userInfoList){ + if(canceledUserResultDTO.getUserId().equals(userBaseInfo.getUserId())){ + canceledUserResultDTO.setRealName(userBaseInfo.getRealName()); + canceledUserResultDTO.setNickName(userBaseInfo.getNickname()); + canceledUserResultDTO.setHeadImgUrl(userBaseInfo.getHeadImgUrl()); + break; + } + + } + } + } + return list; + } + /** * @param actUserRelationEntity * @param type diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 2ddf0c9398..ce22f96e49 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -528,4 +528,53 @@ ORDER BY ai.ACTUAL_END_TIME DESC + + + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index 1c60d1b7af..ac63e1f255 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -33,7 +33,9 @@ act_user_relation aur WHERE aur.DEL_FLAG = '0' - AND aur.`STATUS` = #{status} + + AND aur.`STATUS` = #{status} + AND aur.ACT_ID = #{actId} order by aur.CREATED_TIME desc @@ -46,7 +48,9 @@ act_user_relation aur WHERE aur.DEL_FLAG = '0' - AND aur.`STATUS` =#{status} + + AND aur.`STATUS` =#{status} + AND aur.ACT_ID = #{actId} order by aur.CREATED_TIME desc @@ -58,7 +62,9 @@ act_user_relation aur WHERE aur.DEL_FLAG = '0' - AND aur.`STATUS` =#{status} + + AND aur.`STATUS` =#{status} + AND aur.ACT_ID = #{actId} From e0a154b41702881be80c4750a1eda38a0265d31e Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 24 Jul 2020 11:10:57 +0800 Subject: [PATCH 069/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../oper-crm/oper-crm-server/deploy/docker-compose-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml index ef1e3d8974..97697a5f27 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/oper-crm-server:0.3.29 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/oper-crm-server:0.3.30 ports: - "8090:8090" network_mode: host # 使用现有网络 From 6f83776e2cbab3bd9f8d8f05fe465b4e649ffb0d Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Jul 2020 11:15:25 +0800 Subject: [PATCH 070/157] =?UTF-8?q?heart-work:=E4=BF=AE=E6=94=B9=E5=85=A5?= =?UTF-8?q?=E5=8F=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...gActUserFormDTO.java => ActIdFormDTO.java} | 11 ++++--- .../controller/GrantPointsController.java | 7 ++++ .../controller/WorkActUserController.java | 33 +++++++++---------- .../com/epmet/service/WorkActUserService.java | 17 ++++------ .../service/impl/WorkActUserServiceImpl.java | 17 ++++------ 5 files changed, 42 insertions(+), 43 deletions(-) rename epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/{AuditingActUserFormDTO.java => ActIdFormDTO.java} (50%) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditingActUserFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java similarity index 50% rename from epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditingActUserFormDTO.java rename to epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java index 9fb58c8179..632b567c11 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/AuditingActUserFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/ActIdFormDTO.java @@ -6,18 +6,19 @@ import javax.validation.constraints.NotBlank; import java.io.Serializable; /** - * 报名审核-待审核列表入参 + * 活动id通用formdto * * @author yinzuomei@elink-cn.com - * @date 2020/7/21 22:12 + * @date 2020/7/24 11:07 */ @Data -public class AuditingActUserFormDTO implements Serializable { - private static final long serialVersionUID = 3811387419859675753L; +public class ActIdFormDTO implements Serializable { + private static final long serialVersionUID = 7151533863877527886L; + public interface AddUserInternalGroup {} /** * 活动id */ - @NotBlank(message = "活动id不能为空", groups = { AddUserInternalGroup.class }) + @NotBlank(message = "活动id不能为空", groups = { ActIdFormDTO.AddUserInternalGroup.class }) private String actId; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java index f28d58a269..aec0849ddd 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java @@ -1,5 +1,7 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.Result; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -12,4 +14,9 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("grantpoints") public class GrantPointsController { + @PostMapping("pendinglist") + public Result queryPendingList(){ + return new Result(); + } + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java index ff87861170..d7d1d0eb2e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActUserController.java @@ -2,10 +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.work.AactUserDetailFormDTO; -import com.epmet.dto.form.work.AuditUserFormDTO; -import com.epmet.dto.form.work.AuditingActUserFormDTO; -import com.epmet.dto.form.work.UserHistoricalActFormDTO; +import com.epmet.dto.form.work.*; import com.epmet.dto.result.work.*; import com.epmet.service.WorkActUserService; import org.springframework.beans.factory.annotation.Autowired; @@ -37,8 +34,8 @@ public class WorkActUserController { * @Date 2020/7/21 22:24 **/ @PostMapping("auditinglist") - public Result> getAuditingList(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); + public Result> getAuditingList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActUserService.getAuditingList(formDTO)); } @@ -51,8 +48,8 @@ public class WorkActUserController { * @Date 2020/7/22 15:16 **/ @PostMapping("passedlist") - public Result> getPassedList(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); + public Result> getPassedList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActUserService.getPassedList(formDTO)); } @@ -64,8 +61,8 @@ public class WorkActUserController { * @Date 2020/7/22 15:49 **/ @PostMapping("rejectedlist") - public Result> getRejectedlist(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); + public Result> getRejectedlist(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActUserService.getRejectedlist(formDTO)); } @@ -77,8 +74,8 @@ public class WorkActUserController { * @Date 2020/7/22 16:23 **/ @PostMapping("canceledlist") - public Result> getCanceledList(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); + public Result> getCanceledList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActUserService.getCanceledList(formDTO)); } @@ -90,8 +87,8 @@ public class WorkActUserController { * @Date 2020/7/22 16:43 **/ @PostMapping("signupstat") - public Result getActSignUpStat(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); + public Result getActSignUpStat(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result().ok(workActUserService.getActSignUpStat(formDTO.getActId())); } @@ -157,8 +154,8 @@ public class WorkActUserController { * @Date 2020/7/24 10:17 **/ @PostMapping("joinuserlist") - public Result> queryJoinUserList(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); + public Result> queryJoinUserList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActUserService.queryJoinUserList(formDTO)); } @@ -170,8 +167,8 @@ public class WorkActUserController { * @Date 2020/7/24 10:53 **/ @PostMapping("canceleduserlist") - public Result> queryCanceledUserList(@RequestBody AuditingActUserFormDTO formDTO){ - ValidatorUtils.validateEntity(formDTO, AuditingActUserFormDTO.AddUserInternalGroup.class); + public Result> queryCanceledUserList(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActUserService.queryCanceledUserList(formDTO)); } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java index 035f4792a3..bcd3807014 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActUserService.java @@ -1,9 +1,6 @@ package com.epmet.service; -import com.epmet.dto.form.work.AactUserDetailFormDTO; -import com.epmet.dto.form.work.AuditUserFormDTO; -import com.epmet.dto.form.work.AuditingActUserFormDTO; -import com.epmet.dto.form.work.UserHistoricalActFormDTO; +import com.epmet.dto.form.work.*; import com.epmet.dto.result.work.*; import java.util.List; @@ -22,7 +19,7 @@ public interface WorkActUserService { * @description 报名审核-待审核列表 * @Date 2020/7/21 22:25 **/ - List getAuditingList(AuditingActUserFormDTO formDTO); + List getAuditingList(ActIdFormDTO formDTO); /** * @return java.util.List @@ -31,7 +28,7 @@ public interface WorkActUserService { * @description 报名审核-已通过列表 * @Date 2020/7/22 15:16 **/ - List getPassedList(AuditingActUserFormDTO formDTO); + List getPassedList(ActIdFormDTO formDTO); /** * @return java.util.List @@ -40,7 +37,7 @@ public interface WorkActUserService { * @description 报名审核-已拒绝列表 * @Date 2020/7/22 15:50 **/ - List getRejectedlist(AuditingActUserFormDTO formDTO); + List getRejectedlist(ActIdFormDTO formDTO); /** * @return java.util.List @@ -49,7 +46,7 @@ public interface WorkActUserService { * @description 报名审核-已取消报名列表 * @Date 2020/7/22 16:35 **/ - List getCanceledList(AuditingActUserFormDTO formDTO); + List getCanceledList(ActIdFormDTO formDTO); /** * @return com.epmet.dto.result.work.ActSignUpStatResultDTO @@ -103,7 +100,7 @@ public interface WorkActUserService { * @description 已结束-已参加人员列表 * @Date 2020/7/24 10:17 **/ - List queryJoinUserList(AuditingActUserFormDTO formDTO); + List queryJoinUserList(ActIdFormDTO formDTO); /** * @return java.util.List @@ -112,5 +109,5 @@ public interface WorkActUserService { * @description 已结束-已取消报名人员列表 * @Date 2020/7/24 10:54 **/ - List queryCanceledUserList(AuditingActUserFormDTO formDTO); + List queryCanceledUserList(ActIdFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index 0061c0186b..6d6c81157a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -16,10 +16,7 @@ import com.epmet.dto.ActUserLogDTO; import com.epmet.dto.ActUserRelationDTO; import com.epmet.dto.HeartUserInfoDTO; import com.epmet.dto.form.UserMessageFormDTO; -import com.epmet.dto.form.work.AactUserDetailFormDTO; -import com.epmet.dto.form.work.AuditUserFormDTO; -import com.epmet.dto.form.work.AuditingActUserFormDTO; -import com.epmet.dto.form.work.UserHistoricalActFormDTO; +import com.epmet.dto.form.work.*; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.work.*; import com.epmet.entity.ActInfoEntity; @@ -72,7 +69,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/21 22:25 **/ @Override - public List getAuditingList(AuditingActUserFormDTO formDTO) { + public List getAuditingList(ActIdFormDTO formDTO) { List list=new ArrayList<>(); //查询出待审核的人员列表 List actUserRelationDTOList=actUserRelationService.getUserList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_AUDITING); @@ -114,7 +111,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/22 15:16 **/ @Override - public List getPassedList(AuditingActUserFormDTO formDTO) { + public List getPassedList(ActIdFormDTO formDTO) { List resultList=new ArrayList<>(); //查询已通过的人员列表 List actUserRelationDTOList=actUserRelationService.getUserList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_PASSED); @@ -157,7 +154,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/22 15:50 **/ @Override - public List getRejectedlist(AuditingActUserFormDTO formDTO) { + public List getRejectedlist(ActIdFormDTO formDTO) { List resultList=new ArrayList<>(); //查询已拒绝的人员列表 List actUserRelationDTOList=actUserRelationService.getUserList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_REFUSED); @@ -201,7 +198,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/22 16:35 **/ @Override - public List getCanceledList(AuditingActUserFormDTO formDTO) { + public List getCanceledList(ActIdFormDTO formDTO) { List resultList=new ArrayList<>(); //查询已取消的人员列表 List actUserRelationDTOList=actUserRelationService.getUserList(formDTO.getActId(), ActConstant.ACT_USER_STATUS_CANCELD); @@ -442,7 +439,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/24 10:17 **/ @Override - public List queryJoinUserList(AuditingActUserFormDTO formDTO) { + public List queryJoinUserList(ActIdFormDTO formDTO) { List list=actInfoDao.queryJoinUserList(formDTO.getActId()); if(null!=list&&list.size()>0){ //查询已通过审核的人员id集合 @@ -481,7 +478,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { * @Date 2020/7/24 10:54 **/ @Override - public List queryCanceledUserList(AuditingActUserFormDTO formDTO) { + public List queryCanceledUserList(ActIdFormDTO formDTO) { List list=actInfoDao.queryCanceledUserList(formDTO.getActId()); if(null!=list&&list.size()>0){ //查询已取消报名的人员id集合 From d0792ac9952e9287657873b5b7d8ddb3206ca174 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 13:22:04 +0800 Subject: [PATCH 071/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E6=8E=88=E6=9D=83=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/AuthResultRecordFormDTO.java | 86 ++++++++++++++ .../com/epmet/constant/ModuleConstant.java | 3 + .../constant/ThirdRunTimeInfoConstant.java | 2 + .../com/epmet/dao/AuthResultRecordDao.java | 8 ++ .../java/com/epmet/dao/CustomerMpDao.java | 8 ++ .../ComponentVerifyTicketServiceImpl.java | 110 +++++++++++++----- .../resources/mapper/AuthResultRecordDao.xml | 21 ++++ .../main/resources/mapper/CustomerMpDao.xml | 12 ++ 8 files changed, 218 insertions(+), 32 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthResultRecordFormDTO.java diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthResultRecordFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthResultRecordFormDTO.java new file mode 100644 index 0000000000..6223eafc66 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthResultRecordFormDTO.java @@ -0,0 +1,86 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author zxc + * @CreateTime 2020/7/24 9:22 + */ +@Data +public class AuthResultRecordFormDTO implements Serializable { + + private static final long serialVersionUID = -5359209459022630868L; + + /** + * ID + */ + private String id; + + /** + * 客户ID + */ + private String customerId; + + /** + * resi:居民端,work:工作端 + */ + private String clientType; + + /** + * 第三方平台AppId 第三方平台AppId + */ + private String componentAppId; + + /** + * 微信返回创建时间 微信返回创建时间 + */ + private Date wechatCreateTime; + + /** + * 通知类型 + */ + private String InfoType; + + /** + * 授权方AppId + */ + private String AuthorizerAppid; + + /** + * 授权码(auth_code) + */ + private String AuthorizationCode; + + /** + * 授权码过期时间 + */ + private Date ExpiredTime; + + /** + * 预授权码 + */ + private String PreAuthCode; + + /** + * 删除状态 + */ + private Integer delFlag = 0; + + /** + * 乐观锁 + */ + private Integer revision = 0; + + /** + * 创建人 + */ + private String createdBy = "APP_USER"; + + /** + * 更新人 + */ + private String updatedBy = "APP_USER"; +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java index c157efc7ce..d787e30ed1 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -22,9 +22,12 @@ public interface ModuleConstant { String AUTHORIZATION_CODE_HUMP = "AuthorizationCode"; String UNAUTHORIZED = "unauthorized"; String AUTHORIZED = "authorized"; + String UPDATE_AUTHORIZED = "updateauthorized"; String NULL_CHAR = ""; String SUCCESS = "success"; String AUTHORIZER_APP_ID_HUMP = "AuthorizerAppid"; + String PRE_AUTH_CODE_HUMP = "PreAuthCode"; + String AUTHORIZATION_CODE_EXPIRED_TIME = "AuthorizationCodeExpiredTime"; // 获取 component_access_token 如下 String COMPONENT_APPID = "component_appid"; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java index 2e4e5e7083..92f372b4fd 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java @@ -82,4 +82,6 @@ public interface ThirdRunTimeInfoConstant { String VERIFY_TICKET = "msgSignature = %s, timeStamp = %s, nonce = %s, encryptType = %s, signature = %s"; + String REFRESH_AUTH_ACCESS_TOKEN = "查询到新的 授权方【access_token】"; + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java index ca98874003..42bb397220 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthResultRecordDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.form.AuthResultRecordFormDTO; import com.epmet.entity.AuthResultRecordEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +30,12 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface AuthResultRecordDao extends BaseDao { + + /** + * @Description 插入授权结果记录 + * @param formDTO + * @author zxc + */ + void insertAuthResultRecord(AuthResultRecordFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java index b6c9376f6d..ae1fb6ebf7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java @@ -107,4 +107,12 @@ public interface CustomerMpDao extends BaseDao { * @Description 根据appId查询客户信息 **/ PaCustomerDTO selectCustomerByAppId(@Param("appId") String appId); + + /** + * @Description 校验此小程序是不是绑定别的客户端 + * @param authAppId + * @param clientType + * @author zxc + */ + Integer checkBind(String authAppId,String clientType); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 6fbac46cd3..1b1617d636 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -1,7 +1,9 @@ package com.epmet.service.impl; +import cn.hutool.core.convert.Convert; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; import com.alibaba.nacos.client.config.utils.IOUtils; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; @@ -77,6 +79,8 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe private BusinessInfoDao businessInfoDao; @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private AuthResultRecordDao authResultRecordDao; @Value("${third.platform.appId}") private String componentAppId; @@ -136,16 +140,16 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe log.info(ModuleConstant.TICKET_UNDERLINE_KEY+":"+ComponentVerifyTicket); break; case ModuleConstant.AUTHORIZED: //授权成功 - // 更改customer_mp 授权信息,appId,并绑定 - String authCode = result.get(ModuleConstant.AUTHORIZATION_CODE_HUMP); - String authAppId = result.get(ModuleConstant.AUTHORIZER_APP_ID_HUMP); - log.info("=============================="+authCode); - + this.disposeAuthResult(result); break; case ModuleConstant.UNAUTHORIZED://用户取消授权 //todo 取消授权 String authorizerAppId = result.get(ModuleConstant.AUTHORIZER_APP_ID_HUMP); customerMpDao.updateAuthorizationFlag(authorizerAppId); + this.disposeAuthResult(result); + break; + case ModuleConstant.UPDATE_AUTHORIZED://授权变更 + this.disposeAuthResult(result); break; } } catch (Exception e) { @@ -161,6 +165,24 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe return ModuleConstant.SUCCESS; } + /** + * @Description 授权结果插入 + * @param result + * @author zxc + */ + @Transactional(rollbackFor = Exception.class) + public void disposeAuthResult(Map result){ + Map tempMap = result; + Map data = tempMap; + AuthResultRecordFormDTO authResultRecord = mapToEntity(data, AuthResultRecordFormDTO.class); + authResultRecord.setWechatCreateTime(this.sToDate(result.get(ModuleConstant.CREATE_TIME))); + if (result.containsKey(ModuleConstant.AUTHORIZATION_CODE_EXPIRED_TIME)) { + authResultRecord.setExpiredTime(this.sToDate(result.get(ModuleConstant.AUTHORIZATION_CODE_EXPIRED_TIME))); + } + authResultRecord.setComponentAppId(componentAppId); + authResultRecordDao.insertAuthResultRecord(authResultRecord); + } + /** * @Description 定时获取 (令牌,component_access_token) 第三方与微信交互使用的component_access_token * 每十分钟执行一次,判断是否有马上超时的(15分钟以内算马上超时) @@ -329,28 +351,31 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String componentAccessToken = redisThird.getComponentAccessToken(); String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_AUTHORIZER_TOKEN_URL + componentAccessToken, JSON.toJSONString(jsonObject)).getData(); Map map = JSON.parseObject(data, HashMap.class); - //authorizer_access_token - String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString(); - String expiresIn = map.get(ModuleConstant.EXPIRES_IN).toString(); - String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); - Date expiresInTime = this.countExpirationTime(expiresIn); - //更新DB - AuthorizerAccessTokenFormDTO formDTO = new AuthorizerAccessTokenFormDTO(); - AuthorizationInfoFormDTO authorizationInfo = new AuthorizationInfoFormDTO(); - BeanUtils.copyProperties(formDTO,authorizationInfo); - authorizationInfo.setAuthorizerAppid(authAppId); - formDTO.setAuthorizerAccessToken(authorizerAccessToken); - formDTO.setAuthorizerRefreshToken(authorizerRefreshToken); - formDTO.setExpiresInTime(expiresInTime); - formDTO.setCustomerId(customerId); - formDTO.setAuthAppid(authAppId); - formDTO.setClientType(clientType); - //先逻辑删除,在插入 - authorizationInfoDao.updateOldAuthorizerAccessToken(customerId,clientType); - authorizationInfoDao.insertAuthorizerAccessToken(formDTO); + if (!map.containsKey(ModuleConstant.ERR_CODE)) { + log.info(REFRESH_AUTH_ACCESS_TOKEN); + //authorizer_access_token + String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString(); + String expiresIn = map.get(ModuleConstant.EXPIRES_IN).toString(); + String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); + Date expiresInTime = this.countExpirationTime(expiresIn); + //更新DB + AuthorizerAccessTokenFormDTO formDTO = new AuthorizerAccessTokenFormDTO(); + AuthorizationInfoFormDTO authorizationInfo = new AuthorizationInfoFormDTO(); + BeanUtils.copyProperties(formDTO, authorizationInfo); + authorizationInfo.setAuthorizerAppid(authAppId); + formDTO.setAuthorizerAccessToken(authorizerAccessToken); + formDTO.setAuthorizerRefreshToken(authorizerRefreshToken); + formDTO.setExpiresInTime(expiresInTime); + formDTO.setCustomerId(customerId); + formDTO.setAuthAppid(authAppId); + formDTO.setClientType(clientType); + //先逻辑删除,在插入 + authorizationInfoDao.updateOldAuthorizerAccessToken(customerId, clientType); + authorizationInfoDao.insertAuthorizerAccessToken(formDTO); - //缓存 refreshAuthorizerAccessToken - redisThird.setAuthorizerRefreshToken(authorizationInfo); + //缓存 refreshAuthorizerAccessToken + redisThird.setAuthorizerRefreshToken(authorizationInfo); + } }); log.info("更新authorizer_access_token成功"); } @@ -388,6 +413,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe redisThird.setAuthCode(formDTO); AuthorizationInfoResultDTO authorizationInfoResultDTO = this.authInfoByAuthCode(authCode, customerId, clientType); String authAppId = authorizationInfoResultDTO.getAuthorizer_appid(); + // todo ================================================ AuthCodeResultDTO authCodeResultDTO = authorizationInfoDao.selectCustomerIdByAuthAppId(authAppId); this.createAndBindOpenAccount(customerId,authAppId,clientType); this.updateCustomerMpAppId(customerId,authAppId,clientType); @@ -499,12 +525,15 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe @Transactional(rollbackFor = Exception.class) public void updateCustomerMpAppId(String customerId,String authAppId,String clientType){ log.info("==========回填customer_mp开始=========="); - AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); - formDTO.setClientType(clientType); - formDTO.setAuthAppId(authAppId); - formDTO.setCustomerId(customerId); - //回填customer_mp的appId 只需以上三个字段 - customerMpDao.updateAppIDByCustomerIdAndClient(formDTO); + Integer checkBindCount = customerMpDao.checkBind(authAppId, clientType); + if (checkBindCount == NumConstant.ZERO) { + AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); + formDTO.setClientType(clientType); + formDTO.setAuthAppId(authAppId); + formDTO.setCustomerId(customerId); + //回填customer_mp的appId 只需以上三个字段 + customerMpDao.updateAppIDByCustomerIdAndClient(formDTO); + } log.info("==========回填customer_mp结束=========="); } @@ -635,10 +664,27 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe return date; } + /** + * @Description 查询客户Id + * @param tokenDto + * @author zxc + */ public String getLoginUserCustomerId(TokenDto tokenDto){ LoginUserDetailsFormDTO dto = new LoginUserDetailsFormDTO(); BeanUtils.copyProperties(tokenDto,dto); LoginUserDetailsResultDTO data = epmetUserOpenFeignClient.getLoginUserDetails(dto).getData(); return data.getCustomerId(); } + + /** + * @Description 时间戳(秒级)转换 Date + * @param t + * @author zxc + */ + public Date sToDate(String t){ + Long aLong = Long.valueOf(t + "000"); + Date date = new Date(); + date.setTime(aLong); + return date; + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml index d0c2ba2654..9cc47df530 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthResultRecordDao.xml @@ -3,4 +3,25 @@ + + + INSERT INTO auth_result_record ( ID, COMPONENT_APP_ID, WECHAT_CREATE_TIME, INFO_TYPE, AUTHORIZER_APP_ID, AUTHORIZATION_CODE, EXPIRES_IN_TIME, PRE_AUTH_CODE, DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + VALUES + ( + REPLACE(UUID(),'-',''), + #{componentAppId}, + #{wechatCreateTime}, + #{InfoType}, + #{AuthorizerAppid}, + #{AuthorizationCode}, + #{ExpiredTime}, + #{PreAuthCode}, + #{delFlag}, + #{revision}, + #{createdBy}, + NOW(), + #{updatedBy}, + NOW() + ) + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index bebcb23886..f4e6b6403a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -115,4 +115,16 @@ AND cm.app_id = #{appId} + + + \ No newline at end of file From 9f513914bfbc1b31d8f088d82dcea34c595d6203 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 13:25:42 +0800 Subject: [PATCH 072/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index c6382f6ca2..fea51ce83a 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.53 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.54 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index a77c024c24..8a7810a331 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.53 + 0.0.54 com.epmet From 94e99edd5733c5ecdbb4f842f0c372930c52c065 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Jul 2020 13:26:24 +0800 Subject: [PATCH 073/157] =?UTF-8?q?heart-work:act=5Fuser=5Flog=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E5=B7=B2=E7=AD=BE=E5=88=B0signedin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/ActUserLogDTO.java | 1 - .../src/main/java/com/epmet/constant/ActConstant.java | 2 -- .../src/main/java/com/epmet/entity/ActUserLogEntity.java | 1 - 3 files changed, 4 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java index fa3ec4ecd8..52b18e59e4 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActUserLogDTO.java @@ -54,7 +54,6 @@ public class ActUserLogDTO implements Serializable { * 审核通过passed, * 审核不通过refused * 取消报名canceld, - * 已签到signedin * ) */ private String operationType; diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java index bad108b99d..465955cf64 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActConstant.java @@ -108,13 +108,11 @@ public interface ActConstant { 审核通过passed, 审核不通过refused 取消报名canceld, - 已签到signedin )*/ String ACT_USER_LOG_OPER_AUDITING="auditing"; String ACT_USER_LOG_OPER_PASSED="passed"; String ACT_USER_LOG_OPER_REFUSED="refused"; String ACT_USER_LOG_OPER_CANCELD="canceld"; - String ACT_USER_LOG_OPER_SIGNEDIN="signedin"; /** * 审核通过类型:auto, manual diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java index 49716d0dac..6dd224fec0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActUserLogEntity.java @@ -50,7 +50,6 @@ public class ActUserLogEntity extends BaseEpmetEntity { * 审核通过passed, * 审核不通过refused * 取消报名canceld, - * 已签到signedin * ) */ private String operationType; From 26343ea21902eef98f72f6f978767073fcbc082c Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Jul 2020 13:33:14 +0800 Subject: [PATCH 074/157] =?UTF-8?q?heart-work:ACT=5FPOINT=5FLOG=EF=BC=9AEF?= =?UTF-8?q?FECT=5FFLAG=E6=96=B0=E5=A2=9E1=E6=9C=89=E6=95=880=E6=97=A0?= =?UTF-8?q?=E6=95=88=EF=BC=8C=E5=8F=AA=E6=9C=89=E5=9C=A8=E6=B4=BB=E5=8A=A8?= =?UTF-8?q?=E7=9C=9F=E6=AD=A3=E7=BB=93=E6=9D=9F=E5=90=8E=E6=89=8D=E6=98=AF?= =?UTF-8?q?1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/ActPointLogDTO.java | 9 +++++++-- .../main/java/com/epmet/entity/ActPointLogEntity.java | 9 ++++++--- .../src/main/resources/mapper/ActPointLogDao.xml | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java index 2d878f2615..d7510db23d 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -98,5 +99,9 @@ public class ActPointLogDTO implements Serializable { * 更新时间 */ private Date updatedTime; - + /** + * 1有效0无效,只有在活动真正结束后才是1 + * true有效 false无效 + */ + private Boolean effectFlag; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java index 1a437316e1..0b50778f81 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 活动发放积分日志表 * @@ -69,4 +66,10 @@ public class ActPointLogEntity extends BaseEpmetEntity { */ private String remark; + + /** + * 1有效0无效,只有在活动真正结束后才是1 + * true有效 false无效 + */ + private Boolean effectFlag; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml index 9da8bf431c..0695ec7f4c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml @@ -11,6 +11,7 @@ + From a1fd9cba254d4577a5c433aacfb15d561bcc9cda Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 14:22:34 +0800 Subject: [PATCH 075/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../constant/ThirdRunTimeInfoConstant.java | 2 +- .../impl/ComponentVerifyTicketServiceImpl.java | 17 +++++------------ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java index 92f372b4fd..b7dc98d4b4 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ThirdRunTimeInfoConstant.java @@ -46,7 +46,7 @@ public interface ThirdRunTimeInfoConstant { String END_GET_AUTH_INFO = "=====================结束获取【authorization_info】====================="; - String CREATE_AND_BIND_SUCCESS = "创建开放平台帐号并绑定公众号/小程序"; + String CREATE_AND_BIND_SUCCESS = "开始创建开放平台帐号并绑定公众号/小程序"; String BIND_SUCCESS = "绑定公众号/小程序到开放平台"; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 1b1617d636..8f1493bd72 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -111,20 +111,17 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String nonce = request.getParameter(ModuleConstant.NONCE); String encryptType = request.getParameter(ModuleConstant.ENCRYPT_TYPE); String signature = request.getParameter(ModuleConstant.SIGNATURE); - log.info(String.format(ThirdRunTimeInfoConstant.VERIFY_TICKET,msgSignature,timeStamp,nonce,encryptType,signature)); // 从请求中读取整个post数据 InputStream inputStream; String postData = null; inputStream = request.getInputStream(); postData= IOUtils.toString(inputStream,ModuleConstant.UTF8); - log.info("postData = "+postData); WXBizMsgCrypt wxBizMsgCrypt = new WXBizMsgCrypt(token,aesKey,componentAppId); String msg = wxBizMsgCrypt.decryptMsg(msgSignature, timeStamp, nonce, postData); log.info(String.format(ThirdRunTimeInfoConstant.MSG,msg)); // 将xml转为map Map result = WXXmlToMapUtil.xmlToMap(msg); String infotype = result.get(ModuleConstant.INFO_TYPE); - log.info(infotype); switch (infotype){ case ModuleConstant.TICKET_UNDERLINE_KEY: //接收票据 【component_verify_ticket】 String ComponentVerifyTicket = result.get(ModuleConstant.TICKET_KEY); @@ -353,7 +350,6 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe Map map = JSON.parseObject(data, HashMap.class); if (!map.containsKey(ModuleConstant.ERR_CODE)) { log.info(REFRESH_AUTH_ACCESS_TOKEN); - //authorizer_access_token String authorizerAccessToken = map.get(ModuleConstant.AUTHORIZER_ACCESS_TOKEN).toString(); String expiresIn = map.get(ModuleConstant.EXPIRES_IN).toString(); String authorizerRefreshToken = map.get(ModuleConstant.AUTHORIZER_REFRESH_TOKEN).toString(); @@ -372,7 +368,6 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe //先逻辑删除,在插入 authorizationInfoDao.updateOldAuthorizerAccessToken(customerId, clientType); authorizationInfoDao.insertAuthorizerAccessToken(formDTO); - //缓存 refreshAuthorizerAccessToken redisThird.setAuthorizerRefreshToken(authorizationInfo); } @@ -396,28 +391,26 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe String expiresIn = authCodeAndTime.getExpiresIn(); String customerId = this.getLoginUserCustomerId(tokenDto); Date expiresInTime = this.countExpirationTime(expiresIn); - if (StringUtils.isBlank(customerId)||StringUtils.isBlank(clientType)||StringUtils.isBlank(authCode)||StringUtils.isBlank(expiresIn)){ - log.info("客户ID = "+customerId+", 客户端类型为 = "+clientType+", 授权码为 = "+authCode+", 有效期 = "+expiresIn); - } //authCode存数据库 AuthCodeFormDTO formDTO = new AuthCodeFormDTO(); formDTO.setAuthCode(authCode); formDTO.setExpiresInTime(expiresInTime); formDTO.setClientType(clientType); - //授权方AppId formDTO.setCustomerId(customerId); log.info(formDTO.toString()); authCodeDao.deleteCustomerAuthCode(customerId,clientType); authCodeDao.insertRedirectAuthCode(formDTO); //authCode存缓存 redisThird.setAuthCode(formDTO); + // 1. 开始获取授权信息(使用授权码) AuthorizationInfoResultDTO authorizationInfoResultDTO = this.authInfoByAuthCode(authCode, customerId, clientType); String authAppId = authorizationInfoResultDTO.getAuthorizer_appid(); - // todo ================================================ - AuthCodeResultDTO authCodeResultDTO = authorizationInfoDao.selectCustomerIdByAuthAppId(authAppId); + // 2. 创建开放平台账号并绑定 或者 直接绑定开放平台 this.createAndBindOpenAccount(customerId,authAppId,clientType); + // 3. 更新 customer_mp 表授权状态和AuthAppId this.updateCustomerMpAppId(customerId,authAppId,clientType); authCodeDao.updateAppId(customerId,clientType,authAppId); + // 4. 保存授权方账户信息 this.saveAuthAccountInfo(customerId,authAppId,clientType); log.info("回调结束"); } @@ -546,7 +539,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe Map bindInfo = JSON.parseObject(bindResult, Map.class); boolean bindStatus = bindInfo.containsKey(ModuleConstant.OPEN_APP_ID); if (bindStatus != true) { - log.info("开始创建开放平台账号并绑定"); + log.info(CREATE_AND_BIND_SUCCESS); List authCount = customerMpDao.selectAuthCount(customerId); String openPlatformId = null; if (authCount.size() > 0) { From b44ed74ffa4926e62e0e82f8a217fbfc63099d86 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 14:37:15 +0800 Subject: [PATCH 076/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-funcInfo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/form/AuthorizationInfoFormDTO.java | 5 ++++ .../ComponentVerifyTicketServiceImpl.java | 23 ++++--------------- .../wxapi/constant/WxMaCodeConstant.java | 2 +- .../resources/mapper/AuthorizationInfoDao.xml | 3 ++- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java index 2004536f1c..1340896baf 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AuthorizationInfoFormDTO.java @@ -44,6 +44,11 @@ public class AuthorizationInfoFormDTO implements Serializable { */ private String clientType; + /** + * 权限列表 + */ + private String funcInfo; + private Integer delFlag = 0; private String createdBy = "APP_USER"; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 8f1493bd72..69302821e7 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -293,28 +293,13 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe authInfoDTO.setExpiresInTime(expiresInTime); authInfoDTO.setCustomerId(customerId); authInfoDTO.setClientType(clientType); + List func_info = authorizationInfoResultDTO.getFunc_info(); + log.info("权限列表信息:"+func_info); + String funcInfo = JSON.toJSONString(func_info); + authInfoDTO.setFuncInfo(funcInfo); //先逻辑删除,在插入 authorizationInfoDao.updateOldAuthorizationInfo(authAppId); authorizationInfoDao.insertAuthorizationInfo(authInfoDTO); - // 2. 权限列表 - log.info(START_INSERT_FUNC_INFO); - List funcInfos = new ArrayList<>(); - List func_info = authorizationInfoResultDTO.getFunc_info(); - log.info("权限列表信息:"+func_info); - /*func_info.forEach(func -> { - func.forEach((key,value) -> { - FuncInfoFormDTO fu = new FuncInfoFormDTO(); - fu.setFuncscopeCategory((String) key); - Map funcScope = (Map) value; - fu.setFuncscopeId(funcScope.get(ModuleConstant.ID).toString()); - fu.setAuthorizationInfoAppid(authAppId); - fu.setCustomerId(customerId); - funcInfos.add(fu); - }); - });*/ - // todo 先逻辑删除,在插入 - /*funcInfoDao.updateOldFuncInfo(customerId,authAppId); - funcInfoDao.insertFuncInfo(funcInfos);*/ // 授权信息放入缓存 redisThird.setAuthInfo(authorizationInfoResultDTO,customerId,clientType); //authorizer_refresh_token 放入缓存 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index 7cf0284911..8ec83ac350 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -33,7 +33,7 @@ public interface WxMaCodeConstant { /** * 前端地址 【授权之后的跳转的地址】 */ - String WEB_URL = "https://epmet-cloud.elinkservice.cn/third/mpweb/page/#/info?clientType="; + String WEB_URL = "https://epmet-cloud.elinkservice.cn/third/mpweb/page/#/info?clientType="; /** * 授权注册页面扫码授权 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml index cc9a4ecaf3..d8ab9821eb 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/AuthorizationInfoDao.xml @@ -5,7 +5,7 @@ - INSERT INTO authorization_info ( ID, CUSTOMER_ID, AUTHORIZER_APPID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN_TIME, AUTHORIZER_REFRESH_TOKEN, CLIENT_TYPE, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) + INSERT INTO authorization_info ( ID, CUSTOMER_ID, AUTHORIZER_APPID, AUTHORIZER_ACCESS_TOKEN, EXPIRES_IN_TIME, AUTHORIZER_REFRESH_TOKEN, FUNC_INFO, CLIENT_TYPE, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES ( REPLACE ( UUID(), '-', '' ), @@ -14,6 +14,7 @@ #{authorizerAccessToken}, #{expiresInTime}, #{authorizerRefreshToken}, + #{funcInfo}, #{clientType}, #{delFlag}, #{createdBy}, From da3ef9c240c2b3435ab35bc45e448851c9429b54 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 14:38:41 +0800 Subject: [PATCH 077/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index fea51ce83a..309c6a0e83 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.54 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.55 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 8a7810a331..cdc5473e70 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.54 + 0.0.55 com.epmet From 8e4d11745f35ccc1f06ffff9b889f4b7b77a7537 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Jul 2020 14:58:21 +0800 Subject: [PATCH 078/157] =?UTF-8?q?heart-work:ACT=5FPOINT=5FLOG=E8=A1=A8?= =?UTF-8?q?=E5=88=A0=E9=99=A4POINT=5FTYPE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/entity/ActPointLogEntity.java | 5 ----- .../src/main/resources/mapper/ActPointLogDao.xml | 1 - 2 files changed, 6 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java index 0b50778f81..f96ba508d9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java @@ -45,11 +45,6 @@ public class ActPointLogEntity extends BaseEpmetEntity { */ private String userId; - /** - * 加积分:add ; 减积分:subtract - */ - private String pointType; - /** * 积分值 */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml index 0695ec7f4c..ec6a181d3b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml @@ -7,7 +7,6 @@ - From 41a251dc3ad05b5a3a3aa02e3dc2cffd3467d1da Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 24 Jul 2020 14:58:53 +0800 Subject: [PATCH 079/157] =?UTF-8?q?heart-work:ACT=5FPOINT=5FLOG=E8=A1=A8?= =?UTF-8?q?=E5=88=A0=E9=99=A4POINT=5FTYPE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/ActPointLogDTO.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java index d7510db23d..c19938d48f 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java @@ -49,11 +49,6 @@ public class ActPointLogDTO implements Serializable { */ private String userId; - /** - * 加积分:add ; 减积分:subtract - */ - private String pointType; - /** * 积分值 */ From 910d24fc4646d4da68b56dec4c108f65933bbc67 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 15:00:19 +0800 Subject: [PATCH 080/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E4=BB=A3=E7=A0=81=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/controller/WarrantController.java | 4 ++-- .../src/main/java/com/epmet/service/WarrantService.java | 2 +- .../main/java/com/epmet/service/impl/WarrantServiceImpl.java | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java index 1cb35bb666..2760162a5c 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java @@ -26,9 +26,9 @@ public class WarrantController { private WarrantService warrantService; @RequestMapping(value ="/{APPID}/callback") - public void acceptMessageAndEvent(HttpServletRequest request, @PathVariable("APPID") String appid, + public String acceptMessageAndEvent(HttpServletRequest request, @PathVariable("APPID") String appid, HttpServletResponse response)throws IOException, DocumentException, AesException { - warrantService.acceptMessageAndEvent(request, appid, response); + return warrantService.acceptMessageAndEvent(request, appid, response); } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java index 4ae4cfd5e1..9393704594 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/WarrantService.java @@ -13,6 +13,6 @@ import java.io.IOException; */ public interface WarrantService { - void acceptMessageAndEvent(HttpServletRequest request,String appid,HttpServletResponse response)throws IOException, DocumentException, AesException; + String acceptMessageAndEvent(HttpServletRequest request,String appid,HttpServletResponse response)throws IOException, DocumentException, AesException; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java index b49c04788e..d5a3d500af 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java @@ -65,14 +65,14 @@ public class WarrantServiceImpl implements WarrantService { */ @Transactional(rollbackFor = Exception.class) @Override - public void acceptMessageAndEvent(HttpServletRequest request, String appId, HttpServletResponse response)throws IOException, DocumentException, AesException { + public String acceptMessageAndEvent(HttpServletRequest request, String appId, HttpServletResponse response)throws IOException, DocumentException, AesException { log.info("appId:"+ appId); request.setCharacterEncoding(ModuleConstant.UTF8); String msgSignature = request.getParameter(ModuleConstant.MSG_SIGNATURE); String timeStamp = request.getParameter(ModuleConstant.TIMESTAMP); String nonce = request.getParameter(ModuleConstant.NONCE); if (!StringUtils.isNotBlank(msgSignature)) { - return;// 微信推送给第三方开放平台的消息一定是加过密的,无消息加密无法解密消息 + return ModuleConstant.SUCCESS;// 微信推送给第三方开放平台的消息一定是加过密的,无消息加密无法解密消息 } InputStream inputStream; String postData = null; @@ -119,5 +119,6 @@ public class WarrantServiceImpl implements WarrantService { } String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); codeAuditResultDao.updateAuditResult(customerId,codeCustomerId,codeResult); + return ModuleConstant.SUCCESS; } } From f246fcfe73a0402b55d3e92d1117bfb535dee09c Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Fri, 24 Jul 2020 15:21:51 +0800 Subject: [PATCH 081/157] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/utils/FileUtils.java | 37 ++++++++ .../tools/utils/HttpClientManager.java | 52 ++++------- .../utils/InputStreamResponseHandler.java | 33 +++++++ .../tools/utils/Utf8ResponseHandler.java | 33 +++++++ .../main/java/com/epmet/dto/QrCodeDTO.java | 18 ++++ .../java/com/epmet/feign/OssFeignClient.java | 27 ++---- .../fallback/OssFeignClientFallback.java | 13 ++- .../com/epmet/controller/OssController.java | 15 ++- .../java/com/epmet/dto/CodeCustomerDTO.java | 5 + .../com/epmet/dto/form/CodeCommonFormDTO.java | 5 +- .../epmet/dto/form/SubmitAuditFormDTO.java | 2 +- .../com/epmet/controller/CodeController.java | 4 +- .../com/epmet/entity/CodeCustomerEntity.java | 6 ++ .../epmet/service/impl/CodeServiceImpl.java | 93 ++++++++++++++----- .../param/WxMaCodeSubmitAuditRequest.java | 2 +- .../epmet/wxapi/service/WxMaCodeService.java | 2 +- .../service/impl/WxMaCodeServiceImpl.java | 10 +- .../mapper/CodeOperationHistoryDao.xml | 2 +- 18 files changed, 270 insertions(+), 89 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/InputStreamResponseHandler.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Utf8ResponseHandler.java create mode 100644 epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/QrCodeDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java new file mode 100644 index 0000000000..a9623b7cde --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/FileUtils.java @@ -0,0 +1,37 @@ +package com.epmet.commons.tools.utils; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; + +public class FileUtils { + + /** + * 创建临时文件. + * + * @param inputStream 输入文件流 + * @param name 文件名 + * @param ext 扩展名 + * @param tmpDirFile 临时文件夹目录 + */ + public static File createTmpFile(InputStream inputStream, String name, String ext, File tmpDirFile) throws IOException { + File resultFile = File.createTempFile(name, '.' + ext, tmpDirFile); + + resultFile.deleteOnExit(); + org.apache.commons.io.FileUtils.copyToFile(inputStream, resultFile); + return resultFile; + } + + /** + * 创建临时文件. + * + * @param inputStream 输入文件流 + * @param name 文件名 + * @param ext 扩展名 + */ + public static File createTmpFile(InputStream inputStream, String name, String ext) throws IOException { + return createTmpFile(inputStream, name, ext, Files.createTempDirectory("weixin-java-tools-temp").toFile()); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 880dec240e..50ba1643c8 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -4,15 +4,12 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.dto.form.DingTalkTextMsg; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.scan.param.TextScanParamDTO; -import com.epmet.commons.tools.scan.param.TextTaskDTO; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.http.HttpEntity; -import org.apache.http.HttpStatus; -import org.apache.http.NameValuePair; +import org.apache.http.*; +import org.apache.http.client.HttpResponseException; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; @@ -24,7 +21,6 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.message.BasicNameValuePair; @@ -33,17 +29,16 @@ import org.springframework.util.CollectionUtils; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; -import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.UUID; /** * desc: http 工具类 @@ -256,7 +251,7 @@ public class HttpClientManager { * * @author: jianjun liu */ - public Result sendGetFile(String url, Map params) { + public Result sendGetFile(String url, Map params) { try { URIBuilder builder = new URIBuilder(url); @@ -271,32 +266,35 @@ public class HttpClientManager { return executeToByte(httpGet); } catch (Exception e) { log.error("sendGet exception", e); - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } } - private Result executeToByte(HttpRequestBase httpMethod) { + private Result executeToByte(HttpRequestBase httpMethod) { CloseableHttpResponse response = null; try { response = httpclient.execute(httpMethod); log.debug("http send response:{}", JSON.toJSONString(response)); if (response != null && response.getStatusLine() != null) { if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { - InputStream in = response.getEntity().getContent(); - ByteArrayOutputStream output = new ByteArrayOutputStream(); - byte[] buffer = new byte[4096]; - int n = 0; - while (-1 != (n = in.read(buffer))) { - output.write(buffer, 0, n); - } - return new Result().ok(ArrayUtils.toObject(output.toByteArray())); + InputStream inputStream = InputStreamResponseHandler.INSTANCE.handleResponse(response); + Header[] contentTypeHeader = response.getHeaders("Content-Type"); + if (contentTypeHeader != null && contentTypeHeader.length > 0) { + // 出错 + if (ContentType.TEXT_PLAIN.getMimeType() + .equals(ContentType.parse(contentTypeHeader[0].getValue()).getMimeType())) { + String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); + } + } + File file = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), "jpg"); + return new Result().ok(file); } else { log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); } } } catch (Exception e) { log.error("execute exception", e); - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); } finally { httpMethod.releaseConnection(); try { @@ -306,21 +304,9 @@ public class HttpClientManager { } catch (IOException e) { } } - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } - public static void main(String[] args) { - String url = "http://localhost:8107/epmetscan/api/textSyncScan"; - TextTaskDTO p = new TextTaskDTO(); - p.setDataId("1"); - p.setContent("neirong1"); - List list = new ArrayList<>(); - list.add(p); - TextScanParamDTO param = new TextScanParamDTO(); - param.setTasks(list); - Result result = HttpClientManager.getInstance().sendPostByJSON(url, JSON.toJSONString(param)); - System.out.println(JSON.toJSONString(result)); - } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/InputStreamResponseHandler.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/InputStreamResponseHandler.java new file mode 100644 index 0000000000..75c16053fb --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/InputStreamResponseHandler.java @@ -0,0 +1,33 @@ +package com.epmet.commons.tools.utils; + +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.StatusLine; +import org.apache.http.client.HttpResponseException; +import org.apache.http.client.ResponseHandler; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; +import java.io.InputStream; + +/** + * 输入流响应处理器. + * + * @author Daniel Qian + */ +public class InputStreamResponseHandler implements ResponseHandler { + public static final ResponseHandler INSTANCE = new InputStreamResponseHandler(); + private static final int STATUS_CODE_300 = 300; + + @Override + public InputStream handleResponse(final HttpResponse response) throws IOException { + final StatusLine statusLine = response.getStatusLine(); + final HttpEntity entity = response.getEntity(); + if (statusLine.getStatusCode() >= STATUS_CODE_300) { + EntityUtils.consume(entity); + throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase()); + } + return entity == null ? null : entity.getContent(); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Utf8ResponseHandler.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Utf8ResponseHandler.java new file mode 100644 index 0000000000..107dc3cbdf --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Utf8ResponseHandler.java @@ -0,0 +1,33 @@ +package com.epmet.commons.tools.utils; + +import org.apache.http.Consts; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.StatusLine; +import org.apache.http.client.HttpResponseException; +import org.apache.http.client.ResponseHandler; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; + +/** + * copy from {@link org.apache.http.impl.client.BasicResponseHandler} + * + * @author Daniel Qian + */ +public class Utf8ResponseHandler implements ResponseHandler { + + public static final ResponseHandler INSTANCE = new Utf8ResponseHandler(); + + @Override + public String handleResponse(final HttpResponse response) throws IOException { + final StatusLine statusLine = response.getStatusLine(); + final HttpEntity entity = response.getEntity(); + if (statusLine.getStatusCode() >= 300) { + EntityUtils.consume(entity); + throw new HttpResponseException(statusLine.getStatusCode(), statusLine.toString()); + } + return entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8); + } + +} diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/QrCodeDTO.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/QrCodeDTO.java new file mode 100644 index 0000000000..a154d381a4 --- /dev/null +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/dto/QrCodeDTO.java @@ -0,0 +1,18 @@ +package com.epmet.dto; + +import lombok.Data; +import org.springframework.web.multipart.MultipartFile; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/24 10:10 + */ +@Data +public class QrCodeDTO implements Serializable { + private static final long serialVersionUID = -1787470699926486609L; + private byte[] qrCode; + private MultipartFile media; +} diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java index a22f95bf71..0d200a7177 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java @@ -9,16 +9,13 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; -import feign.codec.Encoder; -import feign.form.spring.SpringFormEncoder; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.UploadDTO; +import com.epmet.dto.QrCodeDTO; +import com.epmet.dto.result.UploadImgResultDTO; +import com.epmet.feign.fallback.OssFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.context.annotation.Bean; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.multipart.MultipartFile; /** * OSS @@ -26,22 +23,18 @@ import org.springframework.web.multipart.MultipartFile; * @author Mark sunlightcs@gmail.c om * @since 1.1.0 */ -@FeignClient(name = ServiceConstant.EPMET_OSS_SERVER, configuration = OssFeignClient.MultipartSupportConfig.class) +@FeignClient(name = ServiceConstant.EPMET_OSS_SERVER, fallback = OssFeignClientFallback.class) public interface OssFeignClient { /** * 文件上传 - * @param file 文件 + * @param dto 文件 * @return 返回路径 */ - @PostMapping(value = "oss/file/upload", produces = {MediaType.APPLICATION_JSON_UTF8_VALUE}, - consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - Result upload(@RequestPart("file") MultipartFile file); + @PostMapping(value = "oss/file/uploadwximg", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + Result uploadWxImg(QrCodeDTO dto); - class MultipartSupportConfig { - @Bean - public Encoder feignFormEncoder() { - return new SpringFormEncoder(); - } - } + + @PostMapping(value ="oss/file/uploadqrcode", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) + Result uploadQrCode(QrCodeDTO dto ); } diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java index f1bb26a963..eb8f1b4b8b 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java @@ -8,8 +8,12 @@ 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.QrCodeDTO; import com.epmet.dto.UploadDTO; +import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.OssFeignClient; import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; @@ -24,7 +28,12 @@ import org.springframework.web.multipart.MultipartFile; public class OssFeignClientFallback implements OssFeignClient { @Override - public Result upload(MultipartFile file) { - return new Result().error(); + public Result uploadWxImg(QrCodeDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadWxImg", dto); + } + + @Override + public Result uploadQrCode(QrCodeDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadQrCode", dto); } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index 4367e4e62e..e9f05c53cd 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -18,6 +18,7 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AliyunGroup; import com.epmet.commons.tools.validator.group.QcloudGroup; import com.epmet.commons.tools.validator.group.QiniuGroup; +import com.epmet.dto.QrCodeDTO; import com.epmet.dto.UploadDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; @@ -98,7 +99,7 @@ public class OssController { @PostMapping("upload") @ApiOperation(value = "上传文件") - public Result upload(@RequestParam("file") MultipartFile file) throws Exception { + public Result upload(@RequestPart("file") MultipartFile file) throws Exception { if (file.isEmpty()) { return new Result().error(ModuleErrorCode.UPLOAD_FILE_EMPTY); } @@ -141,6 +142,18 @@ public class OssController { return ossService.uploadImg(file); } + @PostMapping("uploadwximg") + public Result uploadWxImg(QrCodeDTO dto) { + return ossService.uploadImg(dto.getMedia()); + } + + @PostMapping("uploadqrcode") + public Result uploadQrCode(QrCodeDTO dto) { + String url = OssFactory.build().uploadSuffix(dto.getQrCode(), "jpg"); + UploadImgResultDTO result = new UploadImgResultDTO(); + result.setUrl(url); + return new Result().ok(result); + } /** * 上传客户logo(考虑到以后可能会针对不同的业务有不同的限制条件,这里不再使用通用的接口 * 针对每一个业务新建上传接口) diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java index 2a4c2227fc..458176f17d 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/CodeCustomerDTO.java @@ -83,6 +83,11 @@ public class CodeCustomerDTO implements Serializable { */ private String status; + /** + * 二维码 + */ + private String qrCode; + /** * 乐观锁 */ diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java index e854b15992..2806aa1145 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/CodeCommonFormDTO.java @@ -20,6 +20,7 @@ public class CodeCommonFormDTO implements Serializable { * 代码ID */ private String codeId; - private Integer page; - private Integer limit; + private String path; + private Integer page = 1; + private Integer limit = 999; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java index 82867159cf..222250510f 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/SubmitAuditFormDTO.java @@ -39,7 +39,7 @@ public class SubmitAuditFormDTO implements Serializable { /** * 预览信息(小程序页面截图和操作录屏) */ - private List previewInfo; + private PreviewInfoBean previewInfo; /** * 用户生成内容场景(UGC)信息安全声明 */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java index e2b7901ed6..0c61ff9ac2 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/CodeController.java @@ -161,9 +161,9 @@ public class CodeController { * @date 2020/7/16 10:16 */ @PostMapping("history") - public Result history(@RequestBody CodeCommonFormDTO formDTO) { + public Result> history(@RequestBody CodeCommonFormDTO formDTO) { PageData result = codeService.history(formDTO); - return new Result().ok(result); + return new Result>().ok(result.getList()); } /** diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java index 5bd2485033..3f84ef9a4a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/entity/CodeCustomerEntity.java @@ -83,4 +83,10 @@ public class CodeCustomerEntity extends BaseEpmetEntity { */ private String status; + /** + * 二维码 + */ + private String qrCode; + + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index 8e18dadcbf..aa2076ec75 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -6,17 +6,13 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.commons.tools.utils.MultipartFileToFileUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CodeConstant; import com.epmet.dao.AuthorizationInfoDao; import com.epmet.dao.ComponentAccessTokenDao; import com.epmet.dto.*; import com.epmet.dto.form.*; -import com.epmet.dto.result.CodeHistoryResultDTO; -import com.epmet.dto.result.QrCodeResultDTO; -import com.epmet.dto.result.ReasonResultDTO; -import com.epmet.dto.result.TemplateListResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.feign.OssFeignClient; import com.epmet.service.*; @@ -33,6 +29,9 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; +import java.nio.file.Files; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -67,6 +66,10 @@ public class CodeServiceImpl implements CodeService { private CodeExtService codeExtService; @Autowired private OssFeignClient ossFeignClient; + @Autowired + private PaCustomerService paCustomerService; + @Autowired + private WxMaCodeService wxsMaCodeService; @Override public List templateList() { @@ -141,16 +144,13 @@ public class CodeServiceImpl implements CodeService { //获取客户信息 CustomerDTO customerDTO = new CustomerDTO(); customerDTO.setId(formDTO.getCustomerId()); - Result customerInfo = operCrmOpenFeignClient.getCustomerInfo(customerDTO); - if (!customerInfo.success()) { - throw new RenException(customerInfo.getCode(), customerInfo.getMsg()); - } + PaCustomerDTO paCustomerDTO = paCustomerService.get(formDTO.getCustomerId()); //将之前上传信息删除 codeCustomerService.deleteCode(formDTO.getCustomerId(), formDTO.getClientType()); //将上传信息存入表中 CodeCustomerDTO codeCustomerDTO = ConvertUtils.sourceToTarget(formDTO, CodeCustomerDTO.class); - codeCustomerDTO.setCustomerName(customerInfo.getData().getCustomerName()); + codeCustomerDTO.setCustomerName(paCustomerDTO.getCustomerName()); codeCustomerDTO.setExtJson(formDTO.getExtJson()); codeCustomerDTO.setAppId(authInfo.getAuthorizerAppid()); codeCustomerDTO.setStatus(CodeConstant.UNAUDITED); @@ -211,6 +211,7 @@ public class CodeServiceImpl implements CodeService { if (null == authInfo) { throw new RenException("未授权"); } + //调用微信API上提交审核 WxMaCodeSubmitAuditRequest request = new WxMaCodeSubmitAuditRequest(); request.setVersionDesc(formDTO.getVersionDesc()); @@ -225,13 +226,20 @@ public class CodeServiceImpl implements CodeService { wxResult.getErrorMsg()); throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); } - //将数据存入代码审核表 - CodeAuditResultDTO codeAuditResultDTO = new CodeAuditResultDTO(); - codeAuditResultDTO.setCustomerId(codeCustomerDTO.getCustomerId()); - codeAuditResultDTO.setCodeId(codeCustomerDTO.getId()); - codeAuditResultDTO.setAuditId(wxResult.getData()); - codeAuditResultDTO.setResult(CodeConstant.AUDITING); - codeAuditResultService.save(codeAuditResultDTO); + //获取审核结果信息 + CodeAuditResultDTO codeAuditResultDTO = codeAuditResultService.getAuditResultByCodeId(formDTO.getCodeId()); + if (null == codeAuditResultDTO) { + //将数据存入代码审核表 + codeAuditResultDTO = new CodeAuditResultDTO(); + codeAuditResultDTO.setCustomerId(codeCustomerDTO.getCustomerId()); + codeAuditResultDTO.setCodeId(codeCustomerDTO.getId()); + codeAuditResultDTO.setAuditId(wxResult.getData()); + codeAuditResultDTO.setResult(CodeConstant.AUDITING); + codeAuditResultService.save(codeAuditResultDTO); + } else { + codeAuditResultDTO.setResult(CodeConstant.AUDITING); + codeAuditResultService.update(codeAuditResultDTO); + } //更新代码表状态 codeCustomerDTO.setStatus(CodeConstant.AUDITING); codeCustomerService.update(codeCustomerDTO); @@ -354,6 +362,10 @@ public class CodeServiceImpl implements CodeService { QrCodeResultDTO result = new QrCodeResultDTO(); //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); + if (null != codeCustomerDTO.getQrCode()) { + result.setQrcode(codeCustomerDTO.getQrCode()); + return result; + } //是否授权 if (!customerMpService.getAuthFlag(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType())) { throw new RenException("未授权"); @@ -361,11 +373,20 @@ public class CodeServiceImpl implements CodeService { //获取小程序调用令牌 AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); //调用微信API获取获取体验版二维码 - WxResult wxResult = wxMaCodeService.getQrCode(authInfo.getAuthorizerAccessToken(), null); + WxResult wxResult = wxMaCodeService.getQrCode(authInfo.getAuthorizerAccessToken(), formDTO.getPath()); + QrCodeDTO qrCodeDTO = new QrCodeDTO(); + try { + qrCodeDTO.setQrCode(Files.readAllBytes(wxResult.getData().toPath())); + Result uploadResult = ossFeignClient.uploadQrCode(qrCodeDTO); + codeCustomerDTO.setQrCode(uploadResult.getData().getUrl()); + codeCustomerService.update(codeCustomerDTO); + result.setQrcode(uploadResult.getData().getUrl()); + } catch (Exception e) { + throw new RenException(e.getMessage()); + } if (!wxResult.success()) { throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); } - result.setQrcode(wxResult.getData()); return result; } @@ -382,8 +403,10 @@ public class CodeServiceImpl implements CodeService { @Override public String mediaUpload(MediaUploadFormDTO formDTO) { try { -// Result uploadDTOResult = ossFeignClient.upload(formDTO.getMedia()); - File file = MultipartFileToFileUtils.multipartFileToFile(formDTO.getMedia()); + QrCodeDTO dto = new QrCodeDTO(); + dto.setMedia(formDTO.getMedia()); + Result uploadDTOResult = ossFeignClient.uploadWxImg(dto); + File file = new File(uploadDTOResult.getData().getUrl()); //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //获取小程序调用令牌 @@ -433,5 +456,33 @@ public class CodeServiceImpl implements CodeService { } } + private byte[] toPrimitives(Byte[] oBytes) { + byte[] bytes = new byte[oBytes.length]; + + for (int i = 0; i < oBytes.length; i++) { + bytes[i] = oBytes[i]; + } + return bytes; + } + private void byteToFile(byte[] bytes) + { + try + { + // 根据绝对路径初始化文件 + File localFile = new File("."); + if (!localFile.exists()) + { + localFile.createNewFile(); + } + // 输出流 + OutputStream os = new FileOutputStream(localFile); + os.write(bytes); + os.close(); + } + catch (Exception e) + { + e.printStackTrace(); + } + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java index 1c63b9ed3a..38a074576f 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxMaCodeSubmitAuditRequest.java @@ -42,7 +42,7 @@ public class WxMaCodeSubmitAuditRequest implements Serializable { * 预览信息(小程序页面截图和操作录屏) */ @SerializedName("preview_info") - private List previewInfo; + private SubmitAuditFormDTO.PreviewInfoBean previewInfo; /** * 用户生成内容场景(UGC)信息安全声明 */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java index 111dff5f06..eea4649219 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java @@ -48,7 +48,7 @@ public interface WxMaCodeService { * @author zhaoqifeng * @date 2020/7/10 15:25 */ - WxResult getQrCode(String accessToken, String path); + WxResult getQrCode(String accessToken, String path); /** * 获取授权小程序帐号的可选类目. diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java index e0ae3823e5..5808634523 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -10,10 +10,8 @@ import com.epmet.wxapi.result.*; import com.epmet.wxapi.service.WxMaCodeService; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.google.gson.JsonObject; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import java.io.File; @@ -21,8 +19,6 @@ import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Arrays; import java.util.List; /** @@ -74,8 +70,8 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { } @Override - public WxResult getQrCode(String accessToken, String path) { - WxResult result = new WxResult<>(); + public WxResult getQrCode(String accessToken, String path) { + WxResult result = new WxResult<>(); StringBuilder url = new StringBuilder(WxMaCodeConstant.GET_QRCODE_URL).append("?access_token").append(accessToken); if (StringUtils.isNotBlank(path)) { try { @@ -84,7 +80,7 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { e.printStackTrace(); } } - Result qrCodeResult = HttpClientManager.getInstance().sendGetFile(url.toString(), null); + Result qrCodeResult = HttpClientManager.getInstance().sendGetFile(url.toString(), null); if (!qrCodeResult.success()) { result.setErrorCode(qrCodeResult.getCode()); result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(qrCodeResult.getCode())); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml index 66041c4ea0..2e18d09f58 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CodeOperationHistoryDao.xml @@ -25,7 +25,7 @@ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index ac63e1f255..d2872098fd 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -162,4 +162,31 @@ ORDER BY acr.CREATED_TIME DESC + + + + + + From aafcb9c266ae09425a9041584a2ca12582a62c29 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Jul 2020 15:48:45 +0800 Subject: [PATCH 084/157] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=A4=E7=AB=AF?= =?UTF-8?q?=E7=99=BB=E9=99=86=E8=8E=B7=E5=8F=96=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=80=BB=E8=BE=91=EF=BC=8C=E6=9A=82=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E5=8E=BB=E8=8E=B7=E5=8F=96=E7=94=A8=E6=88=B7=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/wxapi/service/impl/WxLoginServiceImpl.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java index 6edf2fbbd0..ed715cb344 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxLoginServiceImpl.java @@ -57,7 +57,11 @@ public class WxLoginServiceImpl implements WxLoginService { String openid = hashMap.get("openid"); String sessionKey = hashMap.get("session_key"); - //2.换取用户基本信息 + UserWechatDTO dto = new UserWechatDTO(); + dto.setWxOpenId(openid); + dto.setSessionKey(sessionKey); + + /*//2.换取用户基本信息 //小程序access_token Map accessMap = redisUtils.hGetAll(ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + ":" + customerId + ":" + clientType); if(null==accessMap.get("authorizer_access_token")){ @@ -86,7 +90,7 @@ public class WxLoginServiceImpl implements WxLoginService { dto.setCountry(resultMap.get("country")); dto.setProvince(resultMap.get("province")); dto.setCity(resultMap.get("city")); - dto.setLanguage(resultMap.get("language")); + dto.setLanguage(resultMap.get("language"));*/ return dto; } From 0b36296d41f4a2cb117bd91702a5f447a715c028 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Jul 2020 15:50:39 +0800 Subject: [PATCH 085/157] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 309c6a0e83..62b4f74e2e 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.55 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.56 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index cdc5473e70..ffe5d338fd 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.55 + 0.0.56 com.epmet From 5bf19ca3f8380a9578878f9b769de497d6f32bd8 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Jul 2020 16:33:55 +0800 Subject: [PATCH 086/157] =?UTF-8?q?=E6=94=BF=E5=BA=9C=E7=AB=AFenterorg?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E7=94=A8=E5=BE=AE=E4=BF=A1api?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/GovWxmpEnteOrgFormDTO.java | 6 ++++ .../service/impl/GovLoginServiceImpl.java | 30 ++++++++++++++----- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java index e68df77236..8951235a94 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java @@ -38,5 +38,11 @@ public class GovWxmpEnteOrgFormDTO implements Serializable { */ @NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class}) private String rootAgencyId; + + /** + * 客户appId(exJson文件中获取) + */ + @NotBlank(message = "appId不能为空",groups = {AddUserInternalGroup.class}) + private String appId; } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 092a327312..406ae0fe6f 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -19,12 +19,10 @@ import com.epmet.constant.SmsTemplateConstant; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.GovStaffRoleDTO; +import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; -import com.epmet.feign.EpmetMessageOpenFeignClient; -import com.epmet.feign.EpmetUserFeignClient; -import com.epmet.feign.EpmetUserOpenFeignClient; -import com.epmet.feign.GovOrgFeignClient; +import com.epmet.feign.*; import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; import com.epmet.redis.CaptchaRedis; @@ -67,6 +65,8 @@ public class GovLoginServiceImpl implements GovLoginService { private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @Autowired private EpmetUserOpenFeignClient userOpenFeignClient; + @Autowired + private EpmetThirdFeignClient epmetThirdFeignClient; /** * @param formDTO @@ -272,8 +272,24 @@ public class GovLoginServiceImpl implements GovLoginService { throw new RenException(customerStaffDTOResult.getCode()); } CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); - //2、解析微信用户 - WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); + /*//2、解析微信用户 + WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode());*/ + //2020.7.24 获取微信信息接口调整,改调用微信api的方式 sun + //2.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息 + WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO(); + resiLoginFormDTO.setAppId(formDTO.getAppId()); + resiLoginFormDTO.setWxCode(formDTO.getWxCode()); + Result result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO); + if (!result.success()) { + logger.error("工作端小程序登陆,调用epmet_third服务获取数据失败"); + throw new RenException(result.getCode()); + } + UserWechatDTO userWechatDTO = result.getData(); + WxMaJscode2SessionResult wxMaJscode2SessionResult = new WxMaJscode2SessionResult(); + wxMaJscode2SessionResult.setOpenid(userWechatDTO.getWxOpenId()); + wxMaJscode2SessionResult.setSessionKey(userWechatDTO.getSessionKey()); + wxMaJscode2SessionResult.setUnionid(""); + //3、记录staff_wechat,并记录用户激活状态,激活时间 this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); //4、记录登录日志 @@ -437,7 +453,7 @@ public class GovLoginServiceImpl implements GovLoginService { govTokenDto.setUserId(staffId); govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); - govTokenDto.setUnionId(wxMaJscode2SessionResult.getUnionid()); + govTokenDto.setUnionId(null == wxMaJscode2SessionResult.getUnionid() ? "" : wxMaJscode2SessionResult.getUnionid()); govTokenDto.setToken(token); govTokenDto.setUpdateTime(System.currentTimeMillis()); govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); From 592aacb6c601cc6bab6ca71e50e9b137d21c6f39 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 24 Jul 2020 16:36:20 +0800 Subject: [PATCH 087/157] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 8fadcbfa6d..edf73a05cc 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.47 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.48 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 11a9728472..fb25b63090 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.47 + 0.3.48 com.epmet epmet-cloud From cfd46b1bdffdeb0e0d9434f2208800d092a1f798 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 24 Jul 2020 16:44:30 +0800 Subject: [PATCH 088/157] =?UTF-8?q?=E6=B7=BB=E5=8A=A0appId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/LoginServiceImpl.java | 5 +- .../commons/tools/enums/MqMethodPathEnum.java | 1 + .../tools/utils/HttpClientManager.java | 6 +- .../java/com/epmet/dto/result/EventDTO.java | 112 ++++++++++++++++++ .../common-service-server/pom.xml | 10 ++ .../com/epmet/controller/EventController.java | 27 +++++ .../java/com/epmet/service/EventService.java | 6 + .../epmet/service/impl/EventServiceImpl.java | 25 +++- .../src/main/resources/bootstrap.yml | 10 +- .../src/main/resources/bootstrap.yml | 18 +-- 10 files changed, 204 insertions(+), 16 deletions(-) create mode 100644 epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index 695c187105..5221a30b33 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -4,6 +4,7 @@ import cn.binarywang.wx.miniapp.api.WxMaService; import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; +import com.alibaba.fastjson.JSON; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; @@ -120,10 +121,10 @@ public class LoginServiceImpl implements LoginService { wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(wxCode); } } catch (WxErrorException e) { - log.error("->[getMaOpenId]::error[{}]", "解析微信code失败"); + log.error("->[getMaOpenId]::error[{}]", "解析微信code失败",e); } if (null == wxMaJscode2SessionResult) { - log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s]",app,wxCode)); + log.error(String.format("解析微信用户信息失败,app[%s],wxCode[%s],result:[%S]",app,wxCode, JSON.toJSONString(wxMaJscode2SessionResult))); throw new RenException("解析微信用户信息失败"); } else if (StringUtils.isBlank(wxMaJscode2SessionResult.getOpenid())) { log.error(String.format("获取微信openid失败,app[%s],wxCode[%s]",app,wxCode)); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java index 014722de84..d74e47dab6 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java @@ -9,6 +9,7 @@ package com.epmet.commons.tools.enums; **/ public enum MqMethodPathEnum { SEND_MSG("producerService/producer/sendMsg", "发送消息"), + GET_EVENT_LIST("/eventClass/getList", "获取时间类型列表"), ; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 9f8ba52d28..6d91832472 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -27,7 +27,6 @@ import org.apache.http.entity.ContentType; import org.apache.http.entity.StringEntity; import org.apache.http.entity.mime.HttpMultipartMode; import org.apache.http.entity.mime.MultipartEntityBuilder; -import org.apache.http.entity.mime.content.FileBody; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; @@ -45,11 +44,10 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.cert.CertificateException; -import java.nio.charset.Charset; -import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -188,7 +186,7 @@ public class HttpClientManager { // HttpEntity reqEntity = MultipartEntityBuilder.create() // .addPart("media", fileBody).build(); // httppost.setEntity(reqEntity); - return execute(httppost); + return execute(httppost,false); } catch (Exception e) { log.error("send exception", e); throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java new file mode 100644 index 0000000000..e95e09002a --- /dev/null +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/result/EventDTO.java @@ -0,0 +1,112 @@ +/** + * 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.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 事件表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-16 + */ +@Data +public class EventDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 消息网关事件类别ID 从消息网关获取事件类型Id + */ + private String classId; + + /** + * 消息网关APP_ID + */ + private String appId; + + /** + * 消息网关APP_NAME + */ + private String appName; + + /** + * 事件标识 与消息网关事件tag一致 + */ + private String eventCode; + + /** + * 事件名称 + */ + private String eventName; + + /** + * 事件说明 + */ + private String eventDesc; + + /** + * 事件功能分组ID 来自oper_customize.customer_function表 + */ + private String functionId; + + /** + * 是否是通用事件 0-否,1-是;消息体内需要体现该字段,通用则说明由业务系统自己计算分值 + */ + private String isCommon; + + /** + * 删除标识 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/epmet-common-service/common-service-server/pom.xml b/epmet-module/epmet-common-service/common-service-server/pom.xml index 2c694bbd67..69b16c5a01 100644 --- a/epmet-module/epmet-common-service/common-service-server/pom.xml +++ b/epmet-module/epmet-common-service/common-service-server/pom.xml @@ -116,6 +116,11 @@ false + + https://epmet-dev.elinkservice.cn/estos/ + producerService/producer/sendMsg + 202007161443499985fa2d397436d10356542134c8f008c48 + 52d9d9b0e7d0eb5b8b81c205b579e07c @@ -177,6 +182,11 @@ true + + https://epmet-dev.elinkservice.cn/estos/ + producerService/producer/sendMsg + 202007161443499985fa2d397436d10356542134c8f008c48 + 52d9d9b0e7d0eb5b8b81c205b579e07c diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java index a9a8108669..5fb6ca00bd 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java @@ -17,15 +17,24 @@ package com.epmet.controller; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.config.MqConfig; +import com.epmet.commons.tools.enums.MqMethodPathEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; 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.dto.form.EventFormDTO; +import com.epmet.dto.result.EventDTO; import com.epmet.service.EventService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import java.util.Map; + /** * 事件表 @@ -39,6 +48,24 @@ public class EventController { @Autowired private EventService eventService; + @Autowired + private MqConfig mqConfig; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = eventService.page(params); + return new Result>().ok(page); + } + @GetMapping("geteventclass") + public Result getEventClass(@RequestParam Map params){ + params.put("token", mqConfig.getToken()); + params.put("appId", mqConfig.getAppId()); + Result result = HttpClientManager.getInstance().sendPostByHttps(mqConfig.getHost().concat(MqMethodPathEnum.GET_EVENT_LIST.getCode()), JSON.toJSONString(params)); + if (result.success()){ + return new Result<>().ok(JSON.parseArray(result.getData())); + } + return new Result<>().error(EpmetErrorCode.SERVER_ERROR.getMsg()); + } /** * desc:添加事件,如果已存在则不作任何改动,直接返回成功 diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java index fc60058fc2..8e2c4cb635 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/EventService.java @@ -18,9 +18,13 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; import com.epmet.dto.form.EventFormDTO; +import com.epmet.dto.result.EventDTO; import com.epmet.entity.EventEntity; +import java.util.Map; + /** * 事件表 * @@ -32,4 +36,6 @@ public interface EventService extends BaseService { void addEvent(EventFormDTO formDTO); void updateEvent(EventFormDTO formDTO); + + PageData page(Map params); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java index 53f892b9a5..5fe736adb3 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/EventServiceImpl.java @@ -17,15 +17,23 @@ 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.EventDao; import com.epmet.dto.form.EventFormDTO; +import com.epmet.dto.result.EventDTO; import com.epmet.entity.EventEntity; import com.epmet.service.EventService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import java.util.Map; + /** * 事件表 * @@ -35,7 +43,14 @@ import org.springframework.stereotype.Service; @Slf4j @Service public class EventServiceImpl extends BaseServiceImpl implements EventService { - + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, EventDTO.class); + } @Override public void addEvent(EventFormDTO formDTO) { EventEntity eventEntity = ConvertUtils.sourceToTarget(formDTO, EventEntity.class); @@ -46,4 +61,12 @@ public class EventServiceImpl extends BaseServiceImpl imp public void updateEvent(EventFormDTO formDTO) { //baseDao.update(eventEntity); } + 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; + } } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml index 146d5758dd..ec2f2c7a2b 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/bootstrap.yml @@ -117,4 +117,12 @@ ribbon: #pageHelper分页插件 pagehelper: helper-dialect: mysql - reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 \ No newline at end of file + reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 + +#亿联云消息网关 +elink: + mq: + appId: @elink.mq.appId@ #项目接入亿联云的应用Id + token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret + host: @elink.mq.host@ #亿联云消息网关服务地址 + sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径 \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml index 8571a47da1..72477fb20d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/bootstrap.yml @@ -118,17 +118,19 @@ pagehelper: helper-dialect: mysql reasonable: false #分页合理化配置,例如输入页码为-1,则自动转化为最小页码1 -#亿联云消息网关 -elink: - mq: - appId: @elink.mq.appId@ #项目接入亿联云的应用Id - token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret - host: @elink.mq.host@ #亿联云消息网关服务地址 - sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径 + openapi: scan: server: url: @openapi.scan.server.url@ method: imgSyncScan: /imgSyncScan - textSyncScan: /textSyncScan \ No newline at end of file + textSyncScan: /textSyncScan + +#亿联云消息网关 +elink: + mq: + appId: @elink.mq.appId@ #项目接入亿联云的应用Id + token: @elink.mq.token@ #项目接入亿联云的应用token 相当于secret + host: @elink.mq.host@ #亿联云消息网关服务地址 + sendMsgPath: @elink.mq.sendMsgPath@ #发送消息路径 \ No newline at end of file From a01057d543ae3138de9de4c585a7474e7db6c7d8 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 16:59:41 +0800 Subject: [PATCH 089/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E6=8E=88=E6=9D=83=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/dto/form/OpenAppIdFormDTO.java | 20 +++++ .../com/epmet/dto/form/RemoveBindFormDTO.java | 26 +++++++ .../AppLetAuthorizationController.java | 27 +++++++ .../java/com/epmet/dao/BindingAccountDao.java | 9 +++ .../java/com/epmet/dao/CustomerMpDao.java | 10 ++- .../main/java/com/epmet/redis/RedisThird.java | 11 +++ .../service/AppLetAuthorizationService.java | 18 +++++ .../impl/AppLetAuthorizationServiceImpl.java | 78 +++++++++++++++++++ .../ComponentVerifyTicketServiceImpl.java | 8 +- .../wxapi/constant/WxMaCodeConstant.java | 10 +++ .../resources/mapper/BindingAccountDao.xml | 9 +++ .../main/resources/mapper/CustomerMpDao.xml | 19 ++++- 12 files changed, 236 insertions(+), 9 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RemoveBindFormDTO.java diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java new file mode 100644 index 0000000000..ddd36a2376 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/24 16:31 + */ +@Data +public class OpenAppIdFormDTO implements Serializable { + + private static final long serialVersionUID = 4181403694668558506L; + + /** + * 客户端类型 + */ + private String clientType; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RemoveBindFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RemoveBindFormDTO.java new file mode 100644 index 0000000000..c83dbcc97b --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/RemoveBindFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Author zxc + * @CreateTime 2020/7/23 9:09 + */ +@Data +public class RemoveBindFormDTO implements Serializable { + + private static final long serialVersionUID = 1920195626466407047L; + + public interface RemoveBind extends CustomerClientShowGroup {} + + /** + * 客户端类型 resi:居民端 , work:工作端 + */ + @NotBlank(message = "客户端类型不能为空",groups = {RemoveBindFormDTO.RemoveBind.class}) + private String clientType; + +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java index 45c8a65cb4..34d3d87cf2 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java @@ -5,6 +5,8 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.GoToAuthFormDTO; +import com.epmet.dto.form.OpenAppIdFormDTO; +import com.epmet.dto.form.RemoveBindFormDTO; import com.epmet.dto.result.GoToAuthResultDTO; import com.epmet.service.AppLetAuthorizationService; import org.springframework.beans.factory.annotation.Autowired; @@ -36,4 +38,29 @@ public class AppLetAuthorizationController { return new Result().ok(goToAuthResultDTO); } + /** + * @Description 将公众号/小程序从开放平台帐号下解绑 + * @param tokenDto + * @param formDTO + * @author zxc + */ + @PostMapping("removeBind") + public Result removeBind(@LoginUser TokenDto tokenDto , @RequestBody RemoveBindFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,RemoveBindFormDTO.RemoveBind.class); + appLetAuthorizationService.removeBind(tokenDto,formDTO); + return new Result(); + } + + /** + * @Description 查看小程序绑定的开放平台账号 + * @param tokenDto + * @param formDTO + * @author zxc + */ + @PostMapping("getopenappidbyauthappid") + public Result getOpenAppId(@LoginUser TokenDto tokenDto , @RequestBody OpenAppIdFormDTO formDTO){ + String openAppId = appLetAuthorizationService.getOpenAppId(tokenDto, formDTO); + return new Result().ok(openAppId); + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java index 4ea9771d2c..2d6b624400 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.BindingAccountFormDTO; import com.epmet.entity.BindingAccountEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 公众号/小程序绑定开放平台帐号表 @@ -37,5 +38,13 @@ public interface BindingAccountDao extends BaseDao { * @author zxc */ void insertBindingAccount(BindingAccountFormDTO formDTO); + + /** + * @Description 更新绑定状态 + * @param customerId + * @param authAppId + * @author zxc + */ + void updateBindStatus(@Param("customerId")String customerId,@Param("authAppId")String authAppId); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java index ae1fb6ebf7..3b3a4ee9b8 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/CustomerMpDao.java @@ -58,7 +58,7 @@ public interface CustomerMpDao extends BaseDao { * @param customerId * @author zxc */ - List selectAuthCount(@Param("customerId")String customerId); + Integer selectAuthCount(@Param("customerId")String customerId); /** * @Description 回填customer_mp的appId @@ -115,4 +115,12 @@ public interface CustomerMpDao extends BaseDao { * @author zxc */ Integer checkBind(String authAppId,String clientType); + + /** + * @Description 根据客户Id和客户端类型查询AppId + * @param customerId + * @param clientType + * @author zxc + */ + String getAppId(@Param("customerId")String customerId,@Param("clientType")String clientType); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java index e367e13227..50de85c556 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/redis/RedisThird.java @@ -126,4 +126,15 @@ public class RedisThird { redisUtils.hMSet(key, map,NOT_EXPIRE); } + /** + * @Description 获取授权信息 + * @param customerId + * @param clientType + * @author zxc + */ + public Map getAuthInfo(String customerId,String clientType){ + String key = ThirdRedisKeyConstant.AUTH_INFO_REDIS_KEY + customerId + ThirdRedisKeyConstant.COLON + clientType; + return redisUtils.hGetAll(key); + } + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java index 30fa445a54..abb8f4bfbd 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java @@ -2,6 +2,8 @@ package com.epmet.service; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.form.GoToAuthFormDTO; +import com.epmet.dto.form.OpenAppIdFormDTO; +import com.epmet.dto.form.RemoveBindFormDTO; import com.epmet.dto.result.GoToAuthResultDTO; /** @@ -17,4 +19,20 @@ public interface AppLetAuthorizationService { */ GoToAuthResultDTO goToAuth(TokenDto tokenDto, GoToAuthFormDTO formDTO); + /** + * @Description 将公众号/小程序从开放平台帐号下解绑 + * @param tokenDto + * @param formDTO + * @author zxc + */ + void removeBind(TokenDto tokenDto, RemoveBindFormDTO formDTO); + + /** + * @Description 查看小程序绑定的开放平台账号 + * @param tokenDto + * @param formDTO + * @author zxc + */ + String getOpenAppId(TokenDto tokenDto, OpenAppIdFormDTO formDTO); + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java index a80fe2b76a..db41634212 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java @@ -1,9 +1,22 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +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.HttpClientManager; +import com.epmet.constant.ModuleConstant; +import com.epmet.dao.BindingAccountDao; +import com.epmet.dao.CustomerMpDao; +import com.epmet.dao.OpenPlatformAccountDao; import com.epmet.dao.PaCustomerAgencyDao; import com.epmet.dto.form.GoToAuthFormDTO; +import com.epmet.dto.form.OpenAppIdFormDTO; +import com.epmet.dto.form.RemoveBindFormDTO; +import com.epmet.dto.result.AuthorizationInfoResultDTO; import com.epmet.dto.result.GoToAuthResultDTO; +import com.epmet.redis.RedisThird; import com.epmet.service.AppLetAuthorizationService; import com.epmet.service.ComponentVerifyTicketService; import com.epmet.wxapi.constant.WxMaCodeConstant; @@ -12,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.util.Map; + /** * @Author zxc * @CreateTime 2020/7/10 15:52 @@ -24,6 +39,17 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic private PaCustomerAgencyDao paCustomerAgencyDao; @Autowired private ComponentVerifyTicketService componentVerifyTicketService; + @Autowired + private ComponentVerifyTicketServiceImpl componentVerifyTicketServiceImpl; + @Autowired + private OpenPlatformAccountDao openPlatformAccountDao; + @Autowired + private CustomerMpDao customerMpDao; + @Autowired + private RedisThird redisThird; + @Autowired + private BindingAccountDao bindingAccountDao; + @Value("${third.platform.appId}") private String componentAppId; @@ -44,4 +70,56 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic result.setUrl(authUrl); return result; } + + /** + * @Description 将公众号/小程序从开放平台帐号下解绑 + * @param tokenDto + * @param formDTO + * @author zxc + */ + @Override + public void removeBind(TokenDto tokenDto, RemoveBindFormDTO formDTO) { + String customerId = componentVerifyTicketServiceImpl.getLoginUserCustomerId(tokenDto); + String clientType = formDTO.getClientType(); + //查询openAppId + String openAppId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); + //查询appId + String authAppId = customerMpDao.getAppId(customerId, clientType); + Map authInfo = redisThird.getAuthInfo(customerId, clientType); + AuthorizationInfoResultDTO authorizationInfo = componentVerifyTicketServiceImpl.mapToEntity(authInfo, AuthorizationInfoResultDTO.class); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); + jsonObject.put(ModuleConstant.OPEN_APP_ID,openAppId); + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.UN_BIND + authorizationInfo.getAuthorizer_access_token(), JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + if (!map.get(ModuleConstant.ERR_CODE).equals(NumConstant.ZERO_STR)){ + log.error("解绑失败" + data); + throw new RenException("解绑失败" + data); + } + bindingAccountDao.updateBindStatus(customerId,authAppId); + + } + + /** + * @Description 查看小程序绑定的开放平台账号 + * @param tokenDto + * @param formDTO + * @author zxc + */ + @Override + public String getOpenAppId(TokenDto tokenDto, OpenAppIdFormDTO formDTO) { + String customerId = componentVerifyTicketServiceImpl.getLoginUserCustomerId(tokenDto); + String clientType = formDTO.getClientType(); + String authAppId = customerMpDao.getAppId(customerId, clientType); + Map authInfo = redisThird.getAuthInfo(customerId, clientType); + AuthorizationInfoResultDTO authorizationInfo = componentVerifyTicketServiceImpl.mapToEntity(authInfo, AuthorizationInfoResultDTO.class); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.LOW_APP_ID,authAppId); + String data = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.UN_BIND + authorizationInfo.getAuthorizer_access_token(), JSON.toJSONString(jsonObject)).getData(); + Map map = JSON.parseObject(data, Map.class); + if (map.containsKey(ModuleConstant.OPEN_APP_ID)){ + return map.get(ModuleConstant.OPEN_APP_ID).toString(); + } + return map.get(ModuleConstant.ERR_MSG).toString(); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 69302821e7..4bcf98a9e3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -525,12 +525,12 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe boolean bindStatus = bindInfo.containsKey(ModuleConstant.OPEN_APP_ID); if (bindStatus != true) { log.info(CREATE_AND_BIND_SUCCESS); - List authCount = customerMpDao.selectAuthCount(customerId); + Integer authCount = customerMpDao.selectAuthCount(customerId); String openPlatformId = null; - if (authCount.size() > 0) { + if (authCount > 0) { openPlatformId = openPlatformAccountDao.selectOpenAppIdByCustomerId(customerId); } - if (authCount.size() == NumConstant.ZERO) { + if (authCount == NumConstant.ZERO) { log.info("未查询到该客户授权信息,先创建开放平台账号,再绑定"); //没有任何一个小程序/公众号授权,【先创建,再绑定】 JSONObject jsonObject = new JSONObject(); @@ -560,7 +560,7 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe case ModuleConstant.EIGHTY_NINE_THOUSAND: throw new RenException(ACCOUNT_HAS_BOUND_OPEN); } - } else if (authCount.size() > NumConstant.ZERO && !authCount.contains(authAppId)) { + } else if (authCount > NumConstant.ZERO) { log.info("该客户已创建过开放平台账号,直接绑定"); JSONObject jsonObject = new JSONObject(); jsonObject.put(ModuleConstant.LOW_APP_ID, authAppId); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java index 8ec83ac350..9302f876ff 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/constant/WxMaCodeConstant.java @@ -56,6 +56,16 @@ public interface WxMaCodeConstant { */ String API_BIND_OPEN = "https://api.weixin.qq.com/cgi-bin/open/bind?access_token="; + /** + *公众号/小程序从开放平台帐号下解绑 + */ + String UN_BIND = "https://api.weixin.qq.com/cgi-bin/open/unbind?access_token="; + + /** + * 获取公众号/小程序所绑定的开放平台帐号 + */ + String OPEN_GET = "https://api.weixin.qq.com/cgi-bin/open/get?access_token="; + /** * 获取授权方的帐号基本信息 */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml index d0d3d49815..c745f40578 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/BindingAccountDao.xml @@ -21,4 +21,13 @@ NOW() ) + + + + UPDATE binding_account + SET del_flag = 1 + WHERE + customer_id = #{customerId} + AND client_type = #{clientType} + \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index f4e6b6403a..cd54689027 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -19,15 +19,14 @@ client ASC - SELECT app_id AS authAppId FROM - customer_mp + open_platform_account WHERE - del_flag = '0' + del_flag = 0 AND customer_id = #{customerId} - AND authorization_flag = 1 @@ -127,4 +126,16 @@ AND client != #{clientType} + + + \ No newline at end of file From 0ba119a8729a4bf42f64c6c38c4605c874e4b59a Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 17:01:36 +0800 Subject: [PATCH 090/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 62b4f74e2e..fa21816242 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.56 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.57 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index ffe5d338fd..09f02070aa 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.56 + 0.0.57 com.epmet From 9f85f9494563bd0acb7b2aa8a2b7fc4fe1b83407 Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 24 Jul 2020 17:06:08 +0800 Subject: [PATCH 091/157] =?UTF-8?q?HttpClientManager=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=96=87=E4=BB=B6=EF=BC=8C=E8=8E=B7=E5=8F=96?= =?UTF-8?q?byte[]=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/utils/HttpClientManager.java | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 50ba1643c8..0a9f862662 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -29,6 +29,7 @@ import org.springframework.util.CollectionUtils; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -307,6 +308,65 @@ public class HttpClientManager { return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } + /** + * 获取下载文件的字节数组 + * @param url + * @param params + * @return + */ + public Result getDownloadFilebytes(String url, Map params) { + + try { + URIBuilder builder = new URIBuilder(url); + if (!CollectionUtils.isEmpty(params)) { + Set set = params.keySet(); + for (String key : set) { + builder.setParameter(key, params.get(key) == null ? "" : String.valueOf(params.get(key))); + } + } + HttpGet httpGet = new HttpGet(builder.build()); + httpGet.setConfig(requestConfig); + return executeTobyte(httpGet); + } catch (Exception e) { + log.error("sendGet exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } + + private Result executeTobyte(HttpRequestBase httpMethod) { + CloseableHttpResponse response = null; + try { + response = httpclient.execute(httpMethod); + log.debug("http send response:{}", JSON.toJSONString(response)); + if (response != null && response.getStatusLine() != null) { + if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + InputStream in = response.getEntity().getContent(); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int n = 0; + while (-1 != (n = in.read(buffer))) { + output.write(buffer, 0, n); + } + return new Result().ok(output.toByteArray()); + } else { + log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); + } + } + } catch (Exception e) { + log.error("execute exception", e); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + } finally { + httpMethod.releaseConnection(); + try { + if (response != null) { + response.close(); + } + } catch (IOException e) { + } + } + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } From 9a91f7c649c8415de326e8a225fd9ba7b9a6204c Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 17:56:51 +0800 Subject: [PATCH 092/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E6=8E=88=E6=9D=83=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java | 5 +++++ .../com/epmet/controller/AppLetAuthorizationController.java | 5 ++--- .../java/com/epmet/service/AppLetAuthorizationService.java | 3 +-- .../epmet/service/impl/AppLetAuthorizationServiceImpl.java | 5 ++--- .../src/main/resources/mapper/CustomerMpDao.xml | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java index ddd36a2376..a4ac48fe47 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/OpenAppIdFormDTO.java @@ -17,4 +17,9 @@ public class OpenAppIdFormDTO implements Serializable { * 客户端类型 */ private String clientType; + + /** + * 客户ID + */ + private String customerId; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java index 34d3d87cf2..0ef2d05e5a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/AppLetAuthorizationController.java @@ -53,13 +53,12 @@ public class AppLetAuthorizationController { /** * @Description 查看小程序绑定的开放平台账号 - * @param tokenDto * @param formDTO * @author zxc */ @PostMapping("getopenappidbyauthappid") - public Result getOpenAppId(@LoginUser TokenDto tokenDto , @RequestBody OpenAppIdFormDTO formDTO){ - String openAppId = appLetAuthorizationService.getOpenAppId(tokenDto, formDTO); + public Result getOpenAppId( @RequestBody OpenAppIdFormDTO formDTO){ + String openAppId = appLetAuthorizationService.getOpenAppId(formDTO); return new Result().ok(openAppId); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java index abb8f4bfbd..fd659764b9 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/AppLetAuthorizationService.java @@ -29,10 +29,9 @@ public interface AppLetAuthorizationService { /** * @Description 查看小程序绑定的开放平台账号 - * @param tokenDto * @param formDTO * @author zxc */ - String getOpenAppId(TokenDto tokenDto, OpenAppIdFormDTO formDTO); + String getOpenAppId(OpenAppIdFormDTO formDTO); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java index db41634212..ba3c63d941 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java @@ -102,13 +102,12 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic /** * @Description 查看小程序绑定的开放平台账号 - * @param tokenDto * @param formDTO * @author zxc */ @Override - public String getOpenAppId(TokenDto tokenDto, OpenAppIdFormDTO formDTO) { - String customerId = componentVerifyTicketServiceImpl.getLoginUserCustomerId(tokenDto); + public String getOpenAppId(OpenAppIdFormDTO formDTO) { + String customerId = formDTO.getCustomerId(); String clientType = formDTO.getClientType(); String authAppId = customerMpDao.getAppId(customerId, clientType); Map authInfo = redisThird.getAuthInfo(customerId, clientType); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index cd54689027..9c3c48b996 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -135,7 +135,7 @@ WHERE del_flag = 0 AND customer_id = #{customerId} - AND client_type = #{clientType} + AND client = #{clientType} \ No newline at end of file From ced1fc616b5c1b6962cf16b257b8c960634479ce Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Fri, 24 Jul 2020 18:01:15 +0800 Subject: [PATCH 093/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index fa21816242..cb770c9a05 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.57 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.58 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 09f02070aa..3677cfa944 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.57 + 0.0.58 com.epmet From 8f106d7f9794d25575697df1c1abf275747004ef Mon Sep 17 00:00:00 2001 From: wxz Date: Fri, 24 Jul 2020 18:23:55 +0800 Subject: [PATCH 094/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-test.yml | 2 +- .../epmet-job/epmet-job-server/deploy/docker-compose-test.yml | 2 +- .../epmet-third-server/deploy/docker-compose-test.yml | 2 +- .../gov-org/gov-org-server/deploy/docker-compose-test.yml | 2 +- .../resi-guide/resi-guide-server/deploy/docker-compose-test.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-test.yml b/epmet-auth/deploy/docker-compose-test.yml index d15b071181..ef83cd722f 100644 --- a/epmet-auth/deploy/docker-compose-test.yml +++ b/epmet-auth/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.36 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.48 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml index 9fc81b43c5..2749306424 100644 --- a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-job-server: container_name: epmet-job-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-job-server:0.3.22 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-job-server:0.3.23 ports: - "8084:8084" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml index 60cf655960..c396270821 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.14 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-third-server:0.0.58 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-test.yml b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-test.yml index a6e6dd4760..a912b71cc2 100644 --- a/epmet-module/gov-org/gov-org-server/deploy/docker-compose-test.yml +++ b/epmet-module/gov-org/gov-org-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-org-server: container_name: gov-org-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-org-server:0.3.74 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/gov-org-server:0.3.76 ports: - "8092:8092" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-test.yml b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-test.yml index 3aef647382..3fde6f4ec8 100644 --- a/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-test.yml +++ b/epmet-module/resi-guide/resi-guide-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-guide-server: container_name: resi-guide-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-guide-server:0.3.17 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-guide-server:0.3.18 ports: - "8091:8091" network_mode: host # 使用现有网络 From 24a841a0a766b34fdd354415ad65a1ea53c981ab Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Fri, 24 Jul 2020 18:56:17 +0800 Subject: [PATCH 095/157] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4-=E4=B8=80=E6=B3=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/resi/ResiActInsertLiveFormDTO.java | 5 + .../com/epmet/feign/EpmetUserFeignClient.java | 11 --- .../EpmetUserFeignClientFallBack.java | 4 - .../java/com/epmet/dao/ActLiveRecDao.java | 12 ++- .../java/com/epmet/dao/ActSignInRecDao.java | 15 ++- .../com/epmet/service/ActLiveRecService.java | 7 -- .../epmet/service/ActSignInRecService.java | 5 - .../service/impl/ActLiveRecServiceImpl.java | 40 ++++---- .../service/impl/ActSignInRecServiceImpl.java | 58 +++++------ .../impl/ActUserRelationServiceImpl.java | 95 ++++++++++++++----- .../impl/HeartUserInfoServiceImpl.java | 58 ++++++----- .../com/epmet/utils/ValidityVerification.java | 6 +- .../src/main/resources/mapper/ActInfoDao.xml | 12 +-- .../main/resources/mapper/ActLiveRecDao.xml | 31 ++++++ .../main/resources/mapper/ActSignInRecDao.xml | 37 +++++++- .../resources/mapper/HeartUserInfoDao.xml | 3 +- .../epmet/feign/EpmetUserOpenFeignClient.java | 11 +++ .../EpmetUserOpenFeignClientFallback.java | 5 + .../epmet/controller/UserRoleController.java | 4 +- 19 files changed, 275 insertions(+), 144 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java index d84b3b4698..42ee3576fe 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java @@ -90,4 +90,9 @@ public class ResiActInsertLiveFormDTO implements Serializable { * 用户id */ private String userId; + + /** + * id + */ + private String id; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java index c8e1660cd3..55455d5122 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java @@ -36,17 +36,6 @@ public interface EpmetUserFeignClient { @PostMapping("epmetuser/userbaseinfo/queryuserbaseinfo") Result> heartQueryUserBaseInfo(@RequestBody List userIds); - /** - * 根据用户ID,查询用户所属角色: 多种身份 - * - * @param userId - * @return com.epmet.commons.tools.utils.Result> - * @Author zhangyong - * @Date 14:13 2020-07-23 - **/ - @PostMapping(value = "epmetuser/userrole/getuserroleinfobyuserid/{userId}", consumes = MediaType.APPLICATION_JSON_VALUE) - Result> getUserRoleInfoByUserId(@PathVariable("userId") String userId); - /** * 同步-居民基础信息、用户微信信息 * diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java index 1238fceed5..37beeef602 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java @@ -25,10 +25,6 @@ public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "heartQueryUserBaseInfo", userIds); } - @Override - public Result> getUserRoleInfoByUserId(String userId) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfoByUserId", userId); - } @Override public Result updateUserBaseAndWxUserInfo(WxUserInfoFormDTO formDTO) { diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java index 61d04aa888..ce9999af87 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActLiveRecDao.java @@ -20,7 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ActLivePicDTO; import com.epmet.dto.ActLiveRecDTO; -import com.epmet.dto.form.resi.ResiActContentFormDTO; +import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; import com.epmet.entity.ActLiveRecEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -55,4 +55,14 @@ public interface ActLiveRecDao extends BaseDao { * @Date 17:04 2020-07-22 **/ List selectListActLiveImg(@Param("liveId") List liveIds); + + /** + * 插入活动实况表 + * + * @param formDTO + * @return void + * @Author zhangyong + * @Date 18:05 2020-07-24 + **/ + void insertActLiveRec(ResiActInsertLiveFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSignInRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSignInRecDao.java index 04c13f13cd..ca383df81f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSignInRecDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActSignInRecDao.java @@ -18,6 +18,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.ActSignInRecDTO; +import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.entity.ActSignInRecEntity; import org.apache.ibatis.annotations.Mapper; @@ -29,5 +31,14 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActSignInRecDao extends BaseDao { - -} \ No newline at end of file + + /** + * 插入活动签到记录表 + * + * @param dto + * @return void + * @Author zhangyong + * @Date 18:05 2020-07-24 + **/ + void insertActSignInRec(ActSignInRecDTO dto); +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java index 4185eedf75..79d95ce9e7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java @@ -18,19 +18,12 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.ActLiveRecDTO; -import com.epmet.dto.form.resi.ResiActContentFormDTO; import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; -import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLiveRecEntity; -import java.util.List; -import java.util.Map; - /** * 活动实况记录 * diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java index 84aec10141..c2ba4124ce 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActSignInRecService.java @@ -18,16 +18,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.ActSignInRecDTO; import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.entity.ActSignInRecEntity; -import java.util.List; -import java.util.Map; - /** * 活动签到记录 * diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java index b5038ce2ab..79d8a52dbe 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java @@ -20,11 +20,10 @@ package com.epmet.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.ActLivePicDao; import com.epmet.dao.ActLiveRecDao; -import com.epmet.dao.ActUserLogDao; -import com.epmet.dao.ActUserRelationDao; import com.epmet.dto.ActLivePicDTO; import com.epmet.dto.ActLiveRecDTO; import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; @@ -32,9 +31,11 @@ import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLivePicEntity; import com.epmet.entity.ActLiveRecEntity; +import com.epmet.entity.ActSignInRecEntity; import com.epmet.feign.EpmetUserFeignClient; import com.epmet.redis.ActLiveRecRedis; import com.epmet.service.ActLiveRecService; +import com.epmet.utils.ValidityVerification; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -99,26 +100,29 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); + // 文本校验 + ValidityVerification verification = new ValidityVerification(); + verification.textScanVerification(formDTO.getDesc(),"添加实况-文本内容审核失败"); + // 图片校验 + verification.imgScanVerification(formDTO.getImages(),"添加实况-图片审核失败"); + // 存储活动实况记录表 - ActLiveRecEntity actLiveRecEntity = new ActLiveRecEntity(); - actLiveRecEntity.setActId(formDTO.getActId()); - actLiveRecEntity.setUserId(formDTO.getUserId()); - actLiveRecEntity.setLongitude(formDTO.getLongitude()); - actLiveRecEntity.setLatitude(formDTO.getLatitude()); - actLiveRecEntity.setAddress(formDTO.getAddress()); - actLiveRecEntity.setDesc(formDTO.getDesc()); - baseDao.insert(actLiveRecEntity); + String uuid = UUID.randomUUID().toString().replaceAll("-",""); + formDTO.setId(uuid); + baseDao.insertActLiveRec(formDTO); //存储活动实况图片 List imgList = formDTO.getImages(); - for (int i = 0; i < imgList.size(); i++) { - String imgUrl = imgList.get(i); - ActLivePicEntity actLivePicEntity = new ActLivePicEntity(); - actLivePicEntity.setLiveId(actLiveRecEntity.getId()); - actLivePicEntity.setPicUrl(imgUrl); - actLivePicEntity.setSort(i + NumConstant.ONE); - actLivePicDao.insert(actLivePicEntity); + if (null != imgList){ + for (int i = 0; i < imgList.size(); i++) { + String imgUrl = imgList.get(i); + ActLivePicEntity actLivePicEntity = new ActLivePicEntity(); + actLivePicEntity.setLiveId(uuid); + actLivePicEntity.setPicUrl(imgUrl); + actLivePicEntity.setSort(i + NumConstant.ONE); + actLivePicDao.insert(actLivePicEntity); + } } - return new Result().ok(actLiveRecEntity.getId()); + return new Result().ok(uuid); } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java index 5cc716d8b4..4bd516e4f9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java @@ -25,22 +25,23 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ActConstant; import com.epmet.dao.ActSignInPicDao; import com.epmet.dao.ActSignInRecDao; -import com.epmet.dao.ActUserLogDao; import com.epmet.dao.ActUserRelationDao; +import com.epmet.dto.ActSignInRecDTO; import com.epmet.dto.ActUserRelationDTO; import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; import com.epmet.dto.form.resi.ResiActSignInFormDTO; import com.epmet.entity.ActSignInPicEntity; import com.epmet.entity.ActSignInRecEntity; -import com.epmet.entity.ActUserLogEntity; import com.epmet.redis.ActSignInRecRedis; import com.epmet.service.ActLiveRecService; import com.epmet.service.ActSignInRecService; +import com.epmet.utils.ValidityVerification; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.UUID; /** * 活动签到记录 @@ -57,9 +58,6 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl inSertlive = actLiveRecService.inSertlive(tokenDto, liveFormDTO); - liveId = inSertlive.getData(); + //实况id, 当sync_live=1时此列有值 + dto.setLiveId(inSertlive.getData()); } - // 存储活动签到记录表 - ActSignInRecEntity actSignInRecEntity = new ActSignInRecEntity(); - actSignInRecEntity.setActId(formDTO.getActId()); - actSignInRecEntity.setUserId(formDTO.getUserId()); - actSignInRecEntity.setLongitude(formDTO.getLongitude()); - actSignInRecEntity.setLatitude(formDTO.getLatitude()); - actSignInRecEntity.setAddress(formDTO.getAddress()); - actSignInRecEntity.setDesc(formDTO.getDesc()); - actSignInRecEntity.setSyncLive(formDTO.getSyncLive()); - actSignInRecEntity.setLiveId(liveId); - baseDao.insert(actSignInRecEntity); + String uuid = UUID.randomUUID().toString().replaceAll("-",""); + dto.setId(uuid); + baseDao.insertActSignInRec(dto); //存储活动签到图片 List imgList = formDTO.getImages(); - for (int i = 0; i < imgList.size(); i++) { - String imgUrl = imgList.get(i); - ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity(); - actLivePicEntity.setSignInId(actSignInRecEntity.getId()); - actLivePicEntity.setPicUrl(imgUrl); - actLivePicEntity.setSort(i + NumConstant.ONE); - actSignInPicDao.insert(actLivePicEntity); + if (null != imgList){ + for (int i = 0; i < imgList.size(); i++) { + String imgUrl = imgList.get(i); + ActSignInPicEntity actLivePicEntity = new ActSignInPicEntity(); + actLivePicEntity.setSignInId(uuid); + actLivePicEntity.setPicUrl(imgUrl); + actLivePicEntity.setSort(i + NumConstant.ONE); + actSignInPicDao.insert(actLivePicEntity); + } } return new Result(); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java index d1782fc0f8..53bc8a11f0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java @@ -42,7 +42,7 @@ import com.epmet.dto.result.UserRoleResultDTO; import com.epmet.entity.ActUserLogEntity; import com.epmet.entity.ActUserRelationEntity; import com.epmet.entity.HeartUserInfoEntity; -import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.ActUserRelationRedis; import com.epmet.service.ActInfoService; import com.epmet.service.ActUserLogService; @@ -76,7 +76,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl0 当前用户是志愿者 + Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getActId()); if (actInfoDTO.getVolunteerLimit()){ - // 活动只能志愿者参加 - Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getUserId()); - if (volunteerFlag > NumConstant.ZERO){ - satisfy = true; - } else { - logger.info("活动报名失败,请先认证志愿者"); - throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode()); - } + // 活动只能志愿者参加, 当前用户是否满足条件 + satisfy = this.volunteerParticipationAct(volunteerFlag); } else { - // 活动不限制志愿者身份,但要求是 居民身份 - Result> userRoleInfo = epmetUserFeignClient.getUserRoleInfoByUserId(formDTO.getUserId()); - for (UserRoleResultDTO roleResultDTO :userRoleInfo.getData()){ - if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(roleResultDTO.getRoleKey())){ - satisfy = true; - } - } - if (!satisfy){ - logger.info("活动报名失败,请完善居民信息"); - throw new RenException(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); - } + // 活动不限制志愿者身份,但要求是 居民身份, 当前用户是否满足条件 + satisfy = this.resiParticipationAct(formDTO.getUserId()); } if (satisfy){ - this.actStartSignUp(actInfoDTO, formDTO); + // 开始报名 + this.actStartSignUp(actInfoDTO, formDTO, volunteerFlag); } return new Result(); } - private void actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO){ + /** + * 开始报名活动 + * + * @param actInfoDTO 活动详情 + * @param formDTO 接口请求入参 + * @param volunteerFlag >0 当前用户是志愿者 + * @return void + * @Author zhangyong + * @Date 15:31 2020-07-24 + **/ + private void actStartSignUp(ActInfoDTO actInfoDTO, ResiActRegistrationFormDTO formDTO, Integer volunteerFlag){ boolean signUp = true; Integer auditingNum = actUserLogService.countActTimesOfParticipation(formDTO.getUserId()); if (auditingNum > NumConstant.ZERO){ @@ -246,7 +244,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl NumConstant.ZERO); entity.setKindnessTime(NumConstant.ZERO); entity.setParticipationNum(NumConstant.ZERO); entity.setObtainPointNum(NumConstant.ZERO); @@ -264,8 +262,53 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl NumConstant.ZERO){ + satisfy = true; + return satisfy; + } else { + logger.info("活动报名失败,请先认证志愿者"); + throw new RenException(EpmetErrorCode.NON_CERTIFIED_VOLUNTEER.getCode()); + } + } + + /** + * 活动报名,不限制志愿者身份,但要求是 居民身份。当前用户是否符合 + * @param userId + * @return boolean + * @Author zhangyong + * @Date 15:04 2020-07-24 + **/ + private boolean resiParticipationAct(String userId){ + boolean satisfy = false; + // 活动不限制志愿者身份,但要求是 居民身份 + Result> userRoleInfo = epmetUserOpenFeignClient.getUserRoleInfoByUserId(userId); + if (userRoleInfo.success()){ + for (UserRoleResultDTO roleResultDTO :userRoleInfo.getData()){ + if (EpmetRoleKeyConstant.REGISTERED_RESI.equals(roleResultDTO.getRoleKey())){ + satisfy = true; + } + } + } + if (!satisfy){ + logger.info("活动报名失败,请完善居民信息"); + throw new RenException(EpmetErrorCode.CANNOT_AUDIT_WARM.getCode()); + } else { + return satisfy; + } + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java index fead42e055..a8d0dfacfe 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/HeartUserInfoServiceImpl.java @@ -20,21 +20,24 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.HeartUserInfoDao; import com.epmet.dto.HeartUserInfoDTO; -import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.resi.ResiActBaseFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.resi.ResiLeaderboardResultDTO; import com.epmet.entity.HeartUserInfoEntity; -import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.HeartUserInfoRedis; import com.epmet.service.HeartUserInfoService; import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -52,11 +55,11 @@ import java.util.Map; */ @Service public class HeartUserInfoServiceImpl extends BaseServiceImpl implements HeartUserInfoService { - + private Logger logger = LogManager.getLogger(HeartUserInfoServiceImpl.class); @Autowired private HeartUserInfoRedis heartUserInfoRedis; @Autowired - private EpmetUserFeignClient epmetUserFeignClient; + private EpmetUserOpenFeignClient epmetUserOpenFeignClient; @Override public PageData page(Map params) { @@ -124,28 +127,35 @@ public class HeartUserInfoServiceImpl extends BaseServiceImpl> leaderboard(ResiActBaseFormDTO formDTO) { + List resultDTOS = new ArrayList<>(); // 获取排好序的 排行榜 List leaderboardList = baseDao.selectListLeaderboard(formDTO); - // 根据用户ID获取微信昵称、头像 - List userIds = new ArrayList<>(); - for (HeartUserInfoDTO list : leaderboardList){ - userIds.add(list.getUserId()); - } - // 查询用户微信基础信息 - Result> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds); - - List resultDTOS = new ArrayList<>(); - for (HeartUserInfoDTO list : leaderboardList){ - ResiLeaderboardResultDTO dto = new ResiLeaderboardResultDTO(); - dto.setKindnessTime(list.getKindnessTime()); - dto.setVolunteerFlag(list.getVolunteerFlag()); - dto.setParticipationNum(list.getParticipationNum()); - List wxInfo = userWxInfos.getData(); - for (UserBaseInfoResultDTO wx : wxInfo){ - if (list.getUserId().equals(wx.getUserId())){ - dto.setHeadImg(wx.getHeadImgUrl()); - dto.setNickname(wx.getNickname()); + if (leaderboardList.size() > NumConstant.ZERO){ + // 根据用户ID获取微信昵称、头像 + List userIds = new ArrayList<>(); + for (HeartUserInfoDTO list : leaderboardList){ + userIds.add(list.getUserId()); + } + // 查询用户微信基础信息 + Result> userWxInfos = epmetUserOpenFeignClient.queryUserBaseInfo(userIds); + if (userWxInfos.success() && userWxInfos.getData().size() > NumConstant.ZERO){ + for (HeartUserInfoDTO list : leaderboardList){ + ResiLeaderboardResultDTO dto = new ResiLeaderboardResultDTO(); + dto.setKindnessTime(list.getKindnessTime()); + dto.setVolunteerFlag(list.getVolunteerFlag()); + dto.setParticipationNum(list.getParticipationNum()); + List wxInfo = userWxInfos.getData(); + for (UserBaseInfoResultDTO wx : wxInfo){ + if (list.getUserId().equals(wx.getUserId())){ + dto.setHeadImg(wx.getHeadImgUrl()); + dto.setNickname(wx.getNickname()); + } + } + resultDTOS.add(dto); } + } else { + logger.info("查询用户基本信息接口返回失败"); + throw new RenException("查询用户基本信息失败"); } } return new Result>().ok(resultDTOS); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java index 2b56bdc176..48deaa99b9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java @@ -64,11 +64,13 @@ public class ValidityVerification { /** * 图片列表校验 * @param imgList 被校验的图片列表 + * @param businessEnum 业务枚举,定义校验失败后,输出的日志信息 + * * @return void * @auther zhangyong * @Date 14:42 2020-07-15 **/ - public void imgScanVerification(List imgList){ + public void imgScanVerification(List imgList, String businessEnum){ if (NumConstant.ZERO != imgList.size()){ ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); imgList.forEach(url -> { @@ -82,6 +84,8 @@ public class ValidityVerification { throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); } else { if (!imgScanResult.getData().isAllPass()) { + // 业务枚举:例如:评论话题失败,评论内容为:%s" + log.error(String.format(businessEnum)); throw new RenException(EpmetErrorCode.IMG_SCAN_FAILED.getCode()); } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 380e0197a7..41545a7269 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -450,12 +450,12 @@ resultType="java.lang.Integer"> SELECT COUNT(1) - FROM act_info - WHERE DEL_FLAG = '0' - AND USER_ID = #{userId} - AND ACT_STATUS = 'published' - AND ((#{actStartTime} BETWEEN ACT_START_TIME AND ACT_END_TIME OR #{actEndTime} BETWEEN ACT_START_TIME AND ACT_END_TIME) - or (ACT_START_TIME BETWEEN #{actStartTime} AND #{actEndTime} OR ACT_END_TIME BETWEEN #{actStartTime} AND #{actEndTime})); + FROM act_info i LEFT JOIN act_user_relation r ON i.ID = r.ACT_ID + WHERE i.DEL_FLAG = '0' + AND r.USER_ID = #{userId} + AND i.ACT_STATUS = 'published' + AND ((#{actStartTime} BETWEEN i.ACT_START_TIME AND i.ACT_END_TIME OR #{actEndTime} BETWEEN i.ACT_START_TIME AND i.ACT_END_TIME) + or (i.ACT_START_TIME BETWEEN #{actStartTime} AND #{actEndTime} OR i.ACT_END_TIME BETWEEN #{actStartTime} AND #{actEndTime})); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml index 6e0281baf5..6b3c8d92ea 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActLiveRecDao.xml @@ -48,4 +48,35 @@ order by SORT asc + + + INSERT INTO act_live_rec ( + ID, + ACT_ID, + USER_ID, + LONGITUDE, + LATITUDE, + ADDRESS, + `DESC`, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + VALUES + ( #{id}, + #{actId}, + #{userId}, + #{longitude}, + #{latitude}, + #{address}, + #{desc}, + 0, + 0, + #{userId}, + now(), + #{userId}, + now()) + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml index 6ac88d72a1..c1e6956935 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActSignInRecDao.xml @@ -21,5 +21,38 @@ - - \ No newline at end of file + + INSERT INTO act_sign_in_rec ( + ID, + ACT_ID, + USER_ID, + LONGITUDE, + LATITUDE, + ADDRESS, + `DESC`, + SYNC_LIVE, + LIVE_ID, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME) + VALUES + ( #{id}, + #{actId}, + #{userId}, + #{longitude}, + #{latitude}, + #{address}, + #{desc}, + #{syncLive}, + #{liveId}, + 0, + 0, + #{userId}, + now(), + #{userId}, + now()) + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml index 107007c2dc..3a9473fa15 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml @@ -45,8 +45,7 @@ resultType="com.epmet.dto.HeartUserInfoDTO"> SELECT ui.USER_ID userId, - volunteerFlag, - IF(ui.VOLUNTEER_FLAG = 1, true , false ) + ui.VOLUNTEER_FLAG volunteerFlag, ui.KINDNESS_TIME kindnessTime, ui.PARTICIPATION_NUM participationNum FROM heart_user_info ui diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index 8a4de9898e..e9f080a3b5 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -148,4 +148,15 @@ public interface EpmetUserOpenFeignClient { **/ @PostMapping("/epmetuser/userbaseinfo/queryuserbaseinfo") Result> queryUserBaseInfo(@RequestBody List userIdList); + + /** + * 根据用户ID,查询用户所属角色: 多种身份 + * + * @param userId + * @return com.epmet.commons.tools.utils.Result> + * @Author zhangyong + * @Date 14:13 2020-07-23 + **/ + @GetMapping(value = "epmetuser/userrole/getuserroleinfobyuserid/{userId}") + Result> getUserRoleInfoByUserId(@PathVariable("userId") String userId); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index bb2cbe9d77..1eafedfbd2 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -98,4 +98,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> queryUserBaseInfo(List userIdList) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryUserBaseInfo", userIdList); } + + @Override + public Result> getUserRoleInfoByUserId(String userId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfoByUserId", userId); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java index f73fc1b52f..7a1bbbe99d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/UserRoleController.java @@ -128,8 +128,8 @@ public class UserRoleController { * @Author zhangyong * @Date 14:24 2020-07-23 **/ - @PostMapping("getuserroleinfobyuserid/{userId}") - public Result> getUserRoleInfoByUserId(@PathVariable String userId) { + @GetMapping("getuserroleinfobyuserid/{userId}") + public Result> getUserRoleInfoByUserId(@PathVariable("userId") String userId) { return userRoleService.getUserRoleInfoByUserId(userId); } } From 8e83a93a86e7b9aa27ead5ea83f88ff9a17b7d11 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 24 Jul 2020 18:56:40 +0800 Subject: [PATCH 096/157] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=BD=91=E5=85=B3=E4=BA=8B=E4=BB=B6=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/dto/form/mq/EventClassDto.java | 41 +++++++++++++ .../tools/dto/form/mq/MqBaseMsgDTO.java | 7 ++- .../{MqConfigDTO.java => MqBaseParamDTO.java} | 2 +- .../commons/tools/enums/MqMethodPathEnum.java | 2 +- .../commons/tools/utils/SendMqMsgUtils.java | 59 ++++++++++++++++--- .../com/epmet/controller/EventController.java | 17 ++---- 6 files changed, 106 insertions(+), 22 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java rename epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/{MqConfigDTO.java => MqBaseParamDTO.java} (83%) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java new file mode 100644 index 0000000000..fb82587822 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/EventClassDto.java @@ -0,0 +1,41 @@ +package com.epmet.commons.tools.dto.form.mq; + +import lombok.Data; + +import java.io.Serializable; + +/** + * desc:消息网关事件类型dto + * + * @author lyn + * @date 2020/7/24 18:30 + */ +@Data +public class EventClassDto implements Serializable { + private static final long serialVersionUID = 6923860669547819790L; + /** + * appId + */ + private String appId; + /** + * 事件类型Id + */ + private Integer id; + /** + * 事件标识 + */ + private String eventClass; + /** + * 事件名称 + */ + private String eventClassName; + /** + * 0''未删''1''已删 + */ + private Integer delFlag; + /** + * 事件计数 + */ + private Integer eventCount; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java index 812d2e5baa..6e9318549e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseMsgDTO.java @@ -3,6 +3,8 @@ package com.epmet.commons.tools.dto.form.mq; import lombok.Data; import org.springframework.stereotype.Component; +import javax.validation.constraints.NotBlank; + /** * 消息网关基础信息 * @@ -11,20 +13,23 @@ import org.springframework.stereotype.Component; **/ @Data @Component -public class MqBaseMsgDTO extends MqConfigDTO { +public class MqBaseMsgDTO extends MqBaseParamDTO { private static final long serialVersionUID = 8176470786428432009L; /** * mq的事件类型 */ + @NotBlank(message = "事件类型不能为空") private String eventClass; /** * 事件code */ + @NotBlank(message = "事件标识不能为空") private String eventTag; /** * 消息体 */ + @NotBlank(message = "消息体不能为空") private String msg; } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqConfigDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java similarity index 83% rename from epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqConfigDTO.java rename to epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java index 24a388f8ae..9ad8df6cf4 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqConfigDTO.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/MqBaseParamDTO.java @@ -11,7 +11,7 @@ import java.io.Serializable; * @date 2020-07-21 14:33 **/ @Data -public class MqConfigDTO implements Serializable { +public class MqBaseParamDTO implements Serializable { private String appId; private String token; private String requestUrl; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java index d74e47dab6..866229d1d9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/MqMethodPathEnum.java @@ -9,7 +9,7 @@ package com.epmet.commons.tools.enums; **/ public enum MqMethodPathEnum { SEND_MSG("producerService/producer/sendMsg", "发送消息"), - GET_EVENT_LIST("/eventClass/getList", "获取时间类型列表"), + GET_EVENT_LIST("eventClass/getList", "获取事件类型列表"), ; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java index 65fb179ca3..dede8d5706 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/SendMqMsgUtils.java @@ -4,14 +4,21 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.epmet.commons.tools.config.MqConfig; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.form.mq.EventClassDto; import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; import com.epmet.commons.tools.dto.form.mq.MqReturnBaseResult; import com.epmet.commons.tools.enums.MqMethodPathEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ValidateException; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.DefaultGroup; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + /** * 发送亿联云消息工具类 * @@ -21,7 +28,7 @@ import org.springframework.stereotype.Component; @Slf4j @Component public class SendMqMsgUtils { - private static MqConfig mqStaticConfig; + private static MqConfig mqConfig; /** * desc:发送mq消息 @@ -29,19 +36,19 @@ public class SendMqMsgUtils { * @return */ public static Result sendMsg(MqBaseMsgDTO msg) { - if (mqStaticConfig == null) { - mqStaticConfig = SpringContextUtils.getBean(MqConfig.class); + if (mqConfig == null) { + mqConfig = SpringContextUtils.getBean(MqConfig.class); } log.debug("sendMsg param:{}", JSON.toJSONString(msg)); try { // TODO - //ValidatorUtils.validateEntity(msg, null); + ValidatorUtils.validateEntity(msg, DefaultGroup.class); } catch (ValidateException e) { return new Result().error(e.getMsg()); } - msg.setAppId(mqStaticConfig.getAppId()); - msg.setRequestUrl(mqStaticConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode())); - msg.setToken(mqStaticConfig.getToken()); + msg.setAppId(mqConfig.getAppId()); + msg.setRequestUrl(mqConfig.getHost().concat(MqMethodPathEnum.SEND_MSG.getCode())); + msg.setToken(mqConfig.getToken()); try { Result result = HttpClientManager.getInstance().sendPostByHttps(msg.getRequestUrl(), JSON.toJSONString(msg)); log.debug("sendMsg result:{}", JSON.toJSONString(result)); @@ -66,4 +73,42 @@ public class SendMqMsgUtils { } + /** + * desc:发送mq消息 + * + * @return + */ + public static Result> getEventClassList() { + if (mqConfig == null) { + mqConfig = SpringContextUtils.getBean(MqConfig.class); + } + Map param = new HashMap<>(); + param.put("appId", mqConfig.getAppId()); + param.put("token", mqConfig.getToken()); + String requestUrl = mqConfig.getHost().concat(MqMethodPathEnum.GET_EVENT_LIST.getCode()); + + try { + Result result = HttpClientManager.getInstance().sendPostByHttps(requestUrl, JSON.toJSONString(param)); + log.debug("getEventClassList result:{}", JSON.toJSONString(result)); + if (result.success()) { + MqReturnBaseResult resultResult = JSON.parseObject(result.getData(), MqReturnBaseResult.class); + if (resultResult.getErrCode().equals(NumConstant.ZERO)) { + List eventClassDto = JSON.parseArray(resultResult.getData(), EventClassDto.class); + return new Result>().ok(eventClassDto); + } else { + log.error("sendMsg fail,resultData:{}", JSON.toJSONString(resultResult)); + return new Result>().error(EpmetErrorCode.SERVER_ERROR.getCode(), resultResult.getErrMsg()); + } + } + Result> resultResult = new Result<>(); + resultResult.error(result.getCode(), result.getMsg()); + resultResult.setInternalMsg(result.getInternalMsg()); + return resultResult; + } catch (Exception e) { + log.debug("sendMsg exception", e); + return new Result>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + } + } + + } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java index 5fb6ca00bd..4c3212b878 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/EventController.java @@ -17,19 +17,17 @@ package com.epmet.controller; -import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.config.MqConfig; -import com.epmet.commons.tools.enums.MqMethodPathEnum; -import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SendMqMsgUtils; 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.dto.form.EventFormDTO; import com.epmet.dto.result.EventDTO; import com.epmet.service.EventService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -42,6 +40,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-07-16 */ +@Slf4j @RestController @RequestMapping("event") public class EventController { @@ -57,14 +56,8 @@ public class EventController { return new Result>().ok(page); } @GetMapping("geteventclass") - public Result getEventClass(@RequestParam Map params){ - params.put("token", mqConfig.getToken()); - params.put("appId", mqConfig.getAppId()); - Result result = HttpClientManager.getInstance().sendPostByHttps(mqConfig.getHost().concat(MqMethodPathEnum.GET_EVENT_LIST.getCode()), JSON.toJSONString(params)); - if (result.success()){ - return new Result<>().ok(JSON.parseArray(result.getData())); - } - return new Result<>().error(EpmetErrorCode.SERVER_ERROR.getMsg()); + public Result getEventClass(){ + return SendMqMsgUtils.getEventClassList(); } /** From ac5f4ec2e9eab4a93b86aaa349d95cfa7f6b18db Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Sat, 25 Jul 2020 10:28:55 +0800 Subject: [PATCH 097/157] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/EpmetUserFeignClient.java | 49 ------------------- .../EpmetUserFeignClientFallBack.java | 33 ------------- .../service/impl/ActLiveRecServiceImpl.java | 8 ++- .../impl/VolunteerInfoServiceImpl.java | 19 +++---- .../epmet/feign/EpmetUserOpenFeignClient.java | 11 +++++ .../EpmetUserOpenFeignClientFallback.java | 5 ++ 6 files changed, 25 insertions(+), 100 deletions(-) delete mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java delete mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java deleted file mode 100644 index 55455d5122..0000000000 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetUserFeignClient.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.epmet.feign; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.UserRoleFormDTO; -import com.epmet.dto.form.WxUserInfoFormDTO; -import com.epmet.dto.result.UserBaseInfoResultDTO; -import com.epmet.dto.result.UserRoleResultDTO; -import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; -import org.springframework.cloud.openfeign.FeignClient; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; - -import java.util.List; - - -/** - * 用户模块 - * - * @author zhangyong - * @date 2020/7/22 14:51 - */ -@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class) -public interface EpmetUserFeignClient { - - /** - * @param userIds - * @return com.epmet.commons.tools.utils.Result> - * @author zhangyong - * @description 传入用户id集合,返回用户的基本信息(包含微信基本信息) - * @Date 2020/7/22 9:30 - **/ - @PostMapping("epmetuser/userbaseinfo/queryuserbaseinfo") - Result> heartQueryUserBaseInfo(@RequestBody List userIds); - - /** - * 同步-居民基础信息、用户微信信息 - * - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @Author zhangyong - * @Date 14:37 2020-07-23 - **/ - @PostMapping("epmetuser/user/updateUserBaseAndWxUserInfo") - Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO formDTO); -} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java deleted file mode 100644 index 37beeef602..0000000000 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetUserFeignClientFallBack.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.epmet.feign.fallback; - -import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ModuleUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.form.WxUserInfoFormDTO; -import com.epmet.dto.result.UserBaseInfoResultDTO; -import com.epmet.dto.result.UserRoleResultDTO; -import com.epmet.feign.EpmetUserFeignClient; -import org.springframework.stereotype.Component; - -import java.util.List; - - -/** - * @author zhangyong - * @date 2020/7/22 14:51 - */ -@Component -public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { - - @Override - public Result> heartQueryUserBaseInfo(List userIds) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "heartQueryUserBaseInfo", userIds); - } - - - @Override - public Result updateUserBaseAndWxUserInfo(WxUserInfoFormDTO formDTO) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateUserBaseAndWxUserInfo", formDTO); - } -} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java index 79d8a52dbe..45e15e53e6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java @@ -20,7 +20,6 @@ package com.epmet.service.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.security.dto.TokenDto; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.ActLivePicDao; import com.epmet.dao.ActLiveRecDao; @@ -31,8 +30,7 @@ import com.epmet.dto.result.UserBaseInfoResultDTO; import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLivePicEntity; import com.epmet.entity.ActLiveRecEntity; -import com.epmet.entity.ActSignInRecEntity; -import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.ActLiveRecRedis; import com.epmet.service.ActLiveRecService; import com.epmet.utils.ValidityVerification; @@ -55,7 +53,7 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl> userWxInfos = epmetUserFeignClient.heartQueryUserBaseInfo(userIds); + Result> userWxInfos = epmetUserOpenFeignClient.queryUserBaseInfo(userIds); // 根据活动实况id,查询对应实况的图片集合 List actLiveImg = baseDao.selectListActLiveImg(liveIds); // 数据汇总 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index 84e78622c8..3429acbb2f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -17,34 +17,24 @@ 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.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dao.VolunteerInfoDao; import com.epmet.dto.HeartUserInfoDTO; -import com.epmet.dto.VolunteerInfoDTO; import com.epmet.dto.form.WxUserInfoFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; import com.epmet.entity.VolunteerInfoEntity; -import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.VolunteerInfoRedis; import com.epmet.service.HeartUserInfoService; import com.epmet.service.VolunteerInfoService; -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.Arrays; -import java.util.List; -import java.util.Map; - /** * 志愿者信息 * @@ -58,7 +48,7 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl> getUserRoleInfoByUserId(@PathVariable("userId") String userId); + + /** + * 同步-居民基础信息、用户微信信息 + * + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @Author zhangyong + * @Date 14:37 2020-07-23 + **/ + @PostMapping("epmetuser/user/updateUserBaseAndWxUserInfo") + Result updateUserBaseAndWxUserInfo(@RequestBody WxUserInfoFormDTO formDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 1eafedfbd2..4bf31e518b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -103,4 +103,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> getUserRoleInfoByUserId(String userId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getUserRoleInfoByUserId", userId); } + + @Override + public Result updateUserBaseAndWxUserInfo(WxUserInfoFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "updateUserBaseAndWxUserInfo", formDTO); + } } From ba87e8f8ced6415daf971bf472cf6db9fd64b6c7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 26 Jul 2020 19:29:38 +0800 Subject: [PATCH 098/157] =?UTF-8?q?heart-work:=E7=A7=AF=E5=88=86=E5=8F=91?= =?UTF-8?q?=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 4 + .../com/epmet/dto/ActOperationRecDTO.java | 9 +- .../epmet/dto/form/work/CancelActFormDTO.java | 32 ++ .../dto/form/work/DraftActInfoFormDTO.java | 4 - .../dto/result/work/ActPreviewResultDTO.java | 4 +- .../work/CanceledActDetailResultDTO.java | 119 +++++ .../dto/result/work/DeniedUserResultDTO.java | 57 +++ .../result/work/ObtainedUserResultDTO.java | 51 ++ .../epmet/constant/ActMessageConstant.java | 10 + .../controller/GrantPointsController.java | 47 ++ .../epmet/controller/WorkActController.java | 67 ++- .../controller/WorkActDraftController.java | 39 +- .../java/com/epmet/dao/ActContentDao.java | 13 +- .../main/java/com/epmet/dao/ActInfoDao.java | 9 + .../com/epmet/dao/ActUserRelationDao.java | 20 + .../com/epmet/dao/LatestActContentDao.java | 9 + .../epmet/entity/ActOperationRecEntity.java | 6 +- .../com/epmet/service/GrantPointsService.java | 23 + .../epmet/service/WorkActDraftService.java | 23 +- .../com/epmet/service/WorkActService.java | 43 +- .../service/impl/GrantPointsServiceImpl.java | 67 +++ .../impl/LatestActContentServiceImpl.java | 2 +- .../service/impl/WorkActDraftServiceImpl.java | 316 +------------ .../service/impl/WorkActServiceImpl.java | 442 +++++++++++++++++- .../service/impl/WorkActUserServiceImpl.java | 8 + .../main/resources/mapper/ActContentDao.xml | 13 +- .../src/main/resources/mapper/ActInfoDao.xml | 26 ++ .../resources/mapper/ActUserRelationDao.xml | 39 ++ .../resources/mapper/LatestActContentDao.xml | 5 + 29 files changed, 1105 insertions(+), 402 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index b977a2e76f..1c4adc9bf3 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -54,6 +54,10 @@ public enum EpmetErrorCode { ACT_CONTENT_TEXT_SCAN_FAILED(8116,"活动详情内容审核失败,请重新编辑"), ACT_CONTENT_IMG_SCAN_FAILED(8117,"活动详情图片失败,请重新编辑"), ACT_COVER_PIC_SCAN_FAILED(8118,"活动封面图片审核失败,请重新编辑"), + ACT_START_TIME_ERROR(8119,"活动预计开始时间应早于活动预计结束时间"), + ACT_SIGN_IN_START_TIME_ERROR(8120,"签到开始时间应早于签到结束时间"), + ACT_SIGN_UP_END_TIME_ERROR(8121,"活动报名截止时间应早于活动预计开始时间"), + CANNOT_AUDIT_WARM(8201, "请完善居民信息"), NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java index 00b8294271..955997a340 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActOperationRecDTO.java @@ -53,9 +53,14 @@ public class ActOperationRecDTO implements Serializable { private String type; /** - * 1通知用户0不通知 + * 1通知用户0不通知,取消活动时默认true */ - private Boolean noticeUser; + private Boolean noticeUser; + + /** + * 备注,取消活动时此列有值 + */ + private String remark; /** * 删除标记 diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java new file mode 100644 index 0000000000..1ae524df14 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/CancelActFormDTO.java @@ -0,0 +1,32 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 17:23 + */ +@Data +public class CancelActFormDTO implements Serializable { + private static final long serialVersionUID = -5297836691628421645L; + public interface AddUserInternalGroup {} + public interface UserShowGroup extends CustomerClientShowGroup { + } + /** + * 活动id + */ + @NotBlank(message = "活动id不能为空", groups = {AddUserInternalGroup.class }) + private String actId; + + /** + * 取消原因 + */ + @NotBlank(message = "取消原因不能为空", groups = {UserShowGroup.class}) + private String cancelReason; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java index 55cd75a090..1d128594ff 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/DraftActInfoFormDTO.java @@ -1,6 +1,5 @@ package com.epmet.dto.form.work; -import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import lombok.Data; import javax.validation.Valid; @@ -22,9 +21,6 @@ public class DraftActInfoFormDTO implements Serializable { public interface AddUserInternalGroup { } - public interface AddDraftUserShowGroup extends CustomerClientShowGroup { - } - @Valid private List actContent; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java index f5869bdb87..eb6f07693c 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ActPreviewResultDTO.java @@ -43,13 +43,13 @@ public class ActPreviewResultDTO implements Serializable { private Integer reward; /** - * 活动开始时间yyyy-MM-dd HH:mm + * 活动预计开始时间yyyy-MM-dd HH:mm */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date actStartTime; /** - * 活动结束时间yyyy-MM-dd HH:mm + * 活动预计结束时间yyyy-MM-dd HH:mm */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date actEndTime; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java new file mode 100644 index 0000000000..a361a5511e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java @@ -0,0 +1,119 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 已取消-活动详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 18:02 + */ +@Data +public class CanceledActDetailResultDTO implements Serializable { + private static final long serialVersionUID = 4438884084461494174L; + + /** + *活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 报名截止时间:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + + /** + * 活动开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * true:固定名额 false: 不限制名额 + */ + private Boolean actQuotaCategory; + + /** + * 联系人 + */ + private String sponsorContacts; + + /** + * 联系电话 + */ + private String sponsorTel; + /** + * 活动积分 + */ + private Integer reward; + /** + * 主办方名称 + */ + private String sponsorName; + /** + * 报名条件 + */ + private String requirement; + /** + * 取消时间yyyy-MM-dd HH:mm:ss + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date cancelTime; + /** + * 取消理由 + */ + private String cancelReason; + /** + * 活动详情 + */ + private List actContent; + + @Override + public String toString() { + return "CanceledActDetailResultDTO{" + + "actId='" + actId + '\'' + + ", title='" + title + '\'' + + ", signUpEndTime=" + signUpEndTime + + ", actStartTime=" + actStartTime + + ", actEndTime=" + actEndTime + + ", actAddress='" + actAddress + '\'' + + ", actQuota=" + actQuota + + ", actQuotaCategory=" + actQuotaCategory + + ", sponsorContacts='" + sponsorContacts + '\'' + + ", sponsorTel='" + sponsorTel + '\'' + + ", reward=" + reward + + ", sponsorName='" + sponsorName + '\'' + + ", requirement='" + requirement + '\'' + + ", cancelTime=" + cancelTime + + ", cancelReason='" + cancelReason + '\'' + + ", actContent=" + actContent + + '}'; + } +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java new file mode 100644 index 0000000000..c7ca1833bb --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/DeniedUserResultDTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 积分发放-已拒绝列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 19:01 + */ +@Data +public class DeniedUserResultDTO implements Serializable { + private static final long serialVersionUID = 110993452055116412L; + + /** + * 给分或者不给分,重新处理入参用 + */ + private String actUserRelationId; + + /** + * 用户id + */ + private String userId; + + /** + * 活动id + */ + private String actId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true:是志愿者 false:不是志愿者 + */ + private Boolean volunteerFlag; + + /** + * 拒绝原因 + */ + private String denyRewardReason; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java new file mode 100644 index 0000000000..05cf6e2674 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ObtainedUserResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.result.work; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 积分发放-已发放列表 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 18:43 + */ +@Data +public class ObtainedUserResultDTO implements Serializable { + private static final long serialVersionUID = 8187248601958392521L; + /** + * 给分或者不给分,重新处理入参用 + */ + private String actUserRelationId; + + /** + * 用户id + */ + private String userId; + + /** + * 活动id + */ + private String actId; + + /** + * 姓名 + */ + private String realName; + + /** + * 昵称 + */ + private String nickName; + + /** + * 头像 + */ + private String headImgUrl; + + /** + * true:是志愿者 false:不是志愿者 + */ + private Boolean volunteerFlag; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java index be7530973c..b7bf8cce40 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java @@ -8,6 +8,16 @@ package com.epmet.constant; */ public interface ActMessageConstant { String TITLE="您有一条活动消息"; + /** + * 报名审核成功,给居民端用户发送消息 + */ String AUDIT_PASSED="您报名的活动%s,已审核通过"; + /** + * 拒绝用户的报名,给居民端用户发送消息 + */ String AUDIT_REFUSED="您报名的活动%s,审核未通过,原因:%s"; + /** + * 活动被取消,给已经通过审核的居民端用户,发送消息 + */ + String ACT_CANCELED="您报名的活动%s,已取消,原因:%s"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java index 86e935c2a3..72f402337a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/GrantPointsController.java @@ -4,14 +4,20 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.form.work.ActIdFormDTO; import com.epmet.dto.form.work.GrantPointsFormDTO; +import com.epmet.dto.result.work.CanceledUserResultDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; import com.epmet.dto.result.work.PendingUserResultDTO; import com.epmet.service.GrantPointsService; +import com.epmet.service.WorkActUserService; 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 * @@ -23,6 +29,8 @@ import org.springframework.web.bind.annotation.RestController; public class GrantPointsController { @Autowired private GrantPointsService grantPointsService; + @Autowired + private WorkActUserService workActUserService ; /** * @return com.epmet.commons.tools.utils.Result @@ -78,4 +86,43 @@ public class GrantPointsController { grantPointsService.reset(formDTO); return new Result(); } + + /** + * @param actIdFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:46 + **/ + @PostMapping("agreedlist") + public Result> agreedList(@RequestBody ActIdFormDTO actIdFormDTO) { + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(grantPointsService.agreedList(actIdFormDTO)); + } + + /** + * @return com.epmet.commons.tools.utils.Result> + * @param actIdFormDTO + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:02 + **/ + @PostMapping("deniedlist") + public Result> deniedList(@RequestBody ActIdFormDTO actIdFormDTO){ + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(grantPointsService.deniedList(actIdFormDTO)); + } + + /** + * @param actIdFormDTO + * @return com.epmet.commons.tools.utils.Result> + * @author yinzuomei + * @description 积分发放-已取消报名列表 + * @Date 2020/7/26 19:19 + **/ + @PostMapping("canceleduserlist") + public Result> canceledUserList(@RequestBody ActIdFormDTO actIdFormDTO) { + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result>().ok(workActUserService.queryCanceledUserList(actIdFormDTO)); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index 2e14ec9aac..aca1f4aee4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -2,11 +2,8 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; -import com.epmet.dto.form.work.ActListCommonFormDTO; -import com.epmet.dto.result.work.CanceledActResultDTO; -import com.epmet.dto.result.work.FinishedActResultDTO; -import com.epmet.dto.result.work.InProgressActResultDTO; -import com.epmet.dto.result.work.SponsorResultDTO; +import com.epmet.dto.form.work.*; +import com.epmet.dto.result.work.*; import com.epmet.service.WorkActService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; @@ -28,6 +25,19 @@ public class WorkActController { @Autowired private WorkActService workActService; + /** + * @return com.epmet.commons.tools.utils.Result + * @param + * @author yinzuomei + * @description 发布活动-删除历史活动草稿 + * @Date 2020/7/20 18:15 + **/ + @PostMapping("deletedraft") + public Result deleteDraft(){ + workActService.deleteDraft(); + return new Result(); + } + /** * @return com.epmet.commons.tools.utils.Result * @param @@ -40,6 +50,26 @@ public class WorkActController { return new Result().ok(workActService.querySponsorList()); } + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 发布活动 + * @Date 2020/7/21 18:32 + **/ + @PostMapping("publish") + public Result publishAct(@RequestBody PublishActInfoFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); + for (PublishActContentFormDTO actContentFormDTO : formDTO.getActContent()) { + ValidatorUtils.validateEntity(actContentFormDTO, + PublishActContentFormDTO.UserShowGroup.class, + PublishActContentFormDTO.UserInternalGroup.class + ); + } + PublishActResultDTO resultDTO = workActService.publishAct(formDTO); + return new Result().ok(resultDTO); + } + /** * @return com.epmet.commons.tools.utils.Result * @param formDTO @@ -78,4 +108,31 @@ public class WorkActController { ValidatorUtils.validateEntity(formDTO,ActListCommonFormDTO.AddUserInternalGroup.class); return new Result>().ok(workActService.queryFinishedList(formDTO)); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 取消活动 + * @Date 2020/7/26 17:26 + **/ + @PostMapping("cancelact") + public Result cancelAct(@RequestBody CancelActFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,CancelActFormDTO.UserShowGroup.class,CancelActFormDTO.AddUserInternalGroup.class); + workActService.cancelAct(formDTO); + return new Result(); + } + + /** + * @param actIdFormDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 已取消-活动详情 + * @Date 2020/7/26 18:00 + **/ + @PostMapping("canceleddetail") + public Result canceledDetail(@RequestBody ActIdFormDTO actIdFormDTO) { + ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActService.canceledDetail(actIdFormDTO.getActId())); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java index f69b65b065..e960a2f926 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActDraftController.java @@ -37,19 +37,6 @@ public class WorkActDraftController { return new Result().ok(initResultDTO); } - /** - * @return com.epmet.commons.tools.utils.Result - * @param - * @author yinzuomei - * @description 发布活动-删除历史活动草稿 - * @Date 2020/7/20 18:15 - **/ - @PostMapping("deletedraft") - public Result deleteDraft(){ - workActDraftService.deleteDraft(); - return new Result(); - } - /** * @return com.epmet.commons.tools.utils.Result * @param @@ -72,9 +59,8 @@ public class WorkActDraftController { **/ @PostMapping("saveact") public Result saveAct(@RequestBody DraftActInfoFormDTO formDTO){ - //起码活动标题不能为空 - ValidatorUtils.validateEntity(formDTO, DraftActInfoFormDTO.AddDraftUserShowGroup.class, - DraftActInfoFormDTO.AddUserInternalGroup.class); + //起码客户id不能为空 + ValidatorUtils.validateEntity(formDTO,DraftActInfoFormDTO.AddUserInternalGroup.class); //如果录入了活动内容,需要校验 content、contentType if (null != formDTO.getActContent() && formDTO.getActContent().size() > 0) { for(DraftActContentFormDTO actContentFormDTO:formDTO.getActContent()){ @@ -102,25 +88,4 @@ public class WorkActDraftController { return new Result().ok(resultDTO); } - /** - * @param formDTO - * @return com.epmet.commons.tools.utils.Result - * @author yinzuomei - * @description 发布活动 - * @Date 2020/7/21 18:32 - **/ - @PostMapping("publish") - public Result publishAct(@RequestBody PublishActInfoFormDTO formDTO) { - ValidatorUtils.validateEntity(formDTO, PublishActInfoFormDTO.AddUserShowGroup.class, PublishActInfoFormDTO.AddUserInternalGroup.class); - for (PublishActContentFormDTO actContentFormDTO : formDTO.getActContent()) { - ValidatorUtils.validateEntity(actContentFormDTO, - PublishActContentFormDTO.UserShowGroup.class, - PublishActContentFormDTO.UserInternalGroup.class - ); - } - PublishActResultDTO resultDTO = workActDraftService.publishAct(formDTO); - return new Result().ok(resultDTO); - } - - } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java index 2d7ef0de25..c125c2d9f4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java @@ -18,9 +18,12 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.work.ActPreviewContentResultDTO; import com.epmet.entity.ActContentEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 活动内容 * @@ -29,5 +32,13 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface ActContentDao extends BaseDao { - + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 根据活动id查询活动详情 + * @Date 2020/7/26 18:26 + **/ + List selectByActId(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index 86bbf2afde..4766a2823c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java @@ -270,4 +270,13 @@ public interface ActInfoDao extends BaseDao { * @Date 2020/7/24 10:55 **/ List queryCanceledUserList(String actId); + + /** + * @return com.epmet.dto.result.work.CanceledActDetailResultDTO + * @param actId + * @author yinzuomei + * @description 工作端-查询已取消活动详情 + * @Date 2020/7/26 18:29 + **/ + CanceledActDetailResultDTO selectCanceledActInfo(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index bb6598d312..526ca76a1f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -19,6 +19,8 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; import com.epmet.dto.result.work.UserHistoricalActInfoDTO; import com.epmet.entity.ActUserRelationEntity; import org.apache.ibatis.annotations.Mapper; @@ -136,4 +138,22 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/24 13:02 **/ List selectInProgressUserIds(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:48 + **/ + List selectAgreedList(String actId); + + /** + * @return java.util.List + * @param actId + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:11 + **/ + List selectDeniedList(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java index a0cbb2b6e5..acf7fe8557 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActContentDao.java @@ -60,4 +60,13 @@ public interface LatestActContentDao extends BaseDao { * @Date 2020/7/21 18:07 **/ List previewActContent(String actId); + + /** + * @return int + * @param actId + * @author yinzuomei + * @description 根据活动id删除活动详情 物理删除 + * @Date 2020/7/24 16:08 + **/ + int deleteByActId(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java index aef5e68fe0..5a54f8f5c5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActOperationRecEntity.java @@ -49,8 +49,12 @@ public class ActOperationRecEntity extends BaseEpmetEntity { private String type; /** - * 1通知用户0不通知 + * 1通知用户0不通知,取消活动时默认true */ private Boolean noticeUser; + /** + * 备注,取消活动时此列有值 + */ + private String remark; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java index 92d306ac92..e8d53e3b44 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/GrantPointsService.java @@ -1,8 +1,13 @@ package com.epmet.service; +import com.epmet.dto.form.work.ActIdFormDTO; import com.epmet.dto.form.work.GrantPointsFormDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; import com.epmet.dto.result.work.PendingUserResultDTO; +import java.util.List; + /** * 描述一下 * @@ -45,4 +50,22 @@ public interface GrantPointsService { * @Date 2020/7/24 15:16 **/ void reset(GrantPointsFormDTO formDTO); + + /** + * @return java.util.List + * @param actIdFormDTO + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:47 + **/ + List agreedList(ActIdFormDTO actIdFormDTO); + + /** + * @return java.util.List + * @param actIdFormDTO + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:02 + **/ + List deniedList(ActIdFormDTO actIdFormDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java index e08b1671e4..cc0683b91c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActDraftService.java @@ -2,8 +2,10 @@ package com.epmet.service; import com.epmet.dto.form.work.ActPreviewFormDTO; import com.epmet.dto.form.work.DraftActInfoFormDTO; -import com.epmet.dto.form.work.PublishActInfoFormDTO; -import com.epmet.dto.result.work.*; +import com.epmet.dto.result.work.ActPreviewResultDTO; +import com.epmet.dto.result.work.LatestDraftActInfoResultDTO; +import com.epmet.dto.result.work.PublishActInitResultDTO; +import com.epmet.dto.result.work.SaveActDraftResultDTO; /** * 工作端活动草稿 @@ -22,15 +24,6 @@ public interface WorkActDraftService { **/ PublishActInitResultDTO publishActInit(); - /** - * @return void - * @param - * @author yinzuomei - * @description 发布活动-删除历史活动草稿 - * @Date 2020/7/20 18:15 - **/ - void deleteDraft(); - /** * @return com.epmet.dto.result.work.LatestDraftActInfoResultDTO * @param @@ -58,12 +51,4 @@ public interface WorkActDraftService { **/ ActPreviewResultDTO previewActDetail(ActPreviewFormDTO formDTO); - /** - * @return com.epmet.dto.result.work.PublishActResultDTO - * @param formDTO - * @author yinzuomei - * @description 发布活动 - * @Date 2020/7/21 18:33 - **/ - PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index 3945c19213..b4e83a2aa1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -1,10 +1,9 @@ package com.epmet.service; import com.epmet.dto.form.work.ActListCommonFormDTO; -import com.epmet.dto.result.work.CanceledActResultDTO; -import com.epmet.dto.result.work.FinishedActResultDTO; -import com.epmet.dto.result.work.InProgressActResultDTO; -import com.epmet.dto.result.work.SponsorResultDTO; +import com.epmet.dto.form.work.CancelActFormDTO; +import com.epmet.dto.form.work.PublishActInfoFormDTO; +import com.epmet.dto.result.work.*; import java.util.List; @@ -15,6 +14,15 @@ import java.util.List; * @date 2020/7/23 20:36 */ public interface WorkActService { + /** + * @return void + * @param + * @author yinzuomei + * @description 发布活动-删除历史活动草稿 + * @Date 2020/7/20 18:15 + **/ + void deleteDraft(); + /** * @return com.epmet.dto.result.work.SponsorResultDTO * @param @@ -24,6 +32,15 @@ public interface WorkActService { **/ SponsorResultDTO querySponsorList(); + /** + * @return com.epmet.dto.result.work.PublishActResultDTO + * @param formDTO + * @author yinzuomei + * @description 发布活动 + * @Date 2020/7/21 18:33 + **/ + PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO); + /** * @return com.epmet.dto.result.work.InProgressActResultDTO * @param formDTO @@ -50,4 +67,22 @@ public interface WorkActService { * @Date 2020/7/23 23:21 **/ List queryFinishedList(ActListCommonFormDTO formDTO); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 取消活动 + * @Date 2020/7/26 17:26 + **/ + void cancelAct(CancelActFormDTO formDTO); + + /** + * @return void + * @param actId + * @author yinzuomei + * @description 已取消-活动详情 + * @Date 2020/7/26 18:00 + **/ + CanceledActDetailResultDTO canceledDetail(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java index 7374577050..024b325ff9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java @@ -9,8 +9,11 @@ import com.epmet.dao.ActUserRelationDao; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.ActPointLogDTO; import com.epmet.dto.ActUserRelationDTO; +import com.epmet.dto.form.work.ActIdFormDTO; import com.epmet.dto.form.work.GrantPointsFormDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; +import com.epmet.dto.result.work.DeniedUserResultDTO; +import com.epmet.dto.result.work.ObtainedUserResultDTO; import com.epmet.dto.result.work.PendingUserResultDTO; import com.epmet.dto.result.work.UserBaseInfo; import com.epmet.service.*; @@ -233,4 +236,68 @@ public class GrantPointsServiceImpl implements GrantPointsService { actPointLogDTO.setEffectFlag(false); actPointLogService.save(actPointLogDTO); } + + /** + * @param actIdFormDTO + * @return java.util.List + * @author yinzuomei + * @description 积分发放-已发放列表 + * @Date 2020/7/26 18:47 + **/ + @Override + public List agreedList(ActIdFormDTO actIdFormDTO) { + List list = actUserRelationDao.selectAgreedList(actIdFormDTO.getActId()); + if (null == list || list.size() < 0) { + return new ArrayList<>(); + } + List userIdList = new ArrayList<>(); + for (ObtainedUserResultDTO obtainedUserResultDTO : list) { + obtainedUserResultDTO.setVolunteerFlag(workActUserService.getVolunteerFlag(obtainedUserResultDTO.getUserId())); + userIdList.add(obtainedUserResultDTO.getUserId()); + } + List userBaseInfoResultDTOList = workActUserService.queryUserBaseInfoList(userIdList); + for (ObtainedUserResultDTO obtainedUser : list) { + for (UserBaseInfoResultDTO userBaseInfoResultDTO : userBaseInfoResultDTOList) { + if (obtainedUser.getUserId().equals(userBaseInfoResultDTO.getUserId())) { + obtainedUser.setRealName(userBaseInfoResultDTO.getRealName()); + obtainedUser.setNickName(userBaseInfoResultDTO.getNickname()); + obtainedUser.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + break; + } + } + } + return list; + } + + /** + * @param actIdFormDTO + * @return java.util.List + * @author yinzuomei + * @description 积分发放-已拒绝列表 + * @Date 2020/7/26 19:02 + **/ + @Override + public List deniedList(ActIdFormDTO actIdFormDTO) { + List list = actUserRelationDao.selectDeniedList(actIdFormDTO.getActId()); + if (null == list || list.size() < 0) { + return new ArrayList<>(); + } + List userIdList = new ArrayList<>(); + for (DeniedUserResultDTO deniedUserResultDTO : list) { + deniedUserResultDTO.setVolunteerFlag(workActUserService.getVolunteerFlag(deniedUserResultDTO.getUserId())); + userIdList.add(deniedUserResultDTO.getUserId()); + } + List userBaseInfoResultDTOList = workActUserService.queryUserBaseInfoList(userIdList); + for (DeniedUserResultDTO deniedUser : list) { + for (UserBaseInfoResultDTO userBaseInfoResultDTO : userBaseInfoResultDTOList) { + if (deniedUser.getUserId().equals(userBaseInfoResultDTO.getUserId())) { + deniedUser.setRealName(userBaseInfoResultDTO.getRealName()); + deniedUser.setNickName(userBaseInfoResultDTO.getNickname()); + deniedUser.setHeadImgUrl(userBaseInfoResultDTO.getHeadImgUrl()); + break; + } + } + } + return list; + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java index e60c7d539e..38930a1467 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java @@ -93,7 +93,7 @@ public class LatestActContentServiceImpl extends BaseServiceImpl dtoList) { //先删除之前的 - this.deleteByActId(dtoList.get(0).getActId()); + baseDao.deleteByActId(dtoList.get(0).getActId()); //再插入新的 for(LatestActContentDTO dto:dtoList){ LatestActContentEntity entity = ConvertUtils.sourceToTarget(dto, LatestActContentEntity.class); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java index 1c75dfdb57..a1b008430e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActDraftServiceImpl.java @@ -1,31 +1,13 @@ package com.epmet.service.impl; -import com.alibaba.fastjson.JSON; -import com.epmet.commons.tools.exception.EpmetErrorCode; -import com.epmet.commons.tools.exception.RenException; -import com.epmet.commons.tools.scan.param.ImgScanParamDTO; -import com.epmet.commons.tools.scan.param.ImgTaskDTO; -import com.epmet.commons.tools.scan.param.TextScanParamDTO; -import com.epmet.commons.tools.scan.param.TextTaskDTO; -import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.security.user.LoginUserUtil; -import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.ScanContentUtils; -import com.epmet.constant.ActConstant; -import com.epmet.dao.ActContentDao; -import com.epmet.dao.ActInfoDao; -import com.epmet.dao.ActOperationRecDao; -import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.LatestActContentDTO; import com.epmet.dto.LatestActInfoDTO; -import com.epmet.dto.form.work.*; +import com.epmet.dto.form.work.ActPreviewFormDTO; +import com.epmet.dto.form.work.DraftActContentFormDTO; +import com.epmet.dto.form.work.DraftActInfoFormDTO; import com.epmet.dto.result.work.*; -import com.epmet.entity.ActContentEntity; -import com.epmet.entity.ActInfoEntity; -import com.epmet.entity.ActOperationRecEntity; -import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.LatestActContentService; import com.epmet.service.LatestActInfoService; import com.epmet.service.WorkActDraftService; @@ -33,14 +15,11 @@ import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.Date; import java.util.List; -import java.util.UUID; /** * 工作端活动草稿 @@ -57,20 +36,6 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { private LatestActInfoService latestActInfoService; @Autowired private LatestActContentService latestActContentService; - @Value("${openapi.scan.server.url}") - private String scanApiUrl; - @Value("${openapi.scan.method.textSyncScan}") - private String textSyncScanMethod; - @Value("${openapi.scan.method.imgSyncScan}") - private String imgSyncScanMethod; - @Autowired - private ActInfoDao actInfoDao; - @Autowired - private ActContentDao actContentDao; - @Autowired - private ActOperationRecDao actOperationRecDao; - @Autowired - private GovOrgOpenFeignClient govOrgOpenFeignClient; /** * @return com.epmet.dto.form.work.PublishActInitResultDTO @@ -96,19 +61,6 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { return resultDTO; } - /** - * @return void - * @author yinzuomei - * @description 发布活动-删除历史活动草稿 - * @Date 2020/7/20 18:15 - **/ - @Override - public void deleteDraft() { - String currentUserId=loginUserUtil.getLoginUserId(); - if(StringUtils.isNotBlank(currentUserId)){ - latestActInfoService.deleteAllDraft(currentUserId); - } - } /** * @return com.epmet.dto.result.work.LatestDraftActInfoResultDTO @@ -148,7 +100,7 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { if(null!=formDTO.getActContent()&&formDTO.getActContent().size()>0){ //保存活动内容 List actContentList=this.constructLatestActContent(formDTO.getActContent(),actDraftId); - //删除之前的内容 + //删除之前的内容,保存本次的修改 物理删除 latestActContentService.saveLatestActContentDTOList(actContentList); } SaveActDraftResultDTO resultDTO=new SaveActDraftResultDTO(); @@ -175,266 +127,6 @@ public class WorkActDraftServiceImpl implements WorkActDraftService { return actPreviewResultDTO; } - /** - * @param formDTO - * @return com.epmet.dto.result.work.PublishActResultDTO - * @author yinzuomei - * @description 发布活动 - * @Date 2020/7/21 18:33 - **/ - @Override - @Transactional(rollbackFor = Exception.class) - public PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO) { - PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); - //内容审核(活动标题、招募要求、活动内容图文) - this.auditAct(formDTO); - logger.info("发布活动,审核成功"); - - //构造属性保存活动属性,活动内容 - ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); - actInfoDao.insert(actInfoEntity); - - List actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId()); - for(ActContentEntity actContentEntity:actContentEntityList){ - actContentDao.insert(actContentEntity); - } - //插入一条操作日志 - ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); - actOperationRecEntity.setActId(actInfoEntity.getId()); - actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_PUBLISH); - actOperationRecEntity.setNoticeUser(false); - actOperationRecDao.insert(actOperationRecEntity); - - //删除所有的草稿 - this.deleteDraft(); - publishActResultDTO.setActId(actInfoEntity.getId()); - - return publishActResultDTO; - } - - /** - * @return com.epmet.entity.ActInfoEntity - * @param formDTO - * @author yinzuomei - * @description 发布活动-构造act_info - * @Date 2020/7/21 20:00 - **/ - private ActInfoEntity constructActInfo(PublishActInfoFormDTO formDTO) { - ActInfoEntity actInfoEntity = ConvertUtils.sourceToTarget(formDTO, ActInfoEntity.class); - //活动名额类型(0-不限名额,1-固定名额) - if(actInfoEntity.getActQuota()==0){ - actInfoEntity.setActQuotaCategory(false); - }else{ - actInfoEntity.setActQuotaCategory(true); - } - actInfoEntity.setSignUpStartTime(new Date()); - actInfoEntity.setActStatus(ActConstant.ACT_STATUS_PUBLISHED); - - //1已经总结0未总结 - actInfoEntity.setSummaryFlag(false); - if(ActConstant.SPONSOR_AGENCY.equals(actInfoEntity.getSponsorType())){ - //调用gov_org服务获取当前组织的上一级机关id TODO - Result result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId()); - if(result.success()&&null!=result.getData()){ - actInfoEntity.setPid(result.getData().getPid()); - }else{ - logger.warn("根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); - } - }else{ - actInfoEntity.setPid(""); - } - return actInfoEntity; - } - - /** - * @return java.util.List - * @param actContent - * @param actId - * @author yinzuomei - * @description 发布活动-构造活动详情act_content - * @Date 2020/7/21 19:59 - **/ - private List constructActContent(List actContent, String actId) { - List list=new ArrayList<>(); - int orderNum=1; - for(PublishActContentFormDTO actContentFormDTO:actContent){ - ActContentEntity actContentEntity=new ActContentEntity(); - actContentEntity.setActId(actId); - actContentEntity.setContent(actContentFormDTO.getContent()); - actContentEntity.setContentType(actContentFormDTO.getContentType()); - actContentEntity.setOrderNum(orderNum); - list.add(actContentEntity); - orderNum++; - } - return list; - } - - /** - * @return void - * @param formDTO - * @author yinzuomei - * @description 活动相关内容审核(活动标题、招募要求、活动内容图文) - * @Date 2020/7/21 19:20 - **/ - private void auditAct(PublishActInfoFormDTO formDTO) { - //1、活动标题 - if (StringUtils.isNotBlank(formDTO.getTitle())) { - this.auditActTitle(formDTO.getTitle()); - } - //2、活动封面 - if(StringUtils.isNotBlank(formDTO.getCoverPic())){ - this.auditActCoverPic(formDTO.getCoverPic()); - } - - //3、招募要求 - if (StringUtils.isNotBlank(formDTO.getRequirement())) { - this.auditActRequirement(formDTO.getRequirement()); - } - //4、活动内容 - if(null==formDTO.getActContent()||formDTO.getActContent().size()<1){ - return; - } - List textList=new ArrayList<>(); - List imgList=new ArrayList<>(); - for(PublishActContentFormDTO actContent:formDTO.getActContent()){ - if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(actContent.getContentType())){ - textList.add(actContent.getContent()); - }else if(ActConstant.ACT_CONTENT_TYPE_IMG.equals(actContent.getContentType())){ - imgList.add(actContent.getContent()); - } - } - this.auditActContent(textList,imgList); - } - - /** - * @return void - * @param textList - * @param imgList - * @author yinzuomei - * @description 活动详情审核 - * @Date 2020/7/21 19:21 - **/ - private void auditActContent(List textList, List imgList) { - //审核活动详情中的内容 - if(null!=textList&&textList.size()>0){ - TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); - textList.forEach(content -> { - TextTaskDTO taskDTO = new TextTaskDTO(); - taskDTO.setContent(content); - taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); - textScanParamDTO.getTasks().add(taskDTO); - }); - Result contentSyncScanRes = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); - if (!contentSyncScanRes.success()) { - logger.error("活动详情内容审核接口失败,返参:", JSON.toJSONString(contentSyncScanRes)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!contentSyncScanRes.getData().isAllPass()) { - throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); - } - } - logger.info("活动详情内容审核成功"); - } - if(null!=imgList&&imgList.size()>0){ - //审核活动详情中的图片 - ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); - imgList.forEach(url -> { - ImgTaskDTO task = new ImgTaskDTO(); - task.setDataId(UUID.randomUUID().toString().replace("-", "")); - task.setUrl(url); - imgScanParamDTO.getTasks().add(task); - }); - Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); - if (!imgScanResult.success()){ - logger.error("活动详情图片审核接口失败,返参:", JSON.toJSONString(imgScanResult)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!imgScanResult.getData().isAllPass()) { - throw new RenException(EpmetErrorCode.ACT_CONTENT_IMG_SCAN_FAILED.getCode()); - } - } - logger.info("活动详情图片审核成功"); - } - } - - /** - * @return void - * @param requirement - * @author yinzuomei - * @description 活动招募条件审核 - * @Date 2020/7/21 19:21 - **/ - private void auditActRequirement(String requirement) { - TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); - TextTaskDTO taskDTO = new TextTaskDTO(); - taskDTO.setContent(requirement); - taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); - textScanParamDTO.getTasks().add(taskDTO); - Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); - if (!textSyncScanResult.success()) { - logger.error("活动报名条件审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!textSyncScanResult.getData().isAllPass()) { - logger.error("活动报名条件审核失败,报名条件:",requirement); - throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); - } - } - logger.info("活动报名条件审核成功"); - } - - /** - * @return void - * @param coverPic - * @author yinzuomei - * @description 活动封面图片审核 - * @Date 2020/7/21 19:21 - **/ - private void auditActCoverPic(String coverPic) { - ImgScanParamDTO coverPicScanParamDTO = new ImgScanParamDTO(); - ImgTaskDTO coverImgtask = new ImgTaskDTO(); - coverImgtask.setDataId(UUID.randomUUID().toString().replace("-", "")); - coverImgtask.setUrl(coverPic); - coverPicScanParamDTO.getTasks().add(coverImgtask); - Result coverPicScanRes = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), coverPicScanParamDTO); - if (!coverPicScanRes.success()){ - logger.error("活动封面审核失败接口返回失败,返参:",JSON.toJSONString(coverPicScanRes)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!coverPicScanRes.getData().isAllPass()) { - logger.error("活动封面审核失败,封面图片地址:",coverPic); - throw new RenException(EpmetErrorCode.ACT_COVER_PIC_SCAN_FAILED.getCode()); - } - } - logger.info("活动封面审核成功"); - } - - /** - * @return void - * @param title - * @author yinzuomei - * @description 活动标题审核 - * @Date 2020/7/21 19:21 - **/ - private void auditActTitle(String title) { - TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); - TextTaskDTO taskDTO = new TextTaskDTO(); - taskDTO.setContent(title); - taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); - textScanParamDTO.getTasks().add(taskDTO); - Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); - if (!textSyncScanResult.success()) { - logger.error("活动标题审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); - throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); - } else { - if (!textSyncScanResult.getData().isAllPass()) { - logger.error("活动标题审核失败,标题内容:",title); - throw new RenException(EpmetErrorCode.ACT_TITLE_SCAN_FAILED.getCode()); - } - } - logger.info("活动标题审核通过"); - } - /** * @return java.util.List * @param actContent diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index cdeb80c3d3..257b8a810d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -1,24 +1,57 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.scan.param.ImgScanParamDTO; +import com.epmet.commons.tools.scan.param.ImgTaskDTO; +import com.epmet.commons.tools.scan.param.TextScanParamDTO; +import com.epmet.commons.tools.scan.param.TextTaskDTO; +import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.ScanContentUtils; +import com.epmet.constant.ActConstant; +import com.epmet.constant.ActMessageConstant; +import com.epmet.constant.ReadFlagConstant; +import com.epmet.dao.ActContentDao; import com.epmet.dao.ActInfoDao; +import com.epmet.dao.ActOperationRecDao; +import com.epmet.dao.ActUserRelationDao; +import com.epmet.dto.ActInfoDTO; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.work.ActListCommonFormDTO; +import com.epmet.dto.form.work.CancelActFormDTO; +import com.epmet.dto.form.work.PublishActContentFormDTO; +import com.epmet.dto.form.work.PublishActInfoFormDTO; import com.epmet.dto.result.ActSponsorResultDTO; import com.epmet.dto.result.work.*; +import com.epmet.entity.ActContentEntity; +import com.epmet.entity.ActInfoEntity; +import com.epmet.entity.ActOperationRecEntity; +import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.service.ActInfoService; +import com.epmet.service.LatestActInfoService; import com.epmet.service.WorkActService; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.text.ParseException; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.UUID; /** * 描述一下 @@ -29,12 +62,44 @@ import java.util.List; @Service public class WorkActServiceImpl implements WorkActService { private Logger logger = LogManager.getLogger(WorkActServiceImpl.class); + @Value("${openapi.scan.server.url}") + private String scanApiUrl; + @Value("${openapi.scan.method.textSyncScan}") + private String textSyncScanMethod; + @Value("${openapi.scan.method.imgSyncScan}") + private String imgSyncScanMethod; @Autowired private GovOrgOpenFeignClient govOrgOpenFeignClient; @Autowired private LoginUserUtil loginUserUtil; @Autowired private ActInfoDao actInfoDao; + @Autowired + private LatestActInfoService latestActInfoService; + @Autowired + private ActContentDao actContentDao; + @Autowired + private ActOperationRecDao actOperationRecDao; + @Autowired + private ActInfoService actInfoService; + @Autowired + private ActUserRelationDao actUserRelationDao; + @Autowired + private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + + /** + * @return void + * @author yinzuomei + * @description 发布活动-删除历史活动草稿 + * @Date 2020/7/20 18:15 + **/ + @Override + public void deleteDraft() { + String currentUserId=loginUserUtil.getLoginUserId(); + if(StringUtils.isNotBlank(currentUserId)){ + latestActInfoService.deleteAllDraft(currentUserId); + } + } /** * @return com.epmet.dto.result.work.SponsorResultDTO @@ -59,6 +124,308 @@ public class WorkActServiceImpl implements WorkActService { return null; } + /** + * @param formDTO + * @return com.epmet.dto.result.work.PublishActResultDTO + * @author yinzuomei + * @description 发布活动 + * @Date 2020/7/21 18:33 + **/ + @Override + @Transactional(rollbackFor = Exception.class) + public PublishActResultDTO publishAct(PublishActInfoFormDTO formDTO) { + //校验参数 + this.checkPublishFormDTO(formDTO); + PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); + //内容审核(活动标题、招募要求、活动内容图文) + this.auditAct(formDTO); + logger.info("发布活动,审核成功"); + + //构造属性保存活动属性,活动内容 + ActInfoEntity actInfoEntity=this.constructActInfo(formDTO); + actInfoDao.insert(actInfoEntity); + + List actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId()); + for(ActContentEntity actContentEntity:actContentEntityList){ + actContentDao.insert(actContentEntity); + } + //插入一条操作日志 + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(actInfoEntity.getId()); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_PUBLISH); + actOperationRecEntity.setNoticeUser(false); + actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); + actOperationRecDao.insert(actOperationRecEntity); + + //删除所有的草稿 + this.deleteDraft(); + publishActResultDTO.setActId(actInfoEntity.getId()); + + return publishActResultDTO; + } + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description + * @Date 2020/7/24 16:45 + **/ + private void checkPublishFormDTO(PublishActInfoFormDTO formDTO) { + //1、活动预计开始时间、活动预计结束时间 + if(formDTO.getActStartTime().compareTo(formDTO.getActEndTime())!=-1){ + throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode()); + } + //2、签到开始时间、签到结束时间 + if(formDTO.getSignInStartTime().compareTo(formDTO.getSignInEndTime())!=-1){ + throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode()); + } + //3、报名截止时间(应该在活动预计开始时间之前) + if(formDTO.getSignUpEndTime().compareTo(formDTO.getActStartTime())!=-1){ + throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); + } + } + + public static void main(String[] args) { + SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + + try { + Date yesterDate=format.parse("2020-07-25 13:00:00"); + Date today=format.parse("2020-07-26 13:00:00"); + Date tommorrow=format.parse("2020-07-27 13:00:00"); + Date today1=format.parse("2020-07-26 13:00:00"); + System.out.println(yesterDate.compareTo(today)); + System.out.println(tommorrow.compareTo(today)); + System.out.println(today.compareTo(today1)); + } catch (ParseException e) { + e.printStackTrace(); + } + + } + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 活动相关内容审核(活动标题、招募要求、活动内容图文) + * @Date 2020/7/21 19:20 + **/ + private void auditAct(PublishActInfoFormDTO formDTO) { + //1、活动标题 + if (StringUtils.isNotBlank(formDTO.getTitle())) { + this.auditActTitle(formDTO.getTitle()); + } + //2、活动封面 + if(StringUtils.isNotBlank(formDTO.getCoverPic())){ + this.auditActCoverPic(formDTO.getCoverPic()); + } + + //3、招募要求 + if (StringUtils.isNotBlank(formDTO.getRequirement())) { + this.auditActRequirement(formDTO.getRequirement()); + } + //4、活动内容 + if(null==formDTO.getActContent()||formDTO.getActContent().size()<1){ + return; + } + List textList=new ArrayList<>(); + List imgList=new ArrayList<>(); + for(PublishActContentFormDTO actContent:formDTO.getActContent()){ + if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(actContent.getContentType())){ + textList.add(actContent.getContent()); + }else if(ActConstant.ACT_CONTENT_TYPE_IMG.equals(actContent.getContentType())){ + imgList.add(actContent.getContent()); + } + } + this.auditActContent(textList,imgList); + } + + /** + * @return com.epmet.entity.ActInfoEntity + * @param formDTO + * @author yinzuomei + * @description 发布活动-构造act_info + * @Date 2020/7/21 20:00 + **/ + private ActInfoEntity constructActInfo(PublishActInfoFormDTO formDTO) { + ActInfoEntity actInfoEntity = ConvertUtils.sourceToTarget(formDTO, ActInfoEntity.class); + //活动名额类型(0-不限名额,1-固定名额) + if(actInfoEntity.getActQuota()==0){ + actInfoEntity.setActQuotaCategory(false); + }else{ + actInfoEntity.setActQuotaCategory(true); + } + actInfoEntity.setSignUpStartTime(new Date()); + actInfoEntity.setActStatus(ActConstant.ACT_STATUS_PUBLISHED); + + //1已经总结0未总结 + actInfoEntity.setSummaryFlag(false); + if(ActConstant.SPONSOR_AGENCY.equals(actInfoEntity.getSponsorType())){ + //调用gov_org服务获取当前组织的上一级机关id + Result result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId()); + if(result.success()&&null!=result.getData()){ + actInfoEntity.setPid(result.getData().getPid()); + }else{ + logger.warn("根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); + } + }else{ + actInfoEntity.setPid(""); + } + return actInfoEntity; + } + + /** + * @return java.util.List + * @param actContent + * @param actId + * @author yinzuomei + * @description 发布活动-构造活动详情act_content + * @Date 2020/7/21 19:59 + **/ + private List constructActContent(List actContent, String actId) { + List list=new ArrayList<>(); + int orderNum=1; + for(PublishActContentFormDTO actContentFormDTO:actContent){ + ActContentEntity actContentEntity=new ActContentEntity(); + actContentEntity.setActId(actId); + actContentEntity.setContent(actContentFormDTO.getContent()); + actContentEntity.setContentType(actContentFormDTO.getContentType()); + actContentEntity.setOrderNum(orderNum); + list.add(actContentEntity); + orderNum++; + } + return list; + } + + /** + * @return void + * @param textList + * @param imgList + * @author yinzuomei + * @description 活动详情审核 + * @Date 2020/7/21 19:21 + **/ + private void auditActContent(List textList, List imgList) { + //审核活动详情中的内容 + if(null!=textList&&textList.size()>0){ + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + textList.forEach(content -> { + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(content); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + }); + Result contentSyncScanRes = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!contentSyncScanRes.success()) { + logger.error("活动详情内容审核接口失败,返参:", JSON.toJSONString(contentSyncScanRes)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!contentSyncScanRes.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); + } + } + logger.info("活动详情内容审核成功"); + } + if(null!=imgList&&imgList.size()>0){ + //审核活动详情中的图片 + ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); + imgList.forEach(url -> { + ImgTaskDTO task = new ImgTaskDTO(); + task.setDataId(UUID.randomUUID().toString().replace("-", "")); + task.setUrl(url); + imgScanParamDTO.getTasks().add(task); + }); + Result imgScanResult = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), imgScanParamDTO); + if (!imgScanResult.success()){ + logger.error("活动详情图片审核接口失败,返参:", JSON.toJSONString(imgScanResult)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!imgScanResult.getData().isAllPass()) { + throw new RenException(EpmetErrorCode.ACT_CONTENT_IMG_SCAN_FAILED.getCode()); + } + } + logger.info("活动详情图片审核成功"); + } + } + + /** + * @return void + * @param requirement + * @author yinzuomei + * @description 活动招募条件审核 + * @Date 2020/7/21 19:21 + **/ + private void auditActRequirement(String requirement) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(requirement); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + logger.error("活动报名条件审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + logger.error("活动报名条件审核失败,报名条件:",requirement); + throw new RenException(EpmetErrorCode.ACT_REQ_SCAN_FAILED.getCode()); + } + } + logger.info("活动报名条件审核成功"); + } + + /** + * @return void + * @param coverPic + * @author yinzuomei + * @description 活动封面图片审核 + * @Date 2020/7/21 19:21 + **/ + private void auditActCoverPic(String coverPic) { + ImgScanParamDTO coverPicScanParamDTO = new ImgScanParamDTO(); + ImgTaskDTO coverImgtask = new ImgTaskDTO(); + coverImgtask.setDataId(UUID.randomUUID().toString().replace("-", "")); + coverImgtask.setUrl(coverPic); + coverPicScanParamDTO.getTasks().add(coverImgtask); + Result coverPicScanRes = ScanContentUtils.imgSyncScan(scanApiUrl.concat(imgSyncScanMethod), coverPicScanParamDTO); + if (!coverPicScanRes.success()){ + logger.error("活动封面审核失败接口返回失败,返参:", JSON.toJSONString(coverPicScanRes)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!coverPicScanRes.getData().isAllPass()) { + logger.error("活动封面审核失败,封面图片地址:",coverPic); + throw new RenException(EpmetErrorCode.ACT_COVER_PIC_SCAN_FAILED.getCode()); + } + } + logger.info("活动封面审核成功"); + } + + /** + * @return void + * @param title + * @author yinzuomei + * @description 活动标题审核 + * @Date 2020/7/21 19:21 + **/ + private void auditActTitle(String title) { + TextScanParamDTO textScanParamDTO = new TextScanParamDTO(); + TextTaskDTO taskDTO = new TextTaskDTO(); + taskDTO.setContent(title); + taskDTO.setDataId(UUID.randomUUID().toString().replace("-", "")); + textScanParamDTO.getTasks().add(taskDTO); + Result textSyncScanResult = ScanContentUtils.textSyncScan(scanApiUrl.concat(textSyncScanMethod), textScanParamDTO); + if (!textSyncScanResult.success()) { + logger.error("活动标题审核接口返回失败,返参:", JSON.toJSONString(textSyncScanResult)); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } else { + if (!textSyncScanResult.getData().isAllPass()) { + logger.error("活动标题审核失败,标题内容:",title); + throw new RenException(EpmetErrorCode.ACT_TITLE_SCAN_FAILED.getCode()); + } + } + logger.info("活动标题审核通过"); + } + /** * @param formDTO * @return com.epmet.dto.result.work.InProgressActResultDTO @@ -128,20 +495,69 @@ public class WorkActServiceImpl implements WorkActService { return actInfoDao.selectFinishedList(formDTO.getCustomerId()); } - public static void main(String[] args) { - SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - - try { - Date date1=format.parse("2020-07-23 13:00:00"); - Date yesterDate=format.parse("2020-07-22 13:00:00"); - Date date2=format.parse("2020-07-23 13:00:00"); - Date tommorrow=format.parse("2020-07-24 13:00:00"); - System.out.println(new Date().compareTo(yesterDate)); - System.out.println(date1.compareTo(tommorrow)); - System.out.println(date1.compareTo(date2)); - } catch (ParseException e) { - e.printStackTrace(); + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 取消活动 + * @Date 2020/7/26 17:26 + **/ + @Override + public void cancelAct(CancelActFormDTO formDTO) { + ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); + if(null==actInfoDTO){ + logger.error("act_info is null"); + return ; + } + //插入取消活动操作日志 + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(formDTO.getActId()); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_CANCEL); + actOperationRecEntity.setNoticeUser(true); + actOperationRecEntity.setRemark(formDTO.getCancelReason()); + actOperationRecDao.insert(actOperationRecEntity); + //更新活动标识,改为已取消 + actInfoDTO.setCancelReason(formDTO.getCancelReason()); + actInfoDTO.setCancelTime(actOperationRecEntity.getCreatedTime()); + actInfoDTO.setActStatus(ActConstant.ACT_STATUS_CANCELED); + actInfoService.update(actInfoDTO); + //查询已经通过审核的用户,发送消息 + List userIdList=actUserRelationDao.selectUserIdList(formDTO.getActId(),ActConstant.ACT_USER_STATUS_PASSED); + if(null!=userIdList&&userIdList.size()>0){ + List userMessageFormDTOS=new ArrayList<>(); + for(String userId:userIdList){ + UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + userMessageFormDTO.setUserId(userId); + userMessageFormDTO.setGridId(StrConstant.STAR); + userMessageFormDTO.setApp(AppClientConstant.APP_RESI); + userMessageFormDTO.setTitle(ActMessageConstant.TITLE); + userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ); + userMessageFormDTO.setMessageContent(String.format(ActMessageConstant.ACT_CANCELED, + actInfoDTO.getTitle(), + formDTO.getCancelReason())); + userMessageFormDTOS.add(userMessageFormDTO); + } + Result sendMessageRes= epmetMessageOpenFeignClient.saveUserMessageList(userMessageFormDTOS); + if(sendMessageRes.success()){ + logger.info("给审核通过的用户发送消息成功"); + } } } + + /** + * @param actId + * @return void + * @author yinzuomei + * @description 已取消-活动详情 + * @Date 2020/7/26 18:00 + **/ + @Override + public CanceledActDetailResultDTO canceledDetail(String actId) { + CanceledActDetailResultDTO canceledActDetailResultDTO=actInfoDao.selectCanceledActInfo(actId); + if(null!=canceledActDetailResultDTO){ + canceledActDetailResultDTO.setActContent(actContentDao.selectByActId(actId)); + } + return canceledActDetailResultDTO; + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index 3ec8d2dea5..411e6f1cc6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -369,6 +369,10 @@ public class WorkActUserServiceImpl implements WorkActUserService { if(!actInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } + if(actInfo.getActStatus().equals(ActConstant.ACT_STATUS_CANCELED)){ + logger.info("活动已经取消,无需处理"); + return; + } Date auditTime=new Date(); actUserRelationEntity.setStatus(ActConstant.ACT_USER_STATUS_PASSED); actUserRelationEntity.setPassedType(ActConstant.PASSEDTYPE_MANUAL); @@ -408,6 +412,10 @@ public class WorkActUserServiceImpl implements WorkActUserService { logger.error("查询活动为空actId="+actUserRelationEntity.getActId()); return; } + if(actInfo.getActStatus().equals(ActConstant.ACT_STATUS_CANCELED)){ + logger.info("活动已经取消,无需处理"); + return; + } if(!actInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml index 4f6c46667e..6d38c0a679 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml @@ -17,5 +17,16 @@ - + + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 380e0197a7..368115e3e2 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -577,4 +577,30 @@ AND aur.ACT_ID =#{actId} order by aur.CANCEL_TIME desc + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index d2872098fd..507206fa64 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -189,4 +189,43 @@ AND aur.PROCESS_FLAG != 'handled' AND aur.ACT_ID = #{actId} + + + + + + diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml index 68f536b24d..a4aade9b30 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml @@ -50,4 +50,9 @@ ORDER BY lac.ORDER_NUM ASC + + + + delete from latest_act_content lac where lac.ACT_ID=#{actId} + \ No newline at end of file From 8a510a6b0d289392036a87573e337c77d75a7354 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 26 Jul 2020 20:18:33 +0800 Subject: [PATCH 099/157] =?UTF-8?q?heart-work:=E5=B7=B2=E7=BB=93=E6=9D=9F-?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=B4=BB=E5=8A=A8=E5=AE=9E=E9=99=85=E5=BC=80?= =?UTF-8?q?=E5=A7=8B=E7=BB=93=E6=9D=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 2 +- .../epmet/commons/tools/utils/DateUtils.java | 8 ++++ .../dto/form/work/SaveActualTimeFormDTO.java | 40 +++++++++++++++++++ .../epmet/controller/WorkActController.java | 15 +++++++ .../com/epmet/service/WorkActService.java | 10 +++++ .../service/impl/WorkActServiceImpl.java | 27 +++++++++++-- 6 files changed, 97 insertions(+), 5 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SaveActualTimeFormDTO.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 1c4adc9bf3..f715f35b01 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -57,7 +57,7 @@ public enum EpmetErrorCode { ACT_START_TIME_ERROR(8119,"活动预计开始时间应早于活动预计结束时间"), ACT_SIGN_IN_START_TIME_ERROR(8120,"签到开始时间应早于签到结束时间"), ACT_SIGN_UP_END_TIME_ERROR(8121,"活动报名截止时间应早于活动预计开始时间"), - + ACT_ACTUAL_START_TIME_ERROR(8122,"实际开始时间应早于实际结束时间"), CANNOT_AUDIT_WARM(8201, "请完善居民信息"), NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index e76c5a4c33..c652bde696 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -502,4 +502,12 @@ public class DateUtils { return null; } + public static Integer calculateMin(Date startDate,Date endDate){ + long start=startDate.getTime(); + long end=endDate.getTime(); + // 计算差多少分钟 + int minutes = (int) ((end - start) / (1000 * 60)); + System.out.println("两个时间之间的分钟差为:" + minutes); + return minutes; + } } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SaveActualTimeFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SaveActualTimeFormDTO.java new file mode 100644 index 0000000000..8380ece57c --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/SaveActualTimeFormDTO.java @@ -0,0 +1,40 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * 已结束-保存活动实际开始结束时间 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 19:43 + */ +@Data +public class SaveActualTimeFormDTO implements Serializable { + private static final long serialVersionUID = -3668309257254318868L; + + public interface AddUserInternalGroup { + } + + public interface UserShowGroup extends CustomerClientShowGroup { + } + + /** + * 活动id + */ + @NotBlank(message = "活动id不能为空", groups = {AddUserInternalGroup.class}) + private String actId; + /** + * 实际开始时间yyyy-MM-dd HH:mm + */ + @NotBlank(message = "实际开始时间不能为空", groups = {UserShowGroup.class}) + private String actualStartTime; + /** + * 实际结束时间yyyy-MM-dd HH:mm + */ + @NotBlank(message = "实际结束时间不能为空", groups = {UserShowGroup.class}) + private String actualEndTime; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index aca1f4aee4..818f4e48b7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -135,4 +135,19 @@ public class WorkActController { ValidatorUtils.validateEntity(actIdFormDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result().ok(workActService.canceledDetail(actIdFormDTO.getActId())); } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 已结束-保存活动实际开始结束时间 + * @Date 2020/7/26 19:48 + **/ + @PostMapping("saveactualtime") + public Result saveActualTime(@RequestBody SaveActualTimeFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, SaveActualTimeFormDTO.UserShowGroup.class, + SaveActualTimeFormDTO.AddUserInternalGroup.class); + workActService.saveActualTime(formDTO); + return new Result(); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index b4e83a2aa1..971240c5c8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -3,6 +3,7 @@ package com.epmet.service; import com.epmet.dto.form.work.ActListCommonFormDTO; import com.epmet.dto.form.work.CancelActFormDTO; import com.epmet.dto.form.work.PublishActInfoFormDTO; +import com.epmet.dto.form.work.SaveActualTimeFormDTO; import com.epmet.dto.result.work.*; import java.util.List; @@ -85,4 +86,13 @@ public interface WorkActService { * @Date 2020/7/26 18:00 **/ CanceledActDetailResultDTO canceledDetail(String actId); + + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 已结束-保存活动实际开始结束时间 + * @Date 2020/7/26 19:49 + **/ + void saveActualTime(SaveActualTimeFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 257b8a810d..1e713b226e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -12,6 +12,7 @@ import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.ScanContentUtils; import com.epmet.constant.ActConstant; @@ -24,10 +25,7 @@ import com.epmet.dao.ActUserRelationDao; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.UserMessageFormDTO; -import com.epmet.dto.form.work.ActListCommonFormDTO; -import com.epmet.dto.form.work.CancelActFormDTO; -import com.epmet.dto.form.work.PublishActContentFormDTO; -import com.epmet.dto.form.work.PublishActInfoFormDTO; +import com.epmet.dto.form.work.*; import com.epmet.dto.result.ActSponsorResultDTO; import com.epmet.dto.result.work.*; import com.epmet.entity.ActContentEntity; @@ -560,4 +558,25 @@ public class WorkActServiceImpl implements WorkActService { } return canceledActDetailResultDTO; } + + /** + * @param formDTO + * @return void + * @author yinzuomei + * @description 已结束-保存活动实际开始结束时间 + * @Date 2020/7/26 19:49 + **/ + @Override + public void saveActualTime(SaveActualTimeFormDTO formDTO) { + if(formDTO.getActualStartTime().compareTo(formDTO.getActualEndTime())!=-1){ + throw new RenException(EpmetErrorCode.ACT_ACTUAL_START_TIME_ERROR.getCode()); + } + ActInfoDTO actInfoDTO=actInfoService.get(formDTO.getActId()); + Date actualStartTime= DateUtils.minStrToSecondDate(formDTO.getActualStartTime()); + actInfoDTO.setActualStartTime(actualStartTime); + Date actualEndTime= DateUtils.minStrToSecondDate(formDTO.getActualEndTime()); + actInfoDTO.setActualEndTime(actualEndTime); + actInfoDTO.setServiceMin(DateUtils.calculateMin(actualStartTime,actualEndTime)); + actInfoService.update(actInfoDTO); + } } From 750583687a4a9316d35a2dd9fd7d080e7d3a79c9 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 26 Jul 2020 21:42:34 +0800 Subject: [PATCH 100/157] =?UTF-8?q?heart-work:=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../work/FinishedActDetailResultDTO.java | 109 ++++++++++++++++++ .../work/InProgressActDetailResultDTO.java | 92 +++++++++++++++ .../result/work/InProgressActResultDTO.java | 9 ++ .../epmet/controller/WorkActController.java | 26 +++++ .../main/java/com/epmet/dao/ActInfoDao.java | 18 +++ .../com/epmet/service/WorkActService.java | 23 +++- .../service/impl/WorkActServiceImpl.java | 34 ++++++ .../src/main/resources/mapper/ActInfoDao.xml | 61 +++++++++- 8 files changed, 364 insertions(+), 8 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java new file mode 100644 index 0000000000..dceee4956d --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java @@ -0,0 +1,109 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 已结束-活动详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 20:52 + */ +@Data +public class FinishedActDetailResultDTO implements Serializable { + private static final long serialVersionUID = 6780614493878658227L; + /** + * 活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 报名截止时间:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * true:固定名额 false: 不限制名额 + */ + private Boolean actQuotaCategory; + + /** + * 联系人 + */ + private String sponsorContacts; + + /** + * 联系电话 + */ + private String sponsorTel; + + /** + * 活动积分 + */ + private Integer reward; + + /** + * 主办方名称 + */ + private String sponsorName; + + /** + * 报名条件 + */ + private String requirement; + + /** + * 是否添加回顾:true已经总结 false:未总结 + */ + private Boolean summaryFlag; + + /** + * 活动详情 + */ + private List actContent; + + /** + * 实际开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actualStartTime; + + /** + * 实际结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actualEndTime; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java new file mode 100644 index 0000000000..c1c0ed4515 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java @@ -0,0 +1,92 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 进行中-活动详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/26 21:26 + */ +@Data +public class InProgressActDetailResultDTO implements Serializable { + private static final long serialVersionUID = -2159602705968655263L; + + /** + * 活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 报名截止时间:yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 活动地点 + */ + private String actAddress; + + /** + * 活动名额 + */ + private Integer actQuota; + + /** + * true:固定名额 false: 不限制名额 + */ + private Boolean actQuotaCategory; + + /** + * 联系人 + */ + private String sponsorContacts; + + /** + * 联系电话 + */ + private String sponsorTel; + + /** + * 活动积分 + */ + private Integer reward; + + /** + * 主办方名称 + */ + private String sponsorName; + + /** + * 报名条件 + */ + private String requirement; + + /** + * 活动详情 + */ + private List actContent; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java index edf6102c7c..5e25e5fab0 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActResultDTO.java @@ -64,8 +64,17 @@ public class InProgressActResultDTO implements Serializable { */ private Integer signedUp; + /** + * 报名截止时间 + */ @JsonIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date signUpEndTime; + + /** + * 报名开始时间 + */ @JsonIgnore + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date signUpStartTime; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index 818f4e48b7..dd0a773058 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -150,4 +150,30 @@ public class WorkActController { workActService.saveActualTime(formDTO); return new Result(); } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 已结束-活动详情 + * @Date 2020/7/26 21:01 + **/ + @PostMapping("finisheddeatil") + public Result finishedDeatil(@RequestBody ActIdFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActService.finishedDeatil(formDTO)); + } + + /** + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 进行中-活动详情 + * @Date 2020/7/26 21:33 + **/ + @PostMapping("inprogressdetail") + public Result inProgressDetail(@RequestBody ActIdFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActService.inProgressDetail(formDTO.getActId())); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index 4766a2823c..fc1b09d56c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java @@ -279,4 +279,22 @@ public interface ActInfoDao extends BaseDao { * @Date 2020/7/26 18:29 **/ CanceledActDetailResultDTO selectCanceledActInfo(String actId); + + /** + * @return com.epmet.dto.result.work.FinishedActDetailResultDTO + * @param actId + * @author yinzuomei + * @description 已结束-活动详情 + * @Date 2020/7/26 21:04 + **/ + FinishedActDetailResultDTO selectFinishedDetail(String actId); + + /** + * @return com.epmet.dto.result.work.InProgressActDetailResultDTO + * @param actId + * @author yinzuomei + * @description 进行中-活动详情 + * @Date 2020/7/26 21:35 + **/ + InProgressActDetailResultDTO selectInProgressDetail(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index 971240c5c8..22975d0ec0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -1,9 +1,6 @@ package com.epmet.service; -import com.epmet.dto.form.work.ActListCommonFormDTO; -import com.epmet.dto.form.work.CancelActFormDTO; -import com.epmet.dto.form.work.PublishActInfoFormDTO; -import com.epmet.dto.form.work.SaveActualTimeFormDTO; +import com.epmet.dto.form.work.*; import com.epmet.dto.result.work.*; import java.util.List; @@ -95,4 +92,22 @@ public interface WorkActService { * @Date 2020/7/26 19:49 **/ void saveActualTime(SaveActualTimeFormDTO formDTO); + + /** + * @param formDTO + * @return com.epmet.dto.result.work.FinishedActDetailResultDTO + * @author yinzuomei + * @description 已结束-活动详情 + * @Date 2020/7/26 21:02 + **/ + FinishedActDetailResultDTO finishedDeatil(ActIdFormDTO formDTO); + + /** + * @return com.epmet.dto.result.work.InProgressActDetailResultDTO + * @param actId + * @author yinzuomei + * @description 进行中-活动详情 + * @Date 2020/7/26 21:34 + **/ + InProgressActDetailResultDTO inProgressDetail(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 1e713b226e..ac14c06eed 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -579,4 +579,38 @@ public class WorkActServiceImpl implements WorkActService { actInfoDTO.setServiceMin(DateUtils.calculateMin(actualStartTime,actualEndTime)); actInfoService.update(actInfoDTO); } + + /** + * @param formDTO + * @return com.epmet.dto.result.work.FinishedActDetailResultDTO + * @author yinzuomei + * @description 已结束-活动详情 + * @Date 2020/7/26 21:02 + **/ + @Override + public FinishedActDetailResultDTO finishedDeatil(ActIdFormDTO formDTO) { + FinishedActDetailResultDTO resultDTO = actInfoDao.selectFinishedDetail(formDTO.getActId()); + if (null != resultDTO) { + List list = actContentDao.selectByActId(formDTO.getActId()); + resultDTO.setActContent(list); + } + return resultDTO; + } + + /** + * @param actId + * @return com.epmet.dto.result.work.InProgressActDetailResultDTO + * @author yinzuomei + * @description 进行中-活动详情 + * @Date 2020/7/26 21:34 + **/ + @Override + public InProgressActDetailResultDTO inProgressDetail(String actId) { + InProgressActDetailResultDTO resultDTO = actInfoDao.selectInProgressDetail(actId); + if (null != resultDTO) { + List list = actContentDao.selectByActId(actId); + resultDTO.setActContent(list); + } + return resultDTO; + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 4686b14efc..644e5864f4 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -506,7 +506,7 @@ AND ai.ACT_STATUS = 'canceled' AND ai.CUSTOMER_ID = #{customerId} ORDER BY - ai.CANCEL_TIME DESC + ai.CREATED_TIME DESC @@ -526,7 +526,7 @@ AND ai.ACT_STATUS = 'finished' AND ai.CUSTOMER_ID = #{customerId} ORDER BY - ai.ACTUAL_END_TIME DESC + ai.CREATED_TIME DESC @@ -556,7 +556,8 @@ - SELECT aur.id as actUserRelationId, aur.ACT_ID , @@ -579,7 +580,8 @@ - SELECT ai.id AS actId, ai.TITLE AS title, @@ -603,4 +605,55 @@ and ai.id=#{actId} and ai.ACT_STATUS='canceled' + + + + + + From 51d8e62877eaa0096b722641a8c43350efa96938 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 26 Jul 2020 23:11:42 +0800 Subject: [PATCH 101/157] =?UTF-8?q?heart-work:=E5=8F=91=E5=B8=83=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/EpmetErrorCode.java | 3 + .../java/com/epmet/dto/ActPointLogDTO.java | 5 - .../java/com/epmet/dto/ActStatisticalDTO.java | 15 +- .../epmet/controller/WorkActController.java | 14 ++ .../com/epmet/dao/ActUserRelationDao.java | 19 +++ .../com/epmet/entity/ActPointLogEntity.java | 6 - .../epmet/entity/ActStatisticalEntity.java | 15 +- .../com/epmet/service/WorkActService.java | 9 ++ .../service/impl/GrantPointsServiceImpl.java | 15 -- .../service/impl/WorkActServiceImpl.java | 136 ++++++++++++++++-- .../main/resources/mapper/ActPointLogDao.xml | 1 - .../resources/mapper/ActStatisticalDao.xml | 2 - .../resources/mapper/ActUserRelationDao.xml | 24 ++++ 13 files changed, 194 insertions(+), 70 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index f715f35b01..be9c66519e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -58,6 +58,9 @@ public enum EpmetErrorCode { ACT_SIGN_IN_START_TIME_ERROR(8120,"签到开始时间应早于签到结束时间"), ACT_SIGN_UP_END_TIME_ERROR(8121,"活动报名截止时间应早于活动预计开始时间"), ACT_ACTUAL_START_TIME_ERROR(8122,"实际开始时间应早于实际结束时间"), + HAVE_HANDLE(8123,"存在待处理事项,请先处理"), + ACTUAL_TIME(8124,"请录入实际开始时间,实际结束时间"), + CANNOT_AUDIT_WARM(8201, "请完善居民信息"), NOT_DEL_AGENCY(8202, "该机关存在下级机关,不允许删除"), diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java index c19938d48f..6b6daf74c2 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActPointLogDTO.java @@ -94,9 +94,4 @@ public class ActPointLogDTO implements Serializable { * 更新时间 */ private Date updatedTime; - /** - * 1有效0无效,只有在活动真正结束后才是1 - * true有效 false无效 - */ - private Boolean effectFlag; } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java index 233b5c2188..b1bc9f1898 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActStatisticalDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -44,7 +45,7 @@ public class ActStatisticalDTO implements Serializable { private String actId; /** - * 已报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) + * 报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) */ private Integer signupNum; @@ -73,16 +74,6 @@ public class ActStatisticalDTO implements Serializable { */ private Integer signedInUserNum; - /** - * 添加实况总人数 - */ - private Integer liveUserNum; - - /** - * 实况总记录数 - */ - private Integer liveCount; - /** * 发放积分总人数 */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index dd0a773058..dda4fe56b0 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -176,4 +176,18 @@ public class WorkActController { ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result().ok(workActService.inProgressDetail(formDTO.getActId())); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 已结束-确认结束活动 + * @Date 2020/7/26 21:48 + **/ + @PostMapping("finishact") + public Result finishAct(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + workActService.finishAct(formDTO.getActId()); + return new Result(); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index 526ca76a1f..3b50cf440b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -156,4 +156,23 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/26 19:11 **/ List selectDeniedList(String actId); + + /** + * @return java.lang.Integer + * @param actId + * @author yinzuomei + * @description 活动已签到人数 + * @Date 2020/7/26 22:34 + **/ + Integer selectCountSinedIn(String actId); + + /** + * @return java.lang.Integer + * @param actId + * @param rewardFlag + * @author yinzuomei + * @description 查询发放积分的总人数、拒绝发放积分的总人数 + * @Date 2020/7/26 22:38 + **/ + Integer selectCountByReward(@Param("actId") String actId, @Param("rewardFlag")String rewardFlag); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java index f96ba508d9..e18170b8a3 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActPointLogEntity.java @@ -61,10 +61,4 @@ public class ActPointLogEntity extends BaseEpmetEntity { */ private String remark; - - /** - * 1有效0无效,只有在活动真正结束后才是1 - * true有效 false无效 - */ - private Boolean effectFlag; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java index 61de147e46..cc1a41fa9a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/ActStatisticalEntity.java @@ -18,13 +18,10 @@ package com.epmet.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 活动统计信息 * @@ -44,7 +41,7 @@ public class ActStatisticalEntity extends BaseEpmetEntity { private String actId; /** - * 已报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) + * 报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) */ private Integer signupNum; @@ -73,16 +70,6 @@ public class ActStatisticalEntity extends BaseEpmetEntity { */ private Integer signedInUserNum; - /** - * 添加实况总人数 - */ - private Integer liveUserNum; - - /** - * 实况总记录数 - */ - private Integer liveCount; - /** * 发放积分总人数 */ diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index 22975d0ec0..c00fab9abe 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -110,4 +110,13 @@ public interface WorkActService { * @Date 2020/7/26 21:34 **/ InProgressActDetailResultDTO inProgressDetail(String actId); + + /** + * @return void + * @param actId + * @author yinzuomei + * @description 已结束-确认结束活动 + * @Date 2020/7/26 21:48 + **/ + void finishAct(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java index 024b325ff9..ccdab4e19e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/GrantPointsServiceImpl.java @@ -137,11 +137,6 @@ public class GrantPointsServiceImpl implements GrantPointsService { actPointLogDTO.setPoints(actInfoDTO.getReward()); actPointLogDTO.setOperateType(ActConstant.ACT_USER_STATUS_AGREE); actPointLogDTO.setRemark(StrConstant.EPMETY_STR); - /** - * 1有效0无效,只有在活动真正结束后才是1 - * true有效 false无效 - */ - actPointLogDTO.setEffectFlag(false); actPointLogService.save(actPointLogDTO); } @@ -186,11 +181,6 @@ public class GrantPointsServiceImpl implements GrantPointsService { actPointLogDTO.setPoints(actInfoDTO.getReward()); actPointLogDTO.setOperateType(ActConstant.ACT_USER_STATUS_DENY); actPointLogDTO.setRemark(formDTO.getDenyRewardReason()); - /** - * 1有效0无效,只有在活动真正结束后才是1 - * true有效 false无效 - */ - actPointLogDTO.setEffectFlag(false); actPointLogService.save(actPointLogDTO); } @@ -229,11 +219,6 @@ public class GrantPointsServiceImpl implements GrantPointsService { actPointLogDTO.setPoints(actInfoDTO.getReward()); actPointLogDTO.setOperateType(ActConstant.RESET); actPointLogDTO.setRemark(StrConstant.EPMETY_STR); - /** - * 1有效0无效,只有在活动真正结束后才是1 - * true有效 false无效 - */ - actPointLogDTO.setEffectFlag(false); actPointLogService.save(actPointLogDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index ac14c06eed..3c6407fb1c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -11,19 +11,12 @@ import com.epmet.commons.tools.scan.param.TextScanParamDTO; import com.epmet.commons.tools.scan.param.TextTaskDTO; import com.epmet.commons.tools.scan.result.SyncScanResult; import com.epmet.commons.tools.security.user.LoginUserUtil; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.ScanContentUtils; +import com.epmet.commons.tools.utils.*; import com.epmet.constant.ActConstant; import com.epmet.constant.ActMessageConstant; import com.epmet.constant.ReadFlagConstant; -import com.epmet.dao.ActContentDao; -import com.epmet.dao.ActInfoDao; -import com.epmet.dao.ActOperationRecDao; -import com.epmet.dao.ActUserRelationDao; -import com.epmet.dto.ActInfoDTO; -import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dao.*; +import com.epmet.dto.*; import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.work.*; import com.epmet.dto.result.ActSponsorResultDTO; @@ -33,9 +26,7 @@ import com.epmet.entity.ActInfoEntity; import com.epmet.entity.ActOperationRecEntity; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.service.ActInfoService; -import com.epmet.service.LatestActInfoService; -import com.epmet.service.WorkActService; +import com.epmet.service.*; import org.apache.commons.lang3.StringUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -84,6 +75,14 @@ public class WorkActServiceImpl implements WorkActService { private ActUserRelationDao actUserRelationDao; @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private ActStatisticalService actStatisticalService; + @Autowired + private ActUserRelationService actUserRelationService; + @Autowired + private HeartUserInfoDao heartUserInfoDao; + @Autowired + private HeartUserInfoService heartUserInfoService; /** * @return void @@ -247,13 +246,22 @@ public class WorkActServiceImpl implements WorkActService { **/ private ActInfoEntity constructActInfo(PublishActInfoFormDTO formDTO) { ActInfoEntity actInfoEntity = ConvertUtils.sourceToTarget(formDTO, ActInfoEntity.class); + //报名开始、报名截止、活动预计开始、活动预计截止、签到开始、签到截止 + actInfoEntity.setSignUpEndTime(DateUtils.minStrToSecondDate(formDTO.getSignUpEndTime())); + actInfoEntity.setSignInStartTime(DateUtils.minStrToSecondDate(formDTO.getSignInStartTime())); + actInfoEntity.setSignInEndTime(DateUtils.minStrToSecondDate(formDTO.getSignInEndTime())); + actInfoEntity.setActStartTime(DateUtils.minStrToSecondDate(formDTO.getActStartTime())); + actInfoEntity.setActEndTime(DateUtils.minStrToSecondDate(formDTO.getActEndTime())); //活动名额类型(0-不限名额,1-固定名额) if(actInfoEntity.getActQuota()==0){ actInfoEntity.setActQuotaCategory(false); }else{ actInfoEntity.setActQuotaCategory(true); } - actInfoEntity.setSignUpStartTime(new Date()); + Date nowDate=new Date(); + actInfoEntity.setSignUpStartTime(nowDate); + actInfoEntity.setCreatedTime(nowDate); + actInfoEntity.setUpdatedTime(nowDate); actInfoEntity.setActStatus(ActConstant.ACT_STATUS_PUBLISHED); //1已经总结0未总结 @@ -267,7 +275,7 @@ public class WorkActServiceImpl implements WorkActService { logger.warn("根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); } }else{ - actInfoEntity.setPid(""); + actInfoEntity.setPid(StrConstant.EPMETY_STR); } return actInfoEntity; } @@ -507,6 +515,9 @@ public class WorkActServiceImpl implements WorkActService { logger.error("act_info is null"); return ; } + if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } //插入取消活动操作日志 ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); actOperationRecEntity.setActId(formDTO.getActId()); @@ -613,4 +624,99 @@ public class WorkActServiceImpl implements WorkActService { } return resultDTO; } + + /** + * @param actId + * @return void + * @author yinzuomei + * @description 已结束-确认结束活动 + * @Date 2020/7/26 21:48 + **/ + @Override + public void finishAct(String actId) { + ActInfoDTO actInfoDTO=actInfoService.get(actId); + //校验是否可以结束 + this.checkActInfoDTO(actInfoDTO); + //act_info表改为已完成 + actInfoDTO.setActStatus(ActConstant.ACT_STATUS_FINISHED); + actInfoService.update(actInfoDTO); + //发放爱心时长、参与活动并获得积分的次数 + updateHeartUserInfo(actInfoDTO); + //保存结束活动日志 + this.saveActOperationRec(actId); + //生成统计表 + this.saveActStatistical(actId); + //发放积分调用事件 TODO + } + + private void updateHeartUserInfo(ActInfoDTO actInfoDTO) { + List actUserRelationDTOList=actUserRelationService.getUserList(actInfoDTO.getId(),StrConstant.EPMETY_STR); + for(ActUserRelationDTO actUserRelation:actUserRelationDTOList){ + HeartUserInfoDTO heartUserInfoDTO=heartUserInfoDao.selectByUserId(actUserRelation.getUserId()); + if(null==heartUserInfoDTO){ + continue; + } + if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ + heartUserInfoDTO.setObtainPointNum(heartUserInfoDTO.getObtainPointNum()+1); + } + //爱心时长发放(签到的。未签到但是有积分的) + if(ActConstant.ACT_USER_STATUS_SIGNED_IN.equals(actUserRelation.getSignInFlag())){ + //已签到的 + heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); + }else{ + //未签到,但是有积分的 + if(ActConstant.ACT_USER_STATUS_AGREE.equals(actUserRelation.getRewardFlag())){ + heartUserInfoDTO.setKindnessTime(heartUserInfoDTO.getKindnessTime()+actInfoDTO.getServiceMin()); + } + } + heartUserInfoService.update(heartUserInfoDTO); + } + } + + private void saveActStatistical(String actId) { + ActStatisticalDTO actStatisticalDTO=new ActStatisticalDTO(); + actStatisticalDTO.setActId(actId); + //报名总人数(已报名/待审核auditing,审核通过passed,审核不通过refused取消报名canceld总人数) + actStatisticalDTO.setSignupNum(actUserRelationDao.selectCountUser(actId,StrConstant.EPMETY_STR)); + // 待审核总数 + actStatisticalDTO.setAuditingNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_AUDITING)); + //审核不通过总人数 + actStatisticalDTO.setPassedNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_PASSED)); + //审核不通过总人数 + actStatisticalDTO.setRefusedNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_REFUSED)); + //取消报名的人数 + actStatisticalDTO.setCanceldNum(actUserRelationDao.selectCountUser(actId,ActConstant.ACT_USER_STATUS_CANCELD)); + //活动已签到人数 + actStatisticalDTO.setSignedInUserNum(actUserRelationDao.selectCountSinedIn(actId)); + //发放积分总人数 + actStatisticalDTO.setRewardUserNum(actUserRelationDao.selectCountByReward(actId,ActConstant.ACT_USER_STATUS_AGREE)); + //拒绝发放积分总人数 + actStatisticalDTO.setDenyRewardUserNum(actUserRelationDao.selectCountByReward(actId,ActConstant.ACT_USER_STATUS_DENY)); + actStatisticalService.save(actStatisticalDTO); + } + + private void saveActOperationRec(String actId) { + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(actId); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_FINISH); + actOperationRecEntity.setNoticeUser(false); + actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); + actOperationRecDao.insert(actOperationRecEntity); + } + + private ActInfoDTO checkActInfoDTO(ActInfoDTO actInfoDTO) { + if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + List list=actUserRelationDao.selectInProgress(actInfoDTO.getId()); + if(null!=list&&list.size()>0){ + throw new RenException(EpmetErrorCode.HAVE_HANDLE.getCode()); + } + if(null==actInfoDTO.getActualStartTime()||null==actInfoDTO.getActualEndTime()){ + throw new RenException(EpmetErrorCode.ACTUAL_TIME.getCode()); + } + return actInfoDTO; + } + + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml index ec6a181d3b..322fda60fb 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActPointLogDao.xml @@ -10,7 +10,6 @@ - diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml index 7fd6faa626..4381ff3e2d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActStatisticalDao.xml @@ -12,8 +12,6 @@ - - diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index 507206fa64..7640d4f3c1 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -228,4 +228,28 @@ AND aur.ACT_ID = #{actId} order by aur.UPDATED_TIME desc + + + + + + From 0ec5501bc09bef604e62b8097032bcedbc75e095 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 09:23:35 +0800 Subject: [PATCH 102/157] =?UTF-8?q?=E5=9B=BE=E7=89=87=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=EF=BC=8C=E5=88=86=E6=89=B9=E5=8F=91=E9=80=81=20=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E6=94=AF=E6=8C=81100=E4=B8=AA=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/StatsPublicityServiceImpl.java | 2 +- .../scan/common/constant/SysConstant.java | 10 +- .../scan/service/impl/ScanServiceImpl.java | 91 +++++++++++++------ .../scan/support/result/SyncScanResult.java | 4 - 4 files changed, 72 insertions(+), 35 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java index c0f4b194a9..bcc55ede28 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java @@ -613,7 +613,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService { for (ArticleTagsEntity tagEntity : articleTagsList) { ArticleEntity articleEntity = articleMap.get(tagEntity.getArticleId()); if (articleEntity == null) { - log.error("publicitySummary articleMap articleId:{} ", tagEntity.getArticleId()); + log.error("publicitySummary articleMap not contain articleId:{} ", tagEntity.getArticleId()); continue; } DimAgencyEntity dimAgencyEntity = dimAgencyEntityMap.get(articleEntity.getOrgId()); diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java index a23795e538..8d7aa5d4d0 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/constant/SysConstant.java @@ -9,9 +9,15 @@ package com.epmet.openapi.scan.common.constant; public class SysConstant { public static final String UTF8 = "utf-8"; + /** + * 文本审核最大任务数 + */ + public static final Integer MAX_TASK_SIZE = 100; - public static final Integer MAX_TEXT_TASKS = 100; - public static final Integer MAX_IMG_TASKS = 10; + /** + * 图片审核最大任务数 + */ + public static final Integer MAX_SCAN_IMG_TASK_SIZE = 10; public static final String CODE = "code"; public static final String DATA = "data"; diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java index 3756eb1764..2a5db725e2 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java @@ -24,6 +24,7 @@ import com.epmet.openapi.scan.support.result.ScanTaskResult; import com.epmet.openapi.scan.support.result.SceneDetailResult; import com.epmet.openapi.scan.support.result.SyncScanResult; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.ListUtils; import org.apache.http.HttpStatus; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -53,29 +54,19 @@ public class ScanServiceImpl implements ScanService { textScanParam.setBizType(bizType); List textTasks = textScanParam.getTasks(); - if (CollectionUtils.isEmpty(textTasks) || textTasks.size() > SysConstant.MAX_TEXT_TASKS) { - return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg()); + if (CollectionUtils.isEmpty(textTasks) || textTasks.size() > SysConstant.MAX_TASK_SIZE) { + return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg().concat(SysConstant.MAX_TASK_SIZE.toString())); } - TextScanRequest textScanRequest = new TextScanRequest(); - textScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 - textScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 - textScanRequest.setEncoding(SysConstant.UTF8); - textScanRequest.setRegionId(regionId); + TextScanRequest textScanRequest = getTextScanRequest(); try { textScanRequest.setHttpContent(JSON.toJSONString(textScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); } catch (UnsupportedEncodingException e) { log.error("sendTextScan parse param exception", e); + return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); } - - /** - * 请务必设置超时时间 - */ - textScanRequest.setConnectTimeout(3000); - textScanRequest.setReadTimeout(6000); - try { SyncScanResult textScanResult = executeSyncText(textScanRequest); return new Result().ok(textScanResult); @@ -85,24 +76,63 @@ public class ScanServiceImpl implements ScanService { } } + private TextScanRequest getTextScanRequest() { + TextScanRequest textScanRequest = new TextScanRequest(); + textScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 + textScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 + textScanRequest.setEncoding(SysConstant.UTF8); + textScanRequest.setRegionId(regionId); + textScanRequest.setConnectTimeout(3000); + textScanRequest.setReadTimeout(6000); + return textScanRequest; + } + @Override public Result sendSyncImgScan(ImgScanParam imgScanParam) { - ImageSyncScanRequest imageSyncScanRequest = new ImageSyncScanRequest(); - imageSyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 - imageSyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 - imageSyncScanRequest.setEncoding(SysConstant.UTF8); - imageSyncScanRequest.setRegionId(regionId); - //默认参数 // 鉴黄 暴恐涉政 imgScanParam.setScenes(ImgSceneEnum.getImgSceneList()); imgScanParam.setBizType(bizType); List imgTasks = imgScanParam.getTasks(); - if (CollectionUtils.isEmpty(imgTasks) || imgTasks.size() > SysConstant.MAX_IMG_TASKS) { - return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg()); + if (CollectionUtils.isEmpty(imgTasks) || imgTasks.size() > SysConstant.MAX_TASK_SIZE) { + return new Result().error(SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_TASK_LIST_PARAM_ERROR.getMsg().concat(SysConstant.MAX_TASK_SIZE.toString())); + } + if (imgTasks.size() <= SysConstant.MAX_SCAN_IMG_TASK_SIZE) { + return doScanImg(imgScanParam); } + log.info("sendSyncImgScan tasks size:{} over 10", imgTasks.size()); + List> partition = ListUtils.partition(imgTasks, SysConstant.MAX_SCAN_IMG_TASK_SIZE); + SyncScanResult finalResult = new SyncScanResult(); + for (List tasks : partition) { + ImgScanParam scanParam = new ImgScanParam(); + scanParam.setBizType(imgScanParam.getBizType()); + scanParam.setScenes(imgScanParam.getScenes()); + scanParam.setTasks(tasks); + scanParam.setCallback(imgScanParam.getCallback()); + scanParam.setSeed(imgScanParam.getSeed()); + Result partResult = doScanImg(scanParam); + try { + Thread.sleep(5L); + } catch (InterruptedException e) { + log.error("sendSyncImgScan InterruptedException"); + } + if (partResult.success()) { + SyncScanResult data = partResult.getData(); + finalResult.getSuccessDataIds().addAll(data.getSuccessDataIds()); + finalResult.getFailDataIds().addAll(data.getFailDataIds()); + finalResult.getDetails().addAll(data.getDetails()); + } else { + return partResult; + } + } + return new Result().ok(finalResult); + + } + + private Result doScanImg(ImgScanParam imgScanParam) { + ImageSyncScanRequest imageSyncScanRequest = getImgScanRequest(); try { imageSyncScanRequest.setHttpContent(JSON.toJSONString(imgScanParam).getBytes(SysConstant.UTF8), SysConstant.UTF8, FormatType.JSON); } catch (UnsupportedEncodingException e) { @@ -110,12 +140,6 @@ public class ScanServiceImpl implements ScanService { return new Result().error(SysResponseEnum.SCAN_PARAM_ERROR.getCode(), SysResponseEnum.SCAN_PARAM_ERROR.getMsg()); } - /** - * 请务必设置超时时间 - */ - imageSyncScanRequest.setConnectTimeout(3000); - imageSyncScanRequest.setReadTimeout(6000); - try { SyncScanResult scanResult = executeSyncImg(imageSyncScanRequest); return new Result().ok(scanResult); @@ -125,6 +149,17 @@ public class ScanServiceImpl implements ScanService { } } + private ImageSyncScanRequest getImgScanRequest() { + ImageSyncScanRequest imageSyncScanRequest = new ImageSyncScanRequest(); + imageSyncScanRequest.setAcceptFormat(FormatType.JSON); // 指定api返回格式 + imageSyncScanRequest.setMethod(com.aliyuncs.http.MethodType.POST); // 指定请求方法 + imageSyncScanRequest.setEncoding(SysConstant.UTF8); + imageSyncScanRequest.setRegionId(regionId); + imageSyncScanRequest.setConnectTimeout(3000); + imageSyncScanRequest.setReadTimeout(6000); + return imageSyncScanRequest; + } + public SyncScanResult executeSyncText(AcsRequest textScanRequest) { SyncScanResult result = new SyncScanResult(); try { diff --git a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java index c50589d7ce..8dcb757f64 100644 --- a/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java +++ b/epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/support/result/SyncScanResult.java @@ -39,8 +39,4 @@ public class SyncScanResult implements Serializable { } return isAllPass; } - - public void setAllPass(boolean allPass) { - isAllPass = allPass; - } } From 484dd50110f2006d14a5fafe6a35a9ab62ba2fda Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 27 Jul 2020 09:23:39 +0800 Subject: [PATCH 103/157] =?UTF-8?q?Bug=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/PublicUserLoginServiceImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java index f626ec6814..524f475671 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/PublicUserLoginServiceImpl.java @@ -101,6 +101,10 @@ public class PublicUserLoginServiceImpl implements PublicUserLoginService { logger.error("wxMpUser is null"); throw new RenException("解析微信用户信息失败 wxMpUser is null"); } + if(StringUtils.isBlank(wxMpUser.getOpenId())){ + logger.error("wxMpUser.getOpenId() is null"); + throw new RenException("解析微信用户信息失败"); + } /*if(StringUtils.isBlank(wxMpUser.getUnionId())){ logger.error("wxMpUser.getUnionId() is null"); // throw new RenException("解析微信用户信息失败"); From c693872adc031a60d0e85fa19e68dd68fd555498 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 27 Jul 2020 09:28:45 +0800 Subject: [PATCH 104/157] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index edf73a05cc..8295fa44e5 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.48 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.49 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index fb25b63090..d96a621883 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.48 + 0.3.49 com.epmet epmet-cloud From a52fe916678cec8e5cce5d6b71a33634b1de83a0 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 09:28:46 +0800 Subject: [PATCH 105/157] =?UTF-8?q?=E9=83=A8=E7=BD=B2scan=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml | 2 +- epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml | 2 +- epmet-openapi/epmet-openapi-scan/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml index 5137c630ed..a9f630c5e0 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.23 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-openapi-scan:0.3.24 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml index 15c4000109..41652ae4d5 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.23 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-openapi-scan:0.3.24 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml index be5e1ee040..20bfb7607a 100644 --- a/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml +++ b/epmet-openapi/epmet-openapi-scan/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-openapi-scan: container_name: epmet-openapi-scan-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.23 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-openapi-scan:0.3.24 ports: - "8107:8107" network_mode: host # 不会创建新的网络 diff --git a/epmet-openapi/epmet-openapi-scan/pom.xml b/epmet-openapi/epmet-openapi-scan/pom.xml index 747107e901..97029c52f2 100644 --- a/epmet-openapi/epmet-openapi-scan/pom.xml +++ b/epmet-openapi/epmet-openapi-scan/pom.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.3.23 + 0.3.24 epmet-openapi-scan jar From 4a382f7c3c9351b4e1fa42c10f5a131b29cb5c29 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 09:59:45 +0800 Subject: [PATCH 106/157] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E4=BB=B6=E7=B1=BB=E5=9E=8B=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/enums/EventEnum.java | 46 +++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java new file mode 100644 index 0000000000..679307bbf7 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java @@ -0,0 +1,46 @@ +package com.epmet.commons.tools.enums; + +/** + * 系统支持的事件枚举类 + * + * @author jianjun liu + * @date 2020-07-03 11:14 + **/ +public enum EventEnum { + ACTIVE_SEND_POINT("active_send_point", "epmet_heart", "活动发放积分"), + REGISTER_VOLUNTEER("register_volunteer", "epmet_heart", "认证志愿者"), + ; + + private String eventClass; + private String eventCode; + private String eventDesc; + + + EventEnum(String eventCode, String eventClass, String eventDesc) { + this.eventCode = eventCode; + this.eventClass = eventClass; + this.eventDesc = eventDesc; + } + + public static EventEnum getEnum(String code) { + EventEnum[] values = EventEnum.values(); + for (EventEnum value : values) { + if (code != null && value.getEventCode().equals(code)) { + return value; + } + } + return null; + } + + public String getEventCode() { + return eventCode; + } + + public String getEventClass() { + return eventClass; + } + + public String getEventDesc() { + return eventDesc; + } +} From ba3aeb55cb7952ef6339d18964c7de3a48b3e50e Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 10:02:03 +0800 Subject: [PATCH 107/157] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E4=BB=B6=E7=B1=BB=E5=9E=8B=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/commons/tools/enums/EventEnum.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java index 679307bbf7..7211406134 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java @@ -22,10 +22,10 @@ public enum EventEnum { this.eventDesc = eventDesc; } - public static EventEnum getEnum(String code) { + public static EventEnum getEnum(String eventCode) { EventEnum[] values = EventEnum.values(); for (EventEnum value : values) { - if (code != null && value.getEventCode().equals(code)) { + if (eventCode != null && value.getEventCode().equals(eventCode)) { return value; } } From f8830603f446a9044885d76855ce93a0f62729b7 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 10:07:08 +0800 Subject: [PATCH 108/157] =?UTF-8?q?=E7=B3=BB=E7=BB=9F=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E4=BB=B6=E7=B1=BB=E5=9E=8B=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/enums/EventEnum.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java index 7211406134..e1fc5cf810 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java @@ -12,12 +12,12 @@ public enum EventEnum { ; private String eventClass; - private String eventCode; + private String eventTag; private String eventDesc; - EventEnum(String eventCode, String eventClass, String eventDesc) { - this.eventCode = eventCode; + EventEnum(String eventTag, String eventClass, String eventDesc) { + this.eventTag = eventTag; this.eventClass = eventClass; this.eventDesc = eventDesc; } @@ -25,15 +25,15 @@ public enum EventEnum { public static EventEnum getEnum(String eventCode) { EventEnum[] values = EventEnum.values(); for (EventEnum value : values) { - if (eventCode != null && value.getEventCode().equals(eventCode)) { + if (eventCode != null && value.getEventTag().equals(eventCode)) { return value; } } return null; } - public String getEventCode() { - return eventCode; + public String getEventTag() { + return eventTag; } public String getEventClass() { From 2dd2c7fd113981b356c4b0314cd04ae756289c83 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 27 Jul 2020 10:24:42 +0800 Subject: [PATCH 109/157] =?UTF-8?q?heart-work:=E7=A7=AF=E5=88=86=E5=8F=91?= =?UTF-8?q?=E6=94=BE=E6=B7=BB=E5=8A=A0=E6=B6=88=E6=81=AF=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/constant/MqConstant.java | 20 ++++++ .../form/mq/eventmsg/ActPointEventMsg.java | 18 +++++ .../work/CanceledActDetailResultDTO.java | 8 +++ .../work/FinishedActDetailResultDTO.java | 7 ++ .../work/InProgressActDetailResultDTO.java | 9 +++ .../epmet/constant/ActMessageConstant.java | 2 + .../service/impl/WorkActServiceImpl.java | 68 ++++++++++++++++++- .../src/main/resources/mapper/ActInfoDao.xml | 9 ++- 8 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java new file mode 100644 index 0000000000..8ccaba98b4 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/MqConstant.java @@ -0,0 +1,20 @@ +package com.epmet.commons.tools.constant; + +/** + * 消息常亮 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/27 9:58 + */ +public interface MqConstant { + + /** + * 加分 plus + */ + String PLUS="plus"; + + /** + * 减分标识 minus + */ + String MINUS="minus"; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java new file mode 100644 index 0000000000..60db245a07 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/mq/eventmsg/ActPointEventMsg.java @@ -0,0 +1,18 @@ +package com.epmet.commons.tools.dto.form.mq.eventmsg; + +import lombok.Data; + +/** + * 结束活动,发放活动积分消息体 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/27 9:26 + */ +@Data +public class ActPointEventMsg extends BasePointEventMsg{ + /** + * 参与活动的备注 + */ + private String remark; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java index a361a5511e..3239a78ced 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/CanceledActDetailResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.result.work; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -94,6 +95,13 @@ public class CanceledActDetailResultDTO implements Serializable { * 活动详情 */ private List actContent; + /** + * true,我发布的,false,其他人发布的 + */ + private Boolean isMyPublish; + + @JsonIgnore + private String createdBy; @Override public String toString() { diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java index dceee4956d..5e9d4a991d 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/FinishedActDetailResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.result.work; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -105,5 +106,11 @@ public class FinishedActDetailResultDTO implements Serializable { */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") private Date actualEndTime; + /** + * true,我发布的,false,其他人发布的 + */ + private Boolean isMyPublish; + @JsonIgnore + private String createdBy; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java index c1c0ed4515..cc9e66a9bf 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/InProgressActDetailResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.result.work; import com.fasterxml.jackson.annotation.JsonFormat; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -89,4 +90,12 @@ public class InProgressActDetailResultDTO implements Serializable { * 活动详情 */ private List actContent; + + /** + * true,我发布的,false,其他人发布的 + */ + private Boolean isMyPublish; + + @JsonIgnore + private String createdBy; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java index b7bf8cce40..c025257c6f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java @@ -20,4 +20,6 @@ public interface ActMessageConstant { * 活动被取消,给已经通过审核的居民端用户,发送消息 */ String ACT_CANCELED="您报名的活动%s,已取消,原因:%s"; + + String ACT_POINTS_EVENT_REMARK="参与%s"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 3c6407fb1c..98313d7d6c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -1,8 +1,14 @@ package com.epmet.service.impl; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; +import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.scan.param.ImgScanParamDTO; @@ -24,6 +30,7 @@ import com.epmet.dto.result.work.*; import com.epmet.entity.ActContentEntity; import com.epmet.entity.ActInfoEntity; import com.epmet.entity.ActOperationRecEntity; +import com.epmet.entity.ActUserRelationEntity; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.service.*; @@ -566,6 +573,11 @@ public class WorkActServiceImpl implements WorkActService { CanceledActDetailResultDTO canceledActDetailResultDTO=actInfoDao.selectCanceledActInfo(actId); if(null!=canceledActDetailResultDTO){ canceledActDetailResultDTO.setActContent(actContentDao.selectByActId(actId)); + if(canceledActDetailResultDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + canceledActDetailResultDTO.setIsMyPublish(true); + }else{ + canceledActDetailResultDTO.setIsMyPublish(false); + } } return canceledActDetailResultDTO; } @@ -604,6 +616,11 @@ public class WorkActServiceImpl implements WorkActService { if (null != resultDTO) { List list = actContentDao.selectByActId(formDTO.getActId()); resultDTO.setActContent(list); + if(resultDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + resultDTO.setIsMyPublish(true); + }else{ + resultDTO.setIsMyPublish(false); + } } return resultDTO; } @@ -621,6 +638,11 @@ public class WorkActServiceImpl implements WorkActService { if (null != resultDTO) { List list = actContentDao.selectByActId(actId); resultDTO.setActContent(list); + if(resultDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + resultDTO.setIsMyPublish(true); + }else{ + resultDTO.setIsMyPublish(false); + } } return resultDTO; } @@ -646,7 +668,51 @@ public class WorkActServiceImpl implements WorkActService { this.saveActOperationRec(actId); //生成统计表 this.saveActStatistical(actId); - //发放积分调用事件 TODO + //发放积分调用事件 + if(actInfoDTO.getReward()>0){ + this.grantActPoints(actInfoDTO); + } + } + + private void grantActPoints(ActInfoDTO actInfoDTO) { + //查询已经给分的用户 + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(actInfoDTO.getId()), FieldConstant.ID, actInfoDTO.getId()) + .eq("PROCESS_FLAG",ActConstant.HANDLED) + .eq("REWARD_FLAG",ActConstant.ACT_USER_STATUS_AGREE); + List actUserRelationEntityList=actUserRelationDao.selectList(wrapper); + if(null==actUserRelationEntityList||actUserRelationEntityList.size()<1){ + logger.info("不存在给分的记录,无需发送消息时间"); + return; + } + Result userResult=govOrgOpenFeignClient.getAgencyByStaff(loginUserUtil.getLoginUserId()); + if(!userResult.success()||null==userResult.getData()){ + logger.error(String.format("根据staffId查询所属的组织机构失败,staffId=%s",loginUserUtil.getLoginUserId())); + } + String opAgencyId=userResult.getData().getId(); + String remark=String.format(ActMessageConstant.ACT_POINTS_EVENT_REMARK,actInfoDTO.getTitle()); + MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); + //mq的事件类型 + mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_SEND_POINT.getEventClass()); + //事件code + mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_SEND_POINT.getEventTag()); + List actPointEventMsgList=new ArrayList<>(); + for(ActUserRelationEntity actUserRelationEntity:actUserRelationEntityList){ + ActPointEventMsg actPointEventMsg=new ActPointEventMsg(); + actPointEventMsg.setOpAgencyId(opAgencyId); + actPointEventMsg.setCustomerId(actInfoDTO.getCustomerId()); + actPointEventMsg.setUserId(actUserRelationEntity.getUserId()); + actPointEventMsg.setActionFlag(MqConstant.PLUS); + actPointEventMsg.setPoint(actInfoDTO.getReward()); + actPointEventMsg.setIsCommon(true); + actPointEventMsg.setRemark(remark); + actPointEventMsgList.add(actPointEventMsg); + } + mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); + Result result=SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + if(!result.success()){ + logger.error("活动积分发放失败"); + } } private void updateHeartUserInfo(ActInfoDTO actInfoDTO) { diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 644e5864f4..4d54cbd05e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -597,7 +597,8 @@ ai.SPONSOR_NAME AS sponsorName, ai.REQUIREMENT AS requirement, ai.CANCEL_TIME AS cancelTime, - ai.CANCEL_REASON AS cancelReason + ai.CANCEL_REASON AS cancelReason, + ai.CREATED_BY as createdBy FROM act_info ai WHERE @@ -625,7 +626,8 @@ ai.REQUIREMENT AS requirement, AI.SUMMARY_FLAG AS summaryFlag, AI.ACTUAL_START_TIME AS actualStartTime, - AI.ACTUAL_END_TIME AS actualEndTime + AI.ACTUAL_END_TIME AS actualEndTime, + ai.CREATED_BY as createdBy FROM act_info ai WHERE @@ -649,7 +651,8 @@ ai.SPONSOR_TEL AS sponsorTel, ai.REWARD AS reward, ai.SPONSOR_NAME AS sponsorName, - ai.REQUIREMENT AS requirement + ai.REQUIREMENT AS requirement, + ai.CREATED_BY as createdBy FROM act_info ai WHERE From c219e036f9f4770b2348114b0905ce2af3ad3470 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 27 Jul 2020 10:26:31 +0800 Subject: [PATCH 110/157] =?UTF-8?q?heart-work:=E7=A7=AF=E5=88=86=E5=8F=91?= =?UTF-8?q?=E6=94=BE=E6=B7=BB=E5=8A=A0=E6=B6=88=E6=81=AF=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?remark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/WorkActServiceImpl.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 98313d7d6c..33e5c1f463 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -685,11 +685,13 @@ public class WorkActServiceImpl implements WorkActService { logger.info("不存在给分的记录,无需发送消息时间"); return; } + //查询当前用户所属组织信息 Result userResult=govOrgOpenFeignClient.getAgencyByStaff(loginUserUtil.getLoginUserId()); if(!userResult.success()||null==userResult.getData()){ logger.error(String.format("根据staffId查询所属的组织机构失败,staffId=%s",loginUserUtil.getLoginUserId())); } String opAgencyId=userResult.getData().getId(); + //备注 String remark=String.format(ActMessageConstant.ACT_POINTS_EVENT_REMARK,actInfoDTO.getTitle()); MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); //mq的事件类型 From 7474d058c30d506a54cb1b4660e1b2cee13558e4 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 27 Jul 2020 10:28:44 +0800 Subject: [PATCH 111/157] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/utils/DateUtils.java | 14 ++-- .../tools/utils/HttpClientManager.java | 39 ++++++----- .../utils/InputStreamResponseHandler.java | 33 ---------- .../tools/utils/Utf8ResponseHandler.java | 33 ---------- .../epmet-oss/epmet-oss-client/pom.xml | 15 +++++ .../epmet/service/impl/CodeServiceImpl.java | 20 +++--- .../java/com/epmet/wxapi/param/WxExtJson.java | 66 +++++++++++++++++++ .../epmet/wxapi/service/WxMaCodeService.java | 2 +- .../service/impl/WxMaCodeServiceImpl.java | 11 ++-- 9 files changed, 122 insertions(+), 111 deletions(-) delete mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/InputStreamResponseHandler.java delete mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Utf8ResponseHandler.java create mode 100644 epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java index f79b22ccb5..f60e8fd2d7 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DateUtils.java @@ -341,12 +341,12 @@ public class DateUtils { return DateUtils.addDateDays(nextMonth, -1); } - public static void main(String[] args) { - //int weekOfYear = getWeekOfYear(new Date()); - String format = String.format("%02d", 9); - - System.out.println(666); - } +// public static void main(String[] args) { +// //int weekOfYear = getWeekOfYear(new Date()); +// String format = String.format("%02d", 9); +// +// System.out.println(666); +// } /** * 获取日期前一天 @@ -485,7 +485,7 @@ public class DateUtils { public static String formatTimestamp(Long timestamp, String pattern) { //设置格式 SimpleDateFormat format = new SimpleDateFormat(pattern); - return format.format(timestamp); + return format.format(timestamp * 1000); } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java index 50ba1643c8..3b6bc9a999 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/HttpClientManager.java @@ -6,10 +6,10 @@ import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import lombok.extern.slf4j.Slf4j; import org.apache.commons.codec.binary.Base64; -import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; -import org.apache.http.*; -import org.apache.http.client.HttpResponseException; +import org.apache.http.HttpEntity; +import org.apache.http.HttpStatus; +import org.apache.http.NameValuePair; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.CloseableHttpResponse; @@ -29,6 +29,7 @@ import org.springframework.util.CollectionUtils; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -38,7 +39,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.UUID; /** * desc: http 工具类 @@ -243,6 +243,7 @@ public class HttpClientManager { return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } + /** * desc: 发送get请求 * param:url, params @@ -251,7 +252,7 @@ public class HttpClientManager { * * @author: jianjun liu */ - public Result sendGetFile(String url, Map params) { + public Result getByteArray(String url, Map params) { try { URIBuilder builder = new URIBuilder(url); @@ -266,35 +267,33 @@ public class HttpClientManager { return executeToByte(httpGet); } catch (Exception e) { log.error("sendGet exception", e); - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } } - private Result executeToByte(HttpRequestBase httpMethod) { + private Result executeToByte(HttpRequestBase httpMethod) { CloseableHttpResponse response = null; try { response = httpclient.execute(httpMethod); log.debug("http send response:{}", JSON.toJSONString(response)); if (response != null && response.getStatusLine() != null) { if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { - InputStream inputStream = InputStreamResponseHandler.INSTANCE.handleResponse(response); - Header[] contentTypeHeader = response.getHeaders("Content-Type"); - if (contentTypeHeader != null && contentTypeHeader.length > 0) { - // 出错 - if (ContentType.TEXT_PLAIN.getMimeType() - .equals(ContentType.parse(contentTypeHeader[0].getValue()).getMimeType())) { - String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); - } - } - File file = FileUtils.createTmpFile(inputStream, UUID.randomUUID().toString(), "jpg"); - return new Result().ok(file); + InputStream in = response.getEntity().getContent(); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buffer = new byte[4096]; + int n = 0; + while (-1 != (n = in.read(buffer))) { + output.write(buffer, 0, n); + } +// return new Result().ok(ArrayUtils.toObject(output.toByteArray())); + return new Result().ok(output.toByteArray()); } else { log.warn("execute http method fail,httpStatus:{0}", response.getStatusLine().getStatusCode()); } } } catch (Exception e) { log.error("execute exception", e); - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage()); } finally { httpMethod.releaseConnection(); try { @@ -304,7 +303,7 @@ public class HttpClientManager { } catch (IOException e) { } } - return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); + return new Result().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg()); } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/InputStreamResponseHandler.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/InputStreamResponseHandler.java deleted file mode 100644 index 75c16053fb..0000000000 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/InputStreamResponseHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.epmet.commons.tools.utils; - -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.StatusLine; -import org.apache.http.client.HttpResponseException; -import org.apache.http.client.ResponseHandler; -import org.apache.http.util.EntityUtils; - -import java.io.IOException; -import java.io.InputStream; - -/** - * 输入流响应处理器. - * - * @author Daniel Qian - */ -public class InputStreamResponseHandler implements ResponseHandler { - public static final ResponseHandler INSTANCE = new InputStreamResponseHandler(); - private static final int STATUS_CODE_300 = 300; - - @Override - public InputStream handleResponse(final HttpResponse response) throws IOException { - final StatusLine statusLine = response.getStatusLine(); - final HttpEntity entity = response.getEntity(); - if (statusLine.getStatusCode() >= STATUS_CODE_300) { - EntityUtils.consume(entity); - throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase()); - } - return entity == null ? null : entity.getContent(); - } - -} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Utf8ResponseHandler.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Utf8ResponseHandler.java deleted file mode 100644 index 107dc3cbdf..0000000000 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/Utf8ResponseHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.epmet.commons.tools.utils; - -import org.apache.http.Consts; -import org.apache.http.HttpEntity; -import org.apache.http.HttpResponse; -import org.apache.http.StatusLine; -import org.apache.http.client.HttpResponseException; -import org.apache.http.client.ResponseHandler; -import org.apache.http.util.EntityUtils; - -import java.io.IOException; - -/** - * copy from {@link org.apache.http.impl.client.BasicResponseHandler} - * - * @author Daniel Qian - */ -public class Utf8ResponseHandler implements ResponseHandler { - - public static final ResponseHandler INSTANCE = new Utf8ResponseHandler(); - - @Override - public String handleResponse(final HttpResponse response) throws IOException { - final StatusLine statusLine = response.getStatusLine(); - final HttpEntity entity = response.getEntity(); - if (statusLine.getStatusCode() >= 300) { - EntityUtils.consume(entity); - throw new HttpResponseException(statusLine.getStatusCode(), statusLine.toString()); - } - return entity == null ? null : EntityUtils.toString(entity, Consts.UTF_8); - } - -} diff --git a/epmet-module/epmet-oss/epmet-oss-client/pom.xml b/epmet-module/epmet-oss/epmet-oss-client/pom.xml index e88c7004ce..8a27707939 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-client/pom.xml @@ -26,6 +26,21 @@ io.springfox springfox-swagger-ui + + io.github.openfeign.form + feign-form + 3.8.0 + + + io.github.openfeign.form + feign-form-spring + 3.8.0 + + + commons-fileupload + commons-fileupload + 1.3.3 + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index aa2076ec75..18221f298e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -373,17 +373,13 @@ public class CodeServiceImpl implements CodeService { //获取小程序调用令牌 AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); //调用微信API获取获取体验版二维码 - WxResult wxResult = wxMaCodeService.getQrCode(authInfo.getAuthorizerAccessToken(), formDTO.getPath()); + WxResult wxResult = wxMaCodeService.getQrCode(authInfo.getAuthorizerAccessToken(), formDTO.getPath()); QrCodeDTO qrCodeDTO = new QrCodeDTO(); - try { - qrCodeDTO.setQrCode(Files.readAllBytes(wxResult.getData().toPath())); - Result uploadResult = ossFeignClient.uploadQrCode(qrCodeDTO); - codeCustomerDTO.setQrCode(uploadResult.getData().getUrl()); - codeCustomerService.update(codeCustomerDTO); - result.setQrcode(uploadResult.getData().getUrl()); - } catch (Exception e) { - throw new RenException(e.getMessage()); - } + qrCodeDTO.setQrCode(wxResult.getData()); + Result uploadResult = ossFeignClient.uploadQrCode(qrCodeDTO); + codeCustomerDTO.setQrCode(uploadResult.getData().getUrl()); + codeCustomerService.update(codeCustomerDTO); + result.setQrcode(uploadResult.getData().getUrl()); if (!wxResult.success()) { throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); } @@ -405,8 +401,8 @@ public class CodeServiceImpl implements CodeService { try { QrCodeDTO dto = new QrCodeDTO(); dto.setMedia(formDTO.getMedia()); - Result uploadDTOResult = ossFeignClient.uploadWxImg(dto); - File file = new File(uploadDTOResult.getData().getUrl()); + Result uploadWxImg = ossFeignClient.uploadWxImg(dto); + File file = new File(uploadWxImg.getData().getUrl()); //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); //获取小程序调用令牌 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java new file mode 100644 index 0000000000..13441e4573 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java @@ -0,0 +1,66 @@ +package com.epmet.wxapi.param; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/7/27 9:19 + */ +@NoArgsConstructor +@Data +public class WxExtJson implements Serializable { + + private static final long serialVersionUID = -559311391779774945L; + + private boolean extEnable; + private String extAppid; + private boolean directCommit; + private ExtBean ext; + + @NoArgsConstructor + @Data + private static class ExtBean { + private String extAppid; + private FootbarBean footbar; + @NoArgsConstructor + @Data + private static class FootbarBean { + private WorkBean work; + private OrgBean org; + private DataBean data; + private FindBean find; + + @NoArgsConstructor + @Data + private static class WorkBean { + private String name; + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class OrgBean { + private String name; + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class DataBean { + private String name; + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class FindBean { + private String name; + private String pageTile; + } + } + } +} diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java index eea4649219..dca678a55e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/WxMaCodeService.java @@ -48,7 +48,7 @@ public interface WxMaCodeService { * @author zhaoqifeng * @date 2020/7/10 15:25 */ - WxResult getQrCode(String accessToken, String path); + WxResult getQrCode(String accessToken, String path); /** * 获取授权小程序帐号的可选类目. diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java index 5808634523..97f7cac543 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/service/impl/WxMaCodeServiceImpl.java @@ -70,17 +70,18 @@ public class WxMaCodeServiceImpl implements WxMaCodeService { } @Override - public WxResult getQrCode(String accessToken, String path) { - WxResult result = new WxResult<>(); - StringBuilder url = new StringBuilder(WxMaCodeConstant.GET_QRCODE_URL).append("?access_token").append(accessToken); + public WxResult getQrCode(String accessToken, String path) { + WxResult result = new WxResult<>(); + StringBuilder url = new StringBuilder(WxMaCodeConstant.GET_QRCODE_URL).append("?access_token=").append(accessToken); if (StringUtils.isNotBlank(path)) { try { - url.append("?path=").append(URLEncoder.encode(path, StandardCharsets.UTF_8.name())); + url.append("&path=").append(URLEncoder.encode(path, StandardCharsets.UTF_8.name())); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } - Result qrCodeResult = HttpClientManager.getInstance().sendGetFile(url.toString(), null); + Result qrCodeResult = HttpClientManager.getInstance().getByteArray(url.toString(), null); + if (!qrCodeResult.success()) { result.setErrorCode(qrCodeResult.getCode()); result.setErrorMsg(WxMaErrorMsgEnum.findMsgByCode(qrCodeResult.getCode())); From a6c0d9a46630122bc4a793a7e25b072dfe30ff2b Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 27 Jul 2020 10:32:32 +0800 Subject: [PATCH 112/157] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-oss/epmet-oss-server/pom.xml | 2 +- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml index 3cfb7ad834..6460e6170d 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-oss/epmet-oss-server/deploy/docker-compose-dev.yml @@ -3,7 +3,7 @@ services: epmet-oss-server: container_name: epmet-oss-server-dev # image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-dev/epmet-oss-server:0.3.2 - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.22 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-oss-server:0.3.23 ports: - "8083:8083" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-oss/epmet-oss-server/pom.xml b/epmet-module/epmet-oss/epmet-oss-server/pom.xml index 36377c819b..1b8463505e 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/pom.xml +++ b/epmet-module/epmet-oss/epmet-oss-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.22 + 0.3.23 com.epmet epmet-oss diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index cb770c9a05..0a0fadd18c 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.58 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.59 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 3677cfa944..a3979e03f0 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.58 + 0.0.59 com.epmet From 292b3b33c9c6b816fd8b23c2e07836ddedb599fc Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Mon, 27 Jul 2020 10:37:33 +0800 Subject: [PATCH 113/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E6=8E=88=E6=9D=83=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/CustomerMpDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml index 9c3c48b996..2024c79005 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/CustomerMpDao.xml @@ -21,7 +21,7 @@ SELECT - pc.id AS "customerId", - pc.customer_name AS "customerName" + id AS "customerId", + customer_name AS "customerName" FROM - pa_customer pc - INNER JOIN customer_mp cm ON pc.id = cm.customer_id + pa_customer WHERE - pc.del_flag = '0' - AND cm.del_flag = '0' - AND pc.is_initialize = #{initState} - - AND cm.client = #{client} - AND cm.AUTHORIZATION_FLAG = #{resiAuth} - - - AND cm.client = #{client} - AND cm.AUTHORIZATION_FLAG = #{workAuth} + del_flag = '0' + + AND is_initialize = #{initState} From 46dc697164776fbacca737cb48730f9b9d71df2a Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 27 Jul 2020 12:26:08 +0800 Subject: [PATCH 119/157] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index e0b9b311eb..d0df7785ea 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.61 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.62 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 13a33b987a..8a96e2c6af 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.61 + 0.0.62 com.epmet From 2523e7ffb36b335d438738fd10a7dc216f668ca7 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Mon, 27 Jul 2020 13:38:01 +0800 Subject: [PATCH 120/157] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF-=E5=A2=9E=E5=8A=A0=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=8F=91=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/enums/EventEnum.java | 1 + .../form/resi/ResiActInsertLiveFormDTO.java | 6 +++ .../dto/form/resi/ResiActSignInFormDTO.java | 6 +++ .../epmet/constant/ActMessageConstant.java | 10 +++++ .../service/impl/ActLiveRecServiceImpl.java | 36 ++++++++++++++++ .../impl/ActUserRelationServiceImpl.java | 2 +- .../impl/VolunteerInfoServiceImpl.java | 43 ++++++++++++++++++- .../com/epmet/utils/ValidityVerification.java | 2 +- .../src/main/resources/mapper/ActInfoDao.xml | 17 +++++--- 9 files changed, 112 insertions(+), 11 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java index e1fc5cf810..68347c29f9 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/EventEnum.java @@ -9,6 +9,7 @@ package com.epmet.commons.tools.enums; public enum EventEnum { ACTIVE_SEND_POINT("active_send_point", "epmet_heart", "活动发放积分"), REGISTER_VOLUNTEER("register_volunteer", "epmet_heart", "认证志愿者"), + ACTIVE_INSERT_LIVE("active_insert_live", "epmet_heart", "添加活动实况"), ; private String eventClass; diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java index 42ee3576fe..54182f0da3 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActInsertLiveFormDTO.java @@ -95,4 +95,10 @@ public class ResiActInsertLiveFormDTO implements Serializable { * id */ private String id; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class }) + private String customerId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java index 54363137f7..69c1486c7f 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/resi/ResiActSignInFormDTO.java @@ -96,4 +96,10 @@ public class ResiActSignInFormDTO implements Serializable { * 用户id */ private String userId; + + /** + * 客户id + */ + @NotBlank(message = "客户id不能为空", groups = {AddUserShowGroup.class }) + private String customerId; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java index c025257c6f..ac8ba13bfc 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java @@ -22,4 +22,14 @@ public interface ActMessageConstant { String ACT_CANCELED="您报名的活动%s,已取消,原因:%s"; String ACT_POINTS_EVENT_REMARK="参与%s"; + + /** + * 居民端-用户认证志愿者,发送消息 + */ + String POINTS_EVENT_VOLUNTEER_AUTHENTICATE="用户%s,认证志愿者"; + + /** + * 居民端-添加实况,发送消息 + */ + String ACT_POINTS_EVENT_VOLUNTEER_LIVE="用户%s,添加活动实况,活动:%s"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java index 45e15e53e6..1eb66ab5f8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java @@ -17,10 +17,17 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; +import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SendMqMsgUtils; +import com.epmet.constant.ActMessageConstant; import com.epmet.dao.ActLivePicDao; import com.epmet.dao.ActLiveRecDao; import com.epmet.dto.ActLivePicDTO; @@ -34,6 +41,8 @@ import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.ActLiveRecRedis; import com.epmet.service.ActLiveRecService; import com.epmet.utils.ValidityVerification; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -48,6 +57,7 @@ import java.util.*; */ @Service public class ActLiveRecServiceImpl extends BaseServiceImpl implements ActLiveRecService { + private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class); @Autowired private ActLiveRecRedis actLiveRecRedis; @@ -121,6 +131,32 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl().ok(uuid); } + + private void grantActPoints(ResiActInsertLiveFormDTO formDTO){ + //备注 + String remark=String.format(ActMessageConstant.ACT_POINTS_EVENT_VOLUNTEER_LIVE,formDTO.getUserId(),formDTO.getActId()); + MqBaseMsgDTO mqBaseMsgDTO=new MqBaseMsgDTO(); + //mq的事件类型 + mqBaseMsgDTO.setEventClass(EventEnum.ACTIVE_INSERT_LIVE.getEventClass()); + //事件code + mqBaseMsgDTO.setEventTag(EventEnum.ACTIVE_INSERT_LIVE.getEventTag()); + List actPointEventMsgList=new ArrayList<>(); + ActPointEventMsg actPointEventMsg=new ActPointEventMsg(); + actPointEventMsg.setCustomerId(formDTO.getCustomerId()); + actPointEventMsg.setUserId(formDTO.getUserId()); + actPointEventMsg.setActionFlag(MqConstant.PLUS); + actPointEventMsg.setIsCommon(false); + actPointEventMsg.setRemark(remark); + actPointEventMsgList.add(actPointEventMsg); + + mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); + Result result= SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + if(!result.success()){ + logger.error("添加活动实况,事件发送失败"); + } + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java index 53bc8a11f0..dbdb98eee5 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java @@ -202,7 +202,7 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl0 当前用户是志愿者 - Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getActId()); + Integer volunteerFlag = volunteerInfoDao.queryVolunteerFlagByUserId(formDTO.getUserId()); if (actInfoDTO.getVolunteerLimit()){ // 活动只能志愿者参加, 当前用户是否满足条件 satisfy = this.volunteerParticipationAct(volunteerFlag); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java index 3429acbb2f..182da8e261 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java @@ -17,24 +17,37 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.MqConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.dto.form.mq.MqBaseMsgDTO; +import com.epmet.commons.tools.dto.form.mq.eventmsg.ActPointEventMsg; +import com.epmet.commons.tools.enums.EventEnum; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SendMqMsgUtils; +import com.epmet.constant.ActMessageConstant; import com.epmet.dao.VolunteerInfoDao; import com.epmet.dto.HeartUserInfoDTO; import com.epmet.dto.form.WxUserInfoFormDTO; import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO; +import com.epmet.entity.ActUserRelationEntity; import com.epmet.entity.VolunteerInfoEntity; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.redis.VolunteerInfoRedis; import com.epmet.service.HeartUserInfoService; import com.epmet.service.VolunteerInfoService; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; +import java.util.List; + /** * 志愿者信息 * @@ -43,6 +56,7 @@ import org.springframework.transaction.annotation.Transactional; */ @Service public class VolunteerInfoServiceImpl extends BaseServiceImpl implements VolunteerInfoService { + private Logger logger = LogManager.getLogger(VolunteerInfoServiceImpl.class); @Autowired private VolunteerInfoRedis volunteerInfoRedis; @@ -66,17 +80,42 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl actPointEventMsgList=new ArrayList<>(); + ActPointEventMsg actPointEventMsg=new ActPointEventMsg(); + actPointEventMsg.setCustomerId(formDTO.getCustomerId()); + actPointEventMsg.setUserId(formDTO.getUserId()); + actPointEventMsg.setActionFlag(MqConstant.PLUS); + actPointEventMsg.setIsCommon(false); + actPointEventMsg.setRemark(remark); + actPointEventMsgList.add(actPointEventMsg); + + mqBaseMsgDTO.setMsg(JSON.toJSONString(actPointEventMsgList)); + Result result= SendMqMsgUtils.sendMsg(mqBaseMsgDTO); + if(!result.success()){ + logger.error("志愿者认证事件发送失败"); + } + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java index 48deaa99b9..4bb60ab49f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/utils/ValidityVerification.java @@ -71,7 +71,7 @@ public class ValidityVerification { * @Date 14:42 2020-07-15 **/ public void imgScanVerification(List imgList, String businessEnum){ - if (NumConstant.ZERO != imgList.size()){ + if (null != imgList && NumConstant.ZERO != imgList.size()){ ImgScanParamDTO imgScanParamDTO = new ImgScanParamDTO(); imgList.forEach(url -> { ImgTaskDTO task = new ImgTaskDTO(); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml index 4d54cbd05e..784972957b 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActInfoDao.xml @@ -66,9 +66,10 @@ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND (re.`STATUS` = 'auditing' OR re.`STATUS` = 'passed') GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND i.ACT_STATUS = 'published' + AND = ]]> NOW() -- 报名截止时间 >= 当前时间 AND (i.ACT_QUOTA_CATEGORY = 0 OR i.ACT_QUOTA > IFNULL(c.signupNum, 0)) -- 不限名额或者报名人数未报满 AND i.CUSTOMER_ID = #{customerId} ORDER BY i.ACT_QUOTA_CATEGORY DESC,i.CREATED_TIME DESC @@ -91,9 +92,10 @@ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND (re.`STATUS` = 'auditing' OR re.`STATUS` = 'passed') GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND i.ACT_STATUS = 'published' + AND = ]]> NOW() -- 报名截止时间 >= 当前时间 AND i.ACT_QUOTA_CATEGORY = 1 -- 固定名额 AND i.ACT_QUOTA = IFNULL(c.signupNum, 0) -- 名额已满 AND i.CUSTOMER_ID = #{customerId} @@ -117,7 +119,7 @@ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND (re.`STATUS` = 'auditing' OR re.`STATUS` = 'passed') GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' -- 活动开始时间 > 当前时间 并且 报名截止时间 < 当前时间 报名已结束,活动未开始 未开始 AND ( ]]> NOW() AND NOW() ) @@ -143,10 +145,10 @@ IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名) FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` = 'passed' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' -- 活动开始时间 <= 当前时间 并且活动结束时间 >= 当前时间 进行中 - AND ( NOW() AND = ]]> NOW() ) + AND ( NOW() AND = ]]> NOW() ) AND i.ACT_STATUS != 'canceled' AND i.CUSTOMER_ID = #{customerId} ORDER BY i.CREATED_TIME DESC @@ -169,9 +171,10 @@ IF(u.USER_ID = #{userId},'1','0') as signupFlag -- 用户报名状态(0-未报名,1已报名) FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` = 'passed' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' - AND i.ACT_STATUS = 'finished' + AND i.ACT_STATUS != 'canceled' + AND NOW() AND i.CUSTOMER_ID = #{customerId} ORDER BY i.CREATED_TIME DESC LIMIT #{pageNo}, #{pageSize} From 77690bca12070083f2e7740a5234303818b59f58 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 27 Jul 2020 13:43:27 +0800 Subject: [PATCH 121/157] =?UTF-8?q?heart-work:=E9=87=8D=E6=96=B0=E7=BC=96?= =?UTF-8?q?=E8=BE=91-=E8=8E=B7=E5=8F=96=E6=B4=BB=E5=8A=A8=E8=AF=A6?= =?UTF-8?q?=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/work/ReEditActInfoResultDTO.java | 151 ++++++++++++++++++ .../epmet/controller/WorkActController.java | 13 ++ .../com/epmet/service/WorkActService.java | 9 ++ .../service/impl/WorkActServiceImpl.java | 24 +++ 4 files changed, 197 insertions(+) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java new file mode 100644 index 0000000000..a0191a6f3a --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java @@ -0,0 +1,151 @@ +package com.epmet.dto.result.work; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 重新编辑-获取活动详情 + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/27 11:14 + */ +@Data +public class ReEditActInfoResultDTO implements Serializable { + private static final long serialVersionUID = 512857031034752008L; + + /** + * 活动id + */ + private String actId; + + /** + * 活动标题 + */ + private String title; + + /** + * 封面图地址 + */ + private String coverPic; + + /** + * 活动地址 + */ + private String actAddress; + + /** + * 活动地址-经度 + */ + private BigDecimal actLongitude; + + /** + *活动地址-维度 + */ + private BigDecimal actLatitude; + /** + * 活动预计开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actStartTime; + + /** + * 活动预计结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date actEndTime; + + /** + * 活动人数 + */ + private Integer actQuota; + /** + * 活动积分 + */ + private Integer reward; + /** + * 身份限制:1只有志愿者才可以参加活动0不限制志愿者身份 + */ + private Boolean volunteerLimit; + + /** + * 审核开关:1报名人员需要人工审核0不需要 + */ + private Boolean auditSwitch; + + /** + * 报名截止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signUpEndTime; + /** + * 报名条件 + */ + private String requirement; + + /** + * 打卡开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signInStartTime; + + /** + * 打卡签到截止时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date signInEndTime; + + /** + * 活动签到打卡地点 + */ + private String signInAddress; + + /** + * 活动签到打卡位置经度 + */ + private BigDecimal signinLongitude; + + /** + * 活动签到打卡位置纬度 + */ + private BigDecimal signInLatitude; + + /** + * 活动签到打卡半径(单位:米) + */ + private Integer signInRadius; + + /** + * 主办方id(机关或网格的id) + */ + private String sponsorId; + + /** + * 活动主办方名称(机关或网格的名称) + */ + private String sponsorName; + + /** + * 联系人 + */ + private String sponsorContacts; + + /** + * 联系电话 + */ + private String sponsorTel; + + /** + * 发布名义:网格主办:grid;组织主办:agency + */ + private String sponsorType; + + /** + * 活动详情 + */ + private List actContent; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index 4dcdc3a5c1..d1dc5ee508 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -207,4 +207,17 @@ public class WorkActController { workActService.summaryAct(formDTO); return new Result(); } + + /** + * @return com.epmet.commons.tools.utils.Result + * @param formDTO + * @author yinzuomei + * @description 重新编辑-获取活动详情 + * @Date 2020/7/27 13:36 + **/ + @PostMapping("getactinfo") + public Result getActInfo(@RequestBody ActIdFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); + return new Result().ok(workActService.getActInfo(formDTO.getActId())); + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index c2440d3206..b1cb90e829 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -128,4 +128,13 @@ public interface WorkActService { * @Date 2020/7/27 10:45 **/ void summaryAct(SummaryActFormDTO formDTO); + + /** + * @return com.epmet.dto.result.work.ReEditActInfoResultDTO + * @param actId + * @author yinzuomei + * @description 重新编辑-获取活动详情 + * @Date 2020/7/27 13:36 + **/ + ReEditActInfoResultDTO getActInfo(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index dcc8bb902f..2d16b608c2 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -840,4 +840,28 @@ public class WorkActServiceImpl implements WorkActService { actInfoDTO.setSummaryFlag(true); actInfoService.update(actInfoDTO); } + + /** + * @param actId + * @return com.epmet.dto.result.work.ReEditActInfoResultDTO + * @author yinzuomei + * @description 重新编辑-获取活动详情 + * @Date 2020/7/27 13:36 + **/ + @Override + public ReEditActInfoResultDTO getActInfo(String actId) { + ActInfoDTO actInfoDTO=actInfoService.get(actId); + if(null==actInfoDTO){ + logger.error("act_info is null"); + return null; + } + if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + ReEditActInfoResultDTO resultDTO= ConvertUtils.sourceToTarget(actInfoDTO, ReEditActInfoResultDTO.class); + resultDTO.setActId(actId); + List actContent=actContentDao.selectByActId(actId); + resultDTO.setActContent(actContent); + return resultDTO; + } } From 02398634e56dede8c3d33b7980655264e60f1a24 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Mon, 27 Jul 2020 13:45:01 +0800 Subject: [PATCH 122/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-authInfo=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ComponentVerifyTicketServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index 7dd66f3ad7..e46c134759 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -341,15 +341,19 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe Date expiresInTime = this.countExpirationTime(expiresIn); //更新DB AuthorizerAccessTokenFormDTO formDTO = new AuthorizerAccessTokenFormDTO(); - AuthorizationInfoFormDTO authorizationInfo = new AuthorizationInfoFormDTO(); - BeanUtils.copyProperties(formDTO, authorizationInfo); - authorizationInfo.setAuthorizerAppid(authAppId); formDTO.setAuthorizerAccessToken(authorizerAccessToken); formDTO.setAuthorizerRefreshToken(authorizerRefreshToken); formDTO.setExpiresInTime(expiresInTime); formDTO.setCustomerId(customerId); formDTO.setAuthAppid(authAppId); formDTO.setClientType(clientType); + AuthorizationInfoFormDTO authorizationInfo = new AuthorizationInfoFormDTO(); + authorizationInfo.setAuthorizerAppid(authAppId); + authorizationInfo.setClientType(clientType); + authorizationInfo.setCustomerId(customerId); + authorizationInfo.setAuthorizerRefreshToken(authorizerRefreshToken); + authorizationInfo.setAuthorizerAccessToken(authorizerAccessToken); + authorizationInfo.setExpiresInTime(expiresInTime); //先逻辑删除,在插入 authorizationInfoDao.updateOldAuthorizerAccessToken(customerId, clientType); authorizationInfoDao.insertAuthorizerAccessToken(formDTO); From acce1d55573d25cb3744f07d5a13f31bc9b680d9 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Mon, 27 Jul 2020 13:46:53 +0800 Subject: [PATCH 123/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index d0df7785ea..5063585e11 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.62 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.63 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 8a96e2c6af..283c78d2d9 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.62 + 0.0.63 com.epmet From d6b959a3686ce9404a1ce535358f0d36b689b882 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 27 Jul 2020 14:00:43 +0800 Subject: [PATCH 124/157] =?UTF-8?q?=E6=89=8B=E6=9C=BA=E5=8F=B7=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E4=BF=AE=E6=94=B9=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/constant/PaConstant.java | 4 ---- .../java/com/epmet/service/impl/PaCustomerServiceImpl.java | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java index 4651738fd4..bbbf05fa68 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java @@ -6,10 +6,6 @@ package com.epmet.constant; */ public interface PaConstant { - /** - * 手机号注册 - */ - String PHONE_EXCEPTION = "手机号已存在,不允许再次注册"; /** * 更新用户信息失败 */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java index 3842ee0e7a..432066c3da 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaCustomerServiceImpl.java @@ -167,7 +167,7 @@ public class PaCustomerServiceImpl extends BaseServiceImpl userList = paUserDao.selectUserByPhone(formDTO.getPhone()); if (null != userList && userList.size() > NumConstant.ZERO) { - throw new RenException(PaConstant.PHONE_EXCEPTION); + throw new RenException(EpmetErrorCode.MOBILE_USED.getCode()); } //2.根据token中的userId查询pa_user表数据,根据手机号是否为空判断后续是新增还是更新user数据 From d5be842ec500547f0caf3c907c5feaeccaf09441 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 27 Jul 2020 14:07:51 +0800 Subject: [PATCH 125/157] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/constant/PaConstant.java | 4 ++++ .../com/epmet/service/impl/PaUserServiceImpl.java | 12 ++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java index bbbf05fa68..c381b4e2f3 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/PaConstant.java @@ -70,4 +70,8 @@ public interface PaConstant { * 获取客户信息失败 */ String SELECT_CUSTOMER_EXCEPTION = "获取客户信息失败"; + /** + * 获取访问记录表数据失败失败 + */ + String SELECT_VISITED_EXCEPTION = "获取访问记录表数据失败"; } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java index 680bf4fec4..d5acc59fb5 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PaUserServiceImpl.java @@ -20,10 +20,12 @@ package com.epmet.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.constant.PaConstant; import com.epmet.dao.PaCustomerDao; import com.epmet.dao.PaUserDao; import com.epmet.dao.PaUserVisitedDao; @@ -41,6 +43,8 @@ import com.epmet.service.PaUserService; import com.epmet.service.PaUserWechatService; import me.chanjar.weixin.mp.bean.result.WxMpUser; import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -57,7 +61,7 @@ import java.util.Map; */ @Service public class PaUserServiceImpl extends BaseServiceImpl implements PaUserService { - + private Logger logger = LogManager.getLogger(PaUserServiceImpl.class); @Autowired private PaUserRedis paUserRedis; @Autowired @@ -170,6 +174,10 @@ public class PaUserServiceImpl extends BaseServiceImpl //2.4、根据openid查询用户登陆访问记录表数据,按登陆时间倒序 PaUserVisitedDTO visitedDTO = paUserVisitedDao.selectByOpenId(wxMpUser.getOpenId()); + if (null == visitedDTO || "".equals(visitedDTO.getUserId())) { + logger.error("根据openid查询用户访问记录表数据失败,openid->"+wxMpUser.getOpenId()); + throw new RenException(PaConstant.SELECT_VISITED_EXCEPTION); + } resultDTO.setUserId(visitedDTO.getUserId()); } From ff8c31c88bd3d81c85180071f31048b7d5c3c10d Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Mon, 27 Jul 2020 14:09:49 +0800 Subject: [PATCH 126/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E9=80=BB=E8=BE=91=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=9B=B4=E6=94=B9=E7=89=A9=E7=90=86=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dao/AuthorizationInfoDao.java | 2 +- .../java/com/epmet/dao/ComponentAccessTokenDao.java | 2 +- .../service/impl/ComponentVerifyTicketServiceImpl.java | 10 +++------- .../src/main/resources/mapper/AuthorizationInfoDao.xml | 6 +++--- .../main/resources/mapper/ComponentAccessTokenDao.xml | 9 +++++---- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java index f4fde172f6..3d26bcffab 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/AuthorizationInfoDao.java @@ -81,7 +81,7 @@ public interface AuthorizationInfoDao extends BaseDao { * @param customerId * @author zxc */ - void updateOldAuthorizerAccessToken(@Param("customerId")String customerId,@Param("clientType")String clientType); + void deleteOldAuthorizerAccessToken(@Param("customerId")String customerId,@Param("clientType")String clientType); /** * @Description 根据 authAppId 查询客户ID和客户端类型 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java index 67d38d540c..10a5710c6e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/ComponentAccessTokenDao.java @@ -45,7 +45,7 @@ public interface ComponentAccessTokenDao extends BaseDao - - update authorization_info set del_flag = 1 where customer_id = #{customerId} AND client_type = #{clientType} - + + delete from authorization_info where customer_id = #{customerId} AND client_type = #{clientType} + SELECT COMPONENT_ACCESS_TOKEN From 555d35f09e7d54ffebf702ea167a59f987173802 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 27 Jul 2020 14:13:12 +0800 Subject: [PATCH 127/157] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index 5063585e11..fffb5e8bb2 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.63 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.64 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 283c78d2d9..9cb62e714d 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.63 + 0.0.64 com.epmet From 074741ebbf8da1be830ce4a3526f2839ac3a6d12 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Mon, 27 Jul 2020 14:29:41 +0800 Subject: [PATCH 128/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-=E6=8E=88=E6=9D=83=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dao/BindingAccountDao.java | 2 +- .../com/epmet/service/impl/AppLetAuthorizationServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java index 2d6b624400..9e5571029e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/BindingAccountDao.java @@ -45,6 +45,6 @@ public interface BindingAccountDao extends BaseDao { * @param authAppId * @author zxc */ - void updateBindStatus(@Param("customerId")String customerId,@Param("authAppId")String authAppId); + void updateBindStatus(@Param("customerId")String customerId,@Param("clientType")String clientType); } \ No newline at end of file diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java index bafd6849dc..b28550c54c 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/AppLetAuthorizationServiceImpl.java @@ -96,7 +96,7 @@ public class AppLetAuthorizationServiceImpl implements AppLetAuthorizationServic log.error("解绑失败" + data); throw new RenException("解绑失败" + data); } - bindingAccountDao.updateBindStatus(customerId,authAppId); + bindingAccountDao.updateBindStatus(customerId,clientType); } From f39ebdfbcb1e03b75c3d75a7d7f4d048b1a9d4fc Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 27 Jul 2020 14:43:39 +0800 Subject: [PATCH 129/157] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=AF=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8D=95=E5=AE=A2=E6=88=B7=E9=80=89=E6=8B=A9=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E8=BF=9B=E5=85=A5=E9=A6=96=E9=A1=B5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ThirdLoginController.java | 14 +++ .../epmet/dto/form/GovWxmpEnteOrgFormDTO.java | 5 - .../dto/form/ThirdWxmpEnteOrgFormDTO.java | 47 ++++++++ .../com/epmet/service/ThirdLoginService.java | 9 ++ .../service/impl/GovLoginServiceImpl.java | 19 +--- .../service/impl/ThirdLoginServiceImpl.java | 102 +++++++++++++++++- .../epmet/feign/EpmetUserOpenFeignClient.java | 9 ++ .../EpmetUserOpenFeignClientFallback.java | 5 + 8 files changed, 184 insertions(+), 26 deletions(-) create mode 100644 epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgFormDTO.java diff --git a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java index 90be83d3b2..461dd1ab48 100644 --- a/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java +++ b/epmet-auth/src/main/java/com/epmet/controller/ThirdLoginController.java @@ -3,6 +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.LoginFormDTO; +import com.epmet.dto.form.ThirdWxmpEnteOrgFormDTO; import com.epmet.dto.result.UserTokenResultDTO; import com.epmet.service.ThirdLoginService; import org.springframework.beans.factory.annotation.Autowired; @@ -46,4 +47,17 @@ public class ThirdLoginController { return new Result().ok(thirdLoginService.workLogin(formDTO)); } + /** + * @param formDTO + * @return + * @Author sun + * @Description 单客户-选择组织,进入首页 + **/ + @PostMapping(value = "enterorg") + public Result enterOrg(@RequestBody ThirdWxmpEnteOrgFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO,ThirdWxmpEnteOrgFormDTO.AddUserShowGroup.class,ThirdWxmpEnteOrgFormDTO.AddUserInternalGroup.class); + UserTokenResultDTO userTokenResultDTO=thirdLoginService.enterOrg(formDTO); + return new Result().ok(userTokenResultDTO); + } + } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java index 8951235a94..0f1c8f6ff7 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java @@ -39,10 +39,5 @@ public class GovWxmpEnteOrgFormDTO implements Serializable { @NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class}) private String rootAgencyId; - /** - * 客户appId(exJson文件中获取) - */ - @NotBlank(message = "appId不能为空",groups = {AddUserInternalGroup.class}) - private String appId; } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgFormDTO.java new file mode 100644 index 0000000000..14c7339245 --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ThirdWxmpEnteOrgFormDTO.java @@ -0,0 +1,47 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description 单客户-选择组织,进入首页入参Dto + * @Author sun + */ +@Data +public class ThirdWxmpEnteOrgFormDTO implements Serializable { + public interface AddUserInternalGroup {} + public interface AddUserShowGroup extends CustomerClientShowGroup {} + /** + * wxCode + */ + @NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class}) + private String wxCode; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空",groups = {AddUserShowGroup.class}) + private String mobile; + + /** + * 选择的组织所属的id + */ + @NotBlank(message = "客户id不能为空",groups = {AddUserInternalGroup.class}) + private String customerId; + + /** + * 选择的要进入的组织(根组织id) + */ + @NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class}) + private String rootAgencyId; + + /** + * 客户appId(exJson文件中获取) + */ + @NotBlank(message = "appId不能为空",groups = {AddUserInternalGroup.class}) + private String appId; +} + diff --git a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java index 4a9d939a93..a532adec56 100644 --- a/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/ThirdLoginService.java @@ -1,6 +1,7 @@ package com.epmet.service; import com.epmet.dto.form.LoginFormDTO; +import com.epmet.dto.form.ThirdWxmpEnteOrgFormDTO; import com.epmet.dto.result.UserTokenResultDTO; /** @@ -24,4 +25,12 @@ public interface ThirdLoginService { * @Description 单客户-政府端微信小程序登录 **/ UserTokenResultDTO workLogin(LoginFormDTO formDTO); + + /** + * @param formDTO + * @return + * @Author sun + * @Description 单客户-选择组织,进入首页 + **/ + UserTokenResultDTO enterOrg(ThirdWxmpEnteOrgFormDTO formDTO); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 406ae0fe6f..92f13d1582 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -272,23 +272,8 @@ public class GovLoginServiceImpl implements GovLoginService { throw new RenException(customerStaffDTOResult.getCode()); } CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); - /*//2、解析微信用户 - WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode());*/ - //2020.7.24 获取微信信息接口调整,改调用微信api的方式 sun - //2.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息 - WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO(); - resiLoginFormDTO.setAppId(formDTO.getAppId()); - resiLoginFormDTO.setWxCode(formDTO.getWxCode()); - Result result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO); - if (!result.success()) { - logger.error("工作端小程序登陆,调用epmet_third服务获取数据失败"); - throw new RenException(result.getCode()); - } - UserWechatDTO userWechatDTO = result.getData(); - WxMaJscode2SessionResult wxMaJscode2SessionResult = new WxMaJscode2SessionResult(); - wxMaJscode2SessionResult.setOpenid(userWechatDTO.getWxOpenId()); - wxMaJscode2SessionResult.setSessionKey(userWechatDTO.getSessionKey()); - wxMaJscode2SessionResult.setUnionid(""); + //2、解析微信用户 + WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); //3、记录staff_wechat,并记录用户激活状态,激活时间 this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java index 4985f4d9e8..df85d0ccd1 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/ThirdLoginServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; import com.epmet.common.token.constant.LoginConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -10,10 +11,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.CpUserDetailRedis; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.GovStaffRoleDTO; -import com.epmet.dto.UserDTO; -import com.epmet.dto.UserWechatDTO; +import com.epmet.dto.*; import com.epmet.dto.form.*; import com.epmet.dto.result.DepartmentListResultDTO; import com.epmet.dto.result.GridByStaffResultDTO; @@ -347,4 +345,100 @@ public class ThirdLoginServiceImpl implements ThirdLoginService { return null; } + /** + * @param formDTO + * @return + * @Author sun + * @Description 单客户-选择组织,进入首页 + **/ + @Override + public UserTokenResultDTO enterOrg(ThirdWxmpEnteOrgFormDTO formDTO) { + //1、需要校验要登录的客户,是否被禁用 + CustomerStaffFormDTO customerStaffFormDTO = new CustomerStaffFormDTO(); + customerStaffFormDTO.setCustomerId(formDTO.getCustomerId()); + customerStaffFormDTO.setMobile(formDTO.getMobile()); + Result customerStaffDTOResult = epmetUserOpenFeignClient.getCustomerStaffInfo(customerStaffFormDTO); + if (!customerStaffDTOResult.success() || null == customerStaffDTOResult.getData()) { + logger.error(String.format("获取工作人员信息失败,手机号[%s],客户id:[%s],code[%s],msg[%s]", formDTO.getMobile(), formDTO.getCustomerId(), customerStaffDTOResult.getCode(), customerStaffDTOResult.getMsg())); + throw new RenException(customerStaffDTOResult.getCode()); + } + CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); + //2020.7.24 获取微信信息接口调整,改调用微信api的方式 sun start + //2.调用epmet_third服务,校验appId是否有效以及是否授权,校验通过的调用微信API获取用户基本信息 + WxLoginFormDTO resiLoginFormDTO = new WxLoginFormDTO(); + resiLoginFormDTO.setAppId(formDTO.getAppId()); + resiLoginFormDTO.setWxCode(formDTO.getWxCode()); + Result result = epmetThirdFeignClient.resiAndWorkLogin(resiLoginFormDTO); + if (!result.success()) { + logger.error("工作端小程序登陆,调用epmet_third服务获取数据失败"); + throw new RenException(result.getCode()); + } + UserWechatDTO userWechatDTO = result.getData(); + WxMaJscode2SessionResult wxMaJscode2SessionResult = new WxMaJscode2SessionResult(); + wxMaJscode2SessionResult.setOpenid(userWechatDTO.getWxOpenId()); + wxMaJscode2SessionResult.setSessionKey(userWechatDTO.getSessionKey()); + wxMaJscode2SessionResult.setUnionid(""); + // end + + //3、记录staff_wechat,并记录用户激活状态,激活时间 + this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); + //4、记录登录日志 + this.saveGovStaffLoginRecord(formDTO, customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); + //5.1、获取用户token + String token = this.generateGovWxmpToken(customerStaff.getUserId()); + //5.2、保存到redis + this.saveGovTokenDto(formDTO.getRootAgencyId(), formDTO.getCustomerId(), customerStaff.getUserId(), wxMaJscode2SessionResult, token); + UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); + userTokenResultDTO.setToken(token); + return userTokenResultDTO; + } + + //保存登录日志 + private Result saveGovStaffLoginRecord(ThirdWxmpEnteOrgFormDTO formDTO, String staffId, String openId) { + StaffLoginAgencyRecordFormDTO staffLoginAgencyRecordFormDTO = new StaffLoginAgencyRecordFormDTO(); + staffLoginAgencyRecordFormDTO.setCustomerId(formDTO.getCustomerId()); + staffLoginAgencyRecordFormDTO.setStaffId(staffId); + staffLoginAgencyRecordFormDTO.setWxOpenId(openId); + staffLoginAgencyRecordFormDTO.setMobile(formDTO.getMobile()); + staffLoginAgencyRecordFormDTO.setAgencyId(formDTO.getRootAgencyId()); + Result staffLoginRecordResult = epmetUserOpenFeignClient.saveStaffLoginRecord(staffLoginAgencyRecordFormDTO); + return staffLoginRecordResult; + } + + /** + * @Description 生成token + * @Date 2020/4/18 23:04 + **/ + private void saveGovTokenDto(String orgId, + String customerId, + String staffId, + WxMaJscode2SessionResult wxMaJscode2SessionResult, + String token) { + int expire = jwtTokenProperties.getExpire(); + GovTokenDto govTokenDto = new GovTokenDto(); + govTokenDto.setApp(LoginConstant.APP_GOV); + govTokenDto.setClient(LoginConstant.CLIENT_WXMP); + govTokenDto.setUserId(staffId); + govTokenDto.setOpenId(wxMaJscode2SessionResult.getOpenid()); + govTokenDto.setSessionKey(wxMaJscode2SessionResult.getSessionKey()); + govTokenDto.setUnionId(null == wxMaJscode2SessionResult.getUnionid() ? "" : wxMaJscode2SessionResult.getUnionid()); + govTokenDto.setToken(token); + govTokenDto.setUpdateTime(System.currentTimeMillis()); + govTokenDto.setExpireTime(jwtTokenUtils.getExpiration(token).getTime()); + govTokenDto.setRootAgencyId(orgId); + govTokenDto.setCustomerId(customerId); + + //设置部门,网格,角色列表 + govTokenDto.setDeptIdList(getDeptartmentIdList(staffId)); + govTokenDto.setGridIdList(getGridIdList(staffId)); + CustomerAgencyDTO agency = getAgencyByStaffId(staffId); + if (agency != null) { + govTokenDto.setAgencyId(agency.getId()); + govTokenDto.setRoleList(queryGovStaffRoles(staffId, agency.getId())); + } + govTokenDto.setOrgIdPath(getOrgIdPath(staffId)); + cpUserDetailRedis.set(govTokenDto, expire); + logger.info("截止时间:" + DateUtils.format(jwtTokenUtils.getExpiration(token), "yyyy-MM-dd HH:mm:ss")); + } + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index c02d4ba8a1..138f2d0b40 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -139,4 +139,13 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/staffrole/staffroles") Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO); + /** + * @param customerStaffFormDTO + * @return + * @Author sun + * @Description 根据手机号+客户id获取工作人员基本信息 + **/ + @PostMapping(value = "epmetuser/customerstaff/getcustomerstaffinfo", consumes = MediaType.APPLICATION_JSON_VALUE) + Result getCustomerStaffInfo(@RequestBody CustomerStaffFormDTO customerStaffFormDTO); + } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 8f3ef4c809..06c88baab1 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -86,4 +86,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> getRolesOfStaff(StaffRoleFormDTO staffRoleFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getRolesOfStaff", staffRoleFormDTO); } + + @Override + public Result getCustomerStaffInfo(CustomerStaffFormDTO customerStaffFormDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerStaffInfo", customerStaffFormDTO); + } } From b8edbcdef062a0a73d9a5996dbe4ef1c0898e6a4 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 27 Jul 2020 14:46:12 +0800 Subject: [PATCH 130/157] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=AB=AF=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=8D=95=E5=AE=A2=E6=88=B7=E9=80=89=E6=8B=A9=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E8=BF=9B=E5=85=A5=E9=A6=96=E9=A1=B5=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- epmet-user/epmet-user-server/deploy/docker-compose-dev.yml | 2 +- epmet-user/epmet-user-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 8295fa44e5..47c85008cf 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.49 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.50 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index d96a621883..22aacf2b62 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.49 + 0.3.50 com.epmet epmet-cloud diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index f6cc6fc0ea..272e5e117d 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.79 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.80 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index bf248b8b05..e0c626ead8 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.79 + 0.3.80 com.epmet epmet-user From 17e32575db02c6717e4cb012e87781b158cb9ae2 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 14:55:27 +0800 Subject: [PATCH 131/157] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/pom.xml | 6 ++ .../com/epmet/dto/form/GovWxmpFormDTO.java | 4 + .../epmet/dto/form/LoginByWxCodeFormDTO.java | 2 + .../epmet/dto/form/ResiWxPhoneFormDTO.java | 2 + .../epmet/redis/CustomerAppWxServiceUtil.java | 98 +++++++++++++++++++ .../java/com/epmet/service/LoginService.java | 3 +- .../service/impl/GovLoginServiceImpl.java | 2 +- .../epmet/service/impl/LoginServiceImpl.java | 30 ++++-- .../epmet/commons/tools/redis/RedisKeys.java | 9 ++ .../java/com/epmet/dto/CustomerAppDTO.java | 97 ++++++++++++++++++ .../dto/form/CustomerAppSecretFormDTO.java | 42 ++++++++ .../epmet/feign/OperCrmOpenFeignClient.java | 24 ++++- .../OperCrmOpenFeignClientFallback.java | 20 ++++ .../controller/CustomerAppController.java | 88 +++++++++++++++++ .../java/com/epmet/dao/CustomerAppDao.java | 35 +++++++ .../com/epmet/entity/CustomerAppEntity.java | 63 ++++++++++++ .../epmet/service/CustomerAppIdService.java | 92 +++++++++++++++++ .../impl/CustomerAppIdServiceImpl.java | 96 ++++++++++++++++++ .../src/main/resources/CustomerAppDao.xml | 25 +++++ 19 files changed, 724 insertions(+), 14 deletions(-) create mode 100644 epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppDTO.java create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java create mode 100644 epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java create mode 100644 epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java create mode 100644 epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java create mode 100644 epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java create mode 100644 epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppIdServiceImpl.java create mode 100644 epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index d96a621883..838cf9a1bd 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -122,6 +122,12 @@ 2.0.0 compile + + com.epmet + oper-crm-client + 2.0.0 + compile + diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java index 8bab423dec..55abfd3bce 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpFormDTO.java @@ -19,5 +19,9 @@ public class GovWxmpFormDTO extends LoginCommonFormDTO implements Serializable { */ @NotBlank(message = "wxCode不能为空",groups = {AddUserInternalGroup.class}) private String wxCode; + /** + * appId + */ + private String appId; } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java index 8ddfe9edff..3f59baf4d7 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/LoginByWxCodeFormDTO.java @@ -29,4 +29,6 @@ public class LoginByWxCodeFormDTO extends LoginCommonFormDTO implements Serializ * 加密算法的初始向量 */ private String iv; + + private String appId; } diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java index f0148b3c14..f710be379e 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/ResiWxPhoneFormDTO.java @@ -32,4 +32,6 @@ public class ResiWxPhoneFormDTO implements Serializable { */ @NotBlank(message = "iv不能为空",groups = {AddUserInternalGroup.class}) private String iv; + + private String appId; } diff --git a/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java new file mode 100644 index 0000000000..a9f5f4901a --- /dev/null +++ b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java @@ -0,0 +1,98 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

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

+ * 版权所有,侵权必究! + */ + +package com.epmet.redis; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; +import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.redis.RedisKeys; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAppDTO; +import com.epmet.dto.form.CustomerAppSecretFormDTO; +import com.epmet.feign.OperCrmOpenFeignClient; +import com.google.common.collect.Maps; +import org.apache.commons.lang3.StringUtils; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.util.CollectionUtils; + +import javax.annotation.PostConstruct; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * 客户app Redis + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Component +public class CustomerAppWxServiceUtil { + private Logger logger = LogManager.getLogger(CustomerAppWxServiceUtil.class); + + /** + * 过期时长为30分钟,单位:秒 + */ + private final static long MINUTE_THIRTY_EXPIRE = 60 * 60 * 24 * 7L; + private final static String JSON_STR = "JSON"; + + @Autowired + private RedisUtils redisUtils; + @Autowired + private OperCrmOpenFeignClient operCrmOpenFeignClient; + + private static Map maServices = Maps.newHashMap(); + @PostConstruct + private void initWxMa() { + Result> configAllAppResult = operCrmOpenFeignClient.getConfigAllApp(); + if (configAllAppResult != null && configAllAppResult.success() && CollectionUtils.isEmpty(configAllAppResult.getData())) { + maServices = configAllAppResult.getData().stream() + .map(a -> { + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + config.setAppid(a.getAppId()); + config.setSecret(a.getSecret()); + config.setMsgDataFormat(JSON_STR); + + WxMaService service = new WxMaServiceImpl(); + service.setWxMaConfig(config); + return service; + }).collect(Collectors.toMap(s -> s.getWxMaConfig().getAppid(), a -> a)); + } + logger.info("initWxMa success:{}", JSON.toJSONString(maServices)); + } + public WxMaService getWxMaService(String appId) { + WxMaService wxMaService = maServices.get(appId); + if (wxMaService == null){ + logger.error("getMaService appId:{} is not config from customer_app",appId); + } + return wxMaService; + } + public String get(String appId) { + String key = RedisKeys.getAppSecretKey(appId); + String secret = (String) redisUtils.get(key); + if (StringUtils.isBlank(secret)) { + CustomerAppSecretFormDTO param = new CustomerAppSecretFormDTO(); + param.setAppId(appId); + Result result = operCrmOpenFeignClient.getSecretByAppId(param); + if (result.success()) { + secret = result.getData(); + if (StringUtils.isNotBlank(secret)) { + redisUtils.set(key, secret, MINUTE_THIRTY_EXPIRE); + } + } + } + return secret; + } + +} diff --git a/epmet-auth/src/main/java/com/epmet/service/LoginService.java b/epmet-auth/src/main/java/com/epmet/service/LoginService.java index 248e7c4d97..a0e429eff9 100644 --- a/epmet-auth/src/main/java/com/epmet/service/LoginService.java +++ b/epmet-auth/src/main/java/com/epmet/service/LoginService.java @@ -45,11 +45,12 @@ public interface LoginService { * @return cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult * @param app * @param wxCode + * @param appId 非必填 * @Author yinzuomei * @Description 解析wxCode * @Date 2020/4/19 0:24 **/ - WxMaJscode2SessionResult getWxMaUser(String app, String wxCode); + WxMaJscode2SessionResult getWxMaUser(String app, String wxCode, String appId); /** * @return java.lang.String diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 406ae0fe6f..6e6c16f6bb 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -141,7 +141,7 @@ public class GovLoginServiceImpl implements GovLoginService { @Override public UserTokenResultDTO loginByWxCode(GovWxmpFormDTO formDTO) { //1、解析微信用户 - WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode()); + WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(formDTO.getApp(), formDTO.getWxCode(), formDTO.getAppId()); if(null!=wxMaJscode2SessionResult){ logger.info(String.format("app=%s,wxCode=%s,openId=%s",formDTO.getApp(),formDTO.getWxCode(),wxMaJscode2SessionResult.getOpenid())); } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index 695c187105..89fbdbebb0 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.feign.EpmetUserFeignClient; import com.epmet.feign.OperAccessOpenFeignClient; import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; +import com.epmet.redis.CustomerAppWxServiceUtil; import com.epmet.service.CaptchaService; import com.epmet.service.LoginService; import com.epmet.utils.WxMaServiceUtils; @@ -66,6 +67,8 @@ public class LoginServiceImpl implements LoginService { @Autowired private OperAccessOpenFeignClient operAccessOpenFeignClient; + @Autowired + private CustomerAppWxServiceUtil customerAppWxServiceUtil; /** * 居民端微信小程序登录 @@ -82,7 +85,7 @@ public class LoginServiceImpl implements LoginService { throw new RenException("参数错误"); } //1、根据wxCode获取微信信息 - WxMaJscode2SessionResult wxMaJscode2SessionResult = this.getWxMaUser(formDTO.getApp(),formDTO.getWxCode()); + WxMaJscode2SessionResult wxMaJscode2SessionResult = this.getWxMaUser(formDTO.getApp(),formDTO.getWxCode(),formDTO.getAppId()); logger.info("openId=[" + wxMaJscode2SessionResult.getOpenid() + "]unionId=[" + wxMaJscode2SessionResult.getUnionid() + "]"); //2、根据openId查询数据库,没有则直接插入一条记录 String userId = this.getUserId(formDTO, wxMaJscode2SessionResult); @@ -109,15 +112,19 @@ public class LoginServiceImpl implements LoginService { * @date 2020/3/14 20:16 */ @Override - public WxMaJscode2SessionResult getWxMaUser(String app,String wxCode) { + public WxMaJscode2SessionResult getWxMaUser(String app,String wxCode,String appId) { WxMaJscode2SessionResult wxMaJscode2SessionResult = null; try { - if (LoginConstant.APP_GOV.equals(app)) { - wxMaJscode2SessionResult = wxMaServiceUtils.govWxMaService().jsCode2SessionInfo(wxCode); - } else if (LoginConstant.APP_OPER.equals(app)) { - wxMaJscode2SessionResult = wxMaServiceUtils.operWxMaService().jsCode2SessionInfo(wxCode); - } else if (LoginConstant.APP_RESI.equals(app)) { - wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(wxCode); + if (StringUtils.isNotBlank(appId)){ + wxMaJscode2SessionResult = customerAppWxServiceUtil.getWxMaService(appId).jsCode2SessionInfo(wxCode); + }else{ + if (LoginConstant.APP_GOV.equals(app)) { + wxMaJscode2SessionResult = wxMaServiceUtils.govWxMaService().jsCode2SessionInfo(wxCode); + } else if (LoginConstant.APP_OPER.equals(app)) { + wxMaJscode2SessionResult = wxMaServiceUtils.operWxMaService().jsCode2SessionInfo(wxCode); + } else if (LoginConstant.APP_RESI.equals(app)) { + wxMaJscode2SessionResult = wxMaServiceUtils.resiWxMaService().jsCode2SessionInfo(wxCode); + } } } catch (WxErrorException e) { log.error("->[getMaOpenId]::error[{}]", "解析微信code失败"); @@ -137,7 +144,12 @@ public class LoginServiceImpl implements LoginService { String phone=""; try { ValidatorUtils.validateEntity(formDTO, ResiWxPhoneFormDTO.AddUserInternalGroup.class); - WxMaService wxMaService = wxMaServiceUtils.resiWxMaService(); + WxMaService wxMaService = null; + if (StringUtils.isNotBlank(formDTO.getAppId())){ + wxMaService = customerAppWxServiceUtil.getWxMaService(formDTO.getAppId()); + }else{ + wxMaService = wxMaServiceUtils.resiWxMaService(); + } WxMaJscode2SessionResult wxMaJscode2SessionResult = wxMaService.jsCode2SessionInfo(formDTO.getWxCode()); WxMaPhoneNumberInfo phoneNoInfo = wxMaService.getUserService().getPhoneNoInfo(wxMaJscode2SessionResult.getSessionKey(), formDTO.getEncryptedData(), 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 dcf93d3a24..fc0dc2fe49 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 @@ -254,4 +254,13 @@ public class RedisKeys { return rootPrefix.concat("tags:grid:relationTag:").concat(gridId).concat(StrConstant.COLON).concat(tagId); } + /** + * appId secret 缓存Key + * @param appId + * @return + */ + public static String getAppSecretKey(String appId) { + return rootPrefix.concat("oper:crm:appid:secret").concat(appId); + } + } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppDTO.java new file mode 100644 index 0000000000..5a58975a7d --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppDTO.java @@ -0,0 +1,97 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +public class CustomerAppDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户Id + */ + private String customerId; + + /** + * 小程序的appId + */ + private String appId; + + /** + * resi,work + */ + private String client; + + /** + * app的secret + */ + private String secret; + + /** + * 0:停用,1:启用 + */ + private Integer enableFlag; + + /** + * 删除标识: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/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java new file mode 100644 index 0000000000..bed538b63b --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/form/CustomerAppSecretFormDTO.java @@ -0,0 +1,42 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +public class CustomerAppSecretFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 小程序的appId + */ + @NotBlank(message = "小程序Id不能为空") + private String appId; +} \ 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 5b220aa698..71cc77831d 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 @@ -1,13 +1,16 @@ package com.epmet.feign; +import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.CustomerAppDTO; import com.epmet.dto.CustomerDTO; -import org.springframework.cloud.openfeign.FeignClient; - -import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.feign.fallback.OperCrmOpenFeignClientFallback; +import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -23,4 +26,19 @@ public interface OperCrmOpenFeignClient { */ @PostMapping("/oper/crm/customer/getcostomerInfo") Result getCustomerInfo(CustomerDTO dto); + + /** + * 获取客户appId信息 + * @param dto + * @return + */ + @PostMapping("/oper/crm/customerapp/getsecretbyappid") + Result getSecretByAppId(CustomerAppSecretFormDTO dto); + + /** + * 获取所有已配置的app信息 + * @return + */ + @PostMapping("/oper/crm/customerapp/getconfigallapp") + Result getConfigAllApp(); } 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 39594aa4fe..81b74a4f7c 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 @@ -3,10 +3,14 @@ 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.CustomerAppDTO; import com.epmet.dto.CustomerDTO; +import com.epmet.dto.form.CustomerAppSecretFormDTO; import com.epmet.feign.OperCrmOpenFeignClient; import org.springframework.stereotype.Component; +import java.util.List; + /** * 本服务对外开放的API,其他服务通过引用此client调用该服务 * @@ -19,4 +23,20 @@ public class OperCrmOpenFeignClientFallback implements OperCrmOpenFeignClient { public Result getCustomerInfo(CustomerDTO dto) { return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getCustomerInfo", dto); } + + /** + * 获取客户appId信息 + * + * @param dto + * @return + */ + @Override + public Result getSecretByAppId(CustomerAppSecretFormDTO dto) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getSecretByAppId", dto); + } + + @Override + public Result> getConfigAllApp() { + return ModuleUtils.feignConError(ServiceConstant.OPER_CRM_SERVER, "getConfigAllApp", null); + } } diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java new file mode 100644 index 0000000000..90bdfd56c4 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java @@ -0,0 +1,88 @@ +/** + * 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.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.CustomerAppDTO; +import com.epmet.dto.form.CustomerAppSecretFormDTO; +import com.epmet.service.CustomerAppIdService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + + +/** + * 客户表 app表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@RestController +@RequestMapping("customerapp") +public class CustomerAppController { + + @Autowired + private CustomerAppIdService customerAppIdService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = customerAppIdService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + CustomerAppDTO data = customerAppIdService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody CustomerAppDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + customerAppIdService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody CustomerAppDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + customerAppIdService.update(dto); + return new Result(); + } + @PostMapping("getsecretbyappid") + public Result getSecretByAppId(@RequestBody CustomerAppSecretFormDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, DefaultGroup.class); + return new Result().ok(customerAppIdService.selectSecretByAppId(dto.getAppId())); + } + @PostMapping("getconfigallapp") + public Result> getConfigAllApp(){ + return new Result>().ok(customerAppIdService.list(null)); + } + + +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java new file mode 100644 index 0000000000..b69ea9fe11 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/dao/CustomerAppDao.java @@ -0,0 +1,35 @@ +/** + * 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.CustomerAppEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Mapper +public interface CustomerAppDao extends BaseDao { + + String selectSecretByAppId(@Param("appId") String appId); +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java new file mode 100644 index 0000000000..89d62c233d --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/entity/CustomerAppEntity.java @@ -0,0 +1,63 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

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

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("customer_app") +public class CustomerAppEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 小程序的appId + */ + private String appId; + + /** + * resi,work + */ + private String client; + + /** + * app的secret + */ + private String secret; + + /** + * 0:停用,1:启用 + */ + private Integer enableFlag; + +} diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java new file mode 100644 index 0000000000..3da3da447d --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java @@ -0,0 +1,92 @@ +/** + * 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.CustomerAppDTO; +import com.epmet.entity.CustomerAppEntity; + +import java.util.List; +import java.util.Map; + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +public interface CustomerAppIdService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-07-27 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-07-27 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return CustomerAppIdDTO + * @author generator + * @date 2020-07-27 + */ + CustomerAppDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-27 + */ + void save(CustomerAppDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-07-27 + */ + void update(CustomerAppDTO dto); + + /** + * desc:获取客户app secret + * @param appId + * @return + */ + String selectSecretByAppId(String appId); +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppIdServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppIdServiceImpl.java new file mode 100644 index 0000000000..44dfa97eb9 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppIdServiceImpl.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.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.CustomerAppDao; +import com.epmet.dto.CustomerAppDTO; +import com.epmet.entity.CustomerAppEntity; +import com.epmet.service.CustomerAppIdService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * 客户表 appId表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Service +public class CustomerAppIdServiceImpl extends BaseServiceImpl implements CustomerAppIdService { + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, CustomerAppDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, CustomerAppDTO.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 CustomerAppDTO get(String id) { + CustomerAppEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, CustomerAppDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(CustomerAppDTO dto) { + CustomerAppEntity entity = ConvertUtils.sourceToTarget(dto, CustomerAppEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(CustomerAppDTO dto) { + CustomerAppEntity entity = ConvertUtils.sourceToTarget(dto, CustomerAppEntity.class); + updateById(entity); + } + + @Override + public String selectSecretByAppId(String appId) { + return baseDao.selectSecretByAppId(appId); + } + +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml b/epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml new file mode 100644 index 0000000000..599ef18c59 --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-server/src/main/resources/CustomerAppDao.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From 46aafc4c09a7fde0a88bdc37a03685bb0b6b27e7 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Mon, 27 Jul 2020 15:01:59 +0800 Subject: [PATCH 132/157] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResiActListController.java | 5 +-- .../main/java/com/epmet/dao/ActInfoDao.java | 4 +-- .../com/epmet/dao/ActUserRelationDao.java | 22 +++++++++++++ .../com/epmet/service/ActLiveRecService.java | 2 +- .../service/impl/ActInfoServiceImpl.java | 10 +++++- .../service/impl/ActLiveRecServiceImpl.java | 2 +- .../service/impl/ActSignInRecServiceImpl.java | 2 +- .../impl/ActUserRelationServiceImpl.java | 25 ++++++++++----- .../src/main/resources/mapper/ActInfoDao.xml | 17 +++++----- .../resources/mapper/ActUserRelationDao.xml | 32 +++++++++++++++++++ 10 files changed, 97 insertions(+), 24 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java index 721723b58e..f77002c42c 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java @@ -263,9 +263,10 @@ public class ResiActListController { * @Date 10:29 2020-07-23 **/ @PostMapping("insertlive") - public Result inSertlive(@LoginUser TokenDto tokenDto, @RequestBody ResiActInsertLiveFormDTO formDTO) { + public Result insertLive(@LoginUser TokenDto tokenDto, @RequestBody ResiActInsertLiveFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); - return actLiveRecService.inSertlive(tokenDto, formDTO); + Result result = actLiveRecService.insertLive(tokenDto, formDTO); + return new Result(); } /** diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java index fc1b09d56c..ce0d39cb16 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActInfoDao.java @@ -119,7 +119,7 @@ public interface ActInfoDao extends BaseDao { * @Author zhangyong * @Date 13:53 2020-07-20 **/ - List selectListActMyHavePassed(ResiMyActFormDTO formDTO); + List selectListMyActIHavePassed(ResiMyActFormDTO formDTO); /** * 我的活动-已结束 @@ -240,7 +240,7 @@ public interface ActInfoDao extends BaseDao { * @param customerId * @author yinzuomei * @description 已取消-活动列表 - * @Date 2020/7/23 23:13 + * @Date 2020/7/23 23:13 **/ List selectCanceledList(String customerId); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index 3b50cf440b..379875b0a8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -175,4 +175,26 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/26 22:38 **/ Integer selectCountByReward(@Param("actId") String actId, @Param("rewardFlag")String rewardFlag); + + /** + * 取消报名 + * 根据用户id和活动id,修改 用户活动关系表 + * + * @param entity + * @return void + * @Author zhangyong + * @Date 14:39 2020-07-22 + **/ + void cancelSignUp(ActUserRelationEntity entity); + + /** + * 当前用户是否曾报名参加过该活动 + * + * @param actId + * @param userId + * @return java.lang.Integer + * @Author zhangyong + * @Date 14:35 2020-07-27 + **/ + Integer selectCountByActIdAndUserId(@Param("actId") String actId, @Param("userId")String userId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java index 79d95ce9e7..aae4ece4a6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java @@ -52,5 +52,5 @@ public interface ActLiveRecService extends BaseService { * @Author zhangyong * @Date 13:40 2020-07-23 **/ - Result inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO); + Result insertLive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java index 79d97f2bfa..8e6b0bcd5f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java @@ -152,6 +152,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl> myActListAuditing(TokenDto tokenDto, ResiMyActFormDTO formDto) { formDto.setUserId(tokenDto.getUserId()); + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); List myAct = baseDao.selectListMyActAuditing(formDto); return new Result>().ok(myAct); } @@ -159,6 +161,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl> myActListRefused(TokenDto tokenDto, ResiMyActFormDTO formDto) { formDto.setUserId(tokenDto.getUserId()); + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); List myAct = baseDao.selectListActRefused(formDto); return new Result>().ok(myAct); } @@ -166,13 +170,17 @@ public class ActInfoServiceImpl extends BaseServiceImpl> myActListPassed(TokenDto tokenDto, ResiMyActFormDTO formDto) { formDto.setUserId(tokenDto.getUserId()); - List myAct = baseDao.selectListActMyHavePassed(formDto); + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); + List myAct = baseDao.selectListMyActIHavePassed(formDto); return new Result>().ok(myAct); } @Override public Result> myActListCanceld(TokenDto tokenDto, ResiMyActFormDTO formDto) { formDto.setUserId(tokenDto.getUserId()); + int pageIndex = (formDto.getPageNo() - NumConstant.ONE) * formDto.getPageSize(); + formDto.setPageNo(pageIndex); List myAct = baseDao.selectListMyActCanceld(formDto); return new Result>().ok(myAct); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java index 1eb66ab5f8..d03cb6f4b7 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActLiveRecServiceImpl.java @@ -106,7 +106,7 @@ public class ActLiveRecServiceImpl extends BaseServiceImpl inSertlive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO) { + public Result insertLive(TokenDto tokenDto, ResiActInsertLiveFormDTO formDTO) { formDTO.setUserId(tokenDto.getUserId()); // 文本校验 ValidityVerification verification = new ValidityVerification(); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java index 4bd516e4f9..c874a61640 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActSignInRecServiceImpl.java @@ -86,7 +86,7 @@ public class ActSignInRecServiceImpl extends BaseServiceImpl inSertlive = actLiveRecService.inSertlive(tokenDto, liveFormDTO); + Result inSertlive = actLiveRecService.insertLive(tokenDto, liveFormDTO); //实况id, 当sync_live=1时此列有值 dto.setLiveId(inSertlive.getData()); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java index dbdb98eee5..9105a148cf 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActUserRelationServiceImpl.java @@ -251,20 +251,29 @@ public class ActUserRelationServiceImpl extends BaseServiceImpl= ]]> NOW() -- 报名截止时间 >= 当前时间 @@ -92,7 +92,7 @@ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND (re.`STATUS` = 'auditing' OR re.`STATUS` = 'passed') GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND i.ACT_STATUS = 'published' AND = ]]> NOW() -- 报名截止时间 >= 当前时间 @@ -119,7 +119,7 @@ IF(u.USER_ID = #{userId},'signed_up','no_signed_up') as signupFlag FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND U.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND (re.`STATUS` = 'auditing' OR re.`STATUS` = 'passed') GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' -- 活动开始时间 > 当前时间 并且 报名截止时间 < 当前时间 报名已结束,活动未开始 未开始 AND ( ]]> NOW() AND NOW() ) @@ -195,7 +195,7 @@ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'auditing' AS actCurrentState -- 活动状态 FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND u.`STATUS` = 'auditing' @@ -218,7 +218,7 @@ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'passed' AS actCurrentState -- 活动状态 FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND u.`STATUS` = 'passed' @@ -241,7 +241,7 @@ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'refused' AS actCurrentState -- 活动状态 FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND u.`STATUS` = 'refused' @@ -264,7 +264,7 @@ IFNULL(c.signupNum, 0) signupNum, -- 已报名人数 'canceld' AS actCurrentState -- 活动状态 FROM act_info i LEFT JOIN act_user_relation u ON i.ID = u.ACT_ID AND u.DEL_FLAG = '0' - LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID + LEFT JOIN (SELECT count(1) signupNum, re.ACT_ID from act_user_relation re WHERE re.DEL_FLAG = '0' AND re.`STATUS` != 'refused' AND re.`STATUS` != 'canceled' GROUP BY re.ACT_ID) c ON c.ACT_ID = i.ID WHERE i.DEL_FLAG = '0' AND u.USER_ID = #{userId} AND NOW() -- 活动结束时间 < 当前时间, 活动已结束 @@ -457,7 +457,8 @@ WHERE i.DEL_FLAG = '0' AND r.USER_ID = #{userId} AND i.ACT_STATUS = 'published' - AND ((#{actStartTime} BETWEEN i.ACT_START_TIME AND i.ACT_END_TIME OR #{actEndTime} BETWEEN i.ACT_START_TIME AND i.ACT_END_TIME) + AND r.`STATUS` != 'refused' AND r.`STATUS` != 'canceled' + AND ((#{actStartTime} BETWEEN i.ACT_START_TIME AND i.ACT_END_TIME OR #{actEndTime} BETWEEN i.ACT_START_TIME AND i.ACT_END_TIME) or (i.ACT_START_TIME BETWEEN #{actStartTime} AND #{actEndTime} OR i.ACT_END_TIME BETWEEN #{actStartTime} AND #{actEndTime})); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index 7640d4f3c1..57de2ff10f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -252,4 +252,36 @@ and aur.REWARD_FLAG=#{rewardFlag} AND aur.ACT_ID = #{actId} + + + UPDATE act_user_relation + SET + + STATUS = #{status}, + + + CANCEL_TIME = #{cancelTime}, + CANCEL_REASON = #{cancelReason}, + + + UPDATED_BY = #{userId}, + + UPDATED_TIME = NOW() + WHERE + DEL_FLAG = '0' + AND ACT_ID = #{actId} + AND USER_ID = #{userId} + + + + From ee8584e8543e4bb8007a02e15c3b847a100dbe26 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 27 Jul 2020 15:12:07 +0800 Subject: [PATCH 133/157] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 47c85008cf..5f9e8bf5c8 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.50 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.51 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 22aacf2b62..16488992d7 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.50 + 0.3.51 com.epmet epmet-cloud From c0e5578683520b1f8b9923af3faeb73e0f0fa40a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 27 Jul 2020 15:26:02 +0800 Subject: [PATCH 134/157] =?UTF-8?q?heart-work:=E9=87=8D=E6=96=B0=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=B4=BB=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/work/RePublishFormDTO.java | 194 ++++++++++++++++++ .../dto/result/work/PublishActResultDTO.java | 3 + .../epmet/constant/ActMessageConstant.java | 8 + .../epmet/controller/WorkActController.java | 24 ++- .../java/com/epmet/dao/ActContentDao.java | 9 + .../com/epmet/dao/ActUserRelationDao.java | 9 + .../com/epmet/service/WorkActService.java | 9 + .../service/impl/WorkActServiceImpl.java | 168 ++++++++++++++- .../main/resources/mapper/ActContentDao.xml | 8 + .../resources/mapper/ActUserRelationDao.xml | 13 ++ 10 files changed, 442 insertions(+), 3 deletions(-) create mode 100644 epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java new file mode 100644 index 0000000000..f3bce130df --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/work/RePublishFormDTO.java @@ -0,0 +1,194 @@ +package com.epmet.dto.form.work; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.Valid; +import javax.validation.constraints.Min; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.List; + +/** + * 重新发布活动-入参DTO + * + * @author yinzuomei@elink-cn.com + * @date 2020/7/27 13:49 + */ +@Data +public class RePublishFormDTO implements Serializable { + private static final long serialVersionUID = -959956652123514886L; + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @Valid + @Size(min=1,message = "活动详情不能为空",groups = {AddUserShowGroup.class}) + private List actContent; + + /** + * 活动id + */ + @NotBlank(message = "活动id不能为空", groups = {AddUserInternalGroup.class}) + private String actId; + + /** + * 是否通知已报名人员:true 通知 false 不通知 + */ + @NotNull(message = "是否通知已报名人员标志不能为空",groups ={AddUserInternalGroup.class} ) + private Boolean noticePassedPeople; + + + /** + * 活动标题 + */ + @NotBlank(message = "活动标题不能为空", groups = {AddUserShowGroup.class}) + @Length(min=1, max=50,message = "活动标题限50字以内", groups = {AddUserShowGroup.class}) + private String title; + + /** + * 封面图 + */ + @NotBlank(message = "封面图不能为空", groups = {AddUserShowGroup.class}) + private String coverPic; + + /** + * 活动地点 + */ + @NotBlank(message = "活动地点不能为空", groups = {AddUserShowGroup.class}) + private String actAddress; + + /** + * 活动地点-经度 + */ + @NotNull(message = "活动地点经度不能为空", groups = {AddUserInternalGroup.class}) + private BigDecimal actLongitude; + + /** + * 活动地点-纬度 + */ + @NotNull(message = "活动地点经度不能为空", groups = {AddUserInternalGroup.class}) + private BigDecimal actLatitude; + + /** + * 活动预计开始时间yyyy-MM-dd HH:mm + */ + @NotBlank(message = "活动预计开始时间不能为空", groups = {AddUserShowGroup.class}) + private String actStartTime; + + /** + * 活动预计结束时间yyyy-MM-dd HH:mm + */ + @NotBlank(message = "活动预计结束时间不能为空", groups = {AddUserShowGroup.class}) + private String actEndTime; + + /** + * 活动人数 + */ + @Min(0) + private Integer actQuota; + + /** + * 活动积分 + */ + @Min(0) + private Integer reward; + + /** + * 报名审核:true:只有志愿者才可以参加活动,false: 只要是居民就可以参加活动 + */ + @NotNull(message = "报名身份不能为空", groups = {AddUserInternalGroup.class}) + private Boolean volunteerLimit; + + /** + * 报名审核: true: 需人工审核 false: 无需审核 + */ + @NotNull(message = "报名审核方式不能为空", groups = {AddUserInternalGroup.class}) + private Boolean auditSwitch; + + /** + * 报名截止时间:yyyy-MM-dd HH:mm + */ + @NotBlank(message = "报名截止时间不能为空", groups = {AddUserShowGroup.class}) + private String signUpEndTime; + + /** + * 报名条件 + */ + @NotBlank(message = "报名条件不能为空", groups = {AddUserShowGroup.class}) + @Length(min=1, max=50,message = "报名条件限200字以内", groups = {AddUserShowGroup.class}) + private String requirement; + + /** + * 签到开始时间:yyyy-MM-dd HH:mm + */ + @NotBlank(message = "签到开始时间不能为空", groups = {AddUserShowGroup.class}) + private String signInStartTime; + + /** + * 签到结束时间: yyyy-MM-dd HH:mm + */ + @NotBlank(message = "签到结束时间不能为空", groups = {AddUserShowGroup.class}) + private String signInEndTime; + + /** + * 签到地址 + */ + @NotBlank(message = "签到地址不能为空", groups = {AddUserShowGroup.class}) + private String signInAddress; + + /** + * 签到地址-纬度 + */ + @NotNull(message = "签到地址-纬度不能为空", groups = {AddUserInternalGroup.class}) + private BigDecimal signInLatitude; + + /** + * 签到地址-经度 + */ + @NotNull(message = "签到地址-经度不能为空", groups = {AddUserInternalGroup.class}) + private BigDecimal signInLongitude; + + /** + * 签到有效范围(米) + */ + @Min(0) + @NotNull(message = "签到有效范围不能为空", groups = {AddUserShowGroup.class}) + private Integer signInRadius; + + /** + * 主办方id + */ + @NotBlank(message = "主办方id不能为空", groups = {AddUserInternalGroup.class}) + private String sponsorId; + + /** + * 主办方类型:以网格名义:grid , 以机关名义: agency + */ + @NotBlank(message = "主办方类型不能为空", groups = {AddUserInternalGroup.class}) + private String sponsorType; + + /** + * 主办方名称 + */ + @NotBlank(message = "主办方名称不能为空", groups = {AddUserShowGroup.class}) + private String sponsorName; + + /** + * 联系人 + */ + @NotBlank(message = "联系人不能为空", groups = {AddUserShowGroup.class}) + private String sponsorContacts; + + /** + * 联系电话 + */ + @NotBlank(message = "联系电话不能为空", groups = {AddUserShowGroup.class}) + private String sponsorTel; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PublishActResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PublishActResultDTO.java index 5fdc6a5c06..bc9c9549cd 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PublishActResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/PublishActResultDTO.java @@ -13,5 +13,8 @@ import java.io.Serializable; @Data public class PublishActResultDTO implements Serializable { private static final long serialVersionUID = 4699176252192192495L; + /** + * 活动id + */ private String actId; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java index ac8ba13bfc..8f711ee2d2 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java @@ -21,6 +21,9 @@ public interface ActMessageConstant { */ String ACT_CANCELED="您报名的活动%s,已取消,原因:%s"; + /** + * 发放积分(结束活动)时调用消息的备注 + */ String ACT_POINTS_EVENT_REMARK="参与%s"; /** @@ -32,4 +35,9 @@ public interface ActMessageConstant { * 居民端-添加实况,发送消息 */ String ACT_POINTS_EVENT_VOLUNTEER_LIVE="用户%s,添加活动实况,活动:%s"; + + /** + * 工作端-重新发布活动,通知待审核+已经审核通过的用户 + */ + String RE_PUBLISH_ACT="您好,您参与的%s活动,%s,请注意查看"; } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java index d1dc5ee508..8501fb6ac8 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkActController.java @@ -66,8 +66,7 @@ public class WorkActController { PublishActContentFormDTO.UserInternalGroup.class ); } - PublishActResultDTO resultDTO = workActService.publishAct(formDTO); - return new Result().ok(resultDTO); + return new Result().ok(workActService.publishAct(formDTO)); } /** @@ -220,4 +219,25 @@ public class WorkActController { ValidatorUtils.validateEntity(formDTO, ActIdFormDTO.AddUserInternalGroup.class); return new Result().ok(workActService.getActInfo(formDTO.getActId())); } + + /** + * @param rePublishFormDTO + * @return com.epmet.commons.tools.utils.Result + * @author yinzuomei + * @description 重新发布活动 + * @Date 2020/7/27 13:55 + **/ + @PostMapping("republish") + public Result rePublish(@RequestBody RePublishFormDTO rePublishFormDTO) { + ValidatorUtils.validateEntity(rePublishFormDTO, RePublishFormDTO.AddUserShowGroup.class, RePublishFormDTO.AddUserInternalGroup.class); + for (PublishActContentFormDTO actContentFormDTO : rePublishFormDTO.getActContent()) { + ValidatorUtils.validateEntity(actContentFormDTO, + PublishActContentFormDTO.UserShowGroup.class, + PublishActContentFormDTO.UserInternalGroup.class + ); + } + return new Result().ok(workActService.rePublish(rePublishFormDTO)); + } + + } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java index c125c2d9f4..8ff05abcde 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActContentDao.java @@ -41,4 +41,13 @@ public interface ActContentDao extends BaseDao { * @Date 2020/7/26 18:26 **/ List selectByActId(String actId); + + /** + * @return int + * @param actId + * @author yinzuomei + * @description 根据活动id,将原来的活动详情删除,del_flag=1 + * @Date 2020/7/27 14:06 + **/ + int updateDelFlagByActId(String actId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java index 3b50cf440b..ef70fce4fb 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/ActUserRelationDao.java @@ -175,4 +175,13 @@ public interface ActUserRelationDao extends BaseDao { * @Date 2020/7/26 22:38 **/ Integer selectCountByReward(@Param("actId") String actId, @Param("rewardFlag")String rewardFlag); + + /** + * @return java.util.List + * @param actId 活动id + * @author yinzuomei + * @description 根据活动id,查询待审核+已经审核通过的人员 + * @Date 2020/7/27 14:59 + **/ + List selectAuditingAndPassedList(String actId); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java index b1cb90e829..8aca54049d 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkActService.java @@ -137,4 +137,13 @@ public interface WorkActService { * @Date 2020/7/27 13:36 **/ ReEditActInfoResultDTO getActInfo(String actId); + + /** + * @return com.epmet.dto.result.work.PublishActResultDTO + * @param rePublishFormDTO + * @author yinzuomei + * @description 重新发布活动 + * @Date 2020/7/27 13:55 + **/ + PublishActResultDTO rePublish(RePublishFormDTO rePublishFormDTO); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java index 2d16b608c2..e7b24e69fb 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java @@ -171,7 +171,7 @@ public class WorkActServiceImpl implements WorkActService { * @return void * @param formDTO * @author yinzuomei - * @description + * @description 第一次发布 * @Date 2020/7/24 16:45 **/ private void checkPublishFormDTO(PublishActInfoFormDTO formDTO) { @@ -189,6 +189,28 @@ public class WorkActServiceImpl implements WorkActService { } } + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 重新发布 + * @Date 2020/7/24 16:45 + **/ + private void checkRePublishFormDTO(RePublishFormDTO formDTO) { + //1、活动预计开始时间、活动预计结束时间 + if(formDTO.getActStartTime().compareTo(formDTO.getActEndTime())!=-1){ + throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode()); + } + //2、签到开始时间、签到结束时间 + if(formDTO.getSignInStartTime().compareTo(formDTO.getSignInEndTime())!=-1){ + throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode()); + } + //3、报名截止时间(应该在活动预计开始时间之前) + if(formDTO.getSignUpEndTime().compareTo(formDTO.getActStartTime())!=-1){ + throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); + } + } + public static void main(String[] args) { SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -243,6 +265,43 @@ public class WorkActServiceImpl implements WorkActService { this.auditActContent(textList,imgList); } + /** + * @return void + * @param formDTO + * @author yinzuomei + * @description 重新发布活动,内容审核 + * @Date 2020/7/27 14:01 + **/ + private void auditRePublishAct(RePublishFormDTO formDTO) { + //1、活动标题 + if (StringUtils.isNotBlank(formDTO.getTitle())) { + this.auditActTitle(formDTO.getTitle()); + } + //2、活动封面 + if(StringUtils.isNotBlank(formDTO.getCoverPic())){ + this.auditActCoverPic(formDTO.getCoverPic()); + } + + //3、招募要求 + if (StringUtils.isNotBlank(formDTO.getRequirement())) { + this.auditActRequirement(formDTO.getRequirement()); + } + //4、活动内容 + if(null==formDTO.getActContent()||formDTO.getActContent().size()<1){ + return; + } + List textList=new ArrayList<>(); + List imgList=new ArrayList<>(); + for(PublishActContentFormDTO actContent:formDTO.getActContent()){ + if(ActConstant.ACT_CONTENT_TYPE_TEXT.equals(actContent.getContentType())){ + textList.add(actContent.getContent()); + }else if(ActConstant.ACT_CONTENT_TYPE_IMG.equals(actContent.getContentType())){ + imgList.add(actContent.getContent()); + } + } + this.auditActContent(textList,imgList); + } + /** * @return com.epmet.entity.ActInfoEntity * @param formDTO @@ -286,6 +345,49 @@ public class WorkActServiceImpl implements WorkActService { return actInfoEntity; } + /** + * @return com.epmet.entity.ActInfoEntity + * @param formDTO + * @author yinzuomei + * @description 重新发布=构造act_info + * @Date 2020/7/27 14:02 + **/ + private ActInfoEntity constructRePublishActInfo(RePublishFormDTO formDTO) { + ActInfoEntity actInfoEntity = ConvertUtils.sourceToTarget(formDTO, ActInfoEntity.class); + //报名开始、报名截止、活动预计开始、活动预计截止、签到开始、签到截止 + actInfoEntity.setSignUpEndTime(DateUtils.minStrToSecondDate(formDTO.getSignUpEndTime())); + actInfoEntity.setSignInStartTime(DateUtils.minStrToSecondDate(formDTO.getSignInStartTime())); + actInfoEntity.setSignInEndTime(DateUtils.minStrToSecondDate(formDTO.getSignInEndTime())); + actInfoEntity.setActStartTime(DateUtils.minStrToSecondDate(formDTO.getActStartTime())); + actInfoEntity.setActEndTime(DateUtils.minStrToSecondDate(formDTO.getActEndTime())); + //活动名额类型(0-不限名额,1-固定名额) + if(actInfoEntity.getActQuota()==0){ + actInfoEntity.setActQuotaCategory(false); + }else{ + actInfoEntity.setActQuotaCategory(true); + } + Date nowDate=new Date(); + actInfoEntity.setSignUpStartTime(nowDate); + actInfoEntity.setCreatedTime(nowDate); + actInfoEntity.setUpdatedTime(nowDate); + actInfoEntity.setActStatus(ActConstant.ACT_STATUS_PUBLISHED); + + //1已经总结0未总结 + actInfoEntity.setSummaryFlag(false); + if(ActConstant.SPONSOR_AGENCY.equals(actInfoEntity.getSponsorType())){ + //调用gov_org服务获取当前组织的上一级机关id + Result result=govOrgOpenFeignClient.getAgencyById(formDTO.getSponsorId()); + if(result.success()&&null!=result.getData()){ + actInfoEntity.setPid(result.getData().getPid()); + }else{ + logger.warn("重新发布活动,根据agencyId查询组织信息失败,agencyId=",formDTO.getSponsorId()); + } + }else{ + actInfoEntity.setPid(StrConstant.EPMETY_STR); + } + return actInfoEntity; + } + /** * @return java.util.List * @param actContent @@ -864,4 +966,68 @@ public class WorkActServiceImpl implements WorkActService { resultDTO.setActContent(actContent); return resultDTO; } + + /** + * @param rePublishFormDTO + * @return com.epmet.dto.result.work.PublishActResultDTO + * @author yinzuomei + * @description 重新发布活动 + * @Date 2020/7/27 13:55 + **/ + @Override + public PublishActResultDTO rePublish(RePublishFormDTO rePublishFormDTO) { + ActInfoDTO originalActInfo=actInfoService.get(rePublishFormDTO.getActId()); + if(null==originalActInfo){ + logger.error("act_info is null"); + throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode()); + } + if(!originalActInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ + throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); + } + //校验参数 + this.checkRePublishFormDTO(rePublishFormDTO); + PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); + //内容审核(活动标题、招募要求、活动内容图文) + this.auditRePublishAct(rePublishFormDTO); + logger.info("重新发布活动,审核成功"); + + //构造属性保存活动属性,活动内容 + ActInfoEntity newActInfoEntity=this.constructRePublishActInfo(rePublishFormDTO); + newActInfoEntity.setId(rePublishFormDTO.getActId()); + actInfoDao.updateById(newActInfoEntity); + //删除原来的 + actContentDao.updateDelFlagByActId(rePublishFormDTO.getActId()); + //插入编辑后的活动详情 + List actContentEntityList=this.constructActContent(rePublishFormDTO.getActContent(),rePublishFormDTO.getActId()); + for(ActContentEntity actContentEntity:actContentEntityList){ + actContentDao.insert(actContentEntity); + } + //插入一条操作日志 + ActOperationRecEntity actOperationRecEntity=new ActOperationRecEntity(); + actOperationRecEntity.setActId(rePublishFormDTO.getActId()); + actOperationRecEntity.setType(ActConstant.ACT_OPER_TYPE_UPDATE); + actOperationRecEntity.setNoticeUser(rePublishFormDTO.getNoticePassedPeople()); + actOperationRecEntity.setRemark(StrConstant.EPMETY_STR); + actOperationRecDao.insert(actOperationRecEntity); + + //删除所有的草稿 + this.deleteDraft(); + publishActResultDTO.setActId(rePublishFormDTO.getActId()); + //发送消息通知-暂时不做了 + /*if(rePublishFormDTO.getNoticePassedPeople()){ + this.noticePassedPeople(originalActInfo,newActInfoEntity); + }*/ + return publishActResultDTO; + } + + private void noticePassedPeople(ActInfoDTO originalActInfo, ActInfoEntity newActInfoEntity) { + /* List actUserRelationDTOList=actUserRelationDao.selectAuditingAndPassedList(originalActInfo.getId()); + if(null==actUserRelationDTOList||actUserRelationDTOList.size()<1){ + logger.info("不存在待审核人员、已经审核用户,无需发送站内信"); + return; + } + String originalTitle=originalActInfo.getTitle(); + + //活动地点、活动预计开始时间、活动预计结束时间、活动积分、签到时间开始、签到结束时间、签到地点*/ + } } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml index 6d38c0a679..10b82ac717 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml @@ -29,4 +29,12 @@ AND ac.ACT_ID = #{actId} order by orderNum asc + + + + UPDATE act_content ac + SET ac.DEL_FLAG = '1' + WHERE + ac.ACT_ID = #{actId} + \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml index 7640d4f3c1..3ad005ad08 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActUserRelationDao.xml @@ -252,4 +252,17 @@ and aur.REWARD_FLAG=#{rewardFlag} AND aur.ACT_ID = #{actId} + + + From 059b95202742a61aef8fbaa24bca8a53b876ae88 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 15:32:09 +0800 Subject: [PATCH 135/157] =?UTF-8?q?=E6=81=A2=E5=A4=8D=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/pom.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index dadaab41ed..c5f5ab311c 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -108,7 +108,7 @@ - + lb://epmet-auth-server lb://epmet-admin-server @@ -130,6 +130,7 @@ lb://oper-customize-server lb://oper-crm-server + lb://resi-guide-server From 0a752feafd3de56eb9ad2d903c1359c85a1e3ea6 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 15:35:13 +0800 Subject: [PATCH 136/157] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=A4=9A=E4=B8=AAapp?= =?UTF-8?q?Id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java | 5 +++++ .../java/com/epmet/service/impl/GovLoginServiceImpl.java | 3 +-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java index 0f1c8f6ff7..298fa611bc 100644 --- a/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java +++ b/epmet-auth/src/main/java/com/epmet/dto/form/GovWxmpEnteOrgFormDTO.java @@ -39,5 +39,10 @@ public class GovWxmpEnteOrgFormDTO implements Serializable { @NotBlank(message = "组织id不能为空",groups = {AddUserInternalGroup.class}) private String rootAgencyId; + /** + * desc:小程序appId + */ + private String appId; + } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index 5853df538d..d9134aabec 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -19,7 +19,6 @@ import com.epmet.constant.SmsTemplateConstant; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.GovStaffRoleDTO; -import com.epmet.dto.UserWechatDTO; import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.*; @@ -273,7 +272,7 @@ public class GovLoginServiceImpl implements GovLoginService { } CustomerStaffDTO customerStaff = customerStaffDTOResult.getData(); //2、解析微信用户 - WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode()); + WxMaJscode2SessionResult wxMaJscode2SessionResult = loginService.getWxMaUser(LoginConstant.APP_GOV, formDTO.getWxCode(), formDTO.getAppId()); //3、记录staff_wechat,并记录用户激活状态,激活时间 this.savestaffwechat(customerStaff.getUserId(), wxMaJscode2SessionResult.getOpenid()); From 9e17b707e969432224dd2d60812c525c526312c6 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 27 Jul 2020 16:00:38 +0800 Subject: [PATCH 137/157] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=BD=93=E9=AA=8C?= =?UTF-8?q?=E7=89=88=E4=BA=8C=E7=BB=B4=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/feign/OssFeignClient.java | 25 +++++++-- .../fallback/OssFeignClientFallback.java | 23 ++++---- .../com/epmet/controller/OssController.java | 12 ++-- .../epmet-third/epmet-third-server/pom.xml | 6 ++ .../epmet/service/impl/CodeServiceImpl.java | 42 ++++++++------ .../java/com/epmet/wxapi/param/WxExtJson.java | 56 ++++++++++++++++++- 6 files changed, 120 insertions(+), 44 deletions(-) diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java index 0d200a7177..47daa888cc 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/OssFeignClient.java @@ -10,12 +10,17 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.QrCodeDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.fallback.OssFeignClientFallback; +import feign.codec.Encoder; +import feign.form.spring.SpringFormEncoder; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.multipart.MultipartFile; /** * OSS @@ -23,18 +28,28 @@ import org.springframework.web.bind.annotation.PostMapping; * @author Mark sunlightcs@gmail.c om * @since 1.1.0 */ -@FeignClient(name = ServiceConstant.EPMET_OSS_SERVER, fallback = OssFeignClientFallback.class) +@FeignClient(name = ServiceConstant.EPMET_OSS_SERVER, configuration = OssFeignClient.MultipartSupportConfig.class, fallback = + OssFeignClientFallback.class) public interface OssFeignClient { /** * 文件上传 - * @param dto 文件 + * @param media 文件 * @return 返回路径 */ @PostMapping(value = "oss/file/uploadwximg", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - Result uploadWxImg(QrCodeDTO dto); + Result uploadWxImg(@RequestPart(value = "media") MultipartFile media); @PostMapping(value ="oss/file/uploadqrcode", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) - Result uploadQrCode(QrCodeDTO dto ); + Result uploadQrCode(@RequestPart(value = "file") MultipartFile file); + + + @Configuration + class MultipartSupportConfig { + @Bean + public Encoder feignFormEncoder() { + return new SpringFormEncoder(); + } + } } diff --git a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java index eb8f1b4b8b..0158f7f017 100644 --- a/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java +++ b/epmet-module/epmet-oss/epmet-oss-client/src/main/java/com/epmet/feign/fallback/OssFeignClientFallback.java @@ -1,8 +1,8 @@ /** * Copyright (c) 2018 人人开源 All rights reserved. - * + *

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

* 版权所有,侵权必究! */ @@ -11,8 +11,6 @@ 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.QrCodeDTO; -import com.epmet.dto.UploadDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.feign.OssFeignClient; import org.springframework.stereotype.Component; @@ -27,13 +25,14 @@ import org.springframework.web.multipart.MultipartFile; @Component public class OssFeignClientFallback implements OssFeignClient { - @Override - public Result uploadWxImg(QrCodeDTO dto) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadWxImg", dto); - } + @Override + public Result uploadWxImg(MultipartFile media) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadWxImg", media); + } + + @Override + public Result uploadQrCode(MultipartFile file) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadQrCode", file); + } - @Override - public Result uploadQrCode(QrCodeDTO dto) { - return ModuleUtils.feignConError(ServiceConstant.EPMET_OSS_SERVER, "uploadQrCode", dto); - } } diff --git a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java index e9f05c53cd..5b3e3bee6b 100644 --- a/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java +++ b/epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/controller/OssController.java @@ -18,7 +18,6 @@ import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AliyunGroup; import com.epmet.commons.tools.validator.group.QcloudGroup; import com.epmet.commons.tools.validator.group.QiniuGroup; -import com.epmet.dto.QrCodeDTO; import com.epmet.dto.UploadDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.OssEntity; @@ -143,16 +142,13 @@ public class OssController { } @PostMapping("uploadwximg") - public Result uploadWxImg(QrCodeDTO dto) { - return ossService.uploadImg(dto.getMedia()); + public Result uploadWxImg(@RequestPart("media") MultipartFile media) { + return ossService.uploadImg(media); } @PostMapping("uploadqrcode") - public Result uploadQrCode(QrCodeDTO dto) { - String url = OssFactory.build().uploadSuffix(dto.getQrCode(), "jpg"); - UploadImgResultDTO result = new UploadImgResultDTO(); - result.setUrl(url); - return new Result().ok(result); + public Result uploadQrCode(@RequestPart(value = "file") MultipartFile file) { + return ossService.uploadImg(file); } /** * 上传客户logo(考虑到以后可能会针对不同的业务有不同的限制条件,这里不再使用通用的接口 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index 283c78d2d9..df429c2210 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -141,6 +141,12 @@ 2.0.0 compile + + org.springframework + spring-test + 5.1.12.RELEASE + compile + diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java index 18221f298e..fbaaef13fc 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/CodeServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.RenException; @@ -16,22 +17,20 @@ import com.epmet.dto.result.*; import com.epmet.feign.OperCrmOpenFeignClient; import com.epmet.feign.OssFeignClient; import com.epmet.service.*; -import com.epmet.wxapi.param.WxMaCodeAuditStatusReq; -import com.epmet.wxapi.param.WxMaCodeCommitReq; -import com.epmet.wxapi.param.WxMaCodeSubmitAuditRequest; -import com.epmet.wxapi.param.WxMaNewsReq; +import com.epmet.wxapi.param.*; import com.epmet.wxapi.result.*; import com.epmet.wxapi.service.WxMaCodeService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.mock.web.MockMultipartFile; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStream; -import java.nio.file.Files; import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -68,8 +67,6 @@ public class CodeServiceImpl implements CodeService { private OssFeignClient ossFeignClient; @Autowired private PaCustomerService paCustomerService; - @Autowired - private WxMaCodeService wxsMaCodeService; @Override public List templateList() { @@ -104,6 +101,15 @@ public class CodeServiceImpl implements CodeService { return codeExtDTO.getExtJson(); } + public static void main(String[] args) { + String json = "{\"extEnable\":true,\"extAppid\":\"wx2679392c4cc2af22\",\"directCommit\":false,\"ext\":{\"extAppid\":\"wx2679392c4cc2af22\",\"footbar\":{\"work\":{\"name\":\"工作\",\"pageTile\":\"工作\"},\"org\":{\"name\":\"组织\",\"pageTile\":\"组织\"},\"data\":{\"name\":\"数据\",\"pageTile\":\"数据\"},\"find\":{\"name\":\"更多\",\"pageTile\":\"更多\"}}}}"; + WxExtJson wxExtJson = JSONObject.parseObject(json, WxExtJson.class); + wxExtJson.setExtAppid("123456"); + wxExtJson.getExt().setExtAppid("123456"); + String extJson = JSON.toJSONString(wxExtJson); + System.out.println(extJson); + } + @Override @Transactional(rollbackFor = Exception.class) public void upload(CodeUploadFormDTO formDTO) { @@ -120,20 +126,24 @@ public class CodeServiceImpl implements CodeService { throw new RenException("第三方配置不是有效的Json"); } + WxExtJson wxExtJson = JSONObject.parseObject(formDTO.getExtJson(), WxExtJson.class); + wxExtJson.setExtAppid(authInfo.getAuthorizerAppid()); + wxExtJson.getExt().setExtAppid(authInfo.getAuthorizerAppid()); + String extJson = JSON.toJSONString(wxExtJson); CodeExtDTO codeExtDTO = codeExtService.getExtByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); if (null == codeExtDTO) { codeExtDTO = new CodeExtDTO(); codeExtDTO.setCustomerId(formDTO.getCustomerId()); codeExtDTO.setClientType(formDTO.getClientType()); codeExtDTO.setAppId(authInfo.getAuthorizerAppid()); - codeExtDTO.setExtJson(formDTO.getExtJson()); + codeExtDTO.setExtJson(extJson); codeExtService.save(codeExtDTO); } - codeExtDTO.setExtJson(formDTO.getExtJson()); + codeExtDTO.setExtJson(extJson); codeExtService.update(codeExtDTO); WxMaCodeCommitReq request = ConvertUtils.sourceToTarget(formDTO, WxMaCodeCommitReq.class); - request.setExtJson(formDTO.getExtJson()); + request.setExtJson(extJson); //调用微信API上传代码 WxResult wxResult = wxMaCodeService.commit(authInfo.getAuthorizerAccessToken(), request); //上传失败,抛出异常 @@ -151,7 +161,7 @@ public class CodeServiceImpl implements CodeService { //将上传信息存入表中 CodeCustomerDTO codeCustomerDTO = ConvertUtils.sourceToTarget(formDTO, CodeCustomerDTO.class); codeCustomerDTO.setCustomerName(paCustomerDTO.getCustomerName()); - codeCustomerDTO.setExtJson(formDTO.getExtJson()); + codeCustomerDTO.setExtJson(extJson); codeCustomerDTO.setAppId(authInfo.getAuthorizerAppid()); codeCustomerDTO.setStatus(CodeConstant.UNAUDITED); codeCustomerService.save(codeCustomerDTO); @@ -374,9 +384,9 @@ public class CodeServiceImpl implements CodeService { AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(codeCustomerDTO.getCustomerId(), codeCustomerDTO.getClientType()); //调用微信API获取获取体验版二维码 WxResult wxResult = wxMaCodeService.getQrCode(authInfo.getAuthorizerAccessToken(), formDTO.getPath()); - QrCodeDTO qrCodeDTO = new QrCodeDTO(); - qrCodeDTO.setQrCode(wxResult.getData()); - Result uploadResult = ossFeignClient.uploadQrCode(qrCodeDTO); + MultipartFile file = null; + file = new MockMultipartFile("file", "QRCode.jpg", "image/jpeg", wxResult.getData()); + Result uploadResult = ossFeignClient.uploadQrCode(file); codeCustomerDTO.setQrCode(uploadResult.getData().getUrl()); codeCustomerService.update(codeCustomerDTO); result.setQrcode(uploadResult.getData().getUrl()); @@ -399,9 +409,7 @@ public class CodeServiceImpl implements CodeService { @Override public String mediaUpload(MediaUploadFormDTO formDTO) { try { - QrCodeDTO dto = new QrCodeDTO(); - dto.setMedia(formDTO.getMedia()); - Result uploadWxImg = ossFeignClient.uploadWxImg(dto); + Result uploadWxImg = ossFeignClient.uploadWxImg(formDTO.getMedia()); File file = new File(uploadWxImg.getData().getUrl()); //获取上传代码信息 CodeCustomerDTO codeCustomerDTO = codeCustomerService.get(formDTO.getCodeId()); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java index 13441e4573..8d6b843126 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/wxapi/param/WxExtJson.java @@ -1,5 +1,6 @@ package com.epmet.wxapi.param; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; import lombok.NoArgsConstructor; @@ -15,50 +16,101 @@ import java.io.Serializable; public class WxExtJson implements Serializable { private static final long serialVersionUID = -559311391779774945L; - + @JSONField(ordinal = 1) private boolean extEnable; + @JSONField(ordinal = 2) private String extAppid; + @JSONField(ordinal = 3) private boolean directCommit; + @JSONField(ordinal = 4) private ExtBean ext; @NoArgsConstructor @Data - private static class ExtBean { + public static class ExtBean { + @JSONField(ordinal = 1) private String extAppid; + @JSONField(ordinal = 2) private FootbarBean footbar; @NoArgsConstructor @Data private static class FootbarBean { + @JSONField(ordinal = 1) private WorkBean work; + @JSONField(ordinal = 2) private OrgBean org; + @JSONField(ordinal = 3) private DataBean data; + @JSONField(ordinal = 4) private FindBean find; + @JSONField(ordinal = 5) + private GardenBean garden; + @JSONField(ordinal = 6) + private IssueBean issue; + @JSONField(ordinal = 7) + private GroupBean group; @NoArgsConstructor @Data private static class WorkBean { + @JSONField(ordinal = 1) private String name; + @JSONField(ordinal = 2) private String pageTile; } @NoArgsConstructor @Data private static class OrgBean { + @JSONField(ordinal = 1) private String name; + @JSONField(ordinal = 2) private String pageTile; } @NoArgsConstructor @Data private static class DataBean { + @JSONField(ordinal = 1) private String name; + @JSONField(ordinal = 2) private String pageTile; } @NoArgsConstructor @Data private static class FindBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class GardenBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + + } + + @NoArgsConstructor + @Data + private static class IssueBean { + @JSONField(ordinal = 1) + private String name; + @JSONField(ordinal = 2) + private String pageTile; + } + + @NoArgsConstructor + @Data + private static class GroupBean { + @JSONField(ordinal = 1) private String name; + @JSONField(ordinal = 2) private String pageTile; } } From 7a75dd5afe5c00f5027470d10441de16f8953f27 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Mon, 27 Jul 2020 16:12:10 +0800 Subject: [PATCH 138/157] =?UTF-8?q?=E7=88=B1=E5=BF=83=E4=BA=92=E5=8A=A9-?= =?UTF-8?q?=E5=B1=85=E6=B0=91=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResiActListController.java | 7 ++- .../java/com/epmet/dao/HeartUserInfoDao.java | 4 +- .../com/epmet/service/ActLiveRecService.java | 6 +- .../service/impl/ActInfoServiceImpl.java | 6 +- .../service/impl/ActLiveRecServiceImpl.java | 57 ++++++++++++------- .../resources/mapper/HeartUserInfoDao.xml | 2 +- 6 files changed, 50 insertions(+), 32 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java index f77002c42c..c39e1a78b6 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiActListController.java @@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; /** * 居民端-活动相关api @@ -196,14 +197,14 @@ public class ResiActListController { /** * 活动详情-已结束-现场实况列表 * - * @param actId + * @param map{actId:""} * @return com.epmet.commons.tools.utils.Result * @Author zhangyong * @Date 13:39 2020-07-21 **/ @PostMapping("livereclist") - public Result liveRecList(@RequestBody String actId) { - return actLiveRecService.liveRecList(actId); + public Result liveRecList(@RequestBody Map map) { + return actLiveRecService.liveRecList(map); } // diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java index 71e1fc67cd..5e0bfb3785 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/HeartUserInfoDao.java @@ -49,11 +49,11 @@ public interface HeartUserInfoDao extends BaseDao { * 查询用户是否是志愿者:1是志愿者,0不是志愿者 * * @param userId - * @return java.lang.Integer + * @return java.lang.Boolean * @Author zhangyong * @Date 13:53 2020-07-22 **/ - Integer selectUserVolunteerFlag(@Param("userId") String userId); + Boolean selectUserVolunteerFlag(@Param("userId") String userId); /** * 爱心榜 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java index aae4ece4a6..9ebe84e2ff 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/ActLiveRecService.java @@ -24,6 +24,8 @@ import com.epmet.dto.form.resi.ResiActInsertLiveFormDTO; import com.epmet.dto.result.resi.ResiActLiveRecResultDTO; import com.epmet.entity.ActLiveRecEntity; +import java.util.Map; + /** * 活动实况记录 * @@ -35,12 +37,12 @@ public interface ActLiveRecService extends BaseService { /** * 活动详情-已结束-现场实况列表 * - * @param actId + * @param map * @return com.epmet.commons.tools.utils.Result * @Author zhangyong * @Date 13:39 2020-07-21 **/ - Result liveRecList(String actId); + Result liveRecList(Map map); /** * 活动-添加实况 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java index 8e6b0bcd5f..3890401d3e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/ActInfoServiceImpl.java @@ -199,6 +199,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl> actLookBack(ResiActBaseFormDTO formDTO) { + int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize(); + formDTO.setPageNo(pageIndex); List lookBackAct = baseDao.selectListLookBackAct(formDTO); return new Result>().ok(lookBackAct); } @@ -211,8 +213,8 @@ public class ActInfoServiceImpl extends BaseServiceImpl liveRecList(String actId) { + public Result liveRecList(Map map) { + // 数据汇总 + ResiActLiveRecResultDTO resultDto = new ResiActLiveRecResultDTO(); // 查询实况记录 - List actLives = baseDao.selectListActLives(actId); + List actLives = baseDao.selectListActLives(map.get("actId")); List userIds = new ArrayList<>(); List liveIds = new ArrayList<>(); for (ActLiveRecDTO actLive : actLives){ userIds.add(actLive.getUserId()); liveIds.add(actLive.getId()); } - // 查询用户微信基础信息 - Result> userWxInfos = epmetUserOpenFeignClient.queryUserBaseInfo(userIds); - // 根据活动实况id,查询对应实况的图片集合 - List actLiveImg = baseDao.selectListActLiveImg(liveIds); - // 数据汇总 - ResiActLiveRecResultDTO resultDto = new ResiActLiveRecResultDTO(); - List dataContainer = new ArrayList<>(); - for (int k = 0; k < actLives.size(); k++) { - Map map = new HashMap<>(); - map.put("nickname", userWxInfos.getData().get(k).getNickname()); - map.put("headImg", userWxInfos.getData().get(k).getHeadImgUrl()); - map.put("desc", actLives.get(k).getDesc()); - map.put("createdTime", actLives.get(k).getCreatedTime()); - // 查询打卡对应图片 - List imgUrlList = new ArrayList<>(); - for (ActLivePicDTO urlDto : actLiveImg) { - if (actLives.get(k).getId().equals(urlDto.getLiveId())) { - imgUrlList.add(urlDto.getPicUrl()); + if (actLives.size() > NumConstant.ZERO){ + // 查询用户微信基础信息 + Result> userWxInfos = epmetUserOpenFeignClient.queryUserBaseInfo(userIds); + if (userWxInfos.getData().size() > NumConstant.ZERO){ + // 根据活动实况id,查询对应实况的图片集合 + List actLiveImg = baseDao.selectListActLiveImg(liveIds); + + List dataContainer = new ArrayList<>(); + for (int k = 0; k < actLives.size(); k++) { + Map base = new HashMap<>(); + base.put("nickname", userWxInfos.getData().get(k).getNickname()); + base.put("headImg", userWxInfos.getData().get(k).getHeadImgUrl()); + base.put("desc", actLives.get(k).getDesc()); + base.put("createdTime", actLives.get(k).getCreatedTime()); + // 查询打卡对应图片 + List imgUrlList = new ArrayList<>(); + for (ActLivePicDTO urlDto : actLiveImg) { + if (actLives.get(k).getId().equals(urlDto.getLiveId())) { + imgUrlList.add(urlDto.getPicUrl()); + } + } + base.put("images", imgUrlList); + dataContainer.add(base); } + resultDto.setActLives(dataContainer); + resultDto.setActLiveNum(dataContainer.size()); + } else { + logger.error("未查到用户基础信息"); + throw new RenException("未查到用户基础信息"); } - map.put("images", imgUrlList); - dataContainer.add(map); } return new Result().ok(resultDto); } diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml index 3a9473fa15..9908c46e37 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/HeartUserInfoDao.xml @@ -32,7 +32,7 @@ - + UPDATE act_user_relation SET - - STATUS = #{status}, - - - CANCEL_TIME = #{cancelTime}, - CANCEL_REASON = #{cancelReason}, - + DEL_FLAG = '1', UPDATED_BY = #{userId}, From 99589dfa80902b3c8a940e3b948d2306b72b61f2 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 18:42:04 +0800 Subject: [PATCH 148/157] =?UTF-8?q?=E5=85=BC=E5=AE=B9appId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/redis/CustomerAppWxServiceUtil.java | 9 +++------ .../java/com/epmet/service/impl/LoginServiceImpl.java | 10 ++++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java index 4c2a0a0e38..9d74299267 100644 --- a/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java +++ b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java @@ -41,7 +41,7 @@ import java.util.stream.Collectors; */ @Component public class CustomerAppWxServiceUtil implements ApplicationRunner { - private Logger logger = LogManager.getLogger(CustomerAppWxServiceUtil.class); + private static Logger logger = LogManager.getLogger(CustomerAppWxServiceUtil.class); /** * 过期时长为30分钟,单位:秒 @@ -58,10 +58,7 @@ public class CustomerAppWxServiceUtil implements ApplicationRunner { private static Map maServices = Maps.newHashMap(); - private void initWxMa() { - - } - public WxMaService getWxMaService(String appId) { + public static WxMaService getWxMaService(String appId) { WxMaService wxMaService = maServices.get(appId); if (wxMaService == null){ logger.error("getMaService appId:{} is not config from customer_app",appId); @@ -90,7 +87,7 @@ public class CustomerAppWxServiceUtil implements ApplicationRunner { try { Result> configAllAppResult = operCrmOpenFeignClient.getConfigAllApp(); logger.info("initWxMa operCrmOpenFeignClient.getConfigAllApp result:{}", JSON.toJSONString(configAllAppResult)); - if (configAllAppResult == null || configAllAppResult.success()){ + if (configAllAppResult == null || !configAllAppResult.success()){ logger.info("initWxMa operCrmOpenFeignClient.getConfigAllApp fail"); return; } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index 89fbdbebb0..62b3e43892 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -67,8 +67,6 @@ public class LoginServiceImpl implements LoginService { @Autowired private OperAccessOpenFeignClient operAccessOpenFeignClient; - @Autowired - private CustomerAppWxServiceUtil customerAppWxServiceUtil; /** * 居民端微信小程序登录 @@ -116,7 +114,11 @@ public class LoginServiceImpl implements LoginService { WxMaJscode2SessionResult wxMaJscode2SessionResult = null; try { if (StringUtils.isNotBlank(appId)){ - wxMaJscode2SessionResult = customerAppWxServiceUtil.getWxMaService(appId).jsCode2SessionInfo(wxCode); + WxMaService wxMaService = CustomerAppWxServiceUtil.getWxMaService(appId); + if (wxMaService == null){ + throw new RenException("解析微信用户信息失败"); + } + wxMaJscode2SessionResult = wxMaService.jsCode2SessionInfo(wxCode); }else{ if (LoginConstant.APP_GOV.equals(app)) { wxMaJscode2SessionResult = wxMaServiceUtils.govWxMaService().jsCode2SessionInfo(wxCode); @@ -146,7 +148,7 @@ public class LoginServiceImpl implements LoginService { ValidatorUtils.validateEntity(formDTO, ResiWxPhoneFormDTO.AddUserInternalGroup.class); WxMaService wxMaService = null; if (StringUtils.isNotBlank(formDTO.getAppId())){ - wxMaService = customerAppWxServiceUtil.getWxMaService(formDTO.getAppId()); + wxMaService = CustomerAppWxServiceUtil.getWxMaService(formDTO.getAppId()); }else{ wxMaService = wxMaServiceUtils.resiWxMaService(); } From 3fe8621ce0af534c0f582b59d600eb55ecdb5bae Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 27 Jul 2020 18:43:52 +0800 Subject: [PATCH 149/157] =?UTF-8?q?=E9=83=A8=E7=BD=B2user?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/deploy/docker-compose-prod.yml | 2 +- epmet-auth/deploy/docker-compose-test.yml | 2 +- epmet-auth/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index d0300473bc..b95ceaba5d 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.54 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.55 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/deploy/docker-compose-prod.yml b/epmet-auth/deploy/docker-compose-prod.yml index be9ebc4737..0afba96920 100644 --- a/epmet-auth/deploy/docker-compose-prod.yml +++ b/epmet-auth/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.54 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.55 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/deploy/docker-compose-test.yml b/epmet-auth/deploy/docker-compose-test.yml index ec420ae27e..ff10d2224e 100644 --- a/epmet-auth/deploy/docker-compose-test.yml +++ b/epmet-auth/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.54 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.55 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index c9f4218ed0..affb22da4d 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.54 + 0.3.55 com.epmet epmet-cloud From cfb591219155c3ecfb808926e13fcaa9e4875db3 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 27 Jul 2020 18:43:56 +0800 Subject: [PATCH 150/157] =?UTF-8?q?heart-work:=E6=B5=8B=E8=AF=95bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/dto/ActInfoDTO.java | 2 +- .../work/AuditingUserDetailResultDTO.java | 1 + .../result/work/ReEditActInfoResultDTO.java | 2 +- .../epmet/constant/ActMessageConstant.java | 6 +- .../java/com/epmet/dao/LatestActInfoDao.java | 9 +++ .../impl/LatestActContentServiceImpl.java | 1 + .../impl/LatestActInfoServiceImpl.java | 13 ++-- .../service/impl/WorkActServiceImpl.java | 60 +++++++------------ .../service/impl/WorkActUserServiceImpl.java | 6 ++ .../main/resources/mapper/ActContentDao.xml | 2 +- .../resources/mapper/LatestActContentDao.xml | 2 +- .../resources/mapper/LatestActInfoDao.xml | 5 ++ 12 files changed, 60 insertions(+), 49 deletions(-) diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java index 5b6859f190..b747b77985 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/ActInfoDTO.java @@ -112,7 +112,7 @@ public class ActInfoDTO implements Serializable { /** * 活动签到打卡位置经度 */ - private BigDecimal signinLongitude; + private BigDecimal signInLongitude; /** * 活动签到打卡位置纬度 diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java index b04972b890..764c81b2fe 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/AuditingUserDetailResultDTO.java @@ -100,4 +100,5 @@ public class AuditingUserDetailResultDTO implements Serializable { * 审核历史(待审核界面需要显示) */ private HistoricalAuditResult historicalAuditResult; + private String actUserRelationId; } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java index a0191a6f3a..80f668afae 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/work/ReEditActInfoResultDTO.java @@ -107,7 +107,7 @@ public class ReEditActInfoResultDTO implements Serializable { /** * 活动签到打卡位置经度 */ - private BigDecimal signinLongitude; + private BigDecimal signInLongitude; /** * 活动签到打卡位置纬度 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java index 8f711ee2d2..5fcbb51334 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/constant/ActMessageConstant.java @@ -11,15 +11,15 @@ public interface ActMessageConstant { /** * 报名审核成功,给居民端用户发送消息 */ - String AUDIT_PASSED="您报名的活动%s,已审核通过"; + String AUDIT_PASSED="您报名的%s活动,已审核通过"; /** * 拒绝用户的报名,给居民端用户发送消息 */ - String AUDIT_REFUSED="您报名的活动%s,审核未通过,原因:%s"; + String AUDIT_REFUSED="您报名的%s活动,审核未通过,原因:%s"; /** * 活动被取消,给已经通过审核的居民端用户,发送消息 */ - String ACT_CANCELED="您报名的活动%s,已取消,原因:%s"; + String ACT_CANCELED="您报名的%s活动,已取消,原因:%s"; /** * 发放积分(结束活动)时调用消息的备注 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java index d1a00cb15d..caf1adf16f 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/LatestActInfoDao.java @@ -58,4 +58,13 @@ public interface LatestActInfoDao extends BaseDao { * @Date 2020/7/21 17:56 **/ ActPreviewResultDTO previewActInfo(String actDraftId); + + /** + * @return int + * @param id + * @author yinzuomei + * @description 逻辑删除表记录 + * @Date 2020/7/27 17:10 + **/ + int updateToDelById(String id); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java index 38930a1467..9d73f7866a 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/LatestActContentServiceImpl.java @@ -124,6 +124,7 @@ public class LatestActContentServiceImpl extends BaseServiceImpl implements LatestActInfoService { - + private Logger logger = LogManager.getLogger(LatestActInfoServiceImpl.class); @Autowired private LatestActInfoRedis latestActInfoRedis; @Autowired @@ -96,13 +97,16 @@ public class LatestActInfoServiceImpl extends BaseServiceImpl actContentEntityList=this.constructActContent(formDTO.getActContent(),actInfoEntity.getId()); @@ -169,44 +169,23 @@ public class WorkActServiceImpl implements WorkActService { /** * @return void - * @param formDTO + * @param actInfoEntity * @author yinzuomei * @description 第一次发布 * @Date 2020/7/24 16:45 **/ - private void checkPublishFormDTO(PublishActInfoFormDTO formDTO) { + private void checkPublishFormDTO(ActInfoEntity actInfoEntity) { //1、活动预计开始时间、活动预计结束时间 - if(formDTO.getActStartTime().compareTo(formDTO.getActEndTime())!=-1){ + if(actInfoEntity.getActStartTime().compareTo(actInfoEntity.getActEndTime())!=-1){ throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode()); } //2、签到开始时间、签到结束时间 - if(formDTO.getSignInStartTime().compareTo(formDTO.getSignInEndTime())!=-1){ + if(actInfoEntity.getSignInStartTime().compareTo(actInfoEntity.getSignInEndTime())!=-1){ throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode()); } + int n=actInfoEntity.getSignUpEndTime().compareTo(actInfoEntity.getActStartTime()); //3、报名截止时间(应该在活动预计开始时间之前) - if(formDTO.getSignUpEndTime().compareTo(formDTO.getActStartTime())!=-1){ - throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); - } - } - - /** - * @return void - * @param formDTO - * @author yinzuomei - * @description 重新发布 - * @Date 2020/7/24 16:45 - **/ - private void checkRePublishFormDTO(RePublishFormDTO formDTO) { - //1、活动预计开始时间、活动预计结束时间 - if(formDTO.getActStartTime().compareTo(formDTO.getActEndTime())!=-1){ - throw new RenException(EpmetErrorCode.ACT_START_TIME_ERROR.getCode()); - } - //2、签到开始时间、签到结束时间 - if(formDTO.getSignInStartTime().compareTo(formDTO.getSignInEndTime())!=-1){ - throw new RenException(EpmetErrorCode.ACT_SIGN_IN_START_TIME_ERROR.getCode()); - } - //3、报名截止时间(应该在活动预计开始时间之前) - if(formDTO.getSignUpEndTime().compareTo(formDTO.getActStartTime())!=-1){ + if(n!=-1){ throw new RenException((EpmetErrorCode.ACT_SIGN_UP_END_TIME_ERROR.getCode())); } } @@ -215,10 +194,10 @@ public class WorkActServiceImpl implements WorkActService { SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); try { - Date yesterDate=format.parse("2020-07-25 13:00:00"); - Date today=format.parse("2020-07-26 13:00:00"); - Date tommorrow=format.parse("2020-07-27 13:00:00"); - Date today1=format.parse("2020-07-26 13:00:00"); + Date yesterDate=format.parse("2020-07-26 13:00:00"); + Date today=format.parse("2020-07-27 13:00:00"); + Date tommorrow=format.parse("2020-07-28 13:00:00"); + Date today1=format.parse("2020-07-27 13:00:00"); System.out.println(yesterDate.compareTo(today)); System.out.println(tommorrow.compareTo(today)); System.out.println(today.compareTo(today1)); @@ -644,6 +623,7 @@ public class WorkActServiceImpl implements WorkActService { List userMessageFormDTOS=new ArrayList<>(); for(String userId:userIdList){ UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + userMessageFormDTO.setCustomerId(actInfoDTO.getCustomerId()); userMessageFormDTO.setUserId(userId); userMessageFormDTO.setGridId(StrConstant.STAR); userMessageFormDTO.setApp(AppClientConstant.APP_RESI); @@ -960,6 +940,9 @@ public class WorkActServiceImpl implements WorkActService { if(!actInfoDTO.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } + if(!ActConstant.ACT_STATUS_PUBLISHED.equals(actInfoDTO.getActStatus())){ + throw new RenException("只有进行中的活动才可以编辑"); + } ReEditActInfoResultDTO resultDTO= ConvertUtils.sourceToTarget(actInfoDTO, ReEditActInfoResultDTO.class); resultDTO.setActId(actId); List actContent=actContentDao.selectByActId(actId); @@ -984,15 +967,18 @@ public class WorkActServiceImpl implements WorkActService { if(!originalActInfo.getCreatedBy().equals(loginUserUtil.getLoginUserId())){ throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode()); } + if(!ActConstant.ACT_STATUS_PUBLISHED.equals(originalActInfo.getActStatus())){ + throw new RenException("只有进行中的活动才可以编辑"); + } + //构造属性保存活动属性,活动内容 + ActInfoEntity newActInfoEntity=this.constructRePublishActInfo(rePublishFormDTO); //校验参数 - this.checkRePublishFormDTO(rePublishFormDTO); + this.checkPublishFormDTO(newActInfoEntity); PublishActResultDTO publishActResultDTO=new PublishActResultDTO(); //内容审核(活动标题、招募要求、活动内容图文) this.auditRePublishAct(rePublishFormDTO); logger.info("重新发布活动,审核成功"); - //构造属性保存活动属性,活动内容 - ActInfoEntity newActInfoEntity=this.constructRePublishActInfo(rePublishFormDTO); newActInfoEntity.setId(rePublishFormDTO.getActId()); actInfoDao.updateById(newActInfoEntity); //删除原来的 diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java index 411e6f1cc6..c2f121e972 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -278,6 +279,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { UserBaseInfoResultDTO userBaseInfo=queryUserBaseInfo(actUserRelationDTO.getUserId()); AuditingUserDetailResultDTO resultDTO=new AuditingUserDetailResultDTO(); //基本信息赋值 + resultDTO.setActUserRelationId(actUserRelationDTO.getId()); resultDTO.setActId(actUserRelationDTO.getActId()); resultDTO.setUserId(actUserRelationDTO.getUserId()); resultDTO.setRealName(userBaseInfo.getRealName()); @@ -318,6 +320,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { cancelResult.setCancelTime(actUserRelationDTO.getCancelTime()); resultDTO.setCancelResult(cancelResult); } + resultDTO.setVolunteerFlag(getVolunteerFlag(actUserRelationDTO.getUserId())); return resultDTO; } @@ -522,6 +525,7 @@ public class WorkActUserServiceImpl implements WorkActUserService { private void saveUserMessage(ActUserRelationEntity actUserRelationEntity, String type,ActInfoEntity actInfo) { try { UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO(); + userMessageFormDTO.setCustomerId(actInfo.getCustomerId()); userMessageFormDTO.setUserId(actUserRelationEntity.getUserId()); userMessageFormDTO.setGridId(StrConstant.STAR); userMessageFormDTO.setApp(AppClientConstant.APP_RESI); @@ -535,6 +539,8 @@ public class WorkActUserServiceImpl implements WorkActUserService { Result result = epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO); if (result.success()) { logger.info("审核成功,已成功发送站内信"); + }else{ + logger.error("审核成功,发送站内信失败"+ JSON.toJSONString(result)); } } catch (Exception e) { logger.error("审核结果,发送站内信异常", e.getMessage()); diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml index 10b82ac717..6a0027bd5e 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/ActContentDao.xml @@ -27,7 +27,7 @@ WHERE ac.DEL_FLAG = '0' AND ac.ACT_ID = #{actId} - order by orderNum asc + order by ORDER_NUM asc diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml index a4aade9b30..c11277cc32 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActContentDao.xml @@ -53,6 +53,6 @@ - delete from latest_act_content lac where lac.ACT_ID=#{actId} + delete from latest_act_content where ACT_ID=#{actId} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml index 28b43cd8cf..a2e33b2245 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/LatestActInfoDao.xml @@ -118,4 +118,9 @@ lai.DEL_FLAG = '0' AND lai.ID = #{actDraftId} + + + + update latest_act_info set DEL_FLAG='1' where id=#{id} + \ No newline at end of file From 267e0f1636a48dff0a73b735ff042b4b6a70c2ea Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 27 Jul 2020 18:46:44 +0800 Subject: [PATCH 151/157] =?UTF-8?q?heart-work:=E6=B5=8B=E8=AF=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java index 76ac6ca878..b8f1def9d3 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java @@ -22,6 +22,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:47 */ +//@FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = EpmetMessageOpenFeignClientFallback.class,url = "http://127.0.0.1:8085") @FeignClient(name = ServiceConstant.EPMET_MESSAGE_SERVER, fallback = EpmetMessageOpenFeignClientFallback.class) public interface EpmetMessageOpenFeignClient { /** From 1333ecee5c7958b9e6119a277215da8c5bcb33b7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 27 Jul 2020 18:57:32 +0800 Subject: [PATCH 152/157] heart-work:gateway+1 --- epmet-gateway/deploy/docker-compose-dev.yml | 2 +- epmet-gateway/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-gateway/deploy/docker-compose-dev.yml b/epmet-gateway/deploy/docker-compose-dev.yml index 702ce1f34e..b4dc44a7df 100644 --- a/epmet-gateway/deploy/docker-compose-dev.yml +++ b/epmet-gateway/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-gateway-server: container_name: epmet-gateway-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.27 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-gateway:0.3.28 ports: - "8080:8080" network_mode: host # 使用现有网络 diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 543e0e4545..3944de1695 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.27 + 0.3.28 com.epmet epmet-cloud From f489119f6f8a2c789c1249cb7403ceb4b105b6f6 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Tue, 28 Jul 2020 09:03:43 +0800 Subject: [PATCH 153/157] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E6=96=B9=E5=B9=B3=E5=8F=B0-{APPID}/callback=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E8=8E=B7=E5=8F=96component=5Faccess=5Ftoken=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/constant/ModuleConstant.java | 3 + .../epmet/controller/WarrantController.java | 3 +- .../ComponentVerifyTicketServiceImpl.java | 82 +++++++++---------- .../service/impl/WarrantServiceImpl.java | 60 +++++++------- 4 files changed, 77 insertions(+), 71 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java index d787e30ed1..1bc5e3b98b 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/constant/ModuleConstant.java @@ -75,6 +75,9 @@ public interface ModuleConstant { //代码审核结果推送 如下 String EVENT = "Event"; + String MSG_TYPE = "MsgType"; + String EVENT_LOW = "event"; + String TEXT = "text"; String WEAPP_AUDIT_SUCCESS = "weapp_audit_success"; //审核通过 String WEAPP_AUDIT_FAIL = "weapp_audit_fail"; //审核不通过 String WEAPP_AUDIT_DELAY = "weapp_audit_delay"; //审核延后 diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java index 2760162a5c..90139540e1 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/WarrantController.java @@ -6,6 +6,7 @@ import lombok.extern.slf4j.Slf4j; import org.dom4j.DocumentException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -25,7 +26,7 @@ public class WarrantController { @Autowired private WarrantService warrantService; - @RequestMapping(value ="/{APPID}/callback") + @PostMapping(value ="/{APPID}/callback") public String acceptMessageAndEvent(HttpServletRequest request, @PathVariable("APPID") String appid, HttpServletResponse response)throws IOException, DocumentException, AesException { return warrantService.acceptMessageAndEvent(request, appid, response); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java index d00460d8a0..85986d041e 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java @@ -201,24 +201,26 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe jsonObject.put(ModuleConstant.TICKET_UNDERLINE_KEY, componentVerifyTicket); String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_COMPONENT_TOKEN_URL, JSON.toJSONString(jsonObject)).getData(); Map hashMap = JSON.parseObject(post, Map.class); - String componentAccessToken = hashMap.get(COMPONENT_ACCESS_TOKEN).toString(); - Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); - Date expiresInTime = this.countExpirationTime(expiresIn.toString()); - if (StringUtils.isNotEmpty(componentAccessToken)) { - //令牌信息存DB - ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); - formDTO.setComponentAccessToken(componentAccessToken); - formDTO.setExpiresInTime(expiresInTime); - //先逻辑删,在插入 - log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN); - componentAccessTokenDao.deleteOldComponentAccessToken(); - componentAccessTokenDao.insertComponentAccessToken(formDTO); - //存缓存 - redisThird.setComponentAccessToken(componentAccessToken); - } else { - throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN); + if (!hashMap.containsKey(ModuleConstant.ERR_MSG)) { + String componentAccessToken = hashMap.get(COMPONENT_ACCESS_TOKEN).toString(); + Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); + Date expiresInTime = this.countExpirationTime(expiresIn.toString()); + if (StringUtils.isNotEmpty(componentAccessToken)) { + //令牌信息存DB + ComponentAccessTokenFormDTO formDTO = new ComponentAccessTokenFormDTO(); + formDTO.setComponentAccessToken(componentAccessToken); + formDTO.setExpiresInTime(expiresInTime); + //先逻辑删,在插入 + log.info(ThirdRunTimeInfoConstant.START_DELETE_COMPONENT_ACCESS_TOKEN); + componentAccessTokenDao.deleteOldComponentAccessToken(); + componentAccessTokenDao.insertComponentAccessToken(formDTO); + //存缓存 + redisThird.setComponentAccessToken(componentAccessToken); + } else { + throw new RenException(ThirdRunTimeInfoConstant.FAILURE_ACCESS_TOKEN); + } + log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN); } - log.info(ThirdRunTimeInfoConstant.SUCCESS_ACCESS_TOKEN); } } @@ -232,31 +234,27 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe public String preAuthCode() { log.info(START_GET_PRE_AUTH_CODE); String preAuthCode = ""; - try { - String accessToken = redisThird.getComponentAccessToken(); - JSONObject jsonObject = new JSONObject(); - jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); - String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); - log.info(String.format(POST_RESULT,post)); - Map hashMap = JSON.parseObject(post, Map.class); - preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE).toString(); - Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); - Date expiresInTime = this.countExpirationTime(expiresIn.toString()); - if (StringUtils.isNotEmpty(preAuthCode)) { - //预授权码 存DB - PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO(); - formDTO.setPreAuthToken(preAuthCode); - formDTO.setExpiresInTime(expiresInTime); - //先逻辑删除,在插入DB - preAuthTokenDao.updateOldPreAuthCode(); - preAuthTokenDao.insertPreAuthToken(formDTO); - //预授权码 放入缓存 - redisThird.setPreAuthCode(preAuthCode); - } else { - throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE); - } - } catch (Exception e) { - e.printStackTrace(); + String accessToken = redisThird.getComponentAccessToken(); + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ModuleConstant.COMPONENT_APPID, componentAppId); + String post = HttpClientManager.getInstance().sendPostByJSON(WxMaCodeConstant.API_CREATE_PREAUTHCODE_URL + accessToken, JSON.toJSONString(jsonObject)).getData(); + log.info(String.format(POST_RESULT,post)); + Map hashMap = JSON.parseObject(post, Map.class); + preAuthCode = hashMap.get(ModuleConstant.PRE_AUTH_CODE).toString(); + Integer expiresIn = (Integer) hashMap.get(ModuleConstant.EXPIRES_IN); + Date expiresInTime = this.countExpirationTime(expiresIn.toString()); + if (StringUtils.isNotEmpty(preAuthCode)) { + //预授权码 存DB + PreAuthTokenFormDTO formDTO = new PreAuthTokenFormDTO(); + formDTO.setPreAuthToken(preAuthCode); + formDTO.setExpiresInTime(expiresInTime); + //先逻辑删除,在插入DB + preAuthTokenDao.updateOldPreAuthCode(); + preAuthTokenDao.insertPreAuthToken(formDTO); + //预授权码 放入缓存 + redisThird.setPreAuthCode(preAuthCode); + } else { + throw new RuntimeException(FAILURE_GET_PRE_AUTH_CODE); } log.info(END_GET_PRE_AUTH_CODE); return preAuthCode; diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java index d5a3d500af..c55f647789 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/WarrantServiceImpl.java @@ -90,35 +90,39 @@ public class WarrantServiceImpl implements WarrantService { // 将xml转为map Map result = WXXmlToMapUtil.multilayerXmlToMap(msg); Map xml = (Map) result.get(ModuleConstant.XML); - Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString()); - CodeAuditRecordFormDTO codeAuditRecord = componentVerifyTicketService.mapToEntity(xml, CodeAuditRecordFormDTO.class); - codeAuditRecord.setWechatCreateTime(new Date(createTime)); - String toUserName = codeAuditRecord.getToUserName();//小程序原始ID - CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName); - String clientType = customerIdAndClientResultDTO.getClientType(); - String customerId = customerIdAndClientResultDTO.getCustomerId(); - TemplateAndAppIdResultDTO templateAndAppId = codeCustomerDao.selectTemplateAndAppId(customerId, clientType); - String authAppId = templateAndAppId.getAuthAppId(); - String templateId = templateAndAppId.getTemplateId(); - codeAuditRecord.setClientType(clientType); - codeAuditRecord.setCustomerId(customerId); - codeAuditRecord.setAuthAppId(authAppId); - codeAuditRecord.setTemplateId(templateId); - //插入 代码审核 记录 - codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); - // 修改 code_audit_result 中的代码审核结果 - String event = codeAuditRecord.getEvent(); - String codeResult = null; - switch (event){ - case ModuleConstant.WEAPP_AUDIT_SUCCESS: - codeResult = ModuleConstant.AUDIT_SUCCESS; - case ModuleConstant.WEAPP_AUDIT_FAIL: - codeResult = ModuleConstant.AUDIT_FAILED; - case ModuleConstant.WEAPP_AUDIT_DELAY: - codeResult = ModuleConstant.DELAY; + if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.EVENT_LOW)) { + Long createTime = Long.valueOf(xml.get(ModuleConstant.CREATE_TIME).toString()); + CodeAuditRecordFormDTO codeAuditRecord = componentVerifyTicketService.mapToEntity(xml, CodeAuditRecordFormDTO.class); + codeAuditRecord.setWechatCreateTime(new Date(createTime)); + String toUserName = codeAuditRecord.getToUserName();//小程序原始ID + CustomerIdAndClientResultDTO customerIdAndClientResultDTO = miniInfoDao.selectCustomerIdAndClientByToUserName(toUserName); + String clientType = customerIdAndClientResultDTO.getClientType(); + String customerId = customerIdAndClientResultDTO.getCustomerId(); + TemplateAndAppIdResultDTO templateAndAppId = codeCustomerDao.selectTemplateAndAppId(customerId, clientType); + String authAppId = templateAndAppId.getAuthAppId(); + String templateId = templateAndAppId.getTemplateId(); + codeAuditRecord.setClientType(clientType); + codeAuditRecord.setCustomerId(customerId); + codeAuditRecord.setAuthAppId(authAppId); + codeAuditRecord.setTemplateId(templateId); + //插入 代码审核 记录 + codeAuditRecordDao.insertCodeAuditRecord(codeAuditRecord); + // 修改 code_audit_result 中的代码审核结果 + String event = codeAuditRecord.getEvent(); + String codeResult = null; + switch (event) { + case ModuleConstant.WEAPP_AUDIT_SUCCESS: + codeResult = ModuleConstant.AUDIT_SUCCESS; + case ModuleConstant.WEAPP_AUDIT_FAIL: + codeResult = ModuleConstant.AUDIT_FAILED; + case ModuleConstant.WEAPP_AUDIT_DELAY: + codeResult = ModuleConstant.DELAY; + } + String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); + codeAuditResultDao.updateAuditResult(customerId, codeCustomerId, codeResult); + }else if (xml.get(ModuleConstant.MSG_TYPE).equals(ModuleConstant.TEXT)){ + } - String codeCustomerId = codeCustomerDao.selectCodeCustomerId(codeAuditRecord); - codeAuditResultDao.updateAuditResult(customerId,codeCustomerId,codeResult); return ModuleConstant.SUCCESS; } } From 968ce35e23e2e179043dbf03bfe4713b27bb1624 Mon Sep 17 00:00:00 2001 From: zxc <954985706@qq.com> Date: Tue, 28 Jul 2020 09:08:36 +0800 Subject: [PATCH 154/157] =?UTF-8?q?epmet-third=E6=9C=8D=E5=8A=A1=E5=8D=87?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet-third-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-third/epmet-third-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml index fffb5e8bb2..9ee4c50dfa 100644 --- a/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-third/epmet-third-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-third-server: container_name: epmet-third-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.64 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-third-server:0.0.65 ports: - "8110:8110" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-third/epmet-third-server/pom.xml b/epmet-module/epmet-third/epmet-third-server/pom.xml index bca0449ec5..a8b968cfb6 100644 --- a/epmet-module/epmet-third/epmet-third-server/pom.xml +++ b/epmet-module/epmet-third/epmet-third-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.0.64 + 0.0.65 com.epmet From ab7bb9827acd9e44e7d1e7cd21494bbae9c1d118 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 28 Jul 2020 09:11:44 +0800 Subject: [PATCH 155/157] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E5=85=BC=E5=AE=B9?= =?UTF-8?q?appId=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/redis/CustomerAppWxServiceUtil.java | 99 +++++++++---------- .../com/epmet/dto/CustomerAppRedisDTO.java | 55 +++++++++++ .../controller/CustomerAppController.java | 6 +- ...IdService.java => CustomerAppService.java} | 2 +- ...eImpl.java => CustomerAppServiceImpl.java} | 33 ++++++- 5 files changed, 135 insertions(+), 60 deletions(-) create mode 100644 epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppRedisDTO.java rename epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/{CustomerAppIdService.java => CustomerAppService.java} (96%) rename epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/{CustomerAppIdServiceImpl.java => CustomerAppServiceImpl.java} (71%) diff --git a/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java index 9d74299267..a7f36c75f0 100644 --- a/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java +++ b/epmet-auth/src/main/java/com/epmet/redis/CustomerAppWxServiceUtil.java @@ -13,9 +13,9 @@ import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.redis.RedisKeys; -import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerAppDTO; +import com.epmet.dto.CustomerAppRedisDTO; import com.epmet.feign.OperCrmOpenFeignClient; import com.google.common.collect.Maps; import org.apache.logging.log4j.LogManager; @@ -31,7 +31,6 @@ import org.springframework.util.CollectionUtils; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.stream.Collectors; /** * 客户app Redis @@ -50,75 +49,69 @@ public class CustomerAppWxServiceUtil implements ApplicationRunner { private final static String JSON_STR = "JSON"; @Autowired - private RedisUtils redisUtils; - @Autowired - private RedisTemplate redisTemplate; + private RedisTemplate redisTemplate; @Autowired private OperCrmOpenFeignClient operCrmOpenFeignClient; - private static Map maServices = Maps.newHashMap(); + private static Map maServices = Maps.newConcurrentMap(); public static WxMaService getWxMaService(String appId) { WxMaService wxMaService = maServices.get(appId); - if (wxMaService == null){ - logger.error("getMaService appId:{} is not config from customer_app",appId); + if (wxMaService == null) { + logger.error("getMaService appId:{} is not config from customer_app", appId); } return wxMaService; } - /*public String get(String appId) { - String key = RedisKeys.getAppSecretKey(appId); - String secret = (String) redisUtils.get(key); - if (StringUtils.isBlank(secret)) { - CustomerAppSecretFormDTO param = new CustomerAppSecretFormDTO(); - param.setAppId(appId); - Result result = operCrmOpenFeignClient.getSecretByAppId(param); - if (result.success()) { - secret = result.getData(); - if (StringUtils.isNotBlank(secret)) { - redisUtils.set(key, secret, MINUTE_THIRTY_EXPIRE); - } - } - } - return secret; - }*/ @Override public void run(ApplicationArguments args) { + Map maServicesNew = Maps.newConcurrentMap(); + SetOperations appSet = null; + List result = null; + String appKey = RedisKeys.getCustomerAppKey(); + try { + appSet = redisTemplate.opsForSet(); + Set members = appSet.members(appKey); + if (!CollectionUtils.isEmpty(members)) { + members.forEach(app -> { + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + config.setAppid(app.getAppId()); + config.setSecret(app.getSecret()); + config.setMsgDataFormat(JSON_STR); + WxMaService service = new WxMaServiceImpl(); + service.setWxMaConfig(config); + maServicesNew.put(app.getAppId(), service); + }); + } + } catch (Exception ex) { + logger.error("init wxMaService from redis error", ex); + } try { Result> configAllAppResult = operCrmOpenFeignClient.getConfigAllApp(); - logger.info("initWxMa operCrmOpenFeignClient.getConfigAllApp result:{}", JSON.toJSONString(configAllAppResult)); - if (configAllAppResult == null || !configAllAppResult.success()){ - logger.info("initWxMa operCrmOpenFeignClient.getConfigAllApp fail"); + logger.info("wxMaService operCrmOpenFeignClient.getConfigAllApp result:{}", JSON.toJSONString(configAllAppResult)); + if (configAllAppResult == null || !configAllAppResult.success()) { + logger.info("wxMaService operCrmOpenFeignClient.getConfigAllApp fail"); return; } - String appKey = RedisKeys.getCustomerAppKey(); - SetOperations appSet = redisTemplate.opsForSet(); - Set members = appSet.members(appKey); - - if ( !CollectionUtils.isEmpty(configAllAppResult.getData())) { - //if (!CollectionUtils.isEmpty(members) && CollectionUtils.isEmpty()){ - //todo - //} - maServices = configAllAppResult.getData().stream() - .map(a -> { - WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); - config.setAppid(a.getAppId()); - config.setSecret(a.getSecret()); - config.setMsgDataFormat(JSON_STR); + result = configAllAppResult.getData(); + result.forEach(app -> { + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + config.setAppid(app.getAppId()); + config.setSecret(app.getSecret()); + config.setMsgDataFormat(JSON_STR); - WxMaService service = new WxMaServiceImpl(); - service.setWxMaConfig(config); - redisTemplate.opsForSet().add(appKey,a.getSecret()); - return service; - }).collect(Collectors.toMap(s -> s.getWxMaConfig().getAppid(), a -> a)); - - - - } + WxMaService service = new WxMaServiceImpl(); + service.setWxMaConfig(config); + maServicesNew.put(app.getAppId(), service); + }); } catch (Exception e) { - logger.error("init wxMaservice exception",e); - } finally { - logger.info("init wxMaservice end"); + logger.error("init wxMaService from db exception", e); + } + if (maServicesNew.size() > 0) { + maServices = maServicesNew; + if (appSet != null && result != null) { + appSet.add(appKey, result); + } } } } diff --git a/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppRedisDTO.java b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppRedisDTO.java new file mode 100644 index 0000000000..21b46fc61c --- /dev/null +++ b/epmet-module/oper-crm/oper-crm-client/src/main/java/com/epmet/dto/CustomerAppRedisDTO.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.dto; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 客户表 app redis 缓存对象 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-07-27 + */ +@Data +public class CustomerAppRedisDTO implements Serializable { + private static final long serialVersionUID = -1619187268905620766L; + + /** + * 客户Id + */ + private String customerId; + + /** + * 小程序的appId + */ + private String appId; + + /** + * resi,work + */ + private String client; + + /** + * app的secret + */ + private String secret; + +} \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java index 4403ea0120..8d6315e4aa 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/controller/CustomerAppController.java @@ -25,7 +25,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.CustomerAppDTO; import com.epmet.dto.form.CustomerAppSecretFormDTO; -import com.epmet.service.CustomerAppIdService; +import com.epmet.service.CustomerAppService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -42,9 +42,9 @@ import java.util.Map; @RestController @RequestMapping("customerapp") public class CustomerAppController { - + @Autowired - private CustomerAppIdService customerAppIdService; + private CustomerAppService customerAppIdService; @GetMapping("page") public Result> page(@RequestParam Map params){ diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppService.java similarity index 96% rename from epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java rename to epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppService.java index f8036db8cd..db6c5de4a3 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppIdService.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/CustomerAppService.java @@ -31,7 +31,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-07-27 */ -public interface CustomerAppIdService extends BaseService { +public interface CustomerAppService extends BaseService { /** * 默认分页 diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppIdServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java similarity index 71% rename from epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppIdServiceImpl.java rename to epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java index 86c5689b64..c245f3a06e 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppIdServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerAppServiceImpl.java @@ -22,26 +22,53 @@ 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.redis.RedisKeys; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.CustomerAppDao; import com.epmet.dto.CustomerAppDTO; +import com.epmet.dto.CustomerAppRedisDTO; import com.epmet.entity.CustomerAppEntity; -import com.epmet.service.CustomerAppIdService; +import com.epmet.service.CustomerAppService; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.SetOperations; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; +import javax.annotation.PostConstruct; import java.util.List; import java.util.Map; /** - * 客户表 appId表 + * 客户表 app表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-07-27 */ +@Slf4j @Service -public class CustomerAppIdServiceImpl extends BaseServiceImpl implements CustomerAppIdService { +public class CustomerAppServiceImpl extends BaseServiceImpl implements CustomerAppService { + @Autowired + private RedisTemplate redisTemplate; + + @PostConstruct + private void initApp2Redis() { + SetOperations appSet = redisTemplate.opsForSet(); + List configAllApp = this.getConfigAllApp(); + if (!CollectionUtils.isEmpty(configAllApp)) { + String appKey = RedisKeys.getCustomerAppKey(); + List redisDTOS = ConvertUtils.sourceToTarget(configAllApp, CustomerAppRedisDTO.class); + if (CollectionUtils.isEmpty(redisDTOS)) { + log.error("initApp2Redis fail,convert return null"); + return; + } + redisDTOS.forEach(app -> appSet.add(appKey, app)); + log.info("initApp2Redis success"); + } + } @Override public PageData page(Map params) { From 7f87bc17fa4e142797841537e3684ba9a3da4be3 Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 28 Jul 2020 09:15:30 +0800 Subject: [PATCH 156/157] =?UTF-8?q?=E9=83=A8=E7=BD=B2crm=20auth=20?= =?UTF-8?q?=E6=89=80=E6=9C=89=E7=8E=AF=E5=A2=83=E7=89=88=E6=9C=AC=E5=8F=B7?= =?UTF-8?q?=E5=B7=B2=E5=8D=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/deploy/docker-compose-prod.yml | 2 +- epmet-auth/deploy/docker-compose-test.yml | 2 +- epmet-auth/pom.xml | 2 +- .../oper-crm/oper-crm-server/deploy/docker-compose-dev.yml | 2 +- .../oper-crm/oper-crm-server/deploy/docker-compose-prod.yml | 2 +- .../oper-crm/oper-crm-server/deploy/docker-compose-test.yml | 2 +- epmet-module/oper-crm/oper-crm-server/pom.xml | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index b95ceaba5d..e32e5e5432 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.55 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.56 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/deploy/docker-compose-prod.yml b/epmet-auth/deploy/docker-compose-prod.yml index 0afba96920..fda9a1724d 100644 --- a/epmet-auth/deploy/docker-compose-prod.yml +++ b/epmet-auth/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.55 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/epmet-auth:0.3.56 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/deploy/docker-compose-test.yml b/epmet-auth/deploy/docker-compose-test.yml index ff10d2224e..e71cca12c3 100644 --- a/epmet-auth/deploy/docker-compose-test.yml +++ b/epmet-auth/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.55 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.56 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index affb22da4d..8ffde60165 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.55 + 0.3.56 com.epmet epmet-cloud diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml index 9aed49d3e4..19e846598d 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.54 + image: 192.168.1.130:10080/epmet-cloud-dev/oper-crm-server:0.3.55 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml index baaa5112e5..baadb6b7b9 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-prod.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-prod - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-crm-server:0.3.54 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-master/oper-crm-server:0.3.55 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml index 5140018c27..56bcdfbcfe 100644 --- a/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml +++ b/epmet-module/oper-crm/oper-crm-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: oper-crm-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/oper-crm-server:0.3.54 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/oper-crm-server:0.3.55 ports: - "8090:8090" network_mode: host # 使用现有网络 diff --git a/epmet-module/oper-crm/oper-crm-server/pom.xml b/epmet-module/oper-crm/oper-crm-server/pom.xml index e06a4dda09..4fb5098016 100644 --- a/epmet-module/oper-crm/oper-crm-server/pom.xml +++ b/epmet-module/oper-crm/oper-crm-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.54 + 0.3.55 com.epmet oper-crm From 8f4c0550b368ecccb805d33a3dd1f230efbfce1a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 28 Jul 2020 09:15:40 +0800 Subject: [PATCH 157/157] heart-work:point+1 --- .../epmet-point-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-point/epmet-point-server/pom.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml index 60480da477..d37df7459f 100644 --- a/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-point/epmet-point-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: oper-crm-server: container_name: epmet-point-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.1 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-point-server:0.0.2 ports: - "8112:8112" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-point/epmet-point-server/pom.xml b/epmet-module/epmet-point/epmet-point-server/pom.xml index bb85bc3395..1b8007a7b7 100644 --- a/epmet-module/epmet-point/epmet-point-server/pom.xml +++ b/epmet-module/epmet-point/epmet-point-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - 0.0.1 + 0.0.2 epmet-point com.epmet @@ -128,7 +128,7 @@ 6379 123456 - false + true 122.152.200.70:8848 fcd6fc8f-ca3a-4b01-8026-2b05cdc5976b